New ArrayBuffer/TypedArray; Stdlib restructure; Fix importing stdlib in stdlib; Traverse constructors; Allow initialization of readonly instance fields in constructors

This commit is contained in:
dcodeIO
2018-04-07 03:27:22 +02:00
parent 6268b92eba
commit 8770f7b548
44 changed files with 5200 additions and 2165 deletions

View File

@ -7,10 +7,10 @@
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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/allocator_arena/size i32 (i32.const 42))

View File

@ -125,7 +125,7 @@
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 235)
(i32.const 232)
(i32.const 4)
)
(unreachable)

View File

@ -5,7 +5,7 @@
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/string/HEADER_SIZE i32 (i32.const 4))
(global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4))
(global $argumentCount (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 52))
(memory $0 1)
@ -195,7 +195,7 @@
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 235)
(i32.const 232)
(i32.const 4)
)
(unreachable)

View File

@ -2080,24 +2080,33 @@
)
(func $~lib/array/Array<i32>#__grow (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(if
(i32.le_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $4
(i32.load offset=4
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 60)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $3
(call $~lib/allocator/arena/allocate_memory
(i32.shl
(get_local $1)
@ -2106,32 +2115,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $3)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $4)
(i32.const 2)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
@ -2140,28 +2141,29 @@
)
(func $~lib/array/Array<i32>#push (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(if
(i32.eq
(i32.load offset=8
(get_local $0)
(tee_local $2
(i32.load offset=8
(get_local $0)
)
)
(i32.load offset=4
(get_local $0)
(tee_local $3
(i32.load offset=4
(get_local $0)
)
)
)
(call $~lib/array/Array<i32>#__grow
(get_local $0)
(if (result i32)
(i32.load offset=4
(get_local $0)
)
(select
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
(i32.const 1)
(get_local $3)
)
)
)
@ -2171,9 +2173,7 @@
(get_local $0)
)
(i32.shl
(i32.load offset=8
(get_local $0)
)
(get_local $2)
(i32.const 2)
)
)
@ -2183,9 +2183,7 @@
(get_local $0)
(tee_local $2
(i32.add
(i32.load offset=8
(get_local $0)
)
(get_local $2)
(i32.const 1)
)
)
@ -2216,50 +2214,64 @@
)
(func $~lib/array/Array<i32>#pop (; 12 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(if
(i32.lt_s
(i32.load offset=8
(get_local $0)
(tee_local $1
(i32.load offset=8
(get_local $0)
)
)
(i32.const 1)
)
(unreachable)
)
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(block (result i32)
(i32.store offset=8
(set_local $2
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(i32.shl
(tee_local $1
(i32.sub
(i32.load offset=8
(get_local $0)
)
(get_local $1)
(i32.const 1)
)
)
)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
)
(i32.store offset=8
(get_local $0)
(get_local $1)
)
(get_local $2)
)
(func $~lib/array/Array<i32>#unshift (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $4
(i32.load offset=8
(get_local $0)
)
)
(if
(i32.eq
(i32.load offset=8
(get_local $0)
)
(tee_local $2
(tee_local $3
(i32.load offset=4
(get_local $0)
)
@ -2268,106 +2280,93 @@
(block
(if
(i32.le_s
(tee_local $4
(tee_local $6
(select
(i32.shl
(get_local $2)
(get_local $3)
(i32.const 1)
)
(i32.const 1)
(get_local $2)
(get_local $3)
)
)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 60)
(i32.const 207)
(i32.const 204)
(i32.const 6)
)
(unreachable)
)
)
(set_local $3
(set_local $5
(call $~lib/allocator/arena/allocate_memory
(i32.shl
(get_local $4)
(get_local $6)
(i32.const 2)
)
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(i32.add
(get_local $3)
(get_local $5)
(i32.const 4)
)
(i32.load
(get_local $0)
)
(get_local $2)
(i32.shl
(get_local $2)
(get_local $3)
(i32.const 2)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $3)
(get_local $5)
)
(i32.store offset=4
(get_local $0)
(get_local $4)
(get_local $6)
)
(set_local $2
(get_local $5)
)
)
(call $~lib/memory/move_memory
(i32.add
(i32.load
(get_local $0)
)
(get_local $2)
(i32.const 4)
)
(i32.load
(get_local $0)
)
(get_local $2)
(i32.shl
(get_local $2)
(get_local $3)
(i32.const 2)
)
)
)
(i32.store
(i32.load
(get_local $0)
)
(get_local $2)
(get_local $1)
)
(i32.store offset=8
(get_local $0)
(tee_local $3
(tee_local $4
(i32.add
(i32.load offset=8
(get_local $0)
)
(get_local $4)
(i32.const 1)
)
)
)
(get_local $3)
(get_local $4)
)
(func $~lib/memory/set_memory (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i64)
@ -2704,36 +2703,41 @@
)
(func $~lib/array/Array<i32>#shift (; 15 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(if
(i32.lt_s
(i32.load offset=8
(get_local $0)
(tee_local $2
(i32.load offset=8
(get_local $0)
)
)
(i32.const 1)
)
(unreachable)
)
(set_local $1
(set_local $3
(i32.load
(i32.load
(get_local $0)
(tee_local $1
(i32.load
(get_local $0)
)
)
)
)
(call $~lib/memory/move_memory
(i32.load
(get_local $0)
)
(get_local $1)
(i32.add
(i32.load
(get_local $0)
)
(get_local $1)
(i32.const 4)
)
(i32.shl
(i32.sub
(i32.load offset=4
(get_local $0)
(tee_local $4
(i32.load offset=4
(get_local $0)
)
)
(i32.const 1)
)
@ -2742,14 +2746,10 @@
)
(call $~lib/memory/set_memory
(i32.add
(i32.load
(get_local $0)
)
(get_local $1)
(i32.shl
(i32.sub
(i32.load offset=4
(get_local $0)
)
(get_local $4)
(i32.const 1)
)
(i32.const 2)
@ -2761,18 +2761,22 @@
(i32.store offset=8
(get_local $0)
(i32.sub
(i32.load offset=8
(get_local $0)
)
(get_local $2)
(i32.const 1)
)
)
(get_local $1)
(get_local $3)
)
(func $~lib/array/Array<i32>#reverse (; 16 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $3
(i32.load
(get_local $0)
)
)
(set_local $2
(i32.sub
(i32.load offset=8
@ -2788,12 +2792,10 @@
(get_local $2)
)
(block
(set_local $3
(set_local $4
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(get_local $3)
(i32.shl
(get_local $1)
(i32.const 2)
@ -2803,9 +2805,7 @@
)
(i32.store
(i32.add
(i32.load
(get_local $0)
)
(get_local $3)
(i32.shl
(get_local $1)
(i32.const 2)
@ -2813,9 +2813,7 @@
)
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(get_local $3)
(i32.shl
(get_local $2)
(i32.const 2)
@ -2825,15 +2823,13 @@
)
(i32.store
(i32.add
(i32.load
(get_local $0)
)
(get_local $3)
(i32.shl
(get_local $2)
(i32.const 2)
)
)
(get_local $3)
(get_local $4)
)
(set_local $1
(i32.add
@ -2855,22 +2851,23 @@
)
(func $~lib/array/Array<i32>#indexOf (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(if
(i32.and
(if (result i32)
(tee_local $3
(tee_local $4
(i32.eqz
(i32.load offset=8
(get_local $0)
(tee_local $3
(i32.load offset=8
(get_local $0)
)
)
)
)
(get_local $3)
(get_local $4)
(i32.ge_s
(get_local $2)
(i32.load offset=8
(get_local $0)
)
(get_local $3)
)
)
(i32.const 1)
@ -2888,9 +2885,7 @@
(i32.lt_s
(tee_local $2
(i32.add
(i32.load offset=8
(get_local $0)
)
(get_local $3)
(get_local $2)
)
)
@ -2901,22 +2896,23 @@
)
)
)
(set_local $0
(i32.load
(get_local $0)
)
)
(loop $continue|0
(if
(i32.lt_u
(i32.lt_s
(get_local $2)
(i32.load offset=8
(get_local $0)
)
(get_local $3)
)
(block
(if
(i32.eq
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(get_local $0)
(i32.shl
(get_local $2)
(i32.const 2)
@ -2966,22 +2962,23 @@
)
(func $~lib/array/Array<i32>#includes (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(if
(i32.and
(if (result i32)
(tee_local $3
(tee_local $4
(i32.eqz
(i32.load offset=8
(get_local $0)
(tee_local $3
(i32.load offset=8
(get_local $0)
)
)
)
)
(get_local $3)
(get_local $4)
(i32.ge_s
(get_local $2)
(i32.load offset=8
(get_local $0)
)
(get_local $3)
)
)
(i32.const 1)
@ -2999,9 +2996,7 @@
(i32.lt_s
(tee_local $2
(i32.add
(i32.load offset=8
(get_local $0)
)
(get_local $3)
(get_local $2)
)
)
@ -3014,11 +3009,9 @@
)
(loop $continue|0
(if
(i32.lt_u
(i32.lt_s
(get_local $2)
(i32.load offset=8
(get_local $0)
)
(get_local $3)
)
(block
(if
@ -3076,6 +3069,8 @@
)
)
(func $~lib/array/Array<i32>#splice (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(if
(i32.lt_s
(get_local $2)
@ -3083,6 +3078,11 @@
)
(return)
)
(set_local $3
(i32.load offset=8
(get_local $0)
)
)
(if
(i32.lt_s
(get_local $1)
@ -3092,9 +3092,7 @@
(i32.lt_s
(tee_local $1
(i32.add
(i32.load offset=8
(get_local $0)
)
(get_local $3)
(get_local $1)
)
)
@ -3106,9 +3104,7 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=8
(get_local $0)
)
(get_local $3)
)
(return)
)
@ -3116,17 +3112,17 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=8
(get_local $0)
)
(get_local $3)
)
(return)
)
)
(call $~lib/memory/move_memory
(i32.add
(i32.load
(get_local $0)
(tee_local $4
(i32.load
(get_local $0)
)
)
(i32.shl
(get_local $1)
@ -3134,9 +3130,7 @@
)
)
(i32.add
(i32.load
(get_local $0)
)
(get_local $4)
(i32.shl
(i32.add
(get_local $1)
@ -3145,9 +3139,7 @@
(get_local $2)
(tee_local $1
(i32.sub
(i32.load offset=8
(get_local $0)
)
(get_local $3)
(get_local $1)
)
)
@ -3169,9 +3161,7 @@
(i32.store offset=8
(get_local $0)
(i32.sub
(i32.load offset=8
(get_local $0)
)
(get_local $3)
(get_local $2)
)
)
@ -3189,30 +3179,30 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $3
(i32.load offset=4
(get_local $0)
)
)
)
(call $~lib/array/Array<i32>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $3
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $3)
)
)
)
@ -3677,7 +3667,7 @@
(get_local $1)
)
)
(func $~lib/array/Array#constructor (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<i32>#constructor (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.lt_s
@ -3723,22 +3713,20 @@
(i32.const 0)
)
)
(i32.store offset=8
(get_local $0)
(tee_local $2
(get_local $1)
)
)
(i32.store offset=4
(get_local $0)
(get_local $2)
(get_local $1)
)
(i32.store offset=8
(get_local $0)
(get_local $1)
)
(get_local $0)
)
(func $std/array/createReverseOrderedArray (; 48 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(set_local $1
(call $~lib/array/Array#constructor
(call $~lib/array/Array<i32>#constructor
(i32.const 0)
(get_local $0)
)
@ -3844,7 +3832,7 @@
(func $std/array/createRandomOrderedArray (; 50 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(set_local $0
(call $~lib/array/Array#constructor
(call $~lib/array/Array<i32>#constructor
(i32.const 0)
(get_local $0)
)
@ -3899,7 +3887,7 @@
(func $std/array/createDefaultComparator<i32> (; 52 ;) (type $i) (result i32)
(i32.const 23)
)
(func $~lib/array/insertionSort<i32> (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/internal/array/insertionSort<i32> (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -4023,7 +4011,7 @@
)
(get_local $0)
)
(func $~lib/array/weakHeapSort<i32> (; 54 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/internal/array/weakHeapSort<i32> (; 54 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -4467,9 +4455,10 @@
)
(get_local $0)
)
(func $~lib/array/sort<i32> (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<i32>#sort (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(if
(i32.le_s
(tee_local $2
@ -4489,18 +4478,18 @@
(i32.const 2)
)
(block
(set_local $2
(set_local $3
(i32.load offset=4
(i32.load
(get_local $0)
(tee_local $2
(i32.load
(get_local $0)
)
)
)
)
(set_local $3
(set_local $4
(i32.load
(i32.load
(get_local $0)
)
(get_local $2)
)
)
(if
@ -4510,8 +4499,8 @@
)
(i32.lt_s
(call_indirect (type $iii)
(get_local $2)
(get_local $3)
(get_local $4)
(get_local $1)
)
(i32.const 0)
@ -4519,16 +4508,12 @@
)
(block
(i32.store offset=4
(i32.load
(get_local $0)
)
(get_local $3)
(get_local $2)
(get_local $4)
)
(i32.store
(i32.load
(get_local $0)
)
(get_local $2)
(get_local $3)
)
)
)
@ -4537,30 +4522,22 @@
)
)
)
(if
(if (result i32)
(i32.le_s
(get_local $2)
(i32.const 256)
)
(return
(call $~lib/array/insertionSort<i32>
(get_local $0)
(get_local $1)
)
(call $~lib/internal/array/insertionSort<i32>
(get_local $0)
(get_local $1)
)
(call $~lib/internal/array/weakHeapSort<i32>
(get_local $0)
(get_local $1)
)
)
(call $~lib/array/weakHeapSort<i32>
(get_local $0)
(get_local $1)
)
)
(func $~lib/array/Array<i32>#sort (; 56 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(call $~lib/array/sort<i32>
(get_local $0)
(get_local $1)
)
)
(func $std/array/isSorted<i32> (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $std/array/isSorted<i32> (; 56 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(set_local $2
@ -4617,7 +4594,7 @@
)
(i32.const 1)
)
(func $std/array/assertSorted<i32> (; 58 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $std/array/assertSorted<i32> (; 57 ;) (type $iiv) (param $0 i32) (param $1 i32)
(if
(i32.eqz
(call $std/array/isSorted<i32>
@ -4639,13 +4616,13 @@
)
)
)
(func $std/array/assertSortedDefault<i32> (; 59 ;) (type $iv) (param $0 i32)
(func $std/array/assertSortedDefault<i32> (; 58 ;) (type $iv) (param $0 i32)
(call $std/array/assertSorted<i32>
(get_local $0)
(call $std/array/createDefaultComparator<i32>)
)
)
(func $std/array/isArraysEqual<i32> (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $std/array/isArraysEqual<i32> (; 59 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(set_local $3
(get_local $2)
@ -4712,7 +4689,7 @@
)
(i32.const 1)
)
(func $std/array/isArraysEqual<i32>|trampoline (; 61 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $std/array/isArraysEqual<i32>|trampoline (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(block $1of1
(block $0of1
(block $oob
@ -4735,19 +4712,19 @@
(get_local $2)
)
)
(func $start~anonymous|24 (; 62 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $start~anonymous|24 (; 61 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(i32.sub
(get_local $0)
(get_local $1)
)
)
(func $start~anonymous|25 (; 63 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $start~anonymous|25 (; 62 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(i32.sub
(get_local $1)
(get_local $0)
)
)
(func $start (; 64 ;) (type $v)
(func $start (; 63 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.and
(i32.add

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
(type $iii (func (param i32 i32) (result i32)))
(type $ii (func (param i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
@ -11,12 +11,27 @@
(global $std/arraybuffer/buffer (mut i32) (i32.const 0))
(global $argumentCount (mut i32) (i32.const 0))
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 44))
(global $HEAP_BASE i32 (i32.const 104))
(memory $0 1)
(data (i32.const 4) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
(data (i32.const 4) "\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")
(data (i32.const 64) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
(export "memory" (memory $0))
(start $start)
(func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/internal/arraybuffer/computeSize (; 1 ;) (type $ii) (param $0 i32) (result i32)
(i32.shl
(i32.const 1)
(i32.sub
(i32.const 32)
(i32.clz
(i32.add
(get_local $0)
(i32.const 7)
)
)
)
)
)
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -105,29 +120,392 @@
)
(i32.const 0)
)
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/internal/arraybuffer/allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if
(i32.gt_u
(get_local $0)
(i32.const 1073741816)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 22)
(i32.const 2)
)
(unreachable)
)
)
(i32.store
(tee_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/internal/arraybuffer/computeSize
(get_local $0)
)
)
)
(get_local $0)
)
(get_local $1)
)
(func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i64)
(local $4 i32)
(if
(i32.eqz
(get_local $2)
)
(return)
)
(i32.store8
(get_local $0)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 1)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 2)
)
(return)
)
(i32.store8
(i32.add
(get_local $0)
(i32.const 1)
)
(get_local $1)
)
(i32.store8
(i32.add
(get_local $0)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 3)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 6)
)
(return)
)
(i32.store8
(i32.add
(get_local $0)
(i32.const 3)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 4)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 8)
)
(return)
)
(i32.store
(tee_local $0
(i32.add
(get_local $0)
(tee_local $4
(i32.and
(i32.sub
(i32.const 0)
(get_local $0)
)
(i32.const 3)
)
)
)
)
(tee_local $1
(i32.mul
(get_local $1)
(i32.const 16843009)
)
)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(tee_local $2
(i32.and
(i32.sub
(get_local $2)
(get_local $4)
)
(i32.const -4)
)
)
)
(i32.const 4)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 8)
)
(return)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 4)
)
(get_local $1)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 8)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 12)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 8)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 24)
)
(return)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 12)
)
(get_local $1)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 16)
)
(get_local $1)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 20)
)
(get_local $1)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 24)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 28)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 24)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 20)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 16)
)
(get_local $1)
)
(set_local $0
(i32.add
(get_local $0)
(tee_local $4
(i32.add
(i32.and
(get_local $0)
(i32.const 4)
)
(i32.const 24)
)
)
)
)
(set_local $2
(i32.sub
(get_local $2)
(get_local $4)
)
)
(set_local $3
(i64.or
(i64.extend_u/i32
(get_local $1)
)
(i64.shl
(i64.extend_u/i32
(get_local $1)
)
(i64.const 32)
)
)
)
(loop $continue|0
(if
(i32.ge_u
(get_local $2)
(i32.const 32)
)
(block
(i64.store
(get_local $0)
(get_local $3)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 8)
)
(get_local $3)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 16)
)
(get_local $3)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 24)
)
(get_local $3)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 32)
)
)
(set_local $0
(i32.add
(get_local $0)
(i32.const 32)
)
)
(br $continue|0)
)
)
)
)
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 2147483647)
(i32.const 1073741816)
)
(unreachable)
)
(i32.store
(tee_local $2
(call $~lib/allocator/arena/allocate_memory
(i32.add
(call $~lib/memory/set_memory
(i32.add
(tee_local $2
(call $~lib/internal/arraybuffer/allocate
(get_local $1)
(i32.const 4)
)
)
(i32.const 8)
)
(i32.const 0)
(get_local $1)
)
(get_local $2)
)
(func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/memory/copy_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(loop $continue|0
@ -1703,7 +2081,7 @@
)
)
)
(func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(if
(i32.eq
@ -1993,7 +2371,7 @@
)
)
)
(func $~lib/arraybuffer/ArrayBuffer#slice (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/arraybuffer/ArrayBuffer#slice (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -2035,10 +2413,10 @@
)
)
)
(i32.store
(tee_local $3
(call $~lib/allocator/arena/allocate_memory
(i32.add
(call $~lib/memory/move_memory
(i32.add
(tee_local $3
(call $~lib/internal/arraybuffer/allocate
(tee_local $2
(select
(tee_local $3
@ -2090,21 +2468,14 @@
)
)
)
(i32.const 4)
)
)
)
(get_local $2)
)
(call $~lib/memory/move_memory
(i32.add
(get_local $3)
(i32.const 4)
(i32.const 8)
)
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
(i32.const 8)
)
(get_local $1)
)
@ -2112,7 +2483,7 @@
)
(get_local $3)
)
(func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(block $2of2
(block $1of2
(block $0of2
@ -2128,7 +2499,7 @@
)
)
(set_local $2
(i32.const 2147483647)
(i32.const 1073741816)
)
)
(call $~lib/arraybuffer/ArrayBuffer#slice
@ -2137,7 +2508,7 @@
(get_local $2)
)
)
(func $start (; 7 ;) (type $v)
(func $start (; 10 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.and
(i32.add
@ -2166,7 +2537,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 5)
(i32.const 0)
)
@ -2195,7 +2566,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 9)
(i32.const 0)
)
@ -2210,7 +2581,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 10)
(i32.const 0)
)
@ -2239,7 +2610,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 14)
(i32.const 0)
)
@ -2268,7 +2639,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 18)
(i32.const 0)
)
@ -2292,7 +2663,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 22)
(i32.const 0)
)
@ -2316,7 +2687,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 26)
(i32.const 0)
)
@ -2340,7 +2711,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 30)
(i32.const 0)
)
@ -2364,7 +2735,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 34)
(i32.const 0)
)
@ -2390,7 +2761,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 38)
(i32.const 0)
)
@ -2404,7 +2775,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 39)
(i32.const 0)
)

