How to use stack maps

Is there an explanation anywhere of what code that uses a stack map looks like? I’m interested in writing a garbage collector, but it’s not clear to me how my code should make use of the stack map format to actually locate roots in memory.

Hi,
I implemented a garbage collector for a language I wrote in college using the llvm gc statepoint infrastructure.

Information for statepoints:
https://llvm.org/docs/Statepoints.html

Example usage of parsing the llvm stackmap can be found at:
https://github.com/dotnet/llilc/blob/master/lib/GcInfo/GcInfo.cpp
https://llvm.org/docs/StackMaps.html#stackmap-format

https://github.com/llvm-mirror/llvm/blob/4604874612fa292ab4c49f96aedefdf8be1ff27e/include/llvm/Object/StackMapParser.h

Thanks,
River Riddle

p.s. the stackmap format is intended to be transcoded into whatever internal format you might want. It’s not expected to be a long lived data structure. Given that, the format prioritizes simplicity over size and efficiency of access.

The format itself is documented here: