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>.
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.)
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.
@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.
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!
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
- Add swift_getForeignWitnessTable to unique non-unique foreign type
witness tables
- IRGen: Call the foreign witness uniquing runtime function
rdar://24958043
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
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>.
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
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.
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
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.
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
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.