Commit Graph

1782 Commits

Author SHA1 Message Date
swift-ci
5dead4ad96 Merge remote-tracking branch 'origin/master' into master-next 2018-03-06 02:09:22 -08:00
Michael Gottesman
eb96da521f [+0-all-args] Update tryDynamicCastNSErrorToValue for +0 all arguments. 2018-03-06 02:05:43 -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
swift-ci
8c50a53066 Merge remote-tracking branch 'origin/master' into master-next 2018-03-05 12:29:07 -08:00
Michael Gottesman
e66fd1ad0c [+0-all-args] When casting a value to NSError, release the value passed to _swift_stdlib_bridgeErrorToNSError since it is at +0 now.
rdar://34222540
2018-03-05 12:22:09 -08:00
Michael Gottesman
f98fc84957 [+0-all-args] Add a missing +1 guard so this release doesn't happen with a +0 calling convention.
rdar://34222540
2018-03-05 12:21:47 -08:00
swift-ci
6fa54bc0bf Merge remote-tracking branch 'origin/master' into master-next 2018-03-05 11:49:22 -08:00
Joe Groff
f213671327 Runtime: Handle getDescription correctly in +0 mode.
This can eventually be made more efficient by avoiding copies in all the
callees, but this is the minimal fix. Remove an unnecessary bit of
reverse-dependency on the Foundation overlay while we're here.

rdar://34222540
2018-03-05 11:48:40 -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
swift-ci
5477029dd0 Merge remote-tracking branch 'origin/master' into master-next 2018-03-04 15:08:58 -08:00
Davide Italiano
a59d82188f [Metadata] Define _objc_empty_cache under SWIF_OBJC_INTEROP.
Later code uses the variable under this macro, so defining it
under NDEBUG breaks debug builds of stdlib.
2018-03-04 12:29:09 -08: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
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
dcee1f4d47 Merge remote-tracking branch 'origin/master' into master-next 2018-03-02 14:31:02 -08:00
Huon Wilson
78bdc95ce3 Merge pull request #14874 from huonw/at-owned-cleanup
Various refactorings for __owned.
2018-03-02 14:20:21 -08:00
Huon Wilson
b94c5364f5 [NFC] Rename 'Ownership' to 'ReferenceOwnership'.
There's really two forms of ownership: references and values. Renaming
to make way for better distinguishing of the two.
2018-03-02 11:38:28 -08:00
swift-ci
beab182f92 Merge remote-tracking branch 'origin/master' into master-next 2018-02-28 18:52:15 -08:00
Bob Wilson
b124a51570 Merge pull request #14880 from bob-wilson/sr7038
Restore build and install of the swiftImageInspectionShared library
2018-02-28 18:38:44 -08:00
swift-ci
d4e8e40537 Merge remote-tracking branch 'origin/master' into master-next 2018-02-28 17:32:08 -08:00
Saleem Abdulrasool
6d1f4f0b55 Merge pull request #14879 from compnerd/windows-stubs
Windows stubs
2018-02-28 17:25:44 -08:00
swift-ci
631ba2828d Merge remote-tracking branch 'origin/master' into master-next 2018-02-28 13:31:35 -08:00
Bob Wilson
a62cfa0de9 Restore build and install of the swiftImageInspectionShared library
Commit 0c42b57962 ("ELF: restructure image metadata registration")
removed the swift_install_in_component lines for both
swiftImageInspectionStatic and swiftImageInspectionShared libraries,
even though only the former library was removed in that change. As a
result, the swiftImageInspectionShared was not being built or
installed. This should fix SR-7038.
rdar://problem/37710244
2018-02-28 11:22:52 -08:00
Saleem Abdulrasool
c6eed1f19b runtime: make Windows build again
Windows does not have `strndup` and `asprintf`.  Provide equivalents in
terms of other available APIs.  This enables us to build the standard
library for Windows again.
2018-02-28 11:16:18 -08:00
Saleem Abdulrasool
0393bd6b51 runtime: add initializeTypeFieldLookup on COFF
The runtime needs this method to initialize the type fields when loading
the images.  This was added to the ELF side of the initialization path
but not the COFF side.  It repairs the swiftCore.dll build for Windows.
2018-02-28 11:09:26 -08:00
swift-ci
00dfc9cff2 Merge remote-tracking branch 'origin/master' into master-next 2018-02-28 08:12:19 -08:00
John McCall
4e49329393 Make is-reflectable a type descriptor flag instead of a separate field.
Also fix a test for 32-bit compatibility.
2018-02-28 00:38:00 -05: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
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
swift-ci
fbf8af847b Merge remote-tracking branch 'origin/master' into master-next 2018-02-23 23:11:13 -08:00
Michael Gottesman
ba9946a131 Add a dumper/verifier for OpaqueExistentialContainers (i.e. Any) in c++.
The dumper method dumps:

1. The container's metadata pointer.
2. A pointer to the container's value.
3. Whether or not said value is stored inline in the container.

This provides a general overview that can be used even when working with SIL
code in the debugger by grabbing a pointer to swift Anys and then calling the
c++ any method upon them.

The verifier is intended to be used in conjunction with ASAN for maximum
effect to catch use-after-frees of existential boxes.

While implementing this I refactored some code from ExistentialTypeMetadata into
methods on OpaqueExistentialContainer. ExistentialTypeMetadata just calls these
methods now instead of implementing the code inline.
2018-02-23 23:03:55 -08:00
swift-ci
a1dc2330aa Merge remote-tracking branch 'origin/master' into master-next 2018-02-22 14:32:06 -08:00
Mike Ash
35e4d1e07a Merge branch 'master' into remove-reflectionlegacy 2018-02-22 14:44:41 -05:00
Mike Ash
03476e919e Merge branch 'master' into remove-reflectionlegacy 2018-02-22 11:44:55 -05:00
swift-ci
fc39bb57bb Merge remote-tracking branch 'origin/master' into master-next 2018-02-21 17:45:02 -08:00
Pavel Yaskevich
9288b71b60 [MetadataLookup] Enable field descriptor cache 2018-02-21 15:26:19 -08:00
Mike Ash
c250a844d0 [Runtime] Add a declaration for swift_demangle to the header file and export it.
rdar://problem/20356017
2018-02-21 17:22:09 -05:00
Mike Ash
50697a7778 [Runtime] Guard ReflectionMirror's vw_destroy call to avoid emitting it when +0 is enabled.
rdar://problem/20356017
2018-02-21 14:33:05 -05:00
Mike Ash
29eb740bf3 [Runtime] Style fixes in new ReflectionMirror code.
rdar://problem/20356017
2018-02-21 14:32:17 -05:00
swift-ci
c93e69746b Merge remote-tracking branch 'origin/master' into master-next 2018-02-21 10:59:05 -08:00
swift-ci
8a1cc43d82 Merge remote-tracking branch 'origin/master' into master-next 2018-02-20 19:18:13 -08:00
Pavel Yaskevich
94017f7ee7 [IRGen] Remove 'FieldNames' field from type context descriptor
All of the information contained by this field (list of property names)
is already encoded as part of the field reflection metadata and
is accessible via `swift_getFieldAt` runtime method.
2018-02-20 18:49:00 -08:00
Joe Groff
eb316818c5 Demangler: Fill in places we need to handle symbolic references and OtherNominalTypes when demangling bound generic types. 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
194c84e0a4 [MetadataLookup] Properly setup Demangler symbolic ref resolver 2018-02-20 18:20:09 -08:00