Hi,
Here's a short unfinished but semi-working patch to try out JITLink
instead of RuntimeDyld, since Greg expressed an interest in it. I'm
not actively working on this myself right now, but in case it helps, I
think the main things to do next are probably: try out the recently
added debugger and perf plugins (I hope these are the equivalents of
the JITEventListener stuff we use), figure out how and when we can
actually cut over, tidy/refactor and possibly consider upstreaming
some C wrappers if we want to minimise the C++ glue we carry. See
patch for a few more details.
While rebasing, I made it use JITLink for LLVM >= 19, but that's
arbitrary. Tested on FreeBSD/amd64 + LLVM 19, 20, 21. I haven't
tried other architectures or 32 bit, and support is clearly moving at
very different speeds with 32 bit support far behind. There is a
published table[1], but it may already be out of date and doesn't talk
about releases. Ideally I guess we'd put this change off as long as
possible and then cut over everywhere with a simple version threshold
just as RuntimeDyld is finally removed (which hopefully requires full
feature parity to happen first!), but the reality might be messier:
RISC-V doesn't work with RuntimeDyld[2] and it's reasonable to want
that to work sooner, and it might also be nice to drop the ugly ARM
workaround from commit 9044fc1d as soon as LLVM < 15 falls off our
radar.
With LLVM 22 (bleeding edge main branch) it builds and runs simple
things, but I get a SIGBUS crash in the regression tests even on
unpatched master, something to look into separately...
[1] https://llvm.org/docs/JITLink.html (bottom of page)
[2] https://www.postgresql.org/message-id/flat/20220829074622.2474104-1-alex.fan.q%40gmail.com