Rework static memory segment creation; Fix stdlib gc hooks not marking own fields; Align everything to 8 bytes that might be touched by GC

This commit is contained in:
dcodeIO
2018-08-04 00:36:59 +02:00
parent 61de7cf962
commit 631478c7c9
61 changed files with 11944 additions and 5286 deletions

View File

@ -38,12 +38,12 @@
(global $std/symbol/key4 (mut i32) (i32.const 0))
(global $~lib/symbol/Symbol.hasInstance i32 (i32.const 1))
(global $~lib/symbol/Symbol.concatSpreadable i32 (i32.const 2))
(global $HEAP_BASE i32 (i32.const 156))
(global $HEAP_BASE i32 (i32.const 164))
(memory $0 1)
(data (i32.const 8) "\03\00\00\001\002\003\00")
(data (i32.const 20) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00")
(data (i32.const 52) "\13\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 96) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
(data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00")
(data (i32.const 56) "\13\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 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
(export "memory" (memory $0))
(start $start)
(func $~lib/symbol/Symbol (; 1 ;) (type $ii) (param $0 i32) (result i32)
@ -79,105 +79,108 @@
(local $5 i32)
(local $6 i32)
(if
(get_local $0)
(block
(if
(i32.gt_u
(get_local $0)
(get_global $~lib/internal/allocator/MAX_SIZE_32)
)
(unreachable)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(i32.gt_u
(get_local $0)
(get_global $~lib/internal/allocator/MAX_SIZE_32)
)
(unreachable)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $4
(i32.and
(i32.add
(i32.add
(get_local $1)
(select
(tee_local $2
(get_local $0)
)
(get_global $~lib/internal/allocator/AL_MASK)
)
(i32.xor
(get_global $~lib/internal/allocator/AL_MASK)
(i32.const -1)
)
)
)
(set_local $3
(current_memory)
)
(if
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
)
(block
(set_local $4
(i32.shr_u
(i32.and
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
)
)
(i32.const 16)
(tee_local $3
(i32.const 1)
)
)
(set_local $5
(select
(tee_local $5
(get_local $3)
)
(tee_local $6
(get_local $4)
)
(i32.gt_s
(get_local $5)
(get_local $6)
)
)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
)
(i32.const 0)
)
(unreachable)
(i32.gt_u
(get_local $2)
(get_local $3)
)
)
)
(get_global $~lib/internal/allocator/AL_MASK)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.xor
(get_global $~lib/internal/allocator/AL_MASK)
(i32.const -1)
)
)
)
(i32.const 0)
(set_local $5
(current_memory)
)
(if
(i32.gt_u
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 16)
)
)
(block
(set_local $2
(i32.shr_u
(i32.and
(i32.add
(i32.sub
(get_local $4)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
)
)
(i32.const 16)
)
)
(set_local $3
(select
(tee_local $3
(get_local $5)
)
(tee_local $6
(get_local $2)
)
(i32.gt_s
(get_local $3)
(get_local $6)
)
)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $2)
)
(i32.const 0)
)
(unreachable)
)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $4)
)
(get_local $1)
)
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
(return
@ -216,7 +219,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 96)
(i32.const 104)
(i32.const 23)
(i32.const 2)
)
@ -607,7 +610,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 52)
(i32.const 56)
(i32.const 13)
(i32.const 40)
)
@ -2088,7 +2091,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 20)
(i32.const 24)
(i32.const 6)
(i32.const 0)
)
@ -2115,7 +2118,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 20)
(i32.const 24)
(i32.const 11)
(i32.const 0)
)
@ -2142,7 +2145,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 20)
(i32.const 24)
(i32.const 16)
(i32.const 0)
)
@ -2159,7 +2162,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 20)
(i32.const 24)
(i32.const 17)
(i32.const 0)
)
@ -2186,7 +2189,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 20)
(i32.const 24)
(i32.const 22)
(i32.const 0)
)
@ -2203,7 +2206,7 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 20)
(i32.const 24)
(i32.const 23)
(i32.const 0)
)