Commit Graph

228 Commits

Author SHA1 Message Date
Slava Pestov
c9cd33bb0a Reflection: This test requires Objective-C interop 2016-06-02 19:34:08 -07:00
David Farler
492a26bf40 [SwiftRemoteMirror] Consider ObjCClass field descriptors when converting TypeInfos
@slava_pestov recently folded in @objc classes when building class field
descriptors - we just need to update the switch when considering records
for converting TypeRefs to TypeInfos.

rdar://problem/26594130
2016-06-02 17:39:35 -07:00
David Farler
1e94e3f382 SwiftRemoteMirror: Add a test for unowned-self captures
NFC.
2016-06-01 18:19:46 -07:00
David Farler
a7fd48a52f SwiftRemoteMirror: Add a test for weak-self captures
NFC.
2016-06-01 18:17:31 -07:00
Andrew Trick
f424f24017 Temporarily disable Reflection/functions.swift.
The test needs to be fixed: rdar://26561954
It was accidentally enabled recently, but was already broken.
2016-05-31 14:30:55 -07:00
Dmitri Gribenko
d0725fecf4 tests: annotate executable tests with corresponding requirements 2016-05-31 00:48:23 -07:00
Slava Pestov
2b1bfcb838 Reflection: Fix tests for iPhoneOS 2016-05-26 19:33:01 -07:00
Slava Pestov
7a46b0f23f Reflection: Emit descriptors for referenced imported protocols
When we encounter a protocol typeref, we have to know if its @objc,
class-bound, or opaque, so make sure we provide the necessary
information when imported protocols are referenced.
2016-05-26 19:33:00 -07:00
Slava Pestov
e2cf23d971 Reflection: Don't emit builtin descriptors for imported classes
Previously we would emit both a builtin descriptor and field
descriptor for imported classes, but we only need the latter.

Untangle some code and fix a crash with imported Objective-C
generics in the process.

Fixes <rdar://problem/26498484>.
2016-05-26 19:32:59 -07:00
Slava Pestov
72e308679c Reflection: Record builtin and imported types referenced from captures 2016-05-26 19:32:58 -07:00
Slava Pestov
803a6b095b Reflection: Emit metadata for fixed-layout SIL boxes
We were recovering metadata from generic boxes by reading
the instantiated payload metadata from the box's metadata,
but this approach doesn't work for fixed-size boxes, whose
metadata does not store the payload metadata at all.

Instead, emit a capture descriptor with no metadata sources
and a single capture, using the lowered AST type appearing
in the alloc_box instruction that emitted the box.

Since box metadata is shared by all POD types of the same
size, and all single-retainable pointer payloads, the
AST type might not accurately reflect what is actually in
the box.

However, this type is *layout compatible* with the box
payload, at least enough to know where the retainable
pointers are, because after all IRGen uses this type to
synthesize the destructor.

Fixes <rdar://problem/26314060>.
2016-05-26 19:32:57 -07:00
David Farler
8f86719f9f Add more Remote Mirror closure tests with different arity/capture count 2016-05-23 16:34:54 -07:00
Luke Larson
dd3f9165dc Reflection: Update tests for latest reflection changes 2016-05-23 13:42:04 -07:00
Luke Larson
940a3a7094 Reflection: Update tests for NS types 2016-05-23 12:57:29 -07:00
Luke Larson
acede5bf97 Reflection: Add tests for single-field classes of various types 2016-05-23 12:57:29 -07:00
David Farler
a38a4ce596 SwiftRemoteMirror: Turn on reflection metadata by default
Flip the enable flags to disable and make these IRGen options
true by default.

rdar://problem/26206547
2016-05-21 17:40:37 -07:00
David Farler
e42fd92fbb SwiftReflectionTest: Don't exit until the parent asks for an instance
Child processes were exiting too early before the parent has a chance
to read a null pointer from the child, indicating that there are no
more instances to reflect. This wasn't a problem on OS X because the
I/O latency is so small compared to the iOS simulator, where the
problem would come up under heavy load. This makes the end-to-end
remote mirror tests deterministic again.

rdar://problem/26230879
2016-05-18 02:27:53 -07:00
David Farler
cbfc93924b Temporarily fix end-to-end remote mirror tests to OS X
There is an issue with writing to pipes under heavy load in the iOS
simulator but is intermittent. Disabling the tests there while I
investigate.

rdar://problem/26230879
2016-05-17 18:52:25 -07:00
David Farler
c9e0df7d4d Add an opaque field for necessary bindings struct
Without this, offsets of captures in closure contexts may be
incorrect if there is a non-empty necessary bindings structure
at the front.

rdar://problem/26312900
2016-05-16 20:25:35 -07:00
Slava Pestov
710d7ede71 Reflection: Break out SWIFT_RAW_POINTER vs SWIFT_BUILTIN in the C API
Also, use "opaque existential" consistently to refer to non-class
existentials, and clean up some other random bits.
2016-05-12 18:27:35 -07:00
David Farler
9dddc6492b SwiftRemoteMirror: Project error existentials
Error existentials have a kind of special heap layout and can also
be compatible as NSError instances, too.
2016-05-10 12:50:31 -07:00
David Farler
2fd0b39751 SwiftRemoteMirror: move dump APIs to print to stdout instead of stderr
Rather than move file descriptors around in the tools, just tell the
underlying ::dump methods to print to stdout instead.
2016-05-09 14:29:33 -07:00
Slava Pestov
c90ee3c322 Reflection: Fix for last-minute fix for 32-bit platforms that broke 64-bit platforms 2016-05-09 14:18:04 -07:00
Slava Pestov
75bd780aca Reflection: Add support for closure contexts to readMetadataFromInstance()
Also add end-to-end tests for this finally, and fix a bug in
the SwiftReflectionTest library where we would give up on an
module completely if it did not have a field metadata section.
This is of course wrong if the module defines closures but
not nominal types.
2016-05-09 13:41:56 -07:00
Slava Pestov
14b17379f5 Reflection: Try to fix validation tests 2016-05-05 14:41:25 -07:00
David Farler
87e1ab5dcf SwiftRemoteMirror: Add validation test for projecting existentials 2016-05-04 15:57:44 -07:00
David Farler
fb34de8644 Use target-run to run swift-reflection-test-based tests
These may need to run inside the simulator and so need
xcrun simctl spawn ...
2016-05-03 21:47:04 -07:00
David Farler
5f5ce39a1d SwiftRemoteMirror: Wire up existential projection API
Implement the ReflectionContext's implementation of:
swift_reflection_projectExistential.

First, we get the type info of the existential typeref - it should be a
record type info. If it's a class existential, it has trivial layout:
the first word is a pointer to the class instance. Otherwise, if the
value fits in the 3-word buffer of the existential container, it
trivially is also at the start of the container. Otherwise, the value is
off in a heap box somewhere, but the first word of the container is a
pointer to that box.
2016-05-03 21:04:31 -07:00