blob: 1409fe39cd90bf029537e2aae402a42a6a2d7f44 (
plain)
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
|
// |jit-test| skip-if: !wasmGcEnabled()
// global.get cannot refer to self or after globals after self
assertErrorMessage(() => wasmEvalText(`(module
(global i32 global.get 0)
)`), WebAssembly.CompileError, /global/);
assertErrorMessage(() => wasmEvalText(`(module
(global i32 global.get 1)
(global i32 i32.const 0)
)`), WebAssembly.CompileError, /global/);
// global.get works on previous globals
{
let {func, b, c, e} = wasmEvalText(`(module
(func $func (export "func"))
(global $a i32 i32.const 1)
(global $b (export "b") i32 global.get $a)
(global $c (export "c") i32 global.get $b)
(global $d funcref ref.func $func)
(global $e (export "e") funcref global.get $d)
)`).exports;
assertEq(b.value, 1);
assertEq(c.value, 1);
assertEq(e.value, func);
}
|