View File

@ -7,7 +7,7 @@ assert(buffer.byteLength == 8);
var sliced = buffer.slice();
assert(sliced.byteLength == 8);
assert(sliced != buffer);
assert(sliced !== buffer);
sliced = buffer.slice(1);

View File

@ -3,26 +3,47 @@
(type $iii (func (param i32 i32) (result i32)))
(type $ii (func (param i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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 $~lib/arraybuffer/HEADER_SIZE i32 (i32.const 4))
(global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8))
(global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816))
(global $std/arraybuffer/buffer (mut i32) (i32.const 0))
(global $argumentCount (mut i32) (i32.const 0))
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 44))
(global $HEAP_BASE i32 (i32.const 104))
(memory $0 1)
(data (i32.const 4) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
(data (i32.const 4) "\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 64) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
(export "memory" (memory $0))
(start $start)
(func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/internal/arraybuffer/computeSize (; 1 ;) (type $ii) (param $0 i32) (result i32)
(return
(i32.shl
(i32.const 1)
(i32.sub
(i32.const 32)
(i32.clz
(i32.sub
(i32.add
(get_local $0)
(i32.const 8)
)
(i32.const 1)
)
)
)
)
)
)
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -133,32 +154,416 @@
(i32.const 0)
)
)
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(func $~lib/internal/arraybuffer/allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 2147483647)
(i32.eqz
(i32.le_u
(get_local $0)
(i32.const 1073741816)
)
)
(unreachable)
)
(set_local $2
(call $~lib/allocator/arena/allocate_memory
(i32.add
(block
(call $abort
(i32.const 0)
(i32.const 4)
(get_local $1)
(i32.const 22)
(i32.const 2)
)
(unreachable)
)
)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/internal/arraybuffer/computeSize
(get_local $0)
)
)
)
(i32.store
(get_local $2)
(get_local $1)
(get_local $0)
)
(return
(get_local $1)
)
)
(func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i64)
(if
(i32.eqz
(get_local $2)
)
(return)
)
(i32.store8
(get_local $0)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 1)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 2)
)
(return)
)
(i32.store8
(i32.add
(get_local $0)
(i32.const 1)
)
(get_local $1)
)
(i32.store8
(i32.add
(get_local $0)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 3)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 6)
)
(return)
)
(i32.store8
(i32.add
(get_local $0)
(i32.const 3)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 4)
)
(get_local $1)
)
(if
(i32.le_u
(get_local $2)
(i32.const 8)
)
(return)
)
(set_local $3
(i32.and
(i32.sub
(i32.const 0)
(get_local $0)
)
(i32.const 3)
)
)
(set_local $0
(i32.add
(get_local $0)
(get_local $3)
)
)
(set_local $2
(i32.sub
(get_local $2)
(get_local $3)
)
)
(set_local $2
(i32.and
(get_local $2)
(i32.const -4)
)
)
(set_local $4
(i32.mul
(i32.div_u
(i32.const -1)
(i32.const 255)
)
(get_local $1)
)
)
(i32.store
(get_local $0)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 4)
)
(get_local $4)
)
(if
(i32.le_u
(get_local $2)
(i32.const 8)
)
(return)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 4)
)
(get_local $4)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 8)
)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 12)
)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 8)
)
(get_local $4)
)
(if
(i32.le_u
(get_local $2)
(i32.const 24)
)
(return)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 12)
)
(get_local $4)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 16)
)
(get_local $4)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 20)
)
(get_local $4)
)
(i32.store
(i32.add
(get_local $0)
(i32.const 24)
)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 28)
)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 24)
)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 20)
)
(get_local $4)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 16)
)
(get_local $4)
)
(set_local $3
(i32.add
(i32.const 24)
(i32.and
(get_local $0)
(i32.const 4)
)
)
)
(set_local $0
(i32.add
(get_local $0)
(get_local $3)
)
)
(set_local $2
(i32.sub
(get_local $2)
(get_local $3)
)
)
(set_local $5
(i64.or
(i64.extend_u/i32
(get_local $4)
)
(i64.shl
(i64.extend_u/i32
(get_local $4)
)
(i64.const 32)
)
)
)
(block $break|0
(loop $continue|0
(if
(i32.ge_u
(get_local $2)
(i32.const 32)
)
(block
(block
(i64.store
(get_local $0)
(get_local $5)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 8)
)
(get_local $5)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 16)
)
(get_local $5)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 24)
)
(get_local $5)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 32)
)
)
(set_local $0
(i32.add
(get_local $0)
(i32.const 32)
)
)
)
(br $continue|0)
)
)
)
)
)
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 1073741816)
)
(unreachable)
)
(set_local $2
(call $~lib/internal/arraybuffer/allocate
(get_local $1)
)
)
(call $~lib/memory/set_memory
(i32.add
(get_local $2)
(i32.const 8)
)
(i32.const 0)
(get_local $1)
)
(return
(get_local $2)
)
)
(func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/memory/copy_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1961,7 +2366,7 @@
)
)
)
(func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(if
(i32.eq
@ -2284,7 +2689,7 @@
)
)
)
(func $~lib/arraybuffer/ArrayBuffer#slice (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/arraybuffer/ArrayBuffer#slice (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -2387,26 +2792,19 @@
)
)
(set_local $7
(call $~lib/allocator/arena/allocate_memory
(i32.add
(i32.const 4)
(get_local $6)
)
(call $~lib/internal/arraybuffer/allocate
(get_local $6)
)
)
(i32.store
(get_local $7)
(get_local $6)
)
(call $~lib/memory/move_memory
(i32.add
(get_local $7)
(i32.const 4)
(i32.const 8)
)
(i32.add
(i32.add
(get_local $0)
(i32.const 4)
(i32.const 8)
)
(get_local $1)
)
@ -2416,7 +2814,7 @@
(get_local $7)
)
)
(func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(block $2of2
(block $1of2
(block $0of2
@ -2432,7 +2830,7 @@
)
)
(set_local $2
(i32.const 2147483647)
(i32.const 1073741816)
)
)
(call $~lib/arraybuffer/ArrayBuffer#slice
@ -2441,7 +2839,7 @@
(get_local $2)
)
)
(func $start (; 7 ;) (type $v)
(func $start (; 10 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.and
(i32.add
@ -2475,7 +2873,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 5)
(i32.const 0)
)
@ -2506,7 +2904,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 9)
(i32.const 0)
)
@ -2523,7 +2921,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 10)
(i32.const 0)
)
@ -2554,7 +2952,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 14)
(i32.const 0)
)
@ -2585,7 +2983,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 18)
(i32.const 0)
)
@ -2611,7 +3009,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 22)
(i32.const 0)
)
@ -2637,7 +3035,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 26)
(i32.const 0)
)
@ -2663,7 +3061,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 30)
(i32.const 0)
)
@ -2689,7 +3087,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 34)
(i32.const 0)
)
@ -2720,7 +3118,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 38)
(i32.const 0)
)
@ -2737,7 +3135,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 39)
(i32.const 0)
)

