Commit Graph

1549 Commits

Author SHA1 Message Date
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
swift-ci
3466e93d25 Merge remote-tracking branch 'origin/master' into master-next 2018-03-29 19:09:12 -07:00
Slava Pestov
2f0440eafe IRGen: Force witness thunks to be emitted in the same thread as the witness table
Otherwise, they might end up in a different translation unit,
and we will be unable to form a relative reference.
2018-03-29 15:23:20 -07:00
Slava Pestov
588448684b IRGen: Emit resilient witness tables 2018-03-29 14:03:58 -07:00
Slava Pestov
72b56ec66b Runtime: New mechanism for resilient witness table instantiation 2018-03-29 14:03:58 -07:00
Slava Pestov
0edce39a24 IRGen: Remove unused parameters from isDependentConformance() 2018-03-29 14:03:58 -07:00
swift-ci
1cbd392413 Merge remote-tracking branch 'origin/master' into master-next 2018-03-28 22:28:50 -07:00
Slava Pestov
30a3e75fe9 IRGen: Fix dependent witness table linkage
Witness tables for conformances that require runtime instantiation
should not be public, because it is an error to directly reference
such a symbol from outside the module.

Use a different mangling for witness table patterns and give them
non-public linkage.
2018-03-28 20:58:14 -07:00
Slava Pestov
d1da8f3471 IRGen: Conformance records for dependent conformances should reference the witness table accessor function
... and not the pattern, which is about to get non-public linkage.
2018-03-28 20:13:12 -07:00
swift-ci
c5884dc38a Merge remote-tracking branch 'origin/master' into master-next 2018-03-27 18:13:31 -07:00
Slava Pestov
e7ac4f5af2 IRGen: Mangled name for protocol requirement array 2018-03-27 16:24:19 -07:00
Slava Pestov
19982ebaaa IRGen: Header gardening 2018-03-27 16:24:19 -07:00
swift-ci
82dc4bf3eb Merge remote-tracking branch 'origin/master' into master-next 2018-03-27 14:15:41 -07:00
John McCall
976401157f Bind layout type metadata correctly in outlined helper functions.
Fixes a regression in the source compatibility suite which I had a
lot of trouble extracting into a separate test case.

Most of this patch is just moving the outlining code into a separate
file and organizing it into a helper class instead of copy/pasting
so much code.  The main functional change is implicit in the difference
between collecting formal metadata and collecting it for layout, which
then is exploited in bindMetadataParameters.

As a secondary change, stop collecting metadata for class-bounded
archetypes; we don't actually need it to do value operations.
2018-03-27 15:14:12 -04:00
swift-ci
6620cab20d Merge remote-tracking branch 'origin/master' into master-next 2018-03-27 03:05:50 -07:00
Slava Pestov
498e6dc165 SIL: Remove FormalLinkage::HiddenNonUnique 2018-03-27 01:43:07 -07:00
swift-ci
3a4d3919d0 Merge remote-tracking branch 'origin/master' into master-next 2018-03-26 20:32:48 -07:00
Slava Pestov
a103186f04 IRGen: Use linkonce_odr linkage for outlined copy_addr and destroy_addr
Now that they have unique mangling, we can get a small code size
savings for non-WMO builds.
2018-03-26 19:39:26 -07:00
Slava Pestov
c31620d302 IRGen: Mangle generic signature and type for outlined thunks 2018-03-26 19:39:26 -07:00
swift-ci
47e75bf7c0 Merge remote-tracking branch 'origin/master' into master-next 2018-03-23 20:23:04 -07:00
Slava Pestov
b7ff05d036 IRGen: Fix handling of dispatch thunks
Tests fail with the next patch.
2018-03-23 18:59:07 -06:00
swift-ci
6ad76369c9 Merge remote-tracking branch 'origin/master' into master-next 2018-03-23 13:11:30 -07:00
Joe Groff
8b9ffd8033 Merge pull request #15438 from jckarter/property-descriptor-irgen
IRGen: Lower property descriptors.
2018-03-23 12:51:51 -07:00
Joe Groff
02b23d0d96 IRGen: Lower property descriptors.
Factor out the code generation for key path components so we can reuse it to generate the component representing a key path.
2018-03-23 08:46:37 -07:00
swift-ci
893d163241 Merge remote-tracking branch 'origin/master' into master-next 2018-03-21 10:29:45 -07:00
Arnold Schwaighofer
ce7608a7ce IRGen: Make resilient enum's tag indices resilient
This allows reordering enum cases resiliently.

