Commit Graph

738 Commits

Author SHA1 Message Date
David Zarzycki
b61c111f12 [Serialization] NFC: Adopt reference storage type meta-programming macros 2018-06-30 06:44:34 -04:00
Bob Wilson
44712233c3 Merge remote-tracking branch 'origin/master' into master-next 2018-06-21 23:36:03 -07:00
Joe Groff
3e4e00c163 SILGen: Emit "trivial" property descriptors for properties that withhold no information about their implementation.
Client code can make a best effort at emitting a key path referencing a property with its publicly exposed API, which in the common case will match what the defining module would produce as the canonical key path component representation of the declaration. We can reduce the code size impact of these descriptors by not emitting them when there's no hidden or possibly-resiliently-changed-in-the-past information about a storage declaration, having the property descriptor symbol reference a sentinel value telling client key paths to use their definition of the key path component.
2018-06-21 15:18:24 -07:00
swift-ci
bfe796b93e Merge remote-tracking branch 'origin/master' into master-next 2018-06-16 01:32:31 -07:00
Doug Gregor
18569e5f77 Merge pull request #16963 from DougGregor/evaluator-type-checker
[Type checker] Use the request-evaluator in the type checker.
2018-06-15 22:41:31 -07:00
Bob Wilson
d933b5d60c Merge remote-tracking branch 'origin/master' into master-next 2018-06-15 20:20:25 -07:00
Jordan Rose
570ed72ea5 Add assertions to prevent truncation when using llvm::endian::Writer (#17266)
Also, stop serializing a few constant values, saving a tiny bit of
space in swiftmodule files.
2018-06-15 19:26:35 -07:00
Doug Gregor
ef337bb8ba [Evaluator] Use the request-evaluator for the superclass of a class.
Wire up the request-evaluator with an instance in ASTContext, and
introduce two request kinds: one to retrieve the superclass of a class
declaration, and one to compute the type of an entry in the
inheritance clause.

Teach ClassDecl::getSuperclass() to go through the request-evaluator,
centralizing the logic to compute and extract the superclass
type.

Fixes the crasher from rdar://problem/26498438.
2018-06-14 15:28:36 -07:00
Bob Wilson
796122fa45 Merge remote-tracking branch 'origin/master' into master-next 2018-06-12 15:06:47 -07:00
Slava Pestov
4de711edbe SIL: Only serialize sil_globals if they're [serialized] or referenced from inlinable bodies 2018-06-12 12:07:50 -07:00
Vedant Kumar
105a61e50d Use LLVM_DEBUG() instead of DEBUG()
Upstream has renamed the DEBUG() macro to LLVM_DEBUG. This updates swift
accordingly:

$ find . -name \*.cpp -print -exec sed -i "" -E "s/ DEBUG\(/ LLVM_DEBUG(/g" {} \;
2018-05-24 13:10:45 -07:00
Bob Wilson
1fc7f1391e [master-next] Update endian stream interface to match Clang r332757 2018-05-19 22:19:35 -07:00
swift-ci
bed7dc124d Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 16:09:03 -07:00
Andrew Trick
fe326266cc [exclusivity] Add a [builtin] flag to begin_[unpaired_]access.
This flag supports promoting KeyPath access violations to an error in
Swift 4+, while building the standard library in Swift 3 mode. This is
only necessary as long as the standard library continues to build in
Swift 3 mode. Once the standard library build migrates, it can all be
ripped out.

<rdar://problem/40115738> [Exclusivity] Enforce Keypath access as an error, not a warning in 4.2.
2018-05-09 21:42:37 -07:00
swift-ci
ad0712c02b Merge remote-tracking branch 'origin/master' into master-next 2018-05-04 08:49:40 -07:00
David Zarzycki
8c0c55539f [SIL] NFC: Rename misleading getSwiftRValueType() to getASTType()
Reference storage types are not RValues. Also, use more SILType helper
methods to avoid line wrap.
2018-05-04 08:14:38 -04:00
swift-ci
604f5930fe Merge remote-tracking branch 'origin/master' into master-next 2018-05-03 19:29:42 -07:00
swift-ci
5f22c9ceec Merge remote-tracking branch 'origin/master' into master-next 2018-05-03 13:49:29 -07:00
Doug Gregor
ba391b6b47 [Serialization] Remove (de-)serialization of Substitution.
We are no longer serializing Substitution (or SubstitutionList) anywhere, so
remove the code associated with it.
2018-05-03 13:40:52 -07:00
Doug Gregor
caad325a54 [Serialization] Serialize SIL *apply instructions using SubstitutionMaps. 2018-05-03 13:24:30 -07:00
swift-ci
5ce78da1d3 Merge remote-tracking branch 'origin/master' into master-next 2018-05-03 08:49:46 -07:00
Doug Gregor
408aaa5332 [SIL] Use SubstitutionMap in BuiltinInst. 2018-05-03 08:48:55 -07:00
Doug Gregor
d5c9f71a6d [SIL] Switch InitBlockStorageHeaderInst over to SubstitutionMap. 2018-05-03 08:48:54 -07:00
Doug Gregor
7e08b66499 [SIL] Use SubstitutionMap in KeyPathInst rather than SubstitutionList. 2018-05-03 08:48:54 -07:00
Doug Gregor
5724338abe [SIL] Switch "external" key path pattern components to SubstitutionMap.
Eliminates another source of SubstitutionList.
2018-05-03 08:48:54 -07:00
Doug Gregor
d2cf60c465 Revert "[SIL] Replace more SubstitutionLists with SubstitutionMap" 2018-05-03 08:35:20 -07:00
swift-ci
32853a9ed1 Merge remote-tracking branch 'origin/master' into master-next 2018-05-03 01:29:45 -07:00
Doug Gregor
ed1983d9d0 [SIL] Use SubstitutionMap in BuiltinInst. 2018-05-03 00:05:21 -07:00
Doug Gregor
216906cf59 [SIL] Switch InitBlockStorageHeaderInst over to SubstitutionMap. 2018-05-03 00:05:21 -07:00
Doug Gregor
a6dfe0ff88 [SIL] Use SubstitutionMap in KeyPathInst rather than SubstitutionList. 2018-05-03 00:05:21 -07:00
Doug Gregor
25b9afe20f [SIL] Switch "external" key path pattern components to SubstitutionMap.
Eliminates another source of SubstitutionList.
2018-05-03 00:05:21 -07:00
swift-ci
49b2c7fe2a Merge remote-tracking branch 'origin/master' into master-next 2018-05-01 12:08:52 -07:00
Arnold Schwaighofer
1f65ee25f6 Distinguish between withoutActuallyEscaping and passing @noescape
Objective C closures when reporting that a closure has escaped

rdar://39682865
2018-05-01 07:24:19 -07:00
Arnold Schwaighofer
678a99e76a Add a copy_block_without_escaping %block withoutEscaping %closure instruction
Mandatory pass will clean it up and replace it by a copy_block and
is_escaping/cond_fail/release combination on the %closure in follow-up
patches.

The instruction marks the dependence of a block on a closure that is
used as an 'withoutActuallyEscaping' sentinel.

rdar://39682865
2018-05-01 07:24:19 -07:00
swift-ci
b95dd21966 Merge remote-tracking branch 'origin/master' into master-next 2018-04-17 06:29:07 -07:00
Arnold Schwaighofer
36d5408125 SIL: Add an [escaped] attribute to convert_escape_to_noescape instruction
To mark when a user of it is known to escape the value. This happens
with materializeForSet arguments which are captured and used in the
write-back. This means we need to keep the context alive until after
the write-back.

Follow-up patches to fully replace the PostponedCleanup hack in SILGen
by a mandatory SIL transformation pass to guarantee the proper lifetime
will use this flag to be more conservative when extending the lifetime.

The problem:

%pa = partial_apply %f(%some_context)
%cvt = convert_escape_to_noescape [not_guaranteed] [escaped] %pa
%ptr = %materialize_for_set(..., %cvt)
...  write_back
... // <-- %pa needs to be alive until after write_back
2018-04-13 12:40:10 -07:00
swift-ci
8f0f89053a Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 09:29:49 -07:00
Joe Groff
c5abef647f SIL: Force Clang-imported protocol conformances to get deserialized when used.
Code may end up indirectly using a witness table for a Clang-imported type by inlining code that used the conformance from another module, in which case we need to ensure we have a local definition at hand in the inlining module so we can have something to link against independently. This needs to be fixed from both sides:

- During serialization, serialize not only witness tables from the current module, but from Clang-imported modules too
- During deserialization, when the SILLinker walks a loaded module, ensure that all shared conformances get deserialized, including those from ApplyInsts and inherited/associated type protocol requirements.

Fixes rdar://problem/38687726.
2018-04-04 14:41:13 -07:00
swift-ci
1a436bcb75 Merge remote-tracking branch 'origin/master' into master-next 2018-03-31 10:08:58 -07:00
Andrew Trick
e9d07d88fc Merge pull request #15501 from atrick/add-access-tracking-flag
[exclusivity] Add an access tracking flag.
2018-03-31 10:04:08 -07:00
swift-ci
1c162a567d Merge remote-tracking branch 'origin/master' into master-next 2018-03-31 01:49:02 -07:00
Mark Lacey
21134efd22 Revert "IRGen: Deserialize SIL witness tables and shared-linkage definitions by need." 2018-03-30 22:14:13 -07:00
Andrew Trick
4ed120e46c Merge branch 'master' into add-access-tracking-flag 2018-03-30 19:25:46 -07:00
swift-ci
9121164d82 Merge remote-tracking branch 'origin/master' into master-next 2018-03-30 17:09:01 -07:00
Joe Groff
dbcab4b002 Merge pull request #15590 from jckarter/deserialize-clang-importer-witness-tables-ii
IRGen: Deserialize SIL witness tables and shared-linkage definitions by need.
2018-03-30 17:07:18 -07:00
swift-ci
e99fdb8f07 Merge remote-tracking branch 'origin/master' into master-next 2018-03-30 13:48:46 -07:00
Joe Groff
ae2d2973d1 IRGen: Deserialize SIL witness tables and shared-linkage definitions by need.
Code may end up indirectly using a witness table for a Clang-imported type by inlining code that used the conformance from another module, in which case we need to ensure we have a local definition at hand in the inlining module so we can have something to link against independently. This needs to be fixed from both sides:

- During serialization, serialize not only witness tables from the current module, but from Clang-imported modules too, so that their definitions can be used by other modules that inline code from the current module
- During IRGen, when we emit a reference to a SILWitnessTable or SILFunction declaration with shared linkage, attempt to deserialize the definition on demand

Fixes rdar://problem/38687726.
2018-03-30 11:12:58 -07:00
Arnold Schwaighofer
d563806474 Remove hack 2018-03-30 09:46:52 -07:00
Arnold Schwaighofer
80e7a1914d Add a convert_escape_to_noescape [not_guaranteed] variant 2018-03-30 08:53:40 -07:00
Andrew Trick
70ee3df099 Serialization support for begin_access [no_nested_conflict].
Add serialization layouts for rare instructions that take extra attributes. We
can continue adding bits to these layout without affecting the layout of the
vast majority of instructions.
2018-03-27 12:04:20 -07:00