-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Place non-GC statics in the dehydratable section #78795
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,16 +7,28 @@ public abstract class DehydratableObjectNode : ObjectNode | |
| { | ||
| public sealed override ObjectNodeSection GetSection(NodeFactory factory) | ||
| { | ||
| return factory.MetadataManager.IsDataDehydrated ? ObjectNodeSection.HydrationTargetSection : GetDehydratedSection(factory); | ||
| ObjectNodeSection desiredSection = GetDehydratedSection(factory); | ||
|
|
||
| return factory.MetadataManager.IsDataDehydrated | ||
| && desiredSection.Type != SectionType.Uninitialized | ||
| ? ObjectNodeSection.HydrationTargetSection : desiredSection; | ||
| } | ||
|
|
||
| public sealed override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) | ||
| { | ||
| ObjectData result = GetDehydratableData(factory, relocsOnly); | ||
|
|
||
| // If we're not generating full data yet, or dehydration is not active, | ||
| // return the ObjectData as is. | ||
| if (relocsOnly || !factory.MetadataManager.IsDataDehydrated) | ||
| // If we're not actually generating data yet, don't dehydrate | ||
| bool skipDehydrating = relocsOnly; | ||
|
|
||
| // If dehydration is not active, don't dehydrate | ||
| skipDehydrating |= !factory.MetadataManager.IsDataDehydrated; | ||
|
|
||
| // If the data would be placed into an uninitialized section, that's better | ||
| // than dehydrating a bunch of zeros. | ||
| skipDehydrating |= GetDehydratedSection(factory).Type == SectionType.Uninitialized; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe the shared logic could be moved into a helper to ensure it's consistent between
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried with a |
||
|
|
||
| if (skipDehydrating) | ||
| return result; | ||
|
|
||
| // Otherwise return the dehydrated data | ||
|
|
||
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.
I've confirmed in the CI logs this also fixes the linker warning in multimodule testing:
MultiModule.obj : warning LNK4078: multiple '.bss' sections found with different attributes (C0401040). Yay.