mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-17 08:51:34 +00:00
rtti & refactoring
This commit is contained in:
@ -6,13 +6,16 @@
|
||||
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $FUNCSIG$iiiii (func (param i32 i32 i32 i32) (result i32)))
|
||||
(type $FUNCSIG$v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 56) "\01\00\00\00(\00\00\00~\00l\00i\00b\00/\00u\00t\00i\00l\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
|
||||
(data (i32.const 104) "\01\00\00\00$\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 152) "\02\00\00\00\08\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 168) "\01\00\00\00 \00\00\00~\00l\00i\00b\00/\00d\00a\00t\00a\00v\00i\00e\00w\00.\00t\00s\00")
|
||||
(data (i32.const 8) "\10\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 56) "\10\00\00\00(\00\00\00~\00l\00i\00b\00/\00u\00t\00i\00l\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
|
||||
(data (i32.const 104) "\10\00\00\00$\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 152) "\0f\00\00\00\08\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 168) "\10\00\00\00 \00\00\00~\00l\00i\00b\00/\00d\00a\00t\00a\00v\00i\00e\00w\00.\00t\00s\00")
|
||||
(data (i32.const 208) "\10\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
|
||||
(data (i32.const 248) "\1d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00!\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/util/runtime/HEADER_SIZE i32 (i32.const 8))
|
||||
@ -25,9 +28,18 @@
|
||||
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
|
||||
(global $std/arraybuffer/arr8 (mut i32) (i32.const 0))
|
||||
(global $~lib/argc (mut i32) (i32.const 0))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 208))
|
||||
(global $~lib/runtime/RTTI_BASE i32 (i32.const 248))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 488))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "$.instanceof" (func $~lib/runtime/runtime.instanceof))
|
||||
(export "$.flags" (func $~lib/runtime/runtime.flags))
|
||||
(export "$.newObject" (func $~lib/runtime/runtime.newObject))
|
||||
(export "$.newString" (func $~lib/runtime/runtime.newString))
|
||||
(export "$.newArrayBuffer" (func $~lib/runtime/runtime.newArrayBuffer))
|
||||
(export "$.newArray" (func $~lib/runtime/runtime.newArray))
|
||||
(export "$.retain" (func $~lib/runtime/runtime.retain))
|
||||
(export "$.release" (func $~lib/runtime/runtime.release))
|
||||
(export "$.collect" (func $~lib/runtime/runtime.collect))
|
||||
(start $start)
|
||||
(func $~lib/util/runtime/adjust (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
i32.const 1
|
||||
@ -407,9 +419,9 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 64
|
||||
i32.const 128
|
||||
i32.const 131
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
@ -424,9 +436,9 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 64
|
||||
i32.const 130
|
||||
i32.const 133
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
@ -444,7 +456,7 @@
|
||||
i32.const 16
|
||||
i32.const 54
|
||||
i32.const 43
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $1
|
||||
@ -455,7 +467,7 @@
|
||||
local.get $1
|
||||
call $~lib/memory/memory.fill
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.const 15
|
||||
call $~lib/util/runtime/register
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer#get:byteLength (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
@ -753,7 +765,7 @@
|
||||
local.get $6
|
||||
call $~lib/memory/memory.copy
|
||||
local.get $7
|
||||
i32.const 2
|
||||
i32.const 15
|
||||
call $~lib/util/runtime/register
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer.isView<~lib/array/Array<i32>> (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
@ -1338,7 +1350,7 @@
|
||||
i32.const 16
|
||||
i32.const 12
|
||||
i32.const 57
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1354,7 +1366,7 @@
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/util/runtime/allocate
|
||||
i32.const 3
|
||||
i32.const 14
|
||||
call $~lib/util/runtime/register
|
||||
local.set $0
|
||||
end
|
||||
@ -1386,7 +1398,7 @@
|
||||
else
|
||||
i32.const 12
|
||||
call $~lib/util/runtime/allocate
|
||||
i32.const 4
|
||||
i32.const 19
|
||||
call $~lib/util/runtime/register
|
||||
end
|
||||
local.get $1
|
||||
@ -1395,7 +1407,7 @@
|
||||
local.set $0
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/runtime/runtime.newArray (; 18 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
|
||||
(func $~lib/util/runtime/makeArray (; 18 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
@ -1410,7 +1422,7 @@
|
||||
local.set $5
|
||||
local.get $5
|
||||
call $~lib/util/runtime/allocate
|
||||
i32.const 2
|
||||
i32.const 15
|
||||
call $~lib/util/runtime/register
|
||||
local.set $6
|
||||
local.get $4
|
||||
@ -1441,7 +1453,7 @@
|
||||
else
|
||||
i32.const 12
|
||||
call $~lib/util/runtime/allocate
|
||||
i32.const 6
|
||||
i32.const 23
|
||||
call $~lib/util/runtime/register
|
||||
end
|
||||
local.get $1
|
||||
@ -1467,7 +1479,7 @@
|
||||
i32.const 176
|
||||
i32.const 21
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
block (result i32)
|
||||
@ -1476,7 +1488,7 @@
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/util/runtime/allocate
|
||||
i32.const 7
|
||||
i32.const 29
|
||||
call $~lib/util/runtime/register
|
||||
local.set $0
|
||||
end
|
||||
@ -1559,7 +1571,7 @@
|
||||
i32.const 112
|
||||
i32.const 3
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1577,7 +1589,7 @@
|
||||
i32.const 112
|
||||
i32.const 7
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/sliced
|
||||
@ -1589,7 +1601,7 @@
|
||||
i32.const 112
|
||||
i32.const 8
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1607,7 +1619,7 @@
|
||||
i32.const 112
|
||||
i32.const 12
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1625,7 +1637,7 @@
|
||||
i32.const 112
|
||||
i32.const 16
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1643,7 +1655,7 @@
|
||||
i32.const 112
|
||||
i32.const 20
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1661,7 +1673,7 @@
|
||||
i32.const 112
|
||||
i32.const 24
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1679,7 +1691,7 @@
|
||||
i32.const 112
|
||||
i32.const 28
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1697,7 +1709,7 @@
|
||||
i32.const 112
|
||||
i32.const 32
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/buffer
|
||||
@ -1715,7 +1727,7 @@
|
||||
i32.const 112
|
||||
i32.const 36
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/sliced
|
||||
@ -1727,7 +1739,7 @@
|
||||
i32.const 112
|
||||
i32.const 37
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1739,7 +1751,7 @@
|
||||
i32.const 112
|
||||
i32.const 39
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1751,7 +1763,7 @@
|
||||
i32.const 112
|
||||
i32.const 40
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1763,7 +1775,7 @@
|
||||
i32.const 112
|
||||
i32.const 41
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1775,7 +1787,7 @@
|
||||
i32.const 112
|
||||
i32.const 42
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1787,7 +1799,7 @@
|
||||
i32.const 112
|
||||
i32.const 43
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1796,9 +1808,9 @@
|
||||
global.set $std/arraybuffer/arr8
|
||||
i32.const 2
|
||||
i32.const 2
|
||||
i32.const 5
|
||||
i32.const 17
|
||||
i32.const 160
|
||||
call $~lib/runtime/runtime.newArray
|
||||
call $~lib/util/runtime/makeArray
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<~lib/array/Array<i32>>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
@ -1807,7 +1819,7 @@
|
||||
i32.const 112
|
||||
i32.const 46
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
global.get $std/arraybuffer/arr8
|
||||
@ -1818,7 +1830,7 @@
|
||||
i32.const 112
|
||||
i32.const 47
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
@ -1831,7 +1843,7 @@
|
||||
i32.const 112
|
||||
i32.const 48
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
block (result i32)
|
||||
@ -1851,13 +1863,207 @@
|
||||
i32.const 112
|
||||
i32.const 49
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $start (; 24 ;) (type $FUNCSIG$v)
|
||||
(func $~lib/runtime/runtime.instanceof (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
local.get $0
|
||||
global.get $~lib/util/runtime/HEADER_SIZE
|
||||
i32.sub
|
||||
i32.load
|
||||
local.set $2
|
||||
global.get $~lib/runtime/RTTI_BASE
|
||||
local.set $3
|
||||
local.get $2
|
||||
if (result i32)
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.load
|
||||
i32.le_u
|
||||
else
|
||||
local.get $2
|
||||
end
|
||||
if
|
||||
loop $continue|0
|
||||
local.get $2
|
||||
local.get $1
|
||||
i32.eq
|
||||
if
|
||||
i32.const 1
|
||||
return
|
||||
end
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.mul
|
||||
i32.add
|
||||
i32.load offset=4
|
||||
local.tee $2
|
||||
br_if $continue|0
|
||||
end
|
||||
end
|
||||
i32.const 0
|
||||
)
|
||||
(func $~lib/runtime/runtime.flags (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
global.get $~lib/runtime/RTTI_BASE
|
||||
local.set $1
|
||||
local.get $0
|
||||
i32.eqz
|
||||
local.tee $2
|
||||
if (result i32)
|
||||
local.get $2
|
||||
else
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.load
|
||||
i32.gt_u
|
||||
end
|
||||
if (result i32)
|
||||
unreachable
|
||||
else
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.mul
|
||||
i32.add
|
||||
i32.load
|
||||
end
|
||||
)
|
||||
(func $~lib/runtime/runtime.newObject (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
local.get $0
|
||||
call $~lib/util/runtime/allocate
|
||||
local.get $1
|
||||
call $~lib/util/runtime/register
|
||||
)
|
||||
(func $~lib/runtime/runtime.newString (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
i32.const 1
|
||||
i32.shl
|
||||
i32.const 16
|
||||
call $~lib/runtime/runtime.newObject
|
||||
)
|
||||
(func $~lib/runtime/runtime.newArrayBuffer (; 28 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
i32.const 15
|
||||
call $~lib/runtime/runtime.newObject
|
||||
)
|
||||
(func $~lib/runtime/runtime.newArray (; 29 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
local.get $0
|
||||
call $~lib/runtime/runtime.flags
|
||||
local.set $2
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.div_u
|
||||
i32.const 31
|
||||
i32.and
|
||||
local.set $3
|
||||
local.get $1
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
local.tee $4
|
||||
call $~lib/runtime/runtime.newArrayBuffer
|
||||
local.set $1
|
||||
else
|
||||
local.get $1
|
||||
call $~lib/arraybuffer/ArrayBuffer#get:byteLength
|
||||
local.set $4
|
||||
end
|
||||
local.get $0
|
||||
i32.const 16
|
||||
call $~lib/runtime/runtime.newObject
|
||||
local.set $5
|
||||
local.get $5
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $5
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
local.get $5
|
||||
local.get $4
|
||||
i32.store offset=8
|
||||
local.get $5
|
||||
local.get $4
|
||||
local.get $3
|
||||
i32.shr_u
|
||||
i32.store offset=12
|
||||
local.get $2
|
||||
i32.const 512
|
||||
i32.and
|
||||
if
|
||||
local.get $1
|
||||
local.set $6
|
||||
local.get $6
|
||||
local.get $4
|
||||
i32.add
|
||||
local.set $7
|
||||
block $break|0
|
||||
loop $continue|0
|
||||
local.get $6
|
||||
local.get $7
|
||||
i32.lt_u
|
||||
if
|
||||
block
|
||||
local.get $6
|
||||
i32.load
|
||||
local.set $8
|
||||
local.get $8
|
||||
if
|
||||
i32.const 0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 216
|
||||
i32.const 97
|
||||
i32.const 15
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
end
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.add
|
||||
local.set $6
|
||||
end
|
||||
br $continue|0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local.get $5
|
||||
)
|
||||
(func $~lib/runtime/runtime.retain (; 30 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
nop
|
||||
)
|
||||
(func $~lib/runtime/runtime.release (; 31 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
nop
|
||||
)
|
||||
(func $~lib/runtime/runtime.collect (; 32 ;) (type $FUNCSIG$v)
|
||||
i32.const 0
|
||||
i32.const 216
|
||||
i32.const 139
|
||||
i32.const 9
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
)
|
||||
(func $~lib/runtime/runtime#constructor (; 33 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
unreachable
|
||||
)
|
||||
(func $start (; 34 ;) (type $FUNCSIG$v)
|
||||
call $start:std/arraybuffer
|
||||
)
|
||||
(func $null (; 25 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 35 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user