codegen: LLVM 21 ThreadSafeContext and EHFrame compatibility#61273
Conversation
8f8c746 to
a445648
Compare
|
Analyzegc is unhappy: https://buildkite.com/julialang/julia-master/builds/55503#019cd3d0-ac7c-40b7-99ec-70394e193ab7/L2196 |
a445648 to
c0284d5
Compare
|
It's awkward that |
e0d3627 to
86b0ff5
Compare
LLVM 21 removes `jitlink::EHFrameRegistrar` and changes the `EHFrameRegistrationPlugin` constructor to use a factory method. Use the new EHFrameRegistrationPlugin constructor to pass our register/deregister actions. Supersedes #60358. Co-Authored-By: yuyichao <yyc1992@gmail.com> Co-Authored-By: Sam Schweigel <sam.schweigel@juliahub.com>
86b0ff5 to
52bc353
Compare
|
I deleted |
|
All green. Is this ready? |
|
I think so thanks @xal-0 for pushing it forward |
|
Accidentally squashed. Sorry. Can we make it so that the |
…ng#61273) ## Summary - Add `withContextDo` compatibility shim for `ThreadSafeContext` API changes in LLVM 21 (which removes `getLock()`, `Lock`, and `getContext()` in favor of callback-based `withContextDo`) - Replace all manual lock/unlock patterns with scoped `withContextDo` callbacks across `jitlayers.h`, `jitlayers.cpp`, `aotcompile.cpp`, and `disasm.cpp` - Add `JLEHFrameRegistrationPlugin` for LLVM 21+ (which removes `jitlink::EHFrameRegistrar`), using JITLink allocation actions for EH frame registration - Debug asserts ensure `get_context()`/`get_module()` are only called inside `withContextDo` scope - Lock hierarchy respected: TSC locks released before `addOutput()`/`R->replace()` which can trigger materialization Supersedes JuliaLang#59946 and JuliaLang#60358, forward-porting those changes to current master. ## Test plan - [x] Builds and passes smoke test on LLVM 20 - [x] Builds and passes smoke test on LLVM 21 (tested with libLLVM 21.1.2 JLL) - [ ] CI This pull request was written with the assistance of generative AI (Claude). 🤖 Generated with [Claude Code](https://claude.com/claude-code) There is quite a few whitespace changes so ignoring it is quite helpful --------- Co-authored-by: yuyichao <yyc1992@gmail.com> Co-authored-by: Sam Schweigel <sam.schweigel@juliahub.com>
Summary
withContextDocompatibility shim forThreadSafeContextAPI changes in LLVM 21 (which removesgetLock(),Lock, andgetContext()in favor of callback-basedwithContextDo)withContextDocallbacks acrossjitlayers.h,jitlayers.cpp,aotcompile.cpp, anddisasm.cppJLEHFrameRegistrationPluginfor LLVM 21+ (which removesjitlink::EHFrameRegistrar), using JITLink allocation actions for EH frame registrationget_context()/get_module()are only called insidewithContextDoscopeaddOutput()/R->replace()which can trigger materializationSupersedes #59946 and #60358, forward-porting those changes to current master.
Test plan
This pull request was written with the assistance of generative AI (Claude).
🤖 Generated with Claude Code
There is quite a few whitespace changes so ignoring it is quite helpful