Commit Graph

314 Commits

Author SHA1 Message Date
Doug Gregor
89e322032a [Runtime] Minor cleanups to reduce dependency on Swift/ObjC protocol overlap.
As a small step toward splitting apart the Swift and Objective-C protocol
descriptors, eliminate most places where we rely on a shared representation.
2018-07-23 17:08:58 -07:00
Doug Gregor
03c3baab6e [Runtime] TargetProtocolDescriptorRef cleanups.
Eliminate an unnecessary nullptr constructor and make the Metadata
unit test compile when Objective-C interoperability is disabled.
2018-07-22 21:05:45 -07:00
Doug Gregor
bec722df57 [Runtime/IRGen] Switch swift_getExistentialTypeMetadata() to ProtocolDescriptorRef.
Switch one entry point in the runtime (swift_getExistentialTypeMetadata)
to use ProtocolDescriptorRef rather than a protocol descriptor. Update
IRGen to produce ProtocolDescriptorRef instances for its calls, setting
the discriminator bit appropriately.

Within the runtime, verify that all instances of ProtocolDescriptorRef have
the right layout, i.e., the discriminator bit is set for @objc protocols
but not Swift protocols.
2018-07-21 07:48:34 -07:00
Doug Gregor
3464929638 [ABI] Rework existential type metadata to use ProtocolDescriptorRef.
Use ProtocolDescriptorRefs within the runtime representation of
existential type metadata (TargetExistentialTypeMetadata) instead of
bare protocol descriptor pointers. Start rolling out the use of
ProtocolDescriptorRef in a few places in the runtime that touch this
code. Note that we’re not yet establishing any strong invariants on
the TargetProtocolDescriptorRef instances.

While here, replace TargetExistentialTypeMetadata’s hand-rolled pointer 
arithmetic with swift::ABI::TrailingObjects and centralize knowledge of
its layout better.
2018-07-20 20:54:49 -07:00
Mike Ash
b1d1ca2145 [Runtime] Fix warning about implicitly converting nullptr to bool in CompatibilityOverride.cpp tests.
rdar://problem/40625829
2018-07-03 14:37:53 -04:00
Doug Gregor
7952a19f31 [Mangling] Introduce known manglings for many more standard library types.
Since the mangling scheme and set of standard library types is effectively
fixed now, introduce known mangling substitutions for a number of new
standard library types, filling out the S[A-Za-z] space.

Reduces standard library binary size by ~195k.
2018-06-19 23:24:38 -07:00
Lily Vulcano
1377ab7d7e Turn on ‘as’ bridging on Darwin. 2018-05-30 15:07:22 -07:00
swift-ci
435375d258 Merge pull request #16798 from aschwaighofer/opaque_existentials_bitwise_takable 2018-05-23 13:13:02 -07:00
Mike Ash
93470fb9b9 Merge pull request #16794 from mikeash/fix-ConcurrentReadableArray-double-free
[Runtime] Fix double-frees in ConcurrentReadableArray.
2018-05-23 14:38:33 -04:00
Arnold Schwaighofer
98506e03cf IRGen: Opaque existentials are now bitwise takable
Now that the existential inline buffer is bitwise takable so are opaque
existentials.
2018-05-23 11:17:54 -07:00
Mike Ash
a4863c4dcd [Runtime] Fix ConcurrentReadableArray's handling of FreeList to not double-free items. Also implement a destructor so it can be used for non-globals.
rdar://problem/40484362
2018-05-23 11:29:26 -04:00
Arnold Schwaighofer
6267860a7e IRGen: Remove initializeBufferWithTakeOfBuffer in favor of memcpy
And update the existential container's initializeWithTake implementation
in the runtime. After only allowing bitwise takable values in the
inline buffer we can use memcpy to move existential container values.

