1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
(module
(type $array (array (mut (ref null func))))
;; Test that the import remains
(import "elsewhere" "some.tag" (tag $imported (param f64)))
(tag $foo (param f32))
(tag $other (param f64))
(memory $foo 50 60)
(memory $other 70 80)
(data $other (i32.const 3) "ghi")
(data $bar (i32.const 4) "jkl")
(table $foo 50 60 funcref)
(table $other 70 80 funcref)
(elem $other func $foo $other)
(elem $bar func $other $foo)
(global $other i32 (i32.const 3))
(global $bar i32 (i32.const 4))
(export "foo" (func $foo))
(export "other" (func $other))
(export "keepalive" (func $uses.second))
(export "keepalive.tag" (tag $imported))
;; Also test having a different name for the export as for the internal
;; thing it refers to, to test we don't assume they are identical.
(export "other-b" (func $other))
(func $foo
(drop
(i32.const 3)
)
)
(func $other
(drop
(i32.const 4)
)
)
(func $uses.second (param $array (ref $array))
;; Tags.
(try
(do)
(catch $foo
(drop
(pop f32)
)
)
)
(try
(do)
(catch $other
(drop
(pop f64)
)
)
)
(drop
(block $catch (result f32)
(try_table (catch $foo $catch)
(nop)
)
(f32.const 0.0)
)
)
(drop
(block $catch (result f64)
(try_table (catch $other $catch)
(nop)
)
(f64.const 0.0)
)
)
;; Memories
(drop
(i32.load $foo
(i32.const 3)
)
)
(drop
(i32.load $other
(i32.const 4)
)
)
;; Data segments
(data.drop $other)
(data.drop $bar)
;; Tables
(drop
(table.get $foo
(i32.const 3)
)
)
(drop
(table.get $other
(i32.const 4)
)
)
;; Element segments
(array.init_elem $array $other
(local.get $array)
(i32.const 7)
(i32.const 8)
(i32.const 9)
)
(array.init_elem $array $bar
(local.get $array)
(i32.const 10)
(i32.const 11)
(i32.const 12)
)
;; Globals
(drop
(global.get $other)
)
(drop
(global.get $bar)
)
;; Functions.
(call $foo)
(call $other)
)
)
|