0x0LearnReferenceLibraries0x0.jmp0x1b.com

Copy-And-Patch Baseline JIT

The copy-and-patch baseline JIT is an opt-in hosted runtime tier. It exists

only for runtime surfaces that need immediate machine code after a hotness

decision and can prove target, executable-memory, stencil, differential, and

fallback behavior.

Run:


make copy-patch-jit-check

The gate is bounded. It does not run the full release matrix, self-hosting, or

remote deployment. Unsupported targets remain fully functional through the VM,

interpreter, WASM runtime, or AOT/native fallback.

Evidence Files

behavior and their fallback paths.

executable-memory policy, icache behavior, default-disabled status, and

fallback behavior.

relocations, labels, safepoints, deopt metadata, and max code size.

relocation kinds, and label requirements.

finalization, icache flush, reclamation, and shutdown policy.

fixtures.

latency, throughput, and code-size evidence.

evidence.

code-cache evidence.

differential behavior.

wiring.

Runtime Policy

The JIT is never enabled by default. A program or runtime profile must opt in,

the target must be supported, and the runtime must have a fallback path. Current

supported targets are hosted native targets with explicit W^X code-page policy.

Freestanding, bare-metal, and WASM-shaped targets reject native executable

memory JIT and use fallback execution paths.

Stencils

Stencils are generated from the same operation definitions used by the VM or

runtime path. The baseline tier rejects stencil metadata that drifts from

shared operation definitions. Patch slots must fit inside the declared stencil,

branch targets must name declared labels, and unsupported operations remain on

fallback.

Executable Memory

The code cache uses an RW patch phase followed by an RX finalized phase. RWX

pages are forbidden. AArch64 hosted targets require icache flush on

finalization. Code cache entries must be reclaimable at safepoints and released

at shutdown.

Diagnostics

The JIT gate uses stable diagnostics:


JIT_OPT_IN
JIT_TARGET
JIT_STENCIL_UNSUPPORTED
JIT_STENCIL_SOURCE
JIT_PATCH_OVERFLOW
JIT_EXEC_MEMORY
JIT_BRANCH_TARGET
JIT_DIFFERENTIAL
JIT_CODE_CACHE
JIT_LATENCY_BUDGET

Documentation Impact

JIT surface, stencil, patch slot, executable-memory, code-cache, icache,

differential behavior, fallback behavior, or JIT diagnostic changes must update

this page, the source-owned JIT evidence, release notes, and the public

reference index in the same change.