rdar://31414907
SR-343
2018-05-22 13:05:00 -07:00
Ben Langmuir
628b6a1fc7 Revert "Turn on ‘as’ bridging on Linux." 2018-05-17 14:54:35 -07:00
Lily Vulcano
b9455930ee Turn on ‘as’ bridging on Darwin. 2018-05-17 09:59:39 -07:00
Saleem Abdulrasool
f4c24d6e2e Merge pull request #16403 from lanza/inspect-arch-sdk
Configure the swiftImageInspectionShared to generate arch & sdk speci…
2018-05-10 09:42:35 -07:00
Nathan Lanza
9815368788 Configure the swiftImageInspectionShared to generate arch & sdk specific libraries
Previously, swiftImageInspectionShared generated one specific library at
`lib/libswiftImageInspectionShared.a` for only the main arch and sdk.
Generic cross compilation and various changes to the build system to get
cross compilation to work will require swiftImageInspectionShared to
generate libraries at the proper subdirectory. Change the outputs to
agree with paths such as `lib/swift/linux/x86_64`
2018-05-03 12:33:45 -07:00
David Zarzycki
2e19423bf8 [Unit Tests] NFC: Pass nullptr rather than dummy empty array 2018-04-30 17:10:52 -04:00
David Zarzycki
95473a10d7 [Misc] NFC: Fix random build warnings
Unused variables/methods, language extensions, extra semicolons, intentional
self assignment, platform specific quirks, etc.
2018-04-30 12:52:43 -04:00
Mike Ash
99c15bc641 Merge pull request #15429 from mikeash/casting-hooks
[Runtime] Add hooks for back-deploying dynamic casting and type lookup changes
2018-03-30 19:54:35 -07:00
Mike Ash
cd0d075aad [Runtime] Only enable the CompatibilityOverride test Mach-O/Apple.
rdar://problem/36997475
2018-03-29 17:18:45 -04:00
Slava Pestov
72b56ec66b Runtime: New mechanism for resilient witness table instantiation 2018-03-29 14:03:58 -07:00
Slava Pestov
d1c6e1d24a SIL: Generalize default witness tables now that defaulted witnesses don't have to go at the end
NFC until the new witness table instantiation mechanism is enabled.
2018-03-29 14:03:58 -07:00
Mike Ash
f8241caa59 [Runtime] Rename __swift_lite section to __swift_hooks.
rdar://problem/36997475
2018-03-29 12:16:01 -04:00
Saleem Abdulrasool
8695224324 Merge pull request #14598 from AndrewSB/pthreads=😥
unittests/runtime: Migrate tests from pthreads to std::thread
2018-03-28 22:28:07 -04:00
Mike Ash
3019265ffd [Runtime] Fix spurious test failure in CompatibilityOverride.cpp.
rdar://problem/36997475
2018-03-28 15:12:06 -04:00
Mike Ash
34be7f6f15 Merge branch 'master' into casting-hooks 2018-03-28 14:45:48 -04:00
Mike Ash
f4224b092e [Runtime] Redo compatibility overrides boilerplate using a .def file.
rdar://problem/36997475
2018-03-28 13:39:55 -04:00
John McCall
6d99a7755a Restructure how we finalize VWTs in the runtime to potentially allow asynchronous queries.
I keep finding reasons to want such queries and then deciding that they're
unnecessary.  Let's at least do this much, though.
2018-03-26 01:13:45 -04:00
Mike Ash
cf3ee980a8 Merge pull request #14283 from mikeash/fix-urc-overflow-to-side-table-in-deinit
[Runtime] Fix unowned refcount overflow to side table during deinit.
2018-03-22 09:15:20 -07:00
Mike Ash
d024fd7487 [Runtime] Fill out a bunch more compatibility hooks.
rdar://problem/36997475
2018-03-22 09:14:55 -07:00
Mike Ash
ed4e3b9bf3 [Runtime] Fix up the URC overflow test and support code after merging the latest master.
rdar://problem/33765960
2018-03-21 15:34:11 -07:00
Mike Ash
f2b89d1b94 Merge branch 'master' into fix-urc-overflow-to-side-table-in-deinit 2018-03-21 15:32:01 -07:00
Mike Ash
6ed2628883 [Runtime] Clean up the compatibility hooking mechanism a bit. Add a hook to swift_conformsToProtocol.
rdar://problem/36997475
2018-03-21 14:16:41 -07:00
Mike Ash
9e8d4da76f [Runtime] Add a hooking mechanism to allow future apps to extend dynamic casting and type lookup. Make swift_dynamicCast and swift_getTypeByMangledName use these hooks.
rdar://problem/36997475
2018-03-20 16:33:37 -07:00
Andrew Breckenridge
4308104e47 unittests/runtime: Migrate race tests from pthreads to std::thread 2018-03-20 14:29:50 -07:00
Arnold Schwaighofer
9d8c381ab4 Remove resilient tag indices 2018-03-20 13:19:56 -07:00
swift-ci
96a2ce33e4 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-05 16:18:20 -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
Huon Wilson
43196c27ac [IRGen] 'void **' -> 'void ***' in swift_getGenericWitnessTable.
This is simpler, because the native form of that last argument is: a
pointer to a buffer (*) of pointers (*) to witness tables, which is
modelled as a buffer of void *s. Thus, void ***.
2018-03-06 00:22:05 +11: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
b3282e7f25 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-04 01:18:05 -08:00
John McCall
f2bb319bdb Change the pattern of generic class metadata instantiation.
Minimize the generic class metadata template by removing the
class header and base-class members.  Add back the set of
information that's really required for instantiation.
Teach swift_allocateGenericClass how to allocate classes without
superclass metadata.  Reorder generic initialization to establish
a stronger phase-ordering between allocation (the part that doesn't
really care about the generic arguments) and initialization (the
part that really does care about the generic arguments and therefore
might need to be delayed to handle metadata cycles).

A similar thing needs to happen for resilient class relocation.
2018-03-04 00:01:56 -05:00
swift-ci
4c2ad3742d Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-02 14:00:41 -08:00
Saleem Abdulrasool
bef59f7f14 runtime: fix the long test build on Windows
The standard library stubs need to be built with swiftCore_EXPORTS
defined to ensure that the interfaces are exported as if the swiftCore
library was being built.  This allows building the LongTests on Windows.
2018-03-02 11:21:58 -08:00
swift-ci
f66a09023a Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-27 19:00:15 -08:00
Saleem Abdulrasool
418c77ebba Merge pull request #14787 from AndrewSB/mangling🤦‍♂️-stubs-for-protocol-conformances🤷‍♂️
unittests/runtime: Add more stubs related to protocol conformance
2018-02-27 18:53:20 -08:00
swift-ci
18fe201cbc Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-26 11:18:00 -08:00
John McCall
dd99536d31 Move the metadata-pattern header into the type context descriptor.
This is yet another waypoint on the path towards the final
generic-metadata design.  The immediate goal is to make the
pattern a private implementation detail and to give the runtime
more visibility into the allocation and caching of generic types.
2018-02-26 12:10:24 -05:00
Andrew Breckenridge
2e3e899723 unittests/runtime: Add more stubs related to protocol conformance
Found whilst attempting to build the runtime tests on Windows
2018-02-23 13:18:47 -08:00
swift-ci
9871296008 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-13 20:38:00 -08:00