diff options
author | Sam Clegg <sbc@chromium.org> | 2022-09-14 12:36:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-14 19:36:37 +0000 |
commit | 64f9732c40157b84b85dea7763a91b4fe3199093 (patch) | |
tree | ddddb46c4e9d2b34e36aeabbc796e8c5200026c4 /test/wasm2js/bulk-memory.2asm.js | |
parent | 795a70b02032f57f14d97d7555af97f0e527b4b0 (diff) | |
download | binaryen-64f9732c40157b84b85dea7763a91b4fe3199093.tar.gz binaryen-64f9732c40157b84b85dea7763a91b4fe3199093.tar.bz2 binaryen-64f9732c40157b84b85dea7763a91b4fe3199093.zip |
wasm2js: Have instantiate function take standard import object (#5018)
Previously we were assuming asmLibraryArg which is what emscripten
passes as the `env` import object but using this method is more
flexible and should allow wasm2js to work with import that are
not all form a single object.
The slight size increase here is just temporary until emscripten
gets updated.
See https://github.com/emscripten-core/emscripten/pull/17737
Diffstat (limited to 'test/wasm2js/bulk-memory.2asm.js')
-rw-r--r-- | test/wasm2js/bulk-memory.2asm.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/wasm2js/bulk-memory.2asm.js b/test/wasm2js/bulk-memory.2asm.js index a517931fb..4ba96d034 100644 --- a/test/wasm2js/bulk-memory.2asm.js +++ b/test/wasm2js/bulk-memory.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -35,7 +36,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } bufferView.fill(value, dest, dest + size); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -143,7 +145,8 @@ function initActiveSegments(imports) { bufferView.copyWithin(dest, source, source + size); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -229,7 +232,8 @@ memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(4), 0, "qrvM bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -344,7 +348,8 @@ function initActiveSegments(imports) { bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); |