mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-16 16:31:32 +00:00
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:
@ -17,21 +17,25 @@
|
||||
(global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824))
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $std/static-array/i i32 (i32.const 8))
|
||||
(global $std/static-array/I i32 (i32.const 32))
|
||||
(global $std/static-array/f i32 (i32.const 72))
|
||||
(global $std/static-array/F i32 (i32.const 96))
|
||||
(global $std/static-array/i i32 (i32.const 24))
|
||||
(global $std/static-array/I i32 (i32.const 64))
|
||||
(global $std/static-array/f i32 (i32.const 88))
|
||||
(global $std/static-array/F i32 (i32.const 128))
|
||||
(global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8))
|
||||
(global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816))
|
||||
(global $HEAP_BASE i32 (i32.const 272))
|
||||
(global $HEAP_BASE i32 (i32.const 276))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\10\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 32) "(\00\00\00\02\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\04\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 72) "P\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00\00\00\c0?\00\00 @")
|
||||
(data (i32.const 96) "h\00\00\00\02\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\00\00\f4?\00\00\00\00\00\00\02@\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 8) "\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 24) "\08\00\00\00\02\00\00\00")
|
||||
(data (i32.const 32) "\10\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\04\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 64) " \00\00\00\02\00\00\00")
|
||||
(data (i32.const 72) "\08\00\00\00\00\00\00\00\00\00\c0?\00\00 @")
|
||||
(data (i32.const 88) "H\00\00\00\02\00\00\00")
|
||||
(data (i32.const 96) "\10\00\00\00\00\00\00\00\00\00\00\00\00\00\f4?\00\00\00\00\00\00\02@\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 128) "`\00\00\00\02\00\00\00")
|
||||
(data (i32.const 136) "\13\00\00\00s\00t\00d\00/\00s\00t\00a\00t\00i\00c\00-\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
(data (i32.const 180) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
(data (i32.const 212) "\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 184) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
(data (i32.const 216) "\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/array/Array<i32>#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -447,105 +451,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/internal/arraybuffer/allocateUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
@ -560,7 +567,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 212)
|
||||
(i32.const 216)
|
||||
(i32.const 23)
|
||||
(i32.const 2)
|
||||
)
|
||||
@ -2734,7 +2741,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 212)
|
||||
(i32.const 216)
|
||||
(i32.const 37)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -2854,7 +2861,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 212)
|
||||
(i32.const 216)
|
||||
(i32.const 61)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -2900,7 +2907,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 184)
|
||||
(i32.const 86)
|
||||
(i32.const 41)
|
||||
)
|
||||
@ -3011,7 +3018,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 184)
|
||||
(i32.const 86)
|
||||
(i32.const 41)
|
||||
)
|
||||
@ -3122,7 +3129,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 184)
|
||||
(i32.const 86)
|
||||
(i32.const 41)
|
||||
)
|
||||
@ -3233,7 +3240,7 @@
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 180)
|
||||
(i32.const 184)
|
||||
(i32.const 86)
|
||||
(i32.const 41)
|
||||
)
|
||||
|
Reference in New Issue
Block a user