Add create_mcjit_execution_engine_with_memory_manager for custom MCJIT memory management #566
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new function,
create_mcjit_execution_engine_with_memory_manager
, which allows users to supply their own JIT memory manager (McjitMemoryManager
trait). This enables custom allocation, finalization, and teardown logic for code and data sections under MCJIT.Related Issue
Close #296
How This Has Been Tested
Tested on a Mac M1 MAX host running Docker (Debian bookworm),
with LLVM 18 installed inside the container.
allocate_code_section
,allocate_data_section
,finalize_memory
, anddestroy
callbacks are invoked by MCJIT.Checklist
Changes
New Public API
McjitMemoryManager
Traitallocate_code_section
,allocate_data_section
,finalize_memory
, anddestroy
.MemoryManagerAdapter
allocate_code_section_adapter
,allocate_data_section_adapter
, etc.).destroy()
.By merging this PR, Inkwell will support custom JIT memory management for MCJIT, addressing use cases like:
.llvm_stackmaps
for garbage collection.Thank you for reviewing!