x-lang

← Index

x/tool/asm-cache

The compile-asm door: a persistent cache of emitted native code, over the JIT compiler it falls back to.

compile-asm

JIT compile an x-lang (fn …) expression to a native prim, through a persistent byte cache. Accepts an optional fvar alist for free variable support, and a third argument declaring the calling mode: #f for an integer function called from x, #t for an analyse callback the tokenizer calls. A compile with fvars must declare it and refuses without it; one with neither fvars nor a declaration is an integer function. In analyser mode nothing evaluates the arguments and the result is not boxed, and arithmetic or an ordered comparison on a leading param refuses rather than answering. An fvar holding a prim may be called by name; (%call HEAD arg …) calls a prim the code computes, and refuses at run time if the head is not one. The compiled function works with map, fold, closures, etc.

Returns: CALLABLE — X-lang callable prim