Commit Graph

1087 Commits

Author SHA1 Message Date
swift-ci
f0fe310f44 Merge remote-tracking branch 'origin/master' into master-next 2018-07-24 19:29:28 -07:00
Doug Gregor
a2b2798de2 [ABI] Eliminate the now-unused protocol requirement array.
This is a holdover from the old protocol descriptor layout, which is no
longer useful.
2018-07-24 17:33:16 -07:00
Bob Wilson
b254041121 Merge remote-tracking branch 'origin/master' into master-next 2018-06-28 23:23:29 -07:00
Slava Pestov
fcfa1786c8 IRGen: Add another lldb resilience hack
When accessing global variables defined in the REPL, lldb does not consult
debug info, so it does not see that the DW_OP_deref was emitted.

So instead, set a special bit on globals defined in the REPL which bypasses
resilience for them altogether.

Part of the fix <rdar://problem/39722386>.
2018-06-28 16:56:55 -07:00
swift-ci
bea73f7bce Merge remote-tracking branch 'origin/master' into master-next 2018-06-26 17:29:54 -07:00
Arnold Schwaighofer
61c9276809 Fix compile error 2018-06-26 06:17:18 -07:00
Arnold Schwaighofer
d430bb0074 Sink the logic into getResilienceExpansionForLayout
This clearly satisfies the postcondition that 'Calling isResilient() with this scope will always return false.'
2018-06-25 19:25:10 -07:00
swift-ci
60a0e52c88 Merge remote-tracking branch 'origin/master' into master-next 2018-06-22 08:29:52 -07:00
Slava Pestov
cb013b5881 DebugInfo: Bypass resilience to calculate if a global is indirect or not
Progress on <rdar://problem/39722386>.
2018-06-22 01:15:11 -07:00
swift-ci
243d603ffe Merge remote-tracking branch 'origin/master' into master-next 2018-06-15 08:29:11 -07:00
Jordan Rose
7938272c42 [DebugInfo] Don't record that the standard library imports itself (#17226)
This causes problems for cross-compilation -parse-stdlib tests that
emit debug info. At the moment we have zero of those, but we're
trying to add one.

Also, don't try to load new modules when recording imports. (This
isn't harmful, just inefficient.)
2018-06-15 08:23:11 -07:00
swift-ci
72f5e8d124 Merge remote-tracking branch 'origin/master' into master-next 2018-06-13 10:49:12 -07:00
Joe Groff
14fd26a6ed IRGen: More specifically curtail JIT use of relative references to the integrated REPL.
The other JIT modes all still build an entire local context into one LLVM module, so it's safe to form relative references, and necessary for reflection to work with private and local contexts. Only the integrated REPL needs this prohibition. Fixes rdar://problem/40607819.
2018-06-12 14:11:36 -07:00
swift-ci
b87ea23124 Merge remote-tracking branch 'origin/master' into master-next 2018-06-06 17:29:44 -07:00
Erik Little
863f3a19ff Rename @effects to @_effects
@effects is too low a level, and not meant for general usage outside
the standard library. Therefore it deserves to be underscored like
other such attributes.
2018-06-06 12:53:03 -04:00
swift-ci
fdbcfbca65 Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 10:29:01 -07:00
Saleem Abdulrasool
477d43ef1c Merge pull request #16142 from compnerd/irgen-dllstorage
IRGen: the runtime is compacted into the stdlib
2018-05-30 10:27:29 -07:00
Saleem Abdulrasool
283c00e41e IRGen: special case the handling for the stdlib
Because the runtime is compacted into the standard library, functions
which are normally imported are actually local definitions.  Use module
level named metadata to identify the module as being the swift standard
library.  Refactor the condition slightly to improve code readability.

This addresses SR-7107!
2018-05-29 15:39:32 -07:00
swift-ci
76bd350b43 Merge remote-tracking branch 'origin/master' into master-next 2018-05-24 08:09:06 -07:00
Arnold Schwaighofer
cc7f207cec Rename swift sections from swift4 to swift5
rdar://38465220
2018-05-23 12:18:08 -07:00
swift-ci
228d6d7674 Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 07:49:03 -07:00
Arnold Schwaighofer
0be00c820e Merge pull request #16608 from aschwaighofer/unique_foreign_type_witnesses
Unique synthesized foreign type witnesses and make witness tables part of the metadata cache key
2018-05-17 07:35:10 -07:00
swift-ci
14cddf5cd6 Merge remote-tracking branch 'origin/master' into master-next 2018-05-14 15:08:49 -07:00
Erik Eckstein
915391ee99 IRGen: don't emit metadata lazily in JIT mode.
We already do this for witness tables, but the check was missing for metadata.
This problem caused unresolved symbols when interpreting with -O.

rdar://problem/40128897
2018-05-14 14:07:19 -07:00
Arnold Schwaighofer
b83941795a Unique synthesized foreign type conformances
- Add swift_getForeignWitnessTable to unique non-unique foreign type
   witness tables

 - IRGen: Call the foreign witness uniquing runtime function

rdar://24958043
2018-05-14 13:52:41 -07:00
swift-ci
ebc2c0e05a Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 19:49:11 -07:00
Vedant Kumar
bdfd220968 [Coverage] Mark symtab entries as guaranteed after intrinsic lowering
SIL optimizations may rewrite profiling intrinsics in a way that IRGen
can't lower (r://39146527). Don't claim that a coverage mapping has a
guaranteed associated symbol table entry when this happens.

I have not added a test, as this is a defensive workaround until we can
land add a SIL verifier check that prevents profiling intrinsics from
being rewritten.

rdar://40133800
2018-05-10 18:51:40 -07:00
swift-ci
908dbfed4a Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 02:09:07 -07:00
Slava Pestov
51ece23422 IRGen: Fix enum lowering with -enable-resilience-bypass
The layout of an enum type will only use spare bits if the
payload types have a fixed size in all resilience domains
where they are visible. In practice, this means that:

