Commit Graph

256 Commits

Author SHA1 Message Date
John McCall
dd99536d31 Move the metadata-pattern header into the type context descriptor.
This is yet another waypoint on the path towards the final
generic-metadata design.  The immediate goal is to make the
pattern a private implementation detail and to give the runtime
more visibility into the allocation and caching of generic types.
2018-02-26 12:10:24 -05:00
Joe Groff
4c2dde56a0 IRGen: Lower external key path components.
The key path pattern needs to include a reference to the external descriptor, along with hooks for lowering its type arguments and indices, if any. The runtime will need to instantiate and interpolate the external component when the key path object is instantiated.

While we're here, let's also reserve some more component header bytes for future expansion, since this is an ABI we're going to be living with for a while.
2018-02-23 19:03:15 -08:00
Jordan Rose
bb339778b4 Add @_weakLinked and a corresponding SIL attribute
This is mostly intended to be used for testing at this point; in the
long run, we want to be using availability information to decide
whether to weak-link something or not. You'll notice a bunch of FIXMEs
in the test case that we may not need now, but will probably need to
handle in the future.

Groundwork for doing backward-deployment execution tests.
2018-02-20 17:55:31 -08:00
David Ungar
026b850d0c Only pass output filename and main input file name for debugging into IRGenModule constructor. 2018-02-15 20:52:26 -07:00
David Ungar
e7a120f9b3 Avoid copying strings and PrimarySpecificPaths. 2018-02-15 15:34:55 -07:00
David Ungar
1f9a4f3591 Pass around arguments for primary-specific filenames.
Get rid of IRGenOpts attributes that won’t work for batch mode and also remove fakeNamesStub.
2018-02-15 15:34:55 -07:00
Doug Gregor
65b4c9a25a [Runtime] Reference ObjC class objects indirectly in conformance records.
Within conformance records, reference Objective-C class objects
indirectly so the runtime can update those references appropriately.
We don't need to do this for classes with Swift metadata.

Fixes the ABI-affecting part of rdar://problem/36310179.
2018-02-14 13:53:43 -08:00
Joe Groff
a7a3b17597 Replace nominal type descriptors with a hierarchy of context descriptors.
This new format more efficiently represents existing information, while
more accurately encoding important information about nested generic
contexts with same-type and layout constraints that need to be evaluated
at runtime. It's also designed with an eye to forward- and
backward-compatible expansion for ABI stability with future Swift
versions.
2018-01-29 16:19:25 -08:00
Doug Gregor
bc866086d9 [Mangling] Add a mangling for protocol conformance descriptors. 2018-01-17 10:33:30 -08:00
Slava Pestov
3dae007465 IRGen: Remove FieldAccess::NonConstantIndirect 2018-01-10 21:32:54 -08:00
Slava Pestov
3a24135478 IRGen: Add link entities for method dispatch thunks 2018-01-10 13:48:30 -08:00
Slava Pestov
4ed472a3c1 IRGen: Remove more dead code 2018-01-10 13:48:30 -08:00
John McCall
3c54c0edfc IRGen and basic optimizer support for coroutines. 2018-01-09 11:35:09 -05:00
Slava Pestov
217a548edf IRGen: Remove unused Function link entity kind 2018-01-08 21:02:33 -08:00
Slava Pestov
7f28f8a918 IRGen: Remove unused Other link entity kind 2018-01-08 20:50:21 -08:00
Slava Pestov
ce3e6c32bb IRGen: Remove unused ReflectionSuperclassDescriptor link entity kind 2018-01-08 20:46:02 -08:00
David Ungar
51d3165874 NFC: Clarifying uses of NumThreads.
Add hasMultipleGMs predicate to SILOptions.
Rename parameters to TBD file handling to better reflect abstraction boundary.

