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

@ -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