Skip to main content

Module codegen

Module codegen 

Source
Expand description

Codegen — translates a typechecked Typed AST into a Wasm module.

Re-exports§

pub use symbol_table::SymbolTable;

Modules§

analysis
bigint_pool
Compile-time pool for large bigint literals (those outside ±2^53 - 1). Each distinct literal becomes a passive data segment of little-endian u64 limbs; BigIntPool::lookup returns None for small literals that skip the pool.
bounds
Bounds-checked array indexing.
box_types
Per-program GC box wrapper types for captured-binding storage.
cast_check
The structural conformance test and its consumers: x as T, the ! non-null assertion, and the read guard on a narrowed field redeclaration.
classes
WasmGC type emission and body lowering for user class declarations.
closures
Per-program closure type collection + emission.
dependency_usage
dwarf
field_name_strings
Per-field-name (ref $string) Wasm globals.
field_names
Per-module canonical-shape field-names registry.
function_adapters
Collects top-level functions used in value position and emits closure-shaped adapter bodies for them.
function_emitter
FunctionEmitter — single-pass builder for the body of one Wasm function.
imported_classes
Cross-package class reconstruction (SUB-488).
init_guard
Module variables read or written before their declaration has run.
intrinsics
Canonical intrinsic Wasm types every Submilli module hard-codes locally. Both the prelude and consumer codegen call declare_intrinsic_types to guarantee identical bytes; WasmGC structural canonicalization then unifies cross-module references.
recursive_validators
Discovery + planning for recursive alias and data-interface validators.
string_pool
Constant-string pool — pre-codegen sweep that collects every string literal and makes each distinct value a passive data segment in the emitted module.
symbol_table
Maps MangledName to Wasm indices for types, functions, and globals — both imported symbols and consumer-local declarations.
throw
Shared emission for raising a catchable Error: the native-throw tail used by every wasm throw site (user throw, array bounds, as cast mismatch, JSON shape mismatch), plus the TypeError and ReferenceError raises built on it and their messages.
user_subtypes
Per-user-subtype Wasm subtype, vtable, and method emission for structural object shapes.

Structs§

CodegenCtx
CodegenError
GeneratedModule
GuardedBodies
Function indices of the depth-guarded bodies behind a vtable’s universal equals, toJson and hash slots.

Functions§

codegen
codegen_owned_by
Like codegen_with_type_info, but names the module after owning_package instead of TypedAst::package_name.
codegen_package_with_type_info
codegen_with_type_info