Skip to main content

emit_nominal_instance_test

Function emit_nominal_instance_test 

Source
pub fn emit_nominal_instance_test(
    emitter: &mut FunctionEmitter<'_>,
    ctx: &CodegenCtx<'_>,
    target_vtable_global_idx: u32,
) -> Result<(), CompilerFailure>
Expand description

Emit the nominal class-membership test for the value on top of the stack (any (ref null $Object)-compatible ref), leaving an i32 (0/1): walk the value’s vtable parent chain, comparing each link by ref.eq against the target class’s vtable-singleton global. Value identity, not ref.test — same-shape sibling classes canonicalize to one WasmGC type, so shape can’t carry instanceof. Non-class values (strings, boxed primitives, structural objects, closures) exit false at the $ClassVTable test — their vtables are plain $VTable subtypes.