diff options
author | Sam Clegg <sbc@chromium.org> | 2020-11-11 15:50:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-11 15:50:33 -0800 |
commit | f0d6b089960e089bcc5c1794003585ebbd91d33a (patch) | |
tree | 25e44d01fb2343f3152abeceed593986d1a0998b /test/wasm2js/unaligned.2asm.js | |
parent | d0d96a815fb2e6c397dce76fb1b74b803fd431f4 (diff) | |
download | binaryen-f0d6b089960e089bcc5c1794003585ebbd91d33a.tar.gz binaryen-f0d6b089960e089bcc5c1794003585ebbd91d33a.tar.bz2 binaryen-f0d6b089960e089bcc5c1794003585ebbd91d33a.zip |
wasm2js: Declare data segments before calling asmFunc (#3337)
This is because we maybe need to reference the segments
during the start function. For example in the case of
pthreads we conditionally load passive segments during
start.
Tested in emscripten with: tests/runner.py wasm2js1
Diffstat (limited to 'test/wasm2js/unaligned.2asm.js')
-rw-r--r-- | test/wasm2js/unaligned.2asm.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/wasm2js/unaligned.2asm.js b/test/wasm2js/unaligned.2asm.js index fd6018450..8f8f3673b 100644 --- a/test/wasm2js/unaligned.2asm.js +++ b/test/wasm2js/unaligned.2asm.js @@ -1,5 +1,6 @@ import { setTempRet0 } from 'env'; + var bufferView; var scratchBuffer = new ArrayBuffer(16); var i32ScratchView = new Int32Array(scratchBuffer); @@ -40,7 +41,6 @@ function asmFunc(env) { var HEAPU32 = new Uint32Array(buffer); var HEAPF32 = new Float32Array(buffer); var HEAPF64 = new Float64Array(buffer); - bufferView = HEAPU8; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -160,6 +160,7 @@ function asmFunc(env) { return $0_1 | 0; } + bufferView = HEAPU8; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -176,7 +177,6 @@ function asmFunc(env) { }; } -var bufferView; var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }, setTempRet0 }); |