summaryrefslogtreecommitdiff
path: root/test/wasm2js
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2js')
-rw-r--r--test/wasm2js/refs.2asm.js12
-rw-r--r--test/wasm2js/refs.2asm.js.opt12
-rw-r--r--test/wasm2js/refs.wast13
3 files changed, 35 insertions, 2 deletions
diff --git a/test/wasm2js/refs.2asm.js b/test/wasm2js/refs.2asm.js
index f538df6d6..f1d60af6c 100644
--- a/test/wasm2js/refs.2asm.js
+++ b/test/wasm2js/refs.2asm.js
@@ -13,6 +13,7 @@ function asmFunc(imports) {
var Math_trunc = Math.trunc;
var Math_sqrt = Math.sqrt;
var global = null;
+ var global_ref = use_global_ref;
function null_() {
return null;
}
@@ -42,13 +43,21 @@ function asmFunc(imports) {
return temp;
}
+ function use_global_ref(x) {
+ var temp = null;
+ temp = global_ref;
+ global_ref = x;
+ return temp;
+ }
+
return {
"null_": null_,
"is_null": is_null,
"ref_func": ref_func,
"ref_eq": ref_eq,
"ref_as": ref_as,
- "use_global": use_global
+ "use_global": use_global,
+ "use_global_ref": use_global_ref
};
}
@@ -60,3 +69,4 @@ export var ref_func = retasmFunc.ref_func;
export var ref_eq = retasmFunc.ref_eq;
export var ref_as = retasmFunc.ref_as;
export var use_global = retasmFunc.use_global;
+export var use_global_ref = retasmFunc.use_global_ref;
diff --git a/test/wasm2js/refs.2asm.js.opt b/test/wasm2js/refs.2asm.js.opt
index 251e63475..fa1947215 100644
--- a/test/wasm2js/refs.2asm.js.opt
+++ b/test/wasm2js/refs.2asm.js.opt
@@ -13,6 +13,7 @@ function asmFunc(imports) {
var Math_trunc = Math.trunc;
var Math_sqrt = Math.sqrt;
var global = null;
+ var global_ref = use_global_ref;
function null_() {
return null;
}
@@ -40,13 +41,21 @@ function asmFunc(imports) {
return $1;
}
+ function use_global_ref($0) {
+ var $1 = null;
+ $1 = global_ref;
+ global_ref = $0;
+ return $1;
+ }
+
return {
"null_": null_,
"is_null": is_null,
"ref_func": ref_func,
"ref_eq": ref_eq,
"ref_as": ref_as,
- "use_global": use_global
+ "use_global": use_global,
+ "use_global_ref": use_global_ref
};
}
@@ -58,3 +67,4 @@ export var ref_func = retasmFunc.ref_func;
export var ref_eq = retasmFunc.ref_eq;
export var ref_as = retasmFunc.ref_as;
export var use_global = retasmFunc.use_global;
+export var use_global_ref = retasmFunc.use_global_ref;
diff --git a/test/wasm2js/refs.wast b/test/wasm2js/refs.wast
index 964d0a60c..244cf2e97 100644
--- a/test/wasm2js/refs.wast
+++ b/test/wasm2js/refs.wast
@@ -1,6 +1,8 @@
(module
(global $global (mut anyref) (ref.null any))
+ (global $global-ref (mut funcref) (ref.func $use-global-ref))
+
(func $null (export "null") (result anyref)
(ref.null any)
)
@@ -49,4 +51,15 @@
)
(local.get $temp)
)
+
+ (func $use-global-ref (export "use-global-ref") (param $x funcref) (result funcref)
+ (local $temp funcref)
+ (local.set $temp
+ (global.get $global-ref)
+ )
+ (global.set $global-ref
+ (local.get $x)
+ )
+ (local.get $temp)
+ )
)