View File

@ -1,268 +0,0 @@
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $std/carray/arr (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 36))
(memory $0 1)
(data (i32.const 4) "\0d\00\00\00s\00t\00d\00/\00c\00a\00r\00r\00a\00y\00.\00t\00s")
(export "memory" (memory $0))
(start $start)
(func $~lib/array/CArray<i32>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(if
(i32.lt_s
(get_local $1)
(i32.const 0)
)
(unreachable)
)
(i32.load
(i32.add
(get_local $0)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
)
(func $~lib/array/CArray<i32>#__set (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(if
(i32.lt_s
(get_local $1)
(i32.const 0)
)
(unreachable)
)
(i32.store
(i32.add
(get_local $0)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
(get_local $2)
)
)
(func $start (; 3 ;) (type $v)
(local $0 i32)
(local $1 i32)
(set_global $std/carray/arr
(get_global $HEAP_BASE)
)
(if
(i32.load
(get_global $HEAP_BASE)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 8)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.load
(i32.add
(get_global $HEAP_BASE)
(i32.const 4)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 9)
(i32.const 0)
)
(unreachable)
)
)
(if
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 11)
(i32.const 0)
)
(unreachable)
)
)
(if
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 12)
(i32.const 0)
)
(unreachable)
)
)
(call $~lib/array/CArray<i32>#__set
(get_global $std/carray/arr)
(i32.const 0)
(i32.const 42)
)
(call $~lib/array/CArray<i32>#__set
(get_global $std/carray/arr)
(i32.const 1)
(i32.const 24)
)
(if
(i32.ne
(i32.load
(get_global $HEAP_BASE)
)
(i32.const 42)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 17)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load
(i32.add
(get_global $HEAP_BASE)
(i32.const 4)
)
)
(i32.const 24)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 18)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 0)
)
(i32.const 42)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 20)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 1)
)
(i32.const 24)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 21)
(i32.const 0)
)
(unreachable)
)
)
(if
(block (result i32)
(call $~lib/array/CArray<i32>#__set
(tee_local $0
(get_global $std/carray/arr)
)
(tee_local $1
(i32.const 3)
)
(i32.const 9000)
)
(i32.ne
(call $~lib/array/CArray<i32>#__get
(get_local $0)
(get_local $1)
)
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 23)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load
(i32.add
(get_global $HEAP_BASE)
(i32.const 12)
)
)
(i32.const 9000)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 25)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 3)
)
(i32.const 9000)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 26)
(i32.const 0)
)
(unreachable)
)
)
)
)

