aabalke/gojit is a revival of nelhage/gojit and rasky/gojit, providing jit compilation for Golang version 1.17+. The major functionality this fork adds is the ability for Go functions to be called from jit code, without causing errors from stack checks during garbage collection or stack growth.
This jit compiler requires an x86/amd64 system, and go version 1.17+. For handling in golang version 1.16 and earlier please read.
If a Go function is called from jit code, the Go functions must have a nosplit directive. If the JIT mutates variables though pointers, those variables must be heap allocated, and/or global.
See the example directory for basic examples, or see the Guac Emulator if you are interested in a real-life example. It includes the setup of multiple JIT pages, analysis and metrics for JIT compilation thresholds, invalidation, and an LRU cache for invalidating dead JIT compiler blocks.