Remove noMemory option; Omit 'start' if 'main' is present; Unwrap more unnecessary blocks

This commit is contained in:
dcodeIO 2018-06-27 19:03:39 +02:00
parent 0d64c9661a
commit 27e61f8f67
42 changed files with 5337 additions and 3741 deletions

View File

@ -384,7 +384,6 @@ exports.main = function main(argv, options, callback) {
assemblyscript.setTarget(compilerOptions, 0); assemblyscript.setTarget(compilerOptions, 0);
assemblyscript.setNoTreeShaking(compilerOptions, !!args.noTreeShaking); assemblyscript.setNoTreeShaking(compilerOptions, !!args.noTreeShaking);
assemblyscript.setNoAssert(compilerOptions, !!args.noAssert); assemblyscript.setNoAssert(compilerOptions, !!args.noAssert);
assemblyscript.setNoMemory(compilerOptions, !!args.noMemory);
assemblyscript.setImportMemory(compilerOptions, !!args.importMemory); assemblyscript.setImportMemory(compilerOptions, !!args.importMemory);
assemblyscript.setImportTable(compilerOptions, !!args.importTable); assemblyscript.setImportTable(compilerOptions, !!args.importTable);
assemblyscript.setMemoryBase(compilerOptions, args.memoryBase >>> 0); assemblyscript.setMemoryBase(compilerOptions, args.memoryBase >>> 0);

View File

@ -95,10 +95,6 @@
"description": "Performs compilation as usual but does not emit code.", "description": "Performs compilation as usual but does not emit code.",
"type": "boolean" "type": "boolean"
}, },
"noMemory": {
"description": "Does not set up a memory. Useful for low-level WebAssembly.",
"type": "boolean"
},
"importMemory": { "importMemory": {
"description": "Imports the memory instance provided by the embedder.", "description": "Imports the memory instance provided by the embedder.",
"type": "boolean" "type": "boolean"

2
dist/asc.js vendored

File diff suppressed because one or more lines are too long

2
dist/asc.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@
(type $iiiiv (func (param i32 i32 i32 i32))) (type $iiiiv (func (param i32 i32 i32 i32)))
(global $assembly/i64/lo (mut i32) (i32.const 0)) (global $assembly/i64/lo (mut i32) (i32.const 0))
(global $assembly/i64/hi (mut i32) (i32.const 0)) (global $assembly/i64/hi (mut i32) (i32.const 0))
(memory $0 1)
(export "getLo" (func $assembly/i64/getLo)) (export "getLo" (func $assembly/i64/getLo))
(export "getHi" (func $assembly/i64/getHi)) (export "getHi" (func $assembly/i64/getHi))
(export "clz" (func $assembly/i64/clz)) (export "clz" (func $assembly/i64/clz))
@ -35,6 +36,7 @@
(export "gt_u" (func $assembly/i64/gt_u)) (export "gt_u" (func $assembly/i64/gt_u))
(export "ge_s" (func $assembly/i64/ge_s)) (export "ge_s" (func $assembly/i64/ge_s))
(export "ge_u" (func $assembly/i64/ge_u)) (export "ge_u" (func $assembly/i64/ge_u))
(export "memory" (memory $0))
(func $assembly/i64/getLo (; 0 ;) (type $i) (result i32) (func $assembly/i64/getLo (; 0 ;) (type $i) (result i32)
;;@ assembly/i64.ts:4:9 ;;@ assembly/i64.ts:4:9
(get_global $assembly/i64/lo) (get_global $assembly/i64/lo)

View File

@ -6,6 +6,8 @@
(global $assembly/i64/hi (mut i32) (i32.const 0)) (global $assembly/i64/hi (mut i32) (i32.const 0))
(global $NaN f64 (f64.const nan:0x8000000000000)) (global $NaN f64 (f64.const nan:0x8000000000000))
(global $Infinity f64 (f64.const inf)) (global $Infinity f64 (f64.const inf))
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 1)
(export "getLo" (func $assembly/i64/getLo)) (export "getLo" (func $assembly/i64/getLo))
(export "getHi" (func $assembly/i64/getHi)) (export "getHi" (func $assembly/i64/getHi))
(export "clz" (func $assembly/i64/clz)) (export "clz" (func $assembly/i64/clz))
@ -37,19 +39,14 @@
(export "gt_u" (func $assembly/i64/gt_u)) (export "gt_u" (func $assembly/i64/gt_u))
(export "ge_s" (func $assembly/i64/ge_s)) (export "ge_s" (func $assembly/i64/ge_s))
(export "ge_u" (func $assembly/i64/ge_u)) (export "ge_u" (func $assembly/i64/ge_u))
(export "memory" (memory $0))
(func $assembly/i64/getLo (; 0 ;) (type $i) (result i32) (func $assembly/i64/getLo (; 0 ;) (type $i) (result i32)
;;@ assembly/i64.ts:3:29 ;;@ assembly/i64.ts:4:9
(return (get_global $assembly/i64/lo)
;;@ assembly/i64.ts:4:9
(get_global $assembly/i64/lo)
)
) )
(func $assembly/i64/getHi (; 1 ;) (type $i) (result i32) (func $assembly/i64/getHi (; 1 ;) (type $i) (result i32)
;;@ assembly/i64.ts:7:29 ;;@ assembly/i64.ts:8:9
(return (get_global $assembly/i64/hi)
;;@ 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 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i64) (local $2 i64)

View File

@ -17,8 +17,8 @@
}, },
"scripts": { "scripts": {
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
"asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --noMemory --validate --sourceMap --measure", "asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --validate --sourceMap --measure",
"asbuild:optimized": "asc -O assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --noMemory --validate --sourceMap --measure", "asbuild:optimized": "asc -O assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --validate --sourceMap --measure",
"test": "node tests" "test": "node tests"
}, },
"files": [ "files": [

View File

@ -10,9 +10,9 @@
(func $assembly/index/computeLine (; 2 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (func $assembly/index/computeLine (; 2 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 f64) (local $4 f64)
(local $5 f64) (local $5 f64)
(local $6 i32) (local $6 f64)
(local $7 f64) (local $7 f64)
(local $8 f64) (local $8 i32)
(local $9 f64) (local $9 f64)
(local $10 f64) (local $10 f64)
(local $11 f64) (local $11 f64)
@ -21,8 +21,10 @@
(set_local $11 (set_local $11
;;@ assembly/index.ts:8:19 ;;@ assembly/index.ts:8:19
(f64.div (f64.div
(f64.convert_u/i32 (tee_local $6
(get_local $1) (f64.convert_u/i32
(get_local $1)
)
) )
;;@ assembly/index.ts:8:27 ;;@ assembly/index.ts:8:27
(f64.const 1.6) (f64.const 1.6)
@ -34,16 +36,20 @@
(f64.mul (f64.mul
(f64.sub (f64.sub
(f64.convert_u/i32 (f64.convert_u/i32
;;@ assembly/index.ts:11:19
(get_local $0) (get_local $0)
) )
;;@ assembly/index.ts:9:19 ;;@ assembly/index.ts:9:2
(f64.div (tee_local $7
(f64.convert_u/i32 ;;@ assembly/index.ts:9:19
(get_local $2) (f64.div
(tee_local $4
(f64.convert_u/i32
(get_local $2)
)
)
;;@ assembly/index.ts:9:28
(f64.const 2)
) )
;;@ assembly/index.ts:9:28
(f64.const 2)
) )
) )
;;@ assembly/index.ts:10:2 ;;@ assembly/index.ts:10:2
@ -56,150 +62,130 @@
;;@ assembly/index.ts:10:25 ;;@ assembly/index.ts:10:25
(f64.mul (f64.mul
(f64.const 3) (f64.const 3)
(f64.convert_u/i32 (get_local $6)
;;@ assembly/index.ts:10:29
(get_local $1)
)
) )
;;@ assembly/index.ts:10:36 ;;@ assembly/index.ts:10:36
(f64.mul (f64.mul
(f64.const 4) (f64.const 4)
(f64.convert_u/i32 (get_local $4)
;;@ assembly/index.ts:10:40
(get_local $2)
)
) )
) )
) )
) )
) )
) )
;;@ assembly/index.ts:12:7 ;;@ assembly/index.ts:12:2
(set_local $2 (block $break|0
;;@ assembly/index.ts:12:20 (loop $repeat|0
(i32.const 0) (br_if $break|0
) ;;@ assembly/index.ts:12:23
(loop $continue|0 (i32.ge_u
(if (get_local $8)
;;@ assembly/index.ts:12:23 (get_local $1)
(i32.lt_u )
(get_local $2)
;;@ assembly/index.ts:12:27
(get_local $1)
) )
(block ;;@ assembly/index.ts:13:4
;;@ assembly/index.ts:13:4 (set_local $10
(set_local $10 ;;@ assembly/index.ts:13:15
;;@ assembly/index.ts:13:15 (f64.mul
(f64.mul (f64.sub
(f64.sub (f64.convert_u/i32
(f64.convert_u/i32 (get_local $8)
;;@ assembly/index.ts:13:16
(get_local $2)
)
;;@ assembly/index.ts:13:20
(get_local $11)
) )
;;@ assembly/index.ts:13:34 (get_local $11)
(get_local $12)
) )
(get_local $12)
) )
(set_local $4 )
;;@ assembly/index.ts:16:13 (set_local $4
(f64.const 0) ;;@ assembly/index.ts:16:13
) (f64.const 0)
(set_local $5 )
;;@ assembly/index.ts:16:23 (set_local $5
(f64.const 0) ;;@ assembly/index.ts:16:23
) (f64.const 0)
;;@ assembly/index.ts:17:4 )
(set_local $6 ;;@ assembly/index.ts:17:4
;;@ assembly/index.ts:17:25 (set_local $2
(i32.const 0) ;;@ assembly/index.ts:17:25
) (i32.const 0)
;;@ assembly/index.ts:18:4 )
(block $break|1 ;;@ assembly/index.ts:18:4
(loop $continue|1 (block $break|1
(if (loop $continue|1
;;@ assembly/index.ts:18:11 (if
(f64.le ;;@ assembly/index.ts:18:11
(f64.le
(f64.add
(tee_local $6
;;@ assembly/index.ts:18:19
(f64.mul
(get_local $4)
(get_local $4)
)
)
;;@ assembly/index.ts:18:30
(tee_local $7
;;@ assembly/index.ts:18:38
(f64.mul
(get_local $5)
(get_local $5)
)
)
)
;;@ assembly/index.ts:18:50
(f64.const 4)
)
(block
;;@ assembly/index.ts:20:6
(set_local $5
;;@ assembly/index.ts:20:11
(f64.add (f64.add
(tee_local $7 (f64.mul
;;@ assembly/index.ts:18:19
(f64.mul (f64.mul
(get_local $4) (f64.const 2)
;;@ assembly/index.ts:18:24
(get_local $4) (get_local $4)
) )
(get_local $5)
) )
;;@ assembly/index.ts:18:30 (get_local $9)
(tee_local $8
;;@ assembly/index.ts:18:38
(f64.mul
(get_local $5)
;;@ assembly/index.ts:18:43
(get_local $5)
)
)
) )
;;@ assembly/index.ts:18:50
(f64.const 4)
) )
(block ;;@ assembly/index.ts:21:6
;;@ assembly/index.ts:20:6 (set_local $4
(set_local $5 ;;@ assembly/index.ts:19:18
;;@ assembly/index.ts:20:11 (f64.add
(f64.add (f64.sub
(f64.mul
(f64.mul
(f64.const 2)
;;@ assembly/index.ts:20:17
(get_local $4)
)
;;@ assembly/index.ts:20:22
(get_local $5)
)
;;@ assembly/index.ts:20:27
(get_local $9)
)
)
;;@ assembly/index.ts:21:6
(set_local $4
;;@ assembly/index.ts:19:18
(f64.add
(f64.sub
(get_local $7)
;;@ assembly/index.ts:19:25
(get_local $8)
)
;;@ assembly/index.ts:19:32
(get_local $10)
)
)
;;@ assembly/index.ts:22:30
(br_if $break|1
;;@ assembly/index.ts:22:10
(i32.ge_u
(get_local $6) (get_local $6)
;;@ assembly/index.ts:22:23 (get_local $7)
(get_local $3)
) )
(get_local $10)
) )
;;@ assembly/index.ts:23:6
(set_local $6
(i32.add
;;@ assembly/index.ts:23:8
(get_local $6)
(i32.const 1)
)
)
(br $continue|1)
) )
;;@ assembly/index.ts:22:30
(br_if $break|1
;;@ assembly/index.ts:22:10
(i32.ge_u
(get_local $2)
(get_local $3)
)
)
;;@ assembly/index.ts:23:6
(set_local $2
(i32.add
(get_local $2)
(i32.const 1)
)
)
(br $continue|1)
) )
) )
) )
)
;;@ assembly/index.ts:27:4
(block $break|2
;;@ assembly/index.ts:27:9 ;;@ assembly/index.ts:27:9
(set_local $7 (set_local $6
;;@ assembly/index.ts:27:29 ;;@ assembly/index.ts:27:29
(f64.min (f64.min
;;@ assembly/index.ts:27:33 ;;@ assembly/index.ts:27:33
@ -210,127 +196,114 @@
) )
) )
) )
(loop $continue|2 (loop $repeat|2
(if (br_if $break|2
;;@ assembly/index.ts:27:44 (i32.eqz
(f64.lt ;;@ assembly/index.ts:27:44
(f64.convert_u/i32 (f64.lt
(f64.convert_u/i32
(get_local $2)
)
(get_local $6) (get_local $6)
) )
;;@ assembly/index.ts:27:56
(get_local $7)
)
(block
;;@ assembly/index.ts:28:6
(set_local $8
;;@ assembly/index.ts:28:18
(f64.add
(f64.sub
(f64.mul
(get_local $4)
;;@ assembly/index.ts:28:23
(get_local $4)
)
;;@ assembly/index.ts:28:28
(f64.mul
(get_local $5)
;;@ assembly/index.ts:28:33
(get_local $5)
)
)
;;@ assembly/index.ts:28:38
(get_local $10)
)
)
;;@ assembly/index.ts:29:6
(set_local $5
;;@ assembly/index.ts:29:11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
;;@ assembly/index.ts:29:17
(get_local $4)
)
;;@ assembly/index.ts:29:22
(get_local $5)
)
;;@ assembly/index.ts:29:27
(get_local $9)
)
)
;;@ assembly/index.ts:30:6
(set_local $4
;;@ assembly/index.ts:30:11
(get_local $8)
)
;;@ assembly/index.ts:27:71
(set_local $6
(i32.add
;;@ assembly/index.ts:27:73
(get_local $6)
(i32.const 1)
)
)
(br $continue|2)
) )
) )
) ;;@ assembly/index.ts:28:6
;;@ assembly/index.ts:40:4 (set_local $7
(i32.store16 ;;@ assembly/index.ts:28:18
;;@ assembly/index.ts:40:15 (f64.add
(i32.shl (f64.sub
(f64.mul
(get_local $4)
(get_local $4)
)
;;@ assembly/index.ts:28:28
(f64.mul
(get_local $5)
(get_local $5)
)
)
(get_local $10)
)
)
;;@ assembly/index.ts:29:6
(set_local $5
;;@ assembly/index.ts:29:11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
(get_local $4)
)
(get_local $5)
)
(get_local $9)
)
)
;;@ assembly/index.ts:30:6
(set_local $4
(get_local $7)
)
;;@ assembly/index.ts:27:71
(set_local $2
(i32.add (i32.add
;;@ assembly/index.ts:40:16
(i32.mul
(get_local $0)
;;@ assembly/index.ts:40:20
(get_local $1)
)
;;@ assembly/index.ts:40:28
(get_local $2) (get_local $2)
(i32.const 1)
) )
;;@ assembly/index.ts:40:34
(i32.const 1)
) )
(br $repeat|2)
)
)
;;@ assembly/index.ts:40:4
(i32.store16
;;@ assembly/index.ts:40:15
(i32.shl
(i32.add
;;@ assembly/index.ts:40:16
(i32.mul
(get_local $0)
(get_local $1)
)
(get_local $8)
)
;;@ assembly/index.ts:40:34
(i32.const 1)
)
(tee_local $2
;;@ assembly/index.ts:37:15 ;;@ assembly/index.ts:37:15
(if (result i32) (if (result i32)
(f64.eq (f64.eq
(f64.sub (f64.sub
(tee_local $8 ;;@ assembly/index.ts:36:4
;;@ assembly/index.ts:36:4 (tee_local $6
(tee_local $7 ;;@ assembly/index.ts:36:15
;;@ assembly/index.ts:36:15 (f64.div
(f64.div ;;@ assembly/index.ts:36:20
;;@ assembly/index.ts:36:20 (call $~lib/math/JSMath.log
;;@ assembly/index.ts:36:29
(call $~lib/math/JSMath.log (call $~lib/math/JSMath.log
;;@ assembly/index.ts:36:29 ;;@ assembly/index.ts:36:38
(call $~lib/math/JSMath.log (call $~lib/math/JSMath.sqrt
;;@ assembly/index.ts:36:38 ;;@ assembly/index.ts:36:43
(call $~lib/math/JSMath.sqrt (f64.add
;;@ assembly/index.ts:36:43 (f64.mul
(f64.add (get_local $4)
(f64.mul (get_local $4)
(get_local $4) )
;;@ assembly/index.ts:36:48 ;;@ assembly/index.ts:36:53
(get_local $4) (f64.mul
) (get_local $5)
;;@ assembly/index.ts:36:53 (get_local $5)
(f64.mul
(get_local $5)
;;@ assembly/index.ts:36:58
(get_local $5)
)
) )
) )
) )
) )
;;@ assembly/index.ts:36:66
(get_global $~lib/math/JSMath.LN2)
) )
;;@ assembly/index.ts:36:66
(get_global $~lib/math/JSMath.LN2)
) )
) )
(get_local $8) (get_local $6)
) )
(f64.const 0) (f64.const 0)
) )
@ -347,16 +320,14 @@
(f64.convert_u/i32 (f64.convert_u/i32
;;@ assembly/index.ts:38:40 ;;@ assembly/index.ts:38:40
(i32.add (i32.add
(get_local $6) (get_local $2)
;;@ assembly/index.ts:38:52 ;;@ assembly/index.ts:38:52
(i32.const 1) (i32.const 1)
) )
) )
;;@ assembly/index.ts:38:56 (get_local $6)
(get_local $7)
) )
(f64.convert_u/i32 (f64.convert_u/i32
;;@ assembly/index.ts:38:64
(get_local $3) (get_local $3)
) )
) )
@ -366,20 +337,18 @@
) )
) )
) )
;;@ assembly/index.ts:39:8
(i32.const 2047) (i32.const 2047)
) )
) )
;;@ assembly/index.ts:12:34
(set_local $2
(i32.add
;;@ assembly/index.ts:12:36
(get_local $2)
(i32.const 1)
)
)
(br $continue|0)
) )
;;@ assembly/index.ts:12:34
(set_local $8
(i32.add
(get_local $8)
(i32.const 1)
)
)
(br $repeat|0)
) )
) )
) )