View File

@ -1,26 +0,0 @@
// TBD: While this is useful as long as the pointer is just a local or global,
// things go haywire, compared to C, as soon as the CArray is a member of a
// class. Also, multi dimensional arrays cannot be implemented C-like because
// their length isn't known at compile time.
var arr: CArray<i32> = changetype<CArray<i32>>(HEAP_BASE);
assert(load<i32>(HEAP_BASE) == 0);
assert(load<i32>(HEAP_BASE + 4) == 0);
assert(arr[0] == 0);
assert(arr[1] == 0);
arr[0] = 42;
arr[1] = 24;
assert(load<i32>(HEAP_BASE) == 42);
assert(load<i32>(HEAP_BASE + 4) == 24);
assert(arr[0] == 42);
assert(arr[1] == 24);
assert((arr[3] = 9000) == 9000);
assert(load<i32>(HEAP_BASE + 12) == 9000);
assert(arr[3] == 9000);

View File

@ -1,305 +0,0 @@
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $i (func (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $std/carray/arr (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 36))
(memory $0 1)
(data (i32.const 4) "\0d\00\00\00s\00t\00d\00/\00c\00a\00r\00r\00a\00y\00.\00t\00s\00")
(export "memory" (memory $0))
(start $start)
(func $~lib/array/CArray<i32>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(if
(i32.lt_s
(get_local $1)
(i32.const 0)
)
(unreachable)
)
(return
(i32.load
(i32.add
(get_local $0)
(i32.mul
(get_local $1)
(i32.const 4)
)
)
)
)
)
(func $~lib/array/CArray<i32>#__set (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(if
(i32.lt_s
(get_local $1)
(i32.const 0)
)
(unreachable)
)
(i32.store
(i32.add
(get_local $0)
(i32.mul
(get_local $1)
(i32.const 4)
)
)
(get_local $2)
)
)
(func $start (; 3 ;) (type $v)
(local $0 i32)
(local $1 i32)
(set_global $std/carray/arr
(get_global $HEAP_BASE)
)
(if
(i32.eqz
(i32.eq
(i32.load
(get_global $HEAP_BASE)
)
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 8)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.load
(i32.add
(get_global $HEAP_BASE)
(i32.const 4)
)
)
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 9)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 0)
)
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 11)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 1)
)
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 12)
(i32.const 0)
)
(unreachable)
)
)
(call $~lib/array/CArray<i32>#__set
(get_global $std/carray/arr)
(i32.const 0)
(i32.const 42)
)
(call $~lib/array/CArray<i32>#__set
(get_global $std/carray/arr)
(i32.const 1)
(i32.const 24)
)
(if
(i32.eqz
(i32.eq
(i32.load
(get_global $HEAP_BASE)
)
(i32.const 42)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 17)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.load
(i32.add
(get_global $HEAP_BASE)
(i32.const 4)
)
)
(i32.const 24)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 18)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 0)
)
(i32.const 42)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 20)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 1)
)
(i32.const 24)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 21)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(block (result i32)
(call $~lib/array/CArray<i32>#__set
(tee_local $0
(get_global $std/carray/arr)
)
(tee_local $1
(i32.const 3)
)
(i32.const 9000)
)
(call $~lib/array/CArray<i32>#__get
(get_local $0)
(get_local $1)
)
)
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 23)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(i32.load
(i32.add
(get_global $HEAP_BASE)
(i32.const 12)
)
)
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 25)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eq
(call $~lib/array/CArray<i32>#__get
(get_global $std/carray/arr)
(i32.const 3)
)
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 26)
(i32.const 0)
)
(unreachable)
)
)
)
)