fix
2017-12-16 13:58:01 -08:00
Slava Pestov
e04f6e85bd IRGen: Add mangling for class metadata base offset
Also remove some misleading comments from GenDecl.cpp, where
we were giving examples of the old mangling.
2017-12-08 13:50:56 -08:00
Arnold Schwaighofer
f10f8d55dc IRGen: Nuke isSILOnly usage
It queried for [transparent] [serialized] definitions and only had an effect
when the module was compiled with -Onone because we remove [serialized]
as part of the optimizer pipeline.

It was causing bad effects when the module we imported from was compiled
with -Onone:

 The definition would be marked internal in said module.

and the importing module is compile with -O:

 The definition would be marked as available_externally.

because neither would guaranteed the presence of a definition of the
imported symbol available to the importer.

rdar://35100697
2017-11-13 14:33:39 -08:00
Roman Levenstein
9e07d5e0b0 Remove LinkEntity::isFragile which is always false now.
And remove all the code that is dead because of it.
2017-10-05 15:51:17 -07:00
Joe Groff
e1a05d768e IRGen: Un-bit-rot type layout verifier. 2017-09-19 14:45:44 -07:00
John McCall
9f8093f376 Create a central x-macro database of value witnesses. NFC. 2017-08-21 20:17:02 -04:00
John McCall
bd8246351e Add an AST-level abstraction for representing an abstract associated
type or conformance requirement.  NFC.
2017-08-10 20:15:20 -04:00
Joe Groff
101788dbd4 IRGen: Support for computed properties with dependent generic context.
Use the KeyPath implementation's new support for instantiating and dealing with captures to lower the generic context required to dispatch computed accessors with dependent generics.
2017-07-06 20:07:41 -07:00
Doug Gregor
623d72db3c [AST] Make the "requirement signature" of a protocol a flat array.
Rather than pretend that the requirement signature of a protocol is a
full, well-formed generic signature that one can meaningfully query,
treat it as a flat set of requirements. Nearly all clients already did
this, but make it official. NFC
2017-06-29 14:01:49 -07:00
Arnold Schwaighofer
ca63326e1b Delete unused existential value witnesses from the old existential
implementation

And remove the SWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS flag.
2017-06-02 14:34:41 -07:00
Joe Shajrawi
4dc0801785 IRGen Mandatory Module Pass: Pass large loadable types by address instead of by value 2017-05-01 12:04:06 -07:00
Huon Wilson
22c9e20a9d [IRGen] Completely remove witness table offsets.
These are unused.
2017-04-13 11:44:01 -07:00
Huon Wilson
ac0c76be12 [IRGen] Allow constructing UniversalLinkageInfo without an IRGenModule. 2017-04-06 17:31:45 -07:00
Huon Wilson
4e263a29d5 [IRGen] Compute conformance fragility based on containing module.
Previously this would be using the current module's resilience strategy,
rather than that of the one that contains the conformance.
2017-04-06 17:29:42 -07:00
Huon Wilson
0776b19958 [IRGen] Compute LinkInfo without an IGM. 2017-04-05 09:54:20 -07:00
Huon Wilson
65c6bdca90 [IRGen] Remove IGM argument, factor out conformance fragility logic. 2017-04-05 09:54:19 -07:00
Huon Wilson
3105c6ed00 [IRGen] Expose LinkInfo publicly, like LinkEntity. 2017-04-05 09:54:19 -07:00
Huon Wilson
19301e984f [IRGen] Remove unnecessary IRGenModule arguments. 2017-04-05 09:54:19 -07:00
Slava Pestov
8fe8b89b0f SIL: Terminology change: [fragile] => [serialized]
Also, add a third [serializable] state for functions whose bodies we
*can* serialize, but only do so if they're referenced from another
serialized function.

This will be used for bodies synthesized for imported definitions,
such as init(rawValue:), etc, and various thunks, but for now this
change is NFC.
2017-03-29 16:47:28 -07:00
Huon Wilson
655fa58620 [IRGen] Expose LinkEntity and ValueWitness publicly. 2017-03-23 15:58:29 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
44cd889924 [gardening] Fix recently introduced headers. 2016-12-21 21:19:10 +01:00
Arnold Schwaighofer
f1c2dcf1fa Add an alloc_stack hoisting pass.
Hoist alloc_stack instructions of 'generic' or resilient type to the entry
block. At the same time also perform a very simple stack coloring analysis.
This does not use a true liveness-analysis yet but rather employs some simple
conservative checks to see whether the live ranges of two alloc_stacks might
interfere.

