Add a 'call_indirect' builtin to emit arbitrary calls (might trap at runtime); Optimize 'for' loop compilation a bit

This commit is contained in:
dcodeIO
2018-05-25 15:59:17 +02:00
parent 51ede113dd
commit 7ad13f9d65
47 changed files with 3311 additions and 22111 deletions

View File

@ -1639,7 +1639,7 @@
(i32.const 9)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.shr_u
(get_local $3)
@ -1658,7 +1658,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i32.shl
@ -1689,7 +1689,7 @@
(i32.const 9)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.shr_u
(get_local $3)
@ -1708,7 +1708,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i32.shl
@ -1722,7 +1722,7 @@
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_local $4)
@ -1764,7 +1764,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -1791,7 +1791,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.shr_u
(get_local $2)
@ -1810,7 +1810,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(return
@ -3257,7 +3257,7 @@
(i64.const 12)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.eqz
@ -3280,7 +3280,7 @@
(i64.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i64.shl
@ -3313,7 +3313,7 @@
(i64.const 12)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i64.eqz
@ -3336,7 +3336,7 @@
(i64.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i64.shl
@ -3352,7 +3352,7 @@
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_local $3)
@ -3394,7 +3394,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -3421,7 +3421,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i64.eqz
@ -3444,7 +3444,7 @@
(i64.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(return

View File

@ -1831,23 +1831,21 @@
(i32.const 9)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.eqz
(i32.eqz
(i32.shr_u
(get_local $8)
(i32.const 31)
)
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $8
@ -1856,7 +1854,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(set_local $2
@ -1905,23 +1903,21 @@
(i32.const 9)
)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i32.eqz
(i32.eqz
(i32.shr_u
(get_local $8)
(i32.const 31)
)
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $8
@ -1930,7 +1926,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(set_local $3
@ -1968,53 +1964,50 @@
)
)
(block $break|2
(nop)
(loop $loop|2
(block $continue|2
(br_if $break|2
(loop $repeat|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
)
(block
(set_local $8
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
(block
(if
(i32.eqz
(get_local $8)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(block
(set_local $8
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
(block
(if
(i32.eqz
(get_local $8)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
)
)
@ -2024,7 +2017,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(set_local $8
@ -2058,24 +2051,21 @@
)
)
(block $break|3
(nop)
(loop $loop|3
(block $continue|3
(br_if $break|3
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i32.eqz
(i32.eqz
(i32.shr_u
(get_local $2)
(i32.const 23)
)
(i32.shr_u
(get_local $2)
(i32.const 23)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $2
@ -2084,7 +2074,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(if
@ -3713,23 +3703,21 @@
(i64.const 12)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $8
@ -3738,7 +3726,7 @@
(i64.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(set_local $2
@ -3789,23 +3777,21 @@
(i64.const 12)
)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $8
@ -3814,7 +3800,7 @@
(i64.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(set_local $3
@ -3854,53 +3840,50 @@
)
)
(block $break|2
(nop)
(loop $loop|2
(block $continue|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
(loop $repeat|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
)
(block
(set_local $8
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
(block
(if
(i64.eqz
(get_local $8)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(block
(set_local $8
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
(block
(if
(i64.eqz
(get_local $8)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
)
)
@ -3910,7 +3893,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(set_local $8
@ -3944,24 +3927,21 @@
)
)
(block $break|3
(nop)
(loop $loop|3
(block $continue|3
(br_if $break|3
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $2)
(i64.const 52)
)
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $2)
(i64.const 52)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $2
@ -3970,7 +3950,7 @@
(i64.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(if

View File

@ -2,6 +2,7 @@
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $fi (func (param f32) (result i32)))
(type $Fi (func (param f64) (result i32)))
(type $iiv (func (param i32 i32)))
(type $v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(global $builtins/b (mut i32) (i32.const 0))
@ -12,11 +13,15 @@
(global $builtins/u (mut i32) (i32.const 0))
(global $builtins/U (mut i64) (i64.const 0))
(global $builtins/s (mut i32) (i32.const 0))
(global $builtins/fn (mut i32) (i32.const 0))
(table 1 1 anyfunc)
(elem (i32.const 0) $start~anonymous|0)
(memory $0 1)
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s")
(data (i32.const 36) "\01\00\00\001")
(export "test" (func $builtins/test))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $isNaN<f32> (; 1 ;) (type $fi) (param $0 f32) (result i32)
(f32.ne
@ -48,10 +53,13 @@
(f64.const 0)
)
)
(func $builtins/test (; 5 ;) (type $v)
(func $start~anonymous|0 (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
(nop)
)
(func $start (; 6 ;) (type $v)
(func $builtins/test (; 6 ;) (type $v)
(nop)
)
(func $start (; 7 ;) (type $v)
(local $0 i32)
(local $1 i32)
(local $2 i64)
@ -830,6 +838,11 @@
)
(unreachable)
)
(call_indirect (type $iiv)
(i32.const 1)
(i32.const 2)
(get_global $builtins/fn)
)
(if
(i32.eqz
(call $isNaN<f32>
@ -840,7 +853,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 261)
(i32.const 264)
(i32.const 0)
)
(unreachable)
@ -856,7 +869,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 262)
(i32.const 265)
(i32.const 0)
)
(unreachable)
@ -870,7 +883,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 263)
(i32.const 266)
(i32.const 0)
)
(unreachable)
@ -884,7 +897,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 264)
(i32.const 267)
(i32.const 0)
)
(unreachable)
@ -898,7 +911,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 265)
(i32.const 268)
(i32.const 0)
)
(unreachable)
@ -912,7 +925,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 266)
(i32.const 269)
(i32.const 0)
)
(unreachable)
@ -928,7 +941,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 267)
(i32.const 270)
(i32.const 0)
)
(unreachable)
@ -944,7 +957,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 268)
(i32.const 271)
(i32.const 0)
)
(unreachable)

View File

@ -232,6 +232,9 @@ F = select<f64>(12.5, 25.0, false);
if (!i) unreachable();
var fn = function(a: i32, b: i32): void {}
call_indirect(fn, 1, 2);
// AS specific
assert(sizeof<u8>() == 1);

View File

@ -2,6 +2,7 @@
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $fi (func (param f32) (result i32)))
(type $Fi (func (param f64) (result i32)))
(type $iiv (func (param i32 i32)))
(type $v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(global $builtins/b (mut i32) (i32.const 0))
@ -15,12 +16,16 @@
(global $builtins/u (mut i32) (i32.const 0))
(global $builtins/U (mut i64) (i64.const 0))
(global $builtins/s (mut i32) (i32.const 0))
(global $builtins/fn (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 44))
(table 1 1 anyfunc)
(elem (i32.const 0) $start~anonymous|0)
(memory $0 1)
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s\00")
(data (i32.const 36) "\01\00\00\001\00")
(export "test" (func $builtins/test))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $isNaN<f32> (; 1 ;) (type $fi) (param $0 f32) (result i32)
(return
@ -60,10 +65,13 @@
)
)
)
(func $builtins/test (; 5 ;) (type $v)
(func $start~anonymous|0 (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
(nop)
)
(func $start (; 6 ;) (type $v)
(func $builtins/test (; 6 ;) (type $v)
(nop)
)
(func $start (; 7 ;) (type $v)
(local $0 i32)
(local $1 i32)
(local $2 i64)
@ -1538,6 +1546,11 @@
)
(unreachable)
)
(call_indirect (type $iiv)
(i32.const 1)
(i32.const 2)
(get_global $builtins/fn)
)
(if
(i32.eqz
(i32.eq
@ -1545,57 +1558,6 @@
(i32.const 1)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 237)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 2)
(i32.const 2)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 238)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 4)
(i32.const 4)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 239)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 8)
(i32.const 8)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -1606,14 +1568,28 @@
(unreachable)
)
)
(drop
(i32.const 4)
(if
(i32.eqz
(i32.eq
(i32.const 2)
(i32.const 2)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 241)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 1)
(i32.const 1)
(i32.const 4)
(i32.const 4)
)
)
(block
@ -1629,8 +1605,8 @@
(if
(i32.eqz
(i32.eq
(i32.const 1)
(i32.const 1)
(i32.const 8)
(i32.const 8)
)
)
(block
@ -1643,28 +1619,14 @@
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 2)
(i32.const 2)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 244)
(i32.const 0)
)
(unreachable)
)
(drop
(i32.const 4)
)
(if
(i32.eqz
(i32.eq
(i32.const 4)
(i32.const 4)
(i32.const 1)
(i32.const 1)
)
)
(block
@ -1680,8 +1642,8 @@
(if
(i32.eqz
(i32.eq
(i32.const 8)
(i32.const 8)
(i32.const 1)
(i32.const 1)
)
)
(block
@ -1694,8 +1656,22 @@
(unreachable)
)
)
(drop
(i32.const 4)
(if
(i32.eqz
(i32.eq
(i32.const 2)
(i32.const 2)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 247)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
@ -1731,12 +1707,32 @@
(unreachable)
)
)
(drop
(i32.const 4)
)
(if
(i32.eqz
(i32.eq
(i32.const 4)
(i32.const 4)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 251)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 8)
(i32.const 8)
)
)
(block
(call $~lib/env/abort
@ -1748,23 +1744,6 @@
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 4)
(i32.const 4)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 253)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
@ -1772,23 +1751,6 @@
(i32.const 0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 254)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 2)
(i32.const 2)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -1799,6 +1761,23 @@
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 4)
(i32.const 4)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 256)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
@ -1816,6 +1795,40 @@
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 2)
(i32.const 2)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 258)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 0)
(i32.const 0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 260)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
@ -1827,7 +1840,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 258)
(i32.const 261)
(i32.const 0)
)
(unreachable)
@ -1844,7 +1857,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 260)
(i32.const 263)
(i32.const 0)
)
(unreachable)
@ -1860,7 +1873,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 261)
(i32.const 264)
(i32.const 0)
)
(unreachable)
@ -1876,7 +1889,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 262)
(i32.const 265)
(i32.const 0)
)
(unreachable)
@ -1894,7 +1907,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 263)
(i32.const 266)
(i32.const 0)
)
(unreachable)
@ -1912,7 +1925,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 264)
(i32.const 267)
(i32.const 0)
)
(unreachable)
@ -1930,7 +1943,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 265)
(i32.const 268)
(i32.const 0)
)
(unreachable)
@ -1948,7 +1961,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 266)
(i32.const 269)
(i32.const 0)
)
(unreachable)
@ -1964,7 +1977,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 267)
(i32.const 270)
(i32.const 0)
)
(unreachable)
@ -1980,7 +1993,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 268)
(i32.const 271)
(i32.const 0)
)
(unreachable)
@ -2003,7 +2016,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 281)
(i32.const 284)
(i32.const 0)
)
(unreachable)
@ -2020,7 +2033,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 282)
(i32.const 285)
(i32.const 0)
)
(unreachable)
@ -2039,57 +2052,6 @@
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 283)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 32767)
(i32.const 32767)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 284)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const -2147483648)
(i32.const -2147483648)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 285)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 2147483647)
(i32.const 2147483647)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -2102,9 +2064,9 @@
)
(if
(i32.eqz
(i64.eq
(i64.const -9223372036854775808)
(i64.const -9223372036854775808)
(i32.eq
(i32.const 32767)
(i32.const 32767)
)
)
(block
@ -2119,9 +2081,9 @@
)
(if
(i32.eqz
(i64.eq
(i64.const 9223372036854775807)
(i64.const 9223372036854775807)
(i32.eq
(i32.const -2147483648)
(i32.const -2147483648)
)
)
(block
@ -2137,9 +2099,26 @@
(if
(i32.eqz
(i32.eq
(i32.const 2147483647)
(i32.const 2147483647)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 289)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i64.eq
(i64.const -9223372036854775808)
(i64.const -9223372036854775808)
)
)
(block
(call $~lib/env/abort
@ -2153,9 +2132,9 @@
)
(if
(i32.eqz
(i32.eq
(i32.const 255)
(i32.const 255)
(i64.eq
(i64.const 9223372036854775807)
(i64.const 9223372036854775807)
)
)
(block
@ -2175,23 +2154,6 @@
(i32.const 0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 292)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 65535)
(i32.const 65535)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -2205,8 +2167,8 @@
(if
(i32.eqz
(i32.eq
(i32.const 0)
(i32.const 0)
(i32.const 255)
(i32.const 255)
)
)
(block
@ -2222,8 +2184,8 @@
(if
(i32.eqz
(i32.eq
(i32.const -1)
(i32.const -1)
(i32.const 0)
(i32.const 0)
)
)
(block
@ -2238,9 +2200,9 @@
)
(if
(i32.eqz
(i64.eq
(i64.const 0)
(i64.const 0)
(i32.eq
(i32.const 65535)
(i32.const 65535)
)
)
(block
@ -2255,9 +2217,9 @@
)
(if
(i32.eqz
(i64.eq
(i64.const -1)
(i64.const -1)
(i32.eq
(i32.const 0)
(i32.const 0)
)
)
(block
@ -2273,8 +2235,8 @@
(if
(i32.eqz
(i32.eq
(i32.const 0)
(i32.const 0)
(i32.const -1)
(i32.const -1)
)
)
(block
@ -2289,26 +2251,9 @@
)
(if
(i32.eqz
(i32.eq
(i32.const 0)
(i32.const 0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 298)
(i32.const 29)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 1)
(i32.const 1)
(i64.eq
(i64.const 0)
(i64.const 0)
)
)
(block
@ -2323,26 +2268,26 @@
)
(if
(i32.eqz
(i32.eq
(i32.const 1)
(i32.const 1)
(i64.eq
(i64.const -1)
(i64.const -1)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 299)
(i32.const 29)
(i32.const 300)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(f32.eq
(f32.const -3402823466385288598117041e14)
(f32.const -3402823466385288598117041e14)
(i32.eq
(i32.const 0)
(i32.const 0)
)
)
(block
@ -2357,9 +2302,26 @@
)
(if
(i32.eqz
(f32.eq
(f32.const 3402823466385288598117041e14)
(f32.const 3402823466385288598117041e14)
(i32.eq
(i32.const 0)
(i32.const 0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 301)
(i32.const 29)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.const 1)
(i32.const 1)
)
)
(block
@ -2374,17 +2336,17 @@
)
(if
(i32.eqz
(f32.eq
(f32.const -16777215)
(f32.const -16777215)
(i32.eq
(i32.const 1)
(i32.const 1)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 303)
(i32.const 0)
(i32.const 302)
(i32.const 29)
)
(unreachable)
)
@ -2392,8 +2354,8 @@
(if
(i32.eqz
(f32.eq
(f32.const 16777215)
(f32.const 16777215)
(f32.const -3402823466385288598117041e14)
(f32.const -3402823466385288598117041e14)
)
)
(block
@ -2409,8 +2371,8 @@
(if
(i32.eqz
(f32.eq
(f32.const 1.1920928955078125e-07)
(f32.const 1.1920928955078125e-07)
(f32.const 3402823466385288598117041e14)
(f32.const 3402823466385288598117041e14)
)
)
(block
@ -2425,9 +2387,9 @@
)
(if
(i32.eqz
(f64.eq
(f64.const -1797693134862315708145274e284)
(f64.const -1797693134862315708145274e284)
(f32.eq
(f32.const -16777215)
(f32.const -16777215)
)
)
(block
@ -2442,9 +2404,9 @@
)
(if
(i32.eqz
(f64.eq
(f64.const 1797693134862315708145274e284)
(f64.const 1797693134862315708145274e284)
(f32.eq
(f32.const 16777215)
(f32.const 16777215)
)
)
(block
@ -2459,9 +2421,9 @@
)
(if
(i32.eqz
(f64.eq
(f64.const -9007199254740991)
(f64.const -9007199254740991)
(f32.eq
(f32.const 1.1920928955078125e-07)
(f32.const 1.1920928955078125e-07)
)
)
(block
@ -2474,6 +2436,57 @@
(unreachable)
)
)
(if
(i32.eqz
(f64.eq
(f64.const -1797693134862315708145274e284)
(f64.const -1797693134862315708145274e284)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 309)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(f64.eq
(f64.const 1797693134862315708145274e284)
(f64.const 1797693134862315708145274e284)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 310)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(f64.eq
(f64.const -9007199254740991)
(f64.const -9007199254740991)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 311)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(f64.eq
@ -2485,7 +2498,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 309)
(i32.const 312)
(i32.const 0)
)
(unreachable)
@ -2502,7 +2515,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 310)
(i32.const 313)
(i32.const 0)
)
(unreachable)

View File

@ -0,0 +1,21 @@
(module
(type $iv (func (param i32)))
(type $v (func))
(memory $0 1)
(export "test" (func $class-overloading/test))
(export "memory" (memory $0))
(start $start)
(func $class-overloading/Foo#baz (; 0 ;) (type $iv) (param $0 i32)
(nop)
)
(func $class-overloading/test (; 1 ;) (type $iv) (param $0 i32)
(call $class-overloading/Foo#baz
(get_local $0)
)
)
(func $start (; 2 ;) (type $v)
(call $class-overloading/test
(i32.const 0)
)
)
)

View File

@ -0,0 +1,12 @@
class Foo {
baz(): void {}
}
class Bar extends Foo {
baz(): void {}
}
export function test(foo: Foo): void {
foo.baz();
}
// FIXME: this results in a call to Foo.baz instead of Bar.baz above.
// ultimately, overloaded functions should implicitly become virtual.
test(changetype<Bar>(0));

View File

@ -0,0 +1,22 @@
(module
(type $iv (func (param i32)))
(type $v (func))
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 1)
(export "test" (func $class-overloading/test))
(export "memory" (memory $0))
(start $start)
(func $class-overloading/Foo#baz (; 0 ;) (type $iv) (param $0 i32)
(nop)
)
(func $class-overloading/test (; 1 ;) (type $iv) (param $0 i32)
(call $class-overloading/Foo#baz
(get_local $0)
)
)
(func $start (; 2 ;) (type $v)
(call $class-overloading/test
(i32.const 0)
)
)
)

View File

@ -186,7 +186,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -205,7 +205,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(if

View File

@ -217,18 +217,16 @@
(set_local $1
(i32.const 0)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $1)
(get_global $comma/a)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $1)
(get_global $comma/a)
)
)
(nop)
)
(nop)
(block
(set_global $comma/a
(i32.sub
@ -243,7 +241,7 @@
)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(if

View File

@ -13,7 +13,7 @@
(set_global $for/i
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_global $for/i)
@ -26,7 +26,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(if
@ -45,7 +45,7 @@
)
)
(block $break|1
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.ge_s
(get_local $0)
@ -58,11 +58,11 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_global $for/i)
@ -75,7 +75,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -91,7 +91,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.eq
(get_global $for/i)
@ -104,17 +104,17 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(loop $loop|4
(loop $repeat|4
(set_global $for/i
(i32.sub
(get_global $for/i)
(i32.const 1)
)
)
(br_if $loop|4
(br_if $repeat|4
(get_global $for/i)
)
)
@ -122,7 +122,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|5
(loop $repeat|5
(br_if $break|5
(i32.ge_s
(get_local $0)
@ -135,7 +135,7 @@
(i32.const 1)
)
)
(br $loop|5)
(br $repeat|5)
)
)
(if

View File

@ -15,25 +15,23 @@
(set_global $for/i
(i32.const 0)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_global $for/i)
(i32.const 10)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_global $for/i)
(i32.const 10)
)
)
(nop)
)
(nop)
(set_global $for/i
(i32.add
(get_global $for/i)
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(if
@ -57,48 +55,43 @@
(set_local $0
(i32.const 0)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(i32.eqz
(i32.lt_s
(get_local $0)
(i32.const 10)
)
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i32.lt_s
(get_local $0)
(i32.const 10)
)
)
(nop)
)
(nop)
(set_local $0
(i32.add
(get_local $0)
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(block $break|2
(nop)
(loop $loop|2
(block $continue|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_global $for/i)
(i32.const 0)
)
(loop $repeat|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_global $for/i)
(i32.const 0)
)
)
(nop)
)
(nop)
(set_global $for/i
(i32.sub
(get_global $for/i)
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -119,21 +112,18 @@
)
)
(block $break|3
(nop)
(loop $loop|3
(block $continue|3
(br_if $break|3
(i32.eqz
(i32.const 1)
)
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i32.const 1)
)
(if
(i32.eq
(get_global $for/i)
(i32.const 10)
)
(br $break|3)
)
(if
(i32.eq
(get_global $for/i)
(i32.const 10)
)
(br $break|3)
)
(set_global $for/i
(i32.add
@ -141,43 +131,39 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(block $break|4
(nop)
(loop $loop|4
(block $continue|4
(br_if $break|4
(i32.eqz
(i32.const 1)
)
)
(if
(i32.eq
(block (result i32)
(set_global $for/i
(i32.sub
(get_global $for/i)
(i32.const 1)
)
)
(get_global $for/i)
)
(i32.const 0)
)
(br $break|4)
(loop $repeat|4
(br_if $break|4
(i32.eqz
(i32.const 1)
)
)
(nop)
(br $loop|4)
(if
(i32.eq
(block (result i32)
(set_global $for/i
(i32.sub
(get_global $for/i)
(i32.const 1)
)
)
(get_global $for/i)
)
(i32.const 0)
)
(br $break|4)
)
(br $repeat|4)
)
)
(block $break|5
(set_local $1
(i32.const 0)
)
(loop $loop|5
(loop $repeat|5
(block $continue|5
(br_if $break|5
(i32.eqz
@ -195,7 +181,7 @@
(i32.const 1)
)
)
(br $loop|5)
(br $repeat|5)
)
)
(if

View File

@ -46,7 +46,7 @@
(set_local $1
(i32.const 10)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -59,7 +59,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)

View File

@ -107,25 +107,23 @@
(i32.const 10)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $0)
(get_local $1)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $0)
(get_local $1)
)
)
(nop)
)
(nop)
(set_local $0
(i32.add
(get_local $0)
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)

View File

@ -339,7 +339,7 @@
(set_local $2
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_u
(get_local $2)
@ -434,7 +434,7 @@
)
)
)
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.eqz
(f64.lt
@ -481,7 +481,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(i32.store16
@ -551,7 +551,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)

View File

@ -398,137 +398,65 @@
(set_local $8
(i32.const 0)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $8)
(get_local $1)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $8)
(get_local $1)
)
)
)
(block
(set_local $9
(f64.mul
(f64.sub
(f64.convert_u/i32
(get_local $8)
)
(get_local $4)
)
(get_local $6)
)
)
(block
(set_local $9
(f64.mul
(f64.sub
(f64.convert_u/i32
(get_local $8)
)
(get_local $4)
)
(get_local $6)
)
(set_local $10
(f64.const 0)
)
(block
(set_local $10
(f64.const 0)
)
(set_local $11
(f64.const 0)
)
(set_local $11
(f64.const 0)
)
(set_local $14
(i32.const 0)
)
(block $break|1
(loop $continue|1
(if
(f64.le
(f64.add
(tee_local $12
(f64.mul
(get_local $10)
(get_local $10)
)
)
(tee_local $13
(f64.mul
(get_local $11)
(get_local $11)
)
)
(set_local $14
(i32.const 0)
)
(block $break|1
(loop $continue|1
(if
(f64.le
(f64.add
(tee_local $12
(f64.mul
(get_local $10)
(get_local $10)
)
)
(tee_local $13
(f64.mul
(get_local $11)
(get_local $11)
)
)
(f64.const 4)
)
(f64.const 4)
)
(block
(block
(block
(set_local $15
(f64.add
(f64.sub
(get_local $12)
(get_local $13)
)
(get_local $9)
)
)
(set_local $11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
(get_local $10)
)
(get_local $11)
)
(get_local $7)
)
)
(set_local $10
(get_local $15)
)
(if
(i32.ge_u
(get_local $14)
(get_local $3)
)
(br $break|1)
)
(set_local $14
(i32.add
(get_local $14)
(i32.const 1)
)
)
)
(br $continue|1)
)
)
)
)
(block $break|2
(set_local $15
(f64.min
(f64.const 8)
(f64.convert_u/i32
(get_local $3)
)
)
)
(loop $loop|2
(block $continue|2
(br_if $break|2
(i32.eqz
(f64.lt
(f64.convert_u/i32
(get_local $14)
)
(get_local $15)
)
)
)
(block
(set_local $16
(set_local $15
(f64.add
(f64.sub
(f64.mul
(get_local $10)
(get_local $10)
)
(f64.mul
(get_local $11)
(get_local $11)
)
(get_local $12)
(get_local $13)
)
(get_local $9)
)
@ -546,100 +474,168 @@
)
)
(set_local $10
(get_local $16)
(get_local $15)
)
)
)
(set_local $14
(i32.add
(get_local $14)
(i32.const 1)
)
)
(br $loop|2)
)
)
(set_local $15
(f64.div
(call $~lib/math/NativeMath.log
(call $~lib/math/NativeMath.log
(block $~lib/math/NativeMath.sqrt|inlined.0 (result f64)
(set_local $15
(f64.add
(f64.mul
(get_local $10)
(get_local $10)
)
(f64.mul
(get_local $11)
(get_local $11)
)
)
)
(br $~lib/math/NativeMath.sqrt|inlined.0
(f64.sqrt
(get_local $15)
)
(if
(i32.ge_u
(get_local $14)
(get_local $3)
)
(br $break|1)
)
)
)
(f64.const 0.6931471805599453)
)
)
(set_local $17
(if (result i32)
(call $isFinite<f64>
(get_local $15)
)
(i32.trunc_u/f64
(f64.mul
(f64.convert_s/i32
(i32.sub
(i32.const 2048)
(set_local $14
(i32.add
(get_local $14)
(i32.const 1)
)
)
(call $../../examples/mandelbrot/assembly/index/clamp<f64>
(f64.div
(f64.sub
(f64.convert_u/i32
(i32.add
(get_local $14)
(i32.const 1)
)
)
(get_local $15)
)
(f64.convert_u/i32
(get_local $3)
)
)
(f64.const 0)
(f64.const 1)
)
(br $continue|1)
)
)
)
)
(block $break|2
(set_local $15
(f64.min
(f64.const 8)
(f64.convert_u/i32
(get_local $3)
)
)
)
(loop $repeat|2
(br_if $break|2
(i32.eqz
(f64.lt
(f64.convert_u/i32
(get_local $14)
)
(get_local $15)
)
)
(i32.sub
(i32.const 2048)
)
(block
(set_local $16
(f64.add
(f64.sub
(f64.mul
(get_local $10)
(get_local $10)
)
(f64.mul
(get_local $11)
(get_local $11)
)
)
(get_local $9)
)
)
(set_local $11
(f64.add
(f64.mul
(f64.mul
(f64.const 2)
(get_local $10)
)
(get_local $11)
)
(get_local $7)
)
)
(set_local $10
(get_local $16)
)
)
(set_local $14
(i32.add
(get_local $14)
(i32.const 1)
)
)
(br $repeat|2)
)
(i32.store16
(i32.shl
(i32.add
(i32.mul
(get_local $0)
(get_local $1)
)
(set_local $15
(f64.div
(call $~lib/math/NativeMath.log
(call $~lib/math/NativeMath.log
(block $~lib/math/NativeMath.sqrt|inlined.0 (result f64)
(set_local $15
(f64.add
(f64.mul
(get_local $10)
(get_local $10)
)
(f64.mul
(get_local $11)
(get_local $11)
)
)
)
(br $~lib/math/NativeMath.sqrt|inlined.0
(f64.sqrt
(get_local $15)
)
)
)
(get_local $8)
)
)
(f64.const 0.6931471805599453)
)
)
(set_local $17
(if (result i32)
(call $isFinite<f64>
(get_local $15)
)
(i32.trunc_u/f64
(f64.mul
(f64.convert_s/i32
(i32.sub
(i32.const 2048)
(i32.const 1)
)
)
(call $../../examples/mandelbrot/assembly/index/clamp<f64>
(f64.div
(f64.sub
(f64.convert_u/i32
(i32.add
(get_local $14)
(i32.const 1)
)
)
(get_local $15)
)
(f64.convert_u/i32
(get_local $3)
)
)
(f64.const 0)
(f64.const 1)
)
)
)
(i32.sub
(i32.const 2048)
(i32.const 1)
)
(get_local $17)
)
)
(i32.store16
(i32.shl
(i32.add
(i32.mul
(get_local $0)
(get_local $1)
)
(get_local $8)
)
(i32.const 1)
)
(get_local $17)
)
)
(set_local $8
(i32.add
@ -647,7 +643,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)

View File

@ -110,7 +110,7 @@
(set_local $0
(i32.const -128)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.gt_s
(get_local $0)
@ -171,7 +171,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(set_global $retain-i32/si

View File

@ -558,65 +558,63 @@
(set_local $0
(i32.const -128)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.le_s
(get_local $0)
(i32.const 255)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.le_s
(get_local $0)
(i32.const 255)
)
)
(block
(call $retain-i32/test
(i32.const 0)
(get_local $0)
)
(call $retain-i32/test
(i32.const 1)
(get_local $0)
)
(call $retain-i32/test
(i32.const -1)
(get_local $0)
)
(call $retain-i32/test
(i32.const -128)
(get_local $0)
)
(call $retain-i32/test
(i32.const 127)
(get_local $0)
)
(call $retain-i32/test
(i32.const 255)
(get_local $0)
)
(call $retain-i32/test
(i32.const -32768)
(get_local $0)
)
(call $retain-i32/test
(i32.const 32767)
(get_local $0)
)
(call $retain-i32/test
(i32.const 65535)
(get_local $0)
)
(call $retain-i32/test
(i32.const 2147483647)
(get_local $0)
)
(call $retain-i32/test
(i32.const -2147483648)
(get_local $0)
)
(call $retain-i32/test
(i32.const -1)
(get_local $0)
)
)
(block
(call $retain-i32/test
(i32.const 0)
(get_local $0)
)
(call $retain-i32/test
(i32.const 1)
(get_local $0)
)
(call $retain-i32/test
(i32.const -1)
(get_local $0)
)
(call $retain-i32/test
(i32.const -128)
(get_local $0)
)
(call $retain-i32/test
(i32.const 127)
(get_local $0)
)
(call $retain-i32/test
(i32.const 255)
(get_local $0)
)
(call $retain-i32/test
(i32.const -32768)
(get_local $0)
)
(call $retain-i32/test
(i32.const 32767)
(get_local $0)
)
(call $retain-i32/test
(i32.const 65535)
(get_local $0)
)
(call $retain-i32/test
(i32.const 2147483647)
(get_local $0)
)
(call $retain-i32/test
(i32.const -2147483648)
(get_local $0)
)
(call $retain-i32/test
(i32.const -1)
(get_local $0)
)
)
(set_local $0
@ -625,7 +623,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(set_global $retain-i32/si

View File

@ -10,7 +10,7 @@
(func $start (; 1 ;) (type $v)
(local $0 i32)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -23,14 +23,14 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(block $break|1
(set_local $0
(i32.const 0)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.ge_s
(get_local $0)
@ -43,7 +43,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(call $scoped/fn

View File

@ -26,44 +26,40 @@
(set_local $0
(i32.const 0)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $0)
(i32.const 1)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $0)
(i32.const 1)
)
)
(nop)
)
(nop)
(set_local $0
(i32.add
(get_local $0)
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(block $break|1
(set_local $1
(i32.const 0)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(i32.eqz
(i32.lt_s
(get_local $1)
(i32.const 1)
)
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i32.lt_s
(get_local $1)
(i32.const 1)
)
)
(drop
(get_local $1)
)
)
(drop
(get_local $1)
)
(set_local $1
(i32.add
@ -71,7 +67,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(block

File diff suppressed because it is too large Load Diff

View File

@ -1,126 +0,0 @@
// This test case compiles to WebAssembly today, highlights some of the features that have been
// implemented already and gives a quick outlook on the road ahead.
// Global variables can be constant
const aConstantGlobal: i32 = 42;
// Constant globals can be exported to JS from the entry file
export const anExportedConstantGlobal: f32 = 42.0;
// Global variables can be mutable
var aMutableGlobal: i32 = 42;
// Variables can infer their type
var anInferredI32 = 42; // infers i32 by default
var anInferredI64 = 0x100000000; // infers i64 because the value doesn't fit in 32 bits
var anInferredF64 = 42.0; // infers f64 because it is notated as a float
var anInferredF32 = <f32>42.0; // infers f32 by evaluating its initializer
// Unary expressions just work
import "./unary";
// Binary expressions just work
import "./binary";
// Logical expressions just work
import "./logical";
// Several WebAssembly and some common JavaScript built-ins are supported and compile to opcodes directly
import "./builtins";
// Speaking of imports: Exports and re-exports are supported as well
export { aConstantGlobal };
export { anExportedConstantGlobal as anAliasedConstantGlobal } from "./showcase";
// Elements can be arranged in namespaces
namespace ANamespace {
export var aNamespacedGlobal: i32 = 42;
export function aNamespacedFunction(a: i32): i32 { return a; } // functions just work
}
// The compiler supports built-in assertions (--noAssert disables them globally)
assert(ANamespace.aNamespacedFunction(ANamespace.aNamespacedGlobal) == 42);
// Enums become constant globals and thus can be exported from the entry file
export enum AnEnum {
ONE = 1, // values can use explicit initializers
TWO, // or assume the previous value + 1
// or be omitted
FOUR = AnEnum.TWO + 2, // or reference other values (and remain constant through precomputation)
FIVE, // and continue from there
FORTYTWO = aMutableGlobal, // or reference mutable values but then can't be exported
FORTYTHREE // and even continue from there without being exported (tsc doesn't allow this)
}
assert(AnEnum.ONE == 1);
assert(AnEnum.TWO == 2);
assert(AnEnum.FOUR == 4);
assert(AnEnum.FIVE == 5);
assert(AnEnum.FORTYTWO == 42);
assert(AnEnum.FORTYTHREE == 43);
// In fact, there are a couple of things asc just waves through where tsc refuses to
1, 2, 3; // for example not-so-useful comma expressions
function addGeneric<T>(left: T, right: T): T {
return left + right; // or maybe-useful generic math
}
// Speaking of generics: While there is no type inference yet, it just works
addGeneric<i32>(1, 2); // compiles and calls the i32 version
addGeneric<f32>(1, 2); // compiles and calls the f32 version
clz<i64>(0x8000); // most built-ins are generic as well
// Type aliases work but must be declared in the global scope for now
type double = f64;
addGeneric<double>(1, 2); // compiles and calls the f64 version
// Speaking of lazy compilation: Stuff that's not used is considered dead code and not compiled by default
function anUnusedFunction(): void { }
// That is, unless exported from the entry file, so it is considered reachable
export function anExportedFunction(): void { }
// Or, of course, `--noTreeShaking` is specified
// As you see, while classes, strings and arrays are still in the works, pretty much everything can
// be implemented already. Here are a few more sophisitcated examples of code that'll most likely
// make it into the standard library eventually:
import "./memcpy"; // until replaced by the proposed `move_memory` intrinsic (sic.)
// Speaking of classes: Some preliminary work has already been done, so while we can't properly
// instantiate them yet, we can point them at some raw memory
class AClass {
static aStaticField: AClass | null = null;
aField: i32;
}
class ADerivedClass extends AClass {
anotherField: f32;
get aWildAccessorAppears(): f32 { return this.anotherField; }
set aWildAccessorAppears(val: f32) { this.anotherField = val; }
}
var aClassInstance = changetype<ADerivedClass>(<usize>8);
aClassInstance.aField = 42;
aClassInstance.anotherField = 9000;
assert(load<i32>(8) == 42);
assert(load<f32>(12) == 9000);
aClassInstance.aWildAccessorAppears = 123;
assert(aClassInstance.aWildAccessorAppears == 123);
AClass.aStaticField = aClassInstance;
assert(ADerivedClass.aStaticField == aClassInstance);
// yet that's pretty much a work in progress, until...
// Speaking of the standard library:
// Ultimately, a memory manager should still be present regardless of the GC spec because making
// everything a GC-managed object impacts performance where GC isn't necessary. TLSF appears to
// be a viable candidate because it's relatively fast and small and an ARC-variant seems like a
// good internal alternative to a general-purpose GC if we can figure out reference cycles.
// With GC (and earlier: host-bindings) it will technically be possible to declare classes whose
// instances can cross the JS/WASM boundary natively, but then aren't stored in linear memory.
// Have a nice day!
// P.S: Interested in compilers? Nothing cooler to do with your spare time? Say hi!

File diff suppressed because it is too large Load Diff

View File

@ -2419,7 +2419,7 @@
(set_global $std/allocator_arena/i
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_u
(get_global $std/allocator_arena/i)
@ -2452,7 +2452,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -2466,7 +2466,7 @@
(set_global $std/allocator_arena/i
(i32.const 0)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.ge_u
(get_global $std/allocator_arena/i)
@ -2499,7 +2499,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
)

View File

@ -2729,37 +2729,35 @@
(set_global $std/allocator_arena/i
(i32.const 0)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_global $std/allocator_arena/i)
(i32.const 42)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_global $std/allocator_arena/i)
(i32.const 42)
)
)
(if
(i32.eqz
(i32.eq
(i32.load8_u
(i32.add
(get_global $std/allocator_arena/ptr1)
(get_global $std/allocator_arena/i)
)
)
(if
(i32.eqz
(i32.eq
(i32.load8_u
(i32.add
(get_global $std/allocator_arena/ptr1)
(get_global $std/allocator_arena/i)
)
(i32.const 18)
)
(i32.const 18)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 13)
(i32.const 2)
)
(unreachable)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 13)
(i32.const 2)
)
(unreachable)
)
)
(set_global $std/allocator_arena/i
@ -2768,7 +2766,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(call $~lib/memory/move_memory
@ -2780,37 +2778,35 @@
(set_global $std/allocator_arena/i
(i32.const 0)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(i32.eqz
(i32.lt_u
(get_global $std/allocator_arena/i)
(i32.const 42)
)
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i32.lt_u
(get_global $std/allocator_arena/i)
(i32.const 42)
)
)
(if
(i32.eqz
(i32.eq
(i32.load8_u
(i32.add
(get_global $std/allocator_arena/ptr2)
(get_global $std/allocator_arena/i)
)
)
(if
(i32.eqz
(i32.eq
(i32.load8_u
(i32.add
(get_global $std/allocator_arena/ptr2)
(get_global $std/allocator_arena/i)
)
(i32.const 18)
)
(i32.const 18)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 18)
(i32.const 2)
)
(unreachable)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 18)
(i32.const 2)
)
(unreachable)
)
)
(set_global $std/allocator_arena/i
@ -2819,7 +2815,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(if

View File

@ -2939,7 +2939,7 @@
(i32.const 1)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $1)
@ -2997,7 +2997,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $0)
@ -3364,7 +3364,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -3417,7 +3417,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -3481,7 +3481,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -3506,29 +3506,24 @@
(set_global $~argc
(i32.const 3)
)
(i32.eqz
(i32.and
(call_indirect (type $iiii)
(i32.load offset=8
(i32.add
(get_local $3)
(i32.shl
(get_local $2)
(i32.const 2)
)
(i32.and
(call_indirect (type $iiii)
(i32.load offset=8
(i32.add
(get_local $3)
(i32.shl
(get_local $2)
(i32.const 2)
)
)
(get_local $2)
(get_local $0)
(get_local $1)
)
(i32.const 1)
(get_local $2)
(get_local $0)
(get_local $1)
)
(i32.const 1)
)
)
(return
(i32.const 0)
)
(block
(set_local $2
(i32.add
@ -3536,7 +3531,10 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
(return
(i32.const 0)
)
)
)
@ -3600,7 +3598,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -3653,7 +3651,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -3719,7 +3717,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -3762,7 +3760,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -3825,7 +3823,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -3877,7 +3875,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $5)
@ -3952,7 +3950,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -4004,7 +4002,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $5)
@ -4061,7 +4059,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -4120,7 +4118,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $4)
@ -4194,7 +4192,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(if (result i32)
@ -4240,7 +4238,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $2)
@ -4311,7 +4309,7 @@
(i32.const 1)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.lt_s
(get_local $3)
@ -4344,7 +4342,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $2)
@ -4421,7 +4419,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -4449,7 +4447,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $1)
@ -4532,7 +4530,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $1)
@ -4561,7 +4559,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $0)
@ -4597,7 +4595,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $2)
@ -4698,7 +4696,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $0)
@ -4750,7 +4748,7 @@
(i32.const 1)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.le_s
(get_local $4)
@ -4906,7 +4904,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(block $break|2
@ -4916,7 +4914,7 @@
(i32.const 1)
)
)
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.lt_s
(get_local $4)
@ -5098,7 +5096,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(call $~lib/allocator/arena/free_memory
@ -5228,7 +5226,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $2)
@ -5268,7 +5266,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -5331,7 +5329,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $3)
@ -5359,7 +5357,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -5390,7 +5388,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -5429,7 +5427,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $1)
@ -5577,7 +5575,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -5608,7 +5606,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $1)
@ -5946,7 +5944,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $3)
@ -5974,7 +5972,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -6178,7 +6176,7 @@
(i32.const 544)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $2)
@ -6211,7 +6209,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $1)
@ -6228,7 +6226,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $0)
@ -6255,7 +6253,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $1)

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
(i32.const 1)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_u
(get_local $1)
@ -53,7 +53,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $2)

View File

@ -44,29 +44,27 @@
)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $2)
(get_local $3)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $2)
(get_local $3)
)
)
(set_local $1
(i32.mul
(i32.xor
(get_local $1)
(i32.load8_u offset=4
(i32.add
(get_local $0)
(get_local $2)
)
)
(set_local $1
(i32.mul
(i32.xor
(get_local $1)
(i32.load8_u offset=4
(i32.add
(get_local $0)
(get_local $2)
)
)
(i32.const 16777619)
)
(i32.const 16777619)
)
)
(set_local $2
@ -75,7 +73,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(return

View File

@ -8607,7 +8607,7 @@
(i64.const 12)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.eqz
@ -8630,7 +8630,7 @@
(i64.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i64.shl
@ -8663,7 +8663,7 @@
(i64.const 12)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i64.eqz
@ -8686,7 +8686,7 @@
(i64.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i64.shl
@ -8702,7 +8702,7 @@
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_local $3)
@ -8744,7 +8744,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -8771,7 +8771,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i64.eqz
@ -8794,7 +8794,7 @@
(i64.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(return
@ -9000,7 +9000,7 @@
(i32.const 9)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.shr_u
(get_local $3)
@ -9019,7 +9019,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i32.shl
@ -9050,7 +9050,7 @@
(i32.const 9)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.shr_u
(get_local $3)
@ -9069,7 +9069,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i32.shl
@ -9083,7 +9083,7 @@
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_local $4)
@ -9125,7 +9125,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -9152,7 +9152,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.shr_u
(get_local $2)
@ -9171,7 +9171,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(return
@ -12401,7 +12401,7 @@
(i64.const 12)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i64.ne
(i64.shr_u
@ -12423,7 +12423,7 @@
(i64.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i64.shl
@ -12464,7 +12464,7 @@
(i64.const 12)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i64.ne
(i64.shr_u
@ -12486,7 +12486,7 @@
(i64.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i64.shl
@ -12531,7 +12531,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.le_s
(get_local $2)
@ -12581,7 +12581,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(if
@ -12618,7 +12618,7 @@
(i32.const -60)
)
(block $break|4
(loop $loop|4
(loop $repeat|4
(br_if $break|4
(i64.ne
(i64.shr_u
@ -12640,7 +12640,7 @@
(i32.const 1)
)
)
(br $loop|4)
(br $repeat|4)
)
)
)
@ -12866,7 +12866,7 @@
(i32.const 9)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.shr_u
(get_local $2)
@ -12885,7 +12885,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i32.shl
@ -12922,7 +12922,7 @@
(i32.const 9)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.shr_u
(get_local $2)
@ -12941,7 +12941,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i32.shl
@ -12985,7 +12985,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.le_s
(get_local $3)
@ -13034,7 +13034,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(if
@ -13064,7 +13064,7 @@
(if
(get_local $4)
(block $break|4
(loop $loop|4
(loop $repeat|4
(br_if $break|4
(i32.shr_u
(get_local $4)
@ -13083,7 +13083,7 @@
(i32.const 1)
)
)
(br $loop|4)
(br $repeat|4)
)
)
(set_local $3
@ -44238,7 +44238,7 @@
)
)
(block $break|0
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(f64.lt
@ -44272,7 +44272,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
(block
(call $~lib/env/abort
@ -44295,7 +44295,7 @@
(set_local $0
(i32.const 0)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(f64.lt
@ -44329,7 +44329,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
(block
(call $~lib/env/abort

File diff suppressed because it is too large Load Diff

View File

@ -152,7 +152,7 @@
(i64.const 12)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.eqz
@ -175,7 +175,7 @@
(i64.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i64.shl
@ -208,7 +208,7 @@
(i64.const 12)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i64.eqz
@ -231,7 +231,7 @@
(i64.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i64.shl
@ -247,7 +247,7 @@
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_local $3)
@ -289,7 +289,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -316,7 +316,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i64.eqz
@ -339,7 +339,7 @@
(i64.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(return
@ -581,7 +581,7 @@
(i32.const 9)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.shr_u
(get_local $3)
@ -600,7 +600,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(i32.shl
@ -631,7 +631,7 @@
(i32.const 9)
)
)
(loop $loop|1
(loop $repeat|1
(br_if $break|1
(i32.shr_u
(get_local $3)
@ -650,7 +650,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(i32.shl
@ -664,7 +664,7 @@
)
)
(block $break|2
(loop $loop|2
(loop $repeat|2
(br_if $break|2
(i32.le_s
(get_local $4)
@ -706,7 +706,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(if
@ -733,7 +733,7 @@
)
)
(block $break|3
(loop $loop|3
(loop $repeat|3
(br_if $break|3
(i32.shr_u
(get_local $2)
@ -752,7 +752,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(return

View File

@ -160,23 +160,21 @@
(i64.const 12)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $8
@ -185,7 +183,7 @@
(i64.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(set_local $2
@ -236,23 +234,21 @@
(i64.const 12)
)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $8
@ -261,7 +257,7 @@
(i64.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(set_local $3
@ -301,53 +297,50 @@
)
)
(block $break|2
(nop)
(loop $loop|2
(block $continue|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
(loop $repeat|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
)
(block
(set_local $8
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
(block
(if
(i64.eqz
(get_local $8)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(block
(set_local $8
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $8)
(i64.const 63)
)
)
(block
(if
(i64.eqz
(get_local $8)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
)
)
@ -357,7 +350,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(set_local $8
@ -391,24 +384,21 @@
)
)
(block $break|3
(nop)
(loop $loop|3
(block $continue|3
(br_if $break|3
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $2)
(i64.const 52)
)
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i64.eqz
(i64.shr_u
(get_local $2)
(i64.const 52)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $2
@ -417,7 +407,7 @@
(i64.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(if
@ -684,23 +674,21 @@
(i32.const 9)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.eqz
(i32.eqz
(i32.shr_u
(get_local $8)
(i32.const 31)
)
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $8
@ -709,7 +697,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(set_local $2
@ -758,23 +746,21 @@
(i32.const 9)
)
)
(loop $loop|1
(block $continue|1
(br_if $break|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i32.eqz
(i32.eqz
(i32.shr_u
(get_local $8)
(i32.const 31)
)
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $5
(i32.sub
(get_local $5)
(i32.const 1)
)
)
(set_local $8
@ -783,7 +769,7 @@
(i32.const 1)
)
)
(br $loop|1)
(br $repeat|1)
)
)
(set_local $3
@ -821,53 +807,50 @@
)
)
(block $break|2
(nop)
(loop $loop|2
(block $continue|2
(br_if $break|2
(loop $repeat|2
(br_if $break|2
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
)
(block
(set_local $8
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
(block
(if
(i32.eqz
(get_local $8)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(block
(set_local $8
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $8)
(i32.const 31)
)
)
(block
(if
(i32.eqz
(get_local $8)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(get_local $8)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
)
)
@ -877,7 +860,7 @@
(i32.const 1)
)
)
(br $loop|2)
(br $repeat|2)
)
)
(set_local $8
@ -911,24 +894,21 @@
)
)
(block $break|3
(nop)
(loop $loop|3
(block $continue|3
(br_if $break|3
(loop $repeat|3
(br_if $break|3
(i32.eqz
(i32.eqz
(i32.eqz
(i32.shr_u
(get_local $2)
(i32.const 23)
)
(i32.shr_u
(get_local $2)
(i32.const 23)
)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(set_local $2
@ -937,7 +917,7 @@
(i32.const 1)
)
)
(br $loop|3)
(br $repeat|3)
)
)
(if

View File

@ -2110,7 +2110,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_u
(get_local $2)
@ -2142,7 +2142,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)
@ -2172,7 +2172,7 @@
(get_local $0)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_u
(get_local $2)
@ -2254,7 +2254,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
)

View File

@ -2408,34 +2408,32 @@
)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $2)
(get_local $3)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $2)
(get_local $3)
)
)
(if
(i32.eq
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(get_local $2)
(i32.const 4)
)
)
(if
(i32.eq
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(get_local $2)
(i32.const 4)
)
)
(get_local $1)
)
(return
(i32.const 1)
)
(get_local $1)
)
(return
(i32.const 1)
)
)
(set_local $2
@ -2444,7 +2442,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(return
@ -2482,19 +2480,40 @@
)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $2)
(get_local $3)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_u
(get_local $2)
(get_local $3)
)
)
(if
(i32.eq
(i32.load
)
(if
(i32.eq
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(get_local $2)
(i32.const 4)
)
)
)
(get_local $1)
)
(block
(if
(i32.lt_u
(i32.add
(get_local $2)
(i32.const 1)
)
(get_local $3)
)
(call $~lib/memory/move_memory
(i32.add
(i32.load
(get_local $0)
@ -2504,62 +2523,39 @@
(i32.const 4)
)
)
)
(get_local $1)
)
(block
(if
(i32.lt_u
(i32.add
(get_local $2)
(i32.const 1)
)
(get_local $3)
)
(call $~lib/memory/move_memory
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(get_local $2)
(i32.const 4)
)
)
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(i32.add
(get_local $2)
(i32.const 1)
)
(i32.const 4)
)
)
(i32.sub
(i32.sub
(get_local $3)
(get_local $2)
)
(i32.const 1)
)
)
)
(i32.store offset=8
(get_local $0)
(i32.sub
(i32.load offset=8
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(i32.add
(get_local $2)
(i32.const 1)
)
(i32.const 4)
)
)
(i32.sub
(i32.sub
(get_local $3)
(get_local $2)
)
(i32.const 1)
)
)
(return
)
(i32.store offset=8
(get_local $0)
(i32.sub
(i32.load offset=8
(get_local $0)
)
(i32.const 1)
)
)
(return
(i32.const 1)
)
)
)
(set_local $2
@ -2568,7 +2564,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(return

View File

@ -403,7 +403,7 @@
)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.gt_s
(i32.add
@ -441,7 +441,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
(return
(get_local $2)
@ -3644,7 +3644,7 @@
(get_local $1)
)
)
(loop $loop|0
(loop $repeat|0
(br_if $break|0
(i32.ge_s
(get_local $2)
@ -3671,7 +3671,7 @@
(get_local $3)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(get_local $4)

View File

@ -504,45 +504,43 @@
(set_local $5
(get_local $7)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.le_s
(i32.add
(get_local $5)
(get_local $8)
)
(get_local $4)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.le_s
(i32.add
(get_local $5)
(get_local $8)
)
(get_local $4)
)
)
(if
(i32.eqz
(call $~lib/memory/compare_memory
)
(if
(i32.eqz
(call $~lib/memory/compare_memory
(i32.add
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
)
(i32.shl
(get_local $5)
(i32.const 1)
)
)
(i32.add
(get_local $1)
(get_local $0)
(i32.const 4)
)
(i32.shl
(get_local $8)
(get_local $5)
(i32.const 1)
)
)
(i32.add
(get_local $1)
(i32.const 4)
)
(i32.shl
(get_local $8)
(i32.const 1)
)
)
(return
(get_local $5)
)
)
(return
(get_local $5)
)
)
(set_local $5
@ -551,7 +549,7 @@
(i32.const 1)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(return
@ -4208,30 +4206,28 @@
)
)
)
(loop $loop|0
(block $continue|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $3)
(get_local $6)
)
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.lt_s
(get_local $3)
(get_local $6)
)
)
(call $~lib/memory/move_memory
)
(call $~lib/memory/move_memory
(i32.add
(i32.add
(i32.add
(get_local $4)
(i32.const 4)
)
(get_local $3)
)
(i32.add
(get_local $0)
(get_local $4)
(i32.const 4)
)
(get_local $5)
(get_local $3)
)
(i32.add
(get_local $0)
(i32.const 4)
)
(get_local $5)
)
(set_local $3
(i32.add
@ -4239,7 +4235,7 @@
(get_local $5)
)
)
(br $loop|0)
(br $repeat|0)
)
)
(return