-
Notifications
You must be signed in to change notification settings - Fork 10.5k
RemoteAST fixes #22502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RemoteAST fixes #22502
Conversation
b7d31e4
to
d21de1c
Compare
@swift-ci Please smoke test |
/// pointer to its metadata address, its value address, and whether this | ||
/// is a toll-free-bridged NSError or an actual Error existential wrapper | ||
/// around a native Swift value. | ||
Optional<std::tuple<RemoteAddress, RemoteAddress, bool>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider just making a struct
, especially since this type is used multiple places throughout the reader.
@@ -104,7 +104,9 @@ class RemoteASTContextImpl { | |||
getDeclForRemoteNominalTypeDescriptor(RemoteAddress descriptor) = 0; | |||
virtual Result<RemoteAddress> | |||
getHeapMetadataForObject(RemoteAddress object) = 0; | |||
virtual Result<std::pair<Type, RemoteAddress>> | |||
virtual OpenedExistential | |||
getDynamicTypeAndAddressForError(RemoteAddress object) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern was that all of these were Result
-ified.
@swift-ci Please smoke test |
14e36c3
to
40a9880
Compare
@swift-ci Please smoke test |
40a9880
to
8f56bce
Compare
apple/swift-lldb#1287 |
apple/swift-lldb#1287 |
Looks like this breaks LLDB without my larger set of LDLB changes. I'm breaking out #22534 to fix the tagged pointer issue. |
8f56bce
to
1c72e05
Compare
…n up the code flow
An Error existential value can directly store a reference to an NSError instance without wrapping it in an Error container. When "projecting" such an existential, the dynamic type is the NSError's isa pointer, and the payload is the address of the instance itself.
LLDB calls getDynamicTypeAndAddressForExistential() on an existential value without knowing if its a class existential or opaque existential. Class existentials return the address of the instance itself here, whereas opaque existentials always returned the address of the payload value. This meant the caller could not usefully operate on the payload value if it was of class type, because there was no way of knowing if the extra dereference had occurred or not. Now, always load the reference if the wrapped type is a class, even if the existential is opaque. Will be tested on the lldb side with another change I'm working on.
The getDynamicTypeAndAddressForExistential() function takes the address of an existential value; so when looking at an Error, this is the address of the reference, not the address of the instance. lldb needs to look at Error instances too, so add a new entry point named getDynamicTypeAndAddressForError() which avoids the extra dereference. This will be tested on the lldb side.
…ntials with named structs
1c72e05
to
905a6de
Compare
apple/swift-lldb#1287 |
In the service of apple/swift-lldb#1286. Replacing lldb's existing existential projection code path with RemoteAST exposed some limitations in the latter.