Infer u32 from 32-bit integer literals if MSB is set

This commit is contained in:
dcodeIO
2018-06-21 22:47:37 +02:00
parent c74eed2bd8
commit 525795b354
12 changed files with 101 additions and 27 deletions

View File

@ -84,9 +84,7 @@
)
(i32.and
(get_local $0)
(i32.wrap/i64
(i64.const 4294901760)
)
(i32.const -65536)
)
)
)
@ -224,9 +222,7 @@
)
(i32.and
(get_local $0)
(i32.wrap/i64
(i64.const 4294901760)
)
(i32.const -65536)
)
)
)

View File

@ -30,16 +30,21 @@
(export "memory" (memory $0))
(start $start)
(func $~lib/symbol/Symbol#constructor (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(set_global $~lib/symbol/nextId
(i32.add
(tee_local $2
(tee_local $0
(get_global $~lib/symbol/nextId)
)
(i32.const 1)
)
)
(get_local $2)
(if
(i32.eqz
(get_local $0)
)
(unreachable)
)
(get_local $0)
)
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
@ -1639,6 +1644,12 @@
(i32.const 1)
)
)
(if
(i32.eqz
(get_local $1)
)
(unreachable)
)
(call $~lib/map/Map<String,usize>#set
(get_global $~lib/symbol/stringToId)
(get_local $0)

View File

@ -45,7 +45,8 @@
(start $start)
(func $~lib/symbol/Symbol#constructor (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(return
(local $3 i32)
(set_local $3
(block (result i32)
(set_local $2
(get_global $~lib/symbol/nextId)
@ -59,6 +60,15 @@
(get_local $2)
)
)
(if
(i32.eqz
(get_local $3)
)
(unreachable)
)
(return
(get_local $3)
)
)
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
@ -1979,6 +1989,12 @@
(get_local $1)
)
)
(if
(i32.eqz
(get_local $2)
)
(unreachable)
)
(call $~lib/map/Map<String,usize>#set
(get_global $~lib/symbol/stringToId)
(get_local $0)