Improve inlining where locals can be aliased; Add a crude mechanism for explicit unchecked array accesses

The `unchecked` builtin should be handled with ultimate care and it would be a lot better if there'd be a mechanism doing this automatically.
This commit is contained in:
dcodeIO
2018-04-25 05:04:35 +02:00
parent 391db28fe2
commit 6d6d1dddcf
47 changed files with 5374 additions and 15672 deletions

View File

@ -4176,19 +4176,19 @@
(local $10 i32)
(local $11 i32)
(local $12 f64)
(local $13 i32)
(local $14 f64)
(local $15 i32)
(local $13 f64)
(local $14 i32)
(local $15 f64)
(local $16 f64)
(local $17 f64)
(local $18 f64)
(local $19 i64)
(local $18 i64)
(local $19 i32)
(block $folding-inner1
(block $folding-inner0
(set_local $4
(set_local $19
(i32.wrap/i64
(i64.shr_u
(tee_local $19
(tee_local $18
(i64.reinterpret/f64
(get_local $0)
)
@ -4197,14 +4197,14 @@
)
)
)
(set_local $13
(set_local $7
(i32.wrap/i64
(get_local $19)
(get_local $18)
)
)
(set_local $5
(set_local $6
(i32.and
(get_local $4)
(get_local $19)
(i32.const 2147483647)
)
)
@ -4216,7 +4216,7 @@
(tee_local $11
(i32.wrap/i64
(i64.shr_u
(tee_local $19
(tee_local $18
(i64.reinterpret/f64
(get_local $1)
)
@ -4228,9 +4228,9 @@
(i32.const 2147483647)
)
)
(tee_local $6
(tee_local $4
(i32.wrap/i64
(get_local $19)
(get_local $18)
)
)
)
@ -4242,37 +4242,37 @@
(if
(i32.and
(if (result i32)
(tee_local $7
(tee_local $5
(i32.and
(if (result i32)
(tee_local $7
(tee_local $5
(i32.and
(if (result i32)
(tee_local $7
(tee_local $5
(i32.gt_s
(get_local $5)
(get_local $6)
(i32.const 2146435072)
)
)
(get_local $7)
(get_local $5)
(if (result i32)
(tee_local $7
(tee_local $5
(i32.eq
(get_local $5)
(get_local $6)
(i32.const 2146435072)
)
)
(i32.ne
(get_local $13)
(get_local $7)
(i32.const 0)
)
(get_local $7)
(get_local $5)
)
)
(i32.const 1)
)
)
(get_local $7)
(get_local $5)
(i32.gt_s
(get_local $10)
(i32.const 2146435072)
@ -4281,19 +4281,19 @@
(i32.const 1)
)
)
(get_local $7)
(get_local $5)
(if (result i32)
(tee_local $7
(tee_local $5
(i32.eq
(get_local $10)
(i32.const 2146435072)
)
)
(i32.ne
(get_local $6)
(get_local $4)
(i32.const 0)
)
(get_local $7)
(get_local $5)
)
)
(i32.const 1)
@ -4307,7 +4307,7 @@
)
(if
(i32.lt_s
(get_local $4)
(get_local $19)
(i32.const 0)
)
(if
@ -4315,7 +4315,7 @@
(get_local $10)
(i32.const 1128267776)
)
(set_local $15
(set_local $14
(i32.const 2)
)
(if
@ -4339,9 +4339,9 @@
(if
(i32.eq
(i32.shl
(tee_local $7
(tee_local $5
(i32.shr_u
(get_local $6)
(get_local $4)
(i32.sub
(i32.const 52)
(get_local $8)
@ -4353,13 +4353,13 @@
(get_local $8)
)
)
(get_local $6)
(get_local $4)
)
(set_local $15
(set_local $14
(i32.sub
(i32.const 2)
(i32.and
(get_local $7)
(get_local $5)
(i32.const 1)
)
)
@ -4367,12 +4367,12 @@
)
(if
(i32.eqz
(get_local $6)
(get_local $4)
)
(if
(i32.eq
(i32.shl
(tee_local $7
(tee_local $5
(i32.shr_s
(get_local $10)
(i32.sub
@ -4388,11 +4388,11 @@
)
(get_local $10)
)
(set_local $15
(set_local $14
(i32.sub
(i32.const 2)
(i32.and
(get_local $7)
(get_local $5)
(i32.const 1)
)
)
@ -4405,7 +4405,7 @@
)
(if
(i32.eqz
(get_local $6)
(get_local $4)
)
(block
(if
@ -4416,14 +4416,14 @@
(if
(i32.or
(i32.sub
(get_local $5)
(get_local $6)
(i32.const 1072693248)
)
(get_local $13)
(get_local $7)
)
(if
(i32.ge_s
(get_local $5)
(get_local $6)
(i32.const 1072693248)
)
(return
@ -4496,7 +4496,7 @@
)
(if
(i32.ge_s
(get_local $4)
(get_local $19)
(i32.const 0)
)
(return
@ -4515,31 +4515,31 @@
)
(if
(i32.eqz
(get_local $13)
(get_local $7)
)
(if
(i32.and
(if (result i32)
(tee_local $7
(tee_local $5
(i32.and
(if (result i32)
(tee_local $7
(tee_local $5
(i32.eq
(get_local $5)
(get_local $6)
(i32.const 2146435072)
)
)
(get_local $7)
(get_local $5)
(i32.eqz
(get_local $5)
(get_local $6)
)
)
(i32.const 1)
)
)
(get_local $7)
(get_local $5)
(i32.eq
(get_local $5)
(get_local $6)
(i32.const 1072693248)
)
)
@ -4560,20 +4560,20 @@
)
(if
(i32.lt_s
(get_local $4)
(get_local $19)
(i32.const 0)
)
(if
(i32.or
(i32.sub
(get_local $5)
(get_local $6)
(i32.const 1072693248)
)
(get_local $15)
(get_local $14)
)
(if
(i32.eq
(get_local $15)
(get_local $14)
(i32.const 1)
)
(set_local $2
@ -4607,13 +4607,13 @@
)
(if
(i32.lt_s
(get_local $4)
(get_local $19)
(i32.const 0)
)
(block
(if
(i32.eqz
(get_local $15)
(get_local $14)
)
(return
(f64.div
@ -4630,7 +4630,7 @@
)
(if
(i32.eq
(get_local $15)
(get_local $14)
(i32.const 1)
)
(set_local $12
@ -4654,7 +4654,7 @@
(block
(if
(i32.le_s
(get_local $5)
(get_local $6)
(i32.const 1072693247)
)
(return
@ -4670,7 +4670,7 @@
)
(if
(i32.ge_s
(get_local $5)
(get_local $6)
(i32.const 1072693248)
)
(return
@ -4688,7 +4688,7 @@
)
(if
(i32.lt_s
(get_local $5)
(get_local $6)
(i32.const 1072693247)
)
(return
@ -4716,7 +4716,7 @@
)
(if
(i32.gt_s
(get_local $5)
(get_local $6)
(i32.const 1072693248)
)
(return
@ -4773,13 +4773,13 @@
(i64.and
(i64.reinterpret/f64
(f64.add
(tee_local $16
(tee_local $15
(f64.mul
(f64.const 1.4426950216293335)
(get_local $3)
)
)
(tee_local $17
(tee_local $16
(f64.sub
(f64.mul
(get_local $3)
@ -4798,10 +4798,10 @@
)
)
(f64.sub
(get_local $17)
(get_local $16)
(f64.sub
(get_local $9)
(get_local $16)
(get_local $15)
)
)
)
@ -4811,7 +4811,7 @@
)
(if
(i32.lt_s
(get_local $5)
(get_local $6)
(i32.const 1048576)
)
(block
@ -4821,7 +4821,7 @@
(i32.const 53)
)
)
(set_local $5
(set_local $6
(i32.wrap/i64
(i64.shr_u
(i64.reinterpret/f64
@ -4843,18 +4843,18 @@
(get_local $4)
(i32.sub
(i32.shr_s
(get_local $5)
(get_local $6)
(i32.const 20)
)
(i32.const 1023)
)
)
)
(set_local $5
(set_local $6
(i32.or
(tee_local $6
(tee_local $7
(i32.and
(get_local $5)
(get_local $6)
(i32.const 1048575)
)
)
@ -4864,13 +4864,13 @@
(set_local $8
(if (result i32)
(i32.le_s
(get_local $6)
(get_local $7)
(i32.const 235662)
)
(i32.const 0)
(if (result i32)
(i32.lt_s
(get_local $6)
(get_local $7)
(i32.const 767610)
)
(i32.const 1)
@ -4881,9 +4881,9 @@
(i32.const 1)
)
)
(set_local $5
(set_local $6
(i32.add
(get_local $5)
(get_local $6)
(i32.const -1048576)
)
)
@ -4896,9 +4896,9 @@
(f64.reinterpret/i64
(i64.and
(i64.reinterpret/f64
(tee_local $18
(tee_local $17
(f64.mul
(tee_local $16
(tee_local $15
(f64.sub
(tee_local $2
(f64.reinterpret/i64
@ -4911,7 +4911,7 @@
)
(i64.shl
(i64.extend_u/i32
(get_local $5)
(get_local $6)
)
(i64.const 32)
)
@ -4927,7 +4927,7 @@
)
)
)
(tee_local $17
(tee_local $16
(f64.div
(f64.const 1)
(f64.add
@ -4955,7 +4955,7 @@
(i32.add
(i32.or
(i32.shr_s
(get_local $5)
(get_local $6)
(i32.const 1)
)
(i32.const 536870912)
@ -4982,34 +4982,34 @@
(f64.add
(f64.mul
(f64.mul
(tee_local $14
(tee_local $13
(f64.mul
(get_local $18)
(get_local $18)
(get_local $17)
(get_local $17)
)
)
(get_local $14)
(get_local $13)
)
(f64.add
(f64.const 0.5999999999999946)
(f64.mul
(get_local $14)
(get_local $13)
(f64.add
(f64.const 0.4285714285785502)
(f64.mul
(get_local $14)
(get_local $13)
(f64.add
(f64.const 0.33333332981837743)
(f64.mul
(get_local $14)
(get_local $13)
(f64.add
(f64.const 0.272728123808534)
(f64.mul
(get_local $14)
(get_local $13)
(f64.add
(f64.const 0.23066074577556175)
(f64.mul
(get_local $14)
(get_local $13)
(f64.const 0.20697501780033842)
)
)
@ -5025,10 +5025,10 @@
(f64.mul
(tee_local $0
(f64.mul
(get_local $17)
(get_local $16)
(f64.sub
(f64.sub
(get_local $16)
(get_local $15)
(f64.mul
(get_local $3)
(get_local $9)
@ -5043,7 +5043,7 @@
)
(f64.add
(get_local $3)
(get_local $18)
(get_local $17)
)
)
)
@ -5057,7 +5057,7 @@
(f64.add
(f64.add
(f64.const 3)
(tee_local $14
(tee_local $13
(f64.mul
(get_local $3)
(get_local $3)
@ -5073,7 +5073,7 @@
)
(f64.const 3)
)
(get_local $14)
(get_local $13)
)
)
)
@ -5084,7 +5084,7 @@
(f64.add
(f64.add
(f64.add
(tee_local $18
(tee_local $17
(f64.mul
(f64.const 0.9617967009544373)
(tee_local $0
@ -5092,13 +5092,13 @@
(i64.and
(i64.reinterpret/f64
(f64.add
(tee_local $16
(tee_local $15
(f64.mul
(get_local $3)
(get_local $9)
)
)
(tee_local $17
(tee_local $16
(f64.add
(f64.mul
(get_local $0)
@ -5106,7 +5106,7 @@
)
(f64.mul
(get_local $2)
(get_local $18)
(get_local $17)
)
)
)
@ -5127,10 +5127,10 @@
)
(f64.mul
(f64.sub
(get_local $17)
(get_local $16)
(f64.sub
(get_local $0)
(get_local $16)
(get_local $15)
)
)
(f64.const 0.9617966939259756)
@ -5173,16 +5173,16 @@
)
(get_local $0)
)
(get_local $18)
(get_local $17)
)
)
)
)
)
(set_local $6
(set_local $7
(i32.wrap/i64
(i64.shr_u
(tee_local $19
(tee_local $18
(i64.reinterpret/f64
(tee_local $2
(f64.add
@ -5224,24 +5224,24 @@
)
)
)
(set_local $13
(set_local $5
(i32.wrap/i64
(get_local $19)
(get_local $18)
)
)
(if
(i32.ge_s
(get_local $6)
(get_local $7)
(i32.const 1083179008)
)
(br_if $folding-inner1
(i32.or
(i32.or
(i32.sub
(get_local $6)
(get_local $7)
(i32.const 1083179008)
)
(get_local $13)
(get_local $5)
)
(f64.gt
(f64.add
@ -5258,7 +5258,7 @@
(if
(i32.ge_s
(i32.and
(get_local $6)
(get_local $7)
(i32.const 2147483647)
)
(i32.const 1083231232)
@ -5267,10 +5267,10 @@
(i32.or
(i32.or
(i32.sub
(get_local $6)
(get_local $7)
(i32.const -1064252416)
)
(get_local $13)
(get_local $5)
)
(f64.le
(get_local $1)
@ -5286,9 +5286,9 @@
(set_local $8
(i32.sub
(i32.shr_s
(tee_local $13
(tee_local $5
(i32.and
(get_local $6)
(get_local $7)
(i32.const 2147483647)
)
)
@ -5302,7 +5302,7 @@
)
(if
(i32.gt_s
(get_local $13)
(get_local $5)
(i32.const 1071644672)
)
(block
@ -5312,7 +5312,7 @@
(i32.and
(tee_local $4
(i32.add
(get_local $6)
(get_local $7)
(i32.shr_s
(i32.const 1048576)
(i32.add
@ -5365,7 +5365,7 @@
)
(if
(i32.lt_s
(get_local $6)
(get_local $7)
(i32.const 0)
)
(set_local $4
@ -5390,7 +5390,7 @@
(if (result f64)
(i32.le_s
(i32.shr_s
(tee_local $6
(tee_local $7
(i32.add
(i32.wrap/i64
(i64.shr_u
@ -5404,7 +5404,7 @@
(f64.mul
(tee_local $2
(f64.add
(tee_local $16
(tee_local $15
(f64.mul
(tee_local $3
(f64.reinterpret/i64
@ -5422,7 +5422,7 @@
(f64.const 0.6931471824645996)
)
)
(tee_local $17
(tee_local $16
(f64.add
(f64.mul
(f64.sub
@ -5489,10 +5489,10 @@
(f64.add
(tee_local $0
(f64.sub
(get_local $17)
(get_local $16)
(f64.sub
(get_local $2)
(get_local $16)
(get_local $15)
)
)
)
@ -5534,7 +5534,7 @@
)
(i64.shl
(i64.extend_u/i32
(get_local $6)
(get_local $7)
)
(i64.const 32)
)
@ -5708,18 +5708,15 @@
)
)
(func $std/libm/sign (; 51 ;) (type $FF) (param $0 f64) (result f64)
(local $1 f64)
(select
(f64.copysign
(f64.const 1)
(tee_local $1
(get_local $0)
)
(get_local $0)
)
(get_local $1)
(get_local $0)
(f64.gt
(f64.abs
(get_local $1)
(get_local $0)
)
(f64.const 0)
)