Commit Graph

1537 Commits

Author SHA1 Message Date
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
John McCall
dff0031b02 Apply generic metadata patterns to all types and change their layout.
The layout changes to become relative-address based.  For this to be
truly immutable (at least on Darwin), things like the RO data patterns
must be moved out of the pattern header.  Additionally, compress the
pattern header so that we do not include metadata about patterns that
are not needed for the type.

Value metadata patterns just include the metadata kind and VWT.

The design here is meant to accomodate non-default instantiation
patterns should that become an interesting thing to support in the
future, e.g. for v-table specialization.
2018-03-05 19:05:41 -05:00
Huon Wilson
ce1bb8b13c [IRGen] Cond. conformance witness table count isn't needed dynamically.
The count of the number of witness tables was designed to be an
assertion/check that we've hooked up all the infrastructure
correctly. Everything is now implemented, and the assertion has never
triggered, so it can be removed, saving some work.

Fixes rdar://problem/38038928.
2018-03-06 00:22:05 +11:00
swift-ci
9dbb5effd5 Merge remote-tracking branch 'origin/master' into master-next 2018-03-04 01:29:35 -08:00
John McCall
a7c5c80799 Compute class metadata bounds solely from class-descriptor chain information.
Change the "metadata base offset" variable into a "class metadata bounds"
variable that contains the base offset and the +/- bounds on the class.
Link this variable from the class descriptor when the class has a resilient
superclass; otherwise, store the +/- bounds there.  Use this variable to
compute the immediate-members offset for various runtime queries.  Teach the
runtime to fill it in lazily and remove the code to compute it from the
generated code for instantiation.  Identify generic arguments with the start
of the immediate class metadata members / end of the {struct,enum} metadata
header and remove the generic-arguments offset from generic type descriptors.
2018-03-04 02:14:32 -05:00
swift-ci
b8b47f2786 Merge remote-tracking branch 'origin/master' into master-next 2018-03-01 19:10:48 -08:00
Doug Gregor
719533b3f9 Revert "[Runtime] Reference ObjC class objects indirectly in conformance records."
This reverts commit 65b4c9a25a. It broke
the stdlib/ErrorBridged.swift test at -Onone. Fixes rdar://problem/37925234.
2018-03-01 17:07:02 -08:00
swift-ci
757e39aea4 Merge remote-tracking branch 'origin/master' into master-next 2018-02-28 19:52:22 -08:00
swift-ci
72d7dd2013 Merge pull request #14710 from compnerd/got-coff 2018-02-28 19:47:05 -08:00
Saleem Abdulrasool
ae5cfaed4c IRGen: adjust protocol conformance references in PE/COFF
There is no GOT on PE/COFF.  However, the IAT entries serve the same
purpose.  Use the synthetic symbol which will be initialized externally
by the loader to compute the address.  This allows for cross-module
protocol references on Windows.
2018-02-28 14:00:14 -08:00
swift-ci
00dfc9cff2 Merge remote-tracking branch 'origin/master' into master-next 2018-02-28 08:12:19 -08:00
John McCall
8d93cee012 Add a superclass reference to class descriptors. 2018-02-28 00:38:00 -05:00
swift-ci
96b5717d8f Merge remote-tracking branch 'origin/master' into master-next 2018-02-26 11:09:40 -08:00