WebAssembly reference instructions

This set of pages details the reference instructions available in Wasm to create, test and convert references. References are opaque handles to functions, host (for example JavaScript) values, or garbage-collected objects. Common reference types include funcref and externref.

ref.as_non_null

Converts a nullable reference into a non-nullable one, trapping if the reference is null.

ref.cast

Casts a reference to a given reference type, trapping if the cast fails.

ref.eq

Checks whether two references are equal.

ref.func

Creates a reference to a given function.

ref.is_null

Checks whether a reference is null.

ref.null

Creates a null reference of a given heap type.

ref.test

Checks whether a reference matches a given reference type.