View File

@ -12,35 +12,30 @@
(export "computeLine" (func $assembly/index/computeLine)) (export "computeLine" (func $assembly/index/computeLine))
(export "memory" (memory $0)) (export "memory" (memory $0))
(func $isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32) (func $isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
;;@ ~lib/builtins.ts:21:44 ;;@ ~lib/builtins.ts:22:26
(return (f64.eq
;;@ ~lib/builtins.ts:22:9 ;;@ ~lib/builtins.ts:22:9
(f64.eq (f64.sub
(f64.sub (get_local $0)
(get_local $0) ;;@ ~lib/builtins.ts:22:17
;;@ ~lib/builtins.ts:22:17 (get_local $0)
(get_local $0)
)
;;@ ~lib/builtins.ts:22:26
(f64.const 0)
) )
;;@ ~lib/builtins.ts:22:26
(f64.const 0)
) )
) )
(func $assembly/index/clamp<f64> (; 3 ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64) (func $assembly/index/clamp<f64> (; 3 ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64)
;;@ assembly/index.ts:46:57 ;;@ assembly/index.ts:47:43
(return (f64.min
;;@ assembly/index.ts:47:9 ;;@ assembly/index.ts:47:13
(f64.min (f64.max
;;@ assembly/index.ts:47:13 ;;@ assembly/index.ts:47:17
(f64.max (get_local $0)
;;@ assembly/index.ts:47:17 ;;@ assembly/index.ts:47:24
(get_local $0) (get_local $1)
;;@ assembly/index.ts:47:24
(get_local $1)
)
;;@ assembly/index.ts:47:35
(get_local $2)
) )
;;@ assembly/index.ts:47:35
(get_local $2)
) )
) )
(func $assembly/index/computeLine (; 4 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (func $assembly/index/computeLine (; 4 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
@ -129,340 +124,339 @@
;;@ assembly/index.ts:12:20 ;;@ assembly/index.ts:12:20
(i32.const 0) (i32.const 0)
) )
(loop $continue|0 (loop $repeat|0
(if (br_if $break|0
;;@ assembly/index.ts:12:23 (i32.eqz
(i32.lt_u ;;@ assembly/index.ts:12:23
(get_local $8) (i32.lt_u
;;@ assembly/index.ts:12:27 (get_local $8)
(get_local $1) ;;@ assembly/index.ts:12:27
(get_local $1)
)
) )
(block )
(block ;;@ assembly/index.ts:12:39
;;@ assembly/index.ts:13:4 (block
(set_local $9 ;;@ assembly/index.ts:13:4
;;@ assembly/index.ts:13:15 (set_local $9
(f64.mul ;;@ assembly/index.ts:13:15
(f64.sub (f64.mul
(f64.convert_u/i32 (f64.sub
;;@ assembly/index.ts:13:16 (f64.convert_u/i32
(get_local $8) ;;@ assembly/index.ts:13:16
) (get_local $8)
;;@ assembly/index.ts:13:20
(get_local $4)
)
;;@ assembly/index.ts:13:34
(get_local $6)
) )
;;@ assembly/index.ts:13:20
(get_local $4)
) )
;;@ assembly/index.ts:16:4 ;;@ assembly/index.ts:13:34
(block (get_local $6)
(set_local $10 )
;;@ assembly/index.ts:16:13 )
(f64.const 0) (set_local $10
) ;;@ assembly/index.ts:16:13
(set_local $11 (f64.const 0)
;;@ assembly/index.ts:16:23 )
(f64.const 0) (set_local $11
) ;;@ assembly/index.ts:16:23
) (f64.const 0)
;;@ assembly/index.ts:17:4 )
(set_local $14 ;;@ assembly/index.ts:17:4
;;@ assembly/index.ts:17:25 (set_local $14
(i32.const 0) ;;@ assembly/index.ts:17:25
) (i32.const 0)
;;@ assembly/index.ts:18:4 )
(block $break|1 ;;@ assembly/index.ts:18:4
(loop $continue|1 (block $break|1
(if (loop $continue|1
;;@ assembly/index.ts:18:11 (if
(f64.le ;;@ assembly/index.ts:18:11
(f64.add (f64.le
(tee_local $12 (f64.add
;;@ assembly/index.ts:18:19 (tee_local $12
(f64.mul ;;@ assembly/index.ts:18:19
(get_local $10) (f64.mul
;;@ assembly/index.ts:18:24 (get_local $10)
(get_local $10) ;;@ assembly/index.ts:18:24
) (get_local $10)
)
;;@ assembly/index.ts:18:30
(tee_local $13
;;@ assembly/index.ts:18:38
(f64.mul
(get_local $11)
;;@ assembly/index.ts:18:43
(get_local $11)
)
)
) )
;;@ assembly/index.ts:18:50
(f64.const 4)
) )
(block ;;@ assembly/index.ts:18:30
(block (tee_local $13
;;@ assembly/index.ts:19:6 ;;@ assembly/index.ts:18:38
(set_local $15 (f64.mul
;;@ assembly/index.ts:19:18 (get_local $11)
(f64.add ;;@ assembly/index.ts:18:43
(f64.sub (get_local $11)
(get_local $12) )
;;@ assembly/index.ts:19:25 )
(get_local $13) )
) ;;@ assembly/index.ts:18:50
;;@ assembly/index.ts:19:32 (f64.const 4)
(get_local $9) )
(block
(block
;;@ assembly/index.ts:19:6
(set_local $15
;;@ assembly/index.ts:19:18
(f64.add
(f64.sub
(get_local $12)
;;@ assembly/index.ts:19:25
(get_local $13)
)
;;@ assembly/index.ts:19:32
(get_local $9)
)
)
;;@ assembly/index.ts:20:6
(set_local $11
;;@ assembly/index.ts:20:11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
;;@ assembly/index.ts:20:17
(get_local $10)
) )
;;@ assembly/index.ts:20:22
(get_local $11)
) )
;;@ assembly/index.ts:20:6 ;;@ assembly/index.ts:20:27
(set_local $11 (get_local $7)
;;@ assembly/index.ts:20:11 )
(f64.add )
(f64.mul ;;@ assembly/index.ts:21:6
(f64.mul (set_local $10
(f64.const 2) ;;@ assembly/index.ts:21:11
;;@ assembly/index.ts:20:17 (get_local $15)
(get_local $10) )
) ;;@ assembly/index.ts:22:6
;;@ assembly/index.ts:20:22 (if
(get_local $11) ;;@ assembly/index.ts:22:10
) (i32.ge_u
;;@ assembly/index.ts:20:27 (get_local $14)
(get_local $7) ;;@ assembly/index.ts:22:23
) (get_local $3)
) )
;;@ assembly/index.ts:21:6 ;;@ assembly/index.ts:22:30
(set_local $10 (br $break|1)
;;@ assembly/index.ts:21:11 )
(get_local $15) ;;@ assembly/index.ts:23:6
) (set_local $14
;;@ assembly/index.ts:22:6 (i32.add
(if ;;@ assembly/index.ts:23:8
;;@ assembly/index.ts:22:10 (get_local $14)
(i32.ge_u (i32.const 1)
(get_local $14) )
;;@ assembly/index.ts:22:23 )
(get_local $3) )
) (br $continue|1)
;;@ assembly/index.ts:22:30 )
(br $break|1) )
) )
;;@ assembly/index.ts:23:6 )
(set_local $14 ;;@ assembly/index.ts:27:4
(block $break|2
;;@ assembly/index.ts:27:9
(set_local $15
;;@ assembly/index.ts:27:29
(f64.min
;;@ assembly/index.ts:27:33
(f64.const 8)
;;@ assembly/index.ts:27:36
(f64.convert_u/i32
(get_local $3)
)
)
)
(loop $repeat|2
(br_if $break|2
(i32.eqz
;;@ assembly/index.ts:27:44
(f64.lt
(f64.convert_u/i32
(get_local $14)
)
;;@ assembly/index.ts:27:56
(get_local $15)
)
)
)
;;@ assembly/index.ts:27:84
(block
;;@ assembly/index.ts:28:6
(set_local $16
;;@ assembly/index.ts:28:18
(f64.add
(f64.sub
(f64.mul
(get_local $10)
;;@ assembly/index.ts:28:23
(get_local $10)
)
;;@ assembly/index.ts:28:28
(f64.mul
(get_local $11)
;;@ assembly/index.ts:28:33
(get_local $11)
)
)
;;@ assembly/index.ts:28:38
(get_local $9)
)
)
;;@ assembly/index.ts:29:6
(set_local $11
;;@ assembly/index.ts:29:11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
;;@ assembly/index.ts:29:17
(get_local $10)
)
;;@ assembly/index.ts:29:22
(get_local $11)
)
;;@ assembly/index.ts:29:27
(get_local $7)
)
)
;;@ assembly/index.ts:30:6
(set_local $10
;;@ assembly/index.ts:30:11
(get_local $16)
)
)
;;@ assembly/index.ts:27:71
(set_local $14
(i32.add
;;@ assembly/index.ts:27:73
(get_local $14)
(i32.const 1)
)
)
(br $repeat|2)
)
)
;;@ assembly/index.ts:36:4
(set_local $15
;;@ assembly/index.ts:36:15
(f64.div
;;@ assembly/index.ts:36:20
(call $~lib/math/JSMath.log
;;@ assembly/index.ts:36:29
(call $~lib/math/JSMath.log
;;@ assembly/index.ts:36:38
(call $~lib/math/JSMath.sqrt
;;@ assembly/index.ts:36:43
(f64.add
(f64.mul
(get_local $10)
;;@ assembly/index.ts:36:48
(get_local $10)
)
;;@ assembly/index.ts:36:53
(f64.mul
(get_local $11)
;;@ assembly/index.ts:36:58
(get_local $11)
)
)
)
)
)
;;@ assembly/index.ts:36:66
(get_global $~lib/math/JSMath.LN2)
)
)
;;@ assembly/index.ts:37:4
(set_local $17
;;@ assembly/index.ts:37:15
(if (result i32)
(call $isFinite<f64>
;;@ assembly/index.ts:37:24
(get_local $15)
)
;;@ assembly/index.ts:38:8
(i32.trunc_u/f64
;;@ assembly/index.ts:38:14
(f64.mul
(f64.convert_s/i32
(i32.sub
;;@ assembly/index.ts:38:15
(i32.const 2048)
;;@ assembly/index.ts:38:28
(i32.const 1)
)
)
;;@ assembly/index.ts:38:33
(call $assembly/index/clamp<f64>
;;@ assembly/index.ts:38:39
(f64.div
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:38:40
(i32.add (i32.add
;;@ assembly/index.ts:23:8
(get_local $14) (get_local $14)
;;@ assembly/index.ts:38:52
(i32.const 1) (i32.const 1)
) )
) )
;;@ assembly/index.ts:38:56
(get_local $15)
) )
(br $continue|1)
)
)
)
)
;;@ assembly/index.ts:27:4
(block $break|2
;;@ assembly/index.ts:27:9
(set_local $15
;;@ assembly/index.ts:27:29
(f64.min
;;@ assembly/index.ts:27:33
(f64.const 8)
;;@ assembly/index.ts:27:36
(f64.convert_u/i32
(get_local $3)
)
)
)
(loop $continue|2
(if
;;@ assembly/index.ts:27:44
(f64.lt
(f64.convert_u/i32 (f64.convert_u/i32
(get_local $14) ;;@ assembly/index.ts:38:64
(get_local $3)
) )
;;@ assembly/index.ts:27:56
(get_local $15)
)
(block
(block
;;@ assembly/index.ts:28:6
(set_local $16
;;@ assembly/index.ts:28:18
(f64.add
(f64.sub
(f64.mul
(get_local $10)
;;@ assembly/index.ts:28:23
(get_local $10)
)
;;@ assembly/index.ts:28:28
(f64.mul
(get_local $11)
;;@ assembly/index.ts:28:33
(get_local $11)
)
)
;;@ assembly/index.ts:28:38
(get_local $9)
)
)
;;@ assembly/index.ts:29:6
(set_local $11
;;@ assembly/index.ts:29:11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
;;@ assembly/index.ts:29:17
(get_local $10)
)
;;@ assembly/index.ts:29:22
(get_local $11)
)
;;@ assembly/index.ts:29:27
(get_local $7)
)
)
;;@ assembly/index.ts:30:6
(set_local $10
;;@ assembly/index.ts:30:11
(get_local $16)
)
)
;;@ assembly/index.ts:27:71
(set_local $14
(i32.add
;;@ assembly/index.ts:27:73
(get_local $14)
(i32.const 1)
)
)
(br $continue|2)
) )
;;@ assembly/index.ts:38:71
(f64.const 0)
;;@ assembly/index.ts:38:76
(f64.const 1)
) )
) )
) )
;;@ assembly/index.ts:36:4 ;;@ assembly/index.ts:39:8
(set_local $15 (i32.sub
;;@ assembly/index.ts:36:15 (i32.const 2048)
(f64.div ;;@ assembly/index.ts:39:21
;;@ assembly/index.ts:36:20
(call $~lib/math/JSMath.log
;;@ assembly/index.ts:36:29
(call $~lib/math/JSMath.log
;;@ assembly/index.ts:36:38
(call $~lib/math/JSMath.sqrt
;;@ assembly/index.ts:36:43
(f64.add
(f64.mul
(get_local $10)
;;@ assembly/index.ts:36:48
(get_local $10)
)
;;@ assembly/index.ts:36:53
(f64.mul
(get_local $11)
;;@ assembly/index.ts:36:58
(get_local $11)
)
)
)
)
)
;;@ assembly/index.ts:36:66
(get_global $~lib/math/JSMath.LN2)
)
)
;;@ assembly/index.ts:37:4
(set_local $17
;;@ assembly/index.ts:37:15
(if (result i32)
(call $isFinite<f64>
;;@ assembly/index.ts:37:24
(get_local $15)
)
;;@ assembly/index.ts:38:8
(i32.trunc_u/f64
;;@ assembly/index.ts:38:14
(f64.mul
(f64.convert_s/i32
(i32.sub
;;@ assembly/index.ts:38:15
(i32.const 2048)
;;@ assembly/index.ts:38:28
(i32.const 1)
)
)
;;@ assembly/index.ts:38:33
(call $assembly/index/clamp<f64>
;;@ assembly/index.ts:38:39
(f64.div
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:38:40
(i32.add
(get_local $14)
;;@ assembly/index.ts:38:52
(i32.const 1)
)
)
;;@ assembly/index.ts:38:56
(get_local $15)
)
(f64.convert_u/i32
;;@ assembly/index.ts:38:64
(get_local $3)
)
)
;;@ assembly/index.ts:38:71
(f64.const 0)
;;@ assembly/index.ts:38:76
(f64.const 1)
)
)
)
;;@ assembly/index.ts:39:8
(i32.sub
(i32.const 2048)
;;@ assembly/index.ts:39:21
(i32.const 1)
)
)
)
;;@ assembly/index.ts:40:4
(i32.store16
;;@ assembly/index.ts:40:15
(i32.shl
(i32.add
;;@ assembly/index.ts:40:16
(i32.mul
(get_local $0)
;;@ assembly/index.ts:40:20
(get_local $1)
)
;;@ assembly/index.ts:40:28
(get_local $8)
)
;;@ assembly/index.ts:40:34
(i32.const 1)
)
;;@ assembly/index.ts:40:37
(get_local $17)
)
)
;;@ assembly/index.ts:12:34
(set_local $8
(i32.add
;;@ assembly/index.ts:12:36
(get_local $8)
(i32.const 1) (i32.const 1)
) )
) )
(br $continue|0) )
;;@ assembly/index.ts:40:4
(i32.store16
;;@ assembly/index.ts:40:15
(i32.shl
(i32.add
;;@ assembly/index.ts:40:16
(i32.mul
(get_local $0)
;;@ assembly/index.ts:40:20
(get_local $1)
)
;;@ assembly/index.ts:40:28
(get_local $8)
)
;;@ assembly/index.ts:40:34
(i32.const 1)
)
;;@ assembly/index.ts:40:37
(get_local $17)
) )
) )
;;@ assembly/index.ts:12:34
(set_local $8
(i32.add
;;@ assembly/index.ts:12:36
(get_local $8)
(i32.const 1)
)
)
(br $repeat|0)
) )
) )
) )

View File

