Commit Graph

484 Commits

Author SHA1 Message Date
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
Saleem Abdulrasool
bb4fe4ea6a Merge pull request #14564 from compnerd/export
runtime: fix build of the runtime tests for Windows
2018-02-13 20:29:22 -08:00
Saleem Abdulrasool
bd41f66bd5 runtime: fix build of the runtime tests for Windows
Ensure that the local definition of the stdlib functions are marked for
export.  We would previously mark the runtime functions as dllimport on
Windows.
2018-02-13 17:54:06 -08:00
swift-ci
700d259da5 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-13 17:18:09 -08:00
Andrew Breckenridge
baeef55e1e unittest/runtime: Remove no-longer-needed import of sys/mman 2018-02-13 12:10:59 -08:00
swift-ci
25c7530f7e Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-02 16:38:07 -08:00
troughton
cf28ff448c Remove TwoWordPair and use SwiftCC instead. 2018-02-03 09:43:00 +13:00
Mike Ash
146833c9b5 [Runtime] Fix unowned refcount overflow to side table during deinit.
32-bit has a 7-bit inline unowned refcount, then 31 bits in the side table. Overflowing the inline count in deinit on an object that didn't already have a side table would crash, because the code assumed that creating a side table in deinit was not allowed.

(64-bit has 31 bits inline and in the side table. Overflowing the inline count immediately overflows the side table as well, so there's no change in behavior there.)

rdar://problem/33765960
2018-01-30 15:38:08 -05:00
swift-ci
1a27794d91 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-30 06:58:14 -08:00
Joe Groff
a7a3b17597 Replace nominal type descriptors with a hierarchy of context descriptors.
This new format more efficiently represents existing information, while
more accurately encoding important information about nested generic
contexts with same-type and layout constraints that need to be evaluated
at runtime. It's also designed with an eye to forward- and
backward-compatible expansion for ABI stability with future Swift
versions.
2018-01-29 16:19:25 -08:00
swift-ci
23816abd1c Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-23 01:18:16 -08:00
Greg Parker
7b9224794e [runtime] Reinstate TwoWordPair hack for swiftcall returns. (#14079)
clang is miscompiling some swiftcall functions on armv7s.
Stop using swiftcall in some places until it is fixed.

Reverts c5bf2ec (#13299).

rdar://35973477
2018-01-23 01:04:01 -08:00
swift-ci
bfc37e195c Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-19 19:18:52 -08:00
Mike Ash
406ebaddfc [Runtime] Implement overflow check for weak refcounts (#14023)
* Check for overflow in incrementWeak().

This mirrors what is currently done for unowned reference counts, where overflowing the side table field produces a fatal error. Without this, the count silently wrapped from 2^31-1 to 0, which then caused breakage when the balancing releases happened (possibly including use-after-free bugs).

* Fix the implementation of RefCounts::getWeakCount().

The previous implementation was only appropriate for heap objects, but not side tables. This resulted in the weak count always returning 0 or 1. This change specializes the implementation for the two different cases and returns the correct count for side tables.

* Test large weak retain counts.

This tests the largest allowed weak retain count, as well as the overflow check when that count is exceeded.
2018-01-19 19:13:47 -08:00
swift-ci
542410aed2 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-18 23:58:15 -08:00
Doug Gregor
764cb7003d [ABI] Record proper number of requirements in protocol descriptor.
The prior refactoring to add the protocol conformance descriptor into
witness tables offset the # of requirements stored in the witness
table by 1. Address this oddity in the metadata by ensuring that the #
of requirements (and # of mandatory requirements) in the protocol
descriptor is accurate.
2018-01-18 21:34:31 -08:00
Doug Gregor
0b053dde9b Update runtime test for witness table layout change 2018-01-18 20:17:53 -08:00
swift-ci
cc373f9c30 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-08 12:27:47 -08:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
swift-ci
b5050ce5ac Merge remote-tracking branch 'origin/master' into master-next 2017-12-22 01:09:43 -08:00
Greg Parker
c677a5dc11 [IRGen][runtime] Prepare to change the is-Swift bit in class metadata. (#13595)
Swift class metadata has a bit to distinguish it from non-Swift Objective-C
classes. The stable ABI will use a different bit so that stable Swift and
pre-stable Swift can be distinguished from each other.

No bits are actually changed yet. Enabling the new bit needs to wait for
other coordination such as libobjc.

rdar://35767811
2017-12-22 00:52:00 -08:00
swift-ci
4a31d01a00 Merge remote-tracking branch 'origin/master' into master-next 2017-12-19 11:09:52 -08:00
Pavel Yaskevich
d3cd61d8eb Merge pull request #13291 from xedin/rdar-34920390
[Mangling/ABI] Mangle function names with parameter labels
2017-12-19 10:50:18 -08:00
swift-ci
fd21243bd6 Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 17:08:54 -08:00
Pavel Yaskevich
10c385d1b7 [Mangling/ABI] Add special LabelList to store parameter labels
Instead of mangling parameter labels as part of the function type
move them to the end of the function name instead, to match the
language semantics.
2017-12-18 15:44:24 -08:00
Saleem Abdulrasool
b329bf3b32 unittests: silence -Wqual-cast warnings
Qualify the casts to ensure that we do not trigger `-Wqual-cast`
warnings from the compiler.  NFC.
2017-12-18 15:28:53 -08:00
swift-ci
79a758cf10 Merge remote-tracking branch 'origin/master' into master-next 2017-12-08 15:48:53 -08:00
swift-ci
d1e377b947 Merge remote-tracking branch 'origin/master' into master-next 2017-12-08 14:08:50 -08:00
Slava Pestov
ffabf60118 IRGen: Hollow out generic class templates
Don't emit placeholders for field offsets and vtable entries,
since they were always null. Instead, calculate the final size
of class metadata at runtime using the size of the superclass
metadata and the number of immediate members, and only copy
this prefix from the template to the instantiated metadata,
zero-filling the rest.

For this to work with non-generic resilient classes and
non-generic subclasses of generic classes, we need a new
runtime entry point to relocate non-generic class metadata,
calculating its size at runtime using the same strategy.
2017-12-08 13:50:56 -08:00
Thomas Roughton
c5bf2ec553 [runtime] Remove TwoWordPair and use the Swift calling convention instead. (#13299) 2017-12-07 19:27:24 -08:00
Bob Wilson
390058972a [master-next] Use PRIVATE in target_link_libraries for executables
This is needed to work with LLVM r319840.
2017-12-06 21:55:22 -08:00