summaryrefslogtreecommitdiff
path: root/test/wasm2js/reinterpret.2asm.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-04-12 15:45:10 -0700
committerGitHub <noreply@github.com>2019-04-12 15:45:10 -0700
commit883d14de7157950063f74b81658d00df0d53be8d (patch)
treece0eb6bd6f8ba344e41861f3280f5248427072e7 /test/wasm2js/reinterpret.2asm.js
parent53badfbea40e78eadf652735d247649948e0b9a9 (diff)
downloadbinaryen-883d14de7157950063f74b81658d00df0d53be8d.tar.gz
binaryen-883d14de7157950063f74b81658d00df0d53be8d.tar.bz2
binaryen-883d14de7157950063f74b81658d00df0d53be8d.zip
Wasm2js memory fixes (#2003)
* I64ToI32Lowering - don't assume address 0 is a hardcoded location for scratch memory. Import __tempMemory__ for that. * RemoveNonJSOps - also use __tempMemory__. Oddly here the address was a hardcoded 1024 (perhaps where the rust program put a static global?). * Support imported ints in wasm2js, coercing them as needed. * Add "env" import support in the tests, since now we emit imports from there. * Make wasm2js tests split out multi-module tests using split_wast which is more robust and avoids emitting multiple outputs in one file (which makes no sense for ES6 modules)
Diffstat (limited to 'test/wasm2js/reinterpret.2asm.js')
-rw-r--r--test/wasm2js/reinterpret.2asm.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/wasm2js/reinterpret.2asm.js b/test/wasm2js/reinterpret.2asm.js
index f0915fa8e..47521bb91 100644
--- a/test/wasm2js/reinterpret.2asm.js
+++ b/test/wasm2js/reinterpret.2asm.js
@@ -1,3 +1,4 @@
+import { __tempMemory__ } from 'env';
function asmFunc(global, env, buffer) {
"use asm";
@@ -21,6 +22,7 @@ function asmFunc(global, env, buffer) {
var abort = env.abort;
var nan = global.NaN;
var infinity = global.Infinity;
+ var __tempMemory__ = env.__tempMemory__ | 0;
var i64toi32_i32$HIGH_BITS = 0;
function dummy() {
@@ -36,20 +38,20 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
var i64toi32_i32$0 = 0, $3$hi = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_f64$0 = 0.0;
i64toi32_i32$0 = $0$hi;
- wasm2js_i32$0 = 0;
+ wasm2js_i32$0 = __tempMemory__;
wasm2js_i32$1 = $0;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
- wasm2js_i32$0 = 0;
+ wasm2js_i32$0 = __tempMemory__;
wasm2js_i32$1 = i64toi32_i32$0;
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
- wasm2js_i32$0 = 0;
- wasm2js_f64$0 = +HEAPF64[0 >> 3];
+ wasm2js_i32$0 = __tempMemory__;
+ wasm2js_f64$0 = +HEAPF64[__tempMemory__ >> 3];
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
- i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$0 = HEAP32[(__tempMemory__ + 4 | 0) >> 2] | 0;
$3$hi = i64toi32_i32$0;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$0 = $3$hi;
- return (HEAP32[0 >> 2] | 0 | 0) == ($0 | 0) & (i64toi32_i32$0 | 0) == ($0$hi | 0) | 0 | 0;
+ return (HEAP32[__tempMemory__ >> 2] | 0 | 0) == ($0 | 0) & (i64toi32_i32$0 | 0) == ($0$hi | 0) | 0 | 0;
}
return {