Expand description
Type Tracking for Bytecode Compiler
This module tracks known type information during compilation to enable type-specialized code generation. When a variable’s type is known at compile time, the compiler can emit optimized opcodes for field access.
§How Types Become Known
Types are known in these situations:
- Explicit type annotation:
let x: Candle = ... - Constructor call:
let x = Candle { ... } - Object literal:
let x = { a: 1, b: 2 }(inline struct type) - Function with declared return type:
let x = get_candle()
§Usage
The compiler uses this to emit typed field opcodes for dot access:
GetFieldTyped(specialized): Direct slot access by precomputed offsetSetFieldTyped(specialized): Direct slot update by precomputed offset GenericGetProp/SetPropare reserved for non-dot operations (index/slice).
§Storage Type Hints
For JIT optimization, we track storage types:
StorageHint::NullableFloat64: Optionuses NaN sentinel StorageHint::Float64: Plain f64, no nullabilityStorageHint::Unknown: Type not determined at compile time
Structs§
- Frame
Descriptor - Typed frame layout metadata.
- Type
Tracker - Tracks type information for variables during compilation
- Variable
Type Info - Type information for a variable
Enums§
- Numeric
Type - Numeric type known at compile time for typed opcode emission.
- Slot
Kind - Describes the storage kind for a single local/parameter slot in a frame.
- Variable
Kind - The kind of variable: regular value, typed table, row view, or column.
Type Aliases§
- Storage
Hint - Backwards-compatible alias. Prefer
SlotKindin new code.