kit

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

bulk_table_copy.wat (464B)


      1 (module
      2   (type $ret_i32 (func (result i32)))
      3   (func $target (type $ret_i32)
      4     i32.const 42)
      5   (table 4 funcref)
      6   ;; Active elem at index 0 puts $target into table[0].
      7   (elem (i32.const 0) func $target)
      8   (func (export "test_main") (result i32)
      9     ;; table.copy: dst=3 src=0 len=1
     10     i32.const 3
     11     i32.const 0
     12     i32.const 1
     13     table.copy
     14     ;; Indirect call through table[3] (copied from table[0]).
     15     i32.const 3
     16     call_indirect (type $ret_i32)))