Documentation
¶
Overview ¶
Package bridge provides assembly bridges for calling JIT-compiled code from Go. This is a pure Go solution (no CGO required).
Platform Support:
- Linux/macOS: Uses System V AMD64 ABI (args in rdi, rsi, rdx)
- Windows: Uses Microsoft x64 ABI (args in rcx, rdx, r8, r9)
The JIT code generator (BuildFibCode) automatically generates platform-specific code for the target platform.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocExecMem ¶
AllocExecMem allocates executable memory. On Unix systems, uses mmap with PROT_READ|PROT_WRITE|PROT_EXEC.
func BuildFibCode ¶
func BuildFibCode() []byte
BuildFibCode generates x86-64 machine code for iterative Fibonacci. This version uses System V AMD64 ABI (Linux/macOS). Arguments: rdi = n, returns result in rax.
func Call0 ¶
Call0 calls a JIT function with no arguments. The JIT function must follow System V AMD64 ABI. Returns the result from rax.
func Call1 ¶
Call1 calls a JIT function with 1 argument. Arguments are passed in: rdi (System V AMD64 ABI) Returns the result from rax.
func Call2 ¶
Call2 calls a JIT function with 2 arguments. Arguments are passed in: rdi, rsi Returns the result from rax.
func Call3 ¶
Call3 calls a JIT function with 3 arguments. Arguments are passed in: rdi, rsi, rdx Returns the result from rax.
func FreeExecMem ¶
FreeExecMem frees executable memory allocated by AllocExecMem.
Types ¶
This section is empty.