mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-11 05:51:38 +00:00
Update Binaryen to latest; Various fixes
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
bin/* text eol=lf
|
||||
dist/* binary
|
||||
scripts/*.sh eol=lf
|
||||
lib/binaryen.js binary
|
||||
|
Binary file not shown.
@ -3,19 +3,22 @@
|
||||
(type $F (func (result f64)))
|
||||
(type $v (func))
|
||||
(type $iiFv (func (param i32 i32 f64)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "config" "BGR_ALIVE" (global $assembly/config/BGR_ALIVE i32))
|
||||
(import "config" "BGR_DEAD" (global $assembly/config/BGR_DEAD i32))
|
||||
(import "config" "BIT_ROT" (global $assembly/config/BIT_ROT i32))
|
||||
(import "JSMath" "random" (func $~lib/math/JSMath.random (result f64)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(import "Math" "random" (func $~lib/bindings/Math/random (result f64)))
|
||||
(global $assembly/index/w (mut i32) (i32.const 0))
|
||||
(global $assembly/index/h (mut i32) (i32.const 0))
|
||||
(global $assembly/index/s (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "init" (func $assembly/index/init))
|
||||
(export "step" (func $assembly/index/step))
|
||||
(export "fill" (func $assembly/index/fill))
|
||||
(func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $assembly/index/init (; 1 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
;;@ assembly/index.ts:29:2
|
||||
(set_global $assembly/index/w
|
||||
@ -49,7 +52,7 @@
|
||||
(get_global $assembly/index/h)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:34:30
|
||||
;;@ assembly/index.ts:35:4
|
||||
(block $break|1
|
||||
;;@ assembly/index.ts:35:9
|
||||
(set_local $1
|
||||
@ -70,7 +73,7 @@
|
||||
(if (result i32)
|
||||
(f64.gt
|
||||
;;@ assembly/index.ts:36:21
|
||||
(call $~lib/math/JSMath.random)
|
||||
(call $~lib/bindings/Math/random)
|
||||
;;@ assembly/index.ts:36:32
|
||||
(f64.const 0.1)
|
||||
)
|
||||
@ -131,7 +134,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/step (; 2 ;) (type $v)
|
||||
(func $assembly/index/step (; 2 ;) (; has Stack IR ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
@ -604,7 +607,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/fill (; 3 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
|
||||
(func $assembly/index/fill (; 3 ;) (; has Stack IR ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
|
||||
(local $3 i32)
|
||||
;;@ assembly/index.ts:81:2
|
||||
(block $break|0
|
||||
@ -617,12 +620,12 @@
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:81:33
|
||||
;;@ assembly/index.ts:82:4
|
||||
(if
|
||||
;;@ assembly/index.ts:82:8
|
||||
(f64.lt
|
||||
;;@ assembly/index.ts:82:13
|
||||
(call $~lib/math/JSMath.random)
|
||||
(call $~lib/bindings/Math/random)
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.store
|
||||
@ -673,12 +676,12 @@
|
||||
(get_global $assembly/index/h)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:84:33
|
||||
;;@ assembly/index.ts:85:4
|
||||
(if
|
||||
;;@ assembly/index.ts:85:8
|
||||
(f64.lt
|
||||
;;@ assembly/index.ts:85:13
|
||||
(call $~lib/math/JSMath.random)
|
||||
(call $~lib/bindings/Math/random)
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ assembly/index.ts:17:2
|
||||
@ -720,4 +723,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $null (; 4 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
||||
|
@ -3,16 +3,19 @@
|
||||
(type $F (func (result f64)))
|
||||
(type $v (func))
|
||||
(type $iiFv (func (param i32 i32 f64)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "config" "BGR_ALIVE" (global $assembly/config/BGR_ALIVE i32))
|
||||
(import "config" "BGR_DEAD" (global $assembly/config/BGR_DEAD i32))
|
||||
(import "config" "BIT_ROT" (global $assembly/config/BIT_ROT i32))
|
||||
(import "JSMath" "random" (func $~lib/math/JSMath.random (result f64)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(import "Math" "random" (func $~lib/bindings/Math/random (result f64)))
|
||||
(global $assembly/index/w (mut i32) (i32.const 0))
|
||||
(global $assembly/index/h (mut i32) (i32.const 0))
|
||||
(global $assembly/index/s (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "init" (func $assembly/index/init))
|
||||
(export "step" (func $assembly/index/step))
|
||||
(export "fill" (func $assembly/index/fill))
|
||||
@ -57,7 +60,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:34:30
|
||||
;;@ assembly/index.ts:35:4
|
||||
(block $break|1
|
||||
;;@ assembly/index.ts:35:9
|
||||
(set_local $3
|
||||
@ -75,14 +78,14 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:35:32
|
||||
;;@ assembly/index.ts:36:6
|
||||
(block $assembly/index/set|inlined.0
|
||||
(set_local $4
|
||||
;;@ assembly/index.ts:36:16
|
||||
(if (result i32)
|
||||
(f64.gt
|
||||
;;@ assembly/index.ts:36:21
|
||||
(call $~lib/math/JSMath.random)
|
||||
(call $~lib/bindings/Math/random)
|
||||
;;@ assembly/index.ts:36:32
|
||||
(f64.const 0.1)
|
||||
)
|
||||
@ -751,12 +754,12 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:81:33
|
||||
;;@ assembly/index.ts:82:4
|
||||
(if
|
||||
;;@ assembly/index.ts:82:8
|
||||
(f64.lt
|
||||
;;@ assembly/index.ts:82:13
|
||||
(call $~lib/math/JSMath.random)
|
||||
(call $~lib/bindings/Math/random)
|
||||
;;@ assembly/index.ts:82:24
|
||||
(get_local $2)
|
||||
)
|
||||
@ -817,12 +820,12 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:84:33
|
||||
;;@ assembly/index.ts:85:4
|
||||
(if
|
||||
;;@ assembly/index.ts:85:8
|
||||
(f64.lt
|
||||
;;@ assembly/index.ts:85:13
|
||||
(call $~lib/math/JSMath.random)
|
||||
(call $~lib/bindings/Math/random)
|
||||
;;@ assembly/index.ts:85:24
|
||||
(get_local $2)
|
||||
)
|
||||
@ -874,4 +877,6 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $null (; 4 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
@ -70,7 +70,7 @@ fetch("build/optimized.wasm")
|
||||
BGR_DEAD : rgb2bgr(RGB_DEAD) & ~1, // little endian, LSB must not be set
|
||||
BIT_ROT
|
||||
},
|
||||
JSMath: Math
|
||||
Math
|
||||
}))
|
||||
.then(module => {
|
||||
var exports = module.instance.exports;
|
||||
|
@ -2,10 +2,14 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/i64/lo (mut i32) (i32.const 0))
|
||||
(global $assembly/i64/hi (mut i32) (i32.const 0))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "getLo" (func $assembly/i64/getLo))
|
||||
(export "getHi" (func $assembly/i64/getHi))
|
||||
(export "clz" (func $assembly/i64/clz))
|
||||
@ -37,15 +41,15 @@
|
||||
(export "gt_u" (func $assembly/i64/gt_u))
|
||||
(export "ge_s" (func $assembly/i64/ge_s))
|
||||
(export "ge_u" (func $assembly/i64/ge_u))
|
||||
(func $assembly/i64/getLo (; 0 ;) (type $i) (result i32)
|
||||
(func $assembly/i64/getLo (; 0 ;) (; has Stack IR ;) (type $i) (result i32)
|
||||
;;@ assembly/i64.ts:4:9
|
||||
(get_global $assembly/i64/lo)
|
||||
)
|
||||
(func $assembly/i64/getHi (; 1 ;) (type $i) (result i32)
|
||||
(func $assembly/i64/getHi (; 1 ;) (; has Stack IR ;) (type $i) (result i32)
|
||||
;;@ assembly/i64.ts:8:9
|
||||
(get_global $assembly/i64/hi)
|
||||
)
|
||||
(func $assembly/i64/clz (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $assembly/i64/clz (; 2 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
;;@ assembly/i64.ts:15:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:15:7
|
||||
@ -75,7 +79,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/ctz (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $assembly/i64/ctz (; 3 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
;;@ assembly/i64.ts:23:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:23:7
|
||||
@ -105,7 +109,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/popcnt (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $assembly/i64/popcnt (; 4 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
;;@ assembly/i64.ts:31:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:31:7
|
||||
@ -135,7 +139,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/eqz (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(func $assembly/i64/eqz (; 5 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
;;@ assembly/i64.ts:37:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:36:18
|
||||
@ -163,7 +167,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/add (; 6 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/add (; 6 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:43:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -219,7 +223,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/sub (; 7 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/sub (; 7 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:49:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -275,7 +279,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/mul (; 8 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/mul (; 8 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:55:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -331,7 +335,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/div_s (; 9 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/div_s (; 9 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:61:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -388,7 +392,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/div_u (; 10 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/div_u (; 10 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:67:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -444,7 +448,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/rem_s (; 11 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/rem_s (; 11 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:73:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -501,7 +505,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/rem_u (; 12 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/rem_u (; 12 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:79:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -557,7 +561,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/and (; 13 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/and (; 13 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:85:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -613,7 +617,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/or (; 14 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/or (; 14 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:91:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -669,7 +673,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/xor (; 15 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/xor (; 15 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:97:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -725,7 +729,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/shl (; 16 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/shl (; 16 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:103:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -781,7 +785,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/shr_s (; 17 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/shr_s (; 17 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:109:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -838,7 +842,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/shr_u (; 18 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/shr_u (; 18 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:115:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -894,7 +898,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/rotl (; 19 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/rotl (; 19 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:123:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -949,7 +953,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/rotr (; 20 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/rotr (; 20 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
;;@ assembly/i64.ts:131:2
|
||||
(set_global $assembly/i64/lo
|
||||
@ -1004,7 +1008,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/eq (; 21 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/eq (; 21 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:137:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:136:18
|
||||
@ -1046,7 +1050,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/ne (; 22 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/ne (; 22 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:143:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:142:18
|
||||
@ -1088,7 +1092,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/lt_s (; 23 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/lt_s (; 23 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:149:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:148:18
|
||||
@ -1130,7 +1134,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/lt_u (; 24 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/lt_u (; 24 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:155:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:154:18
|
||||
@ -1172,7 +1176,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/le_s (; 25 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/le_s (; 25 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:161:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:160:18
|
||||
@ -1214,7 +1218,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/le_u (; 26 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/le_u (; 26 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:167:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:166:18
|
||||
@ -1256,7 +1260,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/gt_s (; 27 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/gt_s (; 27 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:173:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:172:18
|
||||
@ -1298,7 +1302,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/gt_u (; 28 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/gt_u (; 28 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:179:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:178:18
|
||||
@ -1340,7 +1344,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/ge_s (; 29 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/ge_s (; 29 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:185:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:184:18
|
||||
@ -1382,7 +1386,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $assembly/i64/ge_u (; 30 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/i64/ge_u (; 30 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
;;@ assembly/i64.ts:191:2
|
||||
(set_global $assembly/i64/lo
|
||||
;;@ assembly/i64.ts:190:18
|
||||
@ -1424,4 +1428,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $null (; 31 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
||||
|
@ -2,13 +2,17 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/i64/lo (mut i32) (i32.const 0))
|
||||
(global $assembly/i64/hi (mut i32) (i32.const 0))
|
||||
(global $NaN f64 (f64.const nan:0x8000000000000))
|
||||
(global $Infinity f64 (f64.const inf))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "getLo" (func $assembly/i64/getLo))
|
||||
(export "getHi" (func $assembly/i64/getHi))
|
||||
(export "clz" (func $assembly/i64/clz))
|
||||
@ -1523,4 +1527,6 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $null (; 31 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
Binary file not shown.
@ -1,13 +1,17 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $FF (func (param f64) (result f64)))
|
||||
(import "JSMath" "sqrt" (func $~lib/math/JSMath.sqrt (param f64) (result f64)))
|
||||
(import "JSMath" "log" (func $~lib/math/JSMath.log (param f64) (result f64)))
|
||||
(import "JSMath" "LN2" (global $~lib/math/JSMath.LN2 f64))
|
||||
(type $v (func))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "Math" "LN2" (global $~lib/bindings/Math/LN2 f64))
|
||||
(import "Math" "sqrt" (func $~lib/bindings/Math/sqrt (param f64) (result f64)))
|
||||
(import "Math" "log" (func $~lib/bindings/Math/log (param f64) (result f64)))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "computeLine" (func $assembly/index/computeLine))
|
||||
(func $assembly/index/computeLine (; 2 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/index/computeLine (; 2 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 f64)
|
||||
(local $5 f64)
|
||||
(local $6 f64)
|
||||
@ -279,11 +283,11 @@
|
||||
;;@ assembly/index.ts:36:15
|
||||
(f64.div
|
||||
;;@ assembly/index.ts:36:20
|
||||
(call $~lib/math/JSMath.log
|
||||
(call $~lib/bindings/Math/log
|
||||
;;@ assembly/index.ts:36:29
|
||||
(call $~lib/math/JSMath.log
|
||||
(call $~lib/bindings/Math/log
|
||||
;;@ assembly/index.ts:36:38
|
||||
(call $~lib/math/JSMath.sqrt
|
||||
(call $~lib/bindings/Math/sqrt
|
||||
;;@ assembly/index.ts:36:43
|
||||
(f64.add
|
||||
(f64.mul
|
||||
@ -300,7 +304,7 @@
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:36:66
|
||||
(get_global $~lib/math/JSMath.LN2)
|
||||
(get_global $~lib/bindings/Math/LN2)
|
||||
)
|
||||
)
|
||||
(get_local $6)
|
||||
@ -352,4 +356,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $null (; 3 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
||||
|
@ -3,24 +3,28 @@
|
||||
(type $FF (func (param f64) (result f64)))
|
||||
(type $Fi (func (param f64) (result i32)))
|
||||
(type $FFFF (func (param f64 f64 f64) (result f64)))
|
||||
(import "JSMath" "sqrt" (func $~lib/math/JSMath.sqrt (param f64) (result f64)))
|
||||
(import "JSMath" "log" (func $~lib/math/JSMath.log (param f64) (result f64)))
|
||||
(import "JSMath" "LN2" (global $~lib/math/JSMath.LN2 f64))
|
||||
(type $v (func))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "Math" "LN2" (global $~lib/bindings/Math/LN2 f64))
|
||||
(import "Math" "sqrt" (func $~lib/bindings/Math/sqrt (param f64) (result f64)))
|
||||
(import "Math" "log" (func $~lib/bindings/Math/log (param f64) (result f64)))
|
||||
(global $assembly/index/NUM_COLORS i32 (i32.const 2048))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "computeLine" (func $assembly/index/computeLine))
|
||||
(func $~lib/builtins/isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
|
||||
;;@ ~lib/builtins.ts:16:70
|
||||
;;@ ~lib/builtins.ts:16:78
|
||||
(f64.eq
|
||||
;;@ ~lib/builtins.ts:16:53
|
||||
;;@ ~lib/builtins.ts:16:61
|
||||
(f64.sub
|
||||
(get_local $0)
|
||||
;;@ ~lib/builtins.ts:16:61
|
||||
;;@ ~lib/builtins.ts:16:69
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ ~lib/builtins.ts:16:70
|
||||
;;@ ~lib/builtins.ts:16:78
|
||||
(f64.const 0)
|
||||
)
|
||||
)
|
||||
@ -195,6 +199,7 @@
|
||||
(f64.const 4)
|
||||
)
|
||||
(block
|
||||
;;@ assembly/index.ts:18:55
|
||||
(block
|
||||
;;@ assembly/index.ts:19:6
|
||||
(set_local $15
|
||||
@ -345,11 +350,11 @@
|
||||
;;@ assembly/index.ts:36:15
|
||||
(f64.div
|
||||
;;@ assembly/index.ts:36:20
|
||||
(call $~lib/math/JSMath.log
|
||||
(call $~lib/bindings/Math/log
|
||||
;;@ assembly/index.ts:36:29
|
||||
(call $~lib/math/JSMath.log
|
||||
(call $~lib/bindings/Math/log
|
||||
;;@ assembly/index.ts:36:38
|
||||
(call $~lib/math/JSMath.sqrt
|
||||
(call $~lib/bindings/Math/sqrt
|
||||
;;@ assembly/index.ts:36:43
|
||||
(f64.add
|
||||
(f64.mul
|
||||
@ -368,7 +373,7 @@
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:36:66
|
||||
(get_global $~lib/math/JSMath.LN2)
|
||||
(get_global $~lib/bindings/Math/LN2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:37:4
|
||||
@ -460,4 +465,6 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $null (; 5 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
@ -49,7 +49,7 @@ fetch("build/optimized.wasm")
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(buffer => WebAssembly.instantiate(buffer, {
|
||||
env: { memory: memory },
|
||||
JSMath: Math
|
||||
Math
|
||||
}))
|
||||
.then(module => {
|
||||
var exports = module.instance.exports;
|
||||
|
@ -20,222 +20,179 @@ function asmFunc(global, env, buffer) {
|
||||
var abort = env.abort;
|
||||
var nan = global.NaN;
|
||||
var infinity = global.Infinity;
|
||||
var $lib_env_abort = env.abort;
|
||||
var $lib_allocator_arena_startOffset = 0;
|
||||
var $lib_allocator_arena_offset = 0;
|
||||
var assembly_index_system = 0;
|
||||
var i64toi32_i32$HIGH_BITS = 0;
|
||||
function $lib_allocator_arena___memory_allocate($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0, $3 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0, wasm2asm_i32$2 = 0;
|
||||
if ($0) {
|
||||
if ($0 >>> 0 > 1073741824 >>> 0) abort();
|
||||
$1 = $lib_allocator_arena_offset;
|
||||
$0 = (($1 + $0 | 0) + 7 | 0) & 4294967288 | 0;
|
||||
$2 = __wasm_current_memory();
|
||||
if ($0 >>> 0 > ($2 << 16 | 0) >>> 0) {
|
||||
$3 = ((($0 - $1 | 0) + 65535 | 0) & 4294901760 | 0) >>> 16 | 0;
|
||||
if ((__wasm_grow_memory((wasm2asm_i32$0 = $2, wasm2asm_i32$1 = $3, wasm2asm_i32$2 = ($2 | 0) > ($3 | 0), wasm2asm_i32$2 ? wasm2asm_i32$0 : wasm2asm_i32$1) | 0) | 0) < (0 | 0)) if ((__wasm_grow_memory($3 | 0) | 0) < (0 | 0)) abort();;
|
||||
}
|
||||
$lib_allocator_arena_offset = $0;
|
||||
return $1 | 0;
|
||||
var $1 = 0, $2 = 0, $3 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0;
|
||||
if ($0 >>> 0 > 1073741824 >>> 0) abort();
|
||||
$1 = $lib_allocator_arena_offset;
|
||||
$2 = (($1 + (wasm2js_i32$0 = $0, wasm2js_i32$1 = 1, wasm2js_i32$2 = $0 >>> 0 > 1 >>> 0, wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) + 7 | 0) & 4294967288 | 0;
|
||||
$3 = __wasm_current_memory();
|
||||
if ($2 >>> 0 > ($3 << 16 | 0) >>> 0) {
|
||||
$0 = ((($2 - $1 | 0) + 65535 | 0) & 4294901760 | 0) >>> 16 | 0;
|
||||
if ((__wasm_grow_memory((wasm2js_i32$0 = $3, wasm2js_i32$1 = $0, wasm2js_i32$2 = ($3 | 0) > ($0 | 0), wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) | 0) < (0 | 0)) if ((__wasm_grow_memory($0 | 0) | 0) < (0 | 0)) abort();;
|
||||
}
|
||||
return 0 | 0;
|
||||
$lib_allocator_arena_offset = $2;
|
||||
return $1 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6, $7) {
|
||||
$0 = $0 | 0;
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6) {
|
||||
$0 = +$0;
|
||||
$1 = +$1;
|
||||
$2 = +$2;
|
||||
$3 = +$3;
|
||||
$4 = +$4;
|
||||
$5 = +$5;
|
||||
$6 = +$6;
|
||||
$7 = +$7;
|
||||
var wasm2asm_i32$0 = 0, wasm2asm_f64$0 = 0.0;
|
||||
if (($0 | 0) == (0 | 0)) {
|
||||
$0 = $lib_allocator_arena___memory_allocate(56 | 0) | 0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $1;
|
||||
HEAPF64[wasm2asm_i32$0 >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $2;
|
||||
HEAPF64[(wasm2asm_i32$0 + 8 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $3;
|
||||
HEAPF64[(wasm2asm_i32$0 + 16 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $4;
|
||||
HEAPF64[(wasm2asm_i32$0 + 24 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $5;
|
||||
HEAPF64[(wasm2asm_i32$0 + 32 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $6;
|
||||
HEAPF64[(wasm2asm_i32$0 + 40 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $7;
|
||||
HEAPF64[(wasm2asm_i32$0 + 48 | 0) >> 3] = wasm2asm_f64$0;
|
||||
}
|
||||
return $0 | 0;
|
||||
var $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
|
||||
$7 = $lib_allocator_arena___memory_allocate(56 | 0) | 0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $0;
|
||||
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $1;
|
||||
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $3;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $4;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 48 | 0) >> 3] = wasm2js_f64$0;
|
||||
return $7 | 0;
|
||||
}
|
||||
|
||||
function $lib_memory_memset($0, $1, $2) {
|
||||
function $lib_internal_memory_memset($0, $1) {
|
||||
$0 = $0 | 0;
|
||||
$1 = $1 | 0;
|
||||
$2 = $2 | 0;
|
||||
var i64toi32_i32$2 = 0, i64toi32_i32$0 = 0, $3 = 0, $4 = 0, i64toi32_i32$1 = 0, i64toi32_i32$4 = 0, i64toi32_i32$3 = 0, $4$hi = 0, $14 = 0, $121 = 0, $121$hi = 0, $123$hi = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0, wasm2asm_i32$2 = 0, wasm2asm_i32$3 = 0;
|
||||
if (($2 | 0) == (0 | 0)) return;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = ($0 + $2 | 0) - 1 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
if ($2 >>> 0 <= 2 >>> 0) return;
|
||||
wasm2asm_i32$0 = $0 + 1 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0 + 2 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
$3 = $0 + $2 | 0;
|
||||
wasm2asm_i32$0 = $3 - 2 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $3 - 3 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
if ($2 >>> 0 <= 6 >>> 0) return;
|
||||
wasm2asm_i32$0 = $0 + 3 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = ($0 + $2 | 0) - 4 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP8[wasm2asm_i32$0 >> 0] = wasm2asm_i32$1;
|
||||
if ($2 >>> 0 <= 8 >>> 0) return;
|
||||
$3 = (0 - $0 | 0) & 3 | 0;
|
||||
$2 = $2 - $3 | 0;
|
||||
$0 = $0 + $3 | 0;
|
||||
$1 = Math_imul($1 & 255 | 0, 16843009);
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
$2 = $2 & 4294967292 | 0;
|
||||
wasm2asm_i32$0 = ($0 + $2 | 0) - 4 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
if ($2 >>> 0 <= 8 >>> 0) return;
|
||||
wasm2asm_i32$0 = $0 + 4 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0 + 8 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
$3 = $0 + $2 | 0;
|
||||
wasm2asm_i32$0 = $3 - 12 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $3 - 8 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
if ($2 >>> 0 <= 24 >>> 0) return;
|
||||
wasm2asm_i32$0 = $0 + 12 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0 + 16 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0 + 20 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0 + 24 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
$3 = $0 + $2 | 0;
|
||||
wasm2asm_i32$0 = $3 - 28 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $3 - 24 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $3 - 20 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $3 - 16 | 0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
$3 = ($0 & 4 | 0) + 24 | 0;
|
||||
$0 = $0 + $3 | 0;
|
||||
$2 = $2 - $3 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
i64toi32_i32$0 = i64toi32_i32$0;
|
||||
$4 = $1;
|
||||
$4$hi = i64toi32_i32$0;
|
||||
i64toi32_i32$0 = i64toi32_i32$0;
|
||||
$121 = $1;
|
||||
$121$hi = i64toi32_i32$0;
|
||||
i64toi32_i32$0 = i64toi32_i32$0;
|
||||
i64toi32_i32$0 = i64toi32_i32$0;
|
||||
i64toi32_i32$2 = $1;
|
||||
i64toi32_i32$1 = 0;
|
||||
i64toi32_i32$3 = 32;
|
||||
i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0;
|
||||
if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) {
|
||||
i64toi32_i32$1 = i64toi32_i32$2 << i64toi32_i32$4 | 0;
|
||||
$14 = 0;
|
||||
} else {
|
||||
i64toi32_i32$1 = ((1 << i64toi32_i32$4 | 0) - 1 | 0) & (i64toi32_i32$2 >>> (32 - i64toi32_i32$4 | 0) | 0) | 0 | (i64toi32_i32$0 << i64toi32_i32$4 | 0) | 0;
|
||||
$14 = i64toi32_i32$2 << i64toi32_i32$4 | 0;
|
||||
}
|
||||
$123$hi = i64toi32_i32$1;
|
||||
i64toi32_i32$1 = $121$hi;
|
||||
i64toi32_i32$0 = $121;
|
||||
i64toi32_i32$2 = $123$hi;
|
||||
i64toi32_i32$3 = $14;
|
||||
i64toi32_i32$2 = i64toi32_i32$1 | i64toi32_i32$2 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
$4 = i64toi32_i32$0 | i64toi32_i32$3 | 0;
|
||||
$4$hi = i64toi32_i32$2;
|
||||
var $2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$0 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0, wasm2js_i32$3 = 0;
|
||||
if (($1 | 0) == (0 | 0)) return;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = ($0 + $1 | 0) - 1 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
if ($1 >>> 0 <= 2 >>> 0) return;
|
||||
wasm2js_i32$0 = $0 + 1 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 2 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
$2 = $0 + $1 | 0;
|
||||
wasm2js_i32$0 = $2 - 2 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $2 - 3 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
if ($1 >>> 0 <= 6 >>> 0) return;
|
||||
wasm2js_i32$0 = $0 + 3 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = ($0 + $1 | 0) - 4 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
if ($1 >>> 0 <= 8 >>> 0) return;
|
||||
$2 = (0 - $0 | 0) & 3 | 0;
|
||||
$0 = $0 + $2 | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$1 = ($1 - $2 | 0) & 4294967292 | 0;
|
||||
wasm2js_i32$0 = ($0 + $1 | 0) - 4 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
if ($1 >>> 0 <= 8 >>> 0) return;
|
||||
wasm2js_i32$0 = $0 + 4 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 8 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$2 = $0 + $1 | 0;
|
||||
wasm2js_i32$0 = $2 - 12 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $2 - 8 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
if ($1 >>> 0 <= 24 >>> 0) return;
|
||||
wasm2js_i32$0 = $0 + 12 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 16 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 20 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 24 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$2 = $0 + $1 | 0;
|
||||
wasm2js_i32$0 = $2 - 28 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $2 - 24 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $2 - 20 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $2 - 16 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$2 = ($0 & 4 | 0) + 24 | 0;
|
||||
$0 = $0 + $2 | 0;
|
||||
$1 = $1 - $2 | 0;
|
||||
continue_0 : do {
|
||||
if ($2 >>> 0 >= 32 >>> 0) {
|
||||
i64toi32_i32$2 = $4$hi;
|
||||
i64toi32_i32$0 = $0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = $4;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = i64toi32_i32$2;
|
||||
(wasm2asm_i32$2 = wasm2asm_i32$0, wasm2asm_i32$3 = wasm2asm_i32$1), ((HEAP8[(wasm2asm_i32$2 + 4 | 0) >> 0] = wasm2asm_i32$3 & 255 | 0, HEAP8[(wasm2asm_i32$2 + 5 | 0) >> 0] = (wasm2asm_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 6 | 0) >> 0] = (wasm2asm_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 7 | 0) >> 0] = (wasm2asm_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
i64toi32_i32$0 = $0 + 8 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
wasm2asm_i32$0 = i64toi32_i32$0;
|
||||
wasm2asm_i32$1 = $4;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = i64toi32_i32$0;
|
||||
wasm2asm_i32$1 = i64toi32_i32$2;
|
||||
(wasm2asm_i32$2 = wasm2asm_i32$0, wasm2asm_i32$3 = wasm2asm_i32$1), ((HEAP8[(wasm2asm_i32$2 + 4 | 0) >> 0] = wasm2asm_i32$3 & 255 | 0, HEAP8[(wasm2asm_i32$2 + 5 | 0) >> 0] = (wasm2asm_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 6 | 0) >> 0] = (wasm2asm_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 7 | 0) >> 0] = (wasm2asm_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
i64toi32_i32$0 = $0 + 16 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
wasm2asm_i32$0 = i64toi32_i32$0;
|
||||
wasm2asm_i32$1 = $4;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = i64toi32_i32$0;
|
||||
wasm2asm_i32$1 = i64toi32_i32$2;
|
||||
(wasm2asm_i32$2 = wasm2asm_i32$0, wasm2asm_i32$3 = wasm2asm_i32$1), ((HEAP8[(wasm2asm_i32$2 + 4 | 0) >> 0] = wasm2asm_i32$3 & 255 | 0, HEAP8[(wasm2asm_i32$2 + 5 | 0) >> 0] = (wasm2asm_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 6 | 0) >> 0] = (wasm2asm_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 7 | 0) >> 0] = (wasm2asm_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
i64toi32_i32$0 = $0 + 24 | 0;
|
||||
i64toi32_i32$2 = i64toi32_i32$2;
|
||||
wasm2asm_i32$0 = i64toi32_i32$0;
|
||||
wasm2asm_i32$1 = $4;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = i64toi32_i32$0;
|
||||
wasm2asm_i32$1 = i64toi32_i32$2;
|
||||
(wasm2asm_i32$2 = wasm2asm_i32$0, wasm2asm_i32$3 = wasm2asm_i32$1), ((HEAP8[(wasm2asm_i32$2 + 4 | 0) >> 0] = wasm2asm_i32$3 & 255 | 0, HEAP8[(wasm2asm_i32$2 + 5 | 0) >> 0] = (wasm2asm_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 6 | 0) >> 0] = (wasm2asm_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$2 + 7 | 0) >> 0] = (wasm2asm_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
$2 = $2 - 32 | 0;
|
||||
if ($1 >>> 0 >= 32 >>> 0) {
|
||||
i64toi32_i32$1 = $0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$1 = $0 + 8 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$1 = $0 + 16 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$1 = $0 + 24 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
$1 = $1 - 32 | 0;
|
||||
$0 = $0 + 32 | 0;
|
||||
continue continue_0;
|
||||
}
|
||||
@ -243,171 +200,157 @@ function asmFunc(global, env, buffer) {
|
||||
} while (1);
|
||||
}
|
||||
|
||||
function $lib_array_Array_Body__constructor($0, $1) {
|
||||
$0 = $0 | 0;
|
||||
$1 = $1 | 0;
|
||||
var $2 = 0, $3 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0;
|
||||
if ($1 >>> 0 > 268435454 >>> 0) {
|
||||
$lib_env_abort(0 | 0, 8 | 0, 23 | 0, 39 | 0);
|
||||
abort();
|
||||
}
|
||||
$2 = $1 << 2 | 0;
|
||||
$3 = $lib_allocator_arena___memory_allocate(1 << (32 - Math_clz32($2 + 7 | 0) | 0) | 0 | 0) | 0;
|
||||
wasm2asm_i32$0 = $3;
|
||||
wasm2asm_i32$1 = $2;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
if (($0 | 0) == (0 | 0)) {
|
||||
$0 = $lib_allocator_arena___memory_allocate(8 | 0) | 0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = 0;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = 0;
|
||||
HEAP32[(wasm2asm_i32$0 + 4 | 0) >> 2] = wasm2asm_i32$1;
|
||||
}
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = $3;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[(wasm2asm_i32$0 + 4 | 0) >> 2] = wasm2asm_i32$1;
|
||||
$lib_memory_memset($3 + 8 | 0 | 0, 0 | 0, $2 | 0);
|
||||
function $lib_array_Array_Body__constructor() {
|
||||
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_allocator_arena___memory_allocate(32 | 0) | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = 20;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$0 = $lib_allocator_arena___memory_allocate(8 | 0) | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = $1;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 5;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
$lib_internal_memory_memset($1 + 8 | 0 | 0, 20 | 0);
|
||||
return $0 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_constructor($0, $1) {
|
||||
function assembly_index_NBodySystem_constructor($0) {
|
||||
$0 = $0 | 0;
|
||||
$1 = $1 | 0;
|
||||
var $2 = 0, $3 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $50 = 0, wasm2asm_i32$0 = 0, wasm2asm_f64$0 = 0.0, wasm2asm_i32$1 = 0;
|
||||
$8 = HEAP32[($1 + 4 | 0) >> 2] | 0;
|
||||
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, $49 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
|
||||
$7 = HEAP32[($0 + 4 | 0) >> 2] | 0;
|
||||
break_0 : {
|
||||
repeat_0 : do {
|
||||
if (($2 | 0) >= ($8 | 0)) break break_0;
|
||||
$3 = HEAPU32[(((HEAPU32[$1 >> 2] | 0) + ($2 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$4 = +HEAPF64[($3 + 48 | 0) >> 3];
|
||||
$5 = $5 + +HEAPF64[($3 + 24 | 0) >> 3] * $4;
|
||||
$6 = $6 + +HEAPF64[($3 + 32 | 0) >> 3] * $4;
|
||||
$7 = $7 + +HEAPF64[($3 + 40 | 0) >> 3] * $4;
|
||||
$2 = $2 + 1 | 0;
|
||||
if (($1 | 0) >= ($7 | 0)) break break_0;
|
||||
$2 = HEAPU32[(((HEAPU32[$0 >> 2] | 0) + ($1 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$3 = +HEAPF64[($2 + 48 | 0) >> 3];
|
||||
$4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3;
|
||||
$5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3;
|
||||
$6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3;
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
};
|
||||
$2 = HEAPU32[$1 >> 2] | 0;
|
||||
if (0 >>> 0 < ((HEAP32[$2 >> 2] | 0) >>> 2 | 0) >>> 0) $50 = HEAPU32[($2 + 8 | 0) >> 2] | 0; else abort();
|
||||
$2 = $50;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_f64$0 = -$5 / 39.47841760435743;
|
||||
HEAPF64[(wasm2asm_i32$0 + 24 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_f64$0 = -$6 / 39.47841760435743;
|
||||
HEAPF64[(wasm2asm_i32$0 + 32 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_f64$0 = -$7 / 39.47841760435743;
|
||||
HEAPF64[(wasm2asm_i32$0 + 40 | 0) >> 3] = wasm2asm_f64$0;
|
||||
if (($0 | 0) == (0 | 0)) {
|
||||
$2 = $lib_allocator_arena___memory_allocate(4 | 0) | 0;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_i32$1 = $1;
|
||||
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
|
||||
$0 = $2;
|
||||
}
|
||||
return $0 | 0;
|
||||
$1 = HEAPU32[$0 >> 2] | 0;
|
||||
if (0 >>> 0 < ((HEAP32[$1 >> 2] | 0) >>> 2 | 0) >>> 0) $49 = HEAPU32[($1 + 8 | 0) >> 2] | 0; else abort();
|
||||
$1 = $49;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$4 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$5 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$6 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$1 = $lib_allocator_arena___memory_allocate(4 | 0) | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
return $1 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_init() {
|
||||
var $0 = 0, $1 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0;
|
||||
$1 = $lib_array_Array_Body__constructor(0 | 0, 5 | 0) | 0;
|
||||
$0 = assembly_index_Body_constructor(0 | 0, +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0;
|
||||
wasm2asm_i32$0 = HEAPU32[$1 >> 2] | 0;
|
||||
wasm2asm_i32$1 = $0;
|
||||
HEAP32[(wasm2asm_i32$0 + 8 | 0) >> 2] = wasm2asm_i32$1;
|
||||
$0 = assembly_index_Body_constructor(0 | 0, +(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0;
|
||||
wasm2asm_i32$0 = (HEAPU32[$1 >> 2] | 0) + 4 | 0;
|
||||
wasm2asm_i32$1 = $0;
|
||||
HEAP32[(wasm2asm_i32$0 + 8 | 0) >> 2] = wasm2asm_i32$1;
|
||||
$0 = assembly_index_Body_constructor(0 | 0, +(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0;
|
||||
wasm2asm_i32$0 = (HEAPU32[$1 >> 2] | 0) + 8 | 0;
|
||||
wasm2asm_i32$1 = $0;
|
||||
HEAP32[(wasm2asm_i32$0 + 8 | 0) >> 2] = wasm2asm_i32$1;
|
||||
$0 = assembly_index_Body_constructor(0 | 0, +(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0;
|
||||
wasm2asm_i32$0 = (HEAPU32[$1 >> 2] | 0) + 12 | 0;
|
||||
wasm2asm_i32$1 = $0;
|
||||
HEAP32[(wasm2asm_i32$0 + 8 | 0) >> 2] = wasm2asm_i32$1;
|
||||
$0 = assembly_index_Body_constructor(0 | 0, +(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0;
|
||||
wasm2asm_i32$0 = (HEAPU32[$1 >> 2] | 0) + 16 | 0;
|
||||
wasm2asm_i32$1 = $0;
|
||||
HEAP32[(wasm2asm_i32$0 + 8 | 0) >> 2] = wasm2asm_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor(0 | 0, $1 | 0) | 0;
|
||||
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_array_Array_Body__constructor() | 0;
|
||||
$0 = assembly_index_Body_constructor(+(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0;
|
||||
wasm2js_i32$0 = HEAPU32[$1 >> 2] | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 4 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 8 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 12 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 16 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($1 | 0) | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_advance($0, $1) {
|
||||
function assembly_index_NBodySystem_advance($0) {
|
||||
$0 = $0 | 0;
|
||||
$1 = +$1;
|
||||
var $2 = 0, $3 = 0.0, $9 = 0.0, $4 = 0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $10 = 0.0, $11 = 0.0, $12 = 0.0, $13 = 0, $14 = 0, $19 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $18 = 0.0, wasm2asm_i32$0 = 0, wasm2asm_f64$0 = 0.0;
|
||||
$13 = HEAPU32[$0 >> 2] | 0;
|
||||
$14 = HEAP32[($13 + 4 | 0) >> 2] | 0;
|
||||
var $1 = 0, $2 = 0.0, $8 = 0.0, $3 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $18 = 0.0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
|
||||
$12 = HEAPU32[$0 >> 2] | 0;
|
||||
$13 = HEAP32[($12 + 4 | 0) >> 2] | 0;
|
||||
break_0 : {
|
||||
repeat_0 : do {
|
||||
if ($4 >>> 0 >= $14 >>> 0) break break_0;
|
||||
$0 = HEAPU32[(((HEAPU32[$13 >> 2] | 0) + ($4 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$15 = +HEAPF64[$0 >> 3];
|
||||
$16 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$17 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$5 = +HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$6 = +HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$7 = +HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$18 = +HEAPF64[($0 + 48 | 0) >> 3];
|
||||
if ($3 >>> 0 >= $13 >>> 0) break break_0;
|
||||
$0 = HEAPU32[(((HEAPU32[$12 >> 2] | 0) + ($3 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$14 = +HEAPF64[$0 >> 3];
|
||||
$15 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$16 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$4 = +HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$5 = +HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$6 = +HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$17 = +HEAPF64[($0 + 48 | 0) >> 3];
|
||||
break_1 : {
|
||||
$8 = $4 + 1 | 0;
|
||||
$7 = $3 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($8 >>> 0 >= $14 >>> 0) break break_1;
|
||||
$2 = HEAPU32[(((HEAPU32[$13 >> 2] | 0) + ($8 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$19 = $15 - +HEAPF64[$2 >> 3];
|
||||
$3 = $19;
|
||||
$10 = $16 - +HEAPF64[($2 + 8 | 0) >> 3];
|
||||
$11 = $17 - +HEAPF64[($2 + 16 | 0) >> 3];
|
||||
$9 = $3 * $3 + $10 * $10 + $11 * $11;
|
||||
$12 = Math_sqrt($9);
|
||||
$12 = $1 / ($9 * $12);
|
||||
$9 = +HEAPF64[($2 + 48 | 0) >> 3] * $12;
|
||||
$5 = $5 - $3 * $9;
|
||||
$6 = $6 - $10 * $9;
|
||||
$7 = $7 - $11 * $9;
|
||||
$3 = $18 * $12;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_f64$0 = +HEAPF64[($2 + 24 | 0) >> 3] + $19 * $3;
|
||||
HEAPF64[(wasm2asm_i32$0 + 24 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_f64$0 = +HEAPF64[($2 + 32 | 0) >> 3] + $10 * $3;
|
||||
HEAPF64[(wasm2asm_i32$0 + 32 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $2;
|
||||
wasm2asm_f64$0 = +HEAPF64[($2 + 40 | 0) >> 3] + $11 * $3;
|
||||
HEAPF64[(wasm2asm_i32$0 + 40 | 0) >> 3] = wasm2asm_f64$0;
|
||||
$8 = $8 + 1 | 0;
|
||||
if ($7 >>> 0 >= $13 >>> 0) break break_1;
|
||||
$1 = HEAPU32[(((HEAPU32[$12 >> 2] | 0) + ($7 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$18 = $14 - +HEAPF64[$1 >> 3];
|
||||
$2 = $18;
|
||||
$9 = $15 - +HEAPF64[($1 + 8 | 0) >> 3];
|
||||
$10 = $16 - +HEAPF64[($1 + 16 | 0) >> 3];
|
||||
$8 = $2 * $2 + $9 * $9 + $10 * $10;
|
||||
$11 = Math_sqrt($8);
|
||||
$11 = .01 / ($8 * $11);
|
||||
$8 = +HEAPF64[($1 + 48 | 0) >> 3] * $11;
|
||||
$4 = $4 - $2 * $8;
|
||||
$5 = $5 - $9 * $8;
|
||||
$6 = $6 - $10 * $8;
|
||||
$2 = $17 * $11;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 24 | 0) >> 3] + $18 * $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$7 = $7 + 1 | 0;
|
||||
continue repeat_1;
|
||||
break repeat_1;
|
||||
} while (1);
|
||||
};
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $5;
|
||||
HEAPF64[(wasm2asm_i32$0 + 24 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $6;
|
||||
HEAPF64[(wasm2asm_i32$0 + 32 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = $7;
|
||||
HEAPF64[(wasm2asm_i32$0 + 40 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = +HEAPF64[$0 >> 3] + $1 * $5;
|
||||
HEAPF64[wasm2asm_i32$0 >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = +HEAPF64[($0 + 8 | 0) >> 3] + $1 * $6;
|
||||
HEAPF64[(wasm2asm_i32$0 + 8 | 0) >> 3] = wasm2asm_f64$0;
|
||||
wasm2asm_i32$0 = $0;
|
||||
wasm2asm_f64$0 = +HEAPF64[($0 + 16 | 0) >> 3] + $1 * $7;
|
||||
HEAPF64[(wasm2asm_i32$0 + 16 | 0) >> 3] = wasm2asm_f64$0;
|
||||
$4 = $4 + 1 | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = $4;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = +HEAPF64[$0 >> 3] + .01 * $4;
|
||||
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = +HEAPF64[($0 + 8 | 0) >> 3] + .01 * $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = +HEAPF64[($0 + 16 | 0) >> 3] + .01 * $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
|
||||
$3 = $3 + 1 | 0;
|
||||
continue repeat_0;
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
@ -459,7 +402,7 @@ function asmFunc(global, env, buffer) {
|
||||
}
|
||||
|
||||
function assembly_index_step() {
|
||||
assembly_index_NBodySystem_advance(assembly_index_system | 0, +(.01));
|
||||
assembly_index_NBodySystem_advance(assembly_index_system | 0);
|
||||
return +(+assembly_index_NBodySystem_energy(assembly_index_system | 0));
|
||||
}
|
||||
|
||||
@ -469,7 +412,7 @@ function asmFunc(global, env, buffer) {
|
||||
break_0 : {
|
||||
repeat_0 : do {
|
||||
if ($1 >>> 0 >= $0 >>> 0) break break_0;
|
||||
assembly_index_NBodySystem_advance(assembly_index_system | 0, +(.01));
|
||||
assembly_index_NBodySystem_advance(assembly_index_system | 0);
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
break repeat_0;
|
||||
@ -495,6 +438,11 @@ function asmFunc(global, env, buffer) {
|
||||
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
|
||||
}
|
||||
|
||||
function null_() {
|
||||
|
||||
}
|
||||
|
||||
var FUNCTION_TABLE_v = [null_];
|
||||
function __wasm_grow_memory(pagesToAdd) {
|
||||
pagesToAdd = pagesToAdd | 0;
|
||||
var oldPages = __wasm_current_memory() | 0;
|
||||
@ -538,3 +486,27 @@ function asmFunc(global, env, buffer) {
|
||||
getBody: assembly_index_getBody
|
||||
};
|
||||
}
|
||||
|
||||
const memasmFunc = new ArrayBuffer(65536);
|
||||
const assignasmFunc = (
|
||||
function(mem) {
|
||||
const _mem = new Uint8Array(mem);
|
||||
return function(offset, s) {
|
||||
if (typeof Buffer === 'undefined') {
|
||||
const bytes = atob(s);
|
||||
for (let i = 0; i < bytes.length; i++)
|
||||
_mem[offset + i] = bytes.charCodeAt(i);
|
||||
} else {
|
||||
const bytes = Buffer.from(s, 'base64');
|
||||
for (let i = 0; i < bytes.length; i++)
|
||||
_mem[offset + i] = bytes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
)(memasmFunc);
|
||||
assignasmFunc(8, "DQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHM=");
|
||||
const retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc);
|
||||
export const memory = retasmFunc.memory;
|
||||
export const init = retasmFunc.init;
|
||||
export const step = retasmFunc.step;
|
||||
export const bench = retasmFunc.bench;
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,9 +5,10 @@ const nbodyAS = require("../assembly/index.js");
|
||||
const nbodyRS = require("../rust/index.js");
|
||||
|
||||
// Load ASMJS version
|
||||
var src = fs.readFileSync(__dirname + "/../build/index.asm.js", "utf8");
|
||||
var src = fs.readFileSync(__dirname + "/../build/index.asm.js", "utf8")
|
||||
.replace(/const retasmFunc[^$]*$/g, "");
|
||||
|
||||
const nbodyAsmJS = eval("0," + src)({
|
||||
const nbodyAsmJS = eval(src + ";asmFunc")({
|
||||
Int8Array,
|
||||
Int16Array,
|
||||
Int32Array,
|
||||
|
@ -6,6 +6,9 @@
|
||||
(type $Fv (func (param f64)))
|
||||
(type $i (func (result i32)))
|
||||
(type $I (func (result i64)))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "pson" "onNull" (func $assembly/pson/onNull))
|
||||
(import "pson" "onTrue" (func $assembly/pson/onTrue))
|
||||
(import "pson" "onFalse" (func $assembly/pson/onFalse))
|
||||
@ -21,8 +24,8 @@
|
||||
(import "pson" "onString" (func $assembly/pson/onString (param i32 i32)))
|
||||
(import "pson" "onBinary" (func $assembly/pson/onBinary (param i32 i32)))
|
||||
(global $assembly/pson/offset (mut i32) (i32.const 0))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "onNull" (func $assembly/pson/onNull))
|
||||
(export "onTrue" (func $assembly/pson/onTrue))
|
||||
(export "onFalse" (func $assembly/pson/onFalse))
|
||||
@ -38,7 +41,7 @@
|
||||
(export "onString" (func $assembly/pson/onString))
|
||||
(export "onBinary" (func $assembly/pson/onBinary))
|
||||
(export "decode" (func $assembly/pson/decode))
|
||||
(func $assembly/pson/readVarint32 (; 14 ;) (type $i) (result i32)
|
||||
(func $assembly/pson/readVarint32 (; 14 ;) (; has Stack IR ;) (type $i) (result i32)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
@ -103,7 +106,7 @@
|
||||
;;@ assembly/pson.ts:140:9
|
||||
(get_local $0)
|
||||
)
|
||||
(func $assembly/pson/readVarint64 (; 15 ;) (type $I) (result i64)
|
||||
(func $assembly/pson/readVarint64 (; 15 ;) (; has Stack IR ;) (type $I) (result i64)
|
||||
(local $0 i64)
|
||||
(local $1 i32)
|
||||
(local $2 i64)
|
||||
@ -169,7 +172,7 @@
|
||||
;;@ assembly/pson.ts:151:9
|
||||
(get_local $0)
|
||||
)
|
||||
(func $assembly/pson/decodeValue (; 16 ;) (type $v)
|
||||
(func $assembly/pson/decodeValue (; 16 ;) (; has Stack IR ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i64)
|
||||
@ -535,7 +538,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/pson/decode (; 17 ;) (type $iv) (param $0 i32)
|
||||
(func $assembly/pson/decode (; 17 ;) (; has Stack IR ;) (type $iv) (param $0 i32)
|
||||
;;@ assembly/pson.ts:40:2
|
||||
(set_global $assembly/pson/offset
|
||||
;;@ assembly/pson.ts:40:11
|
||||
@ -568,4 +571,7 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(func $null (; 18 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
||||
|
@ -6,6 +6,9 @@
|
||||
(type $Fv (func (param f64)))
|
||||
(type $i (func (result i32)))
|
||||
(type $I (func (result i64)))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "pson" "onNull" (func $assembly/pson/onNull))
|
||||
(import "pson" "onTrue" (func $assembly/pson/onTrue))
|
||||
(import "pson" "onFalse" (func $assembly/pson/onFalse))
|
||||
@ -40,8 +43,8 @@
|
||||
(global $assembly/pson/Token.STRING_GET i32 (i32.const 254))
|
||||
(global $assembly/pson/Token.BINARY i32 (i32.const 255))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "onNull" (func $assembly/pson/onNull))
|
||||
(export "onTrue" (func $assembly/pson/onTrue))
|
||||
(export "onFalse" (func $assembly/pson/onFalse))
|
||||
@ -469,6 +472,7 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(block
|
||||
;;@ assembly/pson.ts:76:21
|
||||
(block
|
||||
;;@ assembly/pson.ts:77:8
|
||||
(call $assembly/pson/decodeValue)
|
||||
@ -785,4 +789,6 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(func $null (; 18 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
@ -1,20 +0,0 @@
|
||||
μgc garbage collector
|
||||
=====================
|
||||
|
||||
A port of [Bach Le's μgc garbage collector library](https://github.com/bullno1/ugc) to AssemblyScript.
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
||||
To build [assembly/ugc.ts](./assembly/ugc.ts) to an untouched and an optimized `.wasm` including their respective `.wat` representations, run:
|
||||
|
||||
```
|
||||
$> npm run asbuild
|
||||
```
|
||||
|
||||
Afterwards, to run the included [test](./tests/index.js):
|
||||
|
||||
```
|
||||
$> npm install
|
||||
$> npm test
|
||||
```
|
@ -1,25 +0,0 @@
|
||||
ugc.ts is based on https://github.com/bullno1/ugc
|
||||
|
||||
Copyright (c) 2017, Bach Le
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,2 +0,0 @@
|
||||
import "allocator/tlsf";
|
||||
export { gc_collect, gc_pause, gc_resume } from "./ugc";
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "../../../std/assembly.json",
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
]
|
||||
}
|
@ -1,297 +0,0 @@
|
||||
/////////////////////////// μgc Garbage Collector /////////////////////////////
|
||||
// based on https://github.com/bullno1/ugc - BSD (see LICENSE file) //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// States
|
||||
const IDLE: u8 = 0;
|
||||
const MARK: u8 = 1;
|
||||
const SWEEP: u8 = 2;
|
||||
|
||||
// Gray tag
|
||||
const GRAY: u32 = 2;
|
||||
|
||||
/** Header for a managed object. */
|
||||
@unmanaged
|
||||
class ObjectHeader {
|
||||
|
||||
/////////////////////////////// Constants ///////////////////////////////////
|
||||
|
||||
static readonly SIZE: usize = 2 * sizeof<usize>();
|
||||
|
||||
///////////////////////////////// Fields ////////////////////////////////////
|
||||
|
||||
// the next and prev pointer with tags in the least significant two bits that
|
||||
// would otherwise be zero (blocks are guaranteed to be aligned to 8 bytes)
|
||||
tagged_next: usize;
|
||||
tagged_prev: usize;
|
||||
|
||||
get next(): ObjectHeader {
|
||||
return changetype<ObjectHeader>(this.tagged_next & ~3);
|
||||
}
|
||||
|
||||
set next(value: ObjectHeader) {
|
||||
this.tagged_next = changetype<usize>(value) | (this.tagged_next & 3);
|
||||
}
|
||||
|
||||
get prev(): ObjectHeader {
|
||||
return changetype<ObjectHeader>(this.tagged_prev & ~3);
|
||||
}
|
||||
|
||||
set prev(value: ObjectHeader) {
|
||||
this.tagged_prev = changetype<usize>(value) | (this.tagged_prev & 3);
|
||||
}
|
||||
|
||||
get color(): u32 {
|
||||
return this.tagged_next & 3;
|
||||
}
|
||||
|
||||
set color(value: u32) {
|
||||
assert(value < 3);
|
||||
this.tagged_next = this.tagged_next | value;
|
||||
}
|
||||
|
||||
///////////////////////////////// Methods ///////////////////////////////////
|
||||
|
||||
push(element: ObjectHeader): void {
|
||||
element.next = this;
|
||||
element.prev = this.prev;
|
||||
this.prev.next = element;
|
||||
this.prev = element;
|
||||
}
|
||||
|
||||
unlink(): void {
|
||||
var next = this.next;
|
||||
var prev = this.prev;
|
||||
next.prev = prev;
|
||||
prev.next = next;
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.next = this;
|
||||
this.prev = this;
|
||||
}
|
||||
}
|
||||
|
||||
/** Garbage collector data. */
|
||||
@unmanaged
|
||||
class Control {
|
||||
|
||||
/////////////////////////////// Constants ///////////////////////////////////
|
||||
|
||||
static readonly SIZE: usize = 7 * sizeof<usize>() + 2 * sizeof<u8>();
|
||||
static readonly PAUSED_BIT: u8 = 1 << 7;
|
||||
|
||||
///////////////////////////////// Fields ////////////////////////////////////
|
||||
|
||||
// 'from' and 'to' point here
|
||||
private __set1_tagged_next: usize;
|
||||
private __set1_tagged_prev: usize;
|
||||
private __set2_tagged_next: usize;
|
||||
private __set2_tagged_prev: usize;
|
||||
|
||||
from: ObjectHeader;
|
||||
to: ObjectHeader;
|
||||
iterator: ObjectHeader;
|
||||
state: u8; // MSB indicates paused
|
||||
white: u8;
|
||||
|
||||
/** Tests whether the collector is currently paused. */
|
||||
get paused(): bool { return (this.state & Control.PAUSED_BIT) != 0; }
|
||||
/** Sets whether the collector is currently paused. */
|
||||
set paused(paused: bool) {
|
||||
this.state = paused
|
||||
? this.state |= Control.PAUSED_BIT
|
||||
: this.state &= ~Control.PAUSED_BIT;
|
||||
}
|
||||
|
||||
///////////////////////////////// Methods ///////////////////////////////////
|
||||
|
||||
/** Creates a new instance. */
|
||||
static create(mem: usize): Control {
|
||||
var control = changetype<Control>(mem);
|
||||
var set1 = changetype<ObjectHeader>(mem);
|
||||
var set2 = changetype<ObjectHeader>(mem + 2 * sizeof<usize>());
|
||||
set1.clear();
|
||||
set2.clear();
|
||||
control.state = IDLE;
|
||||
control.white = 0;
|
||||
control.from = set1;
|
||||
control.to = set2;
|
||||
control.iterator = control.to;
|
||||
return control;
|
||||
}
|
||||
|
||||
/** Registers a new object to be managed. */
|
||||
register(obj: ObjectHeader): void {
|
||||
this.from.push(obj);
|
||||
obj.color = this.white;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new reference from one object to another.
|
||||
*
|
||||
* Whenever an object stores a reference to another object, this function
|
||||
* MUST be called to ensure that the GC works correctly.
|
||||
*
|
||||
* Root objects (stack, globals) are treated differently so there is no need
|
||||
* to call this function when a store to them occurs.
|
||||
*/
|
||||
addRef(parent: ObjectHeader, child: ObjectHeader): void {
|
||||
var parent_color = parent.color;
|
||||
var child_color = child.color;
|
||||
var white = this.white;
|
||||
var black = white ^ 1;
|
||||
if (parent_color == black && child_color == white) {
|
||||
this.makeGray(parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the GC perform one unit of work.
|
||||
*
|
||||
* What happens depends on the current GC's state.
|
||||
*
|
||||
* - In IDLE state, it will scan the root by calling the scan callback then
|
||||
* switch to MARK state.
|
||||
* - In MARK state, it will mark one object and discover its children using
|
||||
* the scan callback. When there is no object left to mark, the GC will
|
||||
* scan the root once more to account for changes during the mark phase.
|
||||
* When all live objects are marked, it will switch to SWEEP state.
|
||||
* - In SWEEP state, it will release one object. When all garbage are
|
||||
* released, it wil switch to UGC_IDLE state.
|
||||
*/
|
||||
step(): void {
|
||||
var obj: ObjectHeader;
|
||||
switch (this.state) {
|
||||
|
||||
case IDLE:
|
||||
gc_scan_fn(this, null);
|
||||
this.state = MARK;
|
||||
break;
|
||||
|
||||
case MARK:
|
||||
obj = this.iterator.next;
|
||||
var white = this.white;
|
||||
|
||||
if (obj != this.to) {
|
||||
this.iterator = obj;
|
||||
obj.color = white ^ 1;
|
||||
gc_scan_fn(this, obj);
|
||||
} else {
|
||||
gc_scan_fn(this, null);
|
||||
obj = this.iterator.next; // already strips tags, see *
|
||||
if (obj == this.to) {
|
||||
var from = this.from;
|
||||
this.from = this.to;
|
||||
this.to = from;
|
||||
this.white = white ^ 1;
|
||||
this.iterator = changetype<ObjectHeader>(from.tagged_next); // *
|
||||
this.state = SWEEP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SWEEP:
|
||||
obj = this.iterator;
|
||||
if (obj != this.to) {
|
||||
this.iterator = obj.next;
|
||||
gc_free_fn(this, obj);
|
||||
} else {
|
||||
this.to.clear();
|
||||
this.state = IDLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a collection cycle.
|
||||
*
|
||||
* Start the GC if it's not already running and only return once the GC has
|
||||
* finished collecting all garbage identified at the point of calling.
|
||||
*
|
||||
* If the GC is already in the SWEEP state, it will leave newly created
|
||||
* garbage for the next cycle.
|
||||
*/
|
||||
collect(): void {
|
||||
if (this.state == IDLE) {
|
||||
this.step();
|
||||
}
|
||||
while (this.state != IDLE) {
|
||||
this.step();
|
||||
}
|
||||
}
|
||||
|
||||
/** Informs the GC of a referred object during the mark phase. */
|
||||
visit(obj: ObjectHeader): void {
|
||||
if (this.state == SWEEP) {
|
||||
return;
|
||||
}
|
||||
if (obj.color == this.white) {
|
||||
this.makeGray(obj);
|
||||
}
|
||||
}
|
||||
|
||||
makeGray(obj: ObjectHeader): void {
|
||||
if (obj != this.iterator) {
|
||||
obj.unlink();
|
||||
this.to.push(obj);
|
||||
} else {
|
||||
this.iterator = this.iterator.prev;
|
||||
}
|
||||
obj.color = GRAY;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: should happen dynamically so it DCE's if all objects are unmanaged
|
||||
var GC = Control.create(HEAP_BASE);
|
||||
// var someObject = memory.allocate(64);
|
||||
// GC.register(changetype<ObjectHeader>(someObject));
|
||||
|
||||
// Exported interface
|
||||
|
||||
/** Pauses automatic garbage collection. */
|
||||
export function gc_pause(): void {
|
||||
GC.paused = true;
|
||||
}
|
||||
|
||||
/** Resumes automatic garbage collection. */
|
||||
export function gc_resume(): void {
|
||||
GC.paused = false;
|
||||
}
|
||||
|
||||
/** Performs a collection cycle. Ignores pauses. */
|
||||
export function gc_collect(): void {
|
||||
var paused = GC.paused;
|
||||
GC.paused = false;
|
||||
GC.collect();
|
||||
GC.paused = paused;
|
||||
}
|
||||
|
||||
// TODO: these functions must be generated by the compiler and combined by
|
||||
// a potential linker. They live here for now to document their structure.
|
||||
|
||||
function gc_scan_fn(control: Control, header: ObjectHeader | null): void {
|
||||
if (!header) {
|
||||
// visit all global vars referencing managed objects
|
||||
} else {
|
||||
// visit all referenced objects using the compiler's knowledge of this
|
||||
// object's layout
|
||||
var classId = load<u32>(changetype<usize>(header), ObjectHeader.SIZE);
|
||||
// switch (classId) {
|
||||
// arrays
|
||||
// strings
|
||||
// user-defined
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
function gc_free_fn(control: Control, header: ObjectHeader): void {
|
||||
// finalize the given object using the compiler's knowledge of its layout
|
||||
var classId = load<u32>(changetype<usize>(header) + ObjectHeader.SIZE);
|
||||
// switch (classId) {
|
||||
// array, string: free their data segments
|
||||
// TODO: might make sense to provide @finalize or similar
|
||||
// }
|
||||
memory.free(changetype<usize>(header));
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
||||
{
|
||||
"name": "@assemblyscript/ugc",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --validate --sourceMap --measure",
|
||||
"asbuild:optimized": "asc -O3 assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --validate --noDebug --noAssert --sourceMap --measure",
|
||||
"test": "node tests"
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
var fs = require("fs");
|
||||
|
||||
// NOTE that this doesn't do anything useful, yet
|
||||
|
||||
var ugc = new WebAssembly.Instance(new WebAssembly.Module(fs.readFileSync(__dirname + "/../build/untouched.wasm")), {
|
||||
env: { abort: function(msg, file, line, column) {
|
||||
console.log("abort called at " + line + ":" + column);
|
||||
} }
|
||||
}).exports;
|
||||
|
||||
function mem(memory, offset, count) {
|
||||
if (!offset) offset = 0;
|
||||
if (!count) count = 1024;
|
||||
var mem = new Uint8Array(memory.buffer, offset);
|
||||
var stackTop = new Uint32Array(memory.buffer, 4, 1)[0];
|
||||
var hex = [];
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var o = (offset + i).toString(16);
|
||||
while (o.length < 3) o = "0" + o;
|
||||
if ((i & 15) === 0) {
|
||||
hex.push("\n" + o + ":");
|
||||
}
|
||||
var h = mem[i].toString(16);
|
||||
if (h.length < 2) h = "0" + h;
|
||||
hex.push(h);
|
||||
}
|
||||
console.log(hex.join(" ") + " ...");
|
||||
}
|
||||
|
||||
mem(ugc.memory, 0, 1024);
|
4
lib/loader/index.d.ts
vendored
4
lib/loader/index.d.ts
vendored
@ -61,9 +61,11 @@ interface ASUtil {
|
||||
/** Creates a typed array in the module's memory and returns its pointer. */
|
||||
newArray(ctor: TypedArrayConstructor, length: number, unsafe?: boolean): number;
|
||||
/** Gets a view on a typed array in the module's memory by its pointer. */
|
||||
getArray(ctor: TypedArrayConstructor, ptr: number): TypedArray;
|
||||
getArray<T extends TypedArray = TypedArray>(ctor: TypedArrayConstructor, ptr: number): T;
|
||||
/** Frees a typed array in the module's memory. Must not be accessed anymore afterwards. */
|
||||
freeArray(ptr: number): void;
|
||||
/** Gets a function by its pointer. */
|
||||
getFunction<R = any>(ptr: number): (...args: any[]) => R;
|
||||
}
|
||||
|
||||
/** Instantiates an AssemblyScript module using the specified imports. */
|
||||
|
@ -152,6 +152,30 @@ function postInstantiate(baseModule, instance) {
|
||||
|
||||
baseModule.freeArray = freeArray;
|
||||
|
||||
// Reference the table and remember where to insert the next function
|
||||
var table = exports.table;
|
||||
|
||||
/** Creates a new function in the module's table and returns its pointer. */
|
||||
function newFunction(fn) {
|
||||
var index = table.length;
|
||||
table.grow(1);
|
||||
table.set(index, fn);
|
||||
return index;
|
||||
}
|
||||
|
||||
baseModule.newFunction = newFunction;
|
||||
|
||||
/** Gets a function by its pointer. */
|
||||
function getFunction(ptr) {
|
||||
var fn = table.get(ptr);
|
||||
return (...args) => {
|
||||
exports._setargc(args.length);
|
||||
return fn(...args);
|
||||
};
|
||||
}
|
||||
|
||||
baseModule.getFunction = getFunction;
|
||||
|
||||
// Demangle exports and provide the usual utility on the prototype
|
||||
return demangle(instance.exports, Object.defineProperties(baseModule, {
|
||||
I8: { get: function() { checkMem(); return I8; } },
|
||||
@ -240,7 +264,9 @@ function demangle(exports, baseModule) {
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
} else curr[name] = function(...args) { return elem(this.this, ...args); };
|
||||
} else {
|
||||
curr[name] = wrapFunction(elem);
|
||||
}
|
||||
} else {
|
||||
if (/^(get|set):/.test(name)) {
|
||||
if (!hasOwnProperty(curr, name = name.substring(4))) {
|
||||
@ -250,9 +276,25 @@ function demangle(exports, baseModule) {
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
} else curr[name] = elem;
|
||||
} else if (typeof elem === "function") {
|
||||
curr[name] = wrapFunction(elem);
|
||||
} else {
|
||||
curr[name] = elem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wrapFunction(fn) {
|
||||
var ret = function(...args) {
|
||||
exports._setargc(args.length);
|
||||
return fn(...args);
|
||||
};
|
||||
// adding a function to the table with `newFunction` is limited to actual exported WebAssembly
|
||||
// functions, hence we can't use the wrapper for that and instead need to pass a workaround:
|
||||
ret.constructor = fn;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
|
@ -50,3 +50,13 @@ export function sum(arr: Int32Array): i32 {
|
||||
for (let i = 0, k = arr.length; i < k; ++i) v += arr[i];
|
||||
return v;
|
||||
}
|
||||
|
||||
export function varadd(a: i32 = 1, b: i32 = 2): i32 {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
export const varadd_ptr = varadd;
|
||||
|
||||
export function calladd(fn: (a: i32, b: i32) => i32, a: i32, b: i32): i32 {
|
||||
return fn(a, b);
|
||||
}
|
||||
|
Binary file not shown.
@ -18,8 +18,6 @@ assert(proto.I32 instanceof Int32Array);
|
||||
assert(proto.U32 instanceof Uint32Array);
|
||||
assert(proto.F32 instanceof Float32Array);
|
||||
assert(proto.F64 instanceof Float64Array);
|
||||
assert(typeof proto.newString === "function");
|
||||
assert(typeof proto.getString === "function");
|
||||
|
||||
// should export memory
|
||||
assert(module.memory instanceof WebAssembly.Memory);
|
||||
@ -46,3 +44,18 @@ assert.deepEqual(module.getArray(Int32Array, ptr), arr);
|
||||
module.freeArray(ptr);
|
||||
var ptr2 = module.newArray(new Int32Array(arr));
|
||||
assert.strictEqual(ptr, ptr2);
|
||||
|
||||
// should be able to just call a function with variable arguments
|
||||
assert.strictEqual(module.varadd(), 3);
|
||||
assert.strictEqual(module.varadd(2, 3), 5);
|
||||
assert.strictEqual(module.varadd(2), 4);
|
||||
|
||||
// should be able to get a function from the table and just call it with variable arguments
|
||||
var fn = module.getFunction(module.varadd_ptr);
|
||||
assert.strictEqual(fn(), 3);
|
||||
assert.strictEqual(fn(2, 3), 5);
|
||||
assert.strictEqual(fn(2), 4);
|
||||
|
||||
// should be able to create a new function and call it from WASM
|
||||
ptr = module.newFunction(module.varadd.constructor); // must be an actual exported wasm function
|
||||
assert.strictEqual(module.calladd(ptr, 2, 3), 5);
|
||||
|
@ -10,6 +10,9 @@
|
||||
(type $I (func (result i64)))
|
||||
(type $iv (func (param i32)))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "options" "onSection" (func $assembly/options/onSection (param i32 i32 i32 i32 i32) (result i32)))
|
||||
(import "options" "onType" (func $assembly/options/onType (param i32 i32)))
|
||||
(import "options" "onTypeParam" (func $assembly/options/onTypeParam (param i32 i32 i32)))
|
||||
@ -29,7 +32,6 @@
|
||||
(import "options" "onFunctionName" (func $assembly/options/onFunctionName (param i32 i32 i32)))
|
||||
(import "options" "onLocalName" (func $assembly/options/onLocalName (param i32 i32 i32 i32)))
|
||||
(import "options" "onSourceMappingURL" (func $assembly/options/onSourceMappingURL (param i32 i32)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(global $assembly/index/off (mut i32) (i32.const 0))
|
||||
(global $src/common/SectionId.Custom (mut i32) (i32.const 0))
|
||||
(global $src/common/SectionId.Type (mut i32) (i32.const 1))
|
||||
@ -57,6 +59,7 @@
|
||||
(global $src/common/NameType.Function (mut i32) (i32.const 1))
|
||||
(global $src/common/NameType.Local (mut i32) (i32.const 2))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "parse" (func $assembly/index/parse))
|
||||
(func $assembly/index/readVaruint (; 19 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32)
|
||||
(local $0 i32)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1005
package-lock.json
generated
1005
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -12,22 +12,22 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@protobufjs/utf8": "^1.1.0",
|
||||
"binaryen": "^51.0.0",
|
||||
"binaryen": "51.0.0-nightly.20181010",
|
||||
"glob": "^7.1.3",
|
||||
"long": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.9.4",
|
||||
"browser-process-hrtime": "^0.1.2",
|
||||
"@types/node": "^10.11.7",
|
||||
"browser-process-hrtime": "^1.0.0",
|
||||
"diff": "^3.5.0",
|
||||
"ts-loader": "^4.5.0",
|
||||
"ts-loader": "^5.2.1",
|
||||
"ts-node": "^6.2.0",
|
||||
"tslint": "^5.11.0",
|
||||
"typedoc": "^0.11.1",
|
||||
"typedoc": "^0.13.0",
|
||||
"typedoc-plugin-external-module-name": "^1.1.3",
|
||||
"typescript": "^3.0.3",
|
||||
"webpack": "^4.18.1",
|
||||
"webpack-cli": "^3.1.0"
|
||||
"typescript": "^3.1.2",
|
||||
"webpack": "^4.20.2",
|
||||
"webpack-cli": "^3.1.2"
|
||||
},
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
|
@ -1,3 +1,8 @@
|
||||
/**
|
||||
* Binary format utilities.
|
||||
* @module binary
|
||||
*//***/
|
||||
|
||||
// TBD: Moving lib/parse here might make sense where the compiler has to evaluate WASM binaries on
|
||||
// the fly, like when importing other WASM files through `import`. Module integration hasn't been
|
||||
// specified, yet, though, and it somewhat conflicts with our dependency on Binaryen.
|
||||
|
@ -2959,7 +2959,7 @@ export function compileAbort(
|
||||
|
||||
compiler.currentType = Type.void;
|
||||
return module.createBlock(null, [
|
||||
module.createCallImport(
|
||||
module.createCall(
|
||||
abortInstance.internalName, [
|
||||
messageArg,
|
||||
filenameArg,
|
||||
|
@ -330,6 +330,23 @@ export class Compiler extends DiagnosticEmitter {
|
||||
this.startFunctionBody = startFunctionBody;
|
||||
this.currentFunction = startFunctionInstance;
|
||||
|
||||
// add a mutable heap base dummy
|
||||
if (options.isWasm64) {
|
||||
module.addGlobal(
|
||||
"HEAP_BASE",
|
||||
NativeType.I64,
|
||||
true,
|
||||
module.createI64(0, 0)
|
||||
);
|
||||
} else {
|
||||
module.addGlobal(
|
||||
"HEAP_BASE",
|
||||
NativeType.I32,
|
||||
false,
|
||||
module.createI32(0)
|
||||
);
|
||||
}
|
||||
|
||||
// compile entry file(s) while traversing reachable elements
|
||||
var sources = program.sources;
|
||||
for (let i = 0, k = sources.length; i < k; ++i) {
|
||||
@ -353,10 +370,11 @@ export class Compiler extends DiagnosticEmitter {
|
||||
if (!program.mainFunction) module.setStart(funcRef);
|
||||
}
|
||||
|
||||
// set up static memory segments and the heap base pointer
|
||||
// update the heap base pointer
|
||||
var memoryOffset = this.memoryOffset;
|
||||
memoryOffset = i64_align(memoryOffset, options.usizeType.byteSize);
|
||||
this.memoryOffset = memoryOffset;
|
||||
module.removeGlobal("HEAP_BASE");
|
||||
if (options.isWasm64) {
|
||||
module.addGlobal(
|
||||
"HEAP_BASE",
|
||||
@ -392,22 +410,12 @@ export class Compiler extends DiagnosticEmitter {
|
||||
|
||||
// set up function table
|
||||
var functionTable = this.functionTable;
|
||||
var functionTableSize = functionTable.length;
|
||||
var functionTableExported = false;
|
||||
module.setFunctionTable(functionTable);
|
||||
if (functionTableSize) { // index 0 is NULL
|
||||
module.addFunction("null", this.ensureFunctionType(null, Type.void), null, module.createBlock(null, []));
|
||||
if (functionTableSize > 1) {
|
||||
module.addTableExport("0", "table");
|
||||
functionTableExported = true;
|
||||
}
|
||||
}
|
||||
module.setFunctionTable(functionTable.length, 0xffffffff, functionTable);
|
||||
module.addTableExport("0", "table");
|
||||
module.addFunction("null", this.ensureFunctionType(null, Type.void), null, module.createBlock(null, []));
|
||||
|
||||
// import table if requested (default table is named '0' by Binaryen)
|
||||
if (options.importTable) {
|
||||
module.addTableImport("0", "env", "table");
|
||||
if (!functionTableExported) module.addTableExport("0", "table");
|
||||
}
|
||||
if (options.importTable) module.addTableImport("0", "env", "table");
|
||||
|
||||
// set up module exports
|
||||
for (let [name, moduleExport] of program.moduleLevelExports) {
|
||||
@ -748,7 +756,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
if (isDeclaredConstant || this.options.hasFeature(Feature.MUTABLE_GLOBAL)) {
|
||||
global.set(CommonFlags.MODULE_IMPORT);
|
||||
if (declaration) {
|
||||
mangleImportName(global, declaration, global.parent);
|
||||
mangleImportName(global, declaration);
|
||||
} else {
|
||||
mangleImportName_moduleName = "env";
|
||||
mangleImportName_elementName = global.simpleName;
|
||||
@ -1137,7 +1145,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
|
||||
} else {
|
||||
instance.set(CommonFlags.MODULE_IMPORT);
|
||||
mangleImportName(instance, declaration, instance.prototype.parent); // TODO: check for duplicates
|
||||
mangleImportName(instance, declaration); // TODO: check for duplicates
|
||||
|
||||
// create the function import
|
||||
ref = module.addFunctionImport(
|
||||
@ -5733,9 +5741,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
|
||||
// otherwise just call through
|
||||
this.currentType = returnType;
|
||||
if (isCallImport) return module.createCallImport(instance.internalName, operands, returnType.toNativeType());
|
||||
var ret = module.createCall(instance.internalName, operands, returnType.toNativeType());
|
||||
return ret;
|
||||
return module.createCall(instance.internalName, operands, returnType.toNativeType());
|
||||
}
|
||||
|
||||
/** Compiles an indirect call using an index argument and a signature. */
|
||||
@ -7652,11 +7658,12 @@ export class Compiler extends DiagnosticEmitter {
|
||||
|
||||
function mangleImportName(
|
||||
element: Element,
|
||||
declaration: DeclarationStatement,
|
||||
parentElement: Element | null = null
|
||||
declaration: DeclarationStatement
|
||||
): void {
|
||||
mangleImportName_moduleName = parentElement ? parentElement.simpleName : declaration.range.source.simplePath;
|
||||
mangleImportName_elementName = element.simpleName;
|
||||
// by default, use the file name as the module name
|
||||
mangleImportName_moduleName = declaration.range.source.simplePath;
|
||||
// and the internal name of the element within that file as the element name
|
||||
mangleImportName_elementName = declaration.programLevelInternalName;
|
||||
|
||||
if (!element.hasDecorator(DecoratorFlags.EXTERNAL)) return;
|
||||
|
||||
@ -7665,6 +7672,8 @@ function mangleImportName(
|
||||
var args = decorator.arguments;
|
||||
if (args && args.length) {
|
||||
let arg = args[0];
|
||||
// if one argument is given, override just the element name
|
||||
// if two arguments are given, override both module and element name
|
||||
if (arg.kind == NodeKind.LITERAL && (<LiteralExpression>arg).literalKind == LiteralKind.STRING) {
|
||||
mangleImportName_elementName = (<StringLiteralExpression>arg).value;
|
||||
if (args.length >= 2) {
|
||||
|
@ -170,7 +170,6 @@ export class Decompiler {
|
||||
}
|
||||
case ExpressionId.Switch:
|
||||
case ExpressionId.Call:
|
||||
case ExpressionId.CallImport:
|
||||
case ExpressionId.CallIndirect: {
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
10
src/glue/binaryen.d.ts
vendored
10
src/glue/binaryen.d.ts
vendored
@ -30,7 +30,6 @@ declare function _BinaryenLoopId(): BinaryenExpressionId;
|
||||
declare function _BinaryenBreakId(): BinaryenExpressionId;
|
||||
declare function _BinaryenSwitchId(): BinaryenExpressionId;
|
||||
declare function _BinaryenCallId(): BinaryenExpressionId;
|
||||
declare function _BinaryenCallImportId(): BinaryenExpressionId;
|
||||
declare function _BinaryenCallIndirectId(): BinaryenExpressionId;
|
||||
declare function _BinaryenGetLocalId(): BinaryenExpressionId;
|
||||
declare function _BinaryenSetLocalId(): BinaryenExpressionId;
|
||||
@ -219,7 +218,6 @@ declare function _BinaryenLoop(module: BinaryenModuleRef, name: usize, body: Bin
|
||||
declare function _BinaryenBreak(module: BinaryenModuleRef, name: usize, condition: BinaryenExpressionRef, value: BinaryenExpressionRef): BinaryenExpressionRef;
|
||||
declare function _BinaryenSwitch(module: BinaryenModuleRef, names: usize, numNames: BinaryenIndex, defaultName: usize, condition: BinaryenExpressionRef, value: BinaryenExpressionRef): BinaryenExpressionRef;
|
||||
declare function _BinaryenCall(module: BinaryenModuleRef, target: usize, operands: usize, numOperands: BinaryenIndex, returnType: BinaryenType): BinaryenExpressionRef;
|
||||
declare function _BinaryenCallImport(module: BinaryenModuleRef, target: usize, operands: usize, numOperands: BinaryenIndex, returnType: BinaryenType): BinaryenExpressionRef;
|
||||
declare function _BinaryenCallIndirect(module: BinaryenModuleRef, target: BinaryenExpressionRef, operands: usize, numOperands: BinaryenIndex, type: usize): BinaryenExpressionRef;
|
||||
declare function _BinaryenGetLocal(module: BinaryenModuleRef, index: BinaryenIndex, type: BinaryenType): BinaryenExpressionRef;
|
||||
declare function _BinaryenSetLocal(module: BinaryenModuleRef, index: BinaryenIndex, value: BinaryenExpressionRef): BinaryenExpressionRef;
|
||||
@ -273,10 +271,6 @@ declare function _BinaryenCallGetTarget(expr: BinaryenExpressionRef): usize;
|
||||
declare function _BinaryenCallGetNumOperands(expr: BinaryenExpressionRef): BinaryenIndex;
|
||||
declare function _BinaryenCallGetOperand(expr: BinaryenExpressionRef, index: BinaryenIndex): BinaryenExpressionRef;
|
||||
|
||||
declare function _BinaryenCallImportGetTarget(expr: BinaryenExpressionRef): usize;
|
||||
declare function _BinaryenCallImportGetNumOperands(expr: BinaryenExpressionRef): BinaryenIndex;
|
||||
declare function _BinaryenCallImportGetOperand(expr: BinaryenExpressionRef, index: BinaryenIndex): BinaryenExpressionRef;
|
||||
|
||||
declare function _BinaryenCallIndirectGetTarget(expr: BinaryenExpressionRef): BinaryenExpressionRef;
|
||||
declare function _BinaryenCallIndirectGetNumOperands(expr: BinaryenExpressionRef): BinaryenIndex;
|
||||
declare function _BinaryenCallIndirectGetOperand(expr: BinaryenExpressionRef, index: BinaryenIndex): BinaryenExpressionRef;
|
||||
@ -387,7 +381,6 @@ declare function _BinaryenAddFunctionImport(module: BinaryenModuleRef, internalN
|
||||
declare function _BinaryenAddTableImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize): BinaryenImportRef;
|
||||
declare function _BinaryenAddMemoryImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize): BinaryenImportRef;
|
||||
declare function _BinaryenAddGlobalImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, globalType: BinaryenType): BinaryenImportRef;
|
||||
declare function _BinaryenRemoveImport(module: BinaryenModuleRef, internalName: usize): void;
|
||||
|
||||
declare type BinaryenExportRef = usize;
|
||||
|
||||
@ -400,8 +393,9 @@ declare function _BinaryenRemoveExport(module: BinaryenModuleRef, externalName:
|
||||
declare type BinaryenGlobalRef = usize;
|
||||
|
||||
declare function _BinaryenAddGlobal(module: BinaryenModuleRef, name: usize, type: BinaryenType, mutable: i8, init: BinaryenExpressionRef): BinaryenGlobalRef;
|
||||
declare function _BinaryenRemoveGlobal(module: BinaryenModuleRef, name: usize): void;
|
||||
|
||||
declare function _BinaryenSetFunctionTable(module: BinaryenModuleRef, funcs: usize, numFuncs: BinaryenIndex): void;
|
||||
declare function _BinaryenSetFunctionTable(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, funcs: usize, numFuncs: BinaryenIndex): void;
|
||||
|
||||
declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex): void;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
/** @module glue/wasm *//***/
|
||||
|
||||
@global
|
||||
function f32_as_i32(value: f32): i32 {
|
||||
return reinterpret<i32>(value);
|
||||
|
@ -34,7 +34,6 @@ export enum ExpressionId {
|
||||
Break = _BinaryenBreakId(),
|
||||
Switch = _BinaryenSwitchId(),
|
||||
Call = _BinaryenCallId(),
|
||||
CallImport = _BinaryenCallImportId(),
|
||||
CallIndirect = _BinaryenCallIndirectId(),
|
||||
GetLocal = _BinaryenGetLocalId(),
|
||||
SetLocal = _BinaryenSetLocalId(),
|
||||
@ -596,21 +595,6 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createCallImport(
|
||||
target: string,
|
||||
operands: ExpressionRef[] | null,
|
||||
returnType: NativeType
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(target);
|
||||
var cArr = allocPtrArray(operands);
|
||||
try {
|
||||
return _BinaryenCallImport(this.ref, cStr, cArr, operands && operands.length || 0, returnType);
|
||||
} finally {
|
||||
memory.free(cArr);
|
||||
memory.free(cStr);
|
||||
}
|
||||
}
|
||||
|
||||
createCallIndirect(
|
||||
index: ExpressionRef,
|
||||
operands: ExpressionRef[] | null,
|
||||
@ -646,6 +630,17 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
removeGlobal(
|
||||
name: string
|
||||
): void {
|
||||
var cStr = allocString(name);
|
||||
try {
|
||||
_BinaryenRemoveGlobal(this.ref, cStr);
|
||||
} finally {
|
||||
memory.free(cStr);
|
||||
}
|
||||
}
|
||||
|
||||
addFunction(
|
||||
name: string,
|
||||
type: FunctionTypeRef,
|
||||
@ -829,15 +824,6 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
removeImport(internalName: string): void {
|
||||
var cStr = allocString(internalName);
|
||||
try {
|
||||
_BinaryenRemoveImport(this.ref, cStr);
|
||||
} finally {
|
||||
memory.free(cStr);
|
||||
}
|
||||
}
|
||||
|
||||
setMemory(
|
||||
initial: Index,
|
||||
maximum: Index,
|
||||
@ -873,7 +859,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
setFunctionTable(funcs: string[]): void {
|
||||
setFunctionTable(
|
||||
initial: Index,
|
||||
maximum: Index,
|
||||
funcs: string[]
|
||||
): void {
|
||||
var numNames = funcs.length;
|
||||
var names = new Array<usize>(numNames);
|
||||
for (let i = 0; i < numNames; ++i) {
|
||||
@ -881,7 +871,7 @@ export class Module {
|
||||
}
|
||||
var cArr = allocI32Array(names);
|
||||
try {
|
||||
_BinaryenSetFunctionTable(this.ref, cArr, numNames);
|
||||
_BinaryenSetFunctionTable(this.ref, initial, maximum, cArr, numNames);
|
||||
} finally {
|
||||
memory.free(cArr);
|
||||
for (let i = numNames; i >= 0; --i) memory.free(names[i]);
|
||||
|
@ -3268,22 +3268,9 @@ export class Parser extends DiagnosticEmitter {
|
||||
|
||||
var expr = this.parseExpressionStart(tn);
|
||||
if (!expr) return null;
|
||||
expr = this.maybeParseCallExpression(tn, expr); // simple call like on an Identifier
|
||||
|
||||
var startPos = expr.range.start;
|
||||
|
||||
// CallExpression?
|
||||
if (nodeIsCallable(expr.kind)) {
|
||||
let typeArguments: CommonTypeNode[] | null = null;
|
||||
while (
|
||||
tn.skip(Token.OPENPAREN)
|
||||
||
|
||||
nodeIsGenericCallable(expr.kind) && (typeArguments = this.tryParseTypeArgumentsBeforeArguments(tn)) !== null
|
||||
) {
|
||||
let args = this.parseArguments(tn);
|
||||
if (!args) return null;
|
||||
expr = Node.createCallExpression(expr, typeArguments, args, tn.range(startPos, tn.pos)); // is again callable
|
||||
}
|
||||
}
|
||||
|
||||
var token: Token;
|
||||
var next: Expression | null = null;
|
||||
var nextPrecedence: Precedence;
|
||||
@ -3398,28 +3385,15 @@ export class Parser extends DiagnosticEmitter {
|
||||
|
||||
// PropertyAccessExpression
|
||||
if (token == Token.DOT) {
|
||||
if (next.kind == NodeKind.IDENTIFIER) {
|
||||
if (next.kind == NodeKind.IDENTIFIER) { // expr '.' Identifier
|
||||
expr = Node.createPropertyAccessExpression(
|
||||
expr,
|
||||
<IdentifierExpression>next,
|
||||
tn.range(startPos, tn.pos)
|
||||
);
|
||||
} else if (next.kind == NodeKind.CALL) { // join
|
||||
let propertyCall = <CallExpression>next;
|
||||
if (propertyCall.expression.kind == NodeKind.IDENTIFIER) {
|
||||
propertyCall.expression = Node.createPropertyAccessExpression(
|
||||
expr,
|
||||
<IdentifierExpression>propertyCall.expression,
|
||||
tn.range(startPos, tn.pos)
|
||||
);
|
||||
} else {
|
||||
this.error(
|
||||
DiagnosticCode.Identifier_expected,
|
||||
propertyCall.expression.range
|
||||
);
|
||||
return null;
|
||||
}
|
||||
expr = propertyCall;
|
||||
} else if (next.kind == NodeKind.CALL) { // expr '.' CallExpression
|
||||
expr = this.joinPropertyCall(tn, startPos, expr, <CallExpression>next);
|
||||
if (!expr) return null;
|
||||
} else {
|
||||
this.error(
|
||||
DiagnosticCode.Identifier_expected,
|
||||
@ -3435,6 +3409,65 @@ export class Parser extends DiagnosticEmitter {
|
||||
break;
|
||||
}
|
||||
}
|
||||
expr = this.maybeParseCallExpression(tn, expr); // compound call like on an ElementAccess
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
private joinPropertyCall(
|
||||
tn: Tokenizer,
|
||||
startPos: i32,
|
||||
expr: Expression,
|
||||
call: CallExpression
|
||||
): Expression | null {
|
||||
var callee = call.expression;
|
||||
switch (callee.kind) {
|
||||
case NodeKind.IDENTIFIER: { // join property access and use as call target
|
||||
call.expression = Node.createPropertyAccessExpression(
|
||||
expr,
|
||||
<IdentifierExpression>callee,
|
||||
tn.range(startPos, tn.pos)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case NodeKind.CALL: { // join call target und wrap the original call around it
|
||||
let inner = this.joinPropertyCall(tn, startPos, expr, <CallExpression>callee);
|
||||
if (!inner) return null;
|
||||
call.expression = inner;
|
||||
call.range = tn.range(startPos, tn.pos);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.error(
|
||||
DiagnosticCode.Identifier_expected,
|
||||
call.range
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return call;
|
||||
}
|
||||
|
||||
private maybeParseCallExpression(
|
||||
tn: Tokenizer,
|
||||
expr: Expression
|
||||
): Expression {
|
||||
if (nodeIsCallable(expr.kind)) {
|
||||
let typeArguments: CommonTypeNode[] | null = null;
|
||||
while (
|
||||
tn.skip(Token.OPENPAREN)
|
||||
||
|
||||
nodeIsGenericCallable(expr.kind) && (typeArguments = this.tryParseTypeArgumentsBeforeArguments(tn)) !== null
|
||||
) {
|
||||
let args = this.parseArguments(tn);
|
||||
if (!args) break;
|
||||
expr = Node.createCallExpression( // is again callable
|
||||
expr,
|
||||
typeArguments,
|
||||
args,
|
||||
tn.range(expr.range.start, tn.pos)
|
||||
);
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
@ -213,7 +213,11 @@ export class Type {
|
||||
} else if (!target.is(TypeFlags.REFERENCE)) {
|
||||
if (this.is(TypeFlags.INTEGER)) {
|
||||
if (target.is(TypeFlags.INTEGER)) {
|
||||
if (!signednessIsRelevant || this.is(TypeFlags.SIGNED) == target.is(TypeFlags.SIGNED)) {
|
||||
if (
|
||||
!signednessIsRelevant ||
|
||||
this == Type.bool || // a bool (0 or 1) can be safely assigned to all sorts of integers
|
||||
this.is(TypeFlags.SIGNED) == target.is(TypeFlags.SIGNED)
|
||||
) {
|
||||
return this.size <= target.size;
|
||||
}
|
||||
} else if (target.kind == TypeKind.F32) {
|
||||
|
44
std/assembly/bindings/Math.ts
Normal file
44
std/assembly/bindings/Math.ts
Normal file
@ -0,0 +1,44 @@
|
||||
export declare const E: f64;
|
||||
export declare const LN2: f64;
|
||||
export declare const LN10: f64;
|
||||
export declare const LOG2E: f64;
|
||||
export declare const LOG10E: f64;
|
||||
export declare const PI: f64;
|
||||
export declare const SQRT1_2: f64;
|
||||
export declare const SQRT2: f64;
|
||||
|
||||
export declare function abs(x: f64): f64;
|
||||
export declare function acos(x: f64): f64;
|
||||
export declare function acosh(x: f64): f64;
|
||||
export declare function asin(x: f64): f64;
|
||||
export declare function asinh(x: f64): f64;
|
||||
export declare function atan(x: f64): f64;
|
||||
export declare function atan2(y: f64, x: f64): f64;
|
||||
export declare function atanh(x: f64): f64;
|
||||
export declare function cbrt(x: f64): f64;
|
||||
export declare function ceil(x: f64): f64;
|
||||
export declare function clz32(x: f64): f64;
|
||||
export declare function cos(x: f64): f64;
|
||||
export declare function cosh(x: f64): f64;
|
||||
export declare function exp(x: f64): f64;
|
||||
export declare function expm1(x: f64): f64;
|
||||
export declare function floor(x: f64): f64;
|
||||
export declare function fround(x: f64): f32;
|
||||
export declare function hypot(value1: f64, value2: f64): f64; // TODO: rest
|
||||
export declare function imul(a: f64, b: f64): f64;
|
||||
export declare function log(x: f64): f64;
|
||||
export declare function log10(x: f64): f64;
|
||||
export declare function log1p(x: f64): f64;
|
||||
export declare function log2(x: f64): f64;
|
||||
export declare function max(value1: f64, value2: f64): f64; // TODO: rest
|
||||
export declare function min(value1: f64, value2: f64): f64; // TODO: rest
|
||||
export declare function pow(base: f64, exponent: f64): f64;
|
||||
export declare function random(): f64;
|
||||
export declare function round(x: f64): f64;
|
||||
export declare function sign(x: f64): f64;
|
||||
export declare function sin(x: f64): f64;
|
||||
export declare function sinh(x: f64): f64;
|
||||
export declare function sqrt(x: f64): f64;
|
||||
export declare function tan(x: f64): f64;
|
||||
export declare function tanh(x: f64): f64;
|
||||
export declare function trunc(x: f64): f64;
|
@ -1,50 +1,5 @@
|
||||
export declare namespace JSMath {
|
||||
|
||||
export const E: f64;
|
||||
export const LN2: f64;
|
||||
export const LN10: f64;
|
||||
export const LOG2E: f64;
|
||||
export const LOG10E: f64;
|
||||
export const PI: f64;
|
||||
export const SQRT1_2: f64;
|
||||
export const SQRT2: f64;
|
||||
|
||||
export function abs(x: f64): f64;
|
||||
export function acos(x: f64): f64;
|
||||
export function acosh(x: f64): f64;
|
||||
export function asin(x: f64): f64;
|
||||
export function asinh(x: f64): f64;
|
||||
export function atan(x: f64): f64;
|
||||
export function atan2(y: f64, x: f64): f64;
|
||||
export function atanh(x: f64): f64;
|
||||
export function cbrt(x: f64): f64;
|
||||
export function ceil(x: f64): f64;
|
||||
export function clz32(x: f64): f64;
|
||||
export function cos(x: f64): f64;
|
||||
export function cosh(x: f64): f64;
|
||||
export function exp(x: f64): f64;
|
||||
export function expm1(x: f64): f64;
|
||||
export function floor(x: f64): f64;
|
||||
export function fround(x: f64): f32;
|
||||
export function hypot(value1: f64, value2: f64): f64; // TODO: rest
|
||||
export function imul(a: f64, b: f64): f64;
|
||||
export function log(x: f64): f64;
|
||||
export function log10(x: f64): f64;
|
||||
export function log1p(x: f64): f64;
|
||||
export function log2(x: f64): f64;
|
||||
export function max(value1: f64, value2: f64): f64; // TODO: rest
|
||||
export function min(value1: f64, value2: f64): f64; // TODO: rest
|
||||
export function pow(base: f64, exponent: f64): f64;
|
||||
export function random(): f64;
|
||||
export function round(x: f64): f64;
|
||||
export function sign(x: f64): f64;
|
||||
export function sin(x: f64): f64;
|
||||
export function sinh(x: f64): f64;
|
||||
export function sqrt(x: f64): f64;
|
||||
export function tan(x: f64): f64;
|
||||
export function tanh(x: f64): f64;
|
||||
export function trunc(x: f64): f64;
|
||||
}
|
||||
import * as JSMath from "./bindings/Math";
|
||||
export { JSMath };
|
||||
|
||||
import {
|
||||
abs as builtin_abs,
|
||||
|
@ -81,7 +81,7 @@ tests.forEach(filename => {
|
||||
// TODO: also save stdout/stderr and diff it (-> expected failures)
|
||||
|
||||
// Build unoptimized
|
||||
asc.main( [
|
||||
asc.main([
|
||||
filename,
|
||||
"--baseDir", basedir,
|
||||
"--validate",
|
||||
@ -188,28 +188,26 @@ tests.forEach(filename => {
|
||||
externalFunction: function() { },
|
||||
externalConstant: 1
|
||||
},
|
||||
JSOp: {
|
||||
math: {
|
||||
mod: function(a, b) { return a % b; }
|
||||
},
|
||||
JSMath: Math,
|
||||
Math: Math,
|
||||
|
||||
// tests/declare
|
||||
declare: {
|
||||
externalFunction: function() { },
|
||||
externalConstant: 1
|
||||
},
|
||||
my: {
|
||||
externalFunction: function() { },
|
||||
externalConstant: 2
|
||||
externalConstant: 1,
|
||||
"my.externalFunction": function() { },
|
||||
"my.externalConstant": 2
|
||||
},
|
||||
|
||||
// tests/external
|
||||
external: {
|
||||
foo: function() {},
|
||||
"foo.bar": function() {},
|
||||
bar: function() {}
|
||||
},
|
||||
foo: {
|
||||
bar: function() {},
|
||||
baz: function() {},
|
||||
"var": 3
|
||||
}
|
||||
|
@ -2,12 +2,15 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00a\00b\00i\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $abi/condition (mut i32) (i32.const 0))
|
||||
(global $abi/y (mut i32) (i32.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00a\00b\00i\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "exported" (func $abi/exported))
|
||||
(export "exportedExported" (func $abi/exportedExported))
|
||||
(export "exportedInternal" (func $abi/exportedInternal))
|
||||
|
@ -2,15 +2,16 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00a\00b\00i\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $abi/condition (mut i32) (i32.const 0))
|
||||
(global $abi/y (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 24))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00a\00b\00i\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "exported" (func $abi/exported))
|
||||
(export "exportedExported" (func $abi/exportedExported))
|
||||
(export "exportedInternal" (func $abi/exportedInternal))
|
||||
|
@ -1,7 +1,10 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $start)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(func $start (; 0 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
|
@ -1,5 +1,8 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $ASC_TARGET i32 (i32.const 0))
|
||||
(global $ASC_NO_TREESHAKING i32 (i32.const 0))
|
||||
(global $ASC_NO_ASSERT i32 (i32.const 0))
|
||||
@ -9,10 +12,8 @@
|
||||
(global $ASC_FEATURE_MUTABLE_GLOBAL i32 (i32.const 0))
|
||||
(global $ASC_FEATURE_SIGN_EXTENSION i32 (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 0 ;) (type $v)
|
||||
(drop
|
||||
|
@ -3,7 +3,10 @@
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\t\00\00\00a\00s\00s\00e\00r\00t\00.\00t\00s")
|
||||
(data (i32.const 32) "\0c\00\00\00m\00u\00s\00t\00 \00b\00e\00 \00t\00r\00u\00e")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $start)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(func $start (; 0 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
|
@ -1,14 +1,15 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $HEAP_BASE i32 (i32.const 60))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\t\00\00\00a\00s\00s\00e\00r\00t\00.\00t\00s\00")
|
||||
(data (i32.const 32) "\0c\00\00\00m\00u\00s\00t\00 \00b\00e\00 \00t\00r\00u\00e\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $HEAP_BASE i32 (i32.const 60))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -2,13 +2,16 @@
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$dd (func (param f64) (result f64)))
|
||||
(type $FUNCSIG$ff (func (param f32) (result f32)))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $binary/b (mut i32) (i32.const 0))
|
||||
(global $binary/i (mut i32) (i32.const 0))
|
||||
(global $binary/I (mut i64) (i64.const 0))
|
||||
(global $binary/f (mut f32) (f32.const 0))
|
||||
(global $binary/F (mut f64) (f64.const 0))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $~lib/math/NativeMath.pow (; 0 ;) (; has Stack IR ;) (type $FUNCSIG$dd) (param $0 f64) (result f64)
|
||||
(local $1 i32)
|
||||
|
@ -4,6 +4,9 @@
|
||||
(type $fff (func (param f32 f32) (result f32)))
|
||||
(type $fif (func (param f32 i32) (result f32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $binary/b (mut i32) (i32.const 0))
|
||||
(global $binary/i (mut i32) (i32.const 0))
|
||||
(global $NaN f64 (f64.const nan:0x8000000000000))
|
||||
@ -11,10 +14,8 @@
|
||||
(global $binary/f (mut f32) (f32.const 0))
|
||||
(global $binary/F (mut f64) (f64.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $~lib/math/NativeMath.scalbn (; 0 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64)
|
||||
(local $2 f64)
|
||||
|
@ -2,6 +2,11 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s")
|
||||
(data (i32.const 40) "\01\00\00\001")
|
||||
(table 2 anyfunc)
|
||||
(elem (i32.const 0) $builtins/test $start~anonymous|1)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $builtins/b (mut i32) (i32.const 0))
|
||||
(global $builtins/i (mut i32) (i32.const 0))
|
||||
@ -12,11 +17,6 @@
|
||||
(global $builtins/U (mut i64) (i64.const 0))
|
||||
(global $builtins/s (mut i32) (i32.const 0))
|
||||
(global $builtins/fn (mut i32) (i32.const 1))
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $builtins/test $start~anonymous|1)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s")
|
||||
(data (i32.const 40) "\01\00\00\001")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $builtins/test))
|
||||
|
@ -2,6 +2,11 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s\00")
|
||||
(data (i32.const 40) "\01\00\00\001\00")
|
||||
(table 2 anyfunc)
|
||||
(elem (i32.const 0) $null $start~anonymous|1)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $builtins/b (mut i32) (i32.const 0))
|
||||
(global $builtins/i (mut i32) (i32.const 0))
|
||||
@ -48,11 +53,6 @@
|
||||
(global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16))
|
||||
(global $~lib/builtins/f64.NaN f64 (f64.const nan:0x8000000000000))
|
||||
(global $HEAP_BASE i32 (i32.const 48))
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $null $start~anonymous|1)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s\00")
|
||||
(data (i32.const 40) "\01\00\00\001\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $builtins/test))
|
||||
|
@ -4,10 +4,13 @@
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(type $FUNCSIG$d (func (result f64)))
|
||||
(type $FUNCSIG$f (func (result f32)))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00i\00n\00f\00e\00r\00r\00e\00d\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $call-inferred/foo<i32> (; 1 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32)
|
||||
(i32.const 42)
|
||||
|
@ -4,13 +4,14 @@
|
||||
(type $FF (func (param f64) (result f64)))
|
||||
(type $ff (func (param f32) (result f32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $HEAP_BASE i32 (i32.const 44))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00i\00n\00f\00e\00r\00r\00e\00d\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $HEAP_BASE i32 (i32.const 44))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $call-inferred/foo<i32> (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(get_local $0)
|
||||
|
@ -2,13 +2,13 @@
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s")
|
||||
(table 2 anyfunc)
|
||||
(elem (i32.const 0) $null $call-optional/opt|trampoline)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $call-optional/optIndirect (mut i32) (i32.const 1))
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $null $call-optional/opt|trampoline)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
|
@ -2,14 +2,14 @@
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s\00")
|
||||
(table 2 anyfunc)
|
||||
(elem (i32.const 0) $null $call-optional/opt|trampoline)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $call-optional/optIndirect (mut i32) (i32.const 1))
|
||||
(global $HEAP_BASE i32 (i32.const 44))
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $null $call-optional/opt|trampoline)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
|
@ -2,7 +2,10 @@
|
||||
(type $iv (func (param i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class-extends/test))
|
||||
(func $class-extends/test (; 0 ;) (; has Stack IR ;) (type $iv) (param $0 i32)
|
||||
(drop
|
||||
|
@ -1,11 +1,12 @@
|
||||
(module
|
||||
(type $iv (func (param i32)))
|
||||
(type $v (func))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class-extends/test))
|
||||
(func $class-extends/test (; 0 ;) (type $iv) (param $0 i32)
|
||||
(drop
|
||||
|
@ -3,7 +3,10 @@
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class-overloading/test))
|
||||
(start $start)
|
||||
(func $class-overloading/Foo#baz (; 0 ;) (; has Stack IR ;) (type $FUNCSIG$v)
|
||||
|
@ -1,11 +1,12 @@
|
||||
(module
|
||||
(type $iv (func (param i32)))
|
||||
(type $v (func))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class-overloading/test))
|
||||
(start $start)
|
||||
(func $class-overloading/Foo#baz (; 0 ;) (type $iv) (param $0 i32)
|
||||
|
@ -2,7 +2,10 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class-with-boolean-field/test))
|
||||
(func $class-with-boolean-field/test (; 0 ;) (; has Stack IR ;) (type $i) (result i32)
|
||||
(i32.store8
|
||||
|
@ -1,11 +1,12 @@
|
||||
(module
|
||||
(type $i (func (result i32)))
|
||||
(type $v (func))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class-with-boolean-field/test))
|
||||
(func $class-with-boolean-field/test (; 0 ;) (type $i) (result i32)
|
||||
(local $0 i32)
|
||||
|
@ -3,10 +3,13 @@
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(type $FUNCSIG$f (func (result f32)))
|
||||
(global $class/Animal.ONE (mut i32) (i32.const 1))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00l\00a\00s\00s\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $class/Animal.ONE (mut i32) (i32.const 1))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class/test))
|
||||
(start $start)
|
||||
(func $class/Animal.add (; 0 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32)
|
||||
|
@ -6,14 +6,15 @@
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $ifff (func (param i32 f32 f32) (result f32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00l\00a\00s\00s\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $class/Animal.ONE (mut i32) (i32.const 1))
|
||||
(global $HEAP_BASE i32 (i32.const 28))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00l\00a\00s\00s\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $class/test))
|
||||
(start $start)
|
||||
(func $class/Animal.add (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
|
@ -1,7 +1,10 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(func $null (; 0 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
|
@ -1,10 +1,11 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(func $null (; 0 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
@ -1,12 +1,15 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00o\00m\00m\00a\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $comma/a (mut i32) (i32.const 0))
|
||||
(global $comma/b (mut i32) (i32.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00o\00m\00m\00a\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (; has Stack IR ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -1,15 +1,16 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00o\00m\00m\00a\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $comma/a (mut i32) (i32.const 0))
|
||||
(global $comma/b (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 28))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\08\00\00\00c\00o\00m\00m\00a\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -1,14 +1,17 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(import "declare" "externalConstant" (global $declare/externalConstant i32))
|
||||
(import "declare" "externalFunction" (func $declare/externalFunction))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "my" "externalFunction" (func $declare/my.externalFunction))
|
||||
(import "my" "externalConstant" (global $declare/my.externalConstant i32))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\n\00\00\00d\00e\00c\00l\00a\00r\00e\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "declare" "externalConstant" (global $declare/externalConstant i32))
|
||||
(import "declare" "my.externalConstant" (global $declare/my.externalConstant i32))
|
||||
(import "declare" "externalFunction" (func $declare/externalFunction))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "declare" "my.externalFunction" (func $declare/my.externalFunction))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 3 ;) (; has Stack IR ;) (type $v)
|
||||
(call $declare/externalFunction)
|
||||
|
@ -1,17 +1,18 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(import "declare" "externalConstant" (global $declare/externalConstant i32))
|
||||
(import "declare" "externalFunction" (func $declare/externalFunction))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "my" "externalFunction" (func $declare/my.externalFunction))
|
||||
(import "my" "externalConstant" (global $declare/my.externalConstant i32))
|
||||
(global $HEAP_BASE i32 (i32.const 32))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\n\00\00\00d\00e\00c\00l\00a\00r\00e\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "declare" "externalConstant" (global $declare/externalConstant i32))
|
||||
(import "declare" "my.externalConstant" (global $declare/my.externalConstant i32))
|
||||
(import "declare" "externalFunction" (func $declare/externalFunction))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "declare" "my.externalFunction" (func $declare/my.externalFunction))
|
||||
(global $HEAP_BASE i32 (i32.const 32))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 3 ;) (type $v)
|
||||
(call $declare/externalFunction)
|
||||
|
@ -1,13 +1,16 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\05\00\00\00d\00o\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $do/n (mut i32) (i32.const 10))
|
||||
(global $do/m (mut i32) (i32.const 0))
|
||||
(global $do/o (mut i32) (i32.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\05\00\00\00d\00o\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (; has Stack IR ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -1,16 +1,17 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\05\00\00\00d\00o\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $do/n (mut i32) (i32.const 10))
|
||||
(global $do/m (mut i32) (i32.const 0))
|
||||
(global $do/o (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 24))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\05\00\00\00d\00o\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -1,7 +1,10 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(func $null (; 0 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
|
@ -1,10 +1,11 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(func $null (; 0 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
@ -1,6 +1,9 @@
|
||||
(module
|
||||
(type $i (func (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $enum/Implicit.ZERO i32 (i32.const 0))
|
||||
(global $enum/Implicit.ONE i32 (i32.const 1))
|
||||
(global $enum/Implicit.TWO i32 (i32.const 2))
|
||||
@ -17,8 +20,8 @@
|
||||
(global $enum/NonConstant.ONE (mut i32) (i32.const 0))
|
||||
(global $enum/SelfReference.ZERO i32 (i32.const 0))
|
||||
(global $enum/SelfReference.ONE i32 (i32.const 1))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "Implicit.ZERO" (global $enum/Implicit.ZERO))
|
||||
(export "Implicit.ONE" (global $enum/Implicit.ONE))
|
||||
(export "Implicit.TWO" (global $enum/Implicit.TWO))
|
||||
|
@ -1,6 +1,9 @@
|
||||
(module
|
||||
(type $i (func (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $enum/Implicit.ZERO i32 (i32.const 0))
|
||||
(global $enum/Implicit.ONE i32 (i32.const 1))
|
||||
(global $enum/Implicit.TWO i32 (i32.const 2))
|
||||
@ -19,10 +22,8 @@
|
||||
(global $enum/SelfReference.ONE i32 (i32.const 1))
|
||||
(global $enum/enumType (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "Implicit.ZERO" (global $enum/Implicit.ZERO))
|
||||
(export "Implicit.ONE" (global $enum/Implicit.ONE))
|
||||
(export "Implicit.TWO" (global $enum/Implicit.TWO))
|
||||
|
@ -1,11 +1,14 @@
|
||||
(module
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $export/ns.two)
|
||||
(global $export/a i32 (i32.const 1))
|
||||
(global $export/b i32 (i32.const 2))
|
||||
(global $export/c i32 (i32.const 3))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "add" (func $export/add))
|
||||
(export "sub" (func $export/sub))
|
||||
(export "renamed_mul" (func $export/mul))
|
||||
|
@ -1,14 +1,15 @@
|
||||
(module
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $export/a i32 (i32.const 1))
|
||||
(global $export/b i32 (i32.const 2))
|
||||
(global $export/c i32 (i32.const 3))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "add" (func $export/add))
|
||||
(export "sub" (func $export/sub))
|
||||
(export "renamed_mul" (func $export/mul))
|
||||
|
@ -6,6 +6,9 @@
|
||||
(type $iv (func (param i32)))
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $exports/Animal.CAT i32 (i32.const 0))
|
||||
@ -16,8 +19,8 @@
|
||||
(global $exports/vehicles.Car.TIRES i32 (i32.const 4))
|
||||
(global $exports/outer.inner.a i32 (i32.const 42))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "add" (func $exports/add))
|
||||
(export "_setargc" (func $~setargc))
|
||||
(export "subOpt" (func $exports/subOpt|trampoline))
|
||||
|
@ -5,6 +5,9 @@
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iv (func (param i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
||||
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
|
||||
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
|
||||
@ -20,10 +23,8 @@
|
||||
(global $exports/outer.inner.a i32 (i32.const 42))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "add" (func $exports/add))
|
||||
(export "_setargc" (func $~setargc))
|
||||
(export "subOpt" (func $exports/subOpt|trampoline))
|
||||
|
@ -1,12 +1,15 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "foo" "var" (global $external/var_ i32))
|
||||
(import "external" "foo" (func $external/foo))
|
||||
(import "foo" "bar" (func $external/foo.bar))
|
||||
(import "external" "foo.bar" (func $external/foo.bar))
|
||||
(import "external" "bar" (func $external/two))
|
||||
(import "foo" "baz" (func $external/three))
|
||||
(import "foo" "var" (global $external/var_ i32))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "foo.bar" (func $external/foo.bar))
|
||||
(export "foo" (func $external/foo))
|
||||
(export "two" (func $external/two))
|
||||
|
@ -1,13 +1,13 @@
|
||||
export declare function foo(): void; // external.foo
|
||||
export declare function foo(): void; // external , foo
|
||||
export declare namespace foo {
|
||||
export function bar(): void; // foo.bar
|
||||
export function bar(): void; // external , foo.bar
|
||||
}
|
||||
|
||||
@external("bar")
|
||||
export declare function two(): void; // external.bar
|
||||
export declare function two(): void; // external , bar
|
||||
|
||||
@external("foo", "baz")
|
||||
export declare function three(): void; // foo.baz
|
||||
export declare function three(): void; // foo , baz
|
||||
|
||||
@external("foo", "var")
|
||||
@external("foo", "var") // foo , var
|
||||
export declare const var_: i32;
|
||||
|
@ -1,15 +1,16 @@
|
||||
(module
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "foo" "var" (global $external/var_ i32))
|
||||
(import "external" "foo" (func $external/foo))
|
||||
(import "foo" "bar" (func $external/foo.bar))
|
||||
(import "external" "foo.bar" (func $external/foo.bar))
|
||||
(import "external" "bar" (func $external/two))
|
||||
(import "foo" "baz" (func $external/three))
|
||||
(import "foo" "var" (global $external/var_ i32))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "foo.bar" (func $external/foo.bar))
|
||||
(export "foo" (func $external/foo))
|
||||
(export "two" (func $external/two))
|
||||
|
@ -1,11 +1,14 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $for/i (mut i32) (i32.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00f\00o\00r\00.\00t\00s")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $for/i (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (; has Stack IR ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -1,14 +1,15 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00f\00o\00r\00.\00t\00s\00")
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $for/i (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 24))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00f\00o\00r\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
(local $0 i32)
|
||||
|
@ -3,16 +3,16 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(type $i (func (result i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\16\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00e\00x\00p\00r\00e\00s\00s\00i\00o\00n\00.\00t\00s")
|
||||
(table 5 anyfunc)
|
||||
(elem (i32.const 0) $start~someName|3 $start~anonymous|1 $start~anonymous|1 $start~someName|3 $start~anonymous|4)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $function-expression/f1 (mut i32) (i32.const 1))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $function-expression/f2 (mut i32) (i32.const 2))
|
||||
(global $function-expression/f3 (mut i32) (i32.const 3))
|
||||
(global $function-expression/f4 (mut i32) (i32.const 4))
|
||||
(table 5 5 anyfunc)
|
||||
(elem (i32.const 0) $start~someName|3 $start~anonymous|1 $start~anonymous|1 $start~someName|3 $start~anonymous|4)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\16\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00e\00x\00p\00r\00e\00s\00s\00i\00o\00n\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
|
@ -3,6 +3,10 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(type $i (func (result i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\16\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00e\00x\00p\00r\00e\00s\00s\00i\00o\00n\00.\00t\00s\00")
|
||||
(table 5 anyfunc)
|
||||
(elem (i32.const 0) $null $start~anonymous|1 $start~anonymous|2 $start~someName|3 $start~anonymous|4)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $function-expression/f1 (mut i32) (i32.const 1))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
@ -10,10 +14,6 @@
|
||||
(global $function-expression/f3 (mut i32) (i32.const 3))
|
||||
(global $function-expression/f4 (mut i32) (i32.const 4))
|
||||
(global $HEAP_BASE i32 (i32.const 56))
|
||||
(table 5 5 anyfunc)
|
||||
(elem (i32.const 0) $null $start~anonymous|1 $start~anonymous|2 $start~someName|3 $start~anonymous|4)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\16\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00e\00x\00p\00r\00e\00s\00s\00i\00o\00n\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
|
@ -7,14 +7,14 @@
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\11\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s")
|
||||
(table 5 anyfunc)
|
||||
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|1 $function-types/makeAdder<i64>~anonymous|2 $function-types/makeAdder<f64>~anonymous|3 $function-types/makeAdder<i32>~anonymous|1)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $function-types/i32Adder (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $function-types/i64Adder (mut i32) (i32.const 0))
|
||||
(table 5 5 anyfunc)
|
||||
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|1 $function-types/makeAdder<i64>~anonymous|2 $function-types/makeAdder<f64>~anonymous|3 $function-types/makeAdder<i32>~anonymous|1)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\11\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
|
@ -6,15 +6,15 @@
|
||||
(type $FFF (func (param f64 f64) (result f64)))
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\11\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s\00")
|
||||
(table 5 anyfunc)
|
||||
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|1 $function-types/makeAdder<i64>~anonymous|2 $function-types/makeAdder<f64>~anonymous|3 $function-types/addI32)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $function-types/i32Adder (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $function-types/i64Adder (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 48))
|
||||
(table 5 5 anyfunc)
|
||||
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|1 $function-types/makeAdder<i64>~anonymous|2 $function-types/makeAdder<f64>~anonymous|3 $function-types/addI32)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\11\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
|
@ -10,7 +10,10 @@
|
||||
(type $FUNCSIG$f (func (result f32)))
|
||||
(type $FUNCSIG$d (func (result f64)))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $function/v)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $function/v (; 0 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
|
@ -14,11 +14,12 @@
|
||||
(type $IiI (func (param i64 i32) (result i64)))
|
||||
(type $fff (func (param f32 f32) (result f32)))
|
||||
(type $FFF (func (param f64 f64) (result f64)))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $function/v (; 0 ;) (type $v)
|
||||
(nop)
|
||||
|
@ -3,12 +3,12 @@
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(memory $0 0)
|
||||
(table 2 anyfunc)
|
||||
(elem (i32.const 0) $null $getter-call/C#get:x~anonymous|1)
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $null $getter-call/C#get:x~anonymous|1)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $getter-call/test))
|
||||
|
@ -2,6 +2,9 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 2 anyfunc)
|
||||
(elem (i32.const 0) $null $getter-call/C#get:x~anonymous|1)
|
||||
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
||||
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
|
||||
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
|
||||
@ -10,9 +13,6 @@
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $null $getter-call/C#get:x~anonymous|1)
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "test" (func $getter-call/test))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user