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.setNoTreeShaking(compilerOptions, !!args.noTreeShaking);
assemblyscript.setNoAssert(compilerOptions, !!args.noAssert);
assemblyscript.setNoMemory(compilerOptions, !!args.noMemory);
assemblyscript.setImportMemory(compilerOptions, !!args.importMemory);
assemblyscript.setImportTable(compilerOptions, !!args.importTable);
assemblyscript.setMemoryBase(compilerOptions, args.memoryBase >>> 0);

View File

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

View File

@ -19,12 +19,10 @@
(local $2 i32)
;;@ assembly/index.ts:33:2
(set_global $assembly/index/w
;;@ assembly/index.ts:33:6
(get_local $0)
)
;;@ assembly/index.ts:34:2
(set_global $assembly/index/h
;;@ assembly/index.ts:34:6
(get_local $1)
)
;;@ assembly/index.ts:35:2
@ -32,38 +30,41 @@
;;@ assembly/index.ts:35:6
(i32.mul
(get_local $0)
;;@ assembly/index.ts:35:14
(get_local $1)
)
)
;;@ assembly/index.ts:38:2
(block $break|0
;;@ assembly/index.ts:38:7
(set_local $0
;;@ assembly/index.ts:38:15
(i32.const 0)
)
(loop $continue|0
(if
(loop $repeat|0
(br_if $break|0
;;@ assembly/index.ts:38:18
(i32.lt_s
(i32.ge_s
(get_local $0)
;;@ assembly/index.ts:38:22
(get_global $assembly/index/h)
)
(block
)
;;@ assembly/index.ts:38:30
(block $break|1
;;@ assembly/index.ts:39:9
(set_local $1
;;@ assembly/index.ts:39:17
(i32.const 0)
)
(loop $continue|1
(if
(loop $repeat|1
(br_if $break|1
;;@ assembly/index.ts:39:20
(i32.lt_s
(i32.ge_s
(get_local $1)
;;@ assembly/index.ts:39:24
(get_global $assembly/index/w)
)
(block
)
(set_local $2
;;@ assembly/index.ts:40:16
(if (result i32)
@ -102,37 +103,31 @@
(get_global $assembly/index/w)
)
)
;;@ assembly/index.ts:21:26
(get_local $1)
)
;;@ assembly/index.ts:21:32
(i32.const 2)
)
;;@ assembly/index.ts:21:35
(get_local $2)
)
;;@ assembly/index.ts:39:27
(set_local $1
(i32.add
;;@ assembly/index.ts:39:29
(get_local $1)
(i32.const 1)
)
)
(br $continue|1)
)
(br $repeat|1)
)
)
;;@ assembly/index.ts:38:25
(set_local $0
(i32.add
;;@ assembly/index.ts:38:27
(get_local $0)
(i32.const 1)
)
)
(br $continue|0)
)
(br $repeat|0)
)
)
)
@ -145,8 +140,7 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
(local $8 i32)
(set_local $7
(set_local $6
;;@ assembly/index.ts:47:12
(i32.sub
(get_global $assembly/index/h)
@ -154,7 +148,7 @@
(i32.const 1)
)
)
(set_local $8
(set_local $7
;;@ assembly/index.ts:48:12
(i32.sub
(get_global $assembly/index/w)
@ -162,16 +156,19 @@
(i32.const 1)
)
)
(loop $continue|0
(if
;;@ assembly/index.ts:52:2
(block $break|0
(loop $repeat|0
(br_if $break|0
;;@ assembly/index.ts:52:18
(i32.lt_s
(i32.ge_s
(get_local $0)
;;@ assembly/index.ts:52:22
(get_global $assembly/index/h)
)
(block
(set_local $5
)
(set_local $4
(tee_local $2
;;@ assembly/index.ts:53:14
(if (result i32)
(get_local $0)
@ -181,17 +178,16 @@
;;@ assembly/index.ts:53:33
(i32.const 1)
)
;;@ assembly/index.ts:53:23
(get_local $7)
(get_local $6)
)
)
(set_local $6
)
(set_local $5
;;@ assembly/index.ts:54:14
(if (result i32)
(i32.eq
(get_local $0)
;;@ assembly/index.ts:54:19
(get_local $7)
(get_local $6)
)
;;@ assembly/index.ts:54:25
(i32.const 0)
@ -203,20 +199,22 @@
)
)
)
;;@ assembly/index.ts:55:4
(block $break|1
;;@ assembly/index.ts:55:9
(set_local $1
;;@ assembly/index.ts:55:17
(i32.const 0)
)
(loop $continue|1
(if
(loop $repeat|1
(br_if $break|1
;;@ assembly/index.ts:55:20
(i32.lt_s
(i32.ge_s
(get_local $1)
;;@ assembly/index.ts:55:24
(get_global $assembly/index/w)
)
(block
)
;;@ assembly/index.ts:61:6
(set_local $2
;;@ assembly/index.ts:61:27
@ -233,7 +231,7 @@
(i32.shl
(i32.add
(i32.mul
(get_local $5)
(get_local $4)
(get_global $assembly/index/w)
)
(tee_local $2
@ -246,8 +244,7 @@
;;@ assembly/index.ts:56:35
(i32.const 1)
)
;;@ assembly/index.ts:56:25
(get_local $8)
(get_local $7)
)
)
)
@ -263,7 +260,7 @@
(i32.shl
(i32.add
(i32.mul
(get_local $5)
(get_local $4)
(get_global $assembly/index/w)
)
(get_local $1)
@ -281,7 +278,7 @@
(i32.shl
(i32.add
(i32.mul
(get_local $5)
(get_local $4)
(get_global $assembly/index/w)
)
(tee_local $3
@ -289,8 +286,7 @@
(if (result i32)
(i32.eq
(get_local $1)
;;@ assembly/index.ts:57:21
(get_local $8)
(get_local $7)
)
;;@ assembly/index.ts:57:27
(i32.const 0)
@ -352,7 +348,7 @@
(i32.shl
(i32.add
(i32.mul
(get_local $6)
(get_local $5)
(get_global $assembly/index/w)
)
(get_local $2)
@ -370,7 +366,7 @@
(i32.shl
(i32.add
(i32.mul
(get_local $6)
(get_local $5)
(get_global $assembly/index/w)
)
(get_local $1)
@ -388,7 +384,7 @@
(i32.shl
(i32.add
(i32.mul
(get_local $6)
(get_local $5)
(get_global $assembly/index/w)
)
(get_local $3)
@ -406,8 +402,8 @@
;;@ assembly/index.ts:68:10
(i32.and
;;@ assembly/index.ts:67:6
(tee_local $4
;;@ assembly/index.ts:15:9
(tee_local $3
;;@ assembly/index.ts:15:35
(i32.load
;;@ assembly/index.ts:15:19
(i32.shl
@ -418,7 +414,6 @@
;;@ assembly/index.ts:15:24
(get_global $assembly/index/w)
)
;;@ assembly/index.ts:15:28
(get_local $1)
)
;;@ assembly/index.ts:15:34
@ -434,7 +429,6 @@
;;@ assembly/index.ts:70:12
(i32.eq
(i32.and
;;@ assembly/index.ts:70:13
(get_local $2)
;;@ assembly/index.ts:70:30
(i32.const 14)
@ -462,15 +456,13 @@
(tee_local $2
(i32.sub
(i32.shr_u
(get_local $4)
(get_local $3)
(i32.const 24)
)
(get_global $assembly/index/BIT_ROT)
)
)
(tee_local $3
(i32.const 0)
)
(i32.gt_s
(get_local $2)
(i32.const 0)
@ -479,7 +471,7 @@
(i32.const 24)
)
(i32.and
(get_local $4)
(get_local $3)
(i32.const 16777215)
)
)
@ -550,7 +542,6 @@
(get_global $assembly/index/w)
)
)
;;@ assembly/index.ts:21:26
(get_local $1)
)
;;@ assembly/index.ts:21:32
@ -565,8 +556,7 @@
;;@ assembly/index.ts:27:19
(i32.sub
(i32.shr_u
;;@ assembly/index.ts:27:20
(get_local $4)
(get_local $3)
;;@ assembly/index.ts:27:26
(i32.const 24)
)
@ -574,10 +564,7 @@
(get_global $assembly/index/BIT_ROT)
)
)
(tee_local $3
;;@ assembly/index.ts:27:41
(i32.const 0)
)
(i32.gt_s
(get_local $2)
(i32.const 0)
@ -588,8 +575,7 @@
)
;;@ assembly/index.ts:28:24
(i32.and
;;@ assembly/index.ts:28:25
(get_local $4)
(get_local $3)
;;@ assembly/index.ts:28:29
(i32.const 16777215)
)
@ -600,46 +586,43 @@
;;@ assembly/index.ts:55:27
(set_local $1
(i32.add
;;@ assembly/index.ts:55:29
(get_local $1)
(i32.const 1)
)
)
(br $continue|1)
)
(br $repeat|1)
)
)
;;@ assembly/index.ts:52:25
(set_local $0
(i32.add
;;@ assembly/index.ts:52:27
(get_local $0)
(i32.const 1)
)
)
(br $continue|0)
)
(br $repeat|0)
)
)
)
(func $assembly/index/fill (; 3 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
(local $3 i32)
(loop $continue|0
(if
;;@ assembly/index.ts:85:2
(block $break|0
(loop $repeat|0
(br_if $break|0
;;@ assembly/index.ts:85:19
(i32.lt_s
(i32.ge_s
(get_local $3)
;;@ assembly/index.ts:85:24
(get_global $assembly/index/w)
)
(block
)
;;@ assembly/index.ts:85:33
(if
;;@ assembly/index.ts:86:8
(f64.lt
;;@ assembly/index.ts:86:13
(call $~lib/math/JSMath.random)
;;@ assembly/index.ts:86:24
(get_local $2)
)
(i32.store
@ -667,36 +650,35 @@
;;@ assembly/index.ts:85:27
(set_local $3
(i32.add
;;@ assembly/index.ts:85:29
(get_local $3)
(i32.const 1)
)
)
(br $continue|0)
)
(br $repeat|0)
)
)
;;@ assembly/index.ts:88:2
(block $break|1
;;@ assembly/index.ts:88:7
(set_local $3
;;@ assembly/index.ts:88:16
(i32.const 0)
)
(loop $continue|1
(if
(loop $repeat|1
(br_if $break|1
;;@ assembly/index.ts:88:19
(i32.lt_s
(i32.ge_s
(get_local $3)
;;@ assembly/index.ts:88:24
(get_global $assembly/index/h)
)
(block
)
;;@ assembly/index.ts:88:33
(if
;;@ assembly/index.ts:89:8
(f64.lt
;;@ assembly/index.ts:89:13
(call $~lib/math/JSMath.random)
;;@ assembly/index.ts:89:24
(get_local $2)
)
;;@ assembly/index.ts:21:2
@ -714,7 +696,6 @@
(get_global $assembly/index/w)
)
)
;;@ assembly/index.ts:21:26
(get_local $0)
)
;;@ assembly/index.ts:21:32
@ -731,13 +712,11 @@
;;@ assembly/index.ts:88:27
(set_local $3
(i32.add
;;@ assembly/index.ts:88:29
(get_local $3)
(i32.const 1)
)
)
(br $continue|1)
)
(br $repeat|1)
)
)
)

View File

@ -46,30 +46,36 @@
;;@ assembly/index.ts:38:15
(i32.const 0)
)
(loop $continue|0
(if
(loop $repeat|0
(br_if $break|0
(i32.eqz
;;@ assembly/index.ts:38:18
(i32.lt_s
(get_local $2)
;;@ assembly/index.ts:38:22
(get_global $assembly/index/h)
)
(block
)
)
;;@ assembly/index.ts:38:30
(block $break|1
;;@ assembly/index.ts:39:9
(set_local $3
;;@ assembly/index.ts:39:17
(i32.const 0)
)
(loop $continue|1
(if
(loop $repeat|1
(br_if $break|1
(i32.eqz
;;@ assembly/index.ts:39:20
(i32.lt_s
(get_local $3)
;;@ assembly/index.ts:39:24
(get_global $assembly/index/w)
)
(block
)
)
;;@ assembly/index.ts:39:32
(block $assembly/index/set|inlined.0
(set_local $4
;;@ assembly/index.ts:40:16
@ -127,9 +133,7 @@
(i32.const 1)
)
)
(br $continue|1)
)
)
(br $repeat|1)
)
)
;;@ assembly/index.ts:38:25
@ -140,9 +144,7 @@
(i32.const 1)
)
)
(br $continue|0)
)
)
(br $repeat|0)
)
)
)
@ -159,8 +161,6 @@
(local $9 i32)
(local $10 i32)
(local $11 i32)
;;@ assembly/index.ts:47:2
(block
(set_local $0
;;@ assembly/index.ts:47:12
(i32.sub
@ -177,7 +177,6 @@
(i32.const 1)
)
)
)
;;@ assembly/index.ts:52:2
(block $break|0
;;@ assembly/index.ts:52:7
@ -185,16 +184,18 @@
;;@ assembly/index.ts:52:15
(i32.const 0)
)
(loop $continue|0
(if
(loop $repeat|0
(br_if $break|0
(i32.eqz
;;@ assembly/index.ts:52:18
(i32.lt_s
(get_local $2)
;;@ assembly/index.ts:52:22
(get_global $assembly/index/h)
)
(block
(block
)
)
;;@ assembly/index.ts:52:30
(block
(set_local $3
;;@ assembly/index.ts:53:14
@ -232,7 +233,6 @@
)
)
)
)
;;@ assembly/index.ts:55:4
(block $break|1
;;@ assembly/index.ts:55:9
@ -240,16 +240,18 @@
;;@ assembly/index.ts:55:17
(i32.const 0)
)
(loop $continue|1
(if
(loop $repeat|1
(br_if $break|1
(i32.eqz
;;@ assembly/index.ts:55:20
(i32.lt_s
(get_local $5)
;;@ assembly/index.ts:55:24
(get_global $assembly/index/w)
)
(block
(block
)
)
;;@ assembly/index.ts:55:32
(block
(set_local $6
;;@ assembly/index.ts:56:16
@ -287,7 +289,6 @@
)
)
)
)
;;@ assembly/index.ts:61:6
(set_local $8
;;@ assembly/index.ts:61:27
@ -302,7 +303,6 @@
(i32.and
;;@ assembly/index.ts:62:9
(block $assembly/index/get|inlined.0 (result i32)
(br $assembly/index/get|inlined.0
(i32.load
(i32.shl
(i32.add
@ -316,7 +316,6 @@
)
)
)
)
;;@ assembly/index.ts:62:25
(i32.const 1)
)
@ -324,7 +323,6 @@
(i32.and
;;@ assembly/index.ts:62:31
(block $assembly/index/get|inlined.1 (result i32)
(br $assembly/index/get|inlined.1
(i32.load
(i32.shl
(i32.add
@ -338,7 +336,6 @@
)
)
)
)
;;@ assembly/index.ts:62:47
(i32.const 1)
)
@ -347,7 +344,6 @@
(i32.and
;;@ assembly/index.ts:62:53
(block $assembly/index/get|inlined.2 (result i32)
(br $assembly/index/get|inlined.2
(i32.load
(i32.shl
(i32.add
@ -361,7 +357,6 @@
)
)
)
)
;;@ assembly/index.ts:62:69
(i32.const 1)
)
@ -370,7 +365,6 @@
(i32.and
;;@ assembly/index.ts:63:9
(block $assembly/index/get|inlined.3 (result i32)
(br $assembly/index/get|inlined.3
(i32.load
(i32.shl
(i32.add
@ -384,7 +378,6 @@
)
)
)
)
;;@ assembly/index.ts:63:25
(i32.const 1)
)
@ -393,7 +386,6 @@
(i32.and
;;@ assembly/index.ts:63:53
(block $assembly/index/get|inlined.4 (result i32)
(br $assembly/index/get|inlined.4
(i32.load
(i32.shl
(i32.add
@ -407,7 +399,6 @@
)
)
)
)
;;@ assembly/index.ts:63:69
(i32.const 1)
)
@ -416,7 +407,6 @@
(i32.and
;;@ assembly/index.ts:64:9
(block $assembly/index/get|inlined.5 (result i32)
(br $assembly/index/get|inlined.5
(i32.load
(i32.shl
(i32.add
@ -430,7 +420,6 @@
)
)
)
)
;;@ assembly/index.ts:64:25
(i32.const 1)
)
@ -439,7 +428,6 @@
(i32.and
;;@ assembly/index.ts:64:31
(block $assembly/index/get|inlined.6 (result i32)
(br $assembly/index/get|inlined.6
(i32.load
(i32.shl
(i32.add
@ -453,7 +441,6 @@
)
)
)
)
;;@ assembly/index.ts:64:47
(i32.const 1)
)
@ -462,7 +449,6 @@
(i32.and
;;@ assembly/index.ts:64:53
(block $assembly/index/get|inlined.7 (result i32)
(br $assembly/index/get|inlined.7
(i32.load
(i32.shl
(i32.add
@ -476,7 +462,6 @@
)
)
)
)
;;@ assembly/index.ts:64:69
(i32.const 1)
)
@ -487,8 +472,6 @@
;;@ assembly/index.ts:67:17
(block $assembly/index/get|inlined.8 (result i32)
;;@ assembly/index.ts:15:35
(br $assembly/index/get|inlined.8
;;@ assembly/index.ts:15:9
(i32.load
;;@ assembly/index.ts:15:19
(i32.shl
@ -508,7 +491,6 @@
)
)
)
)
;;@ assembly/index.ts:68:6
(if
;;@ assembly/index.ts:68:10
@ -732,9 +714,7 @@
(i32.const 1)
)
)
(br $continue|1)
)
)
(br $repeat|1)
)
)
)
@ -746,9 +726,7 @@
(i32.const 1)
)
)
(br $continue|0)
)
)
(br $repeat|0)
)
)
)
@ -762,15 +740,17 @@
;;@ assembly/index.ts:85:16
(i32.const 0)
)
(loop $continue|0
(if
(loop $repeat|0
(br_if $break|0
(i32.eqz
;;@ assembly/index.ts:85:19
(i32.lt_s
(get_local $3)
;;@ assembly/index.ts:85:24
(get_global $assembly/index/w)
)
(block
)
)
;;@ assembly/index.ts:85:33
(if
;;@ assembly/index.ts:86:8
@ -816,9 +796,7 @@
(i32.const 1)
)
)
(br $continue|0)
)
)
(br $repeat|0)
)
)
;;@ assembly/index.ts:88:2
@ -828,15 +806,17 @@
;;@ assembly/index.ts:88:16
(i32.const 0)
)
(loop $continue|1
(if
(loop $repeat|1
(br_if $break|1
(i32.eqz
;;@ assembly/index.ts:88:19
(i32.lt_s
(get_local $3)
;;@ assembly/index.ts:88:24
(get_global $assembly/index/h)
)
(block
)
)
;;@ assembly/index.ts:88:33
(if
;;@ assembly/index.ts:89:8
@ -890,9 +870,7 @@
(i32.const 1)
)
)
(br $continue|1)
)
)
(br $repeat|1)
)
)
)

View File

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

View File

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

View File

@ -17,8 +17,8 @@
},
"scripts": {
"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:optimized": "asc -O assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --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 --validate --sourceMap --measure",
"test": "node tests"
},
"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)
(local $4 f64)
(local $5 f64)
(local $6 i32)
(local $6 f64)
(local $7 f64)
(local $8 f64)
(local $8 i32)
(local $9 f64)
(local $10 f64)
(local $11 f64)
@ -21,9 +21,11 @@
(set_local $11
;;@ assembly/index.ts:8:19
(f64.div
(tee_local $6
(f64.convert_u/i32
(get_local $1)
)
)
;;@ assembly/index.ts:8:27
(f64.const 1.6)
)
@ -34,18 +36,22 @@
(f64.mul
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:11:19
(get_local $0)
)
;;@ assembly/index.ts:9:2
(tee_local $7
;;@ assembly/index.ts:9:19
(f64.div
(tee_local $4
(f64.convert_u/i32
(get_local $2)
)
)
;;@ assembly/index.ts:9:28
(f64.const 2)
)
)
)
;;@ assembly/index.ts:10:2
(tee_local $12
;;@ assembly/index.ts:10:14
@ -56,51 +62,38 @@
;;@ assembly/index.ts:10:25
(f64.mul
(f64.const 3)
(f64.convert_u/i32
;;@ assembly/index.ts:10:29
(get_local $1)
)
(get_local $6)
)
;;@ assembly/index.ts:10:36
(f64.mul
(f64.const 4)
(f64.convert_u/i32
;;@ assembly/index.ts:10:40
(get_local $2)
(get_local $4)
)
)
)
)
)
)
)
;;@ assembly/index.ts:12:7
(set_local $2
;;@ assembly/index.ts:12:20
(i32.const 0)
)
(loop $continue|0
(if
;;@ assembly/index.ts:12:2
(block $break|0
(loop $repeat|0
(br_if $break|0
;;@ assembly/index.ts:12:23
(i32.lt_u
(get_local $2)
;;@ assembly/index.ts:12:27
(i32.ge_u
(get_local $8)
(get_local $1)
)
(block
)
;;@ assembly/index.ts:13:4
(set_local $10
;;@ assembly/index.ts:13:15
(f64.mul
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:13:16
(get_local $2)
(get_local $8)
)
;;@ assembly/index.ts:13:20
(get_local $11)
)
;;@ assembly/index.ts:13:34
(get_local $12)
)
)
@ -113,7 +106,7 @@
(f64.const 0)
)
;;@ assembly/index.ts:17:4
(set_local $6
(set_local $2
;;@ assembly/index.ts:17:25
(i32.const 0)
)
@ -124,20 +117,18 @@
;;@ assembly/index.ts:18:11
(f64.le
(f64.add
(tee_local $7
(tee_local $6
;;@ assembly/index.ts:18:19
(f64.mul
(get_local $4)
;;@ assembly/index.ts:18:24
(get_local $4)
)
)
;;@ assembly/index.ts:18:30
(tee_local $8
(tee_local $7
;;@ assembly/index.ts:18:38
(f64.mul
(get_local $5)
;;@ assembly/index.ts:18:43
(get_local $5)
)
)
@ -153,13 +144,10 @@
(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)
)
)
@ -168,11 +156,9 @@
;;@ assembly/index.ts:19:18
(f64.add
(f64.sub
(get_local $6)
(get_local $7)
;;@ assembly/index.ts:19:25
(get_local $8)
)
;;@ assembly/index.ts:19:32
(get_local $10)
)
)
@ -180,16 +166,14 @@
(br_if $break|1
;;@ assembly/index.ts:22:10
(i32.ge_u
(get_local $6)
;;@ assembly/index.ts:22:23
(get_local $2)
(get_local $3)
)
)
;;@ assembly/index.ts:23:6
(set_local $6
(set_local $2
(i32.add
;;@ assembly/index.ts:23:8
(get_local $6)
(get_local $2)
(i32.const 1)
)
)
@ -198,8 +182,10 @@
)
)
)
;;@ assembly/index.ts:27:4
(block $break|2
;;@ assembly/index.ts:27:9
(set_local $7
(set_local $6
;;@ assembly/index.ts:27:29
(f64.min
;;@ assembly/index.ts:27:33
@ -210,35 +196,33 @@
)
)
)
(loop $continue|2
(if
(loop $repeat|2
(br_if $break|2
(i32.eqz
;;@ assembly/index.ts:27:44
(f64.lt
(f64.convert_u/i32
(get_local $2)
)
(get_local $6)
)
;;@ assembly/index.ts:27:56
(get_local $7)
)
(block
)
;;@ assembly/index.ts:28:6
(set_local $8
(set_local $7
;;@ 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)
)
)
@ -249,31 +233,25 @@
(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)
(get_local $7)
)
;;@ assembly/index.ts:27:71
(set_local $6
(set_local $2
(i32.add
;;@ assembly/index.ts:27:73
(get_local $6)
(get_local $2)
(i32.const 1)
)
)
(br $continue|2)
)
(br $repeat|2)
)
)
;;@ assembly/index.ts:40:4
@ -284,22 +262,20 @@
;;@ 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 $8)
)
;;@ assembly/index.ts:40:34
(i32.const 1)
)
(tee_local $2
;;@ assembly/index.ts:37:15
(if (result i32)
(f64.eq
(f64.sub
(tee_local $8
;;@ assembly/index.ts:36:4
(tee_local $7
(tee_local $6
;;@ assembly/index.ts:36:15
(f64.div
;;@ assembly/index.ts:36:20
@ -312,13 +288,11 @@
(f64.add
(f64.mul
(get_local $4)
;;@ assembly/index.ts:36:48
(get_local $4)
)
;;@ assembly/index.ts:36:53
(f64.mul
(get_local $5)
;;@ assembly/index.ts:36:58
(get_local $5)
)
)
@ -329,8 +303,7 @@
(get_global $~lib/math/JSMath.LN2)
)
)
)
(get_local $8)
(get_local $6)
)
(f64.const 0)
)
@ -347,16 +320,14 @@
(f64.convert_u/i32
;;@ assembly/index.ts:38:40
(i32.add
(get_local $6)
(get_local $2)
;;@ assembly/index.ts:38:52
(i32.const 1)
)
)
;;@ assembly/index.ts:38:56
(get_local $7)
(get_local $6)
)
(f64.convert_u/i32
;;@ assembly/index.ts:38:64
(get_local $3)
)
)
@ -366,20 +337,18 @@
)
)
)
;;@ assembly/index.ts:39:8
(i32.const 2047)
)
)
)
;;@ assembly/index.ts:12:34
(set_local $2
(set_local $8
(i32.add
;;@ assembly/index.ts:12:36
(get_local $2)
(get_local $8)
(i32.const 1)
)
)
(br $continue|0)
)
(br $repeat|0)
)
)
)

View File

@ -12,10 +12,9 @@
(export "computeLine" (func $assembly/index/computeLine))
(export "memory" (memory $0))
(func $isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
;;@ ~lib/builtins.ts:21:44
(return
;;@ ~lib/builtins.ts:22:9
;;@ ~lib/builtins.ts:22:26
(f64.eq
;;@ ~lib/builtins.ts:22:9
(f64.sub
(get_local $0)
;;@ ~lib/builtins.ts:22:17
@ -25,11 +24,8 @@
(f64.const 0)
)
)
)
(func $assembly/index/clamp<f64> (; 3 ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64)
;;@ assembly/index.ts:46:57
(return
;;@ assembly/index.ts:47:9
;;@ assembly/index.ts:47:43
(f64.min
;;@ assembly/index.ts:47:13
(f64.max
@ -42,7 +38,6 @@
(get_local $2)
)
)
)
(func $assembly/index/computeLine (; 4 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 f64)
(local $5 f64)
@ -129,15 +124,18 @@
;;@ assembly/index.ts:12:20
(i32.const 0)
)
(loop $continue|0
(if
(loop $repeat|0
(br_if $break|0
(i32.eqz
;;@ assembly/index.ts:12:23
(i32.lt_u
(get_local $8)
;;@ assembly/index.ts:12:27
(get_local $1)
)
(block
)
)
;;@ assembly/index.ts:12:39
(block
;;@ assembly/index.ts:13:4
(set_local $9
@ -155,8 +153,6 @@
(get_local $6)
)
)
;;@ assembly/index.ts:16:4
(block
(set_local $10
;;@ assembly/index.ts:16:13
(f64.const 0)
@ -165,7 +161,6 @@
;;@ assembly/index.ts:16:23
(f64.const 0)
)
)
;;@ assembly/index.ts:17:4
(set_local $14
;;@ assembly/index.ts:17:25
@ -275,8 +270,9 @@
)
)
)
(loop $continue|2
(if
(loop $repeat|2
(br_if $break|2
(i32.eqz
;;@ assembly/index.ts:27:44
(f64.lt
(f64.convert_u/i32
@ -285,7 +281,9 @@
;;@ assembly/index.ts:27:56
(get_local $15)
)
(block
)
)
;;@ assembly/index.ts:27:84
(block
;;@ assembly/index.ts:28:6
(set_local $16
@ -339,9 +337,7 @@
(i32.const 1)
)
)
(br $continue|2)
)
)
(br $repeat|2)
)
)
;;@ assembly/index.ts:36:4
@ -460,9 +456,7 @@
(i32.const 1)
)
)
(br $continue|0)
)
)
(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)
(local $8 i32)
;;@ assembly/index.ts:21:4
(nop)
(tee_local $0
(if (result i32)
(get_local $0)
@ -240,7 +238,7 @@
)
)
(func $assembly/index/Sun (; 3 ;) (type $i) (result i32)
;;@ assembly/index.ts:31:21
;;@ assembly/index.ts:34:2
(call $assembly/index/Body#constructor
(i32.const 0)
;;@ assembly/index.ts:33:4
@ -260,7 +258,7 @@
)
)
(func $assembly/index/Jupiter (; 4 ;) (type $i) (result i32)
;;@ assembly/index.ts:37:25
;;@ assembly/index.ts:46:2
(call $assembly/index/Body#constructor
(i32.const 0)
;;@ assembly/index.ts:39:4
@ -296,7 +294,7 @@
)
)
(func $assembly/index/Saturn (; 5 ;) (type $i) (result i32)
;;@ assembly/index.ts:49:24
;;@ assembly/index.ts:58:2
(call $assembly/index/Body#constructor
(i32.const 0)
;;@ assembly/index.ts:51:4
@ -332,7 +330,7 @@
)
)
(func $assembly/index/Uranus (; 6 ;) (type $i) (result i32)
;;@ assembly/index.ts:61:24
;;@ assembly/index.ts:70:2
(call $assembly/index/Body#constructor
(i32.const 0)
;;@ assembly/index.ts:63:4
@ -368,7 +366,7 @@
)
)
(func $assembly/index/Neptune (; 7 ;) (type $i) (result i32)
;;@ assembly/index.ts:73:25
;;@ assembly/index.ts:82:2
(call $assembly/index/Body#constructor
(i32.const 0)
;;@ assembly/index.ts:75:4
@ -404,7 +402,7 @@
)
)
(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
;;@ ~lib/internal/arraybuffer.ts:17:9
(i32.const 1)
@ -998,8 +996,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
;;@ ~lib/array.ts:21:31
(block
;;@ ~lib/array.ts:23:4
(if
;;@ ~lib/array.ts:23:8
@ -1084,12 +1080,11 @@
;;@ ~lib/array.ts:31:6
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/array/Array<Body>#__unchecked_set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
;;@ ~lib/array.ts:95:54
;;@ ~lib/array.ts:96:4
(block $~lib/internal/arraybuffer/storeUnsafe<Body,Body>|inlined.0
(set_local $3
;;@ ~lib/array.ts:96:21
@ -1116,7 +1111,7 @@
)
)
(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
;;@ ~lib/array.ts:36:11
(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)
(local $2 i32)
;;@ ~lib/array.ts:76:41
;;@ ~lib/array.ts:77:46
(block $~lib/internal/arraybuffer/loadUnsafe<Body,Body>|inlined.0 (result i32)
(set_local $2
;;@ ~lib/array.ts:77:27
@ -1244,8 +1239,6 @@
(local $6 i32)
(local $7 i32)
(local $8 f64)
;;@ assembly/index.ts:89:4
(block
;;@ assembly/index.ts:90:4
(set_local $2
;;@ assembly/index.ts:90:20
@ -1375,7 +1368,6 @@
(get_local $4)
)
)
)
(tee_local $0
(if (result i32)
(get_local $0)
@ -1399,7 +1391,7 @@
)
(func $assembly/index/init (; 18 ;) (type $v)
(local $0 i32)
;;@ assembly/index.ts:190:29
;;@ assembly/index.ts:191:2
(set_global $assembly/index/system
;;@ assembly/index.ts:191:11
(call $assembly/index/NBodySystem#constructor
@ -2215,7 +2207,7 @@
)
(func $assembly/index/bench (; 23 ;) (type $iv) (param $0 i32)
(local $1 i32)
;;@ assembly/index.ts:210:40
;;@ assembly/index.ts:211:2
(block $break|0
;;@ assembly/index.ts:211:7
(set_local $1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,7 +33,10 @@ import {
getConstValueF32,
getConstValueF64,
getFunctionBody,
getGetLocalIndex
getGetLocalIndex,
getBlockChildCount,
getBlockChild,
getBlockName
} from "./module";
import {
@ -167,8 +170,6 @@ export class Options {
noTreeShaking: bool = false;
/** If true, replaces assertions with nops. */
noAssert: bool = false;
/** If true, does not set up a memory. */
noMemory: bool = false;
/** If true, imports the memory provided by the embedder. */
importMemory: bool = false;
/** If true, imports the function table provided by the embedder. */
@ -254,9 +255,9 @@ export class Compiler extends DiagnosticEmitter {
/** Current type in compilation. */
currentType: Type = Type.void;
/** Start function being compiled. */
startFunction: Function;
startFunctionInstance: Function;
/** Start function statements. */
startFunctionBody: ExpressionRef[] = [];
startFunctionBody: ExpressionRef[];
/** Counting memory offset. */
memoryOffset: I64;
/** Memory segments being compiled. */
@ -298,15 +299,11 @@ export class Compiler extends DiagnosticEmitter {
// initialize lookup maps, built-ins, imports, exports, etc.
program.initialize(options);
// set up the start function wrapping top-level statements, of all files.
var startFunctionPrototype = assert(program.elementsLookup.get("start"));
assert(startFunctionPrototype.kind == ElementKind.FUNCTION_PROTOTYPE);
var startFunctionInstance = new Function(
<FunctionPrototype>startFunctionPrototype,
startFunctionPrototype.internalName,
new Signature([], Type.void)
);
this.startFunction = startFunctionInstance;
// set up the start function
var startFunctionInstance = new Function(program.startFunction, "start", new Signature([], Type.void));
this.startFunctionInstance = startFunctionInstance;
var startFunctionBody = new Array<ExpressionRef>();
this.startFunctionBody = startFunctionBody;
this.currentFunction = startFunctionInstance;
// 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]);
}
// compile the start function if not empty
var startFunctionBody = this.startFunctionBody;
if (startFunctionBody.length) {
// compile the start function if not empty or called by main
if (startFunctionBody.length || program.mainFunction !== null) {
let signature = startFunctionInstance.signature;
let funcRef = module.addFunction(
startFunctionInstance.internalName,
@ -330,12 +326,11 @@ export class Compiler extends DiagnosticEmitter {
module.createBlock(null, startFunctionBody)
);
startFunctionInstance.finalize(module, funcRef);
module.setStart(funcRef);
if (!program.mainFunction) module.setStart(funcRef);
}
// set up static memory segments and the heap base pointer
if (!options.noMemory) {
let memoryOffset = this.memoryOffset;
var memoryOffset = this.memoryOffset;
memoryOffset = i64_align(memoryOffset, options.usizeType.byteSize);
this.memoryOffset = memoryOffset;
if (options.isWasm64) {
@ -355,7 +350,7 @@ export class Compiler extends DiagnosticEmitter {
}
// determine initial page size
let pages = i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0));
var pages = i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0));
module.setMemory(
i64_low(pages),
this.options.isWasm64
@ -365,7 +360,6 @@ export class Compiler extends DiagnosticEmitter {
options.target,
"memory"
);
}
// import memory if requested (default memory is named '0' by Binaryen)
if (options.importMemory) module.addMemoryImport("0", "env", "memory");
@ -415,7 +409,7 @@ export class Compiler extends DiagnosticEmitter {
// compile top-level statements
var noTreeShaking = this.options.noTreeShaking;
var isEntry = source.isEntry;
var startFunction = this.startFunction;
var startFunctionInstance = this.startFunctionInstance;
var startFunctionBody = this.startFunctionBody;
var statements = source.statements;
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
let previousFunction = this.currentFunction;
this.currentFunction = startFunction;
this.currentFunction = startFunctionInstance;
startFunctionBody.push(this.compileStatement(statement));
this.currentFunction = previousFunction;
break;
@ -900,7 +894,7 @@ export class Compiler extends DiagnosticEmitter {
let flow = instance.flow;
let stmt: ExpressionRef;
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));
stmt = this.compileExpression(
(<ExpressionStatement>body).expression,
@ -913,7 +907,8 @@ export class Compiler extends DiagnosticEmitter {
flow.finalize();
} else {
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();
if (isConstructor) {
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 (flow.is(FlowFlags.ALLOCATES)) {
stmt = module.createBlock(null, [
stmt,
module.createGetLocal(0, nativeSizeType)
], nativeSizeType);
stmts.push(module.createGetLocal(0, nativeSizeType));
// if not all branches are guaranteed to allocate, also append a conditional allocation
} else {
let parent = assert(instance.parent);
assert(parent.kind == ElementKind.CLASS);
stmt = module.createBlock(null, [
stmt,
module.createTeeLocal(0,
stmts.push(module.createTeeLocal(0,
this.makeConditionalAllocate(<Class>parent, declaration.name)
)
], nativeSizeType);
));
}
}
@ -949,6 +938,11 @@ export class Compiler extends DiagnosticEmitter {
declaration.signature.returnType.range
);
}
stmt = !stmts.length
? module.createNop()
: stmts.length == 1
? stmts[0]
: module.createBlock(null, stmts, returnType.toNativeType());
}
this.currentFunction = previousFunction;
@ -1451,7 +1445,7 @@ export class Compiler extends DiagnosticEmitter {
case NodeKind.TYPEDECLARATION: {
// type declarations must be top-level because function bodies are evaluated when
// reachaable only.
if (this.currentFunction == this.startFunction) {
if (this.currentFunction == this.startFunctionInstance) {
return module.createNop();
}
// otherwise fall-through
@ -1468,16 +1462,23 @@ export class Compiler extends DiagnosticEmitter {
compileStatements(statements: Statement[]): ExpressionRef[] {
var numStatements = statements.length;
var stmts = new Array<ExpressionRef>(numStatements);
var count = 0;
stmts.length = 0;
var flow = this.currentFunction.flow;
for (let i = 0; i < numStatements; ++i) {
let stmt = this.compileStatement(statements[i]);
if (getExpressionId(stmt) != ExpressionId.Nop) {
stmts[count++] = stmt;
switch (getExpressionId(stmt)) {
case ExpressionId.Block: {
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;
}
@ -1949,7 +1950,7 @@ export class Compiler extends DiagnosticEmitter {
// top-level variables and constants become globals
if (isKnownGlobal || (
currentFunction == this.startFunction &&
currentFunction == this.startFunctionInstance &&
statement.parent && statement.parent.kind == NodeKind.SOURCE
)) {
// 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;
}
/** Sets the `noMemory` option. */
export function setNoMemory(options: Options, noMemory: bool): void {
options.noMemory = noMemory;
}
/** Sets the `importMemory` option. */
export function setImportMemory(options: Options, importMemory: bool): void {
options.importMemory = importMemory;

View File

@ -329,6 +329,10 @@ export class Program extends DiagnosticEmitter {
arrayBufferViewPrototype: InterfacePrototype | null = null;
/** String instance reference. */
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. */
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. */
@ -758,15 +781,15 @@ export class Program extends DiagnosticEmitter {
this.fileLevelExports.set(internalName, prototype);
this.currentFilespace.members.set(simpleName, prototype);
if (prototype.is(CommonFlags.EXPORT) && declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
if (this.moduleLevelExports.has(simpleName)) {
this.error(
DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,
declaration.name.range, internalName
declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
);
return;
}
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.currentFilespace.members.set(simpleName, element);
if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
if (this.moduleLevelExports.has(simpleName)) {
this.error(
DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,
declaration.name.range, internalName
declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
);
return;
}
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.currentFilespace.members.set(simpleName, prototype);
if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
if (this.moduleLevelExports.has(simpleName)) {
this.error(
DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName
declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
);
return;
}
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.currentFilespace.members.set(simpleName, prototype);
if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
if (this.moduleLevelExports.has(simpleName)) {
this.error(
DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName
declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
);
return;
}
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);
if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
if (this.moduleLevelExports.has(simpleName)) {
this.error(
DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName
declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
);
return;
}
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);
if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
if (this.moduleLevelExports.has(simpleName)) {
this.error(
DiagnosticCode.Duplicate_identifier_0,
declaration.name.range, internalName
declaration.name.range, (<Element>this.moduleLevelExports.get(simpleName)).internalName
);
continue;
}
global.set(CommonFlags.MODULE_EXPORT);
this.moduleLevelExports.set(internalName, global);
this.moduleLevelExports.set(simpleName, global);
}
}
this.checkGlobalOptions(global, declaration);

View File

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

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,14 +413,12 @@
(get_local $6)
)
)
(block
(set_local $10
(f64.const 0)
)
(set_local $11
(f64.const 0)
)
)
(set_local $14
(i32.const 0)
)

View File

@ -574,7 +574,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -640,7 +639,6 @@
(i32.const 0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/array/Array<i32>#__unchecked_set (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)

View File

@ -597,7 +597,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -663,7 +662,6 @@
(i32.const 0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/array/Array<i32>#get:length (; 7 ;) (type $ii) (param $0 i32) (result i32)
@ -4292,7 +4290,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -4358,7 +4355,6 @@
(i32.const 0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/array/Array<i32>#map<f32> (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
@ -6490,7 +6486,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -6556,7 +6551,6 @@
(i32.const 0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/array/Array<Array<i32>>#get:length (; 97 ;) (type $ii) (param $0 i32) (result i32)
@ -7108,7 +7102,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -7174,7 +7167,6 @@
(i32.const 0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/array/Array<Proxy<i32>>#get:length (; 107 ;) (type $ii) (param $0 i32) (result i32)
@ -7184,7 +7176,6 @@
)
(func $std/array/Proxy<i32>#constructor (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(nop)
(tee_local $0
(if (result i32)
(get_local $0)
@ -8530,7 +8521,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -8596,7 +8586,6 @@
(i32.const 0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/string/allocate (; 131 ;) (type $ii) (param $0 i32) (result i32)

View File

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

View File

@ -401,14 +401,12 @@
(set_local $3
(i32.const 1)
)
(block
(set_local $4
(f64.const 0)
)
(set_local $5
(f64.const 0)
)
)
(if
(if (result i32)
(tee_local $6
@ -2782,7 +2780,6 @@
)
)
)
(block
(set_local $3
(i32.const 0)
)
@ -2794,7 +2791,6 @@
)
)
)
)
(if
(i32.ge_u
(get_local $2)

View File

@ -1373,14 +1373,12 @@
(set_local $3
(i32.const 1)
)
(block
(set_local $4
(f64.const 0)
)
(set_local $5
(f64.const 0)
)
)
(if
(if (result i32)
(tee_local $6
@ -2141,14 +2139,12 @@
(get_local $0)
)
)
(block
(set_local $2
(f32.const 0)
)
(set_local $3
(f32.const 0)
)
)
(set_local $4
(i32.const 1)
)
@ -6010,7 +6006,6 @@
)
)
)
(block
(set_local $3
(i32.const 0)
)
@ -6022,7 +6017,6 @@
)
)
)
)
(if
(i32.ge_u
(get_local $2)

View File

@ -123,7 +123,6 @@
)
(func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)
(local $2 i32)
(block
(i32.store
(get_local $0)
(i32.add
@ -160,7 +159,6 @@
(get_local $0)
(get_local $1)
)
)
(get_local $0)
)
(func $start (; 2 ;) (type $v)

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)
(local $3 i32)
(nop)
(tee_local $0
(if (result i32)
(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)
(local $3 i32)
(nop)
(tee_local $0
(if (result i32)
(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)
(local $3 i32)
(nop)
(tee_local $0
(if (result i32)
(get_local $0)

View File

@ -458,7 +458,6 @@
(unreachable)
)
)
(block
(set_local $2
(i64.and
(i64.shr_u
@ -511,7 +510,6 @@
)
)
)
)
(func $~lib/polyfills/bswap<i64> (; 8 ;) (type $II) (param $0 i64) (result i64)
(local $1 i32)
(local $2 i64)
@ -561,7 +559,6 @@
(unreachable)
)
)
(block
(set_local $2
(i64.and
(i64.shr_u
@ -614,7 +611,6 @@
)
)
)
)
(func $~lib/polyfills/bswap<usize> (; 9 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if

View File

@ -538,7 +538,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -612,7 +611,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i8,i32>#get:length (; 6 ;) (type $ii) (param $0 i32) (result i32)
@ -632,7 +630,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -706,7 +703,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<u8,u32>#get:length (; 8 ;) (type $ii) (param $0 i32) (result i32)
@ -726,7 +722,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -800,7 +795,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i16,i32>#get:length (; 10 ;) (type $ii) (param $0 i32) (result i32)
@ -820,7 +814,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -894,7 +887,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<u16,u32>#get:length (; 12 ;) (type $ii) (param $0 i32) (result i32)
@ -914,7 +906,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -988,7 +979,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i32,i32>#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32)
@ -1008,7 +998,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -1082,7 +1071,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<u32,u32>#get:length (; 16 ;) (type $ii) (param $0 i32) (result i32)
@ -1102,7 +1090,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -1176,7 +1163,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i64,i64>#get:length (; 18 ;) (type $ii) (param $0 i32) (result i32)
@ -1196,7 +1182,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -1270,7 +1255,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<u64,u64>#get:length (; 20 ;) (type $ii) (param $0 i32) (result i32)
@ -1290,7 +1274,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -1364,7 +1347,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<f32,f32>#get:length (; 22 ;) (type $ii) (param $0 i32) (result i32)
@ -1384,7 +1366,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(block
(if
(i32.gt_u
(get_local $1)
@ -1458,7 +1439,6 @@
(get_local $0)
(get_local $2)
)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<f64,f64>#get:length (; 24 ;) (type $ii) (param $0 i32) (result i32)