-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix store bug, added testcases for the fix
- Loading branch information
Showing
6 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
"args": [ | ||
"node", | ||
"-t", | ||
"exported-called-params-grow-mem", | ||
"mem-exp-host-mod-pingpong", | ||
] | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/node/mem-exp-host-mod-store-lastfunc-return/index.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(module | ||
(import "env" "changeMemAfterReentry" (func $changeMemAfterReentry (result i32))) | ||
(import "env" "foo" (func $foo)) | ||
(import "env" "bar" (func $bar (result i32))) | ||
(func $main (export "main") | ||
call $changeMemAfterReentry | ||
drop | ||
i32.const 1 | ||
i32.load | ||
drop | ||
call $changeMemAfterReentry | ||
drop | ||
i32.const 1 | ||
i32.load | ||
drop | ||
call $changeMemAfterReentry | ||
drop | ||
i32.const 1 | ||
i32.load | ||
drop | ||
) | ||
(func (export "reentry") | ||
call $foo | ||
i32.const 1 | ||
i32.load | ||
drop | ||
) | ||
(func (export "reentry2") | ||
call $bar | ||
drop | ||
) | ||
(memory (export "memory") 1) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default async function test(wasmBinary) { | ||
let instance | ||
let imports = { | ||
env: { | ||
changeMemAfterReentry: () => { | ||
instance.exports.reentry() | ||
new Uint8Array(instance.exports.memory.buffer)[1] = 1 | ||
return 69 | ||
}, | ||
foo: () => { | ||
instance.exports.reentry2() | ||
}, | ||
bar: () => { | ||
new Uint8Array(instance.exports.memory.buffer)[1] = 2 | ||
return 420 | ||
} | ||
} | ||
} | ||
let wasm = await WebAssembly.instantiate(wasmBinary, imports) | ||
instance = wasm.instance | ||
instance.exports.main() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(module | ||
(import "env" "changeMemAfterReentry" (func $changeMemAfterReentry)) | ||
(import "env" "foo" (func $foo)) | ||
(import "env" "bar" (func $bar)) | ||
(func $main (export "main") | ||
call $changeMemAfterReentry | ||
i32.const 1 | ||
i32.load | ||
drop | ||
) | ||
(func (export "reentry") | ||
call $foo | ||
i32.const 1 | ||
i32.load | ||
drop | ||
) | ||
(func (export "reentry2") | ||
call $bar | ||
) | ||
(memory (export "memory") 1) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default async function test(wasmBinary) { | ||
let instance | ||
let imports = { | ||
env: { | ||
changeMemAfterReentry: () => { | ||
instance.exports.reentry() | ||
new Uint8Array(instance.exports.memory.buffer)[1] = 1 | ||
}, | ||
foo: () => { | ||
instance.exports.reentry2() | ||
}, | ||
bar: () => { | ||
new Uint8Array(instance.exports.memory.buffer)[1] = 2 | ||
} | ||
} | ||
} | ||
let wasm = await WebAssembly.instantiate(wasmBinary, imports) | ||
instance = wasm.instance | ||
instance.exports.main() | ||
} |