Use stack IR when emitting text format (#312)

This commit is contained in:
Daniel Wirtz
2018-11-08 08:04:24 +01:00
committed by GitHub
parent 7135af36bd
commit 2bdc2a72f1
194 changed files with 239934 additions and 340697 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,15 +3,15 @@
(type $FF (func (param f64) (result f64)))
(type $v (func))
(import "env" "memory" (memory $0 0))
(table 1 anyfunc)
(elem (i32.const 0) $null)
(import "Math" "LN2" (global $~lib/bindings/Math/LN2 f64))
(import "Math" "sqrt" (func $~lib/bindings/Math/sqrt (param f64) (result f64)))
(import "Math" "log" (func $~lib/bindings/Math/log (param f64) (result f64)))
(table $0 1 anyfunc)
(elem (i32.const 0) $null)
(export "memory" (memory $0))
(export "table" (table $0))
(export "computeLine" (func $assembly/index/computeLine))
(func $assembly/index/computeLine (; 2 ;) (; has Stack IR ;) (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 $5 f64)
(local $6 f64)
@ -21,342 +21,191 @@
(local $10 f64)
(local $11 f64)
(local $12 f64)
;;@ assembly/index.ts:8:2
(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)
)
)
;;@ assembly/index.ts:11:2
(set_local $9
;;@ assembly/index.ts:11:18
(f64.mul
(f64.sub
(f64.convert_u/i32
(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
(f64.div
(f64.const 10)
;;@ assembly/index.ts:10:21
(f64.min
;;@ assembly/index.ts:10:25
(f64.mul
(f64.const 3)
(get_local $6)
)
;;@ assembly/index.ts:10:36
(f64.mul
(f64.const 4)
(get_local $4)
)
)
)
)
)
)
;;@ assembly/index.ts:12:2
(block $break|0
(loop $repeat|0
(br_if $break|0
;;@ assembly/index.ts:12:23
(i32.ge_u
(get_local $8)
(get_local $1)
)
)
;;@ assembly/index.ts:13:4
(set_local $10
;;@ assembly/index.ts:13:15
(f64.mul
(f64.sub
(f64.convert_u/i32
(get_local $8)
)
(get_local $11)
)
(get_local $12)
)
)
(set_local $4
;;@ assembly/index.ts:16:13
(f64.const 0)
)
(set_local $5
;;@ assembly/index.ts:16:23
(f64.const 0)
)
;;@ assembly/index.ts:17:4
(set_local $2
;;@ assembly/index.ts:17:25
(i32.const 0)
)
;;@ assembly/index.ts:18:4
(block $break|1
(loop $continue|1
(if
;;@ 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.mul
(f64.mul
(f64.const 2)
(get_local $4)
)
(get_local $5)
)
(get_local $9)
)
)
;;@ assembly/index.ts:21:6
(set_local $4
;;@ assembly/index.ts:19:18
(f64.add
(f64.sub
(get_local $6)
(get_local $7)
)
(get_local $10)
)
)
;;@ 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
(set_local $6
;;@ 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 $2)
)
(get_local $6)
)
)
)
;;@ assembly/index.ts:28:6
(set_local $7
;;@ assembly/index.ts:28:18
(f64.add
(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
(get_local $2)
(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
(if (result i32)
(f64.eq
(f64.sub
;;@ assembly/index.ts:36:4
(tee_local $6
;;@ assembly/index.ts:36:15
(f64.div
;;@ assembly/index.ts:36:20
(call $~lib/bindings/Math/log
;;@ assembly/index.ts:36:29
(call $~lib/bindings/Math/log
;;@ assembly/index.ts:36:38
(call $~lib/bindings/Math/sqrt
;;@ assembly/index.ts:36:43
(f64.add
(f64.mul
(get_local $4)
(get_local $4)
)
;;@ assembly/index.ts:36:53
(f64.mul
(get_local $5)
(get_local $5)
)
)
)
)
)
;;@ assembly/index.ts:36:66
(get_global $~lib/bindings/Math/LN2)
)
)
(get_local $6)
)
(f64.const 0)
)
;;@ assembly/index.ts:38:8
(i32.trunc_u/f64
;;@ assembly/index.ts:38:14
(f64.mul
(f64.const 2047)
(f64.min
(f64.max
;;@ assembly/index.ts:38:39
(f64.div
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:38:40
(i32.add
(get_local $2)
;;@ assembly/index.ts:38:52
(i32.const 1)
)
)
(get_local $6)
)
(f64.convert_u/i32
(get_local $3)
)
)
(f64.const 0)
)
(f64.const 1)
)
)
)
(i32.const 2047)
)
)
)
;;@ assembly/index.ts:12:34
(set_local $8
(i32.add
(get_local $8)
(i32.const 1)
)
)
(br $repeat|0)
)
)
get_local $1
f64.convert_u/i32
tee_local $6
f64.const 1.6
f64.div
set_local $11
get_local $0
f64.convert_u/i32
get_local $2
f64.convert_u/i32
tee_local $4
f64.const 2
f64.div
tee_local $7
f64.sub
f64.const 10
f64.const 3
get_local $6
f64.mul
f64.const 4
get_local $4
f64.mul
f64.min
f64.div
tee_local $12
f64.mul
set_local $9
block $break|0
loop $repeat|0
get_local $8
get_local $1
i32.ge_u
br_if $break|0
get_local $8
f64.convert_u/i32
get_local $11
f64.sub
get_local $12
f64.mul
set_local $10
f64.const 0
set_local $4
f64.const 0
set_local $5
i32.const 0
set_local $2
block $break|1
loop $continue|1
get_local $4
get_local $4
f64.mul
tee_local $6
get_local $5
get_local $5
f64.mul
tee_local $7
f64.add
f64.const 4
f64.le
if
f64.const 2
get_local $4
f64.mul
get_local $5
f64.mul
get_local $9
f64.add
set_local $5
get_local $6
get_local $7
f64.sub
get_local $10
f64.add
set_local $4
get_local $2
get_local $3
i32.ge_u
br_if $break|1
get_local $2
i32.const 1
i32.add
set_local $2
br $continue|1
end
end
end
block $break|2
f64.const 8
get_local $3
f64.convert_u/i32
f64.min
set_local $6
loop $repeat|2
get_local $2
f64.convert_u/i32
get_local $6
f64.lt
i32.eqz
br_if $break|2
get_local $4
get_local $4
f64.mul
get_local $5
get_local $5
f64.mul
f64.sub
get_local $10
f64.add
set_local $7
f64.const 2
get_local $4
f64.mul
get_local $5
f64.mul
get_local $9
f64.add
set_local $5
get_local $7
set_local $4
get_local $2
i32.const 1
i32.add
set_local $2
br $repeat|2
unreachable
end
unreachable
end
get_local $0
get_local $1
i32.mul
get_local $8
i32.add
i32.const 1
i32.shl
get_local $4
get_local $4
f64.mul
get_local $5
get_local $5
f64.mul
f64.add
call $~lib/bindings/Math/sqrt
call $~lib/bindings/Math/log
call $~lib/bindings/Math/log
get_global $~lib/bindings/Math/LN2
f64.div
tee_local $6
get_local $6
f64.sub
f64.const 0
f64.eq
if (result i32)
f64.const 2047
get_local $2
i32.const 1
i32.add
f64.convert_u/i32
get_local $6
f64.sub
get_local $3
f64.convert_u/i32
f64.div
f64.const 0
f64.max
f64.const 1
f64.min
f64.mul
i32.trunc_u/f64
else
i32.const 2047
end
tee_local $2
i32.store16
get_local $8
i32.const 1
i32.add
set_local $8
br $repeat|0
unreachable
end
unreachable
end
)
(func $null (; 3 ;) (; has Stack IR ;) (type $v)
(nop)
(func $null (; 3 ;) (type $v)
nop
)
)

