summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-04-07 11:59:29 -0700
committerGitHub <noreply@github.com>2020-04-07 11:59:29 -0700
commiteaa7240105811ffa565dc97768f1399e7855744b (patch)
tree2a7a8897d5d139013a891f6fe687d167b8706584 /test
parentac8b0b71219a1c96d3dab4c9eeddbb4c8401cd1d (diff)
downloadbinaryen-eaa7240105811ffa565dc97768f1399e7855744b.tar.gz
binaryen-eaa7240105811ffa565dc97768f1399e7855744b.tar.bz2
binaryen-eaa7240105811ffa565dc97768f1399e7855744b.zip
JS/Wasm BigInt support for wasm-emscripten-finalize (#2726)
If wasm-emscripten-finalize is given the BigInt flag, then we will be using BigInts on the JS side, and need no legalization at all since i64s will just be BigInts.
Diffstat (limited to 'test')
-rw-r--r--test/lld/bigint.wat10
-rw-r--r--test/lld/bigint.wat.out88
2 files changed, 98 insertions, 0 deletions
diff --git a/test/lld/bigint.wat b/test/lld/bigint.wat
new file mode 100644
index 000000000..4589f396e
--- /dev/null
+++ b/test/lld/bigint.wat
@@ -0,0 +1,10 @@
+(module
+ (table $0 1 1 funcref)
+ (elem (i32.const 1) $foo)
+ (export "__data_end" (global $global$1))
+ (global $global$0 (mut i32) (i32.const 66208))
+ (global $global$1 i32 (i32.const 658))
+ (func $foo (param i64) (result i64)
+ (unreachable)
+ )
+)
diff --git a/test/lld/bigint.wat.out b/test/lld/bigint.wat.out
new file mode 100644
index 000000000..a3214282f
--- /dev/null
+++ b/test/lld/bigint.wat.out
@@ -0,0 +1,88 @@
+(module
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $i64_=>_i64 (func (param i64) (result i64)))
+ (type $i32_=>_none (func (param i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (type $i32_i64_=>_i64 (func (param i32 i64) (result i64)))
+ (table $0 1 1 funcref)
+ (elem (i32.const 1) $foo)
+ (global $global$0 (mut i32) (i32.const 66208))
+ (global $global$1 i32 (i32.const 658))
+ (export "__data_end" (global $global$1))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (export "dynCall_jj" (func $dynCall_jj))
+ (func $foo (; 0 ;) (param $0 i64) (result i64)
+ (unreachable)
+ )
+ (func $stackSave (; 1 ;) (result i32)
+ (global.get $global$0)
+ )
+ (func $stackAlloc (; 2 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $global$0
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $global$0)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 3 ;) (param $0 i32)
+ (global.set $global$0
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 4 ;) (param $newSize i32) (result i32)
+ (memory.grow
+ (local.get $newSize)
+ )
+ )
+ (func $dynCall_jj (; 5 ;) (param $fptr i32) (param $0 i64) (result i64)
+ (call_indirect (type $i64_=>_i64)
+ (local.get $0)
+ (local.get $fptr)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 90,
+ "tableSize": 1,
+ "declares": [
+ ],
+ "externs": [
+ ],
+ "implementedFunctions": [
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory",
+ "_dynCall_jj"
+ ],
+ "exports": [
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory",
+ "dynCall_jj"
+ ],
+ "namedGlobals": {
+ "__data_end" : "658"
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ ],
+ "mainReadsParams": 0
+}
+-- END METADATA --
+;)