x-lang

← Index

x/tool/compile

Native code compiler: JIT assembler (default) with C compiler fallback.

Default compile uses JIT assembler. compile-c falls back to C compiler. compile-asm is the pure JIT path.

Pipeline stages

compile-to-c

Generate C source code from an (fn …) expression.

Parameters:

Returns: STRING — Generated C source code

compile-write

Write a string to a file. Returns the path.

Parameters:

Returns: STRING — The path written to

compile-cc

Invoke the C compiler on a source file to produce a shared library.

Parameters:

compile-load

Load a compiled shared library and return fn_0 as a callable primitive.

Parameters:

Returns: PRIM — Native function

compile-cc-flags

Compiler flags for the current platform.

Returns: LIST — Platform-specific cc flags

compile-ext

Shared library file extension for the current platform.

Returns: STRING — .bundle or .so

Compilation

compile-c

Compile an (fn …) expression to a native primitive via C compiler. Caches by expression hash.

Parameters:

Returns: PRIM — Compiled native function

compile-asm

compile

Compile an (fn …) expression to native code. Pure expressions use JIT assembler; fvar expressions use C compiler with persistent caching.

Parameters:

Returns: PRIM — Compiled native function

compile-batch

Compile multiple (fn …) expressions in a single cc invocation.

Returns: LIST — List of compiled native primitives