BC001: Function is evaluator-only under --strict-bytecode
Code: BC001
Category: Bytecode coverage
Since: the release after v0.57.4 (M-BYTECODE-STRICT-256-REG-CEILING Phase A)
What this error means
The bytecode compiler could not compile a function, so it marked the function
evaluator-only. A normal --bytecode run still works, because the VM hands that
function to the evaluator through a bridge. --strict-bytecode has no bridge, so the
VM cannot run the function.
Before BC001 existed, nothing reported this until the strict VM reached the call and
stopped with vm: CALL: … is evaluator-only … but no interop bridge is wired. A
non-strict run used the bridge without saying so.
BC001 is reported at three points:
| Where | What is reported |
|---|---|
ailang check --strict-bytecode <file> | Every evaluator-only function the file declares, called or not, plus any imported function they reach. Exit code 1. |
ailang run --bytecode --strict-bytecode | Every evaluator-only function the entry can reach. The run fails before the entry starts. |
ailang test --strict-bytecode | Every evaluator-only function a test body can reach. That test fails before its body runs. |
An evaluator-only function in an imported module that your code never reaches is not
reported. It can never trap. For example, importing std/list brings in takeMap,
which the VM cannot run yet, and that import alone produces no BC001.
Reachability is static: it follows every call and function reference in the compiled code, not the path a particular input takes. A strict run whose input never reaches the branch that calls the function is still rejected. Strict mode means the whole program runs on the VM, for any input.
A non-strict ailang run --bytecode prints the same list to stderr as a warning,
giving the exact count and the first ten names. Stdout is unchanged.
Example
A record literal with 300 fields needs more than the 256 registers one VM instruction can address:
$ ailang check --strict-bytecode wide.ail
Error: BC001: function wide.wideRec is evaluator-only under --strict-bytecode
(register allocator: contiguous block of 300 would exceed 256) at wide.ail:3
The text in parentheses is the compiler's reason, copied as it is. --json and
--format agent give the same diagnostic with code, file and line fields.
How to fix
Read the reason first:
register allocator: contiguous block of N would exceed 256: a single construct needs more than 256 registers at once. A record or tuple literal with more than 255 fields is the usual cause. Split it into smaller nested records, or build it in steps. List literals of any length and longif/else ifchains already compile.effectful builtin "…" not yet wiredorpure builtin "…" has no VM implementation: the VM does not implement that builtin yet. Run without--strict-bytecode, or call a VM-native alternative.references evaluator-only X …: this function passes a value the bridge cannot carry to the evaluator-onlyX. FixX, and this function compiles too.
ailang disasm <file> lists every evaluator-only prototype in the image, with its
reason, under --- Prototype N: name [EvalOnly: reason] ---.
Limits
check --strict-bytecode takes one file. Combining it with --package, --verify or
a directory is refused. It does not silently skip the bytecode check.