Skip to main content

SymbolTable

Struct SymbolTable 

Source
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

Source

pub fn new() -> Self

Source

pub fn type_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn func_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn global_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn global_type(&self, mangled: &MangledName) -> Option<&Type>

Source

pub fn init_guard(&self, global: &MangledName) -> Option<&InitFlag>

Source

pub fn class_declaration_flags(&self, index: usize) -> &[u32]

Source

pub fn prelude_func_idx(&self, symbol: &str) -> Option<u32>

Source

pub fn prelude_global_idx(&self, symbol: &str) -> Option<u32>

Source

pub fn string_type_idx(&self) -> Option<u32>

Source

pub fn raw_string_type_idx(&self) -> Option<u32>

Source

pub fn bigint_type_idx(&self) -> Option<u32>

Source

pub fn raw_bigint_type_idx(&self) -> Option<u32>

Source

pub fn regex_type_idx(&self) -> Option<u32>

Source

pub fn regex_match_type_idx(&self) -> Option<u32>

Source

pub fn regex_capture_array_type_idx(&self) -> Option<u32>

Source

pub fn regex_match_box_type_idx(&self) -> Option<u32>

Source

pub fn boxed_number_type_idx(&self) -> Option<u32>

Source

pub fn boxed_boolean_type_idx(&self) -> Option<u32>

Source

pub fn raw_array_type_idx(&self) -> Option<u32>

Source

pub fn field_names_type_idx(&self) -> Option<u32>

Source

pub fn object_shape_type_idx(&self) -> Option<u32>

Source

pub fn array_type_idx(&self) -> Option<u32>

Source

pub fn raw_uint8_array_type_idx(&self) -> Option<u32>

Source

pub fn uint8_array_type_idx(&self) -> Option<u32>

Source

pub fn closure_type_idx(&self) -> Option<u32>

Source

pub fn intrinsic_type_indices(&self) -> Option<IntrinsicTypeIndices>

Source

pub fn object_subtype_idx(&self, ty: &Type) -> Option<u32>

Source

pub fn class_struct_type_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn class_vtable_type_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn class_vtable_global_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn class_getter_global_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn class_setter_global_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn class_method_func_idx( &self, class: &MangledName, method: &str, ) -> Option<u32>

Source

pub fn class_ctor_init_func_idx(&self, class: &MangledName) -> Option<u32>

Source

pub fn class_method_adapter_func_idx( &self, class: &MangledName, method: &str, ) -> Option<u32>

Source

pub fn class_method_slot( &self, class: &MangledName, method: &str, ) -> Option<u32>

Source

pub fn is_class_payload_method(&self, class: &MangledName, method: &str) -> bool

Source

pub fn class_method_sig(&self, class: &MangledName, method: &str) -> Option<u32>

Source

pub fn class_method_abi( &self, class: &MangledName, method: &str, ) -> Option<&MethodSlotAbi>

Source

pub fn class_ctor_abi(&self, class: &MangledName) -> Option<&[ValType]>

Source

pub fn class_field_slot(&self, class: &MangledName, field: &str) -> Option<u32>

Source

pub fn class_field_narrowing_check( &self, class: &MangledName, field: &str, ) -> Option<&FieldNarrowingCheck>

None for every ordinary field. See crate::FieldNarrowingCheck.

Source

pub fn class_field_narrowing_checks<'a>( &'a self, field: &'a str, ) -> impl Iterator<Item = (&'a MangledName, &'a FieldNarrowingCheck)> + 'a

Source

pub fn class_field_setup(&self, class: &MangledName) -> Option<&[FieldSetup]>

Source

pub fn vtable_global_idx(&self, ty: &Type) -> Option<u32>

Source

pub fn record_optional_field_name_type(&mut self, index: u32)

Source

pub fn optional_field_name_type(&self) -> Result<u32, CompilerFailure>

Source

pub fn field_names_global_idx(&self, field_names: &[FieldName]) -> Option<u32>

Source

pub fn field_name_string_global_idx(&self, name: &str) -> Option<u32>

Source

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.

Source

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.

Source

pub fn closure_func_type_idx(&self, sig: ClosureSig) -> Option<u32>

Source

pub fn record_closure_coercion_vtable_type(&mut self, index: u32)

Source

pub fn closure_coercion_vtable_type(&self) -> Result<u32, CompilerFailure>

Source

pub fn closure_signatures(&self) -> impl Iterator<Item = ClosureSig> + '_

Source

pub fn record_closure_coercion(&mut self, target: ClosureSig, index: u32)

Source

pub fn closure_coercion(&self, target: ClosureSig) -> Option<u32>

Source

pub fn closure_struct_type_idx(&self, sig: ClosureSig) -> Option<u32>

Source

pub fn env_type_idx(&self, expr_id: ExprId) -> Option<u32>

Source

pub fn closure_func_idx(&self, expr_id: ExprId) -> Option<u32>

Source

pub fn closure_vtable_global_idx(&self) -> Option<u32>

Source

pub fn adapter_func_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn adapter_closure_global_idx(&self, mangled: &MangledName) -> Option<u32>

Source

pub fn is_shared_closure_global(&self, mangled: &MangledName) -> bool

Source

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.

Source

pub fn record_type(&mut self, mangled: MangledName, idx: u32)

