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

@ -2,7 +2,6 @@
(type $FUNCSIG$i (func (result i32)))
(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)))
@ -10,7 +9,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/ASC_NO_ASSERT i32 (i32.const 0))
@ -33,7 +31,7 @@
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
unreachable
)
(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
@ -49,7 +47,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
@ -57,14 +56,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
@ -72,23 +73,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 $new-without-allocator/A#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $new-without-allocator/A#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
@ -98,24 +93,24 @@
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 $new-without-allocator/test (; 7 ;) (type $FUNCSIG$i) (result i32)
(func $new-without-allocator/test (; 6 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 0
call $new-without-allocator/A#constructor
local.set $0
i32.const 3
)
(func $null (; 8 ;) (type $FUNCSIG$v)
(func $null (; 7 ;) (type $FUNCSIG$v)
)
)