| 1 |
/* Copyright 2021 Mozilla Foundation |
| 2 |
* |
| 3 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
* you may not use this file except in compliance with the License. |
| 5 |
* You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software |
| 10 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
* See the License for the specific language governing permissions and |
| 13 |
* limitations under the License. |
| 14 |
*/ |
| 15 |
|
| 16 |
// ./test/core/local_tee.wast |
| 17 |
|
| 18 |
// ./test/core/local_tee.wast:3 |
| 19 |
let $0 = instantiate(`(module |
| 20 |
;; Typing |
| 21 |
|
| 22 |
(func (export "type-local-i32") (result i32) (local i32) (local.tee 0 (i32.const 0))) |
| 23 |
(func (export "type-local-i64") (result i64) (local i64) (local.tee 0 (i64.const 0))) |
| 24 |
(func (export "type-local-f32") (result f32) (local f32) (local.tee 0 (f32.const 0))) |
| 25 |
(func (export "type-local-f64") (result f64) (local f64) (local.tee 0 (f64.const 0))) |
| 26 |
|
| 27 |
(func (export "type-param-i32") (param i32) (result i32) (local.tee 0 (i32.const 10))) |
| 28 |
(func (export "type-param-i64") (param i64) (result i64) (local.tee 0 (i64.const 11))) |
| 29 |
(func (export "type-param-f32") (param f32) (result f32) (local.tee 0 (f32.const 11.1))) |
| 30 |
(func (export "type-param-f64") (param f64) (result f64) (local.tee 0 (f64.const 12.2))) |
| 31 |
|
| 32 |
(func (export "type-mixed") (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) |
| 33 |
(drop (i64.eqz (local.tee 0 (i64.const 0)))) |
| 34 |
(drop (f32.neg (local.tee 1 (f32.const 0)))) |
| 35 |
(drop (f64.neg (local.tee 2 (f64.const 0)))) |
| 36 |
(drop (i32.eqz (local.tee 3 (i32.const 0)))) |
| 37 |
(drop (i32.eqz (local.tee 4 (i32.const 0)))) |
| 38 |
(drop (f32.neg (local.tee 5 (f32.const 0)))) |
| 39 |
(drop (i64.eqz (local.tee 6 (i64.const 0)))) |
| 40 |
(drop (i64.eqz (local.tee 7 (i64.const 0)))) |
| 41 |
(drop (f64.neg (local.tee 8 (f64.const 0)))) |
| 42 |
) |
| 43 |
|
| 44 |
;; Writing |
| 45 |
|
| 46 |
(func (export "write") (param i64 f32 f64 i32 i32) (result i64) (local f32 i64 i64 f64) |
| 47 |
(drop (local.tee 1 (f32.const -0.3))) |
| 48 |
(drop (local.tee 3 (i32.const 40))) |
| 49 |
(drop (local.tee 4 (i32.const -7))) |
| 50 |
(drop (local.tee 5 (f32.const 5.5))) |
| 51 |
(drop (local.tee 6 (i64.const 6))) |
| 52 |
(drop (local.tee 8 (f64.const 8))) |
| 53 |
(i64.trunc_f64_s |
| 54 |
(f64.add |
| 55 |
(f64.convert_i64_u (local.get 0)) |
| 56 |
(f64.add |
| 57 |
(f64.promote_f32 (local.get 1)) |
| 58 |
(f64.add |
| 59 |
(local.get 2) |
| 60 |
(f64.add |
| 61 |
(f64.convert_i32_u (local.get 3)) |
| 62 |
(f64.add |
| 63 |
(f64.convert_i32_s (local.get 4)) |
| 64 |
(f64.add |
| 65 |
(f64.promote_f32 (local.get 5)) |
| 66 |
(f64.add |
| 67 |
(f64.convert_i64_u (local.get 6)) |
| 68 |
(f64.add |
| 69 |
(f64.convert_i64_u (local.get 7)) |
| 70 |
(local.get 8) |
| 71 |
) |
| 72 |
) |
| 73 |
) |
| 74 |
) |
| 75 |
) |
| 76 |
) |
| 77 |
) |
| 78 |
) |
| 79 |
) |
| 80 |
) |
| 81 |
|
| 82 |
;; Result |
| 83 |
|
| 84 |
(func (export "result") (param i64 f32 f64 i32 i32) (result f64) |
| 85 |
(local f32 i64 i64 f64) |
| 86 |
(f64.add |
| 87 |
(f64.convert_i64_u (local.tee 0 (i64.const 1))) |
| 88 |
(f64.add |
| 89 |
(f64.promote_f32 (local.tee 1 (f32.const 2))) |
| 90 |
(f64.add |
| 91 |
(local.tee 2 (f64.const 3.3)) |
| 92 |
(f64.add |
| 93 |
(f64.convert_i32_u (local.tee 3 (i32.const 4))) |
| 94 |
(f64.add |
| 95 |
(f64.convert_i32_s (local.tee 4 (i32.const 5))) |
| 96 |
(f64.add |
| 97 |
(f64.promote_f32 (local.tee 5 (f32.const 5.5))) |
| 98 |
(f64.add |
| 99 |
(f64.convert_i64_u (local.tee 6 (i64.const 6))) |
| 100 |
(f64.add |
| 101 |
(f64.convert_i64_u (local.tee 7 (i64.const 0))) |
| 102 |
(local.tee 8 (f64.const 8)) |
| 103 |
) |
| 104 |
) |
| 105 |
) |
| 106 |
) |
| 107 |
) |
| 108 |
) |
| 109 |
) |
| 110 |
) |
| 111 |
) |
| 112 |
|
| 113 |
(func $$dummy) |
| 114 |
|
| 115 |
(func (export "as-block-first") (param i32) (result i32) |
| 116 |
(block (result i32) (local.tee 0 (i32.const 1)) (call $$dummy)) |
| 117 |
) |
| 118 |
(func (export "as-block-mid") (param i32) (result i32) |
| 119 |
(block (result i32) (call $$dummy) (local.tee 0 (i32.const 1)) (call $$dummy)) |
| 120 |
) |
| 121 |
(func (export "as-block-last") (param i32) (result i32) |
| 122 |
(block (result i32) (call $$dummy) (call $$dummy) (local.tee 0 (i32.const 1))) |
| 123 |
) |
| 124 |
|
| 125 |
(func (export "as-loop-first") (param i32) (result i32) |
| 126 |
(loop (result i32) (local.tee 0 (i32.const 3)) (call $$dummy)) |
| 127 |
) |
| 128 |
(func (export "as-loop-mid") (param i32) (result i32) |
| 129 |
(loop (result i32) (call $$dummy) (local.tee 0 (i32.const 4)) (call $$dummy)) |
| 130 |
) |
| 131 |
(func (export "as-loop-last") (param i32) (result i32) |
| 132 |
(loop (result i32) (call $$dummy) (call $$dummy) (local.tee 0 (i32.const 5))) |
| 133 |
) |
| 134 |
|
| 135 |
(func (export "as-br-value") (param i32) (result i32) |
| 136 |
(block (result i32) (br 0 (local.tee 0 (i32.const 9)))) |
| 137 |
) |
| 138 |
|
| 139 |
(func (export "as-br_if-cond") (param i32) |
| 140 |
(block (br_if 0 (local.tee 0 (i32.const 1)))) |
| 141 |
) |
| 142 |
(func (export "as-br_if-value") (param i32) (result i32) |
| 143 |
(block (result i32) |
| 144 |
(drop (br_if 0 (local.tee 0 (i32.const 8)) (i32.const 1))) (i32.const 7) |
| 145 |
) |
| 146 |
) |
| 147 |
(func (export "as-br_if-value-cond") (param i32) (result i32) |
| 148 |
(block (result i32) |
| 149 |
(drop (br_if 0 (i32.const 6) (local.tee 0 (i32.const 9)))) (i32.const 7) |
| 150 |
) |
| 151 |
) |
| 152 |
|
| 153 |
(func (export "as-br_table-index") (param i32) |
| 154 |
(block (br_table 0 0 0 (local.tee 0 (i32.const 0)))) |
| 155 |
) |
| 156 |
(func (export "as-br_table-value") (param i32) (result i32) |
| 157 |
(block (result i32) |
| 158 |
(br_table 0 0 0 (local.tee 0 (i32.const 10)) (i32.const 1)) (i32.const 7) |
| 159 |
) |
| 160 |
) |
| 161 |
(func (export "as-br_table-value-index") (param i32) (result i32) |
| 162 |
(block (result i32) |
| 163 |
(br_table 0 0 (i32.const 6) (local.tee 0 (i32.const 11))) (i32.const 7) |
| 164 |
) |
| 165 |
) |
| 166 |
|
| 167 |
(func (export "as-return-value") (param i32) (result i32) |
| 168 |
(return (local.tee 0 (i32.const 7))) |
| 169 |
) |
| 170 |
|
| 171 |
(func (export "as-if-cond") (param i32) (result i32) |
| 172 |
(if (result i32) (local.tee 0 (i32.const 2)) |
| 173 |
(then (i32.const 0)) (else (i32.const 1)) |
| 174 |
) |
| 175 |
) |
| 176 |
(func (export "as-if-then") (param i32) (result i32) |
| 177 |
(if (result i32) (local.get 0) |
| 178 |
(then (local.tee 0 (i32.const 3))) (else (local.get 0)) |
| 179 |
) |
| 180 |
) |
| 181 |
(func (export "as-if-else") (param i32) (result i32) |
| 182 |
(if (result i32) (local.get 0) |
| 183 |
(then (local.get 0)) (else (local.tee 0 (i32.const 4))) |
| 184 |
) |
| 185 |
) |
| 186 |
|
| 187 |
(func (export "as-select-first") (param i32 i32) (result i32) |
| 188 |
(select (local.tee 0 (i32.const 5)) (local.get 0) (local.get 1)) |
| 189 |
) |
| 190 |
(func (export "as-select-second") (param i32 i32) (result i32) |
| 191 |
(select (local.get 0) (local.tee 0 (i32.const 6)) (local.get 1)) |
| 192 |
) |
| 193 |
(func (export "as-select-cond") (param i32) (result i32) |
| 194 |
(select (i32.const 0) (i32.const 1) (local.tee 0 (i32.const 7))) |
| 195 |
) |
| 196 |
|
| 197 |
(func $$f (param i32 i32 i32) (result i32) (i32.const -1)) |
| 198 |
(func (export "as-call-first") (param i32) (result i32) |
| 199 |
(call $$f (local.tee 0 (i32.const 12)) (i32.const 2) (i32.const 3)) |
| 200 |
) |
| 201 |
(func (export "as-call-mid") (param i32) (result i32) |
| 202 |
(call $$f (i32.const 1) (local.tee 0 (i32.const 13)) (i32.const 3)) |
| 203 |
) |
| 204 |
(func (export "as-call-last") (param i32) (result i32) |
| 205 |
(call $$f (i32.const 1) (i32.const 2) (local.tee 0 (i32.const 14))) |
| 206 |
) |
| 207 |
|
| 208 |
(type $$sig (func (param i32 i32 i32) (result i32))) |
| 209 |
(table funcref (elem $$f)) |
| 210 |
(func (export "as-call_indirect-first") (param i32) (result i32) |
| 211 |
(call_indirect (type $$sig) |
| 212 |
(local.tee 0 (i32.const 1)) (i32.const 2) (i32.const 3) (i32.const 0) |
| 213 |
) |
| 214 |
) |
| 215 |
(func (export "as-call_indirect-mid") (param i32) (result i32) |
| 216 |
(call_indirect (type $$sig) |
| 217 |
(i32.const 1) (local.tee 0 (i32.const 2)) (i32.const 3) (i32.const 0) |
| 218 |
) |
| 219 |
) |
| 220 |
(func (export "as-call_indirect-last") (param i32) (result i32) |
| 221 |
(call_indirect (type $$sig) |
| 222 |
(i32.const 1) (i32.const 2) (local.tee 0 (i32.const 3)) (i32.const 0) |
| 223 |
) |
| 224 |
) |
| 225 |
(func (export "as-call_indirect-index") (param i32) (result i32) |
| 226 |
(call_indirect (type $$sig) |
| 227 |
(i32.const 1) (i32.const 2) (i32.const 3) (local.tee 0 (i32.const 0)) |
| 228 |
) |
| 229 |
) |
| 230 |
|
| 231 |
(func (export "as-local.set-value") (local i32) |
| 232 |
(local.set 0 (local.tee 0 (i32.const 1))) |
| 233 |
) |
| 234 |
(func (export "as-local.tee-value") (param i32) (result i32) |
| 235 |
(local.tee 0 (local.tee 0 (i32.const 1))) |
| 236 |
) |
| 237 |
(global $$g (mut i32) (i32.const 0)) |
| 238 |
(func (export "as-global.set-value") (local i32) |
| 239 |
(global.set $$g (local.tee 0 (i32.const 1))) |
| 240 |
) |
| 241 |
|
| 242 |
(memory 1) |
| 243 |
(func (export "as-load-address") (param i32) (result i32) |
| 244 |
(i32.load (local.tee 0 (i32.const 1))) |
| 245 |
) |
| 246 |
(func (export "as-loadN-address") (param i32) (result i32) |
| 247 |
(i32.load8_s (local.tee 0 (i32.const 3))) |
| 248 |
) |
| 249 |
|
| 250 |
(func (export "as-store-address") (param i32) |
| 251 |
(i32.store (local.tee 0 (i32.const 30)) (i32.const 7)) |
| 252 |
) |
| 253 |
(func (export "as-store-value") (param i32) |
| 254 |
(i32.store (i32.const 2) (local.tee 0 (i32.const 1))) |
| 255 |
) |
| 256 |
|
| 257 |
(func (export "as-storeN-address") (param i32) |
| 258 |
(i32.store8 (local.tee 0 (i32.const 1)) (i32.const 7)) |
| 259 |
) |
| 260 |
(func (export "as-storeN-value") (param i32) |
| 261 |
(i32.store16 (i32.const 2) (local.tee 0 (i32.const 1))) |
| 262 |
) |
| 263 |
|
| 264 |
(func (export "as-unary-operand") (param f32) (result f32) |
| 265 |
(f32.neg (local.tee 0 (f32.const nan:0x0f1e2))) |
| 266 |
) |
| 267 |
|
| 268 |
(func (export "as-binary-left") (param i32) (result i32) |
| 269 |
(i32.add (local.tee 0 (i32.const 3)) (i32.const 10)) |
| 270 |
) |
| 271 |
(func (export "as-binary-right") (param i32) (result i32) |
| 272 |
(i32.sub (i32.const 10) (local.tee 0 (i32.const 4))) |
| 273 |
) |
| 274 |
|
| 275 |
(func (export "as-test-operand") (param i32) (result i32) |
| 276 |
(i32.eqz (local.tee 0 (i32.const 0))) |
| 277 |
) |
| 278 |
|
| 279 |
(func (export "as-compare-left") (param i32) (result i32) |
| 280 |
(i32.le_s (local.tee 0 (i32.const 43)) (i32.const 10)) |
| 281 |
) |
| 282 |
(func (export "as-compare-right") (param i32) (result i32) |
| 283 |
(i32.ne (i32.const 10) (local.tee 0 (i32.const 42))) |
| 284 |
) |
| 285 |
|
| 286 |
(func (export "as-convert-operand") (param i64) (result i32) |
| 287 |
(i32.wrap_i64 (local.tee 0 (i64.const 41))) |
| 288 |
) |
| 289 |
|
| 290 |
(func (export "as-memory.grow-size") (param i32) (result i32) |
| 291 |
(memory.grow (local.tee 0 (i32.const 40))) |
| 292 |
) |
| 293 |
|
| 294 |
)`); |
| 295 |
|
| 296 |
// ./test/core/local_tee.wast:280 |
| 297 |
assert_return(() => invoke($0, `type-local-i32`, []), [value("i32", 0)]); |
| 298 |
|
| 299 |
// ./test/core/local_tee.wast:281 |
| 300 |
assert_return(() => invoke($0, `type-local-i64`, []), [value("i64", 0n)]); |
| 301 |
|
| 302 |
// ./test/core/local_tee.wast:282 |
| 303 |
assert_return(() => invoke($0, `type-local-f32`, []), [value("f32", 0)]); |
| 304 |
|
| 305 |
// ./test/core/local_tee.wast:283 |
| 306 |
assert_return(() => invoke($0, `type-local-f64`, []), [value("f64", 0)]); |
| 307 |
|
| 308 |
// ./test/core/local_tee.wast:285 |
| 309 |
assert_return(() => invoke($0, `type-param-i32`, [2]), [value("i32", 10)]); |
| 310 |
|
| 311 |
// ./test/core/local_tee.wast:286 |
| 312 |
assert_return(() => invoke($0, `type-param-i64`, [3n]), [value("i64", 11n)]); |
| 313 |
|
| 314 |
// ./test/core/local_tee.wast:287 |
| 315 |
assert_return(() => invoke($0, `type-param-f32`, [value("f32", 4.4)]), [value("f32", 11.1)]); |
| 316 |
|
| 317 |
// ./test/core/local_tee.wast:288 |
| 318 |
assert_return(() => invoke($0, `type-param-f64`, [value("f64", 5.5)]), [value("f64", 12.2)]); |
| 319 |
|
| 320 |
// ./test/core/local_tee.wast:290 |
| 321 |
assert_return(() => invoke($0, `as-block-first`, [0]), [value("i32", 1)]); |
| 322 |
|
| 323 |
// ./test/core/local_tee.wast:291 |
| 324 |
assert_return(() => invoke($0, `as-block-mid`, [0]), [value("i32", 1)]); |
| 325 |
|
| 326 |
// ./test/core/local_tee.wast:292 |
| 327 |
assert_return(() => invoke($0, `as-block-last`, [0]), [value("i32", 1)]); |
| 328 |
|
| 329 |
// ./test/core/local_tee.wast:294 |
| 330 |
assert_return(() => invoke($0, `as-loop-first`, [0]), [value("i32", 3)]); |
| 331 |
|
| 332 |
// ./test/core/local_tee.wast:295 |
| 333 |
assert_return(() => invoke($0, `as-loop-mid`, [0]), [value("i32", 4)]); |
| 334 |
|
| 335 |
// ./test/core/local_tee.wast:296 |
| 336 |
assert_return(() => invoke($0, `as-loop-last`, [0]), [value("i32", 5)]); |
| 337 |
|
| 338 |
// ./test/core/local_tee.wast:298 |
| 339 |
assert_return(() => invoke($0, `as-br-value`, [0]), [value("i32", 9)]); |
| 340 |
|
| 341 |
// ./test/core/local_tee.wast:300 |
| 342 |
assert_return(() => invoke($0, `as-br_if-cond`, [0]), []); |
| 343 |
|
| 344 |
// ./test/core/local_tee.wast:301 |
| 345 |
assert_return(() => invoke($0, `as-br_if-value`, [0]), [value("i32", 8)]); |
| 346 |
|
| 347 |
// ./test/core/local_tee.wast:302 |
| 348 |
assert_return(() => invoke($0, `as-br_if-value-cond`, [0]), [value("i32", 6)]); |
| 349 |
|
| 350 |
// ./test/core/local_tee.wast:304 |
| 351 |
assert_return(() => invoke($0, `as-br_table-index`, [0]), []); |
| 352 |
|
| 353 |
// ./test/core/local_tee.wast:305 |
| 354 |
assert_return(() => invoke($0, `as-br_table-value`, [0]), [value("i32", 10)]); |
| 355 |
|
| 356 |
// ./test/core/local_tee.wast:306 |
| 357 |
assert_return(() => invoke($0, `as-br_table-value-index`, [0]), [value("i32", 6)]); |
| 358 |
|
| 359 |
// ./test/core/local_tee.wast:308 |
| 360 |
assert_return(() => invoke($0, `as-return-value`, [0]), [value("i32", 7)]); |
| 361 |
|
| 362 |
// ./test/core/local_tee.wast:310 |
| 363 |
assert_return(() => invoke($0, `as-if-cond`, [0]), [value("i32", 0)]); |
| 364 |
|
| 365 |
// ./test/core/local_tee.wast:311 |
| 366 |
assert_return(() => invoke($0, `as-if-then`, [1]), [value("i32", 3)]); |
| 367 |
|
| 368 |
// ./test/core/local_tee.wast:312 |
| 369 |
assert_return(() => invoke($0, `as-if-else`, [0]), [value("i32", 4)]); |
| 370 |
|
| 371 |
// ./test/core/local_tee.wast:314 |
| 372 |
assert_return(() => invoke($0, `as-select-first`, [0, 1]), [value("i32", 5)]); |
| 373 |
|
| 374 |
// ./test/core/local_tee.wast:315 |
| 375 |
assert_return(() => invoke($0, `as-select-second`, [0, 0]), [value("i32", 6)]); |
| 376 |
|
| 377 |
// ./test/core/local_tee.wast:316 |
| 378 |
assert_return(() => invoke($0, `as-select-cond`, [0]), [value("i32", 0)]); |
| 379 |
|
| 380 |
// ./test/core/local_tee.wast:318 |
| 381 |
assert_return(() => invoke($0, `as-call-first`, [0]), [value("i32", -1)]); |
| 382 |
|
| 383 |
// ./test/core/local_tee.wast:319 |
| 384 |
assert_return(() => invoke($0, `as-call-mid`, [0]), [value("i32", -1)]); |
| 385 |
|
| 386 |
// ./test/core/local_tee.wast:320 |
| 387 |
assert_return(() => invoke($0, `as-call-last`, [0]), [value("i32", -1)]); |
| 388 |
|
| 389 |
// ./test/core/local_tee.wast:322 |
| 390 |
assert_return(() => invoke($0, `as-call_indirect-first`, [0]), [value("i32", -1)]); |
| 391 |
|
| 392 |
// ./test/core/local_tee.wast:323 |
| 393 |
assert_return(() => invoke($0, `as-call_indirect-mid`, [0]), [value("i32", -1)]); |
| 394 |
|
| 395 |
// ./test/core/local_tee.wast:324 |
| 396 |
assert_return(() => invoke($0, `as-call_indirect-last`, [0]), [value("i32", -1)]); |
| 397 |
|
| 398 |
// ./test/core/local_tee.wast:325 |
| 399 |
assert_return(() => invoke($0, `as-call_indirect-index`, [0]), [value("i32", -1)]); |
| 400 |
|
| 401 |
// ./test/core/local_tee.wast:327 |
| 402 |
assert_return(() => invoke($0, `as-local.set-value`, []), []); |
| 403 |
|
| 404 |
// ./test/core/local_tee.wast:328 |
| 405 |
assert_return(() => invoke($0, `as-local.tee-value`, [0]), [value("i32", 1)]); |
| 406 |
|
| 407 |
// ./test/core/local_tee.wast:329 |
| 408 |
assert_return(() => invoke($0, `as-global.set-value`, []), []); |
| 409 |
|
| 410 |
// ./test/core/local_tee.wast:331 |
| 411 |
assert_return(() => invoke($0, `as-load-address`, [0]), [value("i32", 0)]); |
| 412 |
|
| 413 |
// ./test/core/local_tee.wast:332 |
| 414 |
assert_return(() => invoke($0, `as-loadN-address`, [0]), [value("i32", 0)]); |
| 415 |
|
| 416 |
// ./test/core/local_tee.wast:333 |
| 417 |
assert_return(() => invoke($0, `as-store-address`, [0]), []); |
| 418 |
|
| 419 |
// ./test/core/local_tee.wast:334 |
| 420 |
assert_return(() => invoke($0, `as-store-value`, [0]), []); |
| 421 |
|
| 422 |
// ./test/core/local_tee.wast:335 |
| 423 |
assert_return(() => invoke($0, `as-storeN-address`, [0]), []); |
| 424 |
|
| 425 |
// ./test/core/local_tee.wast:336 |
| 426 |
assert_return(() => invoke($0, `as-storeN-value`, [0]), []); |
| 427 |
|
| 428 |
// ./test/core/local_tee.wast:338 |
| 429 |
assert_return( |
| 430 |
() => invoke($0, `as-unary-operand`, [value("f32", 0)]), |
| 431 |
[bytes("f32", [0xe2, 0xf1, 0x80, 0xff])], |
| 432 |
); |
| 433 |
|
| 434 |
// ./test/core/local_tee.wast:339 |
| 435 |
assert_return(() => invoke($0, `as-binary-left`, [0]), [value("i32", 13)]); |
| 436 |
|
| 437 |
// ./test/core/local_tee.wast:340 |
| 438 |
assert_return(() => invoke($0, `as-binary-right`, [0]), [value("i32", 6)]); |
| 439 |
|
| 440 |
// ./test/core/local_tee.wast:341 |
| 441 |
assert_return(() => invoke($0, `as-test-operand`, [0]), [value("i32", 1)]); |
| 442 |
|
| 443 |
// ./test/core/local_tee.wast:342 |
| 444 |
assert_return(() => invoke($0, `as-compare-left`, [0]), [value("i32", 0)]); |
| 445 |
|
| 446 |
// ./test/core/local_tee.wast:343 |
| 447 |
assert_return(() => invoke($0, `as-compare-right`, [0]), [value("i32", 1)]); |
| 448 |
|
| 449 |
// ./test/core/local_tee.wast:344 |
| 450 |
assert_return(() => invoke($0, `as-convert-operand`, [0n]), [value("i32", 41)]); |
| 451 |
|
| 452 |
// ./test/core/local_tee.wast:345 |
| 453 |
assert_return(() => invoke($0, `as-memory.grow-size`, [0]), [value("i32", 1)]); |
| 454 |
|
| 455 |
// ./test/core/local_tee.wast:347 |
| 456 |
assert_return(() => invoke($0, `type-mixed`, [1n, value("f32", 2.2), value("f64", 3.3), 4, 5]), []); |
| 457 |
|
| 458 |
// ./test/core/local_tee.wast:353 |
| 459 |
assert_return( |
| 460 |
() => invoke($0, `write`, [1n, value("f32", 2), value("f64", 3.3), 4, 5]), |
| 461 |
[value("i64", 56n)], |
| 462 |
); |
| 463 |
|
| 464 |
// ./test/core/local_tee.wast:360 |
| 465 |
assert_return( |
| 466 |
() => invoke($0, `result`, [-1n, value("f32", -2), value("f64", -3.3), -4, -5]), |
| 467 |
[value("f64", 34.8)], |
| 468 |
); |
| 469 |
|
| 470 |
// ./test/core/local_tee.wast:370 |
| 471 |
assert_invalid( |
| 472 |
() => instantiate(`(module (func $$type-local-num-vs-num (result i64) (local i32) (local.tee 0 (i32.const 0))))`), |
| 473 |
`type mismatch`, |
| 474 |
); |
| 475 |
|
| 476 |
// ./test/core/local_tee.wast:374 |
| 477 |
assert_invalid( |
| 478 |
() => instantiate(`(module (func $$type-local-num-vs-num (local f32) (i32.eqz (local.tee 0 (f32.const 0)))))`), |
| 479 |
`type mismatch`, |
| 480 |
); |
| 481 |
|
| 482 |
// ./test/core/local_tee.wast:378 |
| 483 |
assert_invalid( |
| 484 |
() => instantiate(`(module (func $$type-local-num-vs-num (local f64 i64) (f64.neg (local.tee 1 (i64.const 0)))))`), |
| 485 |
`type mismatch`, |
| 486 |
); |
| 487 |
|
| 488 |
// ./test/core/local_tee.wast:383 |
| 489 |
assert_invalid( |
| 490 |
() => instantiate(`(module (func $$type-local-arg-void-vs-num (local i32) (local.tee 0 (nop))))`), |
| 491 |
`type mismatch`, |
| 492 |
); |
| 493 |
|
| 494 |
// ./test/core/local_tee.wast:387 |
| 495 |
assert_invalid( |
| 496 |
() => instantiate(`(module (func $$type-local-arg-num-vs-num (local i32) (local.tee 0 (f32.const 0))))`), |
| 497 |
`type mismatch`, |
| 498 |
); |
| 499 |
|
| 500 |
// ./test/core/local_tee.wast:391 |
| 501 |
assert_invalid( |
| 502 |
() => instantiate(`(module (func $$type-local-arg-num-vs-num (local f32) (local.tee 0 (f64.const 0))))`), |
| 503 |
`type mismatch`, |
| 504 |
); |
| 505 |
|
| 506 |
// ./test/core/local_tee.wast:395 |
| 507 |
assert_invalid( |
| 508 |
() => instantiate(`(module (func $$type-local-arg-num-vs-num (local f64 i64) (local.tee 1 (f64.const 0))))`), |
| 509 |
`type mismatch`, |
| 510 |
); |
| 511 |
|
| 512 |
// ./test/core/local_tee.wast:403 |
| 513 |
assert_invalid( |
| 514 |
() => instantiate(`(module (func $$type-param-num-vs-num (param i32) (result i64) (local.get 0)))`), |
| 515 |
`type mismatch`, |
| 516 |
); |
| 517 |
|
| 518 |
// ./test/core/local_tee.wast:407 |
| 519 |
assert_invalid( |
| 520 |
() => instantiate(`(module (func $$type-param-num-vs-num (param f32) (i32.eqz (local.get 0))))`), |
| 521 |
`type mismatch`, |
| 522 |
); |
| 523 |
|
| 524 |
// ./test/core/local_tee.wast:411 |
| 525 |
assert_invalid( |
| 526 |
() => instantiate(`(module (func $$type-param-num-vs-num (param f64 i64) (f64.neg (local.get 1))))`), |
| 527 |
`type mismatch`, |
| 528 |
); |
| 529 |
|
| 530 |
// ./test/core/local_tee.wast:416 |
| 531 |
assert_invalid( |
| 532 |
() => instantiate(`(module (func $$type-param-arg-void-vs-num (param i32) (local.tee 0 (nop))))`), |
| 533 |
`type mismatch`, |
| 534 |
); |
| 535 |
|
| 536 |
// ./test/core/local_tee.wast:420 |
| 537 |
assert_invalid( |
| 538 |
() => instantiate(`(module (func $$type-param-arg-num-vs-num (param i32) (local.tee 0 (f32.const 0))))`), |
| 539 |
`type mismatch`, |
| 540 |
); |
| 541 |
|
| 542 |
// ./test/core/local_tee.wast:424 |
| 543 |
assert_invalid( |
| 544 |
() => instantiate(`(module (func $$type-param-arg-num-vs-num (param f32) (local.tee 0 (f64.const 0))))`), |
| 545 |
`type mismatch`, |
| 546 |
); |
| 547 |
|
| 548 |
// ./test/core/local_tee.wast:428 |
| 549 |
assert_invalid( |
| 550 |
() => instantiate(`(module (func $$type-param-arg-num-vs-num (param f64 i64) (local.tee 1 (f64.const 0))))`), |
| 551 |
`type mismatch`, |
| 552 |
); |
| 553 |
|
| 554 |
// ./test/core/local_tee.wast:433 |
| 555 |
assert_invalid( |
| 556 |
() => instantiate(`(module |
| 557 |
(func $$type-param-arg-empty-vs-num (param i32) |
| 558 |
(local.tee 0) (drop) |
| 559 |
) |
| 560 |
)`), |
| 561 |
`type mismatch`, |
| 562 |
); |
| 563 |
|
| 564 |
// ./test/core/local_tee.wast:441 |
| 565 |
assert_invalid( |
| 566 |
() => instantiate(`(module |
| 567 |
(func $$type-param-arg-empty-vs-num-in-block (param i32) |
| 568 |
(i32.const 0) |
| 569 |
(block (local.tee 0) (drop)) |
| 570 |
) |
| 571 |
)`), |
| 572 |
`type mismatch`, |
| 573 |
); |
| 574 |
|
| 575 |
// ./test/core/local_tee.wast:450 |
| 576 |
assert_invalid( |
| 577 |
() => instantiate(`(module |
| 578 |
(func $$type-param-arg-empty-vs-num-in-loop (param i32) |
| 579 |
(i32.const 0) |
| 580 |
(loop (local.tee 0) (drop)) |
| 581 |
) |
| 582 |
)`), |
| 583 |
`type mismatch`, |
| 584 |
); |
| 585 |
|
| 586 |
// ./test/core/local_tee.wast:459 |
| 587 |
assert_invalid( |
| 588 |
() => instantiate(`(module |
| 589 |
(func $$type-param-arg-empty-vs-num-in-then (param i32) |
| 590 |
(i32.const 0) (i32.const 0) |
| 591 |
(if (then (local.tee 0) (drop))) |
| 592 |
) |
| 593 |
)`), |
| 594 |
`type mismatch`, |
| 595 |
); |
| 596 |
|
| 597 |
// ./test/core/local_tee.wast:468 |
| 598 |
assert_invalid( |
| 599 |
() => instantiate(`(module |
| 600 |
(func $$type-param-arg-empty-vs-num-in-else (param i32) |
| 601 |
(i32.const 0) (i32.const 0) |
| 602 |
(if (result i32) (then (i32.const 0)) (else (local.tee 0))) (drop) |
| 603 |
) |
| 604 |
)`), |
| 605 |
`type mismatch`, |
| 606 |
); |
| 607 |
|
| 608 |
// ./test/core/local_tee.wast:477 |
| 609 |
assert_invalid( |
| 610 |
() => instantiate(`(module |
| 611 |
(func $$type-param-arg-empty-vs-num-in-br (param i32) |
| 612 |
(i32.const 0) |
| 613 |
(block (br 0 (local.tee 0)) (drop)) |
| 614 |
) |
| 615 |
)`), |
| 616 |
`type mismatch`, |
| 617 |
); |
| 618 |
|
| 619 |
// ./test/core/local_tee.wast:486 |
| 620 |
assert_invalid( |
| 621 |
() => instantiate(`(module |
| 622 |
(func $$type-param-arg-empty-vs-num-in-br_if (param i32) |
| 623 |
(i32.const 0) |
| 624 |
(block (br_if 0 (local.tee 0) (i32.const 1)) (drop)) |
| 625 |
) |
| 626 |
)`), |
| 627 |
`type mismatch`, |
| 628 |
); |
| 629 |
|
| 630 |
// ./test/core/local_tee.wast:495 |
| 631 |
assert_invalid( |
| 632 |
() => instantiate(`(module |
| 633 |
(func $$type-param-arg-empty-vs-num-in-br_table (param i32) |
| 634 |
(i32.const 0) |
| 635 |
(block (br_table 0 (local.tee 0)) (drop)) |
| 636 |
) |
| 637 |
)`), |
| 638 |
`type mismatch`, |
| 639 |
); |
| 640 |
|
| 641 |
// ./test/core/local_tee.wast:504 |
| 642 |
assert_invalid( |
| 643 |
() => instantiate(`(module |
| 644 |
(func $$type-param-arg-empty-vs-num-in-return (param i32) |
| 645 |
(return (local.tee 0)) (drop) |
| 646 |
) |
| 647 |
)`), |
| 648 |
`type mismatch`, |
| 649 |
); |
| 650 |
|
| 651 |
// ./test/core/local_tee.wast:512 |
| 652 |
assert_invalid( |
| 653 |
() => instantiate(`(module |
| 654 |
(func $$type-param-arg-empty-vs-num-in-select (param i32) |
| 655 |
(select (local.tee 0) (i32.const 1) (i32.const 2)) (drop) |
| 656 |
) |
| 657 |
)`), |
| 658 |
`type mismatch`, |
| 659 |
); |
| 660 |
|
| 661 |
// ./test/core/local_tee.wast:520 |
| 662 |
assert_invalid( |
| 663 |
() => instantiate(`(module |
| 664 |
(func $$type-param-arg-empty-vs-num-in-call (param i32) |
| 665 |
(call 1 (local.tee 0)) (drop) |
| 666 |
) |
| 667 |
(func (param i32) (result i32) (local.get 0)) |
| 668 |
)`), |
| 669 |
`type mismatch`, |
| 670 |
); |
| 671 |
|
| 672 |
// ./test/core/local_tee.wast:529 |
| 673 |
assert_invalid( |
| 674 |
() => instantiate(`(module |
| 675 |
(func $$f (param i32) (result i32) (local.get 0)) |
| 676 |
(type $$sig (func (param i32) (result i32))) |
| 677 |
(table funcref (elem $$f)) |
| 678 |
(func $$type-param-arg-empty-vs-num-in-call_indirect (param i32) |
| 679 |
(block (result i32) |
| 680 |
(call_indirect (type $$sig) |
| 681 |
(local.tee 0) (i32.const 0) |
| 682 |
) |
| 683 |
(drop) |
| 684 |
) |
| 685 |
) |
| 686 |
)`), |
| 687 |
`type mismatch`, |
| 688 |
); |
| 689 |
|
| 690 |
// ./test/core/local_tee.wast:545 |
| 691 |
assert_invalid( |
| 692 |
() => instantiate(`(module |
| 693 |
(func $$type-param-arg-empty-vs-num-in-local.set (param i32) |
| 694 |
(local.set 0 (local.tee 0)) (local.get 0) (drop) |
| 695 |
) |
| 696 |
)`), |
| 697 |
`type mismatch`, |
| 698 |
); |
| 699 |
|
| 700 |
// ./test/core/local_tee.wast:553 |
| 701 |
assert_invalid( |
| 702 |
() => instantiate(`(module |
| 703 |
(func $$type-param-arg-empty-vs-num-in-local.tee (param i32) |
| 704 |
(local.tee 0 (local.tee 0)) (drop) |
| 705 |
) |
| 706 |
)`), |
| 707 |
`type mismatch`, |
| 708 |
); |
| 709 |
|
| 710 |
// ./test/core/local_tee.wast:561 |
| 711 |
assert_invalid( |
| 712 |
() => instantiate(`(module |
| 713 |
(global $$x (mut i32) (i32.const 0)) |
| 714 |
(func $$type-param-arg-empty-vs-num-in-global.set (param i32) |
| 715 |
(global.set $$x (local.tee 0)) (global.get $$x) (drop) |
| 716 |
) |
| 717 |
)`), |
| 718 |
`type mismatch`, |
| 719 |
); |
| 720 |
|
| 721 |
// ./test/core/local_tee.wast:570 |
| 722 |
assert_invalid( |
| 723 |
() => instantiate(`(module |
| 724 |
(memory 0) |
| 725 |
(func $$type-param-arg-empty-vs-num-in-memory.grow (param i32) |
| 726 |
(memory.grow (local.tee 0)) (drop) |
| 727 |
) |
| 728 |
)`), |
| 729 |
`type mismatch`, |
| 730 |
); |
| 731 |
|
| 732 |
// ./test/core/local_tee.wast:579 |
| 733 |
assert_invalid( |
| 734 |
() => instantiate(`(module |
| 735 |
(memory 0) |
| 736 |
(func $$type-param-arg-empty-vs-num-in-load (param i32) |
| 737 |
(i32.load (local.tee 0)) (drop) |
| 738 |
) |
| 739 |
)`), |
| 740 |
`type mismatch`, |
| 741 |
); |
| 742 |
|
| 743 |
// ./test/core/local_tee.wast:588 |
| 744 |
assert_invalid( |
| 745 |
() => instantiate(`(module |
| 746 |
(memory 1) |
| 747 |
(func $$type-param-arg-empty-vs-num-in-store (param i32) |
| 748 |
(i32.store (local.tee 0) (i32.const 1)) |
| 749 |
) |
| 750 |
)`), |
| 751 |
`type mismatch`, |
| 752 |
); |
| 753 |
|
| 754 |
// ./test/core/local_tee.wast:598 |
| 755 |
assert_invalid( |
| 756 |
() => instantiate(`(module (func $$type-mixed-arg-num-vs-num (param f32) (local i32) (local.tee 1 (f32.const 0))))`), |
| 757 |
`type mismatch`, |
| 758 |
); |
| 759 |
|
| 760 |
// ./test/core/local_tee.wast:602 |
| 761 |
assert_invalid( |
| 762 |
() => instantiate(`(module (func $$type-mixed-arg-num-vs-num (param i64 i32) (local f32) (local.tee 1 (f32.const 0))))`), |
| 763 |
`type mismatch`, |
| 764 |
); |
| 765 |
|
| 766 |
// ./test/core/local_tee.wast:606 |
| 767 |
assert_invalid( |
| 768 |
() => instantiate(`(module (func $$type-mixed-arg-num-vs-num (param i64) (local f64 i64) (local.tee 1 (i64.const 0))))`), |
| 769 |
`type mismatch`, |
| 770 |
); |
| 771 |
|
| 772 |
// ./test/core/local_tee.wast:614 |
| 773 |
assert_invalid( |
| 774 |
() => instantiate(`(module (func $$unbound-local (local i32 i64) (local.tee 3 (i32.const 0)) drop))`), |
| 775 |
`unknown local`, |
| 776 |
); |
| 777 |
|
| 778 |
// ./test/core/local_tee.wast:618 |
| 779 |
assert_invalid( |
| 780 |
() => instantiate(`(module (func $$large-local (local i32 i64) (local.tee 14324343 (i32.const 0)) drop))`), |
| 781 |
`unknown local`, |
| 782 |
); |
| 783 |
|
| 784 |
// ./test/core/local_tee.wast:623 |
| 785 |
assert_invalid( |
| 786 |
() => instantiate(`(module (func $$unbound-param (param i32 i64) (local.tee 2 (i32.const 0)) drop))`), |
| 787 |
`unknown local`, |
| 788 |
); |
| 789 |
|
| 790 |
// ./test/core/local_tee.wast:627 |
| 791 |
assert_invalid( |
| 792 |
() => instantiate(`(module (func $$large-param (param i32 i64) (local.tee 714324343 (i32.const 0)) drop))`), |
| 793 |
`unknown local`, |
| 794 |
); |
| 795 |
|
| 796 |
// ./test/core/local_tee.wast:632 |
| 797 |
assert_invalid( |
| 798 |
() => instantiate(`(module (func $$unbound-mixed (param i32) (local i32 i64) (local.tee 3 (i32.const 0)) drop))`), |
| 799 |
`unknown local`, |
| 800 |
); |
| 801 |
|
| 802 |
// ./test/core/local_tee.wast:636 |
| 803 |
assert_invalid( |
| 804 |
() => instantiate(`(module (func $$large-mixed (param i64) (local i32 i64) (local.tee 214324343 (i32.const 0)) drop))`), |
| 805 |
`unknown local`, |
| 806 |
); |