use gc interface directly, document

This commit is contained in:
dcode
2019-03-26 23:35:08 +01:00
parent 7c0dc66849
commit 3146f8f9e0
95 changed files with 17360 additions and 13504 deletions

View File

@ -1,7 +1,6 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
@ -9,7 +8,6 @@
(data (i32.const 8) "\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/runtime/GC_IMPLEMENTED i32 (i32.const 0))
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 8))
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
@ -127,7 +125,7 @@
end
return
)
(func $~lib/runtime/doAllocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
@ -143,7 +141,8 @@
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $~lib/runtime/assertUnregistered (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $~lib/runtime/register (; 4 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.gt_u
@ -151,14 +150,16 @@
if
i32.const 0
i32.const 16
i32.const 313
i32.const 2
i32.const 161
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.sub
local.set $2
local.get $2
i32.load
global.get $~lib/runtime/HEADER_MAGIC
i32.eq
@ -166,23 +167,17 @@
if
i32.const 0
i32.const 16
i32.const 314
i32.const 2
i32.const 163
i32.const 4
call $~lib/env/abort
unreachable
end
)
(func $~lib/runtime/doRegister (; 5 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
call $~lib/runtime/assertUnregistered
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.sub
local.get $2
local.get $1
i32.store
local.get $0
)
(func $constructor/EmptyCtor#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/EmptyCtor#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -192,18 +187,18 @@
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
local.get $0
)
(func $constructor/EmptyCtorWithFieldInit#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/EmptyCtorWithFieldInit#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -213,12 +208,12 @@
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 3
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
@ -227,7 +222,7 @@
i32.store
local.get $0
)
(func $constructor/EmptyCtorWithFieldNoInit#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/EmptyCtorWithFieldNoInit#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -237,12 +232,12 @@
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 4
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
@ -251,7 +246,7 @@
i32.store
local.get $0
)
(func $constructor/None#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/None#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -261,18 +256,18 @@
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 5
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
local.get $0
)
(func $constructor/JustFieldInit#constructor (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/JustFieldInit#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -282,12 +277,12 @@
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 6
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
@ -296,7 +291,7 @@
i32.store
local.get $0
)
(func $constructor/JustFieldNoInit#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/JustFieldNoInit#constructor (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -306,12 +301,12 @@
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 7
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
@ -320,11 +315,11 @@
i32.store
local.get $0
)
(func $constructor/CtorReturns#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorReturns#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 0
call $~lib/memory/memory.allocate
)
(func $constructor/CtorConditionallyReturns#constructor (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorConditionallyReturns#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $constructor/b
if
@ -340,18 +335,18 @@
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
local.get $0
)
(func $constructor/CtorAllocates#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorAllocates#constructor (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
@ -362,12 +357,12 @@
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 9
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
@ -376,7 +371,7 @@
drop
local.get $0
)
(func $constructor/CtorConditionallyAllocates#constructor (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorConditionallyAllocates#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $constructor/b
if
@ -389,12 +384,12 @@
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
@ -410,18 +405,18 @@
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/doAllocate
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/doRegister
call $~lib/runtime/register
end
local.set $0
end
local.get $0
)
(func $start:constructor (; 16 ;) (type $FUNCSIG$v)
(func $start:constructor (; 15 ;) (type $FUNCSIG$v)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
@ -463,9 +458,9 @@
call $constructor/CtorConditionallyAllocates#constructor
global.set $constructor/ctorConditionallyAllocates
)
(func $start (; 17 ;) (type $FUNCSIG$v)
(func $start (; 16 ;) (type $FUNCSIG$v)
call $start:constructor
)
(func $null (; 18 ;) (type $FUNCSIG$v)
(func $null (; 17 ;) (type $FUNCSIG$v)
)
)