@ -192,8 +192,6 @@
) )
(func $assembly/index/Body#constructor (; 2 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) (func $assembly/index/Body#constructor (; 2 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
(local $8 i32) (local $8 i32)
;;@ assembly/index.ts:21:4
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)
@ -240,7 +238,7 @@
) )
) )
(func $assembly/index/Sun (; 3 ;) (type $i) (result i32) (func $assembly/index/Sun (; 3 ;) (type $i) (result i32)
;;@ assembly/index.ts:31:21 ;;@ assembly/index.ts:34:2
(call $assembly/index/Body#constructor (call $assembly/index/Body#constructor
(i32.const 0) (i32.const 0)
;;@ assembly/index.ts:33:4 ;;@ assembly/index.ts:33:4
@ -260,7 +258,7 @@
) )
) )
(func $assembly/index/Jupiter (; 4 ;) (type $i) (result i32) (func $assembly/index/Jupiter (; 4 ;) (type $i) (result i32)
;;@ assembly/index.ts:37:25 ;;@ assembly/index.ts:46:2
(call $assembly/index/Body#constructor (call $assembly/index/Body#constructor
(i32.const 0) (i32.const 0)
;;@ assembly/index.ts:39:4 ;;@ assembly/index.ts:39:4
@ -296,7 +294,7 @@
) )
) )
(func $assembly/index/Saturn (; 5 ;) (type $i) (result i32) (func $assembly/index/Saturn (; 5 ;) (type $i) (result i32)
;;@ assembly/index.ts:49:24 ;;@ assembly/index.ts:58:2
(call $assembly/index/Body#constructor (call $assembly/index/Body#constructor
(i32.const 0) (i32.const 0)
;;@ assembly/index.ts:51:4 ;;@ assembly/index.ts:51:4
@ -332,7 +330,7 @@
) )
) )
(func $assembly/index/Uranus (; 6 ;) (type $i) (result i32) (func $assembly/index/Uranus (; 6 ;) (type $i) (result i32)
;;@ assembly/index.ts:61:24 ;;@ assembly/index.ts:70:2
(call $assembly/index/Body#constructor (call $assembly/index/Body#constructor
(i32.const 0) (i32.const 0)
;;@ assembly/index.ts:63:4 ;;@ assembly/index.ts:63:4
@ -368,7 +366,7 @@
) )
) )
(func $assembly/index/Neptune (; 7 ;) (type $i) (result i32) (func $assembly/index/Neptune (; 7 ;) (type $i) (result i32)
;;@ assembly/index.ts:73:25 ;;@ assembly/index.ts:82:2
(call $assembly/index/Body#constructor (call $assembly/index/Body#constructor
(i32.const 0) (i32.const 0)
;;@ assembly/index.ts:75:4 ;;@ assembly/index.ts:75:4
@ -404,7 +402,7 @@
) )
) )
(func $~lib/internal/arraybuffer/computeSize (; 8 ;) (type $ii) (param $0 i32) (result i32) (func $~lib/internal/arraybuffer/computeSize (; 8 ;) (type $ii) (param $0 i32) (result i32)
;;@ ~lib/internal/arraybuffer.ts:10:52 ;;@ ~lib/internal/arraybuffer.ts:17:77
(i32.shl (i32.shl
;;@ ~lib/internal/arraybuffer.ts:17:9 ;;@ ~lib/internal/arraybuffer.ts:17:9
(i32.const 1) (i32.const 1)
@ -998,98 +996,95 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
;;@ ~lib/array.ts:21:31 ;;@ ~lib/array.ts:23:4
(block (if
;;@ ~lib/array.ts:23:4 ;;@ ~lib/array.ts:23:8
(if (i32.gt_u
;;@ ~lib/array.ts:23:8 (get_local $1)
(i32.gt_u ;;@ ~lib/array.ts:23:22
(get_local $1) (i32.const 268435454)
;;@ ~lib/array.ts:23:22
(i32.const 268435454)
)
;;@ ~lib/array.ts:23:39
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
;;@ ~lib/array.ts:24:4 ;;@ ~lib/array.ts:23:39
(set_local $2 (block
;;@ ~lib/array.ts:24:21 (call $~lib/env/abort
(i32.shl (i32.const 0)
(get_local $1) (i32.const 8)
;;@ ~lib/array.ts:24:31 (i32.const 23)
(i32.const 2) (i32.const 39)
) )
(unreachable)
) )
;;@ ~lib/array.ts:25:4 )
(set_local $3 ;;@ ~lib/array.ts:24:4
;;@ ~lib/array.ts:25:17 (set_local $2
(call $~lib/internal/arraybuffer/allocUnsafe ;;@ ~lib/array.ts:24:21
;;@ ~lib/array.ts:25:29 (i32.shl
(get_local $2) (get_local $1)
) ;;@ ~lib/array.ts:24:31
(i32.const 2)
) )
;;@ ~lib/array.ts:26:4 )
(i32.store ;;@ ~lib/array.ts:25:4
(tee_local $0 (set_local $3
(if (result i32) ;;@ ~lib/array.ts:25:17
(get_local $0) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) ;;@ ~lib/array.ts:25:29
(tee_local $0 (get_local $2)
(block (result i32) )
(set_local $4 )
(call $~lib/allocator/arena/allocate_memory ;;@ ~lib/array.ts:26:4
(i32.const 8) (i32.store
) (tee_local $0
(if (result i32)
(get_local $0)
(get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
;;@ ~lib/array.ts:26:19 )
;;@ ~lib/array.ts:26:19
(get_local $3)
)
;;@ ~lib/array.ts:27:4
(i32.store offset=4
(get_local $0)
;;@ ~lib/array.ts:27:19
(get_local $1)
)
;;@ ~lib/array.ts:28:4
(call $~lib/memory/set_memory
;;@ ~lib/array.ts:29:6
(i32.add
(get_local $3) (get_local $3)
;;@ ~lib/array.ts:29:34
(i32.const 8)
) )
;;@ ~lib/array.ts:27:4 ;;@ ~lib/array.ts:30:6
(i32.store offset=4 (i32.const 0)
(get_local $0) ;;@ ~lib/array.ts:31:6
;;@ ~lib/array.ts:27:19 (get_local $2)
(get_local $1)
)
;;@ ~lib/array.ts:28:4
(call $~lib/memory/set_memory
;;@ ~lib/array.ts:29:6
(i32.add
(get_local $3)
;;@ ~lib/array.ts:29:34
(i32.const 8)
)
;;@ ~lib/array.ts:30:6
(i32.const 0)
;;@ ~lib/array.ts:31:6
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )
(func $~lib/array/Array<Body>#__unchecked_set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/array/Array<Body>#__unchecked_set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
;;@ ~lib/array.ts:95:54 ;;@ ~lib/array.ts:96:4
(block $~lib/internal/arraybuffer/storeUnsafe<Body,Body>|inlined.0 (block $~lib/internal/arraybuffer/storeUnsafe<Body,Body>|inlined.0
(set_local $3 (set_local $3
;;@ ~lib/array.ts:96:21 ;;@ ~lib/array.ts:96:21
@ -1116,7 +1111,7 @@
) )
) )
(func $~lib/array/Array<Body>#get:length (; 13 ;) (type $ii) (param $0 i32) (result i32) (func $~lib/array/Array<Body>#get:length (; 13 ;) (type $ii) (param $0 i32) (result i32)
;;@ ~lib/array.ts:35:20 ;;@ ~lib/array.ts:36:16
(i32.load offset=4 (i32.load offset=4
;;@ ~lib/array.ts:36:11 ;;@ ~lib/array.ts:36:11
(get_local $0) (get_local $0)
@ -1124,7 +1119,7 @@
) )
(func $~lib/array/Array<Body>#__unchecked_get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/array/Array<Body>#__unchecked_get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
;;@ ~lib/array.ts:76:41 ;;@ ~lib/array.ts:77:46
(block $~lib/internal/arraybuffer/loadUnsafe<Body,Body>|inlined.0 (result i32) (block $~lib/internal/arraybuffer/loadUnsafe<Body,Body>|inlined.0 (result i32)
(set_local $2 (set_local $2
;;@ ~lib/array.ts:77:27 ;;@ ~lib/array.ts:77:27
@ -1244,136 +1239,133 @@
(local $6 i32) (local $6 i32)
(local $7 i32) (local $7 i32)
(local $8 f64) (local $8 f64)
;;@ assembly/index.ts:89:4 ;;@ assembly/index.ts:90:4
(block (set_local $2
;;@ assembly/index.ts:90:4 ;;@ assembly/index.ts:90:20
(set_local $2 (f64.const 0)
;;@ assembly/index.ts:90:20 )
(f64.const 0) ;;@ assembly/index.ts:91:4
(set_local $3
;;@ assembly/index.ts:91:20
(f64.const 0)
)
;;@ assembly/index.ts:92:4
(set_local $4
;;@ assembly/index.ts:92:20
(f64.const 0)
)
;;@ assembly/index.ts:93:4
(set_local $5
;;@ assembly/index.ts:93:15
(call $~lib/array/Array<Body>#get:length
(get_local $1)
) )
;;@ assembly/index.ts:91:4 )
(set_local $3 ;;@ assembly/index.ts:94:4
;;@ assembly/index.ts:91:20 (block $break|0
(f64.const 0) ;;@ assembly/index.ts:94:9
(set_local $6
;;@ assembly/index.ts:94:17
(i32.const 0)
) )
;;@ assembly/index.ts:92:4 (loop $repeat|0
(set_local $4 (br_if $break|0
;;@ assembly/index.ts:92:20 (i32.eqz
(f64.const 0) ;;@ assembly/index.ts:94:20
) (i32.lt_s
;;@ assembly/index.ts:93:4 (get_local $6)
(set_local $5 ;;@ assembly/index.ts:94:24
;;@ assembly/index.ts:93:15 (get_local $5)
(call $~lib/array/Array<Body>#get:length )
(get_local $1) )
) )
) ;;@ assembly/index.ts:94:35
;;@ assembly/index.ts:94:4 (block
(block $break|0 ;;@ assembly/index.ts:95:6
;;@ assembly/index.ts:94:9 (set_local $7
;;@ assembly/index.ts:95:14
(call $~lib/array/Array<Body>#__unchecked_get
;;@ assembly/index.ts:95:24
(get_local $1)
;;@ assembly/index.ts:95:31
(get_local $6)
)
)
;;@ assembly/index.ts:96:6
(set_local $8
;;@ assembly/index.ts:96:14
(f64.load offset=48
(get_local $7)
)
)
;;@ assembly/index.ts:97:6
(set_local $2
(f64.add
(get_local $2)
;;@ assembly/index.ts:97:12
(f64.mul
(f64.load offset=24
(get_local $7)
)
;;@ assembly/index.ts:97:19
(get_local $8)
)
)
)
;;@ assembly/index.ts:98:6
(set_local $3
(f64.add
(get_local $3)
;;@ assembly/index.ts:98:12
(f64.mul
(f64.load offset=32
(get_local $7)
)
;;@ assembly/index.ts:98:19
(get_local $8)
)
)
)
;;@ assembly/index.ts:99:6
(set_local $4
(f64.add
(get_local $4)
;;@ assembly/index.ts:99:12
(f64.mul
(f64.load offset=40
(get_local $7)
)
;;@ assembly/index.ts:99:19
(get_local $8)
)
)
)
)
;;@ assembly/index.ts:94:30
(set_local $6 (set_local $6
;;@ assembly/index.ts:94:17 (i32.add
(get_local $6)
(i32.const 1)
)
)
(br $repeat|0)
)
)
;;@ assembly/index.ts:101:14
(drop
(call $assembly/index/Body#offsetMomentum
;;@ assembly/index.ts:101:4
(call $~lib/array/Array<Body>#__get
(get_local $1)
;;@ assembly/index.ts:101:11
(i32.const 0) (i32.const 0)
) )
(loop $repeat|0 ;;@ assembly/index.ts:101:29
(br_if $break|0 (get_local $2)
(i32.eqz ;;@ assembly/index.ts:101:33
;;@ assembly/index.ts:94:20 (get_local $3)
(i32.lt_s ;;@ assembly/index.ts:101:37
(get_local $6) (get_local $4)
;;@ assembly/index.ts:94:24
(get_local $5)
)
)
)
;;@ assembly/index.ts:94:35
(block
;;@ assembly/index.ts:95:6
(set_local $7
;;@ assembly/index.ts:95:14
(call $~lib/array/Array<Body>#__unchecked_get
;;@ assembly/index.ts:95:24
(get_local $1)
;;@ assembly/index.ts:95:31
(get_local $6)
)
)
;;@ assembly/index.ts:96:6
(set_local $8
;;@ assembly/index.ts:96:14
(f64.load offset=48
(get_local $7)
)
)
;;@ assembly/index.ts:97:6
(set_local $2
(f64.add
(get_local $2)
;;@ assembly/index.ts:97:12
(f64.mul
(f64.load offset=24
(get_local $7)
)
;;@ assembly/index.ts:97:19
(get_local $8)
)
)
)
;;@ assembly/index.ts:98:6
(set_local $3
(f64.add
(get_local $3)
;;@ assembly/index.ts:98:12
(f64.mul
(f64.load offset=32
(get_local $7)
)
;;@ assembly/index.ts:98:19
(get_local $8)
)
)
)
;;@ assembly/index.ts:99:6
(set_local $4
(f64.add
(get_local $4)
;;@ assembly/index.ts:99:12
(f64.mul
(f64.load offset=40
(get_local $7)
)
;;@ assembly/index.ts:99:19
(get_local $8)
)
)
)
)
;;@ assembly/index.ts:94:30
(set_local $6
(i32.add
(get_local $6)
(i32.const 1)
)
)
(br $repeat|0)
)
)
;;@ assembly/index.ts:101:14
(drop
(call $assembly/index/Body#offsetMomentum
;;@ assembly/index.ts:101:4
(call $~lib/array/Array<Body>#__get
(get_local $1)
;;@ assembly/index.ts:101:11
(i32.const 0)
)
;;@ assembly/index.ts:101:29
(get_local $2)
;;@ assembly/index.ts:101:33
(get_local $3)
;;@ assembly/index.ts:101:37
(get_local $4)
)
) )
) )
(tee_local $0 (tee_local $0
@ -1399,7 +1391,7 @@
) )
(func $assembly/index/init (; 18 ;) (type $v) (func $assembly/index/init (; 18 ;) (type $v)
(local $0 i32) (local $0 i32)
;;@ assembly/index.ts:190:29 ;;@ assembly/index.ts:191:2
(set_global $assembly/index/system (set_global $assembly/index/system
;;@ assembly/index.ts:191:11 ;;@ assembly/index.ts:191:11
(call $assembly/index/NBodySystem#constructor (call $assembly/index/NBodySystem#constructor
@ -2215,7 +2207,7 @@
) )
(func $assembly/index/bench (; 23 ;) (type $iv) (param $0 i32) (func $assembly/index/bench (; 23 ;) (type $iv) (param $0 i32)
(local $1 i32) (local $1 i32)
;;@ assembly/index.ts:210:40 ;;@ assembly/index.ts:211:2
(block $break|0 (block $break|0
;;@ assembly/index.ts:211:7 ;;@ assembly/index.ts:211:7
(set_local $1 (set_local $1

View File

@ -1,7 +1,7 @@
(module (module
(type $iv (func (param i32))) (type $iv (func (param i32)))
(type $i (func (result i32)))
(type $v (func)) (type $v (func))
(type $i (func (result i32)))
(type $I (func (result i64))) (type $I (func (result i64)))
(type $iiv (func (param i32 i32))) (type $iiv (func (param i32 i32)))
(type $fv (func (param f32))) (type $fv (func (param f32)))

View File

@ -1,7 +1,7 @@
(module (module
(type $iv (func (param i32))) (type $iv (func (param i32)))
(type $i (func (result i32)))
(type $v (func)) (type $v (func))
(type $i (func (result i32)))
(type $I (func (result i64))) (type $I (func (result i64)))
(type $iiv (func (param i32 i32))) (type $iiv (func (param i32 i32)))
(type $fv (func (param f32))) (type $fv (func (param f32)))
@ -39,7 +39,7 @@
(global $assembly/pson/Token.STRING_ADD i32 (i32.const 253)) (global $assembly/pson/Token.STRING_ADD i32 (i32.const 253))
(global $assembly/pson/Token.STRING_GET i32 (i32.const 254)) (global $assembly/pson/Token.STRING_GET i32 (i32.const 254))
(global $assembly/pson/Token.BINARY i32 (i32.const 255)) (global $assembly/pson/Token.BINARY i32 (i32.const 255))
(global $HEAP_BASE i32 (i32.const 4)) (global $HEAP_BASE i32 (i32.const 8))
(memory $0 1) (memory $0 1)
(export "decode" (func $assembly/pson/decode)) (export "decode" (func $assembly/pson/decode))
(export "memory" (memory $0)) (export "memory" (memory $0))
@ -58,8 +58,6 @@
;;@ assembly/pson.ts:136:19 ;;@ assembly/pson.ts:136:19
(i32.const 0) (i32.const 0)
) )
;;@ assembly/pson.ts:137:2
(nop)
;;@ assembly/pson.ts:138:2 ;;@ assembly/pson.ts:138:2
(block $break|0 (block $break|0
(loop $continue|0 (loop $continue|0
@ -129,9 +127,7 @@
) )
) )
;;@ assembly/pson.ts:142:9 ;;@ assembly/pson.ts:142:9
(return (get_local $0)
(get_local $0)
)
) )
(func $assembly/pson/readVarint64 (; 15 ;) (type $I) (result i64) (func $assembly/pson/readVarint64 (; 15 ;) (type $I) (result i64)
(local $0 i64) (local $0 i64)
@ -149,8 +145,6 @@
;;@ assembly/pson.ts:147:19 ;;@ assembly/pson.ts:147:19
(i64.const 0) (i64.const 0)
) )
;;@ assembly/pson.ts:148:2
(nop)
;;@ assembly/pson.ts:149:2 ;;@ assembly/pson.ts:149:2
(block $break|0 (block $break|0
(loop $continue|0 (loop $continue|0
@ -222,9 +216,7 @@
) )
) )
;;@ assembly/pson.ts:153:9 ;;@ assembly/pson.ts:153:9
(return (get_local $0)
(get_local $0)
)
) )
(func $assembly/pson/decodeValue (; 16 ;) (type $v) (func $assembly/pson/decodeValue (; 16 ;) (type $v)
(local $0 i32) (local $0 i32)
@ -250,10 +242,6 @@
) )
) )
) )
;;@ assembly/pson.ts:49:2
(nop)
;;@ assembly/pson.ts:50:2
(nop)
;;@ assembly/pson.ts:51:2 ;;@ assembly/pson.ts:51:2
(block $break|0 (block $break|0
(block $case16|0 (block $case16|0

View File

@ -5,7 +5,7 @@
(type $v (func)) (type $v (func))
(global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0))
(global $assembly/ugc/GC (mut i32) (i32.const 0)) (global $assembly/ugc/GC (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4)) (global $HEAP_BASE i32 (i32.const 8))
(memory $0 1) (memory $0 1)
(export "gc_collect" (func $assembly/ugc/gc_collect)) (export "gc_collect" (func $assembly/ugc/gc_collect))
(export "gc_pause" (func $assembly/ugc/gc_pause)) (export "gc_pause" (func $assembly/ugc/gc_pause))
@ -14,9 +14,7 @@
(start $start) (start $start)
(func $assembly/ugc/Control.create (; 0 ;) (type $ii) (param $0 i32) (result i32) (func $assembly/ugc/Control.create (; 0 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(local $2 i32)
(i32.store (i32.store
;;@ assembly/ugc.ts:112:15
(get_local $0) (get_local $0)
(i32.or (i32.or
(get_local $0) (get_local $0)
@ -41,15 +39,12 @@
) )
) )
(i32.store (i32.store
;;@ assembly/ugc.ts:113:4
(tee_local $1 (tee_local $1
;;@ assembly/ugc.ts:113:4 ;;@ assembly/ugc.ts:113:15
(tee_local $2 (i32.add
;;@ assembly/ugc.ts:113:15 (get_local $0)
(i32.add (i32.const 8)
;;@ assembly/ugc.ts:113:40
(get_local $0)
(i32.const 8)
)
) )
) )
(i32.or (i32.or
@ -76,7 +71,6 @@
) )
;;@ assembly/ugc.ts:116:4 ;;@ assembly/ugc.ts:116:4
(i32.store8 offset=28 (i32.store8 offset=28
;;@ assembly/ugc.ts:111:18
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:116:20 ;;@ assembly/ugc.ts:116:20
(i32.const 0) (i32.const 0)
@ -90,14 +84,12 @@
;;@ assembly/ugc.ts:118:4 ;;@ assembly/ugc.ts:118:4
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:118:19
(get_local $0) (get_local $0)
) )
;;@ assembly/ugc.ts:119:4 ;;@ assembly/ugc.ts:119:4
(i32.store offset=20 (i32.store offset=20
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:119:17 (get_local $1)
(get_local $2)
) )
;;@ assembly/ugc.ts:120:4 ;;@ assembly/ugc.ts:120:4
(i32.store offset=24 (i32.store offset=24
@ -107,11 +99,14 @@
(get_local $0) (get_local $0)
) )
) )
;;@ assembly/ugc.ts:121:11
(get_local $0) (get_local $0)
) )
(func $assembly/ugc/Control#set:paused (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) (func $assembly/ugc/Control#set:paused (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(set_local $2
;;@ assembly/ugc.ts:102:4
(get_local $0)
)
;;@ assembly/ugc.ts:102:17 ;;@ assembly/ugc.ts:102:17
(if (if
(i32.and (i32.and
@ -119,12 +114,12 @@
(i32.const 1) (i32.const 1)
) )
(i32.store8 offset=28 (i32.store8 offset=28
;;@ assembly/ugc.ts:103:8 (get_local $2)
(get_local $0) (tee_local $0
(tee_local $2
(i32.or (i32.or
;;@ assembly/ugc.ts:103:8
(i32.load8_u offset=28 (i32.load8_u offset=28
(get_local $0) (get_local $2)
) )
;;@ assembly/ugc.ts:103:22 ;;@ assembly/ugc.ts:103:22
(i32.const 128) (i32.const 128)
@ -132,23 +127,22 @@
) )
) )
(i32.store8 offset=28 (i32.store8 offset=28
;;@ assembly/ugc.ts:104:8 (get_local $2)
(get_local $0) (tee_local $0
(tee_local $2
(i32.and (i32.and
;;@ assembly/ugc.ts:104:8
(i32.load8_u offset=28 (i32.load8_u offset=28
(get_local $0) (get_local $2)
) )
(i32.const -129) (i32.const -129)
) )
) )
) )
) )
;;@ assembly/ugc.ts:101:27 ;;@ assembly/ugc.ts:102:4
(i32.store8 offset=28 (i32.store8 offset=28
;;@ assembly/ugc.ts:102:4
(get_local $0)
(get_local $2) (get_local $2)
(get_local $0)
) )
) )
(func $~lib/allocator/tlsf/Root#remove (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32) (func $~lib/allocator/tlsf/Root#remove (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
@ -175,22 +169,18 @@
;;@ ~lib/allocator/tlsf.ts:264:15 ;;@ ~lib/allocator/tlsf.ts:264:15
(i32.const 256) (i32.const 256)
) )
;;@ ~lib/allocator/tlsf.ts:264:24
(block (result i32) (block (result i32)
;;@ ~lib/allocator/tlsf.ts:266:6 ;;@ ~lib/allocator/tlsf.ts:266:6
(set_local $4 (set_local $4
;;@ ~lib/allocator/tlsf.ts:266:11 ;;@ ~lib/allocator/tlsf.ts:266:11
(i32.div_u (i32.div_u
;;@ ~lib/allocator/tlsf.ts:266:17
(get_local $2) (get_local $2)
;;@ ~lib/allocator/tlsf.ts:266:24 ;;@ ~lib/allocator/tlsf.ts:266:24
(i32.const 8) (i32.const 8)
) )
) )
;;@ ~lib/allocator/tlsf.ts:265:11
(i32.const 0) (i32.const 0)
) )
;;@ ~lib/allocator/tlsf.ts:267:11
(block (result i32) (block (result i32)
;;@ ~lib/allocator/tlsf.ts:269:6 ;;@ ~lib/allocator/tlsf.ts:269:6
(set_local $4 (set_local $4
@ -198,7 +188,6 @@
(i32.xor (i32.xor
;;@ ~lib/allocator/tlsf.ts:269:17 ;;@ ~lib/allocator/tlsf.ts:269:17
(i32.shr_u (i32.shr_u
;;@ ~lib/allocator/tlsf.ts:269:18
(get_local $2) (get_local $2)
;;@ ~lib/allocator/tlsf.ts:269:26 ;;@ ~lib/allocator/tlsf.ts:269:26
(i32.sub (i32.sub
@ -207,7 +196,6 @@
(i32.sub (i32.sub
(i32.const 31) (i32.const 31)
(i32.clz (i32.clz
;;@ ~lib/allocator/tlsf.ts:268:22
(get_local $2) (get_local $2)
) )
) )
@ -220,9 +208,7 @@
) )
) )
(i32.sub (i32.sub
;;@ ~lib/allocator/tlsf.ts:270:6
(get_local $3) (get_local $3)
;;@ ~lib/allocator/tlsf.ts:270:12
(i32.const 7) (i32.const 7)
) )
) )
@ -247,18 +233,15 @@
;;@ ~lib/allocator/tlsf.ts:276:14 ;;@ ~lib/allocator/tlsf.ts:276:14
(i32.store offset=8 (i32.store offset=8
(get_local $5) (get_local $5)
;;@ ~lib/allocator/tlsf.ts:276:26
(get_local $2) (get_local $2)
) )
) )
;;@ ~lib/allocator/tlsf.ts:277:4 ;;@ ~lib/allocator/tlsf.ts:277:4
(if (if
;;@ ~lib/allocator/tlsf.ts:277:8
(get_local $2) (get_local $2)
;;@ ~lib/allocator/tlsf.ts:277:14 ;;@ ~lib/allocator/tlsf.ts:277:14
(i32.store offset=4 (i32.store offset=4
(get_local $2) (get_local $2)
;;@ ~lib/allocator/tlsf.ts:277:26
(get_local $5) (get_local $5)
) )
) )
@ -269,16 +252,13 @@
(get_local $1) (get_local $1)
(i32.load offset=96 (i32.load offset=96
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:280:17
(get_local $0) (get_local $0)
(i32.shl (i32.shl
(i32.add (i32.add
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:280:30
(get_local $3) (get_local $3)
(i32.const 5) (i32.const 5)
) )
;;@ ~lib/allocator/tlsf.ts:280:34
(get_local $4) (get_local $4)
) )
(i32.const 2) (i32.const 2)
@ -290,39 +270,32 @@
(block (block
(i32.store offset=96 (i32.store offset=96
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:281:6
(get_local $0) (get_local $0)
(i32.shl (i32.shl
(i32.add (i32.add
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:281:19
(get_local $3) (get_local $3)
(i32.const 5) (i32.const 5)
) )
;;@ ~lib/allocator/tlsf.ts:281:23
(get_local $4) (get_local $4)
) )
(i32.const 2) (i32.const 2)
) )
) )
;;@ ~lib/allocator/tlsf.ts:281:27
(get_local $2) (get_local $2)
) )
;;@ ~lib/allocator/tlsf.ts:284:6 ;;@ ~lib/allocator/tlsf.ts:284:6
(if (if
;;@ ~lib/allocator/tlsf.ts:284:10 ;;@ ~lib/allocator/tlsf.ts:284:10
(i32.eqz (i32.eqz
;;@ ~lib/allocator/tlsf.ts:284:11
(get_local $2) (get_local $2)
) )
;;@ ~lib/allocator/tlsf.ts:284:17 ;;@ ~lib/allocator/tlsf.ts:284:17
(block (block
(i32.store offset=4 (i32.store offset=4
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:286:8
(get_local $0) (get_local $0)
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:286:22
(get_local $3) (get_local $3)
(i32.const 2) (i32.const 2)
) )
@ -332,10 +305,8 @@
(i32.and (i32.and
(i32.load offset=4 (i32.load offset=4
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:285:20
(get_local $0) (get_local $0)
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:285:34
(get_local $3) (get_local $3)
(i32.const 2) (i32.const 2)
) )
@ -347,7 +318,6 @@
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:286:37 ;;@ ~lib/allocator/tlsf.ts:286:37
(i32.const 1) (i32.const 1)
;;@ ~lib/allocator/tlsf.ts:286:42
(get_local $4) (get_local $4)
) )
(i32.const -1) (i32.const -1)
@ -359,7 +329,6 @@
(if (if
;;@ ~lib/allocator/tlsf.ts:289:12 ;;@ ~lib/allocator/tlsf.ts:289:12
(i32.eqz (i32.eqz
;;@ ~lib/allocator/tlsf.ts:289:13
(get_local $1) (get_local $1)
) )
;;@ ~lib/allocator/tlsf.ts:289:20 ;;@ ~lib/allocator/tlsf.ts:289:20
@ -375,7 +344,6 @@
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:289:36 ;;@ ~lib/allocator/tlsf.ts:289:36
(i32.const 1) (i32.const 1)
;;@ ~lib/allocator/tlsf.ts:289:41
(get_local $3) (get_local $3)
) )
(i32.const -1) (i32.const -1)
@ -412,7 +380,6 @@
(tee_local $4 (tee_local $4
(i32.add (i32.add
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:197:30
(get_local $1) (get_local $1)
(i32.const 8) (i32.const 8)
) )
@ -433,9 +400,7 @@
(block (block
;;@ ~lib/allocator/tlsf.ts:202:11 ;;@ ~lib/allocator/tlsf.ts:202:11
(call $~lib/allocator/tlsf/Root#remove (call $~lib/allocator/tlsf/Root#remove
;;@ ~lib/allocator/tlsf.ts:202:6
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:202:18
(get_local $4) (get_local $4)
) )
;;@ ~lib/allocator/tlsf.ts:203:6 ;;@ ~lib/allocator/tlsf.ts:203:6
@ -444,13 +409,11 @@
;;@ ~lib/allocator/tlsf.ts:203:19 ;;@ ~lib/allocator/tlsf.ts:203:19
(tee_local $2 (tee_local $2
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:203:20
(get_local $2) (get_local $2)
;;@ ~lib/allocator/tlsf.ts:203:33 ;;@ ~lib/allocator/tlsf.ts:203:33
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:203:46 ;;@ ~lib/allocator/tlsf.ts:203:46
(i32.and (i32.and
;;@ ~lib/allocator/tlsf.ts:203:47
(get_local $5) (get_local $5)
(i32.const -4) (i32.const -4)
) )
@ -468,7 +431,6 @@
(tee_local $4 (tee_local $4
(i32.add (i32.add
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:204:14
(get_local $1) (get_local $1)
(i32.const 8) (i32.const 8)
) )
@ -502,7 +464,6 @@
(tee_local $1 (tee_local $1
(i32.load (i32.load
(i32.sub (i32.sub
;;@ ~lib/allocator/tlsf.ts:211:31
(get_local $1) (get_local $1)
(i32.const 4) (i32.const 4)
) )
@ -512,9 +473,7 @@
) )
;;@ ~lib/allocator/tlsf.ts:214:11 ;;@ ~lib/allocator/tlsf.ts:214:11
(call $~lib/allocator/tlsf/Root#remove (call $~lib/allocator/tlsf/Root#remove
;;@ ~lib/allocator/tlsf.ts:214:6
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:214:18
(get_local $1) (get_local $1)
) )
;;@ ~lib/allocator/tlsf.ts:215:6 ;;@ ~lib/allocator/tlsf.ts:215:6
@ -523,13 +482,11 @@
;;@ ~lib/allocator/tlsf.ts:215:18 ;;@ ~lib/allocator/tlsf.ts:215:18
(tee_local $3 (tee_local $3
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:215:19
(get_local $3) (get_local $3)
;;@ ~lib/allocator/tlsf.ts:215:31 ;;@ ~lib/allocator/tlsf.ts:215:31
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:215:44 ;;@ ~lib/allocator/tlsf.ts:215:44
(i32.and (i32.and
;;@ ~lib/allocator/tlsf.ts:215:45
(get_local $2) (get_local $2)
(i32.const -4) (i32.const -4)
) )
@ -541,7 +498,6 @@
) )
;;@ ~lib/allocator/tlsf.ts:217:6 ;;@ ~lib/allocator/tlsf.ts:217:6
(set_local $2 (set_local $2
;;@ ~lib/allocator/tlsf.ts:217:18
(get_local $3) (get_local $3)
) )
) )
@ -558,18 +514,14 @@
) )
(i32.store (i32.store
(i32.sub (i32.sub
;;@ ~lib/allocator/tlsf.ts:222:24
(get_local $4) (get_local $4)
(i32.const 4) (i32.const 4)
) )
;;@ ~lib/allocator/tlsf.ts:222:17
(get_local $1) (get_local $1)
) )
;;@ ~lib/allocator/tlsf.ts:240:4
(set_local $4 (set_local $4
(i32.load offset=96 (i32.load offset=96
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:240:15
(get_local $0) (get_local $0)
(i32.shl (i32.shl
(i32.add (i32.add
@ -590,22 +542,18 @@
;;@ ~lib/allocator/tlsf.ts:230:15 ;;@ ~lib/allocator/tlsf.ts:230:15
(i32.const 256) (i32.const 256)
) )
;;@ ~lib/allocator/tlsf.ts:230:24
(block (result i32) (block (result i32)
;;@ ~lib/allocator/tlsf.ts:232:6 ;;@ ~lib/allocator/tlsf.ts:232:6
(set_local $3 (set_local $3
;;@ ~lib/allocator/tlsf.ts:232:11 ;;@ ~lib/allocator/tlsf.ts:232:11
(i32.div_u (i32.div_u
;;@ ~lib/allocator/tlsf.ts:232:17
(get_local $3) (get_local $3)
;;@ ~lib/allocator/tlsf.ts:232:24 ;;@ ~lib/allocator/tlsf.ts:232:24
(i32.const 8) (i32.const 8)
) )
) )
;;@ ~lib/allocator/tlsf.ts:231:11
(i32.const 0) (i32.const 0)
) )
;;@ ~lib/allocator/tlsf.ts:233:11
(block (result i32) (block (result i32)
;;@ ~lib/allocator/tlsf.ts:235:6 ;;@ ~lib/allocator/tlsf.ts:235:6
(set_local $3 (set_local $3
@ -613,7 +561,6 @@
(i32.xor (i32.xor
;;@ ~lib/allocator/tlsf.ts:235:17 ;;@ ~lib/allocator/tlsf.ts:235:17
(i32.shr_u (i32.shr_u
;;@ ~lib/allocator/tlsf.ts:235:18
(get_local $3) (get_local $3)
;;@ ~lib/allocator/tlsf.ts:235:26 ;;@ ~lib/allocator/tlsf.ts:235:26
(i32.sub (i32.sub
@ -622,7 +569,6 @@
(i32.sub (i32.sub
(i32.const 31) (i32.const 31)
(i32.clz (i32.clz
;;@ ~lib/allocator/tlsf.ts:234:22
(get_local $3) (get_local $3)
) )
) )
@ -635,9 +581,7 @@
) )
) )
(i32.sub (i32.sub
;;@ ~lib/allocator/tlsf.ts:236:6
(get_local $2) (get_local $2)
;;@ ~lib/allocator/tlsf.ts:236:12
(i32.const 7) (i32.const 7)
) )
) )
@ -645,7 +589,6 @@
) )
(i32.const 5) (i32.const 5)
) )
;;@ ~lib/allocator/tlsf.ts:240:32
(get_local $3) (get_local $3)
) )
(i32.const 2) (i32.const 2)
@ -662,38 +605,31 @@
;;@ ~lib/allocator/tlsf.ts:242:4 ;;@ ~lib/allocator/tlsf.ts:242:4
(i32.store offset=8 (i32.store offset=8
(get_local $1) (get_local $1)
;;@ ~lib/allocator/tlsf.ts:242:17
(get_local $4) (get_local $4)
) )
;;@ ~lib/allocator/tlsf.ts:243:4 ;;@ ~lib/allocator/tlsf.ts:243:4
(if (if
;;@ ~lib/allocator/tlsf.ts:243:8
(get_local $4) (get_local $4)
;;@ ~lib/allocator/tlsf.ts:243:14 ;;@ ~lib/allocator/tlsf.ts:243:14
(i32.store offset=4 (i32.store offset=4
(get_local $4) (get_local $4)
;;@ ~lib/allocator/tlsf.ts:243:26
(get_local $1) (get_local $1)
) )
) )
(i32.store offset=96 (i32.store offset=96
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:244:4
(get_local $0) (get_local $0)
(i32.shl (i32.shl
(i32.add (i32.add
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:244:17
(get_local $2) (get_local $2)
(i32.const 5) (i32.const 5)
) )
;;@ ~lib/allocator/tlsf.ts:244:21
(get_local $3) (get_local $3)
) )
(i32.const 2) (i32.const 2)
) )
) )
;;@ ~lib/allocator/tlsf.ts:244:25
(get_local $1) (get_local $1)
) )
;;@ ~lib/allocator/tlsf.ts:247:4 ;;@ ~lib/allocator/tlsf.ts:247:4
@ -707,17 +643,14 @@
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:247:19 ;;@ ~lib/allocator/tlsf.ts:247:19
(i32.const 1) (i32.const 1)
;;@ ~lib/allocator/tlsf.ts:247:24
(get_local $2) (get_local $2)
) )
) )
) )
(i32.store offset=4 (i32.store offset=4
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:248:4
(get_local $0) (get_local $0)
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:248:18
(get_local $2) (get_local $2)
(i32.const 2) (i32.const 2)
) )
@ -728,7 +661,6 @@
(i32.add (i32.add
(get_local $0) (get_local $0)
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:248:36
(get_local $2) (get_local $2)
(i32.const 2) (i32.const 2)
) )
@ -738,7 +670,6 @@
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:248:43 ;;@ ~lib/allocator/tlsf.ts:248:43
(i32.const 1) (i32.const 1)
;;@ ~lib/allocator/tlsf.ts:248:48
(get_local $3) (get_local $3)
) )
) )
@ -747,9 +678,8 @@
(func $~lib/allocator/tlsf/free_memory (; 4 ;) (type $iv) (param $0 i32) (func $~lib/allocator/tlsf/free_memory (; 4 ;) (type $iv) (param $0 i32)
(local $1 i32) (local $1 i32)
(local $2 i32) (local $2 i32)
;;@ ~lib/allocator/tlsf.ts:491:47 ;;@ ~lib/allocator/tlsf.ts:492:2
(if (if
;;@ ~lib/allocator/tlsf.ts:492:6
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:494:4 ;;@ ~lib/allocator/tlsf.ts:494:4
(if (if
@ -760,39 +690,35 @@
) )
;;@ ~lib/allocator/tlsf.ts:494:14 ;;@ ~lib/allocator/tlsf.ts:494:14
(block (block
;;@ ~lib/allocator/tlsf.ts:498:6 ;;@ ~lib/allocator/tlsf.ts:496:6
(i32.store (set_local $2
;;@ ~lib/allocator/tlsf.ts:495:6 ;;@ ~lib/allocator/tlsf.ts:496:22
(tee_local $2 (i32.load
;;@ ~lib/allocator/tlsf.ts:495:18 ;;@ ~lib/allocator/tlsf.ts:495:6
(i32.sub (tee_local $0
;;@ ~lib/allocator/tlsf.ts:495:36 ;;@ ~lib/allocator/tlsf.ts:495:18
(get_local $0) (i32.sub
;;@ ~lib/allocator/tlsf.ts:495:43 (get_local $0)
(i32.const 8) ;;@ ~lib/allocator/tlsf.ts:495:43
(i32.const 8)
)
) )
) )
)
;;@ ~lib/allocator/tlsf.ts:498:6
(i32.store
(get_local $0)
;;@ ~lib/allocator/tlsf.ts:498:19 ;;@ ~lib/allocator/tlsf.ts:498:19
(i32.or (i32.or
;;@ ~lib/allocator/tlsf.ts:496:22 (get_local $2)
(i32.load
(get_local $2)
)
;;@ ~lib/allocator/tlsf.ts:498:31 ;;@ ~lib/allocator/tlsf.ts:498:31
(i32.const 1) (i32.const 1)
) )
) )
;;@ ~lib/allocator/tlsf.ts:499:11 ;;@ ~lib/allocator/tlsf.ts:499:11
(call $~lib/allocator/tlsf/Root#insert (call $~lib/allocator/tlsf/Root#insert
;;@ ~lib/allocator/tlsf.ts:499:6
(get_local $1) (get_local $1)
;;@ ~lib/allocator/tlsf.ts:499:18 (get_local $0)
(i32.sub
;;@ ~lib/allocator/tlsf.ts:499:36
(get_local $0)
;;@ ~lib/allocator/tlsf.ts:499:43
(i32.const 8)
)
) )
) )
) )
@ -801,20 +727,34 @@
(func $assembly/ugc/Control#step (; 5 ;) (type $iv) (param $0 i32) (func $assembly/ugc/Control#step (; 5 ;) (type $iv) (param $0 i32)
(local $1 i32) (local $1 i32)
(local $2 i32) (local $2 i32)
;;@ assembly/ugc.ts:163:15 ;;@ assembly/ugc.ts:165:4
(block $break|0 (block $break|0
(block $case2|0 (block $case2|0
(block $case1|0 (block $case1|0
(block $case0|0 (if
(block $tablify|0 (tee_local $1
(br_table $case0|0 $case1|0 $case2|0 $tablify|0 ;;@ assembly/ugc.ts:165:12
;;@ assembly/ugc.ts:165:12 (i32.load8_u offset=28
(i32.load8_u offset=28 (get_local $0)
(get_local $0)
)
) )
) )
(br $break|0) (block
(br_if $case1|0
(i32.eq
(get_local $1)
;;@ assembly/ugc.ts:172:11
(i32.const 1)
)
)
(br_if $case2|0
(i32.eq
(get_local $1)
;;@ assembly/ugc.ts:194:11
(i32.const 2)
)
)
(br $break|0)
)
) )
;;@ assembly/ugc.ts:169:8 ;;@ assembly/ugc.ts:169:8
(i32.store8 offset=28 (i32.store8 offset=28
@ -858,18 +798,15 @@
;;@ assembly/ugc.ts:177:10 ;;@ assembly/ugc.ts:177:10
(i32.store offset=24 (i32.store offset=24
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:177:26
(get_local $1) (get_local $1)
) )
(i32.store (i32.store
;;@ assembly/ugc.ts:178:10
(get_local $1) (get_local $1)
(i32.or (i32.or
(i32.load (i32.load
(get_local $1) (get_local $1)
) )
(i32.xor (i32.xor
;;@ assembly/ugc.ts:178:22
(get_local $2) (get_local $2)
;;@ assembly/ugc.ts:178:30 ;;@ assembly/ugc.ts:178:30
(i32.const 1) (i32.const 1)
@ -877,7 +814,6 @@
) )
) )
(if (if
;;@ assembly/ugc.ts:179:27
(get_local $1) (get_local $1)
(drop (drop
(i32.load offset=8 (i32.load offset=8
@ -924,7 +860,6 @@
;;@ assembly/ugc.ts:186:12 ;;@ assembly/ugc.ts:186:12
(i32.store offset=20 (i32.store offset=20
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:186:22
(get_local $1) (get_local $1)
) )
;;@ assembly/ugc.ts:187:12 ;;@ assembly/ugc.ts:187:12
@ -942,7 +877,6 @@
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:188:28 ;;@ assembly/ugc.ts:188:28
(i32.load (i32.load
;;@ assembly/ugc.ts:188:53
(get_local $1) (get_local $1)
) )
) )
@ -981,7 +915,6 @@
(get_local $0) (get_local $0)
(i32.and (i32.and
(i32.load (i32.load
;;@ assembly/ugc.ts:197:26
(get_local $1) (get_local $1)
) )
(i32.const -4) (i32.const -4)
@ -990,7 +923,6 @@
(drop (drop
(i32.load (i32.load
(i32.add (i32.add
;;@ assembly/ugc.ts:198:27
(get_local $1) (get_local $1)
(i32.const 8) (i32.const 8)
) )
@ -1092,23 +1024,20 @@
;;@ assembly/ugc.ts:268:2 ;;@ assembly/ugc.ts:268:2
(call $assembly/ugc/Control#set:paused (call $assembly/ugc/Control#set:paused
(get_global $assembly/ugc/GC) (get_global $assembly/ugc/GC)
;;@ assembly/ugc.ts:268:14
(get_local $1) (get_local $1)
) )
) )
(func $assembly/ugc/gc_pause (; 7 ;) (type $v) (func $assembly/ugc/gc_pause (; 7 ;) (type $v)
;;@ assembly/ugc.ts:254:33 ;;@ assembly/ugc.ts:255:2
(call $assembly/ugc/Control#set:paused (call $assembly/ugc/Control#set:paused
;;@ assembly/ugc.ts:255:2
(get_global $assembly/ugc/GC) (get_global $assembly/ugc/GC)
;;@ assembly/ugc.ts:255:14 ;;@ assembly/ugc.ts:255:14
(i32.const 1) (i32.const 1)
) )
) )
(func $assembly/ugc/gc_resume (; 8 ;) (type $v) (func $assembly/ugc/gc_resume (; 8 ;) (type $v)
;;@ assembly/ugc.ts:259:34 ;;@ assembly/ugc.ts:260:2
(call $assembly/ugc/Control#set:paused (call $assembly/ugc/Control#set:paused
;;@ assembly/ugc.ts:260:2
(get_global $assembly/ugc/GC) (get_global $assembly/ugc/GC)
;;@ assembly/ugc.ts:260:14 ;;@ assembly/ugc.ts:260:14
(i32.const 0) (i32.const 0)

View File

@ -1,5 +1,4 @@
(module (module
(type $i (func (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32))) (type $iiiiv (func (param i32 i32 i32 i32)))
(type $ii (func (param i32) (result i32))) (type $ii (func (param i32) (result i32)))
(type $iv (func (param i32))) (type $iv (func (param i32)))
@ -8,7 +7,7 @@
(type $iiii (func (param i32 i32 i32) (result i32))) (type $iiii (func (param i32 i32 i32) (result i32)))
(type $iii (func (param i32 i32) (result i32))) (type $iii (func (param i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32))) (type $iiiv (func (param i32 i32 i32)))
(import "env" "abort" (func $abort (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) (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_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
@ -27,19 +26,18 @@
(global $assembly/ugc/SWEEP i32 (i32.const 2)) (global $assembly/ugc/SWEEP i32 (i32.const 2))
(global $assembly/ugc/GRAY i32 (i32.const 2)) (global $assembly/ugc/GRAY i32 (i32.const 2))
(global $assembly/ugc/GC (mut i32) (i32.const 0)) (global $assembly/ugc/GC (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 88)) (global $HEAP_BASE i32 (i32.const 92))
(memory $0 1) (memory $0 1)
(data (i32.const 4) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00")
(data (i32.const 52) "\0f\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00u\00g\00c\00.\00t\00s\00") (data (i32.const 56) "\0f\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00u\00g\00c\00.\00t\00s\00")
(export "gc_collect" (func $assembly/ugc/gc_collect)) (export "gc_collect" (func $assembly/ugc/gc_collect))
(export "gc_pause" (func $assembly/ugc/gc_pause)) (export "gc_pause" (func $assembly/ugc/gc_pause))
(export "gc_resume" (func $assembly/ugc/gc_resume)) (export "gc_resume" (func $assembly/ugc/gc_resume))
(export "memory" (memory $0)) (export "memory" (memory $0))
(start $start) (start $start)
(func $assembly/ugc/ObjectHeader#set:next (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) (func $assembly/ugc/ObjectHeader#set:next (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
;;@ assembly/ugc.ts:32:32 ;;@ assembly/ugc.ts:33:4
(i32.store (i32.store
;;@ assembly/ugc.ts:33:4
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:33:23 ;;@ assembly/ugc.ts:33:23
(i32.or (i32.or
@ -57,9 +55,8 @@
) )
) )
(func $assembly/ugc/ObjectHeader#set:prev (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32) (func $assembly/ugc/ObjectHeader#set:prev (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
;;@ assembly/ugc.ts:40:32 ;;@ assembly/ugc.ts:41:4
(i32.store offset=4 (i32.store offset=4
;;@ assembly/ugc.ts:41:4
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:41:23 ;;@ assembly/ugc.ts:41:23
(i32.or (i32.or
@ -161,33 +158,28 @@
) )
) )
;;@ assembly/ugc.ts:121:11 ;;@ assembly/ugc.ts:121:11
(return (get_local $1)
(get_local $1)
)
) )
(func $assembly/ugc/Control#get:paused (; 5 ;) (type $ii) (param $0 i32) (result i32) (func $assembly/ugc/Control#get:paused (; 5 ;) (type $ii) (param $0 i32) (result i32)
;;@ assembly/ugc.ts:99:21 ;;@ assembly/ugc.ts:99:67
(return (i32.ne
;;@ assembly/ugc.ts:99:30 ;;@ assembly/ugc.ts:99:30
(i32.ne (i32.and
(i32.and ;;@ assembly/ugc.ts:99:31
;;@ assembly/ugc.ts:99:31 (i32.load8_u offset=28
(i32.load8_u offset=28 (get_local $0)
(get_local $0)
)
;;@ assembly/ugc.ts:99:44
(i32.const 128)
) )
;;@ assembly/ugc.ts:99:67 ;;@ assembly/ugc.ts:99:44
(i32.const 0) (i32.const 128)
) )
;;@ assembly/ugc.ts:99:67
(i32.const 0)
) )
) )
(func $assembly/ugc/Control#set:paused (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32) (func $assembly/ugc/Control#set:paused (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
;;@ assembly/ugc.ts:101:27 ;;@ assembly/ugc.ts:102:4
(i32.store8 offset=28 (i32.store8 offset=28
;;@ assembly/ugc.ts:102:4
(get_local $0) (get_local $0)
;;@ assembly/ugc.ts:102:17 ;;@ assembly/ugc.ts:102:17
(if (result i32) (if (result i32)
@ -240,7 +232,7 @@
) )
(func $assembly/ugc/gc_scan_fn (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) (func $assembly/ugc/gc_scan_fn (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
;;@ assembly/ugc.ts:274:73 ;;@ assembly/ugc.ts:275:2
(if (if
;;@ assembly/ugc.ts:275:6 ;;@ assembly/ugc.ts:275:6
(i32.eqz (i32.eqz
@ -260,20 +252,17 @@
) )
) )
(func $assembly/ugc/ObjectHeader#get:next (; 8 ;) (type $ii) (param $0 i32) (result i32) (func $assembly/ugc/ObjectHeader#get:next (; 8 ;) (type $ii) (param $0 i32) (result i32)
;;@ assembly/ugc.ts:28:27 ;;@ assembly/ugc.ts:29:57
(return (i32.and
;;@ assembly/ugc.ts:29:11 ;;@ assembly/ugc.ts:29:36
(i32.and (i32.load
;;@ assembly/ugc.ts:29:36 (get_local $0)
(i32.load )
(get_local $0) ;;@ assembly/ugc.ts:29:55
) (i32.xor
;;@ assembly/ugc.ts:29:55 ;;@ assembly/ugc.ts:29:56
(i32.xor (i32.const 3)
;;@ assembly/ugc.ts:29:56 (i32.const -1)
(i32.const 3)
(i32.const -1)
)
) )
) )
) )
@ -289,9 +278,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 52) (i32.const 56)
(i32.const 49) (i32.const 49)
(i32.const 4) (i32.const 4)
) )
@ -330,9 +319,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 89) (i32.const 89)
(i32.const 4) (i32.const 4)
) )
@ -340,46 +329,43 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:94:4 ;;@ ~lib/allocator/tlsf.ts:94:4
(return (if (result i32)
;;@ ~lib/allocator/tlsf.ts:90:11 (i32.eqz
(if (result i32) (tee_local $1
(i32.eqz ;;@ ~lib/allocator/tlsf.ts:91:6
(tee_local $1 (i32.add
;;@ ~lib/allocator/tlsf.ts:91:6 ;;@ ~lib/allocator/tlsf.ts:92:8
(i32.add (i32.add
;;@ ~lib/allocator/tlsf.ts:92:8 (get_local $0)
(i32.add ;;@ ~lib/allocator/tlsf.ts:92:34
(i32.const 8)
)
;;@ ~lib/allocator/tlsf.ts:92:47
(i32.and
;;@ ~lib/allocator/tlsf.ts:92:48
(i32.load
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:92:34
(i32.const 8)
) )
;;@ ~lib/allocator/tlsf.ts:92:47 ;;@ ~lib/allocator/tlsf.ts:92:60
(i32.and (i32.xor
;;@ ~lib/allocator/tlsf.ts:92:48 ;;@ ~lib/allocator/tlsf.ts:92:61
(i32.load (i32.const 3)
(get_local $0) (i32.const -1)
)
;;@ ~lib/allocator/tlsf.ts:92:60
(i32.xor
;;@ ~lib/allocator/tlsf.ts:92:61
(i32.const 3)
(i32.const -1)
)
) )
) )
) )
) )
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 90)
(i32.const 11)
)
(unreachable)
)
(get_local $1)
) )
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 90)
(i32.const 11)
)
(unreachable)
)
(get_local $1)
) )
) )
(func $~lib/allocator/tlsf/fls<usize> (; 11 ;) (type $ii) (param $0 i32) (result i32) (func $~lib/allocator/tlsf/fls<usize> (; 11 ;) (type $ii) (param $0 i32) (result i32)
@ -394,9 +380,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 428) (i32.const 428)
(i32.const 2) (i32.const 2)
) )
@ -404,15 +390,13 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:430:26 ;;@ ~lib/allocator/tlsf.ts:430:26
(return (i32.sub
;;@ ~lib/allocator/tlsf.ts:430:9 ;;@ ~lib/allocator/tlsf.ts:430:9
(i32.sub (i32.const 31)
(i32.const 31) ;;@ ~lib/allocator/tlsf.ts:430:15
;;@ ~lib/allocator/tlsf.ts:430:15 (i32.clz
(i32.clz ;;@ ~lib/allocator/tlsf.ts:430:22
;;@ ~lib/allocator/tlsf.ts:430:22 (get_local $0)
(get_local $0)
)
) )
) )
) )
@ -428,9 +412,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 158) (i32.const 158)
(i32.const 4) (i32.const 4)
) )
@ -448,9 +432,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 159) (i32.const 159)
(i32.const 4) (i32.const 4)
) )
@ -458,27 +442,24 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:162:20 ;;@ ~lib/allocator/tlsf.ts:162:20
(return (i32.load offset=96
;;@ ~lib/allocator/tlsf.ts:160:11 ;;@ ~lib/allocator/tlsf.ts:161:6
(i32.load offset=96 (i32.add
;;@ ~lib/allocator/tlsf.ts:161:6 (get_local $0)
(i32.add ;;@ ~lib/allocator/tlsf.ts:161:32
(get_local $0) (i32.mul
;;@ ~lib/allocator/tlsf.ts:161:32 (i32.add
(i32.mul ;;@ ~lib/allocator/tlsf.ts:161:33
(i32.add (i32.mul
;;@ ~lib/allocator/tlsf.ts:161:33 (get_local $1)
(i32.mul ;;@ ~lib/allocator/tlsf.ts:161:38
(get_local $1) (i32.const 32)
;;@ ~lib/allocator/tlsf.ts:161:38
(i32.const 32)
)
;;@ ~lib/allocator/tlsf.ts:161:48
(get_local $2)
) )
;;@ ~lib/allocator/tlsf.ts:161:61 ;;@ ~lib/allocator/tlsf.ts:161:48
(i32.const 4) (get_local $2)
) )
;;@ ~lib/allocator/tlsf.ts:161:61
(i32.const 4)
) )
) )
) )
@ -495,9 +476,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 167) (i32.const 167)
(i32.const 4) (i32.const 4)
) )
@ -515,9 +496,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 168) (i32.const 168)
(i32.const 4) (i32.const 4)
) )
@ -561,9 +542,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 138) (i32.const 138)
(i32.const 4) (i32.const 4)
) )
@ -571,18 +552,15 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:139:68 ;;@ ~lib/allocator/tlsf.ts:139:68
(return (i32.load offset=4
;;@ ~lib/allocator/tlsf.ts:139:11 ;;@ ~lib/allocator/tlsf.ts:139:21
(i32.load offset=4 (i32.add
;;@ ~lib/allocator/tlsf.ts:139:21 (get_local $0)
(i32.add ;;@ ~lib/allocator/tlsf.ts:139:47
(get_local $0) (i32.mul
;;@ ~lib/allocator/tlsf.ts:139:47 (get_local $1)
(i32.mul ;;@ ~lib/allocator/tlsf.ts:139:52
(get_local $1) (i32.const 4)
;;@ ~lib/allocator/tlsf.ts:139:52
(i32.const 4)
)
) )
) )
) )
@ -599,9 +577,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 144) (i32.const 144)
(i32.const 4) (i32.const 4)
) )
@ -650,9 +628,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 258) (i32.const 258)
(i32.const 4) (i32.const 4)
) )
@ -694,9 +672,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 260) (i32.const 260)
(i32.const 4) (i32.const 4)
) )
@ -933,9 +911,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 81) (i32.const 81)
(i32.const 4) (i32.const 4)
) )
@ -943,33 +921,30 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:84:4 ;;@ ~lib/allocator/tlsf.ts:84:4
(return (if (result i32)
;;@ ~lib/allocator/tlsf.ts:82:11 (i32.eqz
(if (result i32) (tee_local $1
(i32.eqz ;;@ ~lib/allocator/tlsf.ts:83:6
(tee_local $1 (i32.load
;;@ ~lib/allocator/tlsf.ts:83:6 ;;@ ~lib/allocator/tlsf.ts:83:18
(i32.load (i32.sub
;;@ ~lib/allocator/tlsf.ts:83:18 (get_local $0)
(i32.sub ;;@ ~lib/allocator/tlsf.ts:83:44
(get_local $0) (i32.const 4)
;;@ ~lib/allocator/tlsf.ts:83:44
(i32.const 4)
)
) )
) )
) )
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 82)
(i32.const 11)
)
(unreachable)
)
(get_local $1)
) )
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 82)
(i32.const 11)
)
(unreachable)
)
(get_local $1)
) )
) )
(func $~lib/allocator/tlsf/Root#setJump (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/allocator/tlsf/Root#setJump (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
@ -986,9 +961,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 334) (i32.const 334)
(i32.const 4) (i32.const 4)
) )
@ -1008,9 +983,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 335) (i32.const 335)
(i32.const 4) (i32.const 4)
) )
@ -1030,9 +1005,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 336) (i32.const 336)
(i32.const 4) (i32.const 4)
) )
@ -1061,7 +1036,6 @@
(local $8 i32) (local $8 i32)
(local $9 i32) (local $9 i32)
(local $10 i32) (local $10 i32)
(local $11 i32)
;;@ ~lib/allocator/tlsf.ts:189:4 ;;@ ~lib/allocator/tlsf.ts:189:4
(if (if
(i32.eqz (i32.eqz
@ -1069,9 +1043,9 @@
(get_local $1) (get_local $1)
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 189) (i32.const 189)
(i32.const 4) (i32.const 4)
) )
@ -1096,9 +1070,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 191) (i32.const 191)
(i32.const 4) (i32.const 4)
) )
@ -1140,9 +1114,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 193) (i32.const 193)
(i32.const 4) (i32.const 4)
) )
@ -1162,9 +1136,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 197) (i32.const 197)
(i32.const 23) (i32.const 23)
) )
@ -1262,9 +1236,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 211) (i32.const 211)
(i32.const 24) (i32.const 24)
) )
@ -1291,9 +1265,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 213) (i32.const 213)
(i32.const 6) (i32.const 6)
) )
@ -1382,7 +1356,7 @@
(i32.eqz (i32.eqz
;;@ ~lib/allocator/tlsf.ts:226:11 ;;@ ~lib/allocator/tlsf.ts:226:11
(if (result i32) (if (result i32)
(tee_local $8 (tee_local $7
(i32.ge_u (i32.ge_u
(get_local $3) (get_local $3)
;;@ ~lib/allocator/tlsf.ts:226:19 ;;@ ~lib/allocator/tlsf.ts:226:19
@ -1395,13 +1369,13 @@
;;@ ~lib/allocator/tlsf.ts:226:44 ;;@ ~lib/allocator/tlsf.ts:226:44
(i32.const 1073741824) (i32.const 1073741824)
) )
(get_local $8) (get_local $7)
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 226) (i32.const 226)
(i32.const 4) (i32.const 4)
) )
@ -1419,12 +1393,12 @@
;;@ ~lib/allocator/tlsf.ts:230:24 ;;@ ~lib/allocator/tlsf.ts:230:24
(block (block
;;@ ~lib/allocator/tlsf.ts:231:6 ;;@ ~lib/allocator/tlsf.ts:231:6
(set_local $9 (set_local $8
;;@ ~lib/allocator/tlsf.ts:231:11 ;;@ ~lib/allocator/tlsf.ts:231:11
(i32.const 0) (i32.const 0)
) )
;;@ ~lib/allocator/tlsf.ts:232:6 ;;@ ~lib/allocator/tlsf.ts:232:6
(set_local $10 (set_local $9
;;@ ~lib/allocator/tlsf.ts:232:11 ;;@ ~lib/allocator/tlsf.ts:232:11
(i32.div_u (i32.div_u
;;@ ~lib/allocator/tlsf.ts:232:17 ;;@ ~lib/allocator/tlsf.ts:232:17
@ -1437,7 +1411,7 @@
;;@ ~lib/allocator/tlsf.ts:233:11 ;;@ ~lib/allocator/tlsf.ts:233:11
(block (block
;;@ ~lib/allocator/tlsf.ts:234:6 ;;@ ~lib/allocator/tlsf.ts:234:6
(set_local $9 (set_local $8
;;@ ~lib/allocator/tlsf.ts:234:11 ;;@ ~lib/allocator/tlsf.ts:234:11
(call $~lib/allocator/tlsf/fls<usize> (call $~lib/allocator/tlsf/fls<usize>
;;@ ~lib/allocator/tlsf.ts:234:22 ;;@ ~lib/allocator/tlsf.ts:234:22
@ -1445,7 +1419,7 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:235:6 ;;@ ~lib/allocator/tlsf.ts:235:6
(set_local $10 (set_local $9
;;@ ~lib/allocator/tlsf.ts:235:11 ;;@ ~lib/allocator/tlsf.ts:235:11
(i32.xor (i32.xor
;;@ ~lib/allocator/tlsf.ts:235:17 ;;@ ~lib/allocator/tlsf.ts:235:17
@ -1455,7 +1429,7 @@
;;@ ~lib/allocator/tlsf.ts:235:26 ;;@ ~lib/allocator/tlsf.ts:235:26
(i32.sub (i32.sub
;;@ ~lib/allocator/tlsf.ts:235:27 ;;@ ~lib/allocator/tlsf.ts:235:27
(get_local $9) (get_local $8)
;;@ ~lib/allocator/tlsf.ts:235:32 ;;@ ~lib/allocator/tlsf.ts:235:32
(i32.const 5) (i32.const 5)
) )
@ -1470,9 +1444,9 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:236:6 ;;@ ~lib/allocator/tlsf.ts:236:6
(set_local $9 (set_local $8
(i32.sub (i32.sub
(get_local $9) (get_local $8)
;;@ ~lib/allocator/tlsf.ts:236:12 ;;@ ~lib/allocator/tlsf.ts:236:12
(i32.sub (i32.sub
(i32.const 8) (i32.const 8)
@ -1484,15 +1458,15 @@
) )
) )
;;@ ~lib/allocator/tlsf.ts:240:4 ;;@ ~lib/allocator/tlsf.ts:240:4
(set_local $11 (set_local $10
;;@ ~lib/allocator/tlsf.ts:240:20 ;;@ ~lib/allocator/tlsf.ts:240:20
(call $~lib/allocator/tlsf/Root#getHead (call $~lib/allocator/tlsf/Root#getHead
;;@ ~lib/allocator/tlsf.ts:240:15 ;;@ ~lib/allocator/tlsf.ts:240:15
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:240:28 ;;@ ~lib/allocator/tlsf.ts:240:28
(get_local $9) (get_local $8)
;;@ ~lib/allocator/tlsf.ts:240:32 ;;@ ~lib/allocator/tlsf.ts:240:32
(get_local $10) (get_local $9)
) )
) )
;;@ ~lib/allocator/tlsf.ts:241:4 ;;@ ~lib/allocator/tlsf.ts:241:4
@ -1505,15 +1479,15 @@
(i32.store offset=8 (i32.store offset=8
(get_local $1) (get_local $1)
;;@ ~lib/allocator/tlsf.ts:242:17 ;;@ ~lib/allocator/tlsf.ts:242:17
(get_local $11) (get_local $10)
) )
;;@ ~lib/allocator/tlsf.ts:243:4 ;;@ ~lib/allocator/tlsf.ts:243:4
(if (if
;;@ ~lib/allocator/tlsf.ts:243:8 ;;@ ~lib/allocator/tlsf.ts:243:8
(get_local $11) (get_local $10)
;;@ ~lib/allocator/tlsf.ts:243:14 ;;@ ~lib/allocator/tlsf.ts:243:14
(i32.store offset=4 (i32.store offset=4
(get_local $11) (get_local $10)
;;@ ~lib/allocator/tlsf.ts:243:26 ;;@ ~lib/allocator/tlsf.ts:243:26
(get_local $1) (get_local $1)
) )
@ -1523,9 +1497,9 @@
;;@ ~lib/allocator/tlsf.ts:244:4 ;;@ ~lib/allocator/tlsf.ts:244:4
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:244:17 ;;@ ~lib/allocator/tlsf.ts:244:17
(get_local $9) (get_local $8)
;;@ ~lib/allocator/tlsf.ts:244:21 ;;@ ~lib/allocator/tlsf.ts:244:21
(get_local $10) (get_local $9)
;;@ ~lib/allocator/tlsf.ts:244:25 ;;@ ~lib/allocator/tlsf.ts:244:25
(get_local $1) (get_local $1)
) )
@ -1541,7 +1515,7 @@
;;@ ~lib/allocator/tlsf.ts:247:19 ;;@ ~lib/allocator/tlsf.ts:247:19
(i32.const 1) (i32.const 1)
;;@ ~lib/allocator/tlsf.ts:247:24 ;;@ ~lib/allocator/tlsf.ts:247:24
(get_local $9) (get_local $8)
) )
) )
) )
@ -1550,7 +1524,7 @@
;;@ ~lib/allocator/tlsf.ts:248:4 ;;@ ~lib/allocator/tlsf.ts:248:4
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:248:18 ;;@ ~lib/allocator/tlsf.ts:248:18
(get_local $9) (get_local $8)
;;@ ~lib/allocator/tlsf.ts:248:22 ;;@ ~lib/allocator/tlsf.ts:248:22
(i32.or (i32.or
;;@ ~lib/allocator/tlsf.ts:248:27 ;;@ ~lib/allocator/tlsf.ts:248:27
@ -1558,14 +1532,14 @@
;;@ ~lib/allocator/tlsf.ts:248:22 ;;@ ~lib/allocator/tlsf.ts:248:22
(get_local $0) (get_local $0)
;;@ ~lib/allocator/tlsf.ts:248:36 ;;@ ~lib/allocator/tlsf.ts:248:36
(get_local $9) (get_local $8)
) )
;;@ ~lib/allocator/tlsf.ts:248:42 ;;@ ~lib/allocator/tlsf.ts:248:42
(i32.shl (i32.shl
;;@ ~lib/allocator/tlsf.ts:248:43 ;;@ ~lib/allocator/tlsf.ts:248:43
(i32.const 1) (i32.const 1)
;;@ ~lib/allocator/tlsf.ts:248:48 ;;@ ~lib/allocator/tlsf.ts:248:48
(get_local $10) (get_local $9)
) )
) )
) )
@ -1574,7 +1548,7 @@
(local $1 i32) (local $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
;;@ ~lib/allocator/tlsf.ts:491:47 ;;@ ~lib/allocator/tlsf.ts:492:2
(if (if
;;@ ~lib/allocator/tlsf.ts:492:6 ;;@ ~lib/allocator/tlsf.ts:492:6
(get_local $0) (get_local $0)
@ -1623,9 +1597,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 497) (i32.const 497)
(i32.const 6) (i32.const 6)
) )
@ -1684,7 +1658,7 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
;;@ assembly/ugc.ts:163:15 ;;@ assembly/ugc.ts:165:4
(block $break|0 (block $break|0
(block $case2|0 (block $case2|0
(block $case1|0 (block $case1|0
@ -1997,18 +1971,16 @@
) )
) )
(func $assembly/ugc/gc_pause (; 25 ;) (type $v) (func $assembly/ugc/gc_pause (; 25 ;) (type $v)
;;@ assembly/ugc.ts:254:33 ;;@ assembly/ugc.ts:255:2
(call $assembly/ugc/Control#set:paused (call $assembly/ugc/Control#set:paused
;;@ assembly/ugc.ts:255:2
(get_global $assembly/ugc/GC) (get_global $assembly/ugc/GC)
;;@ assembly/ugc.ts:255:14 ;;@ assembly/ugc.ts:255:14
(i32.const 1) (i32.const 1)
) )
) )
(func $assembly/ugc/gc_resume (; 26 ;) (type $v) (func $assembly/ugc/gc_resume (; 26 ;) (type $v)
;;@ assembly/ugc.ts:259:34 ;;@ assembly/ugc.ts:260:2
(call $assembly/ugc/Control#set:paused (call $assembly/ugc/Control#set:paused
;;@ assembly/ugc.ts:260:2
(get_global $assembly/ugc/GC) (get_global $assembly/ugc/GC)
;;@ assembly/ugc.ts:260:14 ;;@ assembly/ugc.ts:260:14
(i32.const 0) (i32.const 0)
@ -2031,9 +2003,9 @@
) )
) )
(block (block
(call $abort (call $~lib/env/abort
(i32.const 0) (i32.const 0)
(i32.const 4) (i32.const 8)
(i32.const 122) (i32.const 122)
(i32.const 0) (i32.const 0)
) )

1798
lib/parse/build/index.wat Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"scripts": { "scripts": {
"build:as": "asc assembly/index.ts -O3 -b build/index.wasm --noMemory --importMemory --noDebug --sourceMap --validate", "asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --noDebug --sourceMap --validate",
"build": "npm run build:as && webpack --mode production --display-modules", "build": "npm run asbuild && webpack --mode production --display-modules",
"test": "ts-node tests/" "test": "ts-node tests/"
}, },
"files": [ "files": [

View File

@ -69,7 +69,9 @@ export enum CommonFlags {
/** Is a trampoline. */ /** Is a trampoline. */
TRAMPOLINE = 1 << 25, TRAMPOLINE = 1 << 25,
/** Is a virtual method. */ /** Is a virtual method. */
VIRTUAL = 1 << 26 VIRTUAL = 1 << 26,
/** Is the main function. */
MAIN = 1 << 27
} }
/** Path delimiter inserted between file system levels. */ /** Path delimiter inserted between file system levels. */

View File

@ -33,7 +33,10 @@ import {
getConstValueF32, getConstValueF32,
getConstValueF64, getConstValueF64,
getFunctionBody, getFunctionBody,
getGetLocalIndex getGetLocalIndex,
getBlockChildCount,
getBlockChild,
getBlockName
} from "./module"; } from "./module";
import { import {
@ -167,8 +170,6 @@ export class Options {
noTreeShaking: bool = false; noTreeShaking: bool = false;
/** If true, replaces assertions with nops. */ /** If true, replaces assertions with nops. */
noAssert: bool = false; noAssert: bool = false;
/** If true, does not set up a memory. */
noMemory: bool = false;
/** If true, imports the memory provided by the embedder. */ /** If true, imports the memory provided by the embedder. */
importMemory: bool = false; importMemory: bool = false;
/** If true, imports the function table provided by the embedder. */ /** If true, imports the function table provided by the embedder. */
@ -254,9 +255,9 @@ export class Compiler extends DiagnosticEmitter {
/** Current type in compilation. */ /** Current type in compilation. */
currentType: Type = Type.void; currentType: Type = Type.void;
/** Start function being compiled. */ /** Start function being compiled. */
startFunction: Function; startFunctionInstance: Function;
/** Start function statements. */ /** Start function statements. */
startFunctionBody: ExpressionRef[] = []; startFunctionBody: ExpressionRef[];
/** Counting memory offset. */ /** Counting memory offset. */
memoryOffset: I64; memoryOffset: I64;
/** Memory segments being compiled. */ /** Memory segments being compiled. */
@ -298,15 +299,11 @@ export class Compiler extends DiagnosticEmitter {
// initialize lookup maps, built-ins, imports, exports, etc. // initialize lookup maps, built-ins, imports, exports, etc.
program.initialize(options); program.initialize(options);
// set up the start function wrapping top-level statements, of all files. // set up the start function
var startFunctionPrototype = assert(program.elementsLookup.get("start")); var startFunctionInstance = new Function(program.startFunction, "start", new Signature([], Type.void));
assert(startFunctionPrototype.kind == ElementKind.FUNCTION_PROTOTYPE); this.startFunctionInstance = startFunctionInstance;
var startFunctionInstance = new Function( var startFunctionBody = new Array<ExpressionRef>();
<FunctionPrototype>startFunctionPrototype, this.startFunctionBody = startFunctionBody;
startFunctionPrototype.internalName,
new Signature([], Type.void)
);
this.startFunction = startFunctionInstance;
this.currentFunction = startFunctionInstance; this.currentFunction = startFunctionInstance;
// compile entry file(s) while traversing reachable elements // compile entry file(s) while traversing reachable elements
@ -315,9 +312,8 @@ export class Compiler extends DiagnosticEmitter {
if (sources[i].isEntry) this.compileSource(sources[i]); if (sources[i].isEntry) this.compileSource(sources[i]);
} }
// compile the start function if not empty // compile the start function if not empty or called by main
var startFunctionBody = this.startFunctionBody; if (startFunctionBody.length || program.mainFunction !== null) {
if (startFunctionBody.length) {
let signature = startFunctionInstance.signature; let signature = startFunctionInstance.signature;
let funcRef = module.addFunction( let funcRef = module.addFunction(
startFunctionInstance.internalName, startFunctionInstance.internalName,
@ -330,43 +326,41 @@ export class Compiler extends DiagnosticEmitter {
module.createBlock(null, startFunctionBody) module.createBlock(null, startFunctionBody)
); );
startFunctionInstance.finalize(module, funcRef); startFunctionInstance.finalize(module, funcRef);
module.setStart(funcRef); if (!program.mainFunction) module.setStart(funcRef);
} }
// set up static memory segments and the heap base pointer // set up static memory segments and the heap base pointer
if (!options.noMemory) { var memoryOffset = this.memoryOffset;
let memoryOffset = this.memoryOffset; memoryOffset = i64_align(memoryOffset, options.usizeType.byteSize);
memoryOffset = i64_align(memoryOffset, options.usizeType.byteSize); this.memoryOffset = memoryOffset;
this.memoryOffset = memoryOffset; if (options.isWasm64) {
if (options.isWasm64) { module.addGlobal(
module.addGlobal( "HEAP_BASE",
"HEAP_BASE", NativeType.I64,
NativeType.I64, false,
false, module.createI64(i64_low(memoryOffset), i64_high(memoryOffset))
module.createI64(i64_low(memoryOffset), i64_high(memoryOffset)) );
); } else {
} else { module.addGlobal(
module.addGlobal( "HEAP_BASE",
"HEAP_BASE", NativeType.I32,
NativeType.I32, false,
false, module.createI32(i64_low(memoryOffset))
module.createI32(i64_low(memoryOffset))
);
}
// determine initial page size
let pages = i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0));
module.setMemory(
i64_low(pages),
this.options.isWasm64
? Module.MAX_MEMORY_WASM64
: Module.MAX_MEMORY_WASM32,
this.memorySegments,
options.target,
"memory"
); );
} }
// determine initial page size
var pages = i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0));
module.setMemory(
i64_low(pages),
this.options.isWasm64
? Module.MAX_MEMORY_WASM64
: Module.MAX_MEMORY_WASM32,
this.memorySegments,
options.target,
"memory"
);
// import memory if requested (default memory is named '0' by Binaryen) // import memory if requested (default memory is named '0' by Binaryen)
if (options.importMemory) module.addMemoryImport("0", "env", "memory"); if (options.importMemory) module.addMemoryImport("0", "env", "memory");
@ -415,7 +409,7 @@ export class Compiler extends DiagnosticEmitter {
// compile top-level statements // compile top-level statements
var noTreeShaking = this.options.noTreeShaking; var noTreeShaking = this.options.noTreeShaking;
var isEntry = source.isEntry; var isEntry = source.isEntry;
var startFunction = this.startFunction; var startFunctionInstance = this.startFunctionInstance;
var startFunctionBody = this.startFunctionBody; var startFunctionBody = this.startFunctionBody;
var statements = source.statements; var statements = source.statements;
for (let i = 0, k = statements.length; i < k; ++i) { for (let i = 0, k = statements.length; i < k; ++i) {
@ -478,7 +472,7 @@ export class Compiler extends DiagnosticEmitter {
} }
default: { // otherwise a top-level statement that is part of the start function's body default: { // otherwise a top-level statement that is part of the start function's body
let previousFunction = this.currentFunction; let previousFunction = this.currentFunction;
this.currentFunction = startFunction; this.currentFunction = startFunctionInstance;
startFunctionBody.push(this.compileStatement(statement)); startFunctionBody.push(this.compileStatement(statement));
this.currentFunction = previousFunction; this.currentFunction = previousFunction;
break; break;
@ -900,7 +894,7 @@ export class Compiler extends DiagnosticEmitter {
let flow = instance.flow; let flow = instance.flow;
let stmt: ExpressionRef; let stmt: ExpressionRef;
if (body.kind == NodeKind.EXPRESSION) { // () => expression if (body.kind == NodeKind.EXPRESSION) { // () => expression
assert(!instance.isAny(CommonFlags.CONSTRUCTOR | CommonFlags.GET | CommonFlags.SET)); assert(!instance.isAny(CommonFlags.CONSTRUCTOR | CommonFlags.GET | CommonFlags.SET | CommonFlags.MAIN));
assert(instance.is(CommonFlags.ARROW)); assert(instance.is(CommonFlags.ARROW));
stmt = this.compileExpression( stmt = this.compileExpression(
(<ExpressionStatement>body).expression, (<ExpressionStatement>body).expression,
@ -913,7 +907,8 @@ export class Compiler extends DiagnosticEmitter {
flow.finalize(); flow.finalize();
} else { } else {
assert(body.kind == NodeKind.BLOCK); assert(body.kind == NodeKind.BLOCK);
stmt = this.compileStatement(body); let stmts = this.compileStatements((<BlockStatement>body).statements);
if (instance.is(CommonFlags.MAIN)) stmts.unshift(module.createCall("start", null, NativeType.None));
flow.finalize(); flow.finalize();
if (isConstructor) { if (isConstructor) {
let nativeSizeType = this.options.nativeSizeType; let nativeSizeType = this.options.nativeSizeType;
@ -924,21 +919,15 @@ export class Compiler extends DiagnosticEmitter {
// if all branches are guaranteed to allocate, skip the final conditional allocation // if all branches are guaranteed to allocate, skip the final conditional allocation
if (flow.is(FlowFlags.ALLOCATES)) { if (flow.is(FlowFlags.ALLOCATES)) {
stmt = module.createBlock(null, [ stmts.push(module.createGetLocal(0, nativeSizeType));
stmt,
module.createGetLocal(0, nativeSizeType)
], nativeSizeType);
// if not all branches are guaranteed to allocate, also append a conditional allocation // if not all branches are guaranteed to allocate, also append a conditional allocation
} else { } else {
let parent = assert(instance.parent); let parent = assert(instance.parent);
assert(parent.kind == ElementKind.CLASS); assert(parent.kind == ElementKind.CLASS);
stmt = module.createBlock(null, [ stmts.push(module.createTeeLocal(0,
stmt, this.makeConditionalAllocate(<Class>parent, declaration.name)
module.createTeeLocal(0, ));
this.makeConditionalAllocate(<Class>parent, declaration.name)
)
], nativeSizeType);
} }
} }
@ -949,6 +938,11 @@ export class Compiler extends DiagnosticEmitter {
declaration.signature.returnType.range declaration.signature.returnType.range
); );
} }
stmt = !stmts.length
? module.createNop()
: stmts.length == 1
? stmts[0]
: module.createBlock(null, stmts, returnType.toNativeType());
} }
this.currentFunction = previousFunction; this.currentFunction = previousFunction;
@ -1451,7 +1445,7 @@ export class Compiler extends DiagnosticEmitter {
case NodeKind.TYPEDECLARATION: { case NodeKind.TYPEDECLARATION: {
// type declarations must be top-level because function bodies are evaluated when // type declarations must be top-level because function bodies are evaluated when
// reachaable only. // reachaable only.
if (this.currentFunction == this.startFunction) { if (this.currentFunction == this.startFunctionInstance) {
return module.createNop(); return module.createNop();
} }
// otherwise fall-through // otherwise fall-through
@ -1468,16 +1462,23 @@ export class Compiler extends DiagnosticEmitter {
compileStatements(statements: Statement[]): ExpressionRef[] { compileStatements(statements: Statement[]): ExpressionRef[] {
var numStatements = statements.length; var numStatements = statements.length;
var stmts = new Array<ExpressionRef>(numStatements); var stmts = new Array<ExpressionRef>(numStatements);
var count = 0; stmts.length = 0;
var flow = this.currentFunction.flow; var flow = this.currentFunction.flow;
for (let i = 0; i < numStatements; ++i) { for (let i = 0; i < numStatements; ++i) {
let stmt = this.compileStatement(statements[i]); let stmt = this.compileStatement(statements[i]);
if (getExpressionId(stmt) != ExpressionId.Nop) { switch (getExpressionId(stmt)) {
stmts[count++] = stmt; case ExpressionId.Block: {
if (flow.isAny(FlowFlags.ANY_TERMINATING)) break; if (!getBlockName(stmt)) {
for (let j = 0, k = getBlockChildCount(stmt); j < k; ++j) stmts.push(getBlockChild(stmt, j));
break;
}
// fall-through
}
default: stmts.push(stmt);
case ExpressionId.Nop:
} }
if (flow.isAny(FlowFlags.ANY_TERMINATING)) break;
} }
stmts.length = count;
return stmts; return stmts;
} }
@ -1949,7 +1950,7 @@ export class Compiler extends DiagnosticEmitter {
// top-level variables and constants become globals // top-level variables and constants become globals
if (isKnownGlobal || ( if (isKnownGlobal || (
currentFunction == this.startFunction && currentFunction == this.startFunctionInstance &&
statement.parent && statement.parent.kind == NodeKind.SOURCE statement.parent && statement.parent.kind == NodeKind.SOURCE
)) { )) {
// NOTE that the above condition also covers top-level variables declared with 'let', even // NOTE that the above condition also covers top-level variables declared with 'let', even

View File

@ -97,11 +97,6 @@ export function setNoAssert(options: Options, noAssert: bool): void {
options.noAssert = noAssert; options.noAssert = noAssert;
} }
/** Sets the `noMemory` option. */
export function setNoMemory(options: Options, noMemory: bool): void {
options.noMemory = noMemory;
}
/** Sets the `importMemory` option. */ /** Sets the `importMemory` option. */
export function setImportMemory(options: Options, importMemory: bool): void { export function setImportMemory(options: Options, importMemory: bool): void {
options.importMemory = importMemory; options.importMemory = importMemory;

View File

@ -329,6 +329,10 @@ export class Program extends DiagnosticEmitter {
arrayBufferViewPrototype: InterfacePrototype | null = null; arrayBufferViewPrototype: InterfacePrototype | null = null;
/** String instance reference. */ /** String instance reference. */
stringInstance: Class | null = null; stringInstance: Class | null = null;
/** Start function reference. */
startFunction: FunctionPrototype;
/** Main function reference. */
mainFunction: FunctionPrototype | null = null;
/** Target expression of the previously resolved property or element access. */ /** Target expression of the previously resolved property or element access. */
resolvedThisExpression: Expression | null = null; resolvedThisExpression: Expression | null = null;
@ -592,6 +596,25 @@ export class Program extends DiagnosticEmitter {
} }
} }
} }
// register 'start'
{
let element = <Element>assert(this.elementsLookup.get("start"));
assert(element.kind == ElementKind.FUNCTION_PROTOTYPE);
this.startFunction = <FunctionPrototype>element;
}
// register 'main' if present
if (this.moduleLevelExports.has("main")) {
let element = <Element>this.moduleLevelExports.get("main");
if (
element.kind == ElementKind.FUNCTION_PROTOTYPE &&
!(<FunctionPrototype>element).isAny(CommonFlags.GENERIC | CommonFlags.AMBIENT)
) {
(<FunctionPrototype>element).set(CommonFlags.MAIN);
this.mainFunction = <FunctionPrototype>element;
}
}
} }
/** Tries to resolve an import by traversing exports and queued exports. */ /** Tries to resolve an import by traversing exports and queued exports. */
@ -758,15 +781,15 @@ export class Program extends DiagnosticEmitter {
this.fileLevelExports.set(internalName, prototype); this.fileLevelExports.set(internalName, prototype);
this.currentFilespace.members.set(simpleName, prototype); this.currentFilespace.members.set(simpleName, prototype);
if (prototype.is(CommonFlags.EXPORT) && declaration.range.source.isEntry) { if (prototype.is(CommonFlags.EXPORT) && declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) { if (this.moduleLevelExports.has(simpleName)) {
this.error( this.error(
DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,
declaration.name.range, internalName declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
); );
return; return;
} }
prototype.set(CommonFlags.MODULE_EXPORT); prototype.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, prototype); this.moduleLevelExports.set(simpleName, prototype);
} }
} }
@ -1192,15 +1215,15 @@ export class Program extends DiagnosticEmitter {
this.fileLevelExports.set(internalName, element); this.fileLevelExports.set(internalName, element);
this.currentFilespace.members.set(simpleName, element); this.currentFilespace.members.set(simpleName, element);
if (declaration.range.source.isEntry) { if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) { if (this.moduleLevelExports.has(simpleName)) {
this.error( this.error(
DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,
declaration.name.range, internalName declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
); );
return; return;
} }
element.set(CommonFlags.MODULE_EXPORT); element.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, element); this.moduleLevelExports.set(simpleName, element);
} }
} }
@ -1448,15 +1471,15 @@ export class Program extends DiagnosticEmitter {
this.fileLevelExports.set(internalName, prototype); this.fileLevelExports.set(internalName, prototype);
this.currentFilespace.members.set(simpleName, prototype); this.currentFilespace.members.set(simpleName, prototype);
if (declaration.range.source.isEntry) { if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) { if (this.moduleLevelExports.has(simpleName)) {
this.error( this.error(
DiagnosticCode.Duplicate_identifier_0, DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
); );
return; return;
} }
prototype.set(CommonFlags.MODULE_EXPORT); prototype.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, prototype); this.moduleLevelExports.set(simpleName, prototype);
} }
} }
@ -1609,15 +1632,15 @@ export class Program extends DiagnosticEmitter {
this.fileLevelExports.set(internalName, prototype); this.fileLevelExports.set(internalName, prototype);
this.currentFilespace.members.set(simpleName, prototype); this.currentFilespace.members.set(simpleName, prototype);
if (declaration.range.source.isEntry) { if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) { if (this.moduleLevelExports.has(simpleName)) {
this.error( this.error(
DiagnosticCode.Duplicate_identifier_0, DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
); );
return; return;
} }
prototype.set(CommonFlags.MODULE_EXPORT); prototype.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, prototype); this.moduleLevelExports.set(simpleName, prototype);
} }
} }
@ -1694,15 +1717,15 @@ export class Program extends DiagnosticEmitter {
} }
this.currentFilespace.members.set(simpleName, namespace); this.currentFilespace.members.set(simpleName, namespace);
if (declaration.range.source.isEntry) { if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) { if (this.moduleLevelExports.has(simpleName)) {
this.error( this.error(
DiagnosticCode.Duplicate_identifier_0, DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
); );
return; return;
} }
namespace.set(CommonFlags.MODULE_EXPORT); namespace.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, namespace); this.moduleLevelExports.set(simpleName, namespace);
} }
} }
@ -1822,15 +1845,15 @@ export class Program extends DiagnosticEmitter {
} }
this.currentFilespace.members.set(simpleName, global); this.currentFilespace.members.set(simpleName, global);
if (declaration.range.source.isEntry) { if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) { if (this.moduleLevelExports.has(simpleName)) {
this.error( this.error(
DiagnosticCode.Duplicate_identifier_0, DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
); );
continue; continue;
} }
global.set(CommonFlags.MODULE_EXPORT); global.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, global); this.moduleLevelExports.set(simpleName, global);
} }
} }
this.checkGlobalOptions(global, declaration); this.checkGlobalOptions(global, declaration);

