rtti & refactoring

This commit is contained in:
dcode
2019-04-06 20:17:48 +02:00
parent a9e4813798
commit e1070cee86
266 changed files with 23295 additions and 33925 deletions

View File

@ -8,33 +8,34 @@
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\01\00\00\00\06\00\00\001\002\003")
(data (i32.const 24) "\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s")
(data (i32.const 64) "\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")
(data (i32.const 112) "\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")
(data (i32.const 160) "\01")
(data (i32.const 168) "\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e")
(data (i32.const 200) "\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e")
(data (i32.const 248) "\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p")
(data (i32.const 272) "\01\00\00\00\n\00\00\00m\00a\00t\00c\00h")
(data (i32.const 296) "\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e")
(data (i32.const 320) "\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h")
(data (i32.const 344) "\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s")
(data (i32.const 368) "\01\00\00\00\n\00\00\00s\00p\00l\00i\00t")
(data (i32.const 392) "\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e")
(data (i32.const 424) "\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g")
(data (i32.const 456) "\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s")
(data (i32.const 488) "\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(")
(data (i32.const 512) "\01\00\00\00\08\00\00\00n\00u\00l\00l")
(data (i32.const 528) "\01\00\00\00\02\00\00\00)")
(data (i32.const 544) "\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)")
(data (i32.const 568) "\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)")
(data (i32.const 600) "\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)")
(data (i32.const 648) "\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(data (i32.const 8) "\10\00\00\00\06\00\00\001\002\003")
(data (i32.const 24) "\10\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s")
(data (i32.const 64) "\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")
(data (i32.const 112) "\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")
(data (i32.const 160) "\10")
(data (i32.const 168) "\10\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e")
(data (i32.const 200) "\10\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e")
(data (i32.const 248) "\10\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p")
(data (i32.const 272) "\10\00\00\00\n\00\00\00m\00a\00t\00c\00h")
(data (i32.const 296) "\10\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e")
(data (i32.const 320) "\10\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h")
(data (i32.const 344) "\10\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s")
(data (i32.const 368) "\10\00\00\00\n\00\00\00s\00p\00l\00i\00t")
(data (i32.const 392) "\10\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e")
(data (i32.const 424) "\10\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g")
(data (i32.const 456) "\10\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s")
(data (i32.const 488) "\10\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(")
(data (i32.const 512) "\10\00\00\00\08\00\00\00n\00u\00l\00l")
(data (i32.const 528) "\10\00\00\00\02\00\00\00)")
(data (i32.const 544) "\10\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)")
(data (i32.const 568) "\10\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)")
(data (i32.const 600) "\10\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)")
(data (i32.const 648) "\10\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)")
(data (i32.const 712) "\10\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 752) "\13")
(data (i32.const 888) "$\10\00\00\00\00\00\00$\10\00\00\00\00\00\00!\00\00\00\0e")
(global $~lib/symbol/nextId (mut i32) (i32.const 12))
(global $std/symbol/sym1 (mut i32) (i32.const 0))
(global $std/symbol/sym2 (mut i32) (i32.const 0))
@ -51,7 +52,15 @@
(global $std/symbol/hasInstance (mut i32) (i32.const 0))
(global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0))
(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.retain))
(export "$.collect" (func $~lib/runtime/runtime.collect))
(start $start)
(func $~lib/allocator/arena/__mem_allocate (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
@ -139,14 +148,14 @@
(func $~lib/util/runtime/register (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
i32.const 708
i32.const 912
i32.le_u
if
i32.const 0
i32.const 72
i32.const 128
i32.const 131
i32.const 4
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
local.get $0
@ -159,9 +168,9 @@
if
i32.const 0
i32.const 72
i32.const 130
i32.const 133
i32.const 4
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
local.get $2
@ -390,7 +399,7 @@
i32.const 120
i32.const 54
i32.const 43
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
local.get $0
@ -399,7 +408,7 @@
local.get $0
call $~lib/memory/memory.fill
local.get $1
i32.const 3
i32.const 15
call $~lib/util/runtime/register
)
(func $~lib/map/Map<~lib/string/String,usize>#clear (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
@ -428,7 +437,7 @@
(local $0 i32)
i32.const 24
call $~lib/util/runtime/allocate
i32.const 2
i32.const 17
call $~lib/util/runtime/register
local.tee $0
i32.const 0
@ -456,7 +465,7 @@
(local $0 i32)
i32.const 24
call $~lib/util/runtime/allocate
i32.const 4
i32.const 18
call $~lib/util/runtime/register
local.tee $0
i32.const 0
@ -1408,7 +1417,7 @@
local.get $4
call $~lib/memory/memory.copy
local.get $2
i32.const 1
i32.const 16
call $~lib/util/runtime/register
)
(func $~lib/string/String.__concat (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -1544,10 +1553,10 @@
i32.const 32
i32.const 4
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
i32.const 712
i32.const 912
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
@ -1563,7 +1572,7 @@
i32.const 32
i32.const 9
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $std/symbol/sym1
@ -1578,7 +1587,7 @@
i32.const 32
i32.const 14
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $std/symbol/key2
@ -1587,7 +1596,7 @@
i32.const 32
i32.const 15
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $std/symbol/sym3
@ -1617,7 +1626,7 @@
i32.const 32
i32.const 20
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $std/symbol/key3
@ -1629,7 +1638,7 @@
i32.const 32
i32.const 21
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $~lib/symbol/nextId
@ -1652,7 +1661,7 @@
i32.const 32
i32.const 23
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $std/symbol/sym3
@ -1665,7 +1674,7 @@
i32.const 32
i32.const 24
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
i32.const 1
@ -1682,7 +1691,7 @@
i32.const 32
i32.const 28
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
global.get $std/symbol/isConcatSpreadable
@ -1695,14 +1704,197 @@
i32.const 32
i32.const 29
i32.const 0
call $~lib/env/abort
call $~lib/builtins/abort
unreachable
end
)
(func $start (; 28 ;) (type $FUNCSIG$v)
(func $~lib/runtime/runtime.instanceof (; 28 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.const 8
i32.sub
i32.load
local.tee $0
if (result i32)
local.get $0
i32.const 752
i32.load
i32.le_u
else
local.get $0
end
if
loop $continue|0
local.get $0
local.get $1
i32.eq
if
i32.const 1
return
end
local.get $0
i32.const 3
i32.shl
i32.const 752
i32.add
i32.load offset=4
local.tee $0
br_if $continue|0
end
end
i32.const 0
)
(func $~lib/runtime/runtime.flags (; 29 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
local.tee $1
i32.eqz
if
local.get $0
i32.const 752
i32.load
i32.gt_u
local.set $1
end
local.get $1
if (result i32)
unreachable
else
local.get $0
i32.const 3
i32.shl
i32.const 752
i32.add
i32.load
end
)
(func $~lib/runtime/runtime.newObject (; 30 ;) (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 (; 31 ;) (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 (; 32 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.const 15
call $~lib/runtime/runtime.newObject
)
(func $~lib/runtime/runtime.newArray (; 33 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
local.get $0
i32.eqz
local.tee $2
if (result i32)
local.get $2
else
local.get $0
i32.const 752
i32.load
i32.gt_u
end
if (result i32)
unreachable
else
local.get $0
i32.const 3
i32.shl
i32.const 752
i32.add
i32.load
end
local.tee $3
i32.const 8
i32.div_u
i32.const 31
i32.and
local.set $4
local.get $1
if (result i32)
local.get $1
i32.const 8
i32.sub
i32.load offset=4
else
i32.const 0
call $~lib/runtime/runtime.newArrayBuffer
local.set $1
i32.const 0
end
local.set $2
local.get $0
i32.const 16
call $~lib/runtime/runtime.newObject
local.tee $0
local.get $1
i32.store
local.get $0
local.get $1
i32.store offset=4
local.get $0
local.get $2
i32.store offset=8
local.get $0
local.get $2
local.get $4
i32.shr_u
i32.store offset=12
local.get $3
i32.const 512
i32.and
if
local.get $1
local.get $2
i32.add
local.set $2
loop $continue|0
local.get $1
local.get $2
i32.lt_u
if
local.get $1
i32.load
if
i32.const 0
i32.const 720
i32.const 97
i32.const 15
call $~lib/builtins/abort
unreachable
end
local.get $1
i32.const 4
i32.add
local.set $1
br $continue|0
end
end
end
local.get $0
)
(func $~lib/runtime/runtime.retain (; 34 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/runtime/runtime.collect (; 35 ;) (type $FUNCSIG$v)
i32.const 0
i32.const 720
i32.const 139
i32.const 9
call $~lib/builtins/abort
unreachable
)
(func $start (; 36 ;) (type $FUNCSIG$v)
call $start:std/symbol
)
(func $null (; 29 ;) (type $FUNCSIG$v)
(func $null (; 37 ;) (type $FUNCSIG$v)
nop
)
)