-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[ORC] Free ELF debug objects in dealloc action of corresponding code (wip) #168522
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
base: main
Are you sure you want to change the base?
[ORC] Free ELF debug objects in dealloc action of corresponding code (wip) #168522
Conversation
weliveindetail
left a comment
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.
| Err = ES.getExecutorProcessControl().getBootstrapSymbols({ | ||
| {RegistrationAction, rt::RegisterJITLoaderGDBAllocActionName}, | ||
| {DeallocAction, rt::SimpleExecutorMemoryManagerReleaseWrapperName}, | ||
| {TargetMemMgr, rt::SimpleExecutorMemoryManagerInstanceName}, |
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.
InProcessMemoryManager does not expose bootstrap symbols yet. SimpleRemoteEPC does it in createDefaultMemoryManager() and we could do something similar in SelfExecutorProcessControl(). Or should we better enforce it in the JITLinkMemoryManager() base class ctor?
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 think that that sounds reasonable, but we should wait until we've brought up the new ORC runtime: there might be an opportunity to define a widely implementable set of memory allocation primitives there.
| // FIXME: The lookup in the segment info here is a workaround. The below | ||
| // FA->release() is supposed to provide the base address in target memory, | ||
| // but InProcessMemoryManager returns the address of a FinalizedAllocInfo | ||
| // helper instead. |
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.
This is another inconsistency in InProcessMemoryManager. The workaround is ok, but not very reasonable.
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.
There's a substantial further simplification that could be made here: If we're ok with the debug object living for as long as the corresponding JIT'd code then the debug object could be embedded in a special section in the graph, rather than having its own allocation. That would allow you to avoid managing the memory lifetime entirely, and you could just focus on populating the debug object bits and calling the registration and deregistration functions.
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) lldb-shelllldb-shell.Breakpoint/jit-loader_jitlink_elf.testlldb-shell.Breakpoint/jit-loader_rtdyld_elf.testLLVMLLVM.ExecutionEngine/OrcLazy/debug-descriptor.llLLVM.ExecutionEngine/OrcLazy/debug-objects.llLLVM-UnitLLVM-Unit.ExecutionEngine/Orc/_/OrcJITTests/OrcCAPITestBase/EnableDebugSupportIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
We don't want to keep tracking allocations of debug objects in the controller after linking finished. So far, the plugin did that to free the target memory once the corresponding code is unlinked. This patch removes the tracking and instead attaches a dealloc action for it to the target memory of the code.