rdar://24057946
2018-03-20 13:19:56 -07:00
swift-ci
6f4f5025d4 Merge remote-tracking branch 'origin/master' into master-next 2018-03-19 20:40:59 -07:00
Doug Gregor
cd617dce4a [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.

Make all OBJC_CLASS_REF symbols object-local using "\01l", which
prevents the linker from producing incorrect relative addresses.

Fixes the ABI-affecting part of rdar://problem/36310179.
2018-03-19 17:13:48 -07:00
swift-ci
a948e52936 Merge remote-tracking branch 'origin/master' into master-next 2018-03-19 10:43:42 -07:00
John McCall
aaa40ee82b Move metadata-accessing IRGen out of GenMeta. NFC.
Abstract type/heap metadata access goes into MetadataRequest.
Metadata access starting from a heap object goes into GenHeap.
Accessing various components of class metadata goes into GenClass
or MetadataLayout.
2018-03-18 23:53:11 -04:00
John McCall
31f2eec044 Change type metadata accessors to support incomplete metadata.
This includes global generic and non-generic global access
functions, protocol associated type access functions,
swift_getGenericMetadata, and generic type completion functions.

The main part of this change is that the functions now need to take
a MetadataRequest and return a MetadataResponse, which is capable
of expressing that the request can fail.  The state of the returned
metadata is reported as an second, independent return value; this
allows the caller to easily check the possibility of failure without
having to mask it out from the returned metadata pointer, as well
as allowing it to be easily ignored.

Also, change metadata access functions to use swiftcc to ensure that
this return value is indeed returned in two separate registers.

Also, change protocol associated conformance access functions to use
swiftcc.  This isn't really related, but for some reason it snuck in.
Since it's clearly the right thing to do, and since I really didn't
want to retroactively tease that back out from all the rest of the
test changes, I've left it in.

Also, change generic metadata access functions to either pass all
the generic arguments directly or pass them all indirectly.  I don't
know how we ended up with the hybrid approach.  I needed to change all
the code-generation and calls here anyway in order to pass the request
parameter, and I figured I might as well change the ABI to something
sensible.
2018-03-18 21:38:08 -04:00
swift-ci
f168a79875 Merge remote-tracking branch 'origin/master' into master-next 2018-03-14 15:36:54 -07:00
Arnold Schwaighofer
0c11e1a0a3 Mark swift sections as swift4 for Swift 4.2
rdar://36363251
2018-03-14 10:27:28 -07:00
swift-ci
632dce19ce Merge remote-tracking branch 'origin/master' into master-next 2018-03-06 02:49:18 -08:00
John McCall
9a4540e84d Split the instantiation function into two phases.
The allocation phase is guaranteed to succeed and just puts enough
of the structure together to make things work.

The completion phase does any component metadata lookups that are
necessary (for the superclass, fields, etc.) and performs layout;
it can fail and require restart.

Next up is to support this in the runtime; then we can start the
process of making metadata accessors actually allow incomplete
metadata to be fetched.
2018-03-06 03:07:55 -05:00
swift-ci
a0cd030c07 Merge remote-tracking branch 'origin/master' into master-next 2018-03-05 19:49:23 -08:00
John McCall
11e3d16c93 Merge pull request #14998 from rjmccall/generic-metadata-patterns
Apply generic metadata patterns to all types and change their layout.
2018-03-05 22:45:23 -05:00
swift-ci
d9c2e4b593 Merge remote-tracking branch 'origin/master' into master-next 2018-03-05 16:09:21 -08:00
Huon Wilson
216e69e810 Merge pull request #14973 from huonw/no-dynamic-count
[IRGen] Cond. conformance witness table count isn't needed dynamically.
2018-03-05 16:07:14 -08:00