Implement unary operator overloads (#124)

This commit is contained in:
Max Graey
2018-06-04 18:23:09 +03:00
committed by Daniel Wirtz
parent 0054eae491
commit 567a5fb064
5 changed files with 1700 additions and 186 deletions

View File

@ -59,6 +59,20 @@
(global $std/operator-overloading/leq1 (mut i32) (i32.const 0))
(global $std/operator-overloading/leq2 (mut i32) (i32.const 0))
(global $std/operator-overloading/leq (mut i32) (i32.const 0))
(global $std/operator-overloading/shr (mut i32) (i32.const 0))
(global $std/operator-overloading/sres (mut i32) (i32.const 0))
(global $std/operator-overloading/shu (mut i32) (i32.const 0))
(global $std/operator-overloading/ures (mut i32) (i32.const 0))
(global $std/operator-overloading/shl (mut i32) (i32.const 0))
(global $std/operator-overloading/pos (mut i32) (i32.const 0))
(global $std/operator-overloading/pres (mut i32) (i32.const 0))
(global $std/operator-overloading/neg (mut i32) (i32.const 0))
(global $std/operator-overloading/nres (mut i32) (i32.const 0))
(global $std/operator-overloading/not (mut i32) (i32.const 0))
(global $std/operator-overloading/res (mut i32) (i32.const 0))
(global $std/operator-overloading/excl (mut i32) (i32.const 0))
(global $std/operator-overloading/bres (mut i32) (i32.const 0))
(global $std/operator-overloading/incdec (mut i32) (i32.const 0))
(global $std/operator-overloading/ais1 (mut i32) (i32.const 0))
(global $std/operator-overloading/ais2 (mut i32) (i32.const 0))
(global $std/operator-overloading/ais (mut i32) (i32.const 0))
@ -2263,7 +2277,168 @@
)
)
)
(func $std/operator-overloading/TesterInlineStatic#constructor (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $std/operator-overloading/Tester.shr (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(return
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.shr_s
(i32.load
(get_local $0)
)
(get_local $1)
)
(i32.shr_s
(i32.load offset=4
(get_local $0)
)
(get_local $1)
)
)
)
)
(func $std/operator-overloading/Tester.shu (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(return
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.shr_u
(i32.load
(get_local $0)
)
(get_local $1)
)
(i32.shr_u
(i32.load offset=4
(get_local $0)
)
(get_local $1)
)
)
)
)
(func $std/operator-overloading/Tester.shl (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(return
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.shl
(i32.load
(get_local $0)
)
(get_local $1)
)
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $1)
)
)
)
)
(func $std/operator-overloading/Tester.neg (; 23 ;) (type $ii) (param $0 i32) (result i32)
(return
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.sub
(i32.const 0)
(i32.load
(get_local $0)
)
)
(i32.sub
(i32.const 0)
(i32.load offset=4
(get_local $0)
)
)
)
)
)
(func $std/operator-overloading/Tester.not (; 24 ;) (type $ii) (param $0 i32) (result i32)
(return
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.xor
(i32.load
(get_local $0)
)
(i32.const -1)
)
(i32.xor
(i32.load offset=4
(get_local $0)
)
(i32.const -1)
)
)
)
)
(func $std/operator-overloading/Tester.excl (; 25 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(return
(if (result i32)
(tee_local $1
(i32.eqz
(i32.load
(get_local $0)
)
)
)
(i32.eqz
(i32.load offset=4
(get_local $0)
)
)
(get_local $1)
)
)
)
(func $std/operator-overloading/Tester#inc (; 26 ;) (type $ii) (param $0 i32) (result i32)
(i32.store
(get_local $0)
(i32.add
(i32.load
(get_local $0)
)
(i32.const 1)
)
)
(i32.store offset=4
(get_local $0)
(i32.add
(i32.load offset=4
(get_local $0)
)
(i32.const 1)
)
)
(return
(get_local $0)
)
)
(func $std/operator-overloading/Tester#dec (; 27 ;) (type $ii) (param $0 i32) (result i32)
(i32.store
(get_local $0)
(i32.sub
(i32.load
(get_local $0)
)
(i32.const 1)
)
)
(i32.store offset=4
(get_local $0)
(i32.sub
(i32.load offset=4
(get_local $0)
)
(i32.const 1)
)
)
(return
(get_local $0)
)
)
(func $std/operator-overloading/TesterInlineStatic#constructor (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(nop)
(tee_local $0
@ -2291,7 +2466,7 @@
)
)
)
(func $std/operator-overloading/TesterInlineInstance#constructor (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $std/operator-overloading/TesterInlineInstance#constructor (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(nop)
(tee_local $0
@ -2319,7 +2494,7 @@
)
)
)
(func $start (; 22 ;) (type $v)
(func $start (; 30 ;) (type $v)
(local $0 i32)
(local $1 i32)
(set_global $~lib/allocator/arena/startOffset
@ -2381,7 +2556,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 87)
(i32.const 137)
(i32.const 0)
)
(unreachable)
@ -2431,7 +2606,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 93)
(i32.const 143)
(i32.const 0)
)
(unreachable)
@ -2481,7 +2656,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 99)
(i32.const 149)
(i32.const 0)
)
(unreachable)
@ -2531,7 +2706,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 105)
(i32.const 155)
(i32.const 0)
)
(unreachable)
@ -2581,7 +2756,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 111)
(i32.const 161)
(i32.const 0)
)
(unreachable)
@ -2631,7 +2806,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 117)
(i32.const 167)
(i32.const 0)
)
(unreachable)
@ -2681,7 +2856,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 123)
(i32.const 173)
(i32.const 0)
)
(unreachable)
@ -2731,7 +2906,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 129)
(i32.const 179)
(i32.const 0)
)
(unreachable)
@ -2781,7 +2956,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 135)
(i32.const 185)
(i32.const 0)
)
(unreachable)
@ -2818,7 +2993,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 141)
(i32.const 191)
(i32.const 0)
)
(unreachable)
@ -2855,7 +3030,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 147)
(i32.const 197)
(i32.const 0)
)
(unreachable)
@ -2878,7 +3053,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 151)
(i32.const 201)
(i32.const 0)
)
(unreachable)
@ -2901,7 +3076,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 155)
(i32.const 205)
(i32.const 0)
)
(unreachable)
@ -2938,7 +3113,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 161)
(i32.const 211)
(i32.const 0)
)
(unreachable)
@ -2975,7 +3150,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 167)
(i32.const 217)
(i32.const 0)
)
(unreachable)
@ -3012,7 +3187,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 173)
(i32.const 223)
(i32.const 0)
)
(unreachable)
@ -3049,7 +3224,421 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 179)
(i32.const 229)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/shr
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 8)
(i32.const 16)
)
)
(set_global $std/operator-overloading/sres
(call $std/operator-overloading/Tester.shr
(get_global $std/operator-overloading/shr)
(i32.const 3)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/sres)
)
(i32.const 1)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/sres)
)
(i32.const 2)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 234)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/shu
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const -8)
(i32.const -16)
)
)
(set_global $std/operator-overloading/ures
(call $std/operator-overloading/Tester.shu
(get_global $std/operator-overloading/shu)
(i32.const 3)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/ures)
)
(i32.const 536870911)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/ures)
)
(i32.const 536870910)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 239)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/shl
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(set_global $std/operator-overloading/sres
(call $std/operator-overloading/Tester.shl
(get_global $std/operator-overloading/shl)
(i32.const 3)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/sres)
)
(i32.const 8)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/sres)
)
(i32.const 16)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 244)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/pos
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 1)
(i32.const -2)
)
)
(set_global $std/operator-overloading/pres
(get_global $std/operator-overloading/pos)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/pres)
)
(i32.load
(get_global $std/operator-overloading/pos)
)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/pres)
)
(i32.load offset=4
(get_global $std/operator-overloading/pos)
)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 249)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/neg
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const -1)
(i32.const -2)
)
)
(set_global $std/operator-overloading/nres
(call $std/operator-overloading/Tester.neg
(get_global $std/operator-overloading/neg)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/nres)
)
(i32.sub
(i32.const 0)
(i32.load
(get_global $std/operator-overloading/neg)
)
)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/nres)
)
(i32.sub
(i32.const 0)
(i32.load offset=4
(get_global $std/operator-overloading/neg)
)
)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 254)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/not
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 255)
(i32.const 16)
)
)
(set_global $std/operator-overloading/res
(call $std/operator-overloading/Tester.not
(get_global $std/operator-overloading/not)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/res)
)
(i32.xor
(i32.load
(get_global $std/operator-overloading/not)
)
(i32.const -1)
)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/res)
)
(i32.xor
(i32.load offset=4
(get_global $std/operator-overloading/not)
)
(i32.const -1)
)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 259)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/excl
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 0)
(i32.const 0)
)
)
(set_global $std/operator-overloading/bres
(call $std/operator-overloading/Tester.excl
(get_global $std/operator-overloading/excl)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/bres)
(if (result i32)
(tee_local $0
(i32.eqz
(i32.load
(get_global $std/operator-overloading/excl)
)
)
)
(i32.eqz
(i32.load offset=4
(get_global $std/operator-overloading/excl)
)
)
(get_local $0)
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 264)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(get_global $std/operator-overloading/bres)
(i32.const 1)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 265)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/incdec
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
)
(set_global $std/operator-overloading/incdec
(call $std/operator-overloading/Tester#inc
(get_global $std/operator-overloading/incdec)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/incdec)
)
(i32.const 1)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/incdec)
)
(i32.const 2)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 271)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/incdec
(call $std/operator-overloading/Tester#dec
(get_global $std/operator-overloading/incdec)
)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/incdec)
)
(i32.const 0)
)
)
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/incdec)
)
(i32.const 1)
)
(get_local $0)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 274)
(i32.const 0)
)
(unreachable)
@ -3124,7 +3713,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 193)
(i32.const 288)
(i32.const 0)
)
(unreachable)
@ -3199,7 +3788,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 207)
(i32.const 302)
(i32.const 0)
)
(unreachable)