Uh oh!
There was an error while loading. Please reload this page.
Allocate all long-lived contents of interpreter memory via the jit interface allocation apis - #125091
Conversation
…aBuilder Remove the unused InterpReloc struct, m_relocs member, and AddReloc method from InterpMethodDataBuilder. The relocation application loop in Finalize is also removed since there are no relocs to apply. The MemPoolAllocator constructor parameter is removed since it was only needed for the TArray<InterpReloc> member, and the datastructs.h include is dropped as TArray is no longer used in the header. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Pull request overview
This PR refactors CoreCLR interpreter method compilation to place long-lived per-method data (bytecode header + bytecodes + method metadata + related structures) into a single allocation obtained via the JIT allocMem interface, with the goal of preventing leaks for collectible assemblies.
Changes:
- Introduces
InterpMethodDataBuilderto size/lay out a unified method-data allocation. - Switches
InterpCompiler::CompileMethodto returnbooland addsGetTotalAllocationSize/FinalizeMethodDatato drive unified allocation and finalization. - Adds a new interpreter memory kind (
IMK_MethodData) and updates allocator plumbing (MemPoolAllocator) and build inputs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/interpreter/interpmethoddata.h | Adds method-data section model and builder API for unified allocation layout. |
| src/coreclr/interpreter/interpmethoddata.cpp | Implements section sizing, alignment, and final offset computation for unified allocation. |
| src/coreclr/interpreter/interpmemkind.h | Adds MethodData memkind for compilation-time method data allocations. |
| src/coreclr/interpreter/interpalloc.h | Moves MemPoolAllocator into shared allocator header and changes it to wrap InterpAllocator. |
| src/coreclr/interpreter/eeinterp.cpp | Updates compile pipeline to allocate one unified block and finalize method data into it. |
| src/coreclr/interpreter/compiler.h | Updates compiler API for new allocation/finalization flow; adds builder + fixup tracking state. |
| src/coreclr/interpreter/compiler.cpp | Implements new finalization/copy/fixup logic; changes AllocMethodData to use arena allocator. |
| src/coreclr/interpreter/CMakeLists.txt | Adds interpmethoddata.cpp to interpreter build. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…righton/runtime into mini_interpreter_linker_2
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
This makes all allocation of memory for the interpreter which are long-lived be allocated in the one big allocation. This should fix any issues where we have memory leaking from collectible assemblies.