Debian Codegraph @

js/src/jit-test/tests/wasm/tail-calls/litmus17.js

raw
1 // Test that unwinding will find the right instance in the middle of a tail call
2 // chain. This test is mostly useful on the simulators, as they will walk the
3 // stack, looking for the innermost instance, on every memory reference. The
4 // logic of this test is that the setup intra-module tail call in mod2 will need
5 // to be recorded as possibly-inter-module because the subsequent inter-module
6 // call replaces the activation with one that is actually inter-module.
7
8 let ins1 = wasmEvalText(`
9 (module
10 (memory (export "mem") 1 1)
11 (func (export "memref") (result i32)
12 (i32.load (i32.const 0))))`);
13
14 let ins2 = wasmEvalText(`
15 (module
16 (import "mod1" "memref" (func $memref (result i32)))
17
18 (func (export "run") (result i32)
19 (return_call $g))
20
21 (func $g (result i32)
22 (return_call $memref)))`, {mod1: ins1.exports});
23
24 (new Int32Array(ins1.exports.mem.buffer))[0] = 1337;
25 assertEq(ins2.exports.run(), 1337);