Commit Graph

3150 Commits

Author SHA1 Message Date
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
Pavel Yaskevich
3323ae36bf [Metadata] Use ownership info from _typeByMangledName 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
7bcd7306c0 [Runtime/Metadata] Move swift_getFieldAt to new generic context framework 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
50785df558 [Runtime] NFC: Update names of the field section to swift5_fieldmd 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
7a7825ff50 [Runtime/Reflection] Switch enum mirrors to use runtime get field method 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
877c70bae9 [Runtime/Metadata] Add support for dynamic field descriptor registration 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
c44ad571c8 [Runtime/ABI] Add ownership info to the name-to-type metadata builder 2018-02-20 18:20:09 -08:00
Pavel Yaskevich
0da5e48a0e [Runtime/Reflection] Add swift_getFieldAt runtime accessor
Use information from reflection section of the binary to lookup
type field info such as name and it's type and return it using
new `swift_getFieldAt` method based on nominal type and field index.
2018-02-20 18:20:09 -08:00
Pavel Yaskevich
bc1c170a45 [Runtime] Register type field metadata section 2018-02-20 18:18:48 -08:00
John McCall
23fa44e56c Render TypeContextDescriptor into a proper hierarchy; NFC.
The purpose here is to make it easier to add type-specific fields to the
descriptor.
2018-02-20 15:20:32 -05:00
Mike Ash
0cff498db4 [Reflection] Use getClassObject() when testing for ObjCness rather than blindly casting to ClassMetada, which turns out to be completely incorrect. 2018-02-20 15:15:14 -05:00
swift-ci
aa5c530a36 Merge remote-tracking branch 'origin/master' into master-next 2018-02-19 17:09:06 -08:00
Pavel Yaskevich
855e2286cd [Metadata/TypeByName] Don't try to check for dot syntax in presence of symbolic references
If symbolic references are present in the mangled name don't try
to check for convenience dot syntax as well since they can't appear
together.
2018-02-19 14:54:34 -08:00
Mike Ash
fa2ea034d1 Merge branch 'master' into remove-reflectionlegacy 2018-02-19 09:56:57 -05:00
Mike Ash
44d9b2f5cd [Runtime] Move swift_demangle to Demangle.cpp. It seems more at home there. 2018-02-16 16:55:11 -05:00
Mike Ash
33990583df [Runtime] Have ReflectionMirror.mm get SwiftObject declarations from SwiftObject.h. 2018-02-16 16:20:12 -05:00
Mike Ash
4045edf886 [Runtime] Remove old-style mirrors in ReflectionLegacy.swift.
The old-style mirrors were the basis for non-custom, reflection based Mirrors. As part of removing old-style mirrors, reflection based Mirrors are reimplemented without them. Reflection.mm is deleted and replaced with ReflectionMirror.mm, which borrows a chunk of the old code but presents a simpler API to the Swift side. ReflectionMirror.swift then uses that API to implement a reflection-based Mirror init.

rdar://problem/20356017
2018-02-16 16:05:40 -05:00
swift-ci
91376db8cb Merge remote-tracking branch 'origin/master' into master-next 2018-02-16 11:29:49 -08:00
Doug Gregor
800e3818b7 [Type metadata] @objc protocol conformance requirements don't have arguments.
@objc protocols don't have witness tables. However, both type metadata
(in the nominal type descriptors) and the runtime code to demangle
type names into metadata weren't acknowledging this. Fix type metadata
emission to not count an "extra argument" for @objc protocol
conformance requirements, and teach the runtime code to properly look
for conformances to @objc protocols (through the Objective-C runtime)
and not record witness tables for them.
2018-02-15 14:07:46 -08:00
swift-ci
934240baba Merge remote-tracking branch 'origin/master' into master-next 2018-02-14 22:29:26 -08:00
Pavel Yaskevich
33996de39c Merge pull request #14649 from xedin/objc-existential-type-by-name
[Runtime] Existential types marked as @objc should satisfy class requirement
2018-02-14 22:28:37 -08:00
Pavel Yaskevich
73f09ecbf5 [Runtime] Existential types marked as @objc should satisfy class requirement
Make sure that `checkGenericRequirements` properly enforces
"class requirement" constraint on the generic parameters.
2018-02-14 21:16:44 -08:00
swift-ci
6dd6a9213b Merge remote-tracking branch 'origin/master' into master-next 2018-02-14 15:49:04 -08:00
Michael Gottesman
7bceb07083 [+0-normal-args] Upstream fixes for _bridgeAnythingNonVerbatimToObjectiveC and _bridgeNonVerbatimFromObjectiveCConditional at +0.
NFC with +1 arguments. I am testing this upstream against SILGen changes.

rdar://34222540
2018-02-14 14:34:20 -08:00
swift-ci
5be3c78ef9 Merge remote-tracking branch 'origin/master' into master-next 2018-02-14 09:29:30 -08:00
Mike Ash
4c9dc2677c Merge pull request #14375 from mikeash/fix-slowalloc-alignment
[Runtime] Fix swift_slowAlloc to respect its alignMask parameter.
2018-02-14 12:29:14 -05:00
swift-ci
eddd61be68 Merge remote-tracking branch 'origin/master' into master-next 2018-02-14 08:09:28 -08:00
Arnold Schwaighofer
fff94ad18c Fix comment of escape and noescape witness tables 2018-02-14 05:32:33 -08:00
swift-ci
beae25974d Merge remote-tracking branch 'origin/master' into master-next 2018-02-14 05:29:28 -08:00
Arnold Schwaighofer
74e1cfaeb3 runtime: Implemenation of value witness for @noescape types
We should not need those -- except (at least) for functions passed as
arguments to materializeForSet ...
2018-02-13 04:19:59 -08:00
swift-ci
831a238176 Merge remote-tracking branch 'origin/master' into master-next 2018-02-12 12:29:36 -08:00
Joe Groff
b53d90e8e2 Merge pull request #14512 from jckarter/mangling-symbolic-references
IRGen/Runtime: Allow mangled type refs to embed "symbolic references" to type context descriptors.
2018-02-12 12:21:19 -08:00
Joe Groff
953dddd5d3 IRGen/Runtime: Allow mangled type refs to embed "symbolic references" to type context descriptors.
This makes resolving mangled names to nominal types in the same module more efficient, and for eventual secrecy improvements, also allows types in the same module to be referenced from mangled typerefs without encoding any source-level name information about them.
2018-02-10 10:43:47 -08:00