View File

@ -2,10 +2,10 @@
(type $i (func (result i32)))
(type $ii (func (param i32) (result i32)))
(type $v (func))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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/constructor/emptyCtor (mut i32) (i32.const 0))

View File

@ -3,10 +3,10 @@
(type $ifi (func (param i32 f32) (result i32)))
(type $ii (func (param i32) (result i32)))
(type $v (func))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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/new/aClass (mut i32) (i32.const 0))

View File

@ -6,10 +6,10 @@
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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/operator-overloading/a1 (mut i32) (i32.const 0))

View File

@ -7,10 +7,10 @@
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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/set/set (mut i32) (i32.const 0))

View File

@ -2013,24 +2013,33 @@
)
(func $~lib/array/Array<i32>#__grow (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(if
(i32.le_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $4
(i32.load offset=4
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 160)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $3
(call $~lib/allocator/arena/allocate_memory
(i32.shl
(get_local $1)
@ -2039,32 +2048,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $3)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $4)
(i32.const 2)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
@ -2084,30 +2085,30 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $3
(i32.load offset=4
(get_local $0)
)
)
)
(call $~lib/array/Array<i32>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $3
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $3)
)
)
)
@ -2149,24 +2150,33 @@
)
(func $~lib/array/Array<i64>#__grow (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(if
(i32.le_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $4
(i32.load offset=4
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 160)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $3
(call $~lib/allocator/arena/allocate_memory
(i32.shl
(get_local $1)
@ -2175,32 +2185,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $3)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $4)
(i32.const 3)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $3)
)
(i32.store offset=4
(get_local $0)
@ -2220,30 +2222,30 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $3
(i32.load offset=4
(get_local $0)
)
)
)
(call $~lib/array/Array<i64>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $3
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $3)
)
)
)
@ -2296,30 +2298,30 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $3
(i32.load offset=4
(get_local $0)
)
)
)
(call $~lib/array/Array<i32>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $3
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $3)
)
)
)
@ -2372,30 +2374,30 @@
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
(tee_local $3
(i32.load offset=4
(get_local $0)
)
)
)
(call $~lib/array/Array<i64>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $3
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $3)
)
)
)

View File

