Commit Graph

9 Commits

Author SHA1 Message Date
Slava Pestov
91b980b94d SILGen: Dynamic, curry, foreign thunks should be serializable
This fixes a crash when referencing partially-applied methods
from @_inlineable functions.

Also, curry thunks for private methods do not need shared
linkage; private is sufficient.
2017-03-29 21:35:25 -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
Erik Eckstein
c4a11f4c92 tests: remove the now unused option -new-mangling-for-tests 2017-03-22 11:28:43 -07:00
Slava Pestov
4fa2ad8f55 SIL: Allocating entry points of designated initializers are [fragile]
The allocating entry point allocates an instance and calls the
initializing entry point. This should always be safe to inline
into resilient callers.
2017-03-12 23:14:51 -07:00
Erik Eckstein
a04a29af4f mangling: efficient mangling of repeated substitutions
Instead of appending a character for each substitution, we now prefix the substitution with the repeat count, e.g.
AbbbbB -> A5B

The same is done for known-type substitutions, e.g.
SiSiSi -> S3i

This significantly shrinks mangled names which contain large lists of the same type, like
  func foo(_ x: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int))

rdar://problem/30707433
2017-03-05 17:41:43 -08:00
Slava Pestov
e338a50bc3 SIL: Stored property initializers get the linkage of their containing type
This allows inlineble initializers to be defined on types that
have stored property initializers.

This is not the final behavior we want; in Swift 4 mode, we want
to give these shared linkage and make them fragile, and enforce
that stored property initializer expressions only reference other
public and versioned symbols.

This will match the behavior of default argument expressions in
Swift 4 mode, and I'll implement it when I do those.
2017-01-29 22:43:41 -08:00
Slava Pestov
5ce84060ca SIL: Enum case constructors are fragile if the enum is public or @_versioned 2017-01-29 22:43:40 -08:00
Erik Eckstein
1d3724666f tests: convert about 400 tests to the new mangling by using the -new-mangling-for-tests option
When the new mangling is enabled permanently, the option can be removed from the RUN command lines again.
2017-01-24 15:27:45 -08:00
Slava Pestov
4780b0bcdf AST: Introduce @_inlineable attribute
This attribute causes a function's body to be serialized, but unlike
@_transparent and @inline(__always), does not force it to be inlined.
2016-11-01 21:14:35 -07:00