Skip to main content

Module native_kernels

Module native_kernels 

Source
Expand description

The standard library’s native KERNELS — the ## To native functions of crypto.lg (ML-KEM’s NTT, sampling, and serialization; the high-level ML-KEM / ML-DSA primitives) — as ONE table every tier reads.

A ## To native declaration has an EMPTY body: the engine supplies the implementation. The compiled tier links logicaffeine_system’s kernel (NativeKernel::rust_path); the tree-walker calls NativeKernel::call; the VM lowers a kernel call to CallBuiltin(NativeKernel) whose first argument is the kernel’s NativeKernel::code, and the builtin runs the same NativeKernel::call. So every tier runs the very same Rust function, and a kernel added here reaches all of them at once.

NativeKernel::code is the kernel’s POSITION in NativeKernel::ALL and travels in bytecode (and the binary wire format), so new kernels are APPENDED — goldens/native_kernel_codes.txt locks it.

Enums§

NativeKernel
One native kernel of the standard library.

Functions§

refuse_kernel_calls
The refusal for a backend that lowers compiled bytecode but cannot link the Rust kernels: Err at the first kernel call that can RUN (named when its code is a constant, as the VM compiler emits it). A kernel in a function nothing reaches is code the loader spliced in and nothing calls, so it refuses nothing — crate::vm::reach is the same answer the backends lower by.
refuse_kernel_calls_with
refuse_kernel_calls, judging what the host’s own entries reach as well as Main — the same roots a module built with those entries lowers.