All Projects → kavon → llvm-statepoint-utils

kavon / llvm-statepoint-utils

Licence: MIT License
Runtime support for LLVM's GC Statepoints

Programming Languages

c
50402 projects - #5 most used programming language
LLVM
166 projects
Makefile
30231 projects
sed
78 projects

Projects that are alternatives of or similar to llvm-statepoint-utils

cactusref
🌵 Cycle-Aware Reference Counting in Rust
Stars: ✭ 129 (+268.57%)
Mutual labels:  garbage-collector, garbage-collection
mmtk-core
Memory Management ToolKit
Stars: ✭ 205 (+485.71%)
Mutual labels:  garbage-collector, garbage-collection
on-the-fly-gc
Concurrent mark-sweep garbage collector for accurate garbage collection of language runtimes in C++ 1x.
Stars: ✭ 25 (-28.57%)
Mutual labels:  garbage-collector, garbage-collection
jitmap
LLVM-jitted bitmaps
Stars: ✭ 25 (-28.57%)
Mutual labels:  llvm
stack-guard
A toy implementation of 'Stack Guard' on top of the LLVM compiler toolchain
Stars: ✭ 21 (-40%)
Mutual labels:  llvm
ugo-compiler-book
📚 µGo语言实现(从头开发一个迷你Go语言编译器)[Go版本+Rust版本]
Stars: ✭ 996 (+2745.71%)
Mutual labels:  llvm
lleaves
Compiler for LightGBM gradient-boosted trees, based on LLVM. Speeds up prediction by ≥10x.
Stars: ✭ 132 (+277.14%)
Mutual labels:  llvm
chimera
🐍 A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
Stars: ✭ 12 (-65.71%)
Mutual labels:  llvm
ts-llvm
TypeScript to LLVM compiler (abandoned)
Stars: ✭ 266 (+660%)
Mutual labels:  llvm
wasm-toolchain
WebAssembly toolchain
Stars: ✭ 34 (-2.86%)
Mutual labels:  llvm
glottie
OpenGL/WebGL based Lottie animation player
Stars: ✭ 60 (+71.43%)
Mutual labels:  llvm
gogo
Go to MIPS compiler, written in Go. Course project for Compiler Design (CS335).
Stars: ✭ 25 (-28.57%)
Mutual labels:  garbage-collection
malgo
A statically typed functional programming language.
Stars: ✭ 37 (+5.71%)
Mutual labels:  llvm
python-memory-management-course
Demo code exploring Python's memory models and collection algorithms from the Talk Python Training course.
Stars: ✭ 31 (-11.43%)
Mutual labels:  garbage-collection
llvm-hs-typed
Type Safe LLVM IR ( Experimental )
Stars: ✭ 47 (+34.29%)
Mutual labels:  llvm
clam
Static Analyzer for LLVM bitcode based on Abstract Interpretation
Stars: ✭ 180 (+414.29%)
Mutual labels:  llvm
IR2Vec
Implementation of IR2Vec, published in ACM TACO
Stars: ✭ 28 (-20%)
Mutual labels:  llvm
dmjit
.dmJIT is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle! (formerly known as dm-jitaux)
Stars: ✭ 18 (-48.57%)
Mutual labels:  llvm
docker-garby
Just another Docker maintenance script, managing garbage collection of Docker containers and images.
Stars: ✭ 36 (+2.86%)
Mutual labels:  garbage-collector
book
Writing Interpreters in Rust: a Guide
Stars: ✭ 150 (+328.57%)
Mutual labels:  garbage-collection

LLVM Statepoint Utilities

Build Status

LLVM's statepoint infrastructure generates stack frame layout information to enable precise garbage collection. However, the information is not in a suitable form for efficient lookups by an actual garbage collector scanning the stack. This design is intentional because "the runtime is expected to parse the [stack map] immediately after compiling a module and encode the information in its own format."

The utilities herein are designed to do just that: it can generate an efficient hash table at runtime that can be used by a garbage collector to walk the stack and find all pointers. Generating the table at runtime works around issues with position independent code, since the table is keyed on absolute return addresses. The code is pure, unadulterated C99* with no dependencies and a permissive license.

Note that this library was designed to work for programs whose stack map information was generated solely by gc.statepoint intrinsics, as these intrinsics generate specially formatted stack map records. If you're mixing patchpoint or regular stackmap intrinsics in the same code, you might need to modify the library in addition to marking call sites to differentiate them from statepoints.

The currently supported Stackmap Format is version 3, which is found in LLVM 5+.

how to build and use

  1. Run OPT_FLAG="-O3 -DNDEBUG" make
  2. Look inside dist and you should see a library file and a header file
  3. Enjoy

* almost... we rely on the packed attribute supported by popular C compilers (i.e., clang and gcc).

including these utils in your project

You can generate a single .c and corresponding .h file for inclusion in your own build system. To do this, run make unified, and the output code will be placed under build/.

a fancier implementation

To avoid having to generate the hash table each time the program starts up, you could extend this utility to instead generate a position-independent, static, callsite-offset table. For example, to lookup information about a callsite, we would:

  1. Take the return address, and subtract from it the starting address of the .text section, to obtain the callsite offset. The starting address would change on each launch because of ASLR, but it can be determined once during program startup and saved to a global variable.

  2. Use the call-site offset as the key into the statically allocated table. There are various ways of doing this, such as using a perfect hash function + a pointer array, or generating a standard hash table that is laid out statically in the data section.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].