Skip to main content

Module stack

Module stack 

Source
Expand description

Stack headroom checks, so that deep recursion fails with D1011 instead of overflowing the stack.

On native targets the evaluator grows the stack on demand (stacker). WebAssembly has a fixed stack, and an overflow there traps and leaves the module instance unusable, so the recursive parts of jlens stop while some headroom is left.

Crates that walk syntax trees recursively (such as jlens-schema) use the same helpers.

Functionsยง

exhausted
Whether the stack is close to exhaustion. Only meaningful on WebAssembly; native targets grow the stack instead and always return false.
grow
Runs f, first growing the stack if little of it is left (native targets only).