AllocStackHoisting is an IRGen SIL pass. This allows for using IRGen's type
lowering information. Furthermore, hoisting and merging the alloc_stack
instructions this late does not interfere with SIL optimizations because the
resulting SIL never gets serialized.
2016-12-20 07:51:55 -08:00
Arnold Schwaighofer
f38c912878 Add support of a IRGen lowering SIL pipeline.
This pipeline is run as part of IRGen and has access to the IRGenModule.

Passes that run as part of this pipeline can query for the IRGenModule.

We will use it for the AllocStackHoisting pass. It wants to know if a type is of
non-fixed size.

To break the cyclic dependency between IRGen -> SILOptimizer -> IRGen that would
arise from the SILPassManager having to know about the createIRGENPASS()
function IRGen passes instead of exposing this function dynamically have to add
themselves to the pass manager.
2016-12-20 07:51:47 -08:00
Connor Wakamo
3e81830385 Move "include/swift/IRGen/Options.h" to "include/swift/AST/IRGenOptions.h".
This commit only moves the header file; updating the class so that it is no longer in the irgen namespace will be handled separately.

Swift SVN r11404
2013-12-18 01:17:09 +00:00
Jordan Rose
f7f253320a Re-add -l flag to Swift interim driver.
This is useful in -i and REPL modes, which do not have a separate linking
step. This version of the -l flag doesn't rely on TranslationUnit. I also
cleaned up the library-loading diagnostics.

Swift SVN r9488
2013-10-18 18:52:10 +00:00
Michael Gottesman
4dc7cee606 Add in the option -disable-llvm-optzns to swift.
-disable-llvm-optzns in clang tells the frontend to do everything it would
normally do at lets say -O2, except run the actual LLVM IR passes on the
resulting IR. This is useful in the case where one wants to look at the result
of a non gauranteed SIL optimization pass at the IR level without llvm
optimizations applied.

Swift SVN r8594
2013-09-24 16:48:09 +00:00
Joe Groff
e011a80ba8 Add an option to disable 'unimplemented' errors for dynamic type layout.
This will let me work on dynamic value type layout without leaving crash bugs for the library team to puzzle over.

Swift SVN r7897
2013-09-04 15:54:07 +00:00
Adrian Prantl
3313f8acbc Debug info: emit command line options.
Swift SVN r6778
2013-07-31 18:48:59 +00:00
Adrian Prantl
e147e1a385 Initialize the DebugInfo field in the default constructor of Options.
Swift SVN r6015
2013-07-05 20:37:10 +00:00
Adrian Prantl
2db17656f5 Debug Info: Wire up the CU's main file to point to the the first input file passed on the command line.
Swift SVN r5805
2013-06-25 22:07:33 +00:00
Adrian Prantl
0f7533dc7e Debug Info! Add basic support for line tables, compilation units, files,
and lexical scopes, which can be enabled through the new -g option.
When -g is enabled, line tables and scopes compile all the way
down to DWARF.

Changes to SIL:
- In addition to a SILLocation, every instruction now also has a pointer
  to a SILDebugScope (its containing lexical scope).
- Added LexicalScope, which is to be used for all Scopes we want to show
  up in the debug info.

Swift SVN r5772
2013-06-23 00:09:17 +00:00
Doug Gregor
07be3f3e7f Use the Objective-C runtime to unique selectors in JIT'd code.
When generating IR for the JIT, use sel_registerName() to unique the
selector references we generate. Static code doesn't need this
pessimization. Fixes <rdar://problem/12764732>.


Swift SVN r3403
2012-12-07 17:13:27 +00:00
Eli Friedman
760b49f4c6 Remove unused bit from IRGen options.
Swift SVN r1750
2012-05-05 03:19:11 +00:00