Progress and a tiny WASM binary parser

This commit is contained in:
dcodeIO
2018-04-03 23:56:48 +02:00
parent 06198a3723
commit 5823e35f37
58 changed files with 12075 additions and 3964 deletions

View File

@ -0,0 +1,4 @@
(module
(memory $0 1)
(export "memory" (memory $0))
)

16
tests/compiler/closure.ts Normal file
View File

@ -0,0 +1,16 @@
// TODO
// export function outer(): () => () => i32 {
// var inner: i32 = 42; // should become a global right away
// return function a(): () => i32 {
// return function b(): i32 {
// return inner++;
// };
// };
// }
// var fnA = outer();
// var fnB = fnA();
// assert(fnB() == 42);
// assert(fnB() == 43);

View File

@ -0,0 +1,5 @@
(module
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "memory" (memory $0))
)

View File

@ -22,81 +22,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $~lib/memory/set_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i64)

View File

@ -7,9 +7,10 @@
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -28,100 +29,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $~lib/memory/set_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)

View File

@ -33,81 +33,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $~lib/array/Array<i32>#get:length (; 2 ;) (type $ii) (param $0 i32) (result i32)
(i32.load offset=8

View File

@ -10,9 +10,10 @@
(type $iiiii (func (param i32 i32 i32 i32) (result i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $std/array/arr (mut i32) (i32.const 0))
@ -38,100 +39,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $~lib/array/Array<i32>#get:length (; 2 ;) (type $ii) (param $0 i32) (result i32)

View File

@ -22,81 +22,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)

View File

@ -7,9 +7,10 @@
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -28,100 +29,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)

View File

@ -24,81 +24,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32)
(if (result i32)

View File

@ -2,9 +2,10 @@
(type $i (func (result i32)))
(type $ii (func (param i32) (result i32)))
(type $v (func))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -29,100 +30,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32)

View File

@ -15,81 +15,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)
(local $2 i32)

View File

@ -3,9 +3,10 @@
(type $ifi (func (param i32 f32) (result i32)))
(type $ii (func (param i32) (result i32)))
(type $v (func))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -20,100 +21,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)

View File

@ -48,81 +48,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $std/operator-overloading/Tester#constructor (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)

View File

@ -6,9 +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/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -53,100 +54,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $std/operator-overloading/Tester#constructor (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)

View File

@ -21,81 +21,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $~lib/set/Set<i32>#get:size (; 2 ;) (type $ii) (param $0 i32) (result i32)
(i32.load offset=8

View File

@ -7,9 +7,10 @@
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -26,100 +27,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $~lib/set/Set<i32>#get:size (; 2 ;) (type $ii) (param $0 i32) (result i32)

View File

@ -59,81 +59,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $~lib/memory/copy_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)

View File

@ -17,9 +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/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -74,100 +75,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $~lib/memory/copy_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)

View File

@ -1226,81 +1226,88 @@
(local $3 i32)
(local $4 i32)
(if
(i32.eqz
(select
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
(get_local $0)
)
(return
(i32.const 0)
)
)
(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)
(block
(if
(i32.gt_u
(tee_local $2
(i32.and
(i32.add
(i32.add
(tee_local $1
(get_global $~lib/allocator/arena/offset)
)
(i32.const 16)
(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.gt_s
(get_local $0)
(get_local $4)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $3)
)
(i32.const 0)
)
(unreachable)
)
)
(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)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(get_local $1)
(i32.const 0)
)
(func $~lib/string/allocate (; 18 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)

View File

@ -9,9 +9,10 @@
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/allocator/common/alignment/BITS i32 (i32.const 3))
(global $~lib/allocator/common/alignment/SIZE i32 (i32.const 8))
(global $~lib/allocator/common/alignment/MASK i32 (i32.const 7))
(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/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))
@ -1415,100 +1416,108 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
(nop)
(if
(i32.eqz
(if (result i32)
(get_local $0)
(i32.lt_u
(get_local $0)
(i32.const 1073741824)
)
(get_local $0)
)
(return
(i32.const 0)
)
)
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(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
(set_local $1
(get_global $~lib/allocator/arena/offset)
)
(set_local $2
(i32.and
(i32.add
(i32.add
(i32.sub
(get_local $2)
(get_local $1)
)
(i32.const 65535)
)
(i32.xor
(i32.const 65535)
(i32.const -1)
(get_local $1)
(get_local $0)
)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
(i32.const 16)
)
)
(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)
)
)
(set_local $3
(current_memory)
)
(if
(i32.lt_s
(grow_memory
(get_local $5)
(i32.gt_u
(get_local $2)
(i32.shl
(get_local $3)
(i32.const 16)
)
(i32.const 0)
)
(if
(i32.lt_s
(grow_memory
(get_local $4)
(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)
)
)
(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.const 0)
)
(unreachable)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
)
)
)
(set_global $~lib/allocator/arena/offset
(get_local $2)
)
(return
(get_local $1)
(i32.const 0)
)
)
(func $~lib/string/allocate (; 18 ;) (type $ii) (param $0 i32) (result i32)