pub struct SymbolTable {
pub class_type_parameters: BTreeMap<MangledName, Vec<String>>,
pub runtime_generic_functions: BTreeSet<MangledName>,
pub field_guard_targets: BTreeMap<u32, Type>,
pub type_descriptor_functions: BTreeMap<Type, u32>,
pub type_descriptor_globals: BTreeMap<Type, u32>,
/* private fields */
}Fields§
§class_type_parameters: BTreeMap<MangledName, Vec<String>>§runtime_generic_functions: BTreeSet<MangledName>§field_guard_targets: BTreeMap<u32, Type>§type_descriptor_functions: BTreeMap<Type, u32>§type_descriptor_globals: BTreeMap<Type, u32>Implementations§
Source§impl SymbolTable
impl SymbolTable
pub fn new() -> Self
pub fn type_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn func_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn global_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn global_type(&self, mangled: &MangledName) -> Option<&Type>
pub fn init_guard(&self, global: &MangledName) -> Option<&InitFlag>
pub fn class_declaration_flags(&self, index: usize) -> &[u32]
pub fn prelude_func_idx(&self, symbol: &str) -> Option<u32>
pub fn prelude_global_idx(&self, symbol: &str) -> Option<u32>
pub fn string_type_idx(&self) -> Option<u32>
pub fn raw_string_type_idx(&self) -> Option<u32>
pub fn bigint_type_idx(&self) -> Option<u32>
pub fn raw_bigint_type_idx(&self) -> Option<u32>
pub fn regex_type_idx(&self) -> Option<u32>
pub fn regex_match_type_idx(&self) -> Option<u32>
pub fn regex_capture_array_type_idx(&self) -> Option<u32>
pub fn regex_match_box_type_idx(&self) -> Option<u32>
pub fn boxed_number_type_idx(&self) -> Option<u32>
pub fn boxed_boolean_type_idx(&self) -> Option<u32>
pub fn raw_array_type_idx(&self) -> Option<u32>
pub fn field_names_type_idx(&self) -> Option<u32>
pub fn object_shape_type_idx(&self) -> Option<u32>
pub fn array_type_idx(&self) -> Option<u32>
pub fn raw_uint8_array_type_idx(&self) -> Option<u32>
pub fn uint8_array_type_idx(&self) -> Option<u32>
pub fn closure_type_idx(&self) -> Option<u32>
pub fn intrinsic_type_indices(&self) -> Option<IntrinsicTypeIndices>
pub fn object_subtype_idx(&self, ty: &Type) -> Option<u32>
pub fn class_struct_type_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn class_vtable_type_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn class_vtable_global_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn class_getter_global_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn class_setter_global_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn class_method_func_idx( &self, class: &MangledName, method: &str, ) -> Option<u32>
pub fn class_ctor_init_func_idx(&self, class: &MangledName) -> Option<u32>
pub fn class_method_adapter_func_idx( &self, class: &MangledName, method: &str, ) -> Option<u32>
pub fn class_method_slot( &self, class: &MangledName, method: &str, ) -> Option<u32>
pub fn is_class_payload_method(&self, class: &MangledName, method: &str) -> bool
pub fn class_method_sig(&self, class: &MangledName, method: &str) -> Option<u32>
pub fn class_method_abi( &self, class: &MangledName, method: &str, ) -> Option<&MethodSlotAbi>
pub fn class_ctor_abi(&self, class: &MangledName) -> Option<&[ValType]>
pub fn class_field_slot(&self, class: &MangledName, field: &str) -> Option<u32>
Sourcepub fn class_field_narrowing_check(
&self,
class: &MangledName,
field: &str,
) -> Option<&FieldNarrowingCheck>
pub fn class_field_narrowing_check( &self, class: &MangledName, field: &str, ) -> Option<&FieldNarrowingCheck>
None for every ordinary field. See crate::FieldNarrowingCheck.
pub fn class_field_narrowing_checks<'a>( &'a self, field: &'a str, ) -> impl Iterator<Item = (&'a MangledName, &'a FieldNarrowingCheck)> + 'a
pub fn class_field_setup(&self, class: &MangledName) -> Option<&[FieldSetup]>
pub fn vtable_global_idx(&self, ty: &Type) -> Option<u32>
pub fn record_optional_field_name_type(&mut self, index: u32)
pub fn optional_field_name_type(&self) -> Result<u32, CompilerFailure>
pub fn field_names_global_idx(&self, field_names: &[FieldName]) -> Option<u32>
pub fn field_name_string_global_idx(&self, name: &str) -> Option<u32>
Sourcepub fn box_type_idx(&self, ty: &Type) -> Result<Option<u32>, CompilerFailure>
pub fn box_type_idx(&self, ty: &Type) -> Result<Option<u32>, CompilerFailure>
Box cells are keyed on slot_value_type so the
key a binding registers during collection still resolves once class
struct types are recorded. A cell for an erased type therefore holds
(ref null $Object); reads out of it need emit_unerase.
Sourcepub fn box_payload_type(&self, idx: u32) -> Option<ValType>
pub fn box_payload_type(&self, idx: u32) -> Option<ValType>
A box struct is the (ref $box_T) wrapper a captured-and-mutated binding
is stored behind. Returns the payload type of idx, or None if idx
is not one — so codegen can recognise a slot that holds a box rather than
the value, and know what a struct.get off it leaves on the stack.
The reverse scan is unambiguous because box_types::collect dedups by
payload before recording, so one index is registered per payload type.
pub fn closure_func_type_idx(&self, sig: ClosureSig) -> Option<u32>
pub fn record_closure_coercion_vtable_type(&mut self, index: u32)
pub fn closure_coercion_vtable_type(&self) -> Result<u32, CompilerFailure>
pub fn closure_signatures(&self) -> impl Iterator<Item = ClosureSig> + '_
pub fn record_closure_coercion(&mut self, target: ClosureSig, index: u32)
pub fn closure_coercion(&self, target: ClosureSig) -> Option<u32>
pub fn closure_struct_type_idx(&self, sig: ClosureSig) -> Option<u32>
pub fn env_type_idx(&self, expr_id: ExprId) -> Option<u32>
pub fn closure_func_idx(&self, expr_id: ExprId) -> Option<u32>
pub fn closure_vtable_global_idx(&self) -> Option<u32>
pub fn adapter_func_idx(&self, mangled: &MangledName) -> Option<u32>
pub fn adapter_closure_global_idx(&self, mangled: &MangledName) -> Option<u32>
Sourcepub fn ref_fits_slot(&self, value: RefType, slot: RefType) -> bool
pub fn ref_fits_slot(&self, value: RefType, slot: RefType) -> bool
Whether a value-typed ref already satisfies a slot by WasmGC
subtyping, so a coercion needs no instruction.
Answers false whenever the relation isn’t known — an unrecorded
supertype edge, an abstract heap type — leaving the caller to emit a
ref.cast, which is valid for any two types sharing a hierarchy. Wrong
in that direction costs an always-succeeding cast; wrong in the other
direction is a module the validator rejects.
pub fn record_type(&mut self, mangled: MangledName, idx: u32)
Sourcepub fn set_intrinsic_type_indices(&mut self, indices: IntrinsicTypeIndices)
pub fn set_intrinsic_type_indices(&mut self, indices: IntrinsicTypeIndices)
Also seeds the intrinsic hierarchy: those edges are fixed by the indices, so they can neither be known before this call nor go stale after it.
pub fn record_struct_supertype(&mut self, child: u32, parent: u32)
pub fn record_class_struct_type(&mut self, mangled: MangledName, idx: u32)
pub fn record_class_vtable_type(&mut self, mangled: MangledName, idx: u32)
pub fn record_class_vtable_global(&mut self, mangled: MangledName, idx: u32)
pub fn record_class_getter_global(&mut self, mangled: MangledName, idx: u32)
pub fn record_class_setter_global(&mut self, mangled: MangledName, idx: u32)
pub fn record_class_method_func( &mut self, class: MangledName, method: String, idx: u32, )
pub fn record_class_ctor_init_func(&mut self, class: MangledName, idx: u32)
pub fn record_class_method_adapter_func( &mut self, class: MangledName, method: String, idx: u32, )
pub fn record_class_method_slot( &mut self, class: MangledName, method: String, slot: u32, )
pub fn record_class_payload_method( &mut self, class: MangledName, method: String, )
Sourcepub fn is_rewritable_class_method(
&self,
class: &MangledName,
method: &str,
) -> bool
pub fn is_rewritable_class_method( &self, class: &MangledName, method: &str, ) -> bool
A payload method, local or imported, that this module may overwrite through a structural alias, so a direct call must read the payload rather than the class vtable. Every other call keeps the cheaper vtable dispatch.
pub fn record_class_method_sig( &mut self, class: MangledName, method: String, sig: u32, )
pub fn record_class_method_abi( &mut self, class: MangledName, method: String, abi: MethodSlotAbi, )
pub fn record_class_ctor_abi( &mut self, class: MangledName, params: Vec<ValType>, )
pub fn record_class_field_narrowing_check( &mut self, class: MangledName, field: String, check: FieldNarrowingCheck, )
pub fn record_class_field_slot( &mut self, class: MangledName, field: String, slot: u32, )
pub fn record_class_field_setup( &mut self, class: MangledName, setup: Vec<FieldSetup>, )
pub fn record_vtable_global(&mut self, ty: Type, idx: u32)
pub fn record_field_names_global( &mut self, field_names: Vec<FieldName>, idx: u32, )
pub fn record_field_name_string_global(&mut self, name: String, idx: u32)
pub fn record_box_type(&mut self, value_type: ValType, idx: u32)
pub fn record_closure_func_type(&mut self, sig: ClosureSig, idx: u32)
pub fn record_closure_struct_type(&mut self, sig: ClosureSig, idx: u32)
pub fn record_env_type(&mut self, expr_id: ExprId, idx: u32)
pub fn record_closure_func_idx(&mut self, expr_id: ExprId, idx: u32)
pub fn set_closure_vtable_global(&mut self, idx: u32)
pub fn error_tag_idx(&self) -> Option<u32>
pub fn set_error_tag_idx(&mut self, idx: u32)
pub fn record_adapter_func_idx(&mut self, mangled: MangledName, idx: u32)
pub fn record_adapter_closure_global_idx( &mut self, mangled: MangledName, idx: u32, )
pub fn record_class_guard_layout( &mut self, class: MangledName, parent: Option<&MangledName>, named_len: u32, guarded: bool, ) -> Result<(), CompilerFailure>
Sourcepub fn class_guard_layout(&self, class: &MangledName) -> ClassGuardLayout
pub fn class_guard_layout(&self, class: &MangledName) -> ClassGuardLayout
Defaults an unrecorded class to no guards. Only the field-guard emitters
still rely on this until SUB-633 item 17; everything else uses
Self::recorded_class_guard_layout.
Sourcepub fn recorded_class_guard_layout(
&self,
class: &MangledName,
) -> Result<ClassGuardLayout, CompilerFailure>
pub fn recorded_class_guard_layout( &self, class: &MangledName, ) -> Result<ClassGuardLayout, CompilerFailure>
Guard layout of a class this module lays out or reconstructs, which is recorded before any use.
pub fn record_instance_field_guard( &mut self, class: Type, declaration: MangledName, field: String, function: u32, )
pub fn instance_field_guards<'a>( &'a self, class: &'a Type, ) -> impl Iterator<Item = (&'a MangledName, &'a str, u32)> + 'a
pub fn record_runtime_validator(&mut self, key: Type, idx: u32)
Sourcepub fn runtime_validator_idx(&self, key: &Type) -> Option<u32>
pub fn runtime_validator_idx(&self, key: &Type) -> Option<u32>
Function index of a recursive runtime validator keyed by an alias or interface back-edge.
pub fn generic_runtime_validator(&self, key: &Type) -> Option<(&[String], u32)>
pub fn record_func(&mut self, mangled: MangledName, idx: u32)
pub fn record_global(&mut self, mangled: MangledName, idx: u32)
Sourcepub fn record_init_guard(&mut self, global: MangledName, flag: InitFlag)
pub fn record_init_guard(&mut self, global: MangledName, flag: InitFlag)
A guarded module global’s initialization flag; see init_guard.
pub fn record_class_declaration_flag(&mut self, index: usize, flag_idx: u32)
Sourcepub fn record_typed_global(&mut self, mangled: MangledName, idx: u32, ty: Type)
pub fn record_typed_global(&mut self, mangled: MangledName, idx: u32, ty: Type)
Language globals retain their declared type for checked narrowed reads. Runtime metadata globals only need an index.
Sourcepub fn record_imported_fn(
&mut self,
mangled: MangledName,
idx: u32,
params: Vec<Type>,
ret: Type,
is_host: bool,
)
pub fn record_imported_fn( &mut self, mangled: MangledName, idx: u32, params: Vec<Type>, ret: Type, is_host: bool, )
Writes both the wasm function index and the static-call registry entry; splitting them invited callers to drop one half by accident.
pub fn record_local_fn( &mut self, mangled: MangledName, idx: u32, params: Vec<Type>, ret: Type, ) -> Result<(), CompilerFailure>
pub fn top_level_fn(&self, mangled: &MangledName) -> Option<&TopLevelFn>
pub fn record_iface_dispatch(&mut self, iface: MangledName, dispatch: Dispatch)
pub fn record_static_value_tag(&mut self, iface: MangledName, tag: String)
pub fn static_value_tag(&self, iface: &MangledName) -> Option<&str>
pub fn iface_dispatch(&self, iface: &MangledName) -> Option<Dispatch>
pub fn record_iface_method_abi( &mut self, method_key: MangledName, abi: MethodSlotAbi, )
pub fn iface_method_abi( &self, method_key: &MangledName, ) -> Option<&MethodSlotAbi>
pub fn record_intrinsic_member(&mut self, mangled: MangledName)
pub fn is_intrinsic_member(&self, mangled: &MangledName) -> bool
pub fn value_type(&self, ty: &Type) -> Result<ValType, CompilerFailure>
pub fn wasm_result(&self, ty: &Type) -> Result<Vec<ValType>, CompilerFailure>
Sourcepub fn slot_value_type(&self, ty: &Type) -> Result<ValType, CompilerFailure>
pub fn slot_value_type(&self, ty: &Type) -> Result<ValType, CompilerFailure>
Wasm value type of a class-method vtable-slot parameter or result, of a constructor parameter, or of a box cell’s payload.
These slots erase every class type and type variable to the boxed
object slot. value_type cannot serve here because
its ClassRef lowering is phase-dependent: it yields the concrete
struct once that struct type is recorded, and imported classes are
reconstructed before local slot signatures are built while local
classes are reserved after — so one declaration would lower two ways.
Erasing unconditionally keeps a slot’s ABI stable across phases and
identical between a producer and a cross-package consumer, and keeps it
in step with the types recorded for each slot (MethodSlotAbi for a
method, class_ctor_abi for a constructor).