Skip to main content

Module type_tracking

Module type_tracking 

Source
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 offset
  • SetFieldTyped (specialized): Direct slot update by precomputed offset Generic GetProp/SetProp are reserved for non-dot operations (index/slice).

§Storage Type Hints

For JIT optimization, we track storage types:

  • StorageHint::NullableFloat64: Option uses NaN sentinel
  • StorageHint::Float64: Plain f64, no nullability
  • StorageHint::Unknown: Type not determined at compile time

Structs§

BindingSemantics
Ownership/storage metadata for a binding slot.
FrameDescriptor
Typed frame layout metadata.
TypeTracker
Tracks type information for variables during compilation
VariableTypeInfo
Type information for a variable

Enums§

Aliasability
BindingOwnershipClass
Source-level ownership class for a binding slot.
BindingStorageClass
Planned runtime storage strategy for a binding slot.
EscapeStatus
MutationCapability
NumericType
Numeric type known at compile time for typed opcode emission.
SlotKind
Describes the storage kind for a single local/parameter slot in a frame.
VariableKind
The kind of variable: regular value, typed table, row view, or column.

Type Aliases§

StorageHint
Backwards-compatible alias. Prefer SlotKind in new code.