View File

@ -5,42 +5,29 @@
(type $FFFF (func (param f64 f64 f64) (result f64)))
(type $v (func))
(import "env" "memory" (memory $0 0))
(table 1 anyfunc)
(elem (i32.const 0) $null)
(import "Math" "LN2" (global $~lib/bindings/Math/LN2 f64))
(import "Math" "sqrt" (func $~lib/bindings/Math/sqrt (param f64) (result f64)))
(import "Math" "log" (func $~lib/bindings/Math/log (param f64) (result f64)))
(table $0 1 anyfunc)
(elem (i32.const 0) $null)
(global $assembly/index/NUM_COLORS i32 (i32.const 2048))
(global $HEAP_BASE i32 (i32.const 8))
(export "memory" (memory $0))
(export "table" (table $0))
(export "computeLine" (func $assembly/index/computeLine))
(func $~lib/builtins/isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
;;@ ~lib/builtins.ts:16:78
(f64.eq
;;@ ~lib/builtins.ts:16:61
(f64.sub
(get_local $0)
;;@ ~lib/builtins.ts:16:69
(get_local $0)
)
;;@ ~lib/builtins.ts:16:78
(f64.const 0)
)
get_local $0
get_local $0
f64.sub
f64.const 0
f64.eq
)
(func $assembly/index/clamp<f64> (; 3 ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64)
;;@ assembly/index.ts:47:43
(f64.min
;;@ assembly/index.ts:47:13
(f64.max
;;@ assembly/index.ts:47:17
(get_local $0)
;;@ assembly/index.ts:47:24
(get_local $1)
)
;;@ assembly/index.ts:47:35
(get_local $2)
)
get_local $0
get_local $1
f64.max
get_local $2
f64.min
)
(func $assembly/index/computeLine (; 4 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 f64)
@ -57,413 +44,207 @@
(local $15 f64)
(local $16 f64)
(local $17 i32)
;;@ assembly/index.ts:8:2
(set_local $4
;;@ assembly/index.ts:8:19
(f64.div
(f64.convert_u/i32
(get_local $1)
)
;;@ assembly/index.ts:8:27
(f64.const 1.6)
)
)
;;@ assembly/index.ts:9:2
(set_local $5
;;@ assembly/index.ts:9:19
(f64.div
(f64.convert_u/i32
(get_local $2)
)
;;@ assembly/index.ts:9:28
(f64.const 2)
)
)
;;@ assembly/index.ts:10:2
(set_local $6
;;@ assembly/index.ts:10:14
(f64.div
(f64.const 10)
;;@ assembly/index.ts:10:21
(f64.min
;;@ assembly/index.ts:10:25
(f64.mul
(f64.const 3)
(f64.convert_u/i32
;;@ assembly/index.ts:10:29
(get_local $1)
)
)
;;@ assembly/index.ts:10:36
(f64.mul
(f64.const 4)
(f64.convert_u/i32
;;@ assembly/index.ts:10:40
(get_local $2)
)
)
)
)
)
;;@ assembly/index.ts:11:2
(set_local $7
;;@ assembly/index.ts:11:18
(f64.mul
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:11:19
(get_local $0)
)
;;@ assembly/index.ts:11:23
(get_local $5)
)
;;@ assembly/index.ts:11:37
(get_local $6)
)
)
;;@ assembly/index.ts:12:2
(block $break|0
;;@ assembly/index.ts:12:7
(set_local $8
;;@ assembly/index.ts:12:20
(i32.const 0)
)
(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)
)
)
)
;;@ assembly/index.ts:12:39
(block
;;@ assembly/index.ts:13:4
(set_local $9
;;@ assembly/index.ts:13:15
(f64.mul
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:13:16
(get_local $8)
)
;;@ assembly/index.ts:13:20
(get_local $4)
)
;;@ assembly/index.ts:13:34
(get_local $6)
)
)
(set_local $10
;;@ assembly/index.ts:16:13
(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:25
(i32.const 0)
)
;;@ assembly/index.ts:18:4
(block $break|1
(loop $continue|1
(if
;;@ assembly/index.ts:18:11
(f64.le
(f64.add
(tee_local $12
;;@ assembly/index.ts:18:19
(f64.mul
(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:55
(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:27
(get_local $7)
)
)
;;@ assembly/index.ts:21:6
(set_local $10
;;@ assembly/index.ts:21:11
(get_local $15)
)
;;@ assembly/index.ts:22:6
(if
;;@ assembly/index.ts:22:10
(i32.ge_u
(get_local $14)
;;@ assembly/index.ts:22:23
(get_local $3)
)
;;@ assembly/index.ts:22:30
(br $break|1)
)
;;@ assembly/index.ts:23:6
(set_local $14
(i32.add
;;@ assembly/index.ts:23:8
(get_local $14)
(i32.const 1)
)
)
)
(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 $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/bindings/Math/log
;;@ assembly/index.ts:36:29
(call $~lib/bindings/Math/log
;;@ assembly/index.ts:36:38
(call $~lib/bindings/Math/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/bindings/Math/LN2)
)
)
;;@ assembly/index.ts:37:4
(set_local $17
;;@ assembly/index.ts:37:15
(if (result i32)
(call $~lib/builtins/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
(get_global $assembly/index/NUM_COLORS)
;;@ 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
(get_global $assembly/index/NUM_COLORS)
;;@ 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)
)
)
(br $repeat|0)
)
)
get_local $1
f64.convert_u/i32
f64.const 1.6
f64.div
set_local $4
get_local $2
f64.convert_u/i32
f64.const 2
f64.div
set_local $5
f64.const 10
f64.const 3
get_local $1
f64.convert_u/i32
f64.mul
f64.const 4
get_local $2
f64.convert_u/i32
f64.mul
f64.min
f64.div
set_local $6
get_local $0
f64.convert_u/i32
get_local $5
f64.sub
get_local $6
f64.mul
set_local $7
block $break|0
i32.const 0
set_local $8
loop $repeat|0
get_local $8
get_local $1
i32.lt_u
i32.eqz
br_if $break|0
block
get_local $8
f64.convert_u/i32
get_local $4
f64.sub
get_local $6
f64.mul
set_local $9
f64.const 0
set_local $10
f64.const 0
set_local $11
i32.const 0
set_local $14
block $break|1
loop $continue|1
get_local $10
get_local $10
f64.mul
tee_local $12
get_local $11
get_local $11
f64.mul
tee_local $13
f64.add
f64.const 4
f64.le
if
block
get_local $12
get_local $13
f64.sub
get_local $9
f64.add
set_local $15
f64.const 2
get_local $10
f64.mul
get_local $11
f64.mul
get_local $7
f64.add
set_local $11
get_local $15
set_local $10
get_local $14
get_local $3
i32.ge_u
if
br $break|1
end
get_local $14
i32.const 1
i32.add
set_local $14
end
br $continue|1
end
end
end
block $break|2
f64.const 8
get_local $3
f64.convert_u/i32
f64.min
set_local $15
loop $repeat|2
get_local $14
f64.convert_u/i32
get_local $15
f64.lt
i32.eqz
br_if $break|2
block
get_local $10
get_local $10
f64.mul
get_local $11
get_local $11
f64.mul
f64.sub
get_local $9
f64.add
set_local $16
f64.const 2
get_local $10
f64.mul
get_local $11
f64.mul
get_local $7
f64.add
set_local $11
get_local $16
set_local $10
end
get_local $14
i32.const 1
i32.add
set_local $14
br $repeat|2
unreachable
end
unreachable
end
get_local $10
get_local $10
f64.mul
get_local $11
get_local $11
f64.mul
f64.add
call $~lib/bindings/Math/sqrt
call $~lib/bindings/Math/log
call $~lib/bindings/Math/log
get_global $~lib/bindings/Math/LN2
f64.div
set_local $15
get_local $15
call $~lib/builtins/isFinite<f64>
if (result i32)
get_global $assembly/index/NUM_COLORS
i32.const 1
i32.sub
f64.convert_s/i32
get_local $14
i32.const 1
i32.add
f64.convert_u/i32
get_local $15
f64.sub
get_local $3
f64.convert_u/i32
f64.div
f64.const 0
f64.const 1
call $assembly/index/clamp<f64>
f64.mul
i32.trunc_u/f64
else
get_global $assembly/index/NUM_COLORS
i32.const 1
i32.sub
end
set_local $17
get_local $0
get_local $1
i32.mul
get_local $8
i32.add
i32.const 1
i32.shl
get_local $17
i32.store16
end
get_local $8
i32.const 1
i32.add
set_local $8
br $repeat|0
unreachable
end
unreachable
end
)
(func $null (; 5 ;) (type $v)
)

View File

@ -447,7 +447,7 @@ function asmFunc(global, env, buffer) {
pagesToAdd = pagesToAdd | 0;
var oldPages = __wasm_current_memory() | 0;
var newPages = oldPages + pagesToAdd | 0;
if ((oldPages < newPages) && (newPages < 65535)) {
if ((oldPages < newPages) && (newPages < 65536)) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new global.Int8Array(newBuffer);
newHEAP8.set(HEAP8);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,6 @@
(type $Fv (func (param f64)))
(type $i (func (result i32)))
(type $I (func (result i64)))
(memory $0 0)
(table 1 anyfunc)
(elem (i32.const 0) $null)
(import "pson" "onNull" (func $assembly/pson/onNull))
(import "pson" "onTrue" (func $assembly/pson/onTrue))
(import "pson" "onFalse" (func $assembly/pson/onFalse))
@ -23,6 +20,9 @@
(import "pson" "onDouble" (func $assembly/pson/onDouble (param f64)))
(import "pson" "onString" (func $assembly/pson/onString (param i32 i32)))
(import "pson" "onBinary" (func $assembly/pson/onBinary (param i32 i32)))
(memory $0 0)
(table $0 1 anyfunc)
(elem (i32.const 0) $null)
(global $assembly/pson/offset (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "table" (table $0))
@ -41,537 +41,304 @@
(export "onString" (func $assembly/pson/onString))
(export "onBinary" (func $assembly/pson/onBinary))
(export "decode" (func $assembly/pson/decode))
(func $assembly/pson/readVarint32 (; 14 ;) (; has Stack IR ;) (type $i) (result i32)
(func $assembly/pson/readVarint32 (; 14 ;) (type $i) (result i32)
(local $0 i32)
(local $1 i32)
(local $2 i32)
(loop $continue|0
;;@ assembly/pson.ts:138:4
(set_local $0
(i32.or
(get_local $0)
;;@ assembly/pson.ts:137:17
(block (result i32)
(set_global $assembly/pson/offset
(i32.add
(tee_local $0
(get_global $assembly/pson/offset)
)
(i32.const 1)
)
)
;;@ assembly/pson.ts:138:13
(i32.shl
(i32.and
;;@ assembly/pson.ts:137:4
(tee_local $2
;;@ assembly/pson.ts:137:8
(i32.load8_u
(get_local $0)
)
)
;;@ assembly/pson.ts:138:23
(i32.const 127)
)
;;@ assembly/pson.ts:138:37
(block (result i32)
(set_local $1
(i32.add
(tee_local $0
(get_local $1)
)
(i32.const 1)
)
)
;;@ assembly/pson.ts:138:32
(i32.mul
(get_local $0)
;;@ assembly/pson.ts:138:33
(i32.const 7)
)
)
)
)
)
)
(br_if $continue|0
;;@ assembly/pson.ts:139:11
(i32.and
(get_local $2)
;;@ assembly/pson.ts:139:15
(i32.const 128)
)
)
)
;;@ assembly/pson.ts:140:9
(get_local $0)
loop $continue|0
get_local $0
block (result i32)
get_global $assembly/pson/offset
tee_local $0
i32.const 1
i32.add
set_global $assembly/pson/offset
get_local $0
i32.load8_u
tee_local $2
i32.const 127
i32.and
block (result i32)
get_local $1
tee_local $0
i32.const 1
i32.add
set_local $1
get_local $0
i32.const 7
i32.mul
end
i32.shl
end
i32.or
set_local $0
get_local $2
i32.const 128
i32.and
br_if $continue|0
end
get_local $0
)
(func $assembly/pson/readVarint64 (; 15 ;) (; has Stack IR ;) (type $I) (result i64)
(func $assembly/pson/readVarint64 (; 15 ;) (type $I) (result i64)
(local $0 i64)
(local $1 i32)
(local $2 i64)
(loop $continue|0
;;@ assembly/pson.ts:149:4
(set_local $0
(i64.or
(get_local $0)
;;@ assembly/pson.ts:148:17
(block (result i64)
(set_global $assembly/pson/offset
(i32.add
(tee_local $1
(get_global $assembly/pson/offset)
)
(i32.const 1)
)
)
(set_local $2
(i64.add
(tee_local $0
;;@ assembly/pson.ts:149:37
(get_local $2)
)
(i64.const 1)
)
)
;;@ assembly/pson.ts:149:13
(i64.shl
(i64.extend_u/i32
;;@ assembly/pson.ts:149:19
(i32.and
;;@ assembly/pson.ts:148:4
(tee_local $1
;;@ assembly/pson.ts:148:8
(i32.load8_u
(get_local $1)
)
)
;;@ assembly/pson.ts:149:23
(i32.const 127)
)
)
;;@ assembly/pson.ts:149:32
(i64.mul
(get_local $0)
;;@ assembly/pson.ts:149:33
(i64.const 7)
)
)
)
)
)
(br_if $continue|0
;;@ assembly/pson.ts:150:11
(i32.and
(get_local $1)
;;@ assembly/pson.ts:150:15
(i32.const 128)
)
)
)
;;@ assembly/pson.ts:151:9
(get_local $0)
loop $continue|0
get_local $0
block (result i64)
get_global $assembly/pson/offset
tee_local $1
i32.const 1
i32.add
set_global $assembly/pson/offset
get_local $2
tee_local $0
i64.const 1
i64.add
set_local $2
get_local $1
i32.load8_u
tee_local $1
i32.const 127
i32.and
i64.extend_u/i32
get_local $0
i64.const 7
i64.mul
i64.shl
end
i64.or
set_local $0
get_local $1
i32.const 128
i32.and
br_if $continue|0
end
get_local $0
)
(func $assembly/pson/decodeValue (; 16 ;) (; has Stack IR ;) (type $v)
(func $assembly/pson/decodeValue (; 16 ;) (type $v)
(local $0 i32)
(local $1 i32)
(local $2 i64)
;;@ assembly/pson.ts:49:2
(block $break|0
(block $case16|0
(block $case15|0
(block $case14|0
(block $case12|0
(block $case11|0
(block $case10|0
(block $case9|0
(block $case8|0
(block $case7|0
(block $case6|0
(block $case5|0
(block $case4|0
(block $case3|0
(block $case2|0
(block $case1|0
(if
;;@ assembly/pson.ts:46:28
(block (result i32)
(set_global $assembly/pson/offset
(i32.add
(tee_local $1
(get_global $assembly/pson/offset)
)
(i32.const 1)
)
)
(i32.ne
(tee_local $1
;;@ assembly/pson.ts:46:2
(tee_local $0
;;@ assembly/pson.ts:46:19
(i32.load8_u
(get_local $1)
)
)
)
(i32.const 240)
)
)
(block
(block $tablify|0
(br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 $case12|0 $tablify|0
(i32.sub
(get_local $1)
(i32.const 241)
)
)
)
(br_if $case14|0
(i32.or
(i32.eq
(get_local $1)
(i32.const 253)
)
(i32.eq
(get_local $1)
(i32.const 254)
)
)
)
(br_if $case15|0
(i32.eq
(get_local $1)
(i32.const 255)
)
)
(br $case16|0)
)
)
;;@ assembly/pson.ts:51:6
(call $assembly/pson/onNull)
;;@ assembly/pson.ts:52:6
(br $break|0)
)
;;@ assembly/pson.ts:55:6
(call $assembly/pson/onTrue)
;;@ assembly/pson.ts:56:6
(br $break|0)
)
;;@ assembly/pson.ts:59:6
(call $assembly/pson/onFalse)
;;@ assembly/pson.ts:60:6
(br $break|0)
)
;;@ assembly/pson.ts:63:6
(call $assembly/pson/onEObject)
;;@ assembly/pson.ts:64:6
(br $break|0)
)
;;@ assembly/pson.ts:67:6
(call $assembly/pson/onEArray)
;;@ assembly/pson.ts:68:6
(br $break|0)
)
;;@ assembly/pson.ts:71:6
(call $assembly/pson/onEString)
;;@ assembly/pson.ts:72:6
(br $break|0)
)
;;@ assembly/pson.ts:75:6
(call $assembly/pson/onObject
;;@ assembly/pson.ts:75:15
(tee_local $0
;;@ assembly/pson.ts:75:22
(call $assembly/pson/readVarint32)
)
)
(loop $continue|1
(if
;;@ assembly/pson.ts:76:13
(block (result i32)
(set_local $0
(i32.sub
(tee_local $1
(get_local $0)
)
(i32.const 1)
)
)
(get_local $1)
)
(block
;;@ assembly/pson.ts:77:8
(call $assembly/pson/decodeValue)
;;@ assembly/pson.ts:78:8
(call $assembly/pson/decodeValue)
(br $continue|1)
)
)
)
;;@ assembly/pson.ts:80:6
(br $break|0)
)
;;@ assembly/pson.ts:83:6
(call $assembly/pson/onArray
;;@ assembly/pson.ts:83:14
(tee_local $0
;;@ assembly/pson.ts:83:21
(call $assembly/pson/readVarint32)
)
)
(loop $continue|2
(if
;;@ assembly/pson.ts:84:13
(block (result i32)
(set_local $0
(i32.sub
(tee_local $1
(get_local $0)
)
(i32.const 1)
)
)
(get_local $1)
)
(block
;;@ assembly/pson.ts:84:21
(call $assembly/pson/decodeValue)
(br $continue|2)
)
)
)
;;@ assembly/pson.ts:85:6
(br $break|0)
)
;;@ assembly/pson.ts:88:6
(call $assembly/pson/onInteger
;;@ assembly/pson.ts:88:16
(i32.xor
(i32.shr_u
;;@ assembly/pson.ts:88:17
(tee_local $0
;;@ assembly/pson.ts:88:25
(call $assembly/pson/readVarint32)
)
;;@ assembly/pson.ts:88:44
(i32.const 1)
)
;;@ assembly/pson.ts:88:49
(i32.sub
(i32.const 0)
;;@ assembly/pson.ts:88:50
(i32.and
;;@ assembly/pson.ts:88:51
(get_local $0)
;;@ assembly/pson.ts:88:58
(i32.const 1)
)
)
)
)
;;@ assembly/pson.ts:89:6
(br $break|0)
)
;;@ assembly/pson.ts:93:6
(call $assembly/pson/onLong
;;@ assembly/pson.ts:93:13
(i32.wrap/i64
;;@ assembly/pson.ts:92:6
(tee_local $2
;;@ assembly/pson.ts:92:13
(i64.xor
(i64.shr_u
;;@ assembly/pson.ts:92:14
(tee_local $2
;;@ assembly/pson.ts:92:22
(call $assembly/pson/readVarint64)
)
;;@ assembly/pson.ts:92:41
(i64.const 1)
)
;;@ assembly/pson.ts:92:46
(i64.sub
(i64.const 0)
;;@ assembly/pson.ts:92:47
(i64.and
;;@ assembly/pson.ts:92:48
(get_local $2)
;;@ assembly/pson.ts:92:55
(i64.const 1)
)
)
)
)
)
;;@ assembly/pson.ts:93:24
(i32.wrap/i64
;;@ assembly/pson.ts:93:30
(i64.shr_u
(get_local $2)
;;@ assembly/pson.ts:93:39
(i64.const 32)
)
)
)
;;@ assembly/pson.ts:94:6
(br $break|0)
)
;;@ assembly/pson.ts:97:6
(call $assembly/pson/onFloat
;;@ assembly/pson.ts:97:14
(f32.load
;;@ assembly/pson.ts:97:24
(get_global $assembly/pson/offset)
)
)
;;@ assembly/pson.ts:98:6
(set_global $assembly/pson/offset
(i32.add
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:98:16
(i32.const 4)
)
)
;;@ assembly/pson.ts:99:6
(br $break|0)
)
;;@ assembly/pson.ts:102:6
(call $assembly/pson/onDouble
;;@ assembly/pson.ts:102:15
(f64.load
;;@ assembly/pson.ts:102:25
(get_global $assembly/pson/offset)
)
)
;;@ assembly/pson.ts:103:6
(set_global $assembly/pson/offset
(i32.add
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:103:16
(i32.const 8)
)
)
;;@ assembly/pson.ts:104:6
(br $break|0)
)
;;@ assembly/pson.ts:107:6
(set_local $0
;;@ assembly/pson.ts:107:13
(call $assembly/pson/readVarint32)
)
;;@ assembly/pson.ts:108:6
(call $assembly/pson/onString
;;@ assembly/pson.ts:108:15
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:108:23
(get_local $0)
)
;;@ assembly/pson.ts:109:6
(set_global $assembly/pson/offset
(i32.add
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:109:16
(get_local $0)
)
)
;;@ assembly/pson.ts:110:6
(br $break|0)
)
;;@ assembly/pson.ts:115:6
(unreachable)
)
;;@ assembly/pson.ts:119:6
(set_local $0
;;@ assembly/pson.ts:119:13
(call $assembly/pson/readVarint32)
)
;;@ assembly/pson.ts:120:6
(call $assembly/pson/onBinary
;;@ assembly/pson.ts:120:15
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:120:23
(get_local $0)
)
;;@ assembly/pson.ts:121:6
(set_global $assembly/pson/offset
(i32.add
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:121:16
(get_local $0)
)
)
;;@ assembly/pson.ts:122:6
(br $break|0)
)
;;@ assembly/pson.ts:125:6
(if
;;@ assembly/pson.ts:125:10
(i32.gt_u
(get_local $0)
(i32.const 239)
)
;;@ assembly/pson.ts:125:34
(unreachable)
)
;;@ assembly/pson.ts:126:6
(call $assembly/pson/onInteger
;;@ assembly/pson.ts:126:16
(i32.xor
(i32.shr_u
;;@ assembly/pson.ts:126:17
(get_local $0)
;;@ assembly/pson.ts:126:26
(i32.const 1)
)
;;@ assembly/pson.ts:126:31
(i32.sub
(i32.const 0)
;;@ assembly/pson.ts:126:32
(i32.and
;;@ assembly/pson.ts:126:33
(get_local $0)
;;@ assembly/pson.ts:126:41
(i32.const 1)
)
)
)
)
)
block $break|0
block $case16|0
block $case15|0
block $case14|0
block $case12|0
block $case11|0
block $case10|0
block $case9|0
block $case8|0
block $case7|0
block $case6|0
block $case5|0
block $case4|0
block $case3|0
block $case2|0
block $case1|0
block (result i32)
get_global $assembly/pson/offset
tee_local $1
i32.const 1
i32.add
set_global $assembly/pson/offset
get_local $1
i32.load8_u
tee_local $0
tee_local $1
i32.const 240
i32.ne
end
if
block $tablify|0
get_local $1
i32.const 241
i32.sub
br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 $case12|0 $tablify|0
end
get_local $1
i32.const 253
i32.eq
get_local $1
i32.const 254
i32.eq
i32.or
br_if $case14|0
get_local $1
i32.const 255
i32.eq
br_if $case15|0
br $case16|0
end
call $assembly/pson/onNull
br $break|0
end
call $assembly/pson/onTrue
br $break|0
end
call $assembly/pson/onFalse
br $break|0
end
call $assembly/pson/onEObject
br $break|0
end
call $assembly/pson/onEArray
br $break|0
end
call $assembly/pson/onEString
br $break|0
end
call $assembly/pson/readVarint32
tee_local $0
call $assembly/pson/onObject
loop $continue|1
block (result i32)
get_local $0
tee_local $1
i32.const 1
i32.sub
set_local $0
get_local $1
end
if
call $assembly/pson/decodeValue
call $assembly/pson/decodeValue
br $continue|1
end
end
br $break|0
end
call $assembly/pson/readVarint32
tee_local $0
call $assembly/pson/onArray
loop $continue|2
block (result i32)
get_local $0
tee_local $1
i32.const 1
i32.sub
set_local $0
get_local $1
end
if
call $assembly/pson/decodeValue
br $continue|2
end
end
br $break|0
end
call $assembly/pson/readVarint32
tee_local $0
i32.const 1
i32.shr_u
i32.const 0
get_local $0
i32.const 1
i32.and
i32.sub
i32.xor
call $assembly/pson/onInteger
br $break|0
end
call $assembly/pson/readVarint64
tee_local $2
i64.const 1
i64.shr_u
i64.const 0
get_local $2
i64.const 1
i64.and
i64.sub
i64.xor
tee_local $2
i32.wrap/i64
get_local $2
i64.const 32
i64.shr_u
i32.wrap/i64
call $assembly/pson/onLong
br $break|0
end
get_global $assembly/pson/offset
f32.load
call $assembly/pson/onFloat
get_global $assembly/pson/offset
i32.const 4
i32.add
set_global $assembly/pson/offset
br $break|0
end
get_global $assembly/pson/offset
f64.load
call $assembly/pson/onDouble
get_global $assembly/pson/offset
i32.const 8
i32.add
set_global $assembly/pson/offset
br $break|0
end
call $assembly/pson/readVarint32
set_local $0
get_global $assembly/pson/offset
get_local $0
call $assembly/pson/onString
get_global $assembly/pson/offset
get_local $0
i32.add
set_global $assembly/pson/offset
br $break|0
end
unreachable
end
call $assembly/pson/readVarint32
set_local $0
get_global $assembly/pson/offset
get_local $0
call $assembly/pson/onBinary
get_global $assembly/pson/offset
get_local $0
i32.add
set_global $assembly/pson/offset
br $break|0
end
get_local $0
i32.const 239
i32.gt_u
if
unreachable
end
get_local $0
i32.const 1
i32.shr_u
i32.const 0
get_local $0
i32.const 1
i32.and
i32.sub
i32.xor
call $assembly/pson/onInteger
end
)
(func $assembly/pson/decode (; 17 ;) (; has Stack IR ;) (type $iv) (param $0 i32)
;;@ assembly/pson.ts:40:2
(set_global $assembly/pson/offset
;;@ assembly/pson.ts:40:11
(i32.const 0)
)
(loop $continue|0
(if
;;@ assembly/pson.ts:41:9
(i32.lt_u
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:41:18
(get_local $0)
)
(block
;;@ assembly/pson.ts:41:26
(call $assembly/pson/decodeValue)
(br $continue|0)
)
)
)
;;@ assembly/pson.ts:42:2
(if
;;@ assembly/pson.ts:42:6
(i32.ne
(get_global $assembly/pson/offset)
;;@ assembly/pson.ts:42:16
(get_local $0)
)
;;@ assembly/pson.ts:42:24
(unreachable)
)
(func $assembly/pson/decode (; 17 ;) (type $iv) (param $0 i32)
i32.const 0
set_global $assembly/pson/offset
loop $continue|0
get_global $assembly/pson/offset
get_local $0
i32.lt_u
if
call $assembly/pson/decodeValue
br $continue|0
end
end
get_global $assembly/pson/offset
get_local $0
i32.ne
if
unreachable
end
)
(func $null (; 18 ;) (; has Stack IR ;) (type $v)
(nop)
(func $null (; 18 ;) (type $v)
nop
)
)

File diff suppressed because it is too large Load Diff