@ -17,10 +17,10 @@
(type $iiFv (func (param i32 i32 f64)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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))
@ -2309,26 +2309,36 @@
)
(func $~lib/array/Array<i32>#__grow (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.eqz
(i32.gt_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 160)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.mul
(get_local $1)
@ -2337,32 +2347,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $4)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.mul
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 4)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $4)
)
(i32.store offset=4
(get_local $0)
@ -2372,6 +2374,7 @@
(func $~lib/array/Array<i32>#__set (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(if
(i32.lt_s
(get_local $1)
@ -2379,33 +2382,34 @@
)
(unreachable)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
(call $~lib/array/Array<i32>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $5
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $5)
)
)
)
@ -2456,26 +2460,36 @@
)
(func $~lib/array/Array<i64>#__grow (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.eqz
(i32.gt_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 160)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.mul
(get_local $1)
@ -2484,32 +2498,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $4)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.mul
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 8)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $4)
)
(i32.store offset=4
(get_local $0)
@ -2519,6 +2525,7 @@
(func $~lib/array/Array<i64>#__set (; 12 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(if
(i32.lt_s
(get_local $1)
@ -2526,33 +2533,34 @@
)
(unreachable)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
(call $~lib/array/Array<i64>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $5
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $5)
)
)
)
@ -2603,26 +2611,36 @@
)
(func $~lib/array/Array<f32>#__grow (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.eqz
(i32.gt_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 160)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.mul
(get_local $1)
@ -2631,32 +2649,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $4)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.mul
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 4)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $4)
)
(i32.store offset=4
(get_local $0)
@ -2666,6 +2676,7 @@
(func $~lib/array/Array<f32>#__set (; 16 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(if
(i32.lt_s
(get_local $1)
@ -2673,33 +2684,34 @@
)
(unreachable)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
(call $~lib/array/Array<f32>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $5
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $5)
)
)
)
@ -2750,26 +2762,36 @@
)
(func $~lib/array/Array<f64>#__grow (; 19 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.eqz
(i32.gt_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 160)
(i32.const 9)
(i32.const 16)
(i32.const 4)
)
(unreachable)
)
)
(set_local $2
(set_local $4
(call $~lib/allocator/arena/allocate_memory
(i32.mul
(get_local $1)
@ -2778,32 +2800,24 @@
)
)
(if
(i32.load
(get_local $0)
)
(get_local $2)
(block
(call $~lib/memory/move_memory
(get_local $4)
(get_local $2)
(i32.load
(get_local $0)
)
(i32.mul
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 8)
)
)
(call $~lib/allocator/arena/free_memory
(i32.load
(get_local $0)
)
(get_local $2)
)
)
)
(i32.store
(get_local $0)
(get_local $2)
(get_local $4)
)
(i32.store offset=4
(get_local $0)
@ -2813,6 +2827,7 @@
(func $~lib/array/Array<f64>#__set (; 20 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(if
(i32.lt_s
(get_local $1)
@ -2820,33 +2835,34 @@
)
(unreachable)
)
(set_local $3
(i32.load offset=4
(get_local $0)
)
)
(if
(i32.ge_s
(get_local $1)
(i32.load offset=4
(get_local $0)
)
(get_local $3)
)
(call $~lib/array/Array<f64>#__grow
(get_local $0)
(select
(tee_local $3
(tee_local $4
(i32.add
(get_local $1)
(i32.const 1)
)
)
(tee_local $4
(tee_local $5
(i32.shl
(i32.load offset=4
(get_local $0)
)
(get_local $3)
(i32.const 1)
)
)
(i32.gt_s
(get_local $3)
(get_local $4)
(get_local $5)
)
)
)

View File

@ -15,7 +15,7 @@
(global $std/string/nullStr (mut i32) (i32.const 0))
(global $argumentCount (mut i32) (i32.const 0))
(global $std/string/c (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 384))
(global $HEAP_BASE i32 (i32.const 436))
(memory $0 1)
(data (i32.const 4) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g")
(data (i32.const 40) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
@ -39,11 +39,12 @@
(data (i32.const 296) "\08\00\00\00.\001\00f\00o\00o\00b\00a\00r")
(data (i32.const 316) "\01\00\00\00a")
(data (i32.const 324) "\01\00\00\00b")
(data (i32.const 336) "\02\00\00\00a\00b")
(data (i32.const 344) "\02\00\00\00b\00a")
(data (i32.const 352) "\02\00\00\00a\00a")
(data (i32.const 360) "\03\00\00\00a\00b\00c")
(data (i32.const 372) "\03\00\00\001\002\003")
(data (i32.const 336) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
(data (i32.const 388) "\02\00\00\00a\00b")
(data (i32.const 396) "\02\00\00\00b\00a")
(data (i32.const 404) "\02\00\00\00a\00a")
(data (i32.const 412) "\03\00\00\00a\00b\00c")
(data (i32.const 424) "\03\00\00\001\002\003")
(export "getString" (func $std/string/getString))
(export "memory" (memory $0))
(start $start)
@ -56,7 +57,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 40)
(i32.const 37)
(i32.const 4)
)
(unreachable)
@ -155,7 +156,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 235)
(i32.const 232)
(i32.const 4)
)
(unreachable)
@ -265,7 +266,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 101)
(i32.const 98)
(i32.const 4)
)
(unreachable)
@ -354,7 +355,7 @@
(unreachable)
)
(set_local $2
(i32.const 2147483647)
(i32.const 536870910)
)
)
(call $~lib/string/String#endsWith
@ -375,7 +376,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 214)
(i32.const 211)
(i32.const 4)
)
(unreachable)
@ -527,7 +528,7 @@
(func $std/string/getString (; 11 ;) (type $i) (result i32)
(get_global $std/string/str)
)
(func $~lib/string/parse<f64> (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(func $~lib/internal/string/parse<f64> (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -893,7 +894,7 @@
)
)
(func $~lib/string/parseInt (; 13 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(call $~lib/string/parse<f64>
(call $~lib/internal/string/parse<f64>
(get_local $0)
(get_local $1)
)
@ -1086,7 +1087,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 559)
(i32.const 431)
(i32.const 10)
)
(unreachable)
@ -1261,18 +1262,32 @@
)
(i32.const 0)
)
(func $~lib/string/allocate (; 17 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/internal/string/allocate (; 17 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if
(i32.le_s
(get_local $0)
(i32.const 0)
(i32.eqz
(i32.and
(if (result i32)
(tee_local $1
(i32.gt_s
(get_local $0)
(i32.const 0)
)
)
(i32.le_s
(get_local $0)
(i32.const 536870910)
)
(get_local $1)
)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 8)
(i32.const 336)
(i32.const 20)
(i32.const 2)
)
(unreachable)
@ -3172,7 +3187,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 77)
(i32.const 74)
(i32.const 4)
)
(unreachable)
@ -3210,7 +3225,7 @@
(call $~lib/memory/move_memory
(i32.add
(tee_local $2
(call $~lib/string/allocate
(call $~lib/internal/string/allocate
(get_local $2)
)
)
@ -4075,7 +4090,7 @@
(i32.eqz
(call $~lib/string/String.__eq
(get_global $std/string/c)
(i32.const 336)
(i32.const 388)
)
)
(block
@ -4159,7 +4174,7 @@
(if
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 344)
(i32.const 396)
(i32.const 316)
)
)
@ -4176,8 +4191,8 @@
(if
(i32.eqz
(call $~lib/string/String.__gte
(i32.const 344)
(i32.const 352)
(i32.const 396)
(i32.const 404)
)
)
(block
@ -4193,8 +4208,8 @@
(if
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 344)
(i32.const 336)
(i32.const 396)
(i32.const 388)
)
)
(block
@ -4209,8 +4224,8 @@
)
(if
(call $~lib/string/String.__lt
(i32.const 344)
(i32.const 336)
(i32.const 396)
(i32.const 388)
)
(block
(call $abort
@ -4255,7 +4270,7 @@
(if
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 360)
(i32.const 412)
(i32.const 332)
)
)
@ -4273,7 +4288,7 @@
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 332)
(i32.const 360)
(i32.const 412)
)
)
(block
@ -4289,7 +4304,7 @@
(if
(i32.eqz
(call $~lib/string/String.__gte
(i32.const 360)
(i32.const 412)
(i32.const 332)
)
)
@ -4307,7 +4322,7 @@
(i32.eqz
(call $~lib/string/String.__lte
(i32.const 332)
(i32.const 360)
(i32.const 412)
)
)
(block
@ -4322,7 +4337,7 @@
)
(if
(call $~lib/string/String.__lt
(i32.const 360)
(i32.const 412)
(i32.const 332)
)
(block
@ -4338,7 +4353,7 @@
(if
(call $~lib/string/String.__gt
(i32.const 332)
(i32.const 360)
(i32.const 412)
)
(block
(call $abort
@ -4417,7 +4432,7 @@
(if
(i32.ne
(i32.load
(i32.const 372)
(i32.const 424)
)
(i32.const 3)
)

View File

@ -9,44 +9,45 @@
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/index/AL_BITS i32 (i32.const 3))
(global $~lib/allocator/common/index/AL_SIZE i32 (i32.const 8))
(global $~lib/allocator/common/index/AL_MASK i32 (i32.const 7))
(global $~lib/allocator/common/index/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(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/string/str (mut i32) (i32.const 4))
(global $std/string/nullStr (mut i32) (i32.const 0))
(global $~lib/string/HEADER_SIZE i32 (i32.const 4))
(global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4))
(global $argumentCount (mut i32) (i32.const 0))
(global $~lib/string/CharCode.PLUS i32 (i32.const 43))
(global $~lib/string/CharCode.MINUS i32 (i32.const 45))
(global $~lib/string/CharCode.DOT i32 (i32.const 46))
(global $~lib/string/CharCode._0 i32 (i32.const 48))
(global $~lib/string/CharCode._1 i32 (i32.const 49))
(global $~lib/string/CharCode._2 i32 (i32.const 50))
(global $~lib/string/CharCode._3 i32 (i32.const 51))
(global $~lib/string/CharCode._4 i32 (i32.const 52))
(global $~lib/string/CharCode._5 i32 (i32.const 53))
(global $~lib/string/CharCode._6 i32 (i32.const 54))
(global $~lib/string/CharCode._7 i32 (i32.const 55))
(global $~lib/string/CharCode._8 i32 (i32.const 56))
(global $~lib/string/CharCode._9 i32 (i32.const 57))
(global $~lib/string/CharCode.A i32 (i32.const 65))
(global $~lib/string/CharCode.B i32 (i32.const 66))
(global $~lib/string/CharCode.E i32 (i32.const 69))
(global $~lib/string/CharCode.O i32 (i32.const 79))
(global $~lib/string/CharCode.X i32 (i32.const 88))
(global $~lib/string/CharCode.Z i32 (i32.const 90))
(global $~lib/string/CharCode.a i32 (i32.const 97))
(global $~lib/string/CharCode.b i32 (i32.const 98))
(global $~lib/string/CharCode.e i32 (i32.const 101))
(global $~lib/string/CharCode.o i32 (i32.const 111))
(global $~lib/string/CharCode.x i32 (i32.const 120))
(global $~lib/string/CharCode.z i32 (i32.const 122))
(global $~lib/string/EMPTY i32 (i32.const 332))
(global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910))
(global $~lib/internal/string/CharCode.PLUS i32 (i32.const 43))
(global $~lib/internal/string/CharCode.MINUS i32 (i32.const 45))
(global $~lib/internal/string/CharCode.DOT i32 (i32.const 46))
(global $~lib/internal/string/CharCode._0 i32 (i32.const 48))
(global $~lib/internal/string/CharCode._1 i32 (i32.const 49))
(global $~lib/internal/string/CharCode._2 i32 (i32.const 50))
(global $~lib/internal/string/CharCode._3 i32 (i32.const 51))
(global $~lib/internal/string/CharCode._4 i32 (i32.const 52))
(global $~lib/internal/string/CharCode._5 i32 (i32.const 53))
(global $~lib/internal/string/CharCode._6 i32 (i32.const 54))
(global $~lib/internal/string/CharCode._7 i32 (i32.const 55))
(global $~lib/internal/string/CharCode._8 i32 (i32.const 56))
(global $~lib/internal/string/CharCode._9 i32 (i32.const 57))
(global $~lib/internal/string/CharCode.A i32 (i32.const 65))
(global $~lib/internal/string/CharCode.B i32 (i32.const 66))
(global $~lib/internal/string/CharCode.E i32 (i32.const 69))
(global $~lib/internal/string/CharCode.O i32 (i32.const 79))
(global $~lib/internal/string/CharCode.X i32 (i32.const 88))
(global $~lib/internal/string/CharCode.Z i32 (i32.const 90))
(global $~lib/internal/string/CharCode.a i32 (i32.const 97))
(global $~lib/internal/string/CharCode.b i32 (i32.const 98))
(global $~lib/internal/string/CharCode.e i32 (i32.const 101))
(global $~lib/internal/string/CharCode.o i32 (i32.const 111))
(global $~lib/internal/string/CharCode.x i32 (i32.const 120))
(global $~lib/internal/string/CharCode.z i32 (i32.const 122))
(global $~lib/internal/string/EMPTY i32 (i32.const 332))
(global $std/string/c (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 384))
(global $HEAP_BASE i32 (i32.const 436))
(memory $0 1)
(data (i32.const 4) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g\00")
(data (i32.const 40) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
@ -71,11 +72,12 @@
(data (i32.const 316) "\01\00\00\00a\00")
(data (i32.const 324) "\01\00\00\00b\00")
(data (i32.const 332) "\00\00\00\00")
(data (i32.const 336) "\02\00\00\00a\00b\00")
(data (i32.const 344) "\02\00\00\00b\00a\00")
(data (i32.const 352) "\02\00\00\00a\00a\00")
(data (i32.const 360) "\03\00\00\00a\00b\00c\00")
(data (i32.const 372) "\03\00\00\001\002\003\00")
(data (i32.const 336) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
(data (i32.const 388) "\02\00\00\00a\00b\00")
(data (i32.const 396) "\02\00\00\00b\00a\00")
(data (i32.const 404) "\02\00\00\00a\00a\00")
(data (i32.const 412) "\03\00\00\00a\00b\00c\00")
(data (i32.const 424) "\03\00\00\001\002\003\00")
(export "getString" (func $std/string/getString))
(export "memory" (memory $0))
(start $start)
@ -91,7 +93,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 40)
(i32.const 37)
(i32.const 4)
)
(unreachable)
@ -204,7 +206,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 235)
(i32.const 232)
(i32.const 4)
)
(unreachable)
@ -334,7 +336,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 101)
(i32.const 98)
(i32.const 4)
)
(unreachable)
@ -435,7 +437,7 @@
(unreachable)
)
(set_local $2
(i32.const 2147483647)
(i32.const 536870910)
)
)
(call $~lib/string/String#endsWith
@ -462,7 +464,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 214)
(i32.const 211)
(i32.const 4)
)
(unreachable)
@ -636,7 +638,7 @@
(get_global $std/string/str)
)
)
(func $~lib/string/parse<f64> (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(func $~lib/internal/string/parse<f64> (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -1048,7 +1050,7 @@
)
(func $~lib/string/parseInt (; 13 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(return
(call $~lib/string/parse<f64>
(call $~lib/internal/string/parse<f64>
(get_local $0)
(get_local $1)
)
@ -1264,7 +1266,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 559)
(i32.const 431)
(i32.const 10)
)
(unreachable)
@ -1470,26 +1472,39 @@
(i32.const 0)
)
)
(func $~lib/string/allocate (; 17 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/internal/string/allocate (; 17 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(if
(i32.eqz
(i32.gt_s
(get_local $0)
(i32.const 0)
(i32.and
(if (result i32)
(tee_local $1
(i32.gt_s
(get_local $0)
(i32.const 0)
)
)
(i32.le_s
(get_local $0)
(i32.const 536870910)
)
(get_local $1)
)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 8)
(i32.const 336)
(i32.const 20)
(i32.const 2)
)
(unreachable)
)
)
(set_local $1
(set_local $2
(call $~lib/allocator/arena/allocate_memory
(i32.add
(i32.const 4)
@ -1501,11 +1516,11 @@
)
)
(i32.store
(get_local $1)
(get_local $2)
(get_local $0)
)
(return
(get_local $1)
(get_local $2)
)
)
(func $~lib/memory/copy_memory (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
@ -3650,7 +3665,7 @@
(call $abort
(i32.const 0)
(i32.const 72)
(i32.const 77)
(i32.const 74)
(i32.const 4)
)
(unreachable)
@ -3691,7 +3706,7 @@
)
)
(set_local $5
(call $~lib/string/allocate
(call $~lib/internal/string/allocate
(get_local $4)
)
)
@ -4676,7 +4691,7 @@
(i32.eqz
(call $~lib/string/String.__eq
(get_global $std/string/c)
(i32.const 336)
(i32.const 388)
)
)
(block
@ -4760,7 +4775,7 @@
(if
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 344)
(i32.const 396)
(i32.const 316)
)
)
@ -4777,8 +4792,8 @@
(if
(i32.eqz
(call $~lib/string/String.__gte
(i32.const 344)
(i32.const 352)
(i32.const 396)
(i32.const 404)
)
)
(block
@ -4794,8 +4809,8 @@
(if
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 344)
(i32.const 336)
(i32.const 396)
(i32.const 388)
)
)
(block
@ -4812,8 +4827,8 @@
(i32.eqz
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 344)
(i32.const 336)
(i32.const 396)
(i32.const 388)
)
)
)
@ -4868,7 +4883,7 @@
(if
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 360)
(i32.const 412)
(i32.const 332)
)
)
@ -4886,7 +4901,7 @@
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 332)
(i32.const 360)
(i32.const 412)
)
)
(block
@ -4902,7 +4917,7 @@
(if
(i32.eqz
(call $~lib/string/String.__gte
(i32.const 360)
(i32.const 412)
(i32.const 332)
)
)
@ -4920,7 +4935,7 @@
(i32.eqz
(call $~lib/string/String.__lte
(i32.const 332)
(i32.const 360)
(i32.const 412)
)
)
(block
@ -4937,7 +4952,7 @@
(i32.eqz
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 360)
(i32.const 412)
(i32.const 332)
)
)
@ -4957,7 +4972,7 @@
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 332)
(i32.const 360)
(i32.const 412)
)
)
)
@ -5047,7 +5062,7 @@
(i32.eqz
(i32.eq
(i32.load
(i32.const 372)
(i32.const 424)
)
(i32.const 3)
)

View File

@ -0,0 +1,962 @@
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iv (func (param i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $ii (func (param i32) (result i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 104))
(memory $0 1)
(data (i32.const 4) "\11\00\00\00s\00t\00d\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s")
(data (i32.const 44) "\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")
(export "memory" (memory $0))
(start $start)
(func $~lib/internal/arraybuffer/computeSize (; 1 ;) (type $ii) (param $0 i32) (result i32)
(i32.shl
(i32.const 1)
(i32.sub
(i32.const 32)
(i32.clz
(i32.add
(get_local $0)
(i32.const 7)
)
)
)
)
)
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(if
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(get_local $0)
)
(i32.const 7)
)
(i32.const -8)
)
)
(i32.shl
(tee_local $0
(current_memory)
)
(i32.const 16)
)
)
(if
(i32.lt_s
(grow_memory
(select
(get_local $0)
(tee_local $4
(tee_local $3
(i32.shr_u
(i32.and
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.const -65536)
)
(i32.const 16)
)
)
)
(i32.gt_s
(get_local $0)
(get_local $4)
)
)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(i32.const 0)
)
(func $~lib/internal/arraybuffer/allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if
(i32.gt_u
(get_local $0)
(i32.const 1073741816)
)
(block
(call $abort
(i32.const 0)
(i32.const 44)
(i32.const 22)
(i32.const 2)
)
(unreachable)
)
)
(i32.store
(tee_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/internal/arraybuffer/computeSize
(get_local $0)
)
)
)
(get_local $0)
)
(get_local $1)
)
(func $~lib/internal/typedarray/TypedArray<i8>#constructor (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 1073741816)
)
(unreachable)
)
(i32.store
(if (result i32)
(get_local $0)
(get_local $0)
(block (result i32)
(i32.store
(tee_local $0
(call $~lib/allocator/arena/allocate_memory
(i32.const 12)
)
)
(i32.const 0)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(i32.const 0)
)
(get_local $0)
)
)
(call $~lib/internal/arraybuffer/allocate
(get_local $1)
)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(get_local $1)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i8>#get:length (; 5 ;) (type $ii) (param $0 i32) (result i32)
(i32.load offset=8
(get_local $0)
)
)
(func $~lib/internal/typedarray/TypedArray<i16>#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 536870908)
)
(unreachable)
)
(set_local $1
(i32.shl
(get_local $1)
(i32.const 1)
)
)
(i32.store
(if (result i32)
(get_local $0)
(get_local $0)
(block (result i32)
(i32.store
(tee_local $0
(call $~lib/allocator/arena/allocate_memory
(i32.const 12)
)
)
(i32.const 0)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(i32.const 0)
)
(get_local $0)
)
)
(call $~lib/internal/arraybuffer/allocate
(get_local $1)
)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(get_local $1)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i16>#get:length (; 7 ;) (type $ii) (param $0 i32) (result i32)
(i32.shr_s
(i32.load offset=8
(get_local $0)
)
(i32.const 1)
)
)
(func $~lib/internal/typedarray/TypedArray<i32>#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 268435454)
)
(unreachable)
)
(set_local $1
(i32.shl
(get_local $1)
(i32.const 2)
)
)
(i32.store
(if (result i32)
(get_local $0)
(get_local $0)
(block (result i32)
(i32.store
(tee_local $0
(call $~lib/allocator/arena/allocate_memory
(i32.const 12)
)
)
(i32.const 0)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(i32.const 0)
)
(get_local $0)
)
)
(call $~lib/internal/arraybuffer/allocate
(get_local $1)
)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(get_local $1)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i32>#get:length (; 9 ;) (type $ii) (param $0 i32) (result i32)
(i32.shr_s
(i32.load offset=8
(get_local $0)
)
(i32.const 2)
)
)
(func $~lib/internal/typedarray/TypedArray<i64>#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(if
(i32.gt_u
(get_local $1)
(i32.const 134217727)
)
(unreachable)
)
(set_local $1
(i32.shl
(get_local $1)
(i32.const 3)
)
)
(i32.store
(if (result i32)
(get_local $0)
(get_local $0)
(block (result i32)
(i32.store
(tee_local $0
(call $~lib/allocator/arena/allocate_memory
(i32.const 12)
)
)
(i32.const 0)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(i32.const 0)
)
(get_local $0)
)
)
(call $~lib/internal/arraybuffer/allocate
(get_local $1)
)
)
(i32.store offset=4
(get_local $0)
(i32.const 0)
)
(i32.store offset=8
(get_local $0)
(get_local $1)
)
(get_local $0)
)
(func $~lib/internal/typedarray/TypedArray<i64>#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32)
(i32.shr_s
(i32.load offset=8
(get_local $0)
)
(i32.const 3)
)
)
(func $std/typedarray/testInstantiate (; 12 ;) (type $iv) (param $0 i32)
(local $1 i32)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i8>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 17)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 18)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i8>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 19)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i8>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 22)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 23)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i8>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 24)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i16>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 27)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 28)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i16>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 29)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i16>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 32)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 1)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 33)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i16>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 34)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i32>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 37)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 38)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i32>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 39)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i32>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 42)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 43)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i32>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 44)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i64>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 47)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 48)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i64>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 49)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i64>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 52)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 53)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i64>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 54)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i32>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 57)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 58)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i32>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 59)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.load offset=4
(tee_local $1
(call $~lib/internal/typedarray/TypedArray<i64>#constructor
(i32.const 0)
(get_local $0)
)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 62)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(i32.load offset=8
(get_local $1)
)
(i32.shl
(get_local $0)
(i32.const 3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 63)
(i32.const 2)
)
(unreachable)
)
)
(if
(i32.ne
(call $~lib/internal/typedarray/TypedArray<i64>#get:length
(get_local $1)
)
(get_local $0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 2)
)
(unreachable)
)
)
)
(func $start (; 13 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.and
(i32.add
(get_global $HEAP_BASE)
(i32.const 7)
)
(i32.const -8)
)
)
(set_global $~lib/allocator/arena/offset
(get_global $~lib/allocator/arena/startOffset)
)
(call $std/typedarray/testInstantiate
(i32.const 0)
)
(call $std/typedarray/testInstantiate
(i32.const 5)
)
(drop
(call $~lib/internal/typedarray/TypedArray<i64>#constructor
(i32.const 0)
(i32.const 134217727)
)
)
)
)

