Skip to content
uencoder

WASM Table

A WASM Table is the WebAssembly function-reference table, storing function references for indirect calls (call_indirect), implementing function pointers and vtables.

Purpose

To give WASM a safe function-pointer mechanism supporting indirect calls and dynamic dispatch (C function pointers, C++ vtables).

Mechanism

new WebAssembly.Table({element:funcanyref, initial, maximum}) creates the reference table; get/set read and write references. call_indirect invokes a table function by index. Type checks prevent calling functions with wrong signatures.

Use cases

  • WASM function pointers
  • C++ vtable porting
  • Indirect calls

Related tools

References