-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
JIT: lay groundwork for custom layouts #111942
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
@jakobbotsch PTAL New features aren't yet implemented, but that shouldn't be too hard once we settle on an API surface. I kept the interface to the rest of the code the same for now. |
Sorry to keep nagging... I was hoping to see an API that can be used roughly in the following way: ClassLayoutBuilder builder(compiler);
builder.SetSize(124);
builder.SetName("MyLayout");
builder.SetShortName("ShortName");
builder.SetPointer(8, TYPE_GC_REF);
builder.SetPointer(16, TYPE_GC_BYREF);
ClassLayout* layout = compiler->typGetCustomLayout(builder); |
I'm just curious - do we need this builder for something other than Object-on-stack? Presumably hiding custom layout creation under named APIs sort of keeps VM impl details in one place since JIT has to make assumptions about object layout without asking VM |
One thing I've had in mind with this work for a long time is the ability to represent remainders in physical promotion. It's one of my items in #110642 and #103362.
I am fine with adding some named helpers too (even as the static members that @AndyAyersMS started with)... I was just hoping to have a more flexible central builder type. Doing this is something I've been thinking about for a long time, but I didn't really communicate my thoughts clearly enough here. |
Seems like if you want that kind of fluent pattern you'll have a bunch of intermediate state that you'll have to store somewhere. If you force the size to be disclosed up front you can allocate a ClassLayout immediately and a GC byte array if/when needed and there's no need to save up anything... |
That's a good point -- it seems reasonable to require the size up front. I tried that out with the kind of shape I was thinking here: https://github.com/dotnet/runtime/compare/main...jakobbotsch:class-layout-builder?expand=1 |
Looks good to me. |
Subsumed by #112064 |
No description provided.