kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

bulk_table_grow.wat (522B)


      1 (module
      2   (type $ret_i32 (func (result i32)))
      3   (func $target (type $ret_i32)
      4     i32.const 1)
      5   (table 2 16 funcref)
      6   (func (export "test_main") (result i32)
      7     ;; Grow the table by 3 entries, initializing them with funcref(target).
      8     ;; table.grow returns the old size (2).
      9     ref.func $target
     10     i32.const 3
     11     table.grow
     12     drop
     13     ;; New size should be 5; we encode the verification value (5 + 37 = 42)
     14     ;; to match the convention of returning 42 on success.
     15     table.size
     16     i32.const 37
     17     i32.add))