ref.null func |
✅ |
— |
Produces a null funcref |
For the function-reference hierarchy |
ref.null extern |
— |
✅ |
Produces a null externref |
For the external-reference hierarchy |
ref.func $f |
✅ |
— |
Produces a non-null reference to $f |
The function must be declared for reference use |
ref.is_null |
✅ |
✅ |
Produces i32 |
1 for null, otherwise 0 |
ref.as_non_null |
✅ |
✅ |
Converts nullable reference to non-null reference |
Traps when the operand is null |
ref.eq |
✅ |
✅ |
Produces i32 identity comparison |
Both operands must satisfy the instruction’s reference-type constraints; it does not inspect their contents |
ref.test <type> |
✅ |
Limited |
Produces i32 |
Runtime type test; mainly useful with typed function and GC reference hierarchies |
ref.cast <type> |
✅ |
Limited |
Produces a narrowed reference |
Traps if the runtime type does not match |
drop |
✅ |
✅ |
Discards the reference |
Works on every value type |
select |
✅ |
✅ |
Selects one of two references |
Both alternatives must have a compatible type |
select (result <reftype>) |
✅ |
✅ |
Typed selection |
Explicit result type |
local.get |
✅ |
✅ |
Reads a local reference |
Local must have the corresponding reference type |
local.set |
✅ |
✅ |
Writes a local reference |
|
local.tee |
✅ |
✅ |
Writes and retains the reference |
|
global.get |
✅ |
✅ |
Reads a global reference |
|
global.set |
✅ |
✅ |
Writes a mutable global reference |
Global must be mutable |
table.get |
✅ |
✅ |
Reads a reference from a table |
Table element type must be compatible |
table.set |
✅ |
✅ |
Writes a reference into a table |
|
table.grow |
✅ |
✅ |
Grows a table using a reference as the initial value |
Returns the old size or -1 |
table.fill |
✅ |
✅ |
Fills table entries with a reference |
|
table.copy |
✅ |
✅ |
Copies references between tables |
Source and destination element types must be compatible |
table.init |
✅ |
✅ |
Initializes a table from an element segment |
Element segment type must be compatible |
table.size |
✅ |
✅ |
Produces the table size |
Does not operate on an individual reference value |
elem.drop |
✅ |
✅ |
Discards an element segment |
Does not operate on an individual reference value |
call_indirect |
✅ |
❌ |
Calls the referenced function from a table |
Performs a runtime signature check |
return_call_indirect |
✅ |
❌ |
Tail-calls a function from a table |
Requires tail-call support |
call_ref |
✅ |
❌ |
Calls a typed function reference directly |
Requires a typed function reference, not merely an unrefined funcref |
return_call_ref |
✅ |
❌ |
Tail-calls a typed function reference |
Typed function references plus tail calls |
| Function parameter passing |
✅ |
✅ |
Passes a reference into a function |
Works for Wasm-defined and imported functions |
| Function result |
✅ |
✅ |
Returns a reference |
Works for Wasm-defined and imported functions |
call / imported call |
✅ |
✅ |
May consume or produce references |
According to the callee’s declared signature |
return |
✅ |
✅ |
Returns reference-typed results |
According to the current function signature |
br |
✅ |
✅ |
Transfers references as label arguments |
According to the target block type |
br_if |
✅ |
✅ |
Conditionally transfers references |
|
br_table |
✅ |
✅ |
Transfers references to one of several labels |
All target label types must be compatible |
block, loop, if parameters/results |
✅ |
✅ |
Carries references through structured control flow |
Reference types can appear in block signatures |
| Import/export |
✅ |
✅ |
Exchanges references across the host boundary |
Subject to the embedding API |
any.convert_extern |
❌ |
✅ input |
Converts externref to an internal anyref representation |
GC/reference conversion; does not reveal the host object |
extern.convert_any |
❌ |
✅ output |
Converts an internal anyref back to externref |
Inverse of any.convert_extern |