View File

@ -33,13 +33,11 @@
(local $5 i32) (local $5 i32)
(local $6 i32) (local $6 i32)
(local $7 i32) (local $7 i32)
(block (set_local $0
(set_local $0 (f32.const -1)
(f32.const -1) )
) (set_local $1
(set_local $1 (f64.const -2)
(f64.const -2)
)
) )
(if (if
(i32.eqz (i32.eqz

View File

@ -0,0 +1,17 @@
(module
(type $iii (func (param i32 i32) (result i32)))
(type $v (func))
(global $main/code (mut i32) (i32.const 0))
(memory $0 1)
(export "main" (func $main/main))
(export "memory" (memory $0))
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(call $start)
(get_global $main/code)
)
(func $start (; 1 ;) (type $v)
(set_global $main/code
(i32.const 1)
)
)
)

6
tests/compiler/main.ts Normal file
View File

@ -0,0 +1,6 @@
var code = 0;
code = 1;
export function main(argc: i32, argv: usize): i32 {
return code;
}

View File

@ -0,0 +1,18 @@
(module
(type $iii (func (param i32 i32) (result i32)))
(type $v (func))
(global $main/code (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 1)
(export "main" (func $main/main))
(export "memory" (memory $0))
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(call $start)
(get_global $main/code)
)
(func $start (; 1 ;) (type $v)
(set_global $main/code
(i32.const 1)
)
)
)

View File

@ -413,13 +413,11 @@
(get_local $6) (get_local $6)
) )
) )
(block (set_local $10
(set_local $10 (f64.const 0)
(f64.const 0) )
) (set_local $11
(set_local $11 (f64.const 0)
(f64.const 0)
)
) )
(set_local $14 (set_local $14
(i32.const 0) (i32.const 0)

View File

@ -574,72 +574,70 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(block (if
(if (i32.gt_u
(i32.gt_u (get_local $1)
(get_local $1) (i32.const 268435454)
(i32.const 268435454)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 92)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
(set_local $2 (block
(i32.shl (call $~lib/env/abort
(get_local $1) (i32.const 0)
(i32.const 2) (i32.const 92)
(i32.const 23)
(i32.const 39)
) )
(unreachable)
) )
(set_local $3 )
(call $~lib/internal/arraybuffer/allocUnsafe (set_local $2
(get_local $2) (i32.shl
) (get_local $1)
(i32.const 2)
) )
(i32.store )
(tee_local $0 (set_local $3
(if (result i32) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) (get_local $2)
(get_local $0) )
(tee_local $0 )
(block (result i32) (i32.store
(set_local $4 (tee_local $0
(call $~lib/allocator/arena/allocate_memory (if (result i32)
(i32.const 8) (get_local $0)
) (get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3) (get_local $3)
(i32.const 8)
) )
(i32.store offset=4 (i32.const 0)
(get_local $0) (get_local $2)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3)
(i32.const 8)
)
(i32.const 0)
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )

View File

@ -597,72 +597,70 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(block (if
(if (i32.gt_u
(i32.gt_u (get_local $1)
(get_local $1) (i32.const 268435454)
(i32.const 268435454)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
(set_local $2 (block
(i32.shl (call $~lib/env/abort
(get_local $1) (i32.const 0)
(i32.const 2) (i32.const 8)
(i32.const 23)
(i32.const 39)
) )
(unreachable)
) )
(set_local $3 )
(call $~lib/internal/arraybuffer/allocUnsafe (set_local $2
(get_local $2) (i32.shl
) (get_local $1)
(i32.const 2)
) )
(i32.store )
(tee_local $0 (set_local $3
(if (result i32) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) (get_local $2)
(get_local $0) )
(tee_local $0 )
(block (result i32) (i32.store
(set_local $4 (tee_local $0
(call $~lib/allocator/arena/allocate_memory (if (result i32)
(i32.const 8) (get_local $0)
) (get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3) (get_local $3)
(i32.const 8)
) )
(i32.store offset=4 (i32.const 0)
(get_local $0) (get_local $2)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3)
(i32.const 8)
)
(i32.const 0)
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )
@ -4292,72 +4290,70 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(block (if
(if (i32.gt_u
(i32.gt_u (get_local $1)
(get_local $1) (i32.const 268435454)
(i32.const 268435454)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
(set_local $2 (block
(i32.shl (call $~lib/env/abort
(get_local $1) (i32.const 0)
(i32.const 2) (i32.const 8)
(i32.const 23)
(i32.const 39)
) )
(unreachable)
) )
(set_local $3 )
(call $~lib/internal/arraybuffer/allocUnsafe (set_local $2
(get_local $2) (i32.shl
) (get_local $1)
(i32.const 2)
) )
(i32.store )
(tee_local $0 (set_local $3
(if (result i32) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) (get_local $2)
(get_local $0) )
(tee_local $0 )
(block (result i32) (i32.store
(set_local $4 (tee_local $0
(call $~lib/allocator/arena/allocate_memory (if (result i32)
(i32.const 8) (get_local $0)
) (get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3) (get_local $3)
(i32.const 8)
) )
(i32.store offset=4 (i32.const 0)
(get_local $0) (get_local $2)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3)
(i32.const 8)
)
(i32.const 0)
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )
@ -6490,72 +6486,70 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(block (if
(if (i32.gt_u
(i32.gt_u (get_local $1)
(get_local $1) (i32.const 268435454)
(i32.const 268435454)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
(set_local $2 (block
(i32.shl (call $~lib/env/abort
(get_local $1) (i32.const 0)
(i32.const 2) (i32.const 8)
(i32.const 23)
(i32.const 39)
) )
(unreachable)
) )
(set_local $3 )
(call $~lib/internal/arraybuffer/allocUnsafe (set_local $2
(get_local $2) (i32.shl
) (get_local $1)
(i32.const 2)
) )
(i32.store )
(tee_local $0 (set_local $3
(if (result i32) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) (get_local $2)
(get_local $0) )
(tee_local $0 )
(block (result i32) (i32.store
(set_local $4 (tee_local $0
(call $~lib/allocator/arena/allocate_memory (if (result i32)
(i32.const 8) (get_local $0)
) (get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3) (get_local $3)
(i32.const 8)
) )
(i32.store offset=4 (i32.const 0)
(get_local $0) (get_local $2)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3)
(i32.const 8)
)
(i32.const 0)
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )
@ -7108,72 +7102,70 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(block (if
(if (i32.gt_u
(i32.gt_u (get_local $1)
(get_local $1) (i32.const 268435454)
(i32.const 268435454)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
(set_local $2 (block
(i32.shl (call $~lib/env/abort
(get_local $1) (i32.const 0)
(i32.const 2) (i32.const 8)
(i32.const 23)
(i32.const 39)
) )
(unreachable)
) )
(set_local $3 )
(call $~lib/internal/arraybuffer/allocUnsafe (set_local $2
(get_local $2) (i32.shl
) (get_local $1)
(i32.const 2)
) )
(i32.store )
(tee_local $0 (set_local $3
(if (result i32) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) (get_local $2)
(get_local $0) )
(tee_local $0 )
(block (result i32) (i32.store
(set_local $4 (tee_local $0
(call $~lib/allocator/arena/allocate_memory (if (result i32)
(i32.const 8) (get_local $0)
) (get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3) (get_local $3)
(i32.const 8)
) )
(i32.store offset=4 (i32.const 0)
(get_local $0) (get_local $2)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3)
(i32.const 8)
)
(i32.const 0)
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )
@ -7184,7 +7176,6 @@
) )
(func $std/array/Proxy<i32>#constructor (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $std/array/Proxy<i32>#constructor (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)
@ -8530,72 +8521,70 @@
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(block (if
(if (i32.gt_u
(i32.gt_u (get_local $1)
(get_local $1) (i32.const 268435454)
(i32.const 268435454)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 39)
)
(unreachable)
)
) )
(set_local $2 (block
(i32.shl (call $~lib/env/abort
(get_local $1) (i32.const 0)
(i32.const 2) (i32.const 8)
(i32.const 23)
(i32.const 39)
) )
(unreachable)
) )
(set_local $3 )
(call $~lib/internal/arraybuffer/allocUnsafe (set_local $2
(get_local $2) (i32.shl
) (get_local $1)
(i32.const 2)
) )
(i32.store )
(tee_local $0 (set_local $3
(if (result i32) (call $~lib/internal/arraybuffer/allocUnsafe
(get_local $0) (get_local $2)
(get_local $0) )
(tee_local $0 )
(block (result i32) (i32.store
(set_local $4 (tee_local $0
(call $~lib/allocator/arena/allocate_memory (if (result i32)
(i32.const 8) (get_local $0)
) (get_local $0)
(tee_local $0
(block (result i32)
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.const 8)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
(i32.store
(get_local $4)
(i32.const 0)
)
(i32.store offset=4
(get_local $4)
(i32.const 0)
)
(get_local $4)
) )
) )
) )
)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3) (get_local $3)
(i32.const 8)
) )
(i32.store offset=4 (i32.const 0)
(get_local $0) (get_local $2)
(get_local $1)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $3)
(i32.const 8)
)
(i32.const 0)
(get_local $2)
)
) )
(get_local $0) (get_local $0)
) )

View File

@ -132,7 +132,6 @@
) )
(func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32) (func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)
@ -152,7 +151,6 @@
) )
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32) (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)
@ -176,7 +174,6 @@
) )
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)

View File

@ -401,13 +401,11 @@
(set_local $3 (set_local $3
(i32.const 1) (i32.const 1)
) )
(block (set_local $4
(set_local $4 (f64.const 0)
(f64.const 0) )
) (set_local $5
(set_local $5 (f64.const 0)
(f64.const 0)
)
) )
(if (if
(if (result i32) (if (result i32)
@ -2782,16 +2780,14 @@
) )
) )
) )
(block (set_local $3
(set_local $3 (i32.const 0)
(i32.const 0) )
) (set_local $4
(set_local $4 (i32.wrap/i64
(i32.wrap/i64 (i64.shr_u
(i64.shr_u (get_local $1)
(get_local $1) (i64.const 63)
(i64.const 63)
)
) )
) )
) )

View File

@ -1373,13 +1373,11 @@
(set_local $3 (set_local $3
(i32.const 1) (i32.const 1)
) )
(block (set_local $4
(set_local $4 (f64.const 0)
(f64.const 0) )
) (set_local $5
(set_local $5 (f64.const 0)
(f64.const 0)
)
) )
(if (if
(if (result i32) (if (result i32)
@ -2141,13 +2139,11 @@
(get_local $0) (get_local $0)
) )
) )
(block (set_local $2
(set_local $2 (f32.const 0)
(f32.const 0) )
) (set_local $3
(set_local $3 (f32.const 0)
(f32.const 0)
)
) )
(set_local $4 (set_local $4
(i32.const 1) (i32.const 1)
@ -6010,16 +6006,14 @@
) )
) )
) )
(block (set_local $3
(set_local $3 (i32.const 0)
(i32.const 0) )
) (set_local $4
(set_local $4 (i32.wrap/i64
(i32.wrap/i64 (i64.shr_u
(i64.shr_u (get_local $1)
(get_local $1) (i64.const 63)
(i64.const 63)
)
) )
) )
) )

View File

@ -123,43 +123,41 @@
) )
(func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)
(local $2 i32) (local $2 i32)
(block (i32.store
(i32.store (get_local $0)
(get_local $0) (i32.add
(i32.add (i32.load
(i32.load (tee_local $0
(tee_local $0 (if (result i32)
(if (result i32) (get_local $0)
(get_local $0) (get_local $0)
(get_local $0) (tee_local $0
(tee_local $0 (block (result i32)
(block (result i32) (set_local $2
(set_local $2 (call $~lib/allocator/arena/allocate_memory
(call $~lib/allocator/arena/allocate_memory (i32.const 8)
(i32.const 8)
)
) )
(i32.store
(get_local $2)
(i32.const 1)
)
(f32.store offset=4
(get_local $2)
(f32.const 2)
)
(get_local $2)
) )
(i32.store
(get_local $2)
(i32.const 1)
)
(f32.store offset=4
(get_local $2)
(f32.const 2)
)
(get_local $2)
) )
) )
) )
) )
(i32.const 1)
) )
(i32.const 1)
) )
(f32.store offset=4 )
(get_local $0) (f32.store offset=4
(get_local $1) (get_local $0)
) (get_local $1)
) )
(get_local $0) (get_local $0)
) )

View File

@ -194,7 +194,6 @@
) )
(func $std/operator-overloading/Tester#constructor (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (func $std/operator-overloading/Tester#constructor (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32) (local $3 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)
@ -2399,7 +2398,6 @@
) )
(func $std/operator-overloading/TesterInlineStatic#constructor (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (func $std/operator-overloading/TesterInlineStatic#constructor (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32) (local $3 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)
@ -2427,7 +2425,6 @@
) )
(func $std/operator-overloading/TesterInlineInstance#constructor (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (func $std/operator-overloading/TesterInlineInstance#constructor (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32) (local $3 i32)
(nop)
(tee_local $0 (tee_local $0
(if (result i32) (if (result i32)
(get_local $0) (get_local $0)

View File

@ -458,57 +458,55 @@
(unreachable) (unreachable)
) )
) )
(block (set_local $2
(set_local $2 (i64.and
(i64.and (i64.shr_u
(i64.shr_u (get_local $0)
(get_local $0)
(i64.const 8)
)
(i64.const 71777214294589695)
)
)
(set_local $3
(i64.shl
(i64.and
(get_local $0)
(i64.const 71777214294589695)
)
(i64.const 8) (i64.const 8)
) )
(i64.const 71777214294589695)
) )
(set_local $4 )
(set_local $3
(i64.shl
(i64.and
(get_local $0)
(i64.const 71777214294589695)
)
(i64.const 8)
)
)
(set_local $4
(i64.or
(get_local $2)
(get_local $3)
)
)
(set_local $2
(i64.and
(i64.shr_u
(get_local $4)
(i64.const 16)
)
(i64.const 281470681808895)
)
)
(set_local $3
(i64.shl
(i64.and
(get_local $4)
(i64.const 281470681808895)
)
(i64.const 16)
)
)
(return
(i64.rotr
(i64.or (i64.or
(get_local $2) (get_local $2)
(get_local $3) (get_local $3)
) )
) (i64.const 32)
(set_local $2
(i64.and
(i64.shr_u
(get_local $4)
(i64.const 16)
)
(i64.const 281470681808895)
)
)
(set_local $3
(i64.shl
(i64.and
(get_local $4)
(i64.const 281470681808895)
)
(i64.const 16)
)
)
(return
(i64.rotr
(i64.or
(get_local $2)
(get_local $3)
)
(i64.const 32)
)
) )
) )
) )
@ -561,57 +559,55 @@
(unreachable) (unreachable)
) )
) )
(block (set_local $2
(set_local $2 (i64.and
(i64.and (i64.shr_u
(i64.shr_u (get_local $0)
(get_local $0)
(i64.const 8)
)
(i64.const 71777214294589695)
)
)
(set_local $3
(i64.shl
(i64.and
(get_local $0)
(i64.const 71777214294589695)
)
(i64.const 8) (i64.const 8)
) )
(i64.const 71777214294589695)
) )
(set_local $4 )
(set_local $3
(i64.shl
(i64.and
(get_local $0)
(i64.const 71777214294589695)
)
(i64.const 8)
)
)
(set_local $4
(i64.or
(get_local $2)
(get_local $3)
)
)
(set_local $2
(i64.and
(i64.shr_u
(get_local $4)
(i64.const 16)
)
(i64.const 281470681808895)
)
)
(set_local $3
(i64.shl
(i64.and
(get_local $4)
(i64.const 281470681808895)
)
(i64.const 16)
)
)
(return
(i64.rotr
(i64.or (i64.or
(get_local $2) (get_local $2)
(get_local $3) (get_local $3)
) )
) (i64.const 32)
(set_local $2
(i64.and
(i64.shr_u
(get_local $4)
(i64.const 16)
)
(i64.const 281470681808895)
)
)
(set_local $3
(i64.shl
(i64.and
(get_local $4)
(i64.const 281470681808895)
)
(i64.const 16)
)
)
(return
(i64.rotr
(i64.or
(get_local $2)
(get_local $3)
)
(i64.const 32)
)
) )
) )
) )

File diff suppressed because it is too large Load Diff