- If the enum is internal or resilient, we can use spare bits
  if the payload types are fixed size from inside the current
  module.

- If the enum is public and not resilient, we can use spare bits
  if the payload types are fixed size from all resilience
  domains.

The bug was that the 'fixed size in all resilience domains'
check was returning true for resilient types when the
-enable-resilience-bypass flag was on. This is wrong, because
this meant that building a module with and without
-enable-resilience-bypass could produce different lowerings
for enum types.

Fixes <rdar://problem/40034143>.
2018-05-10 00:56:15 -04:00
swift-ci
28f97c08ca Merge remote-tracking branch 'origin/master' into master-next 2018-05-03 10:09:45 -07:00
Adrian Prantl
2c7a69852b Emits a DW_OP_deref for global variables in a fixed size buffer.
Note that this is only correct unless the variable uses inline
storage. This makes the majority of resilient types in Foundation work
as global variables.  The correct solution would be for LLDB to poke
at the runtime to figure out whether the storage is inline or not, but
until then this is the next best thing.

rdar://problem/39722386
2018-05-02 15:40:16 -07:00
swift-ci
cd0fd541ae Merge remote-tracking branch 'origin/master' into master-next 2018-04-23 13:29:24 -07:00
Saleem Abdulrasool
4cdddedddb IRGen: avoid implicit conversion from IGM to UniversalLinkInfo
This just makes the conversion an explicit operation.  This makes it
easier to see what is being invoked.  NFC.
2018-04-23 11:17:33 -07:00
swift-ci
44b4be86f4 Merge remote-tracking branch 'origin/master' into master-next 2018-04-20 08:27:12 -07:00
Andrew Trick
abab49e54c Support exclusivity enforcement of KeyPath read-only access.
Use begin_unpaired_access [no_nested_conflict] for
Builtin.performInstantaneousReadAccess. This can't be optimized away
and is the proper marker to use when the access scope is unknown.

Drop the requirement that
_semantics("optimize.sil.preserve_exclusivity") be @inline(never). We
actually want theses inlined into user code. Verify that the
@_semantic functions are not inlined or otherwise tampered with prior
to serialization.

Make *no* change to propagate @inline(__always) into LLVM. This no longer has
any relationship to this PR and can be investigated seperately.
2018-04-19 22:46:10 -07:00
Michael Gottesman
e58fdc81fc [Exclusivity] Add support for semantics tag "optimize.sil.preserve_exclusivity".
This is a special @_semantics attribute that preserves exclusivity even if we
are eliminating exclusivity in other parts of a module in release mode. This is
done by:

1. Teaching the Access Marker Elimination pass to skip any function with the
semantics tag.

2. Requiring all functions with the semantics tag to be noinline. This ensures
that the SIL level inliner will not inline these functions into any callers
without the protection of the semantics tag. This is enforced in IRGenPrepare
and ensures that our access markers will live to IRGen time.

3. In IRGenPrepare, we convert these functions from noinline to always
inline. After IRGen this then allows for the LLVM inliner to inline these
trivial functions that just perform the exclusivity checks ensuring that we do
not have extra calls in the fast path.

This ensures that we can fix the keypaths exclusivity issue without having to
enable exclusivity across the entire stdlib and deal with any of the potential
performance issues therein.

rdar://39335800
2018-04-19 21:37:12 -07:00
swift-ci
b95dd21966 Merge remote-tracking branch 'origin/master' into master-next 2018-04-17 06:29:07 -07:00
Mike Ash
309c7f7634 Merge pull request #15828 from mikeash/fix-asan-metadata
[IRGen] Blacklist metadata globals from address sanitizer.
2018-04-17 06:19:14 -07:00
Mike Ash
0f73e32cfe [IRGen] Blacklist some more globals that caused trouble with ASAN on Linux.
rdar://problem/39128762
2018-04-11 15:21:13 -04:00
swift-ci
4b5a4a963d Merge remote-tracking branch 'origin/master' into master-next 2018-04-11 10:08:16 -07:00
Doug Gregor
ee70e19c3c Make SourceFile::collectLinkLibraries() visit all visible modules; use it.
Centralize the logic for collecting the link libraries of a source file
in SourceFile::collectLinkLibraries(), extending it to look at all visible
modules. Use it in the main place that counts for autolinking.
2018-04-10 23:09:52 -07:00
swift-ci
0d728ccabb Merge remote-tracking branch 'origin/master' into master-next 2018-04-10 07:29:08 -07:00
Slava Pestov
2232203424 IRGen: Add mode for lowering types in a completely fragile manner 2018-04-09 21:53:45 -07:00
Mike Ash
e13c58dd56 [IRGen] Blacklist metadata globals from address sanitizer. Otherwise asan pads them in an attempt to detect overflows, which messes with other code which assumes that metadata is contiguous.
rdar://problem/39128762
2018-04-09 15:11:06 -04:00
swift-ci
0f92d894a8 Merge remote-tracking branch 'origin/master' into master-next 2018-04-06 14:15:23 -07:00
Arnold Schwaighofer
ae0f98d601 IRGen: Ensure collocation of relative pointers in resilient witness tables
Ensure collocation by recording the dependence between witness table and
witness before functions are processed. Debug info of inlined function
scopes can reference the witness and will cause the wrong IRGenModule to
be associated before lazy witness tables are processed.

No, I am not sure that this is the only instance of this but the same
solution can apply to other instances if we find them.

rdar://39116991
2018-04-06 10:03:54 -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
swift-ci
9121164d82 Merge remote-tracking branch 'origin/master' into master-next 2018-03-30 17:09:01 -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