A table starts empty; the element section fills it. Today you decode an element segment and write its function indices into the table at load time.
Decode an element segment and initialize the table's slots with the function indices it lists.
The element section (id 9) supplies a table’s initial contents. Each element segment names where to start writing and which functions to write: an offset, given as a small constant expression that ends in end (0x0B) - here 41 00 0B is just i32.const 0 - and then a vector of function indices. Applying the segment evaluates the offset to a start index and copies the function indices into the table starting there, so 02 00 01 fills table[0] = function 0 and table[1] = function 1.
The offset being an expression rather than a bare number is a small but real detail: WebAssembly allows a constant expression there (in full generality it can read an imported global), and you evaluate it the same way you evaluate any constant-producing sequence - run it until end and take the value it leaves. For the MVP an i32.const is all you will see. Applying element segments is a load-time step, done once when the module is instantiated, before any exported function runs - so by the time a call happens, the table already points at real functions. With the table filled, indirect calls can finally dispatch.
// A segment (MVP form 0): flag 0x00, an offset const-expr (ends in 0x0B),// then a vec of funcidx. Evaluate the offset, write funcidx into the table.func applyElement(c *Cursor, t *Table) error {// read flag; start := evalConstExpr() // i32.const N ... 0x0B// funcs := readVec(readVarU32); copy into t.Funcs[start:]}