| 1 |
(module |
| 2 |
(type $ft (;0;) (func)) |
| 3 |
(type $st (;1;) (struct)) |
| 4 |
(type $at (;2;) (array i8)) |
| 5 |
(type (;3;) (func (param externref))) |
| 6 |
(type (;4;) (func (param i32))) |
| 7 |
(table (;0;) 10 anyref) |
| 8 |
(export "init" (func 1)) |
| 9 |
(export "ref_cast_non_null" (func 2)) |
| 10 |
(export "ref_cast_null" (func 3)) |
| 11 |
(export "ref_cast_i31" (func 4)) |
| 12 |
(export "ref_cast_struct" (func 5)) |
| 13 |
(export "ref_cast_array" (func 6)) |
| 14 |
(elem (;0;) declare func $f) |
| 15 |
(func $f (;0;) (type $ft)) |
| 16 |
(func (;1;) (type 3) (param $x externref) |
| 17 |
(table.set 0 (; [] ;) |
| 18 |
(i32.const 0 (; [i32] ;)) |
| 19 |
(ref.null any (; [i32 anyref] ;))) |
| 20 |
(table.set 0 (; [] ;) |
| 21 |
(i32.const 1 (; [i32] ;)) |
| 22 |
(ref.i31 (; [i32 (ref i31)] ;) |
| 23 |
(i32.const 7 (; [i32 i32] ;)))) |
| 24 |
(table.set 0 (; [] ;) |
| 25 |
(i32.const 2 (; [i32] ;)) |
| 26 |
(struct.new_default $st (; [i32 (ref (id 1))] ;))) |
| 27 |
(table.set 0 (; [] ;) |
| 28 |
(i32.const 3 (; [i32] ;)) |
| 29 |
(array.new_default $at (; [i32 (ref (id 2))] ;) |
| 30 |
(i32.const 0 (; [i32 i32] ;)))) |
| 31 |
(table.set 0 (; [] ;) |
| 32 |
(i32.const 4 (; [i32] ;)) |
| 33 |
(any.convert_extern (; [i32 anyref] ;) |
| 34 |
(local.get $x (; [i32 externref] ;)))) |
| 35 |
(table.set 0 (; [] ;) |
| 36 |
(i32.const 5 (; [i32] ;)) |
| 37 |
(ref.null i31 (; [i32 i31ref] ;))) |
| 38 |
(table.set 0 (; [] ;) |
| 39 |
(i32.const 6 (; [i32] ;)) |
| 40 |
(ref.null struct (; [i32 structref] ;))) |
| 41 |
(table.set 0 (; [] ;) |
| 42 |
(i32.const 7 (; [i32] ;)) |
| 43 |
(ref.null none (; [i32 nullref] ;))) |
| 44 |
) |
| 45 |
(func (;2;) (type 4) (param $i i32) |
| 46 |
(drop (; [] ;) |
| 47 |
(ref.as_non_null (; [(ref any)] ;) |
| 48 |
(table.get 0 (; [anyref] ;) |
| 49 |
(local.get $i (; [i32] ;))))) |
| 50 |
(drop (; [] ;) |
| 51 |
(ref.cast anyref (; [anyref] ;) |
| 52 |
(table.get 0 (; [anyref] ;) |
| 53 |
(local.get $i (; [i32] ;))))) |
| 54 |
) |
| 55 |
(func (;3;) (type 4) (param $i i32) |
| 56 |
(drop (; [] ;) |
| 57 |
(ref.cast anyref (; [anyref] ;) |
| 58 |
(table.get 0 (; [anyref] ;) |
| 59 |
(local.get $i (; [i32] ;))))) |
| 60 |
(drop (; [] ;) |
| 61 |
(ref.cast structref (; [structref] ;) |
| 62 |
(table.get 0 (; [anyref] ;) |
| 63 |
(local.get $i (; [i32] ;))))) |
| 64 |
(drop (; [] ;) |
| 65 |
(ref.cast arrayref (; [arrayref] ;) |
| 66 |
(table.get 0 (; [anyref] ;) |
| 67 |
(local.get $i (; [i32] ;))))) |
| 68 |
(drop (; [] ;) |
| 69 |
(ref.cast i31ref (; [i31ref] ;) |
| 70 |
(table.get 0 (; [anyref] ;) |
| 71 |
(local.get $i (; [i32] ;))))) |
| 72 |
(drop (; [] ;) |
| 73 |
(ref.cast nullref (; [nullref] ;) |
| 74 |
(table.get 0 (; [anyref] ;) |
| 75 |
(local.get $i (; [i32] ;))))) |
| 76 |
) |
| 77 |
(func (;4;) (type 4) (param $i i32) |
| 78 |
(drop (; [] ;) |
| 79 |
(ref.cast (ref i31) (; [(ref i31)] ;) |
| 80 |
(table.get 0 (; [anyref] ;) |
| 81 |
(local.get $i (; [i32] ;))))) |
| 82 |
(drop (; [] ;) |
| 83 |
(ref.cast i31ref (; [i31ref] ;) |
| 84 |
(table.get 0 (; [anyref] ;) |
| 85 |
(local.get $i (; [i32] ;))))) |
| 86 |
) |
| 87 |
(func (;5;) (type 4) (param $i i32) |
| 88 |
(drop (; [] ;) |
| 89 |
(ref.cast (ref struct) (; [(ref struct)] ;) |
| 90 |
(table.get 0 (; [anyref] ;) |
| 91 |
(local.get $i (; [i32] ;))))) |
| 92 |
(drop (; [] ;) |
| 93 |
(ref.cast structref (; [structref] ;) |
| 94 |
(table.get 0 (; [anyref] ;) |
| 95 |
(local.get $i (; [i32] ;))))) |
| 96 |
) |
| 97 |
(func (;6;) (type 4) (param $i i32) |
| 98 |
(drop (; [] ;) |
| 99 |
(ref.cast (ref array) (; [(ref array)] ;) |
| 100 |
(table.get 0 (; [anyref] ;) |
| 101 |
(local.get $i (; [i32] ;))))) |
| 102 |
(drop (; [] ;) |
| 103 |
(ref.cast arrayref (; [arrayref] ;) |
| 104 |
(table.get 0 (; [anyref] ;) |
| 105 |
(local.get $i (; [i32] ;))))) |
| 106 |
) |
| 107 |
) |