-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Serialize and Deserialize Debug Scopes #76934
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
@swift-ci test |
798881e
to
2d1a948
Compare
@swift-ci test |
2d1a948
to
0edb969
Compare
def experimental_serialize_debug_info: | ||
Flag<["-"], "experimental-serialize-debug-info">, | ||
Flags<[FrontendOption, HelpHidden]>, | ||
HelpText<"Enables seriailzation/deserialization of debug scopes">; |
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 should become on by default eventually, right?
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.
Yes it should be. I am not sure if we want to turn it on right now. @kubamracek Do you have a suggestion here? Thanks
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.
Yeah, I think this is a staging flag, correct? Sounds like a good approach to me.
@swift-ci test |
@swift-ci please test windows platform |
@swift-ci please test |
@swift-ci test |
1 similar comment
@swift-ci test |
// ii) Deserialized by linker/optimizer -> deserialized for debugging -> | ||
// no zombie created | ||
|
||
if (fn->isZombie() && !forDebugScope) { |
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.
@eeckstein I hope you can take a look at this again. Thanks
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.
lgtm
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.
lgtm!
This patch adds code for serializing and deserializing debug scopes. During serialization, declarations of functions only referred to by debug scopes are serialization. During deserialization, these declarations are deserialized as zombie functions. The deserializer refuses to deserialize these functions when referred to by the optimizer, such as during Generic Specialization.
deserialized from stdlib
This reverts commit 384877f.
599cac2
to
f3ae48b
Compare
@swift-ci test |
@swift-ci please test macOS platform |
Serialize functions referred only from debug scopes as zombies. Serialize rest of the functions normally.
While deserializing, if isDebug (deserializing for debug scopes) only deserialize the declaration as zombie and mark function as private/shared since public functions make into the final binary causing linking errors.
If function is later referred to in non debug scope context and the function was not marked a zombie while serializing, resurrect the function, deserialize body if applicable and return it.
While serializing instructions, whenever the debug scopes of the instruction changes, the new scope along with parents is serialized in post order.