mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-20 18:26:40 +00:00
Use stack IR when emitting text format (#312)
This commit is contained in:
@ -5,13 +5,13 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\00\00\00\00")
|
||||
(data (i32.const 16) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 48) "\04\00\00\00n\00u\00l\00l\00")
|
||||
(table 1 anyfunc)
|
||||
(table $0 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
||||
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
|
||||
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
|
||||
@ -27,185 +27,135 @@
|
||||
(export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall))
|
||||
(func $~lib/array/Array<Array<i32>>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(set_local $2
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(if (result i32)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<Array<i32>,Array<i32>>|inlined.0 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
get_local $0
|
||||
i32.load
|
||||
set_local $2
|
||||
get_local $1
|
||||
get_local $2
|
||||
i32.load
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
get_local $2
|
||||
get_local $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
else
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(set_local $2
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(if (result i32)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<i32,i32>|inlined.0 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
get_local $0
|
||||
i32.load
|
||||
set_local $2
|
||||
get_local $1
|
||||
get_local $2
|
||||
i32.load
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
get_local $2
|
||||
get_local $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
else
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $std/array-access/i32ArrayArrayElementAccess (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(call $~lib/array/Array<i32>#__get
|
||||
(call $~lib/array/Array<Array<i32>>#__get
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
call $~lib/array/Array<Array<i32>>#__get
|
||||
i32.const 1
|
||||
call $~lib/array/Array<i32>#__get
|
||||
)
|
||||
(func $~lib/array/Array<String>#__get (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(set_local $2
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(if (result i32)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<String,String>|inlined.0 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
get_local $0
|
||||
i32.load
|
||||
set_local $2
|
||||
get_local $1
|
||||
get_local $2
|
||||
i32.load
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
get_local $2
|
||||
get_local $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
else
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $std/array-access/stringArrayPropertyAccess (; 5 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(i32.load
|
||||
(call $~lib/array/Array<String>#__get
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
call $~lib/array/Array<String>#__get
|
||||
i32.load
|
||||
)
|
||||
(func $~lib/internal/string/compareUnsafe (; 6 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(set_local $5
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $6
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(loop $continue|0
|
||||
(if
|
||||
(if (result i32)
|
||||
(get_local $4)
|
||||
(i32.eqz
|
||||
(tee_local $5
|
||||
(i32.sub
|
||||
(i32.load16_u offset=4
|
||||
(get_local $6)
|
||||
)
|
||||
(i32.load16_u offset=4
|
||||
(get_local $7)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $4)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $6
|
||||
(i32.add
|
||||
(get_local $6)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(i32.add
|
||||
(get_local $7)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $5)
|
||||
i32.const 0
|
||||
set_local $5
|
||||
get_local $0
|
||||
get_local $1
|
||||
i32.const 1
|
||||
i32.shl
|
||||
i32.add
|
||||
set_local $6
|
||||
get_local $2
|
||||
get_local $3
|
||||
i32.const 1
|
||||
i32.shl
|
||||
i32.add
|
||||
set_local $7
|
||||
block $break|0
|
||||
loop $continue|0
|
||||
get_local $4
|
||||
if (result i32)
|
||||
get_local $6
|
||||
i32.load16_u offset=4
|
||||
get_local $7
|
||||
i32.load16_u offset=4
|
||||
i32.sub
|
||||
tee_local $5
|
||||
i32.eqz
|
||||
else
|
||||
get_local $4
|
||||
end
|
||||
if
|
||||
block
|
||||
get_local $4
|
||||
i32.const 1
|
||||
i32.sub
|
||||
set_local $4
|
||||
get_local $6
|
||||
i32.const 1
|
||||
i32.add
|
||||
set_local $6
|
||||
get_local $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
set_local $7
|
||||
end
|
||||
br $continue|0
|
||||
end
|
||||
end
|
||||
end
|
||||
get_local $5
|
||||
)
|
||||
(func $~lib/string/String#startsWith (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(local $3 i32)
|
||||
@ -214,156 +164,113 @@
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.ne
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 16)
|
||||
(i32.const 244)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 48)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $4
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(select
|
||||
(tee_local $5
|
||||
(select
|
||||
(tee_local $5
|
||||
(get_local $3)
|
||||
)
|
||||
(tee_local $6
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $5)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(tee_local $6
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.lt_s
|
||||
(get_local $5)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $8
|
||||
(i32.load
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.gt_s
|
||||
(i32.add
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $4)
|
||||
)
|
||||
(return
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(i32.eqz
|
||||
(call $~lib/internal/string/compareUnsafe
|
||||
(get_local $0)
|
||||
(get_local $7)
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 16
|
||||
i32.const 244
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $1
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if
|
||||
i32.const 48
|
||||
set_local $1
|
||||
end
|
||||
get_local $2
|
||||
set_local $3
|
||||
get_local $0
|
||||
i32.load
|
||||
set_local $4
|
||||
get_local $3
|
||||
tee_local $5
|
||||
i32.const 0
|
||||
tee_local $6
|
||||
get_local $5
|
||||
get_local $6
|
||||
i32.gt_s
|
||||
select
|
||||
tee_local $5
|
||||
get_local $4
|
||||
tee_local $6
|
||||
get_local $5
|
||||
get_local $6
|
||||
i32.lt_s
|
||||
select
|
||||
set_local $7
|
||||
get_local $1
|
||||
i32.load
|
||||
set_local $8
|
||||
get_local $8
|
||||
get_local $7
|
||||
i32.add
|
||||
get_local $4
|
||||
i32.gt_s
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
get_local $0
|
||||
get_local $7
|
||||
get_local $1
|
||||
i32.const 0
|
||||
get_local $8
|
||||
call $~lib/internal/string/compareUnsafe
|
||||
i32.eqz
|
||||
)
|
||||
(func $std/array-access/stringArrayMethodCall (; 8 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(call $~lib/string/String#startsWith
|
||||
(call $~lib/array/Array<String>#__get
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 8)
|
||||
(i32.const 0)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
call $~lib/array/Array<String>#__get
|
||||
i32.const 8
|
||||
i32.const 0
|
||||
call $~lib/string/String#startsWith
|
||||
)
|
||||
(func $~lib/array/Array<Array<String>>#__get (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(set_local $2
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(if (result i32)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<Array<String>,Array<String>>|inlined.0 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
get_local $0
|
||||
i32.load
|
||||
set_local $2
|
||||
get_local $1
|
||||
get_local $2
|
||||
i32.load
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
get_local $2
|
||||
get_local $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
else
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $std/array-access/stringArrayArrayPropertyAccess (; 10 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(i32.load
|
||||
(call $~lib/array/Array<String>#__get
|
||||
(call $~lib/array/Array<Array<String>>#__get
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
call $~lib/array/Array<Array<String>>#__get
|
||||
i32.const 1
|
||||
call $~lib/array/Array<String>#__get
|
||||
i32.load
|
||||
)
|
||||
(func $std/array-access/stringArrayArrayMethodCall (; 11 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(call $~lib/string/String#startsWith
|
||||
(call $~lib/array/Array<String>#__get
|
||||
(call $~lib/array/Array<Array<String>>#__get
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 8)
|
||||
(i32.const 0)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
call $~lib/array/Array<Array<String>>#__get
|
||||
i32.const 1
|
||||
call $~lib/array/Array<String>#__get
|
||||
i32.const 8
|
||||
i32.const 0
|
||||
call $~lib/string/String#startsWith
|
||||
)
|
||||
(func $null (; 12 ;) (type $v)
|
||||
)
|
||||
|
Reference in New Issue
Block a user