;;; TOOL: run-objdump
;;; ARGS0: --enable-reference-types
;;; ARGS1: -x

(module
  (table $foo 1 anyref)
  (table $bar 1 anyref)
  (table $baz 1 anyfunc)
  (elem (table $baz) (i32.const 0) $f1)
  (elem funcref (ref.null))

  (func $f1 (result anyref)
    i32.const 0
    table.get $foo
  )
  (func (result anyref)
    i32.const 0
    table.get $bar
  )

  (func (param anyref)
    i32.const 0
    get_local 0
    table.set $foo
  )
  (func (param anyref)
    i32.const 0
    get_local 0
    table.set $bar
  )

  (func (result i32)
    ref.null
    i32.const 0
    table.grow $foo
  )
  (func (result i32)
    ref.null
    i32.const 0
    table.grow $bar
  )

  (func (param anyref) (result i32)
    local.get 0
    ref.is_null
  )


  (func (result i32)
    table.size $foo
  )
  (func (result i32)
    table.size $bar
  )
  (func (result i32)
    table.size $baz
  )
)

(;; STDOUT ;;;

reference-types.wasm:	file format wasm 0x1

Section Details:

Type[4]:
 - type[0] () -> anyref
 - type[1] (anyref) -> nil
 - type[2] () -> i32
 - type[3] (anyref) -> i32
Function[10]:
 - func[0] sig=0
 - func[1] sig=0
 - func[2] sig=1
 - func[3] sig=1
 - func[4] sig=2
 - func[5] sig=2
 - func[6] sig=3
 - func[7] sig=2
 - func[8] sig=2
 - func[9] sig=2
Table[3]:
 - table[0] type=anyref initial=1
 - table[1] type=anyref initial=1
 - table[2] type=funcref initial=1
Elem[2]:
 - segment[0] flags=2 table=2 count=1 - init i32=0
  - elem[0] = func[0]
 - segment[1] flags=5 table=0 count=1
  - elem[0] = nullref
Code[10]:
 - func[0] size=6
 - func[1] size=6
 - func[2] size=8
 - func[3] size=8
 - func[4] size=8
 - func[5] size=8
 - func[6] size=5
 - func[7] size=5
 - func[8] size=5
 - func[9] size=5

Code Disassembly:

000049 func[0]:
 00004a: 41 00                      | i32.const 0
 00004c: 25 00                      | table.get 0
 00004e: 0b                         | end
000050 func[1]:
 000051: 41 00                      | i32.const 0
 000053: 25 01                      | table.get 1
 000055: 0b                         | end
000057 func[2]:
 000058: 41 00                      | i32.const 0
 00005a: 20 00                      | local.get 0
 00005c: 26 00                      | table.set 0
 00005e: 0b                         | end
000060 func[3]:
 000061: 41 00                      | i32.const 0
 000063: 20 00                      | local.get 0
 000065: 26 01                      | table.set 1
 000067: 0b                         | end
000069 func[4]:
 00006a: d0                         | ref.null
 00006b: 41 00                      | i32.const 0
 00006d: fc 0f 00                   | table.grow 0
 000070: 0b                         | end
000072 func[5]:
 000073: d0                         | ref.null
 000074: 41 00                      | i32.const 0
 000076: fc 0f 01                   | table.grow 1
 000079: 0b                         | end
00007b func[6]:
 00007c: 20 00                      | local.get 0
 00007e: d1                         | ref.is_null
 00007f: 0b                         | end
000081 func[7]:
 000082: fc 10 00                   | table.size 0
 000085: 0b                         | end
000087 func[8]:
 000088: fc 10 01                   | table.size 1
 00008b: 0b                         | end
00008d func[9]:
 00008e: fc 10 02                   | table.size 2
 000091: 0b                         | end
;;; STDOUT ;;)
