mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-13 06:51:34 +00:00
Properly resolve top level enums to i32s, see #116
This commit is contained in:
@ -32,3 +32,5 @@ export enum SelfReference {
|
||||
ZERO,
|
||||
ONE = ZERO + 1
|
||||
}
|
||||
|
||||
var enumType: SelfReference;
|
||||
|
@ -17,6 +17,7 @@
|
||||
(global $enum/NonConstant.ONE (mut i32) (i32.const 0))
|
||||
(global $enum/SelfReference.ZERO i32 (i32.const 0))
|
||||
(global $enum/SelfReference.ONE i32 (i32.const 1))
|
||||
(global $enum/enumType (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(memory $0 1)
|
||||
(export "Implicit.ZERO" (global $enum/Implicit.ZERO))
|
||||
|
@ -9,11 +9,10 @@
|
||||
(global $std/string-utf8/str (mut i32) (i32.const 8))
|
||||
(global $std/string-utf8/len (mut i32) (i32.const 0))
|
||||
(global $std/string-utf8/ptr (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 96))
|
||||
(global $HEAP_BASE i32 (i32.const 64))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00\01\d87\dch\00i\00R\d8b\df")
|
||||
(data (i32.const 24) "\12\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00u\00t\00f\008\00.\00t\00s")
|
||||
(data (i32.const 64) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $~lib/string/String#get:lengthUTF8 (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -21,17 +20,17 @@
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(set_local $1
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $4
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 1)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(i32.lt_u
|
||||
(get_local $2)
|
||||
(get_local $4)
|
||||
)
|
||||
@ -243,29 +242,26 @@
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(set_local $5
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(tee_local $6
|
||||
(call $~lib/string/String#get:lengthUTF8
|
||||
(get_local $0)
|
||||
)
|
||||
(call $~lib/string/String#get:lengthUTF8
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(set_local $6
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $3)
|
||||
(get_local $7)
|
||||
(i32.lt_u
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $3
|
||||
(if (result i32)
|
||||
(i32.lt_u
|
||||
(tee_local $1
|
||||
@ -273,7 +269,7 @@
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -285,18 +281,18 @@
|
||||
(i32.store8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -310,7 +306,7 @@
|
||||
(tee_local $4
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(i32.or
|
||||
@ -331,14 +327,14 @@
|
||||
(i32.const 128)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -346,7 +342,7 @@
|
||||
(set_local $4
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
@ -360,13 +356,13 @@
|
||||
(if
|
||||
(i32.eq
|
||||
(i32.and
|
||||
(tee_local $8
|
||||
(tee_local $7
|
||||
(i32.load16_u offset=4
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -396,7 +392,7 @@
|
||||
(i32.const 65536)
|
||||
)
|
||||
(i32.and
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
(i32.const 1023)
|
||||
)
|
||||
)
|
||||
@ -442,15 +438,15 @@
|
||||
(i32.const 128)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -491,14 +487,14 @@
|
||||
(i32.const 128)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
@ -509,28 +505,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ne
|
||||
(get_local $2)
|
||||
(i32.sub
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 64)
|
||||
(i32.const 471)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(i32.store8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
|
@ -14,11 +14,10 @@
|
||||
(global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4))
|
||||
(global $std/string-utf8/len (mut i32) (i32.const 0))
|
||||
(global $std/string-utf8/ptr (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 96))
|
||||
(global $HEAP_BASE i32 (i32.const 64))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\06\00\00\00\01\d87\dch\00i\00R\d8b\df")
|
||||
(data (i32.const 24) "\12\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00u\00t\00f\008\00.\00t\00s\00")
|
||||
(data (i32.const 64) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $~lib/string/String#get:lengthUTF8 (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -28,22 +27,24 @@
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(set_local $1
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.const 1)
|
||||
)
|
||||
(block $break|0
|
||||
(set_local $3
|
||||
(i32.const 0)
|
||||
(block
|
||||
(set_local $2
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(i32.lt_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
(get_local $1)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
@ -52,7 +53,7 @@
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -64,15 +65,15 @@
|
||||
(i32.const 128)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -83,15 +84,15 @@
|
||||
(i32.const 2048)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -114,7 +115,7 @@
|
||||
(get_local $0)
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -128,29 +129,29 @@
|
||||
(get_local $5)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -166,7 +167,7 @@
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -314,7 +315,7 @@
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(i32.lt_u
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
@ -577,26 +578,6 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(get_local $3)
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 64)
|
||||
(i32.const 471)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(i32.store8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
|
@ -980,7 +980,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 76)
|
||||
(i32.const 526)
|
||||
(i32.const 524)
|
||||
(i32.const 10)
|
||||
)
|
||||
(unreachable)
|
||||
|
@ -1157,7 +1157,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 76)
|
||||
(i32.const 526)
|
||||
(i32.const 524)
|
||||
(i32.const 10)
|
||||
)
|
||||
(unreachable)
|
||||
|
Reference in New Issue
Block a user