Expand description
The bytecode representation of a function.
Compilation happens in two phases, exactly as in the reference implementation:
- Unresolved ([
FunctionBuilder]): jump targets are label ids and every variable is still described by its declaration, not its storage class. - Resolved (
Function): jump targets are byte offsets and every variable reference names its storage class (arg,loc,var_reforvar), so the bytecode can be executed and serialised.
The split matters for testing: each phase can be compared against the corresponding pass of the reference compiler.
Structs§
- Closure
Var - One captured variable of a function.
- Eval
Site - One direct
eval(...)call site and the bindings visible at it. - Eval
Visible - One binding an
evalcan see. - Function
- A compiled function.
- Import
Entry - One imported binding.
- Instruction
- A resolved instruction: opcode plus the operands encoded in its payload.
- LineCol
- A stretch of bytecode and the source position it came from.
- Module
Meta - What a module body needs from the host, recorded at compile time.
- Module
Request - One
from "…"of a module. - VarDef
- A declared variable: an argument or a local.
Enums§
- Atom
- One entry of a function’s atom table.
- Closure
Type - Where a captured variable actually lives, and therefore how a closure reaches it.
- Constant
- A constant in the pool.
- Export
Entry - One exported name.
- Function
Kind - How a function was declared. Determines the calling convention.
- Operand
- An operand of an instruction during compilation, before addresses are known.
- Storage
- Where a variable lives in the resolved function.
- VarKind
- What a declared name is used for, which decides how it is displayed and how the function prologue initialises it.
Constants§
- ANONYMOUS_
BINDING - The name of a binding the source never named.