summaryrefslogtreecommitdiff
path: root/test/wasm2js/conversions-modified.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/conversions-modified.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/conversions-modified.2asm.js')
-rw-r--r--test/wasm2js/conversions-modified.2asm.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/wasm2js/conversions-modified.2asm.js b/test/wasm2js/conversions-modified.2asm.js
index a9dd9f0cb..3d6044a01 100644
--- a/test/wasm2js/conversions-modified.2asm.js
+++ b/test/wasm2js/conversions-modified.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 $0(x) {
x = x | 0;
@@ -193,13 +195,13 @@ function asmFunc(global, env, buffer) {
x$hi = x$hi | 0;
var i64toi32_i32$0 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
i64toi32_i32$0 = x$hi;
- wasm2js_i32$0 = 0;
+ wasm2js_i32$0 = __tempMemory__;
wasm2js_i32$1 = x;
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;
- return +(+HEAPF64[0 >> 3]);
+ return +(+HEAPF64[__tempMemory__ >> 3]);
}
function $23(x) {
@@ -210,11 +212,11 @@ function asmFunc(global, env, buffer) {
function $24(x) {
x = +x;
var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
- wasm2js_i32$0 = 0;
+ wasm2js_i32$0 = __tempMemory__;
wasm2js_f64$0 = x;
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
- i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
- i64toi32_i32$1 = HEAP32[0 >> 2] | 0;
+ i64toi32_i32$0 = HEAP32[(__tempMemory__ + 4 | 0) >> 2] | 0;
+ i64toi32_i32$1 = HEAP32[__tempMemory__ >> 2] | 0;
i64toi32_i32$HIGH_BITS = i64toi32_i32$0;
return i64toi32_i32$1 | 0;
}