Skip to content

Commit 909a2ac

Browse files
committed
fix small bug in wasm runtime
1 parent 1f2584e commit 909a2ac

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

lib/wasm/WasmMainTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function generateImportObject(module) {
9696
).join(", ");
9797
const variables = Array.from(
9898
waitForInstances.keys(),
99-
(name, i) => `${name} = array[${i}];`
99+
(name, i) => `${name} = array[${i}]`
100100
).join(", ");
101101
return Template.asString([
102102
`${JSON.stringify(module.id)}: function() {`,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
it("should allow to run a WebAssembly module with many direct wasm dependencies", function() {
2+
return import("./wasm.wat").then(function(wasm) {
3+
const result = wasm.testI64();
4+
expect(result).toEqual(42);
5+
});
6+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(module
2+
(type $t0 (func (param i64) (result i64)))
3+
(func $getI64 (type $t0) (param $p0 i64) (result i64)
4+
get_local $p0
5+
i64.const 20
6+
i64.add)
7+
(export "getI64" (func $getI64)))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(module
2+
(type $t0 (func (param i64) (result i64)))
3+
(func $getI64 (type $t0) (param $p0 i64) (result i64)
4+
get_local $p0
5+
i64.const 22
6+
i64.add)
7+
(export "getI64" (func $getI64)))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");
2+
3+
module.exports = function(config) {
4+
return supportsWebAssembly();
5+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(module
2+
(type $t0 (func (param i64) (result i64)))
3+
(type $t1 (func (result i32)))
4+
(import "./other1.wat" "getI64" (func $getI641 (type $t0)))
5+
(import "./other2.wat" "getI64" (func $getI642 (type $t0)))
6+
(func $testI64 (type $t1) (result i32)
7+
i64.const 1152921504606846976
8+
call $getI641
9+
call $getI642
10+
i64.const 1152921504606846976
11+
i64.sub
12+
i32.wrap/i64)
13+
(export "testI64" (func $testI64)))

0 commit comments

Comments
 (0)