Source

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.

Source

pub fn record_struct_supertype(&mut self, child: u32, parent: u32)

Source

pub fn record_class_struct_type(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_class_vtable_type(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_class_vtable_global(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_class_getter_global(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_class_setter_global(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_class_method_func( &mut self, class: MangledName, method: String, idx: u32, )

Source

pub fn record_class_ctor_init_func(&mut self, class: MangledName, idx: u32)

Source

pub fn record_class_method_adapter_func( &mut self, class: MangledName, method: String, idx: u32, )

Source

pub fn record_class_method_slot( &mut self, class: MangledName, method: String, slot: u32, )

Source

pub fn record_class_payload_method( &mut self, class: MangledName, method: String, )

Source

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.

Source

pub fn record_class_method_sig( &mut self, class: MangledName, method: String, sig: u32, )

Source

pub fn record_class_method_abi( &mut self, class: MangledName, method: String, abi: MethodSlotAbi, )

Source

pub fn record_class_ctor_abi( &mut self, class: MangledName, params: Vec<ValType>, )

Source

pub fn record_class_field_narrowing_check( &mut self, class: MangledName, field: String, check: FieldNarrowingCheck, )

Source

pub fn record_class_field_slot( &mut self, class: MangledName, field: String, slot: u32, )

Source

pub fn record_class_field_setup( &mut self, class: MangledName, setup: Vec<FieldSetup>, )

Source

pub fn record_vtable_global(&mut self, ty: Type, idx: u32)

Source

pub fn record_field_names_global( &mut self, field_names: Vec<FieldName>, idx: u32, )

Source

pub fn record_field_name_string_global(&mut self, name: String, idx: u32)

Source

pub fn record_box_type(&mut self, value_type: ValType, idx: u32)

Source

pub fn record_closure_func_type(&mut self, sig: ClosureSig, idx: u32)

Source

pub fn record_closure_struct_type(&mut self, sig: ClosureSig, idx: u32)

Source

pub fn record_env_type(&mut self, expr_id: ExprId, idx: u32)

Source

pub fn record_closure_func_idx(&mut self, expr_id: ExprId, idx: u32)

Source

pub fn set_closure_vtable_global(&mut self, idx: u32)

Source

pub fn error_tag_idx(&self) -> Option<u32>

Source

pub fn set_error_tag_idx(&mut self, idx: u32)

Source

pub fn record_adapter_func_idx(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_adapter_closure_global_idx( &mut self, mangled: MangledName, idx: u32, )

Source

pub fn record_shared_closure_global_idx( &mut self, mangled: MangledName, idx: u32, )

Source

pub fn record_class_guard_layout( &mut self, class: MangledName, parent: Option<&MangledName>, named_len: u32, guarded: bool, ) -> Result<(), CompilerFailure>

Source

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.

Source

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.

Source

pub fn record_instance_field_guard( &mut self, class: Type, declaration: MangledName, field: String, function: u32, )

Source

pub fn instance_field_guards<'a>( &'a self, class: &'a Type, ) -> impl Iterator<Item = (&'a MangledName, &'a str, u32)> + 'a

Source

pub fn record_runtime_validator(&mut self, key: Type, idx: u32)

Source

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.

Source

pub fn generic_runtime_validator(&self, key: &Type) -> Option<(&[String], u32)>

Source

pub fn record_func(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_global(&mut self, mangled: MangledName, idx: u32)

Source

pub fn record_init_guard(&mut self, global: MangledName, flag: InitFlag)

A guarded module global’s initialization flag; see init_guard.

Source

pub fn record_class_declaration_flag(&mut self, index: usize, flag_idx: u32)

Source

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.

Source

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.

Source

pub fn record_local_fn( &mut self, mangled: MangledName, idx: u32, params: Vec<Type>, ret: Type, ) -> Result<(), CompilerFailure>

Source

pub fn top_level_fn(&self, mangled: &MangledName) -> Option<&TopLevelFn>

Source

pub fn record_iface_dispatch(&mut self, iface: MangledName, dispatch: Dispatch)

Source

pub fn record_static_value_tag(&mut self, iface: MangledName, tag: String)

Source

pub fn static_value_tag(&self, iface: &MangledName) -> Option<&str>

Source

pub fn iface_dispatch(&self, iface: &MangledName) -> Option<Dispatch>

Source

pub fn record_iface_method_abi( &mut self, method_key: MangledName, abi: MethodSlotAbi, )

Source

pub fn iface_method_abi( &self, method_key: &MangledName, ) -> Option<&MethodSlotAbi>

Source

pub fn record_intrinsic_member(&mut self, mangled: MangledName)

Source

pub fn is_intrinsic_member(&self, mangled: &MangledName) -> bool

Source

pub fn value_type(&self, ty: &Type) -> Result<ValType, CompilerFailure>

Source

pub fn wasm_result(&self, ty: &Type) -> Result<Vec<ValType>, CompilerFailure>

Source

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).

Source

pub fn slot_wasm_result( &self, ty: &Type, ) -> Result<Vec<ValType>, CompilerFailure>

Source

pub fn host_value_type(&self, ty: &Type) -> Result<ValType, CompilerFailure>

Trait Implementations§

Source§

impl Clone for SymbolTable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SymbolTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SymbolTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more