-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add interface for lookup up of externally stored type descriptors #69556
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
Conversation
5f92b33
to
3eaf708
Compare
@slavapestov this is my approach for looking up descriptors that live outside of reflection metadata. With this approach we can keep the entire type information building logic inside remote mirrors, and only implement in LLDB the logic to look up the descriptors. |
@swift-ci smoke test |
@swift-ci smoke test |
3eaf708
to
77b4b00
Compare
@swift-ci smoke test |
77b4b00
to
8046460
Compare
@swift-ci smoke test |
Separate the functionality that reads descriptors from reflection information into its own class.
0c212b3
to
d739887
Compare
@swift-ci smoke test |
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.
In general I think this looks promising, but the diff is so large due to the formatting changes that it's a bit difficult to review.
struct DescriptorFinder { | ||
virtual ~DescriptorFinder(){}; | ||
|
||
virtual std::unique_ptr<BuiltinTypeDescriptorInterface> |
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.
Performance-wise, you could design the base class to already have all the data members needed by all implementations, maybe with an opaque element for implementation-specific data, then you could pass a stack-allocated object through this interface and don't need to use unique_ptr here.
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.
Personally I don't think the performance benefits would be worth the extra complexity. There's already indirection going on today when using RemoteRef
, and there will be a pretty big difference in size between the DWARF version and the reflection version, so accommodating both on the base class would look a bit ugly imo.
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.
If this is only used in the debugger and similar clients, I think that's reasonable. If it's used in-process then I'm not sure.
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.
This is only used for out of process inspection.
d739887
to
3793b29
Compare
@swift-ci smoke test |
NormalizedReflectionNameCache; | ||
|
||
/// Cache for built-in type descriptor lookups. | ||
std::unordered_map<std::string /* normalized name */, |
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.
Not for this patch, but since we have LLVM here, this should probably be a StringMap for better efficiency. Same for all the other caches.
3793b29
to
5327590
Compare
@swift-ci test |
@swift-ci smoke test |
Currently, TypeRefBuilder knows how to parse type descriptors from reflection metadata. We aim to store the same information that lives in type descriptors externally, as an effort to support embedded Swift debugging. In order to take advantage of all of the existing type information parsing code that exists today in remote mirrors, add an interface for external lookup of type descriptors, and replace all the usages of type descriptors with their generic counterpart (this patch only adds support for builtin descriptors, but follow up patches will add support for other descriptor types).
5327590
to
f09f518
Compare
@swift-ci smoke test |
Currently, TypeRefBuilder knows how to parse type descriptors from reflection metadata. We aim to store the same information that lives in type descriptors externally, as an effort to support embedded Swift debugging. In order to take advantage of all of the existing type information parsing code that exists today in remote mirrors, add an interface for external lookup of type descriptors, and replace all the usages of type descriptors with their generic counterpart (this patch only adds support for builtin descriptors, but follow up patches will add support for other descriptor types).