[llvm-dev] Building GC on statepoint-example

Jordan Rudd via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 1 14:06:54 PDT 2018


Hi,

I'm trying to build a gc using the statepoint-example strategy. However, after hours of searching, reading documentation and trying to find code examples online, I cannot figure out how to access the Stack Map.

The documentation for statepoint-example says:

The stack map format generated by this GC strategy can be found in the Stack Map Section<https://llvm.org/docs/StackMaps.html#stackmap-section> using a format documented here<https://llvm.org/docs/Statepoints.html#statepoint-stackmap-format>. This format is intended to be the standard format supported by LLVM going forward.

Ok, great, I see the format. But... how do I access the Stack Map from my runtime? Where is it?

The link seems to send me to this instruction:

A JIT compiler can easily access this section by providing its own memory manager via the LLVM C APILLVMCreateSimpleMCJITMemoryManager(). When creating the memory manager, the JIT provides a callback:LLVMMemoryManagerAllocateDataSectionCallback(). When LLVM creates this section, it invokes the callback and passes the section name.

None of these API's are well-documented, so I'm kind of trying to guess what to do here. As a proof of concept, I tried building a do-nothing memory manager that calls APILLVMCreateSimpleMCJITMemoryManager on static initialization and passes the callbacks to it. I link the necessary llvm libs into my runtime and fire it up.

I can confirm that my safepoint poll code is getting hit. I can confirm that creating the "memory manager" is called on runtime boot and that it's succeeding. But the callbacks never get hit. Even if they were, it's unclear how I would use the parameters of those callbacks to locate the stack map.

What am I missing?

Thanks!
Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181101/ad81ae56/attachment.html>


More information about the llvm-dev mailing list