Skip to content

Conversation

MichalStrehovsky
Copy link
Member

This allows us to get rid of a level of indirection when accessing GC static fields.

Fixes #841.

This allows us to get rid of a level of indirection when accessing GC static fields.
@MichalStrehovsky MichalStrehovsky added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Mar 27, 2021
@MichalStrehovsky MichalStrehovsky requested a review from jkotas March 27, 2021 09:23
@MichalStrehovsky
Copy link
Member Author

Cc @yowl - this is removing an indirection when accessing GC static bases - I assume the WASM side will be a one-liner delete, like in the R2R helper nodes in this pull request.

@@ -27,17 +29,25 @@ public static partial class StartupCodeHelpers
/// </summary>
private static int s_moduleCount;

/// <summary>
/// GC handle of an array with s_moduleCount elements, each representing and array of GC static bases of the types in the module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// GC handle of an array with s_moduleCount elements, each representing and array of GC static bases of the types in the module.
/// GC handle of an array with s_moduleCount elements, each representing an array of GC static bases of the types in the module.

max_object_size = (INT32_MAX - 7 - min_obj_size);
}

if (size >= max_object_size)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this checked somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, it's checked in the newly factored out GcAllocInternal. We had all of this duplicated between RhpGcAlloc and AllocateNewArrayImpl. Instead of adding a third copy for AllocateNewObjectImpl, I'm funneling it all to the common helper. But please double check, I would hate to mess this up.

@Suchiman
Copy link

Does the removed indirection mean that statics can be debug evaluated now?

@MichalStrehovsky
Copy link
Member Author

Does the removed indirection mean that statics can be debug evaluated now?

I think it would also be possible before although this still has one extra indirection compared to statics in C++ (statics in C++ are simply allocated in the data section of the executable - here they're on the GC heap and symbols can't refer to the GC heap directly).

I think we're not generating the debug info in the format the debugger expects. I haven't look what VC++ generates.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants