Commit Graph

75 Commits

Author SHA1 Message Date
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
David Farler
941ec1e043 SwiftRemoteMirror: Add reflection metadata version query API
rdar://problem/27251582
2016-07-08 14:12:59 -07:00
Slava Pestov
da40b5e566 Merge pull request #2285 from tinysun212/pr-portability-1
[SwiftRemoteMirror] Renamed addr_t to swift_addr_t
2016-06-02 10:59:46 -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
Han Sangjin
675de4048d [SwiftRemoteMirror] Renamed addr_t to swift_addr_t
They would think the type 'addr_t' is defined in the standard library
because it has the same name format with the types in <cstdint>. In
addition, the definition conflicts in Cygwin which defines it differently
in the system library.
2016-05-11 04:02:11 +09: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
David Farler
bfc94f4290 SwiftRemoteMirror: Add API to convert mangled type name to a typeref
This is useful on its own as well as for testing, so you can generate
typerefs to canned types such as Any, Swift.Int, etc.
2016-05-03 21:04:31 -07:00
David Farler
97fe3e70d9 SwiftRemoteMirror: Add convenience API for demangling
rdar://problem/26060031
2016-05-03 19:11:00 -07:00
Slava Pestov
faecfda594 Reflection: Consolidate some code for passing around reflection sections
I'm about to add a new section, and I'd like to update as few
places as possible.
2016-04-30 15:12:38 -07:00
Slava Pestov
1d5b9b09ac Reflection: Add instance-specific layout entry point, and do some refactoring
Closure context layout will depend on the instance itself as well
as the isa pointer, because instead of instantiating metadata for
closures that capture generic parameters, we store the substitutions
inside the context itself.

For classes, this entry point just reads the isa pointer, applies
the isa mask and proceeds down the metadata path.

For now, the only the latter is hooked up.
2016-04-29 15:39:49 -07:00
David Farler
cef6a23310 Fix doc comment for swift_reflection_genericArgumentCountOfTypeRef, NFC. 2016-04-29 11:28:17 -07:00
Slava Pestov
ce1c30b1bc Reflection: Support reading the remote process's isaMask
Also, use the instance layout entry point in swift-reflection-test,
so that we can dump the layout of a class instance and not the
lowering of the reference value.
2016-04-28 22:56:15 -07:00
David Farler
210f8dfe63 swift-reflection-test: Target SwiftRemoteMirror C API
This tool should test the usage from SwiftRemoteMirror dylib and
the C API, since that is the public interface from which we're
vending the remote reflection functionality.
2016-04-28 19:38:03 -07:00
David Farler
9b06e78965 SwiftRemoteMirror: More convenience APIs for dumping
Add convenience functions for dumping the typeinfos via an isa pointer
and a typeref.
2016-04-28 18:07:31 -07:00
David Farler
f2189162fe SwiftRemoteMirror: Add convenience API for dumping typerefs. 2016-04-28 14:52:06 -07:00
David Farler
84c3613e12 SwiftRemoteMirror: Add API stub for projecting existentials
This API will take a pointer to the start of an existential
container and its typeref and provide a typeref for its
instance type and the address to the start of the instance's
data.

This has a dummy implementation that returns false for now.
2016-04-28 14:52:06 -07:00
Slava Pestov
7a9a4dca83 Reflection: Preliminary C API entry points for class instance layout
Tested by manually running swift-reflection-test, no automated
tests yet, but coming soon.
2016-04-27 23:15:08 -07:00
David Farler
88fde5050d SwiftRemoteMirror: Fix missing ReaderContext in creation API
swift_reflection_createReflectionContext was defaulting to C++ mangling
because the declaration under extern C in the header didn't match
its signature.
2016-04-27 12:53:39 -07:00
Slava Pestov
936d4e5e23 Reflection: Flesh out SwiftRemoteMirror C API
- Add swift_reflection_genericArgumentCountOfTypeRef()
- Flesh out swift_reflection_infoForTypeRef()
- Flesh out swift_reflection_infoForChild()
2016-04-24 23:36:31 -07:00
Slava Pestov
824bd7544d IRGen: Emit typerefs for all builtin types referenced from reflection metadata sections
In order to perform layout, the remote mirrors library needs to know
about the size, alignment and extra inhabitants of builtin types.

Ideally we would emit a reflection info section in libswiftRuntime.o,
but in the meantime just duplicate builtin type metadata for all
builtin types referenced from the current module instead.

In practice only the stdlib and a handful of overlays like the SIMD
overlay use builtin types, and only a few at a time.

Tested manually by running swift-reflection-tool on the standard
library -- I'll add automated tests by using -parse-stdlib to
reference Builtin types in a subsequent patch that adds more layout
logic.

NFC if -enable-reflection-metadata is off.
2016-04-15 00:12:11 -07:00
David Farler
20f5304b90 Revised SwiftRemoteMirror C API
Some minor changes to the SwiftRemoteMirror C API, NFC yet.
2016-04-13 13:09:27 -07:00
David Farler
0b04b90895 SwiftRemoteMirrors: Stub implementations for infoFor{TypeRef,Field}
These are just some dummy implementations to temporarily appease
the linker.
2016-04-11 20:03:45 -07:00
David Farler
90d29340a0 Add full SwiftRemoteMirror C API
This just adds the prototypes for the SwiftRemoteMirror C API, which
will call into the appropriate methods of the ReflectionContext.
2016-04-11 19:11:36 -07:00
practicalswift
c26098c877 [gardening] Fix file header formatting. 2016-04-06 21:30:01 +02:00
David Farler
358a0fefe8 Add SwiftRemoteMirror library
This will wrap the ./lib/Reflection functionality in a C
interface.
2016-04-05 13:45:46 -07:00