;;; 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
DataCount:
 - data count: 0
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:

00004c func[0]:
 00004d: 41 00                      | i32.const 0
 00004f: 25 00                      | table.get 0
 000051: 0b                         | end
000053 func[1]:
 000054: 41 00                      | i32.const 0
 000056: 25 01                      | table.get 1
 000058: 0b                         | end
00005a func[2]:
 00005b: 41 00                      | i32.const 0
 00005d: 20 00                      | local.get 0
 00005f: 26 00                      | table.set 0
 000061: 0b                         | end
000063 func[3]:
 000064: 41 00                      | i32.const 0
 000066: 20 00                      | local.get 0
 000068: 26 01                      | table.set 1
 00006a: 0b                         | end
00006c func[4]:
 00006d: d0                         | ref.null
 00006e: 41 00                      | i32.const 0
 000070: fc 0f 00                   | table.grow 0
 000073: 0b                         | end
000075 func[5]:
 000076: d0                         | ref.null
 000077: 41 00                      | i32.const 0
 000079: fc 0f 01                   | table.grow 1
 00007c: 0b                         | end
00007e func[6]:
 00007f: 20 00                      | local.get 0
 000081: d1                         | ref.is_null
 000082: 0b                         | end
000084 func[7]:
 000085: fc 10 00                   | table.size 0
 000088: 0b                         | end
00008a func[8]:
 00008b: fc 10 01                   | table.size 1
 00008e: 0b                         | end
000090 func[9]:
 000091: fc 10 02                   | table.size 2
 000094: 0b                         | end
;;; STDOUT ;;)
