Commit Graph

16 Commits

Author SHA1 Message Date
Ben Troller
bb3c7f5ee8 [RemoteMirror] Allow clients to specify whether Obj-C interop is enabled.
rdar://119570103
2024-01-26 13:11:10 -08:00
Kuba (Brecka) Mracek
ab6533a40f Merge branch 'master' into mracek/arm64e 2020-03-06 15:07:01 -08:00
tbkka
0d361bd3ea Teach RemoteMirror how to project enum values (#30161)
Teach RemoteMirror how to project enum values

This adds two new functions to the SwiftRemoteMirror
facility that support inspecting enum values.

Currently, these support non-payload enums and
single-payload enums, including nested enums and
payloads with struct, tuple, and reference payloads.
In particular, it handles nested `Optional` types.

TODO: Multi-payload enums use different strategies for
encoding the cases that aren't yet supported by this
code.

Note: This relies on information from dataLayoutQuery
to correctly decode invalid pointer values that are used
to encode enums.  Existing clients will need to augment
their DLQ functions before using these new APIs.

Resolves rdar://59961527

```
/// Projects the value of an enum.
///
/// Takes the address and typeref for an enum and determines the
/// index of the currently-selected case within the enum.
///
/// Returns true iff the enum case could be successfully determined.
/// In particular, note that this code may fail for valid in-memory data
/// if the compiler is using a strategy we do not yet understand.
SWIFT_REMOTE_MIRROR_LINKAGE
int swift_reflection_projectEnumValue(SwiftReflectionContextRef ContextRef,
                                      swift_addr_t EnumAddress,
                                      swift_typeref_t EnumTypeRef,
                                      uint64_t *CaseIndex);

/// Finds information about a particular enum case.
///
/// Given an enum typeref and index of a case, returns:
/// * Typeref of the associated payload or zero if there is no payload
/// * Name of the case if known.
///
/// The Name points to a freshly-allocated C string on the heap.  You
/// are responsible for freeing the string (via `free()`) when you are finished.
SWIFT_REMOTE_MIRROR_LINKAGE
int swift_reflection_getEnumCaseTypeRef(SwiftReflectionContextRef ContextRef,
                                        swift_typeref_t EnumTypeRef,
                                        unsigned CaseIndex,
                                        char **CaseName,
                                        swift_typeref_t *PayloadTypeRef);
```


Co-authored-by: Mike Ash <mikeash@apple.com>
2020-03-06 13:17:40 -08:00
Kuba Mracek
84c4864911 [arm64e] Add Swift compiler support for arm64e pointer authentication 2020-02-27 16:10:31 -08:00
Kuba (Brecka) Mracek
84e71b8d7a Change the RemoteMirror API to have extensible data layout callback (#15291)
* Change the RemoteMirror API to have extensible data layout callback

* Use DLQ_Get prefix on DataLayoutQueryType enum values

* Simplify MemoryReaderImpl and synthesize minimalDataLayoutQueryFunction
2018-03-16 14:54:04 -07:00
Mike Ash
d775f72d19 [RemoteMirrors] Support passing NULL for the FreeBytesFunction. 2018-02-27 15:16:15 -05:00
Mike Ash
71f1c391ab [RemoteMirrors] Move FreeBytesFunction from an out-parameter on ReadBytesFunction to a function pointer passed in when creating a reflection context. 2018-02-27 12:51:04 -05:00
Mike Ash
bf58357e54 [Reflection] Change ReadBytesFunction to return a pointer rather than copying data, and adjust its users accordingly.
rdar://problem/37538580
2018-02-21 12:17:28 -05:00
Mike Ash
902e34a68e [Reflection] Sketch out desired changes to the RemoteMirror API to hide swift_reflection_info, so API clients don’t need to know the details of the sections where this info is stored.
rdar://problem/37538580
2018-02-19 11:24:22 -05:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
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
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
Slava Pestov
ddc81e1b68 Reflection: Some more refactoring for swift-reflection-test, NFC 2016-05-02 01:16:24 -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
90f1523c4c Add opaque context pointer to SwiftRemoteMirror C API Reader API
Memory readers on the C-side of the API may actually have an object-
oriented design, so they may want to pass an instance to revive
when callbacks make it to the other side of the API boundary.
2016-04-25 00:00:27 -07: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