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
copy-patch-jit/surfaces.tsvrecords hosted runtime surfaces that need JIT
behavior and their fallback paths.
copy-patch-jit/target-policy.tsvrecords ISA, OS, page model,
executable-memory policy, icache behavior, default-disabled status, and
fallback behavior.
copy-patch-jit/stencil-format.tsvrecords stencil formats, patch slots,
relocations, labels, safepoints, deopt metadata, and max code size.
copy-patch-jit/patch-slots.tsvrecords patch-slot offsets, sizes,
relocation kinds, and label requirements.
copy-patch-jit/code-cache-policy.tsvrecords W^X code allocation,
finalization, icache flush, reclamation, and shutdown policy.
copy-patch-jit/diagnostics.tsvdefines stable diagnostics.copy-patch-jit/verification-cases.tsvrecords positive and negative
fixtures.
release/copy-patch-jit-latency-report.tsvrecords compile latency, runtime
latency, throughput, and code-size evidence.
release/copy-patch-jit-stencil-report.tsvrecords stencil validation
evidence.
release/copy-patch-jit-execmem-report.tsvrecords executable-memory and
code-cache evidence.
release/copy-patch-jit-differential-report.tsvrecords VM/interpreter
differential behavior.
release/copy-patch-jit-diagnostics-report.tsvrecords negative diagnostics.perf/copy-patch-jit-benchmarks.tsvrecords performance budgets.compat/copy-patch-jit-contract.tsvrecords release ownership and gate
wiring.
tools/copy_patch_jit_check.pyvalidates the evidence and fixtures.
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.