View File

@ -0,0 +1,74 @@
assert(Int8Array.BYTES_PER_ELEMENT == 1);
assert(Uint8Array.BYTES_PER_ELEMENT == 1);
assert(Int16Array.BYTES_PER_ELEMENT == 2);
assert(Uint16Array.BYTES_PER_ELEMENT == 2);
assert(Int32Array.BYTES_PER_ELEMENT == 4);
assert(Uint32Array.BYTES_PER_ELEMENT == 4);
assert(Int64Array.BYTES_PER_ELEMENT == 8);
assert(Uint64Array.BYTES_PER_ELEMENT == 8);
assert(Float32Array.BYTES_PER_ELEMENT == 4);
assert(Float64Array.BYTES_PER_ELEMENT == 8);
import "allocator/arena";
function testInstantiate(len: i32): void {
var i8a = new Int8Array(len);
assert(i8a.byteOffset == 0);
assert(i8a.byteLength == len * Int8Array.BYTES_PER_ELEMENT);
assert(i8a.length == len);
var u8a = new Uint8Array(len);
assert(u8a.byteOffset == 0);
assert(u8a.byteLength == len * Uint8Array.BYTES_PER_ELEMENT);
assert(u8a.length == len);
var i16a = new Int16Array(len);
assert(i16a.byteOffset == 0);
assert(i16a.byteLength == len * Int16Array.BYTES_PER_ELEMENT);
assert(i16a.length == len);
var u16a = new Uint16Array(len);
assert(u16a.byteOffset == 0);
assert(u16a.byteLength == len * Uint16Array.BYTES_PER_ELEMENT);
assert(u16a.length == len);
var i32a = new Int32Array(len);
assert(i32a.byteOffset == 0);
assert(i32a.byteLength == len * Int32Array.BYTES_PER_ELEMENT);
assert(i32a.length == len);
var u32a = new Uint32Array(len);
assert(u32a.byteOffset == 0);
assert(u32a.byteLength == len * Uint32Array.BYTES_PER_ELEMENT);
assert(u32a.length == len);
var i64a = new Int64Array(len);
assert(i64a.byteOffset == 0);
assert(i64a.byteLength == len * Int64Array.BYTES_PER_ELEMENT);
assert(i64a.length == len);
var u64a = new Uint64Array(len);
assert(u64a.byteOffset == 0);
assert(u64a.byteLength == len * Uint64Array.BYTES_PER_ELEMENT);
assert(u64a.length == len);
var f32a = new Float32Array(len);
assert(f32a.byteOffset == 0);
assert(f32a.byteLength == len * Float32Array.BYTES_PER_ELEMENT);
assert(f32a.length == len);
var f64a = new Float64Array(len);
assert(f64a.byteOffset == 0);
assert(f64a.byteLength == len * Float64Array.BYTES_PER_ELEMENT);
assert(f64a.length == len);
}
testInstantiate(0);
testInstantiate(5);
import { MAX_BLENGTH } from "internal/arraybuffer";
const MAX_F64LENGTH = <u32>MAX_BLENGTH >> alignof<f64>();
new Float64Array(MAX_F64LENGTH); // 1GB
// new Float64Array(MAX_F64 + 1); // throws

File diff suppressed because it is too large Load Diff