Expand description
Compiler limits, and the native stack embedders provide for compilation.
Structs§
Constants§
- COMPILER_
STACK_ BYTES - Native stack a thread needs to run a
crate::compileentry point or a public phase API on any program within the structural limits below and incrate::tree_height, including types atMAX_TYPE_DEPTH. The interpreter creates no threads: embedders run compilation on a thread of at least this size. Only touched pages are committed. The deepest programs at the limits measured about 63 MiB in unoptimized builds and 2 MiB in optimized ones; each size keeps at least twice that. - MAX_
CLASS_ CHAIN_ LEN - Classes in one inheritance chain, including the class itself and library
ancestors such as
Error. Each class struct subtypes its parent’s, the root class subtypes the intrinsic object struct, and WasmGC validation rejects subtype depths above 63. - MAX_
CLOSURE_ ARITY - Number of declared argument slots in the closure ABI. Defaults keep their slots and a packed rest array occupies one slot. The environment/receiver and captured generic descriptors are carried separately.
- MAX_
FUNCTION_ BODY_ BYTES - Bytes the Wasm engine accepts in one function body (wasmparser’s
MAX_WASM_FUNCTION_SIZE). Runtime checks stop emitting before a function reaches it, which also keeps a body far below the 4 GiB the Wasm encoder can represent. - MAX_
FUNCTION_ LOCALS - Locals the Wasm engine accepts in one function (wasmparser’s
MAX_WASM_FUNCTION_LOCALS). Runtime checks add locals as they are emitted, so emitting stops with a located error before a function the engine would reject. - MAX_
INLINE_ VALIDATOR_ STEPS - Steps of inline code one runtime type check may emit: one per structural test of a type, union member, field or element, and one per segment of the failure path each test records. Interface checks are inlined with their members’ checks, so interfaces that reference others several times multiply a check’s code; this bounds the work of emitting one before the function’s locals would. The largest module in the fixture and package suites emits under 4,000 tests across all its checks.
- MAX_
NAMESPACE_ DEPTH - Limits on dependency namespace metadata before recursive compiler consumers.
- MAX_
NAMESPACE_ NODES - MAX_
NAMESPACE_ PATH_ BYTES - Total qualified namespace/type path bytes materialized during registration.
- MAX_
SPREAD_ FALLBACK_ CHAIN - Optional spreads that may override one field of an object literal, each over the value an earlier member supplied. Each link is a boxed fallback walked recursively; kept well below the typed-tree height limit so this limit, not the generic one, names the cause.
- MAX_
TYPE_ DEPTH - Nesting depth of one type, counting every type constructor and alias. Every
recursive walk over a type is bounded by it. Annotation resolution nests at
most
MAX_TYPE_RESOLUTION_DEPTHlevels, but a[]suffix is not one of them, so a chaintype Ai = A(i-1)[]adds two levels per alias and is cut here at 254 aliases. - MAX_
TYPE_ NODES - Nodes in one type. Instantiating an alias or generic that mentions its parameter more than once copies the argument, so nesting such instantiations doubles a type’s size per level; substitution stops at this bound. An alias instance also keeps its arguments beside its substituted body, so each layer of generic alias around a type doubles it too. The largest type in the fixture and package suites has under 100 nodes. Each stored copy of a type costs memory in proportion, up to about 1 KiB per node for small objects.
- MAX_
TYPE_ RESOLUTION_ DEPTH - Nested type annotation and alias-body resolutions. Each alias reference
costs a level, and so does each type constructor (object, array, tuple,
union, function, generic type or
readonly) wrapping the next reference in an alias body: over a primitive base, plain renames chain 254 aliases and{ v: Previous }bodies 127. Resolved alias bodies are inlined, so this also bounds the depth of alias-expanded types. - MAX_
TYPE_ WORK - Steps of type work one compiler phase may spend: each type node built by
substitution (instantiating aliases, generic calls and members, and
expanding interfaces) and each step comparing types. A phase can rebuild or
compare types near
MAX_TYPE_NODESmany times over; this bounds the total. The largest inference in the fixture and package suites spends under 2 million.
Functions§
- checked_
closure_ arity - Checks the encoded slot count, not the number of source call arguments. Callers attach their compiler stage and source context to a failure.