diff --git a/tests/allocators/arena/optimized.wat b/tests/allocators/arena/optimized.wat index 96023e27..16b995f9 100644 --- a/tests/allocators/arena/optimized.wat +++ b/tests/allocators/arena/optimized.wat @@ -5,16 +5,14 @@ (type $FUNCSIG$v (func)) (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) - (data (i32.const 8) "\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s") - (table $0 1 funcref) - (elem (i32.const 0) $null) + (data (i32.const 8) "\10\00\00\00\1c") + (data (i32.const 24) "~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s") (global $~lib/memory/memory.implemented i32 (i32.const 1)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (export "memory" (memory $0)) - (export "table" (table $0)) (export "memory.implemented" (global $~lib/memory/memory.implemented)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) @@ -27,18 +25,18 @@ (start $start) (func $~lib/memory/memory.init (; 1 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) i32.const 0 - i32.const 16 + i32.const 24 i32.const 46 i32.const 4 - call $~lib/env/abort + call $~lib/builtins/abort unreachable ) (func $~lib/memory/memory.drop (; 2 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 0 - i32.const 16 + i32.const 24 i32.const 53 i32.const 4 - call $~lib/env/abort + call $~lib/builtins/abort unreachable ) (func $~lib/allocator/arena/__mem_allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -117,935 +115,13 @@ global.get $~lib/allocator/arena/startOffset global.set $~lib/allocator/arena/offset ) - (func $~lib/util/memory/memcpy (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - loop $continue|0 - local.get $1 - i32.const 3 - i32.and - local.get $2 - local.get $2 - select - if - local.get $0 - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $continue|0 - end - end - local.get $0 - i32.const 3 - i32.and - i32.eqz - if - loop $continue|1 - local.get $2 - i32.const 16 - i32.ge_u - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 12 - i32.add - i32.load - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|1 - end - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $1 - i32.const 8 - i32.add - local.set $1 - local.get $0 - i32.const 8 - i32.add - local.set $0 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $1 - i32.const 4 - i32.add - local.set $1 - local.get $0 - i32.const 4 - i32.add - local.set $0 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load16_u - i32.store16 - local.get $1 - i32.const 2 - i32.add - local.set $1 - local.get $0 - i32.const 2 - i32.add - local.set $0 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - end - return - end - local.get $2 - i32.const 32 - i32.ge_u - if - block $break|2 - block $case2|2 - block $case1|2 - block $case0|2 - local.get $0 - i32.const 3 - i32.and - i32.const 1 - i32.sub - br_table $case0|2 $case1|2 $case2|2 $break|2 - end - local.get $1 - i32.load - local.set $4 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $0 - i32.const 1 - i32.add - local.set $3 - local.get $0 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $0 - i32.const 1 - i32.add - local.set $5 - local.get $0 - i32.load8_u - end - i32.store8 - local.get $3 - i32.const 1 - i32.add - local.set $0 - local.get $5 - i32.const 1 - i32.add - local.set $1 - local.get $3 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - loop $continue|3 - local.get $2 - i32.const 17 - i32.ge_u - if - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.load - local.tee $3 - i32.const 8 - i32.shl - local.get $4 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 5 - i32.add - i32.load - local.tee $4 - i32.const 8 - i32.shl - local.get $3 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 9 - i32.add - i32.load - local.tee $3 - i32.const 8 - i32.shl - local.get $4 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 13 - i32.add - i32.load - local.tee $4 - i32.const 8 - i32.shl - local.get $3 - i32.const 24 - i32.shr_u - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|3 - end - end - br $break|2 - end - local.get $1 - i32.load - local.set $4 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $2 - i32.const 2 - i32.sub - local.set $2 - loop $continue|4 - local.get $2 - i32.const 18 - i32.ge_u - if - local.get $0 - local.get $1 - i32.const 2 - i32.add - i32.load - local.tee $3 - i32.const 16 - i32.shl - local.get $4 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 6 - i32.add - i32.load - local.tee $4 - i32.const 16 - i32.shl - local.get $3 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 10 - i32.add - i32.load - local.tee $3 - i32.const 16 - i32.shl - local.get $4 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 14 - i32.add - i32.load - local.tee $4 - i32.const 16 - i32.shl - local.get $3 - i32.const 16 - i32.shr_u - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|4 - end - end - br $break|2 - end - local.get $1 - i32.load - local.set $4 - local.get $0 - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - loop $continue|5 - local.get $2 - i32.const 19 - i32.ge_u - if - local.get $0 - local.get $1 - i32.const 3 - i32.add - i32.load - local.tee $3 - i32.const 24 - i32.shl - local.get $4 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 7 - i32.add - i32.load - local.tee $4 - i32.const 24 - i32.shl - local.get $3 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 11 - i32.add - i32.load - local.tee $3 - i32.const 24 - i32.shl - local.get $4 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 15 - i32.add - i32.load - local.tee $4 - i32.const 24 - i32.shl - local.get $3 - i32.const 8 - i32.shr_u - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|5 - end - end - end - end - local.get $2 - i32.const 16 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - local.get $0 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $0 - local.get $3 - block (result i32) - local.get $1 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $1 - local.get $3 - i32.load8_u - end - i32.store8 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.get $1 - i32.load8_u - i32.store8 - end - ) - (func $~lib/memory/memory.copy (; 8 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.copy (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) block $~lib/util/memory/memmove|inlined.0 local.get $0 local.get $1 i32.eq br_if $~lib/util/memory/memmove|inlined.0 - local.get $1 - local.get $2 - i32.add - local.get $0 - i32.le_u - local.tee $3 - if (result i32) - local.get $3 - else - local.get $0 - local.get $2 - i32.add - local.get $1 - i32.le_u - end - if - local.get $0 - local.get $1 - local.get $2 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end local.get $0 local.get $1 i32.lt_u @@ -1213,7 +289,7 @@ end end ) - (func $~lib/memory/memory.repeat (; 9 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 8 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) local.get $2 local.get $3 @@ -1238,8 +314,7 @@ end end ) - (func $~lib/memory/memory.compare (; 10 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) + (func $~lib/memory/memory.compare (; 9 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.eq @@ -1248,9 +323,6 @@ else loop $continue|0 local.get $2 - i32.const 0 - i32.ne - local.tee $3 if (result i32) local.get $0 i32.load8_u @@ -1258,7 +330,7 @@ i32.load8_u i32.eq else - local.get $3 + i32.const 0 end if local.get $2 @@ -1288,13 +360,13 @@ end end ) - (func $start (; 11 ;) (type $FUNCSIG$v) - i32.const 48 + (func $start (; 10 ;) (type $FUNCSIG$v) + i32.const 56 global.set $~lib/allocator/arena/startOffset global.get $~lib/allocator/arena/startOffset global.set $~lib/allocator/arena/offset ) - (func $null (; 12 ;) (type $FUNCSIG$v) + (func $null (; 11 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/allocators/arena/untouched.wat b/tests/allocators/arena/untouched.wat index bf627fb6..e912ce61 100644 --- a/tests/allocators/arena/untouched.wat +++ b/tests/allocators/arena/untouched.wat @@ -5,17 +5,16 @@ (type $FUNCSIG$v (func)) (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) - (data (i32.const 8) "\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s\00") + (data (i32.const 8) "\10\00\00\00\1c\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $~lib/memory/memory.implemented i32 (i32.const 1)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $~lib/memory/HEAP_BASE i32 (i32.const 44)) + (global $~lib/memory/HEAP_BASE i32 (i32.const 52)) (export "memory" (memory $0)) - (export "table" (table $0)) (export "memory.implemented" (global $~lib/memory/memory.implemented)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) @@ -28,18 +27,18 @@ (start $start) (func $~lib/memory/memory.init (; 1 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) i32.const 0 - i32.const 16 + i32.const 24 i32.const 46 i32.const 4 - call $~lib/env/abort + call $~lib/builtins/abort unreachable ) (func $~lib/memory/memory.drop (; 2 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 0 - i32.const 16 + i32.const 24 i32.const 53 i32.const 4 - call $~lib/env/abort + call $~lib/builtins/abort unreachable ) (func $~lib/allocator/arena/__mem_allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -140,1208 +139,7 @@ (func $~lib/memory/memory.reset (; 8 ;) (type $FUNCSIG$v) call $~lib/allocator/arena/__mem_reset ) - (func $~lib/util/memory/memcpy (; 9 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - block $break|0 - loop $continue|0 - local.get $2 - if (result i32) - local.get $1 - i32.const 3 - i32.and - else - local.get $2 - end - if - block - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - end - br $continue|0 - end - end - end - local.get $0 - i32.const 3 - i32.and - i32.const 0 - i32.eq - if - block $break|1 - loop $continue|1 - local.get $2 - i32.const 16 - i32.ge_u - if - block - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 12 - i32.add - i32.load - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|1 - end - end - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.set $0 - local.get $1 - i32.const 4 - i32.add - local.set $1 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load16_u - i32.store16 - local.get $0 - i32.const 2 - i32.add - local.set $0 - local.get $1 - i32.const 2 - i32.add - local.set $1 - end - local.get $2 - i32.const 1 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - return - end - local.get $2 - i32.const 32 - i32.ge_u - if - block $break|2 - block $case2|2 - block $case1|2 - block $case0|2 - local.get $0 - i32.const 3 - i32.and - local.set $5 - local.get $5 - i32.const 1 - i32.eq - br_if $case0|2 - local.get $5 - i32.const 2 - i32.eq - br_if $case1|2 - local.get $5 - i32.const 3 - i32.eq - br_if $case2|2 - br $break|2 - end - block - local.get $1 - i32.load - local.set $3 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - block $break|3 - loop $continue|3 - local.get $2 - i32.const 17 - i32.ge_u - if - block - local.get $1 - i32.const 1 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 5 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 9 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 13 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|3 - end - end - end - br $break|2 - unreachable - end - unreachable - end - block - local.get $1 - i32.load - local.set $3 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 2 - i32.sub - local.set $2 - block $break|4 - loop $continue|4 - local.get $2 - i32.const 18 - i32.ge_u - if - block - local.get $1 - i32.const 2 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 6 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 10 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 14 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|4 - end - end - end - br $break|2 - unreachable - end - unreachable - end - block - local.get $1 - i32.load - local.set $3 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - block $break|5 - loop $continue|5 - local.get $2 - i32.const 19 - i32.ge_u - if - block - local.get $1 - i32.const 3 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 7 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 11 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 15 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - end - br $continue|5 - end - end - end - br $break|2 - unreachable - end - unreachable - end - end - local.get $2 - i32.const 16 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 8 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 4 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 2 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 1 - i32.and - if - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - end - ) - (func $~lib/memory/memory.copy (; 10 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.copy (; 9 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1352,28 +150,6 @@ if br $~lib/util/memory/memmove|inlined.0 end - local.get $1 - local.get $2 - i32.add - local.get $0 - i32.le_u - local.tee $5 - if (result i32) - local.get $5 - else - local.get $0 - local.get $2 - i32.add - local.get $1 - i32.le_u - end - if - local.get $0 - local.get $1 - local.get $2 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end local.get $0 local.get $1 i32.lt_u @@ -1572,7 +348,7 @@ end end ) - (func $~lib/memory/memory.repeat (; 11 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 10 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) i32.const 0 @@ -1604,11 +380,10 @@ end end ) - (func $~lib/memory/memory.compare (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 11 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) block $~lib/util/memory/memcmp|inlined.0 (result i32) local.get $0 local.set $5 @@ -1628,7 +403,6 @@ local.get $3 i32.const 0 i32.ne - local.tee $6 if (result i32) local.get $5 i32.load8_u @@ -1636,7 +410,7 @@ i32.load8_u i32.eq else - local.get $6 + i32.const 0 end if block @@ -1669,7 +443,7 @@ end end ) - (func $start (; 13 ;) (type $FUNCSIG$v) + (func $start (; 12 ;) (type $FUNCSIG$v) global.get $~lib/memory/HEAP_BASE i32.const 7 i32.add @@ -1681,6 +455,6 @@ global.get $~lib/allocator/arena/startOffset global.set $~lib/allocator/arena/offset ) - (func $null (; 14 ;) (type $FUNCSIG$v) + (func $null (; 13 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/allocators/asrt/assembly/index.ts b/tests/allocators/asrt/assembly/index.ts index 2f233501..0aa4ccc0 100644 --- a/tests/allocators/asrt/assembly/index.ts +++ b/tests/allocators/asrt/assembly/index.ts @@ -1,4 +1,5 @@ -import "../../../compiler/runtime/asrt"; +import "../../../runtime/assembly/index"; +import { memory as builtin_memory } from "memory"; export namespace memory { export function allocate(size: usize): usize { @@ -7,4 +8,7 @@ export namespace memory { export function free(ptr: usize): void { __mm_free(ptr); } + export function fill(dst: usize, c: u8, n: usize): void { + builtin_memory.fill(dst, c, n); + } } diff --git a/tests/allocators/asrt/optimized.wat b/tests/allocators/asrt/optimized.wat index adfc94e7..0f7bc599 100644 --- a/tests/allocators/asrt/optimized.wat +++ b/tests/allocators/asrt/optimized.wat @@ -8,17 +8,21 @@ (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) - (memory $0 0) - (global $../../compiler/runtime/asrt/ROOT (mut i32) (i32.const 0)) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 8) "\10\00\00\00>") + (data (i32.const 24) ".\00.\00/\00.\00.\00/\00r\00u\00n\00t\00i\00m\00e\00/\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00d\00e\00x\00.\00t\00s") + (global $../../runtime/assembly/index/ROOT (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "memory.allocate" (func $assembly/index/memory.allocate)) (export "memory.free" (func $assembly/index/memory.free)) - (func $../../compiler/runtime/asrt/setTail (; 0 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (export "memory.fill" (func $assembly/index/memory.fill)) + (func $../../runtime/assembly/index/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) local.get $0 local.get $1 - i32.store offset=1504 + i32.store offset=1568 ) - (func $../../compiler/runtime/asrt/setSLMap (; 1 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $../../runtime/assembly/index/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) local.get $0 local.get $1 i32.const 2 @@ -27,7 +31,7 @@ local.get $2 i32.store offset=4 ) - (func $../../compiler/runtime/asrt/setHead (; 2 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../runtime/assembly/index/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) local.get $0 local.get $1 i32.const 4 @@ -40,7 +44,7 @@ local.get $3 i32.store offset=96 ) - (func $../../compiler/runtime/asrt/getRight (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/getRight (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.add @@ -50,13 +54,13 @@ i32.and i32.add ) - (func $../../compiler/runtime/asrt/fls (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/fls (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) i32.const 31 local.get $0 i32.clz i32.sub ) - (func $../../compiler/runtime/asrt/getHead (; 5 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $../../runtime/assembly/index/getHead (; 6 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.const 4 @@ -68,7 +72,7 @@ i32.add i32.load offset=96 ) - (func $../../compiler/runtime/asrt/getSLMap (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $../../runtime/assembly/index/getSLMap (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 i32.const 2 @@ -76,7 +80,7 @@ i32.add i32.load offset=4 ) - (func $../../compiler/runtime/asrt/removeBlock (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/removeBlock (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -97,7 +101,7 @@ else local.get $2 local.get $2 - call $../../compiler/runtime/asrt/fls + call $../../runtime/assembly/index/fls local.tee $3 i32.const 4 i32.sub @@ -130,7 +134,7 @@ local.get $0 local.get $3 local.get $4 - call $../../compiler/runtime/asrt/getHead + call $../../runtime/assembly/index/getHead local.get $1 i32.eq if @@ -138,7 +142,7 @@ local.get $3 local.get $4 local.get $2 - call $../../compiler/runtime/asrt/setHead + call $../../runtime/assembly/index/setHead local.get $2 i32.eqz if @@ -146,7 +150,7 @@ local.get $3 local.get $0 local.get $3 - call $../../compiler/runtime/asrt/getSLMap + call $../../runtime/assembly/index/getSLMap i32.const 1 local.get $4 i32.shl @@ -154,7 +158,7 @@ i32.xor i32.and local.tee $1 - call $../../compiler/runtime/asrt/setSLMap + call $../../runtime/assembly/index/setSLMap local.get $1 i32.eqz if @@ -172,42 +176,56 @@ end end ) - (func $../../compiler/runtime/asrt/insertBlock (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/insertBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) + (local $7 i32) local.get $1 i32.load - local.set $2 + local.set $3 local.get $1 - call $../../compiler/runtime/asrt/getRight - local.tee $3 - i32.load + call $../../runtime/assembly/index/getRight local.tee $4 + i32.load + local.tee $5 i32.const 1 i32.and if - local.get $0 local.get $3 - call $../../compiler/runtime/asrt/removeBlock - local.get $1 - local.get $2 - local.get $4 i32.const -4 i32.and i32.const 16 i32.add + local.get $5 + i32.const -4 + i32.and i32.add local.tee $2 - i32.store - local.get $1 - call $../../compiler/runtime/asrt/getRight - local.tee $3 - i32.load - local.set $4 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $4 + call $../../runtime/assembly/index/removeBlock + local.get $1 + local.get $3 + i32.const 3 + i32.and + local.get $2 + i32.or + local.tee $3 + i32.store + local.get $1 + call $../../runtime/assembly/index/getRight + local.tee $4 + i32.load + local.set $5 + end end - local.get $2 + local.get $3 i32.const 2 i32.and if @@ -215,35 +233,48 @@ i32.const 4 i32.sub i32.load - local.tee $1 + local.tee $2 i32.load - local.set $5 - local.get $0 - local.get $1 - call $../../compiler/runtime/asrt/removeBlock - local.get $1 - local.get $5 - local.get $2 + local.tee $6 i32.const -4 i32.and i32.const 16 i32.add + local.get $3 + i32.const -4 + i32.and i32.add - local.tee $2 - i32.store + local.tee $7 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $2 + call $../../runtime/assembly/index/removeBlock + local.get $2 + local.get $6 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $3 + i32.store + local.get $2 + local.set $1 + end end - local.get $3 local.get $4 + local.get $5 i32.const 2 i32.or i32.store - local.get $3 + local.get $4 i32.const 4 i32.sub local.get $1 i32.store local.get $0 - local.get $2 + local.get $3 i32.const -4 i32.and local.tee $2 @@ -253,26 +284,26 @@ local.get $2 i32.const 16 i32.div_u - local.set $2 + local.set $3 i32.const 0 else local.get $2 local.get $2 - call $../../compiler/runtime/asrt/fls - local.tee $3 + call $../../runtime/assembly/index/fls + local.tee $2 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $2 - local.get $3 + local.set $3 + local.get $2 i32.const 7 i32.sub end - local.tee $3 - local.get $2 - call $../../compiler/runtime/asrt/getHead + local.tee $2 + local.get $3 + call $../../runtime/assembly/index/getHead local.set $4 local.get $1 i32.const 0 @@ -287,35 +318,35 @@ i32.store offset=16 end local.get $0 - local.get $3 local.get $2 + local.get $3 local.get $1 - call $../../compiler/runtime/asrt/setHead + call $../../runtime/assembly/index/setHead local.get $0 local.get $0 i32.load i32.const 1 - local.get $3 + local.get $2 i32.shl i32.or i32.store local.get $0 - local.get $3 - local.get $0 - local.get $3 - call $../../compiler/runtime/asrt/getSLMap - i32.const 1 local.get $2 + local.get $0 + local.get $2 + call $../../runtime/assembly/index/getSLMap + i32.const 1 + local.get $3 i32.shl i32.or - call $../../compiler/runtime/asrt/setSLMap + call $../../runtime/assembly/index/setSLMap ) - (func $../../compiler/runtime/asrt/addMemory (; 9 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $../../runtime/assembly/index/addMemory (; 10 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) local.get $2 block (result i32) local.get $0 - i32.load offset=1504 + i32.load offset=1568 local.tee $2 if local.get $1 @@ -369,19 +400,19 @@ i32.store local.get $0 local.get $2 - call $../../compiler/runtime/asrt/setTail + call $../../runtime/assembly/index/setTail local.get $0 local.get $1 - call $../../compiler/runtime/asrt/insertBlock + call $../../runtime/assembly/index/insertBlock ) - (func $../../compiler/runtime/asrt/initialize (; 10 ;) (type $FUNCSIG$i) (result i32) + (func $../../runtime/assembly/index/initialize (; 11 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) - i32.const 16 + i32.const 96 local.tee $3 - i32.const 67043 + i32.const 67107 i32.add i32.const -65536 i32.and @@ -410,17 +441,17 @@ i32.store local.get $0 i32.const 0 - call $../../compiler/runtime/asrt/setTail + call $../../runtime/assembly/index/setTail loop $repeat|0 block $break|0 local.get $2 - i32.const 22 + i32.const 23 i32.ge_u br_if $break|0 local.get $0 local.get $2 i32.const 0 - call $../../compiler/runtime/asrt/setSLMap + call $../../runtime/assembly/index/setSLMap i32.const 0 local.set $1 loop $repeat|1 @@ -433,7 +464,7 @@ local.get $2 local.get $1 i32.const 0 - call $../../compiler/runtime/asrt/setHead + call $../../runtime/assembly/index/setHead local.get $1 i32.const 1 i32.add @@ -450,18 +481,19 @@ end local.get $0 local.get $3 - i32.const 1523 + i32.const 1587 i32.add i32.const -16 i32.and current_memory i32.const 16 i32.shl - call $../../compiler/runtime/asrt/addMemory + call $../../runtime/assembly/index/addMemory local.get $0 ) - (func $../../compiler/runtime/asrt/searchBlock (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $../../runtime/assembly/index/searchBlock (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) + local.get $0 local.get $1 i32.const 256 i32.lt_u @@ -469,11 +501,32 @@ local.get $1 i32.const 16 i32.div_u + local.set $1 + i32.const 0 else + block (result i32) + local.get $1 + i32.const 536870912 + i32.lt_u + if + local.get $1 + i32.const 1 + local.get $1 + call $../../runtime/assembly/index/fls + i32.const 4 + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.set $1 + end + local.get $1 + end + call $../../runtime/assembly/index/fls + local.set $2 local.get $1 - local.get $1 - call $../../compiler/runtime/asrt/fls - local.tee $2 + local.get $2 i32.const 4 i32.sub i32.shr_u @@ -483,26 +536,9 @@ local.get $2 i32.const 7 i32.sub - local.set $2 - local.get $1 - i32.const 15 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.add - else - local.get $2 - i32.const 1 - i32.add - local.set $2 - i32.const 0 - end end - local.set $1 - local.get $0 - local.get $2 - call $../../compiler/runtime/asrt/getSLMap + local.tee $2 + call $../../runtime/assembly/index/getSLMap i32.const -1 local.get $1 i32.shl @@ -513,7 +549,7 @@ local.get $2 local.get $1 i32.ctz - call $../../compiler/runtime/asrt/getHead + call $../../runtime/assembly/index/getHead else local.get $0 i32.load @@ -531,15 +567,15 @@ local.tee $1 local.get $0 local.get $1 - call $../../compiler/runtime/asrt/getSLMap + call $../../runtime/assembly/index/getSLMap i32.ctz - call $../../compiler/runtime/asrt/getHead + call $../../runtime/assembly/index/getHead else i32.const 0 end end ) - (func $../../compiler/runtime/asrt/growMemory (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/growMemory (; 13 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -578,9 +614,9 @@ current_memory i32.const 16 i32.shl - call $../../compiler/runtime/asrt/addMemory + call $../../runtime/assembly/index/addMemory ) - (func $../../compiler/runtime/asrt/prepareBlock (; 13 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $../../runtime/assembly/index/prepareBlock (; 14 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $1 @@ -588,7 +624,7 @@ local.set $3 local.get $0 local.get $1 - call $../../compiler/runtime/asrt/removeBlock + call $../../runtime/assembly/index/removeBlock local.get $3 i32.const -4 i32.and @@ -619,7 +655,7 @@ i32.store local.get $0 local.get $2 - call $../../compiler/runtime/asrt/insertBlock + call $../../runtime/assembly/index/insertBlock else local.get $1 local.get $3 @@ -627,9 +663,9 @@ i32.and i32.store local.get $1 - call $../../compiler/runtime/asrt/getRight + call $../../runtime/assembly/index/getRight local.get $1 - call $../../compiler/runtime/asrt/getRight + call $../../runtime/assembly/index/getRight i32.load i32.const -3 i32.and @@ -639,21 +675,26 @@ i32.const 16 i32.add ) - (func $../../compiler/runtime/asrt/__mm_allocate (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/__mm_allocate (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - global.get $../../compiler/runtime/asrt/ROOT + global.get $../../runtime/assembly/index/ROOT local.tee $2 i32.eqz if - call $../../compiler/runtime/asrt/initialize + call $../../runtime/assembly/index/initialize local.tee $2 - global.set $../../compiler/runtime/asrt/ROOT + global.set $../../runtime/assembly/index/ROOT end local.get $0 i32.const 1073741824 - i32.gt_u + i32.ge_u if + i32.const 0 + i32.const 24 + i32.const 498 + i32.const 29 + call $~lib/builtins/abort unreachable end local.get $2 @@ -670,16 +711,16 @@ i32.gt_u select local.tee $1 - call $../../compiler/runtime/asrt/searchBlock + call $../../runtime/assembly/index/searchBlock local.tee $0 i32.eqz if local.get $2 local.get $1 - call $../../compiler/runtime/asrt/growMemory + call $../../runtime/assembly/index/growMemory local.get $2 local.get $1 - call $../../compiler/runtime/asrt/searchBlock + call $../../runtime/assembly/index/searchBlock local.set $0 end local.get $0 @@ -694,17 +735,17 @@ local.get $2 local.get $0 local.get $1 - call $../../compiler/runtime/asrt/prepareBlock + call $../../runtime/assembly/index/prepareBlock ) - (func $assembly/index/memory.allocate (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/memory.allocate (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - call $../../compiler/runtime/asrt/__mm_allocate + call $../../runtime/assembly/index/__mm_allocate ) - (func $../../compiler/runtime/asrt/__mm_free (; 16 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $../../runtime/assembly/index/__mm_free (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 if - global.get $../../compiler/runtime/asrt/ROOT + global.get $../../runtime/assembly/index/ROOT local.tee $1 if local.get $0 @@ -718,15 +759,251 @@ i32.store local.get $1 local.get $0 - call $../../compiler/runtime/asrt/insertBlock + call $../../runtime/assembly/index/insertBlock end end ) - (func $assembly/index/memory.free (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/memory.free (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - call $../../compiler/runtime/asrt/__mm_free + call $../../runtime/assembly/index/__mm_free ) - (func $null (; 18 ;) (type $FUNCSIG$v) + (func $~lib/memory/memory.fill (; 19 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + block $~lib/util/memory/memset|inlined.0 + local.get $2 + i32.eqz + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 1 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 2 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 1 + i32.add + local.get $1 + i32.store8 + local.get $0 + i32.const 2 + i32.add + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 2 + i32.sub + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 3 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 6 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 3 + i32.add + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 4 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 8 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + i32.const 0 + local.get $0 + i32.sub + i32.const 3 + i32.and + local.tee $4 + local.get $0 + i32.add + local.tee $0 + local.get $1 + i32.const 255 + i32.and + i32.const 16843009 + i32.mul + local.tee $1 + i32.store + local.get $2 + local.get $4 + i32.sub + i32.const -4 + i32.and + local.tee $2 + local.get $0 + i32.add + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $2 + i32.const 8 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 12 + i32.sub + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 8 + i32.sub + local.get $1 + i32.store + local.get $2 + i32.const 24 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.store + local.get $0 + i32.const 16 + i32.add + local.get $1 + i32.store + local.get $0 + i32.const 20 + i32.add + local.get $1 + i32.store + local.get $0 + i32.const 24 + i32.add + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 28 + i32.sub + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 24 + i32.sub + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 20 + i32.sub + local.get $1 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.get $1 + i32.store + local.get $0 + i32.const 4 + i32.and + i32.const 24 + i32.add + local.tee $4 + local.get $0 + i32.add + local.set $0 + local.get $2 + local.get $4 + i32.sub + local.set $2 + local.get $1 + i64.extend_i32_u + local.get $1 + i64.extend_i32_u + i64.const 32 + i64.shl + i64.or + local.set $3 + loop $continue|0 + local.get $2 + i32.const 32 + i32.ge_u + if + local.get $0 + local.get $3 + i64.store + local.get $0 + i32.const 8 + i32.add + local.get $3 + i64.store + local.get $0 + i32.const 16 + i32.add + local.get $3 + i64.store + local.get $0 + i32.const 24 + i32.add + local.get $3 + i64.store + local.get $2 + i32.const 32 + i32.sub + local.set $2 + local.get $0 + i32.const 32 + i32.add + local.set $0 + br $continue|0 + end + end + end + ) + (func $assembly/index/memory.fill (; 20 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $0 + local.get $1 + local.get $2 + call $~lib/memory/memory.fill + ) + (func $null (; 21 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/allocators/asrt/untouched.wat b/tests/allocators/asrt/untouched.wat index b9d111da..6b298ee2 100644 --- a/tests/allocators/asrt/untouched.wat +++ b/tests/allocators/asrt/untouched.wat @@ -1,38 +1,39 @@ (module (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$i (func (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) - (data (i32.const 8) "\10\00\00\00<\00\00\00\00\00\00\00\00\00\00\00.\00.\00/\00.\00.\00/\00c\00o\00m\00p\00i\00l\00e\00r\00/\00r\00u\00n\00t\00i\00m\00e\00/\00a\00s\00r\00t\00.\00t\00s\00") + (data (i32.const 8) "\10\00\00\00>\00\00\00\00\00\00\00\00\00\00\00.\00.\00/\00.\00.\00/\00r\00u\00n\00t\00i\00m\00e\00/\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00d\00e\00x\00.\00t\00s\00") (table $0 1 funcref) (elem (i32.const 0) $null) - (global $../../compiler/runtime/asrt/ROOT (mut i32) (i32.const 0)) - (global $../../compiler/runtime/asrt/ACYCLIC_FLAG i32 (i32.const 0)) - (global $~lib/memory/HEAP_BASE i32 (i32.const 84)) + (global $../../runtime/assembly/index/ROOT (mut i32) (i32.const 0)) + (global $../../runtime/assembly/index/ACYCLIC_FLAG i32 (i32.const 0)) + (global $~lib/memory/HEAP_BASE i32 (i32.const 88)) (export "memory" (memory $0)) (export "memory.allocate" (func $assembly/index/memory.allocate)) (export "memory.free" (func $assembly/index/memory.free)) - (func $../../compiler/runtime/asrt/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (export "memory.fill" (func $assembly/index/memory.fill)) + (func $../../runtime/assembly/index/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) local.get $0 local.get $1 - i32.store offset=1504 + i32.store offset=1568 ) - (func $../../compiler/runtime/asrt/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $../../runtime/assembly/index/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u i32.eqz if i32.const 0 i32.const 24 - i32.const 164 + i32.const 175 i32.const 13 call $~lib/builtins/abort unreachable @@ -45,9 +46,9 @@ local.get $2 i32.store offset=4 ) - (func $../../compiler/runtime/asrt/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../runtime/assembly/index/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u if (result i32) local.get $2 @@ -60,7 +61,7 @@ if i32.const 0 i32.const 24 - i32.const 178 + i32.const 189 i32.const 13 call $~lib/builtins/abort unreachable @@ -77,11 +78,11 @@ local.get $3 i32.store offset=96 ) - (func $../../compiler/runtime/asrt/getTail (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/getTail (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - i32.load offset=1504 + i32.load offset=1568 ) - (func $../../compiler/runtime/asrt/getRight (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/getRight (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) local.get $0 @@ -96,7 +97,7 @@ if i32.const 0 i32.const 24 - i32.const 111 + i32.const 122 i32.const 13 call $~lib/builtins/abort unreachable @@ -116,14 +117,14 @@ if i32.const 0 i32.const 24 - i32.const 113 + i32.const 124 i32.const 13 call $~lib/builtins/abort unreachable end local.get $2 ) - (func $../../compiler/runtime/asrt/fls (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/fls (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 0 i32.ne @@ -131,7 +132,7 @@ if i32.const 0 i32.const 24 - i32.const 472 + i32.const 481 i32.const 13 call $~lib/builtins/abort unreachable @@ -141,9 +142,9 @@ i32.clz i32.sub ) - (func $../../compiler/runtime/asrt/getHead (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $../../runtime/assembly/index/getHead (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u if (result i32) local.get $2 @@ -156,7 +157,7 @@ if i32.const 0 i32.const 24 - i32.const 169 + i32.const 180 i32.const 13 call $~lib/builtins/abort unreachable @@ -172,15 +173,15 @@ i32.add i32.load offset=96 ) - (func $../../compiler/runtime/asrt/getSLMap (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $../../runtime/assembly/index/getSLMap (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u i32.eqz if i32.const 0 i32.const 24 - i32.const 159 + i32.const 170 i32.const 13 call $~lib/builtins/abort unreachable @@ -192,7 +193,7 @@ i32.add i32.load offset=4 ) - (func $../../compiler/runtime/asrt/removeBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/removeBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -210,7 +211,7 @@ if i32.const 0 i32.const 24 - i32.const 259 + i32.const 275 i32.const 13 call $~lib/builtins/abort unreachable @@ -235,7 +236,7 @@ if i32.const 0 i32.const 24 - i32.const 261 + i32.const 277 i32.const 13 call $~lib/builtins/abort unreachable @@ -252,7 +253,7 @@ local.set $5 else local.get $3 - call $../../compiler/runtime/asrt/fls + call $../../runtime/assembly/index/fls local.set $4 local.get $3 local.get $4 @@ -293,20 +294,20 @@ local.get $0 local.get $4 local.get $5 - call $../../compiler/runtime/asrt/getHead + call $../../runtime/assembly/index/getHead i32.eq if local.get $0 local.get $4 local.get $5 local.get $7 - call $../../compiler/runtime/asrt/setHead + call $../../runtime/assembly/index/setHead local.get $7 i32.eqz if local.get $0 local.get $4 - call $../../compiler/runtime/asrt/getSLMap + call $../../runtime/assembly/index/getSLMap local.set $8 local.get $0 local.get $4 @@ -318,7 +319,7 @@ i32.xor i32.and local.tee $8 - call $../../compiler/runtime/asrt/setSLMap + call $../../runtime/assembly/index/setSLMap local.get $8 i32.eqz if @@ -336,7 +337,7 @@ end end ) - (func $../../compiler/runtime/asrt/getLeft (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/getLeft (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 i32.load @@ -346,7 +347,7 @@ if i32.const 0 i32.const 24 - i32.const 102 + i32.const 113 i32.const 13 call $~lib/builtins/abort unreachable @@ -361,14 +362,14 @@ if i32.const 0 i32.const 24 - i32.const 104 + i32.const 115 i32.const 13 call $~lib/builtins/abort unreachable end local.get $1 ) - (func $../../compiler/runtime/asrt/insertBlock (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/insertBlock (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -378,12 +379,13 @@ (local $8 i32) (local $9 i32) (local $10 i32) + (local $11 i32) local.get $1 i32.eqz if i32.const 0 i32.const 24 - i32.const 194 + i32.const 205 i32.const 13 call $~lib/builtins/abort unreachable @@ -398,13 +400,13 @@ if i32.const 0 i32.const 24 - i32.const 196 + i32.const 207 i32.const 13 call $~lib/builtins/abort unreachable end local.get $1 - call $../../compiler/runtime/asrt/getRight + call $../../runtime/assembly/index/getRight local.set $3 local.get $3 i32.load @@ -413,34 +415,49 @@ i32.const 1 i32.and if - local.get $0 - local.get $3 - call $../../compiler/runtime/asrt/removeBlock - local.get $1 local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and i32.const 16 + i32.add local.get $4 i32.const 3 i32.const -1 i32.xor i32.and i32.add - i32.add - local.tee $2 - i32.store - local.get $1 - call $../../compiler/runtime/asrt/getRight - local.set $3 - local.get $3 - i32.load - local.set $4 + local.set $5 + local.get $5 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $3 + call $../../runtime/assembly/index/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $5 + i32.or + local.tee $2 + i32.store + local.get $1 + call $../../runtime/assembly/index/getRight + local.set $3 + local.get $3 + i32.load + local.set $4 + end end local.get $2 i32.const 2 i32.and if local.get $1 - call $../../compiler/runtime/asrt/getLeft + call $../../runtime/assembly/index/getLeft local.set $5 local.get $5 i32.load @@ -452,30 +469,43 @@ if i32.const 0 i32.const 24 - i32.const 214 + i32.const 228 i32.const 15 call $~lib/builtins/abort unreachable end - local.get $0 - local.get $5 - call $../../compiler/runtime/asrt/removeBlock - local.get $5 local.get $6 + i32.const 3 + i32.const -1 + i32.xor + i32.and i32.const 16 + i32.add local.get $2 i32.const 3 i32.const -1 i32.xor i32.and i32.add - i32.add - local.tee $6 - i32.store - local.get $5 - local.set $1 - local.get $6 - local.set $2 + local.set $7 + local.get $7 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $5 + call $../../runtime/assembly/index/removeBlock + local.get $5 + local.get $6 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $5 + local.set $1 + end end local.get $3 local.get $4 @@ -487,12 +517,12 @@ i32.const -1 i32.xor i32.and - local.set $7 - local.get $7 + local.set $8 + local.get $8 i32.const 16 i32.ge_u if (result i32) - local.get $7 + local.get $8 i32.const 1073741824 i32.lt_u else @@ -502,7 +532,7 @@ if i32.const 0 i32.const 24 - i32.const 227 + i32.const 243 i32.const 13 call $~lib/builtins/abort unreachable @@ -510,7 +540,7 @@ local.get $1 i32.const 16 i32.add - local.get $7 + local.get $8 i32.add local.get $3 i32.eq @@ -518,7 +548,7 @@ if i32.const 0 i32.const 24 - i32.const 228 + i32.const 244 i32.const 13 call $~lib/builtins/abort unreachable @@ -528,22 +558,22 @@ i32.sub local.get $1 i32.store - local.get $7 + local.get $8 i32.const 256 i32.lt_u if i32.const 0 - local.set $8 - local.get $7 + local.set $9 + local.get $8 i32.const 16 i32.div_u - local.set $9 + local.set $10 else - local.get $7 - call $../../compiler/runtime/asrt/fls - local.set $8 - local.get $7 local.get $8 + call $../../runtime/assembly/index/fls + local.set $9 + local.get $8 + local.get $9 i32.const 4 i32.sub i32.shr_u @@ -551,56 +581,56 @@ i32.const 4 i32.shl i32.xor - local.set $9 - local.get $8 + local.set $10 + local.get $9 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $8 + local.set $9 end local.get $0 - local.get $8 local.get $9 - call $../../compiler/runtime/asrt/getHead - local.set $10 + local.get $10 + call $../../runtime/assembly/index/getHead + local.set $11 local.get $1 i32.const 0 i32.store offset=16 local.get $1 - local.get $10 + local.get $11 i32.store offset=20 - local.get $10 + local.get $11 if - local.get $10 + local.get $11 local.get $1 i32.store offset=16 end local.get $0 - local.get $8 local.get $9 + local.get $10 local.get $1 - call $../../compiler/runtime/asrt/setHead + call $../../runtime/assembly/index/setHead local.get $0 local.get $0 i32.load i32.const 1 - local.get $8 + local.get $9 i32.shl i32.or i32.store local.get $0 - local.get $8 - local.get $0 - local.get $8 - call $../../compiler/runtime/asrt/getSLMap - i32.const 1 local.get $9 + local.get $0 + local.get $9 + call $../../runtime/assembly/index/getSLMap + i32.const 1 + local.get $10 i32.shl i32.or - call $../../compiler/runtime/asrt/setSLMap + call $../../runtime/assembly/index/setSLMap ) - (func $../../compiler/runtime/asrt/addMemory (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $../../runtime/assembly/index/addMemory (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -629,13 +659,13 @@ if i32.const 0 i32.const 24 - i32.const 371 + i32.const 387 i32.const 4 call $~lib/builtins/abort unreachable end local.get $0 - call $../../compiler/runtime/asrt/getTail + call $../../runtime/assembly/index/getTail local.set $3 i32.const 0 local.set $4 @@ -650,7 +680,7 @@ if i32.const 0 i32.const 24 - i32.const 381 + i32.const 397 i32.const 15 call $~lib/builtins/abort unreachable @@ -674,14 +704,14 @@ else local.get $1 local.get $0 - i32.const 1508 + i32.const 1572 i32.add i32.ge_u i32.eqz if i32.const 0 i32.const 24 - i32.const 393 + i32.const 409 i32.const 4 call $~lib/builtins/abort unreachable @@ -738,47 +768,19 @@ i32.store local.get $0 local.get $3 - call $../../compiler/runtime/asrt/setTail + call $../../runtime/assembly/index/setTail local.get $0 local.get $7 - call $../../compiler/runtime/asrt/insertBlock + call $../../runtime/assembly/index/insertBlock i32.const 1 ) - (func $../../compiler/runtime/asrt/initialize (; 13 ;) (type $FUNCSIG$i) (result i32) + (func $../../runtime/assembly/index/initialize (; 13 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - i32.const 256 - i32.const 256 - i32.eq - if (result i32) - i32.const 22 - i32.const 22 - i32.eq - else - i32.const 0 - end - if (result i32) - i32.const 22 - i32.const 16 - i32.mul - i32.const 352 - i32.eq - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 434 - i32.const 4 - call $~lib/builtins/abort - unreachable - end global.get $~lib/memory/HEAP_BASE i32.const 15 i32.add @@ -790,7 +792,7 @@ current_memory local.set $1 local.get $0 - i32.const 1508 + i32.const 1572 i32.add i32.const 65535 i32.add @@ -824,13 +826,13 @@ i32.store local.get $3 i32.const 0 - call $../../compiler/runtime/asrt/setTail + call $../../runtime/assembly/index/setTail block $break|0 i32.const 0 local.set $4 loop $repeat|0 local.get $4 - i32.const 22 + i32.const 23 i32.lt_u i32.eqz br_if $break|0 @@ -838,7 +840,7 @@ local.get $3 local.get $4 i32.const 0 - call $../../compiler/runtime/asrt/setSLMap + call $../../runtime/assembly/index/setSLMap block $break|1 i32.const 0 local.set $5 @@ -852,7 +854,7 @@ local.get $4 local.get $5 i32.const 0 - call $../../compiler/runtime/asrt/setHead + call $../../runtime/assembly/index/setHead local.get $5 i32.const 1 i32.add @@ -874,7 +876,7 @@ end local.get $3 local.get $0 - i32.const 1508 + i32.const 1572 i32.add i32.const 15 i32.add @@ -885,11 +887,11 @@ current_memory i32.const 16 i32.shl - call $../../compiler/runtime/asrt/addMemory + call $../../runtime/assembly/index/addMemory drop local.get $3 ) - (func $../../compiler/runtime/asrt/ffs (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/ffs (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 0 i32.ne @@ -897,7 +899,7 @@ if i32.const 0 i32.const 24 - i32.const 466 + i32.const 475 i32.const 13 call $~lib/builtins/abort unreachable @@ -905,7 +907,7 @@ local.get $0 i32.ctz ) - (func $../../compiler/runtime/asrt/ffs (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/ffs (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 0 i32.ne @@ -913,7 +915,7 @@ if i32.const 0 i32.const 24 - i32.const 466 + i32.const 475 i32.const 13 call $~lib/builtins/abort unreachable @@ -921,7 +923,7 @@ local.get $0 i32.ctz ) - (func $../../compiler/runtime/asrt/searchBlock (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $../../runtime/assembly/index/searchBlock (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -939,9 +941,27 @@ local.set $3 else local.get $1 - call $../../compiler/runtime/asrt/fls + i32.const 536870912 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + local.get $1 + call $../../runtime/assembly/index/fls + i32.const 4 + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + local.get $4 + call $../../runtime/assembly/index/fls local.set $2 - local.get $1 + local.get $4 local.get $2 i32.const 4 i32.sub @@ -957,36 +977,18 @@ i32.sub i32.sub local.set $2 - local.get $3 - i32.const 16 - i32.const 1 - i32.sub - i32.lt_u - if - local.get $3 - i32.const 1 - i32.add - local.set $3 - else - local.get $2 - i32.const 1 - i32.add - local.set $2 - i32.const 0 - local.set $3 - end end local.get $0 local.get $2 - call $../../compiler/runtime/asrt/getSLMap + call $../../runtime/assembly/index/getSLMap i32.const 0 i32.const -1 i32.xor local.get $3 i32.shl i32.and - local.set $4 - local.get $4 + local.set $5 + local.get $5 i32.eqz if local.get $0 @@ -999,48 +1001,48 @@ i32.add i32.shl i32.and - local.set $6 - local.get $6 + local.set $4 + local.get $4 i32.eqz if i32.const 0 - local.set $5 + local.set $6 else - local.get $6 - call $../../compiler/runtime/asrt/ffs + local.get $4 + call $../../runtime/assembly/index/ffs local.set $2 local.get $0 local.get $2 - call $../../compiler/runtime/asrt/getSLMap - local.set $4 - local.get $4 + call $../../runtime/assembly/index/getSLMap + local.set $5 + local.get $5 i32.eqz if i32.const 0 i32.const 24 - i32.const 328 + i32.const 344 i32.const 17 call $~lib/builtins/abort unreachable end local.get $0 local.get $2 - local.get $4 - call $../../compiler/runtime/asrt/ffs - call $../../compiler/runtime/asrt/getHead - local.set $5 + local.get $5 + call $../../runtime/assembly/index/ffs + call $../../runtime/assembly/index/getHead + local.set $6 end else local.get $0 local.get $2 - local.get $4 - call $../../compiler/runtime/asrt/ffs - call $../../compiler/runtime/asrt/getHead - local.set $5 + local.get $5 + call $../../runtime/assembly/index/ffs + call $../../runtime/assembly/index/getHead + local.set $6 end - local.get $5 + local.get $6 ) - (func $../../compiler/runtime/asrt/growMemory (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/growMemory (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1090,10 +1092,10 @@ local.get $7 i32.const 16 i32.shl - call $../../compiler/runtime/asrt/addMemory + call $../../runtime/assembly/index/addMemory drop ) - (func $../../compiler/runtime/asrt/prepareBlock (; 18 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $../../runtime/assembly/index/prepareBlock (; 18 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1117,14 +1119,14 @@ if i32.const 0 i32.const 24 - i32.const 343 + i32.const 359 i32.const 4 call $~lib/builtins/abort unreachable end local.get $0 local.get $1 - call $../../compiler/runtime/asrt/removeBlock + call $../../runtime/assembly/index/removeBlock local.get $3 i32.const 3 i32.const -1 @@ -1161,7 +1163,7 @@ i32.store local.get $0 local.get $5 - call $../../compiler/runtime/asrt/insertBlock + call $../../runtime/assembly/index/insertBlock else local.get $1 local.get $3 @@ -1171,9 +1173,9 @@ i32.and i32.store local.get $1 - call $../../compiler/runtime/asrt/getRight + call $../../runtime/assembly/index/getRight local.get $1 - call $../../compiler/runtime/asrt/getRight + call $../../runtime/assembly/index/getRight i32.load i32.const 2 i32.const -1 @@ -1185,24 +1187,29 @@ i32.const 16 i32.add ) - (func $../../compiler/runtime/asrt/__mm_allocate (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $../../runtime/assembly/index/__mm_allocate (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) - global.get $../../compiler/runtime/asrt/ROOT + global.get $../../runtime/assembly/index/ROOT local.set $1 local.get $1 i32.eqz if - call $../../compiler/runtime/asrt/initialize + call $../../runtime/assembly/index/initialize local.tee $1 - global.set $../../compiler/runtime/asrt/ROOT + global.set $../../runtime/assembly/index/ROOT end local.get $0 i32.const 1073741824 - i32.gt_u + i32.ge_u if + i32.const 0 + i32.const 24 + i32.const 498 + i32.const 29 + call $~lib/builtins/abort unreachable end local.get $0 @@ -1222,24 +1229,24 @@ local.set $0 local.get $1 local.get $0 - call $../../compiler/runtime/asrt/searchBlock + call $../../runtime/assembly/index/searchBlock local.set $4 local.get $4 i32.eqz if local.get $1 local.get $0 - call $../../compiler/runtime/asrt/growMemory + call $../../runtime/assembly/index/growMemory local.get $1 local.get $0 - call $../../compiler/runtime/asrt/searchBlock + call $../../runtime/assembly/index/searchBlock local.set $4 local.get $4 i32.eqz if i32.const 0 i32.const 24 - i32.const 495 + i32.const 504 i32.const 15 call $~lib/builtins/abort unreachable @@ -1257,7 +1264,7 @@ if i32.const 0 i32.const 24 - i32.const 497 + i32.const 506 i32.const 13 call $~lib/builtins/abort unreachable @@ -1274,13 +1281,13 @@ local.get $1 local.get $4 local.get $0 - call $../../compiler/runtime/asrt/prepareBlock + call $../../runtime/assembly/index/prepareBlock ) (func $assembly/index/memory.allocate (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - call $../../compiler/runtime/asrt/__mm_allocate + call $../../runtime/assembly/index/__mm_allocate ) - (func $../../compiler/runtime/asrt/freeBlock (; 21 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $../../runtime/assembly/index/freeBlock (; 21 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) local.get $1 i32.load @@ -1293,7 +1300,7 @@ if i32.const 0 i32.const 24 - i32.const 459 + i32.const 468 i32.const 2 call $~lib/builtins/abort unreachable @@ -1305,9 +1312,9 @@ i32.store local.get $0 local.get $1 - call $../../compiler/runtime/asrt/insertBlock + call $../../runtime/assembly/index/insertBlock ) - (func $../../compiler/runtime/asrt/__mm_free (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $../../runtime/assembly/index/__mm_free (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 if @@ -1319,12 +1326,12 @@ if i32.const 0 i32.const 24 - i32.const 508 + i32.const 517 i32.const 4 call $~lib/builtins/abort unreachable end - global.get $../../compiler/runtime/asrt/ROOT + global.get $../../runtime/assembly/index/ROOT local.set $1 local.get $1 if @@ -1332,14 +1339,277 @@ local.get $0 i32.const 16 i32.sub - call $../../compiler/runtime/asrt/freeBlock + call $../../runtime/assembly/index/freeBlock end end ) (func $assembly/index/memory.free (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - call $../../compiler/runtime/asrt/__mm_free + call $../../runtime/assembly/index/__mm_free ) - (func $null (; 24 ;) (type $FUNCSIG$v) + (func $~lib/memory/memory.fill (; 24 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i64) + block $~lib/util/memory/memset|inlined.0 + local.get $2 + i32.eqz + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $0 + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 1 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 2 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $0 + i32.const 1 + i32.add + local.get $1 + i32.store8 + local.get $0 + i32.const 2 + i32.add + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 2 + i32.sub + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 3 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 6 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $0 + i32.const 3 + i32.add + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 4 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 8 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + i32.const 0 + local.get $0 + i32.sub + i32.const 3 + i32.and + local.set $5 + local.get $0 + local.get $5 + i32.add + local.set $0 + local.get $2 + local.get $5 + i32.sub + local.set $2 + local.get $2 + i32.const -4 + i32.and + local.set $2 + i32.const -1 + i32.const 255 + i32.div_u + local.get $1 + i32.const 255 + i32.and + i32.mul + local.set $4 + local.get $0 + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 4 + i32.sub + local.get $4 + i32.store + local.get $2 + i32.const 8 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 12 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 8 + i32.sub + local.get $4 + i32.store + local.get $2 + i32.const 24 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 16 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 20 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 24 + i32.add + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 28 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 24 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 20 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.get $4 + i32.store + i32.const 24 + local.get $0 + i32.const 4 + i32.and + i32.add + local.set $5 + local.get $0 + local.get $5 + i32.add + local.set $0 + local.get $2 + local.get $5 + i32.sub + local.set $2 + local.get $4 + i64.extend_i32_u + local.get $4 + i64.extend_i32_u + i64.const 32 + i64.shl + i64.or + local.set $6 + block $break|0 + loop $continue|0 + local.get $2 + i32.const 32 + i32.ge_u + if + block + local.get $0 + local.get $6 + i64.store + local.get $0 + i32.const 8 + i32.add + local.get $6 + i64.store + local.get $0 + i32.const 16 + i32.add + local.get $6 + i64.store + local.get $0 + i32.const 24 + i32.add + local.get $6 + i64.store + local.get $2 + i32.const 32 + i32.sub + local.set $2 + local.get $0 + i32.const 32 + i32.add + local.set $0 + end + br $continue|0 + end + end + end + end + ) + (func $assembly/index/memory.fill (; 25 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $0 + local.get $1 + local.get $2 + call $~lib/memory/memory.fill + ) + (func $null (; 26 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/allocators/runner.js b/tests/allocators/runner.js index 1a7bdaa5..b8d39637 100644 --- a/tests/allocators/runner.js +++ b/tests/allocators/runner.js @@ -1,5 +1,3 @@ -const useFill = false; - function runner(exports, runs, allocs) { const alloc = exports["memory.allocate"]; const free = exports["memory.free"]; @@ -16,7 +14,7 @@ function runner(exports, runs, allocs) { if (!ptr) throw Error(); if ((ptr & 7) != 0) throw Error("invalid alignment: " + (ptr & 7) + " on " + ptr); if (ptrs.indexOf(ptr) >= 0) throw Error("duplicate pointer"); - if (useFill) fill(ptr, 0xdc, size); + if (fill) fill(ptr, ptr % 8, size); ptrs.push(ptr); return ptr; } @@ -86,14 +84,14 @@ function runner(exports, runs, allocs) { // SL+1 for allocations in TLSF var size = ((exports.memory.buffer.byteLength - base) * 9 / 10) >>> 0; var ptr = alloc(size); - if (useFill) fill(ptr, 0xac, size); + // if (fill) fill(ptr, 0xac, size); if (ptr !== base) throw Error("expected " + base + " but got " + ptr); free(ptr); } testMemChanged(); } } finally { - // mem(allocator.memory, 0, 0x10000); + // mem(exports.memory, 0, 0x800); } } diff --git a/tests/compiler/runtime/asrt.optimized.wat b/tests/compiler/runtime/asrt.optimized.wat deleted file mode 100644 index 1a537ab1..00000000 --- a/tests/compiler/runtime/asrt.optimized.wat +++ /dev/null @@ -1,1461 +0,0 @@ -(module - (type $FUNCSIG$ii (func (param i32) (result i32))) - (type $FUNCSIG$i (func (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) - (type $FUNCSIG$vii (func (param i32 i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) - (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - (type $FUNCSIG$vi (func (param i32))) - (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 8) "\10\00\00\00\1e") - (data (i32.const 24) "r\00u\00n\00t\00i\00m\00e\00/\00a\00s\00r\00t\00.\00t\00s") - (data (i32.const 56) "\10\00\00\00\1c") - (data (i32.const 72) "~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s") - (global $runtime/asrt/ROOT (mut i32) (i32.const 0)) - (global $runtime/asrt/CUR (mut i32) (i32.const 0)) - (global $runtime/asrt/ROOTS (mut i32) (i32.const 0)) - (export "memory" (memory $0)) - (export "__mm_allocate" (func $runtime/asrt/__mm_allocate)) - (export "__mm_free" (func $runtime/asrt/__mm_free)) - (export "__rt_visit" (func $runtime/asrt/__rt_visit)) - (export "__gc_retain" (func $runtime/asrt/__gc_retain)) - (export "__gc_release" (func $runtime/asrt/__gc_release)) - (export "__gc_collect" (func $runtime/asrt/collectCycles)) - (func $runtime/asrt/setSLMap (; 1 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - local.get $1 - i32.const 22 - i32.ge_u - if - i32.const 0 - i32.const 24 - i32.const 164 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 2 - i32.shl - local.get $0 - i32.add - local.get $2 - i32.store offset=4 - ) - (func $runtime/asrt/setHead (; 2 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) - local.get $2 - i32.const 16 - i32.lt_u - i32.const 0 - local.get $1 - i32.const 22 - i32.lt_u - select - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 178 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 4 - i32.shl - local.get $2 - i32.add - i32.const 2 - i32.shl - local.get $0 - i32.add - local.get $3 - i32.store offset=96 - ) - (func $runtime/asrt/getRight (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - i32.load - local.tee $1 - i32.const -4 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 111 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 16 - i32.add - local.get $1 - i32.const -4 - i32.and - i32.add - local.tee $0 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 113 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $0 - ) - (func $runtime/asrt/fls (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 472 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - i32.const 31 - local.get $0 - i32.clz - i32.sub - ) - (func $runtime/asrt/getHead (; 5 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $2 - i32.const 16 - i32.lt_u - i32.const 0 - local.get $1 - i32.const 22 - i32.lt_u - select - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 169 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 4 - i32.shl - local.get $2 - i32.add - i32.const 2 - i32.shl - local.get $0 - i32.add - i32.load offset=96 - ) - (func $runtime/asrt/getSLMap (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - local.get $1 - i32.const 22 - i32.ge_u - if - i32.const 0 - i32.const 24 - i32.const 159 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 2 - i32.shl - local.get $0 - i32.add - i32.load offset=4 - ) - (func $runtime/asrt/removeBlock (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.tee $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 259 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const -4 - i32.and - local.tee $2 - i32.const 16 - i32.ge_u - if (result i32) - local.get $2 - i32.const 1073741824 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 261 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 256 - i32.lt_u - if (result i32) - local.get $2 - i32.const 16 - i32.div_u - local.set $4 - i32.const 0 - else - local.get $2 - local.get $2 - call $runtime/asrt/fls - local.tee $3 - i32.const 4 - i32.sub - i32.shr_u - i32.const 16 - i32.xor - local.set $4 - local.get $3 - i32.const 7 - i32.sub - end - local.set $3 - local.get $1 - i32.load offset=20 - local.set $2 - local.get $1 - i32.load offset=16 - local.tee $5 - if - local.get $5 - local.get $2 - i32.store offset=20 - end - local.get $2 - if - local.get $2 - local.get $5 - i32.store offset=16 - end - local.get $0 - local.get $3 - local.get $4 - call $runtime/asrt/getHead - local.get $1 - i32.eq - if - local.get $0 - local.get $3 - local.get $4 - local.get $2 - call $runtime/asrt/setHead - local.get $2 - i32.eqz - if - local.get $0 - local.get $3 - local.get $0 - local.get $3 - call $runtime/asrt/getSLMap - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - local.tee $1 - call $runtime/asrt/setSLMap - local.get $1 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $3 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $runtime/asrt/getLeft (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.load - i32.const 2 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 102 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - i32.sub - i32.load - local.tee $0 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 104 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $0 - ) - (func $runtime/asrt/insertBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 194 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.tee $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 196 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $1 - call $runtime/asrt/getRight - local.tee $5 - i32.load - local.tee $4 - i32.const 1 - i32.and - if - local.get $0 - local.get $5 - call $runtime/asrt/removeBlock - local.get $1 - local.get $4 - i32.const -4 - i32.and - i32.const 16 - i32.add - local.get $3 - i32.add - local.tee $3 - i32.store - local.get $1 - call $runtime/asrt/getRight - local.tee $5 - i32.load - local.set $4 - end - local.get $3 - i32.const 2 - i32.and - if - local.get $1 - call $runtime/asrt/getLeft - local.tee $1 - i32.load - local.tee $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 214 - i32.const 15 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - call $runtime/asrt/removeBlock - local.get $1 - local.get $3 - i32.const -4 - i32.and - i32.const 16 - i32.add - local.get $2 - i32.add - local.tee $3 - i32.store - end - local.get $5 - local.get $4 - i32.const 2 - i32.or - i32.store - local.get $3 - i32.const -4 - i32.and - local.tee $2 - i32.const 16 - i32.ge_u - if (result i32) - local.get $2 - i32.const 1073741824 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 227 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $5 - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 228 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $5 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $0 - local.get $2 - i32.const 256 - i32.lt_u - if (result i32) - local.get $2 - i32.const 16 - i32.div_u - local.set $2 - i32.const 0 - else - local.get $2 - local.get $2 - call $runtime/asrt/fls - local.tee $3 - i32.const 4 - i32.sub - i32.shr_u - i32.const 16 - i32.xor - local.set $2 - local.get $3 - i32.const 7 - i32.sub - end - local.tee $4 - local.get $2 - call $runtime/asrt/getHead - local.set $3 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $3 - i32.store offset=20 - local.get $3 - if - local.get $3 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.get $4 - local.get $2 - local.get $1 - call $runtime/asrt/setHead - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.or - i32.store - local.get $0 - local.get $4 - local.get $0 - local.get $4 - call $runtime/asrt/getSLMap - i32.const 1 - local.get $2 - i32.shl - i32.or - call $runtime/asrt/setSLMap - ) - (func $runtime/asrt/addMemory (; 10 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.const 0 - local.get $1 - i32.const 15 - i32.and - i32.eqz - i32.const 0 - local.get $1 - local.get $2 - i32.le_u - select - select - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 371 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load offset=1504 - local.tee $3 - if - local.get $1 - local.get $3 - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - i32.const 24 - i32.const 381 - i32.const 15 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.sub - local.get $3 - i32.eq - if - local.get $3 - i32.load - local.set $4 - local.get $1 - i32.const 16 - i32.sub - local.set $1 - end - else - local.get $1 - local.get $0 - i32.const 1508 - i32.add - i32.lt_u - if - i32.const 0 - i32.const 24 - i32.const 393 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.tee $2 - i32.const 48 - i32.lt_u - if - return - end - local.get $1 - local.get $4 - i32.const 2 - i32.and - local.get $2 - i32.const 32 - i32.sub - i32.const 1 - i32.or - i32.or - i32.store - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $2 - i32.add - i32.const 16 - i32.sub - local.tee $2 - i32.const 2 - i32.store - local.get $0 - local.get $2 - i32.store offset=1504 - local.get $0 - local.get $1 - call $runtime/asrt/insertBlock - ) - (func $runtime/asrt/initialize (; 11 ;) (type $FUNCSIG$i) (result i32) - (local $0 i32) - (local $1 i32) - i32.const 1 - current_memory - local.tee $0 - i32.gt_s - if (result i32) - i32.const 1 - local.get $0 - i32.sub - grow_memory - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - i32.const 112 - i32.const 0 - i32.store - i32.const 1616 - i32.const 0 - i32.store - i32.const 0 - local.set $0 - loop $repeat|0 - local.get $0 - i32.const 22 - i32.lt_u - if - i32.const 112 - local.get $0 - i32.const 0 - call $runtime/asrt/setSLMap - i32.const 0 - local.set $1 - loop $repeat|1 - local.get $1 - i32.const 16 - i32.lt_u - if - i32.const 112 - local.get $0 - local.get $1 - i32.const 0 - call $runtime/asrt/setHead - local.get $1 - i32.const 1 - i32.add - local.set $1 - br $repeat|1 - end - end - local.get $0 - i32.const 1 - i32.add - local.set $0 - br $repeat|0 - end - end - i32.const 112 - i32.const 1632 - current_memory - i32.const 16 - i32.shl - call $runtime/asrt/addMemory - i32.const 112 - ) - (func $runtime/asrt/ffs (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 466 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.ctz - ) - (func $runtime/asrt/searchBlock (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - local.get $1 - i32.const 256 - i32.lt_u - if (result i32) - local.get $1 - i32.const 16 - i32.div_u - else - local.get $1 - call $runtime/asrt/fls - local.tee $3 - i32.const 7 - i32.sub - local.set $2 - local.get $1 - local.get $3 - i32.const 4 - i32.sub - i32.shr_u - i32.const 16 - i32.xor - local.tee $1 - i32.const 15 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.add - else - local.get $2 - i32.const 1 - i32.add - local.set $2 - i32.const 0 - end - end - local.set $1 - local.get $0 - local.get $2 - call $runtime/asrt/getSLMap - i32.const -1 - local.get $1 - i32.shl - i32.and - local.tee $1 - if (result i32) - local.get $0 - local.get $2 - local.get $1 - call $runtime/asrt/ffs - call $runtime/asrt/getHead - else - local.get $0 - i32.load - i32.const -1 - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.tee $1 - if (result i32) - local.get $0 - local.get $1 - call $runtime/asrt/ffs - local.tee $1 - call $runtime/asrt/getSLMap - local.tee $2 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 328 - i32.const 17 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - local.get $2 - call $runtime/asrt/ffs - call $runtime/asrt/getHead - else - i32.const 0 - end - end - ) - (func $runtime/asrt/growMemory (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - (local $2 i32) - current_memory - local.tee $2 - local.get $1 - i32.const 65535 - i32.add - i32.const -65536 - i32.and - i32.const 16 - i32.shr_u - local.tee $1 - local.get $2 - local.get $1 - i32.gt_s - select - grow_memory - i32.const 0 - i32.lt_s - if - local.get $1 - grow_memory - i32.const 0 - i32.lt_s - if - unreachable - end - end - local.get $0 - local.get $2 - i32.const 16 - i32.shl - current_memory - i32.const 16 - i32.shl - call $runtime/asrt/addMemory - ) - (func $runtime/asrt/prepareBlock (; 15 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - local.get $1 - i32.load - local.tee $3 - i32.const 1 - i32.and - if (result i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 343 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - call $runtime/asrt/removeBlock - local.get $3 - i32.const -4 - i32.and - local.get $2 - i32.sub - local.tee $4 - i32.const 32 - i32.ge_u - if - local.get $1 - local.get $3 - i32.const 2 - i32.and - local.get $2 - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - local.tee $2 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $2 - call $runtime/asrt/insertBlock - else - local.get $1 - local.get $3 - i32.const -2 - i32.and - i32.store - local.get $1 - call $runtime/asrt/getRight - local.get $1 - call $runtime/asrt/getRight - i32.load - i32.const -3 - i32.and - i32.store - end - local.get $1 - i32.const 16 - i32.add - ) - (func $runtime/asrt/__mm_allocate (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - global.get $runtime/asrt/ROOT - local.tee $1 - i32.eqz - if - call $runtime/asrt/initialize - local.tee $1 - global.set $runtime/asrt/ROOT - end - local.get $0 - i32.const 1073741824 - i32.gt_u - if - unreachable - end - local.get $1 - local.get $0 - i32.const 15 - i32.add - i32.const -16 - i32.and - local.tee $0 - i32.const 16 - local.get $0 - i32.const 16 - i32.gt_u - select - local.tee $2 - call $runtime/asrt/searchBlock - local.tee $0 - i32.eqz - if - local.get $1 - local.get $2 - call $runtime/asrt/growMemory - local.get $1 - local.get $2 - call $runtime/asrt/searchBlock - local.tee $0 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 495 - i32.const 15 - call $~lib/builtins/abort - unreachable - end - end - local.get $0 - i32.load - i32.const -4 - i32.and - local.get $2 - i32.lt_u - if - i32.const 0 - i32.const 24 - i32.const 497 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 0 - i32.store offset=4 - local.get $0 - i32.const 0 - i32.store offset=8 - local.get $0 - local.get $2 - i32.store offset=12 - local.get $1 - local.get $0 - local.get $2 - call $runtime/asrt/prepareBlock - ) - (func $runtime/asrt/freeBlock (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $1 - i32.load - local.tee $2 - i32.const 1 - i32.and - if - i32.const 0 - i32.const 24 - i32.const 459 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.get $2 - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $runtime/asrt/insertBlock - ) - (func $runtime/asrt/__mm_free (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) - (local $1 i32) - local.get $0 - if - local.get $0 - i32.const 15 - i32.and - if - i32.const 0 - i32.const 24 - i32.const 508 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - global.get $runtime/asrt/ROOT - local.tee $1 - if - local.get $1 - local.get $0 - i32.const 16 - i32.sub - call $runtime/asrt/freeBlock - end - end - ) - (func $runtime/asrt/decrement (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - i32.const 268435455 - i32.and - local.tee $1 - i32.const 1 - i32.eq - if - unreachable - else - local.get $1 - i32.const 0 - i32.le_u - if - i32.const 0 - i32.const 24 - i32.const 631 - i32.const 15 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load offset=8 - drop - unreachable - end - unreachable - ) - (func $runtime/asrt/scan (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.tee $1 - i32.const 1879048192 - i32.and - i32.const 268435456 - i32.eq - if - local.get $1 - i32.const 268435455 - i32.and - i32.const 0 - i32.gt_u - if - local.get $0 - local.get $0 - i32.load offset=4 - i32.const -1879048193 - i32.and - i32.store offset=4 - else - local.get $0 - local.get $1 - i32.const -1879048193 - i32.and - i32.const 536870912 - i32.or - i32.store offset=4 - end - unreachable - end - ) - (func $runtime/asrt/collectWhite (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.tee $1 - i32.const 1879048192 - i32.and - i32.const 536870912 - i32.eq - if (result i32) - local.get $1 - i32.const -2147483648 - i32.and - i32.eqz - else - i32.const 0 - end - if - unreachable - end - global.get $runtime/asrt/ROOT - local.get $0 - call $runtime/asrt/freeBlock - ) - (func $runtime/asrt/__rt_visit (; 22 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - block $break|0 - block $case5|0 - block $case4|0 - block $case3|0 - block $case2|0 - block $case1|0 - local.get $1 - i32.const 1 - i32.ne - if - local.get $1 - i32.const 2 - i32.eq - br_if $case1|0 - block $tablify|0 - local.get $1 - i32.const 3 - i32.sub - br_table $case2|0 $case3|0 $case4|0 $tablify|0 - end - br $case5|0 - end - local.get $0 - call $runtime/asrt/decrement - br $break|0 - end - local.get $0 - i32.load offset=4 - i32.const 268435455 - i32.and - i32.const 0 - i32.le_u - if - i32.const 0 - i32.const 24 - i32.const 586 - i32.const 17 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $0 - i32.load offset=4 - i32.const 1 - i32.sub - i32.store offset=4 - local.get $0 - i32.load offset=4 - local.tee $1 - i32.const 1879048192 - i32.and - i32.const 268435456 - i32.ne - if - local.get $0 - local.get $1 - i32.const -1879048193 - i32.and - i32.const 268435456 - i32.or - i32.store offset=4 - unreachable - end - br $break|0 - end - local.get $0 - call $runtime/asrt/scan - br $break|0 - end - local.get $0 - i32.load offset=4 - local.tee $1 - i32.const -268435456 - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const -268435456 - i32.and - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 597 - i32.const 6 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - local.get $1 - i32.const 1879048192 - i32.and - if - local.get $0 - local.get $0 - i32.load offset=4 - i32.const -1879048193 - i32.and - i32.store offset=4 - unreachable - end - br $break|0 - end - local.get $0 - call $runtime/asrt/collectWhite - br $break|0 - end - i32.const 0 - i32.const 24 - i32.const 608 - i32.const 24 - call $~lib/builtins/abort - unreachable - end - ) - (func $runtime/asrt/increment (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.tee $1 - i32.const -268435456 - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const -268435456 - i32.and - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 615 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - ) - (func $runtime/asrt/__gc_retain (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) - local.get $0 - if - local.get $0 - i32.const 16 - i32.sub - call $runtime/asrt/increment - end - ) - (func $runtime/asrt/__gc_release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) - local.get $0 - if - local.get $0 - i32.const 16 - i32.sub - call $runtime/asrt/decrement - end - ) - (func $runtime/asrt/collectCycles (; 26 ;) (type $FUNCSIG$v) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - global.get $runtime/asrt/ROOTS - local.tee $4 - local.tee $2 - local.set $3 - global.get $runtime/asrt/CUR - local.set $5 - loop $repeat|0 - local.get $3 - local.get $5 - i32.lt_u - if - local.get $3 - i32.load - local.tee $0 - i32.load offset=4 - local.tee $1 - i32.const 1879048192 - i32.and - i32.const 805306368 - i32.eq - if (result i32) - local.get $1 - i32.const 268435455 - i32.and - i32.const 0 - i32.gt_u - else - i32.const 0 - end - if - local.get $0 - i32.load offset=4 - local.tee $1 - i32.const 1879048192 - i32.and - i32.const 268435456 - i32.ne - if - local.get $0 - local.get $1 - i32.const -1879048193 - i32.and - i32.const 268435456 - i32.or - i32.store offset=4 - unreachable - end - local.get $2 - local.get $0 - i32.store - local.get $2 - i32.const 4 - i32.add - local.set $2 - else - i32.const 0 - local.get $1 - i32.const 268435455 - i32.and - i32.eqz - local.get $1 - i32.const 1879048192 - i32.and - select - if - global.get $runtime/asrt/ROOT - local.get $0 - call $runtime/asrt/freeBlock - else - local.get $0 - local.get $1 - i32.const 2147483647 - i32.and - i32.store offset=4 - end - end - local.get $3 - i32.const 4 - i32.add - local.set $3 - br $repeat|0 - end - end - local.get $2 - global.set $runtime/asrt/CUR - local.get $4 - local.set $0 - loop $repeat|1 - local.get $0 - local.get $2 - i32.lt_u - if - local.get $0 - i32.load - call $runtime/asrt/scan - local.get $0 - i32.const 4 - i32.add - local.set $0 - br $repeat|1 - end - end - local.get $4 - local.set $0 - loop $repeat|2 - local.get $0 - local.get $2 - i32.lt_u - if - local.get $0 - i32.load - local.tee $1 - local.get $1 - i32.load offset=4 - i32.const 2147483647 - i32.and - i32.store offset=4 - local.get $1 - call $runtime/asrt/collectWhite - local.get $0 - i32.const 4 - i32.add - local.set $0 - br $repeat|2 - end - end - local.get $4 - global.set $runtime/asrt/CUR - ) - (func $null (; 27 ;) (type $FUNCSIG$v) - nop - ) -) diff --git a/tests/compiler/runtime/asrt.ts b/tests/runtime/assembly/index.ts similarity index 94% rename from tests/compiler/runtime/asrt.ts rename to tests/runtime/assembly/index.ts index 528df673..1b02f4af 100644 --- a/tests/compiler/runtime/asrt.ts +++ b/tests/runtime/assembly/index.ts @@ -19,7 +19,7 @@ // 3 2 1 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits // ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─╫─┴─┴─┴─┤ -// │ | FL │ SB = SL + AL │ ◄─ usize +// │ | FL │ SB = SL + AL │ ◄─ usize // └───────────────────────────────────────────────┴───────╨───────┘ // FL: first level, SL: second level, AL: alignment, SB: small block @@ -35,10 +35,21 @@ // @ts-ignore: decorator @inline -const FL_BITS: u32 = (sizeof() == sizeof() - ? 30 // ^= up to 1GB per block - : 32 // ^= up to 4GB per block -) - SB_BITS; +const FL_BITS: u32 = 31 - SB_BITS; + +// [00]: < 256B (SB) [12]: < 1M +// [01]: < 512B [13]: < 2M +// [02]: < 1K [14]: < 4M +// [03]: < 2K [15]: < 8M +// [04]: < 4K [16]: < 16M +// [05]: < 8K [17]: < 32M +// [06]: < 16K [18]: < 64M +// [07]: < 32K [19]: < 128M +// [08]: < 64K [20]: < 256M +// [09]: < 128K [21]: < 512M +// [10]: < 256K [22]: <= 1G - OVERHEAD +// [11]: < 512K +// VMs limit to 2GB total (currently), making one 1G block max (or three 512M etc.) due to block overhead // Tags stored in otherwise unused alignment bits @@ -95,7 +106,7 @@ const FL_BITS: u32 = (sizeof() == sizeof() // @ts-ignore: decorator @inline const BLOCK_MINSIZE: usize = (3 * sizeof() + AL_MASK) & ~AL_MASK;// prev + next + back // @ts-ignore: decorator -@inline const BLOCK_MAXSIZE: usize = 1 << (FL_BITS + SB_BITS); // 1GB if WASM32, 4GB if WASM64 +@inline const BLOCK_MAXSIZE: usize = 1 << (FL_BITS + SB_BITS - 1); // exclusive /** Gets the left block of a block. Only valid if the left block is free. */ function getLeft(block: Block): Block { @@ -200,11 +211,14 @@ function insertBlock(root: Root, block: Block): void { // merge with right block if also free if (rightInfo & FREE) { - removeBlock(root, right); - block.mmInfo = (blockInfo += BLOCK_OVERHEAD + (rightInfo & ~TAGS_MASK)); - right = getRight(block); - rightInfo = right.mmInfo; - // 'back' is set below + let newSize = (blockInfo & ~TAGS_MASK) + BLOCK_OVERHEAD + (rightInfo & ~TAGS_MASK); + if (newSize < BLOCK_MAXSIZE) { + removeBlock(root, right); + block.mmInfo = blockInfo = (blockInfo & TAGS_MASK) | newSize; + right = getRight(block); + rightInfo = right.mmInfo; + // 'back' is set below + } } // merge with left block if also free @@ -212,11 +226,13 @@ function insertBlock(root: Root, block: Block): void { let left = getLeft(block); let leftInfo = left.mmInfo; if (DEBUG) assert(leftInfo & FREE); // must be free according to right tags - removeBlock(root, left); - left.mmInfo = (leftInfo += BLOCK_OVERHEAD + (blockInfo & ~TAGS_MASK)); - block = left; - blockInfo = leftInfo; - // 'back' is set below + let newSize = (leftInfo & ~TAGS_MASK) + BLOCK_OVERHEAD + (blockInfo & ~TAGS_MASK); + if (newSize < BLOCK_MAXSIZE) { + removeBlock(root, left); + left.mmInfo = blockInfo = (leftInfo & TAGS_MASK) | newSize; + block = left; + // 'back' is set below + } } right.mmInfo = rightInfo | LEFTFREE; @@ -305,13 +321,13 @@ function searchBlock(root: Root, size: usize): Block | null { fl = 0; sl = (size / AL_SIZE); } else { - // (*) size += (1 << (fls(size) - SL_BITS)) - 1; - fl = fls(size); - sl = ((size >> (fl - SL_BITS)) ^ (1 << SL_BITS)); + const halfMaxSize = BLOCK_MAXSIZE >> 1; // don't round last fl + let requestSize = size < halfMaxSize + ? size + (1 << fls(size) - SL_BITS) - 1 + : size; + fl = fls(requestSize); + sl = ((requestSize >> (fl - SL_BITS)) ^ (1 << SL_BITS)); fl -= SB_BITS - 1; - // (*) instead of rounding up, use next second level list for better fit - if (sl < SL_SIZE - 1) ++sl; - else ++fl, sl = 0; } // search second level @@ -422,7 +438,7 @@ function growMemory(root: Root, size: usize): void { var pagesNeeded = (((size + 0xffff) & ~0xffff) >>> 16); var pagesWanted = max(pagesBefore, pagesNeeded); // double memory if (memory.grow(pagesWanted) < 0) { - if (memory.grow(pagesNeeded) < 0) unreachable(); // out of memory + if (memory.grow(pagesNeeded) < 0) unreachable(); } var pagesAfter = memory.size(); addMemory(root, pagesBefore << 16, pagesAfter << 16); @@ -430,13 +446,6 @@ function growMemory(root: Root, size: usize): void { /** Initilizes the root structure. */ function initialize(): Root { - if (DEBUG) { - assert( - SB_SIZE == 256 && // max size of a small block - FL_BITS == 22 && // number of second level maps - FL_BITS * SL_SIZE == 352 // number of heads - ); - } var rootOffset = (HEAP_BASE + AL_MASK) & ~AL_MASK; var pagesBefore = memory.size(); var pagesNeeded = ((((rootOffset + ROOT_SIZE) + 0xffff) & ~0xffff) >>> 16); @@ -486,8 +495,8 @@ function __mm_allocate(size: usize): usize { if (!root) ROOT = root = initialize(); // search for a suitable block - if (size > BLOCK_MAXSIZE) unreachable(); - size = max((size + AL_MASK) & ~AL_MASK, BLOCK_MINSIZE); // valid + if (size >= BLOCK_MAXSIZE) throw new Error("allocation too large"); + size = max((size + AL_MASK) & ~AL_MASK, BLOCK_MINSIZE); // align and ensure min size var block = searchBlock(root, size); if (!block) { growMemory(root, size); diff --git a/tests/runtime/assembly/tsconfig.json b/tests/runtime/assembly/tsconfig.json new file mode 100644 index 00000000..6e52b21c --- /dev/null +++ b/tests/runtime/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} diff --git a/tests/runtime/index.html b/tests/runtime/index.html new file mode 100644 index 00000000..9eaabee0 --- /dev/null +++ b/tests/runtime/index.html @@ -0,0 +1,196 @@ + + + + +

AssemblyScript Runtime Visualizer

+

+ Notes: +

    +
  • It is expected that there is exactly one block on initialization. This is the remaining space (< 64K) within the last page after static data.
  • +
  • It is expected that if two adjacent blocks of size K are freed, the merged block doesn't go into the first level list for K*2 because its size is actually larger than that (K + OVERHEAD + K).
  • +
  • It is expected that if memory grows beyond 1GB, that even if all blocks are free'd there are at least two (or even three if the largest block is in the middle) remaining blocks, because a single block must not be larger than 1GB.
  • +
  • It is expected that after other operations have already been performed, being able to allocate 1GB can't be guaranteed anymore, even if there should be enough space left in absolute terms, because prior subdivision prevents it.
  • +
+

+ +

First level bitmap

+

The first level map is a bitmap determining whether free blocks exists in at least one of its respective second levels. In this implementation, the first bit indicates whether a small block (< 256B) exists. Each bit doubles the size.

+
+
+ +

Second level maps

+

Second level maps subdivide each first level into multiple lists of subsizes. Each one works similar to the first level bitmap.

+
+
+ +

Heads

+

The heads of the actual free lists, one per second level per first level. Values here are pointers into memory. Last item is the address of the special zero-size "used" tail block, which is usually the end of WASM memory minus block overhead.

+
+
+ +

Allocator

+

+ Click to allocate: +   + + +   + + + + + +   + +

+ +

Segments

+
+
diff --git a/tests/runtime/optimized.wat b/tests/runtime/optimized.wat new file mode 100644 index 00000000..7f838326 --- /dev/null +++ b/tests/runtime/optimized.wat @@ -0,0 +1,1067 @@ +(module + (type $FUNCSIG$ii (func (param i32) (result i32))) + (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (type $FUNCSIG$v (func)) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 8) "\10\00\00\00\"") + (data (i32.const 24) "a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00d\00e\00x\00.\00t\00s") + (data (i32.const 64) "\10\00\00\00\1c") + (data (i32.const 80) "~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s") + (global $assembly/index/ROOT (mut i32) (i32.const 0)) + (global $assembly/index/CUR (mut i32) (i32.const 0)) + (global $assembly/index/ROOTS (mut i32) (i32.const 0)) + (export "memory" (memory $0)) + (export "__mm_allocate" (func $assembly/index/__mm_allocate)) + (export "__mm_free" (func $assembly/index/__mm_free)) + (export "__rt_visit" (func $assembly/index/__rt_visit)) + (export "__gc_retain" (func $assembly/index/__gc_retain)) + (export "__gc_release" (func $assembly/index/__gc_release)) + (export "__gc_collect" (func $assembly/index/collectCycles)) + (func $assembly/index/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=1568 + ) + (func $assembly/index/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $0 + local.get $1 + i32.const 2 + i32.shl + i32.add + local.get $2 + i32.store offset=4 + ) + (func $assembly/index/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + local.get $0 + local.get $1 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $3 + i32.store offset=96 + ) + (func $assembly/index/getRight (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.add + local.get $0 + i32.load + i32.const -4 + i32.and + i32.add + ) + (func $assembly/index/fls (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + i32.const 31 + local.get $0 + i32.clz + i32.sub + ) + (func $assembly/index/getHead (; 6 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + local.get $1 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + ) + (func $assembly/index/getSLMap (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + local.get $0 + local.get $1 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + ) + (func $assembly/index/removeBlock (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + i32.const -4 + i32.and + local.tee $2 + i32.const 256 + i32.lt_u + if (result i32) + local.get $2 + i32.const 16 + i32.div_u + local.set $4 + i32.const 0 + else + local.get $2 + local.get $2 + call $assembly/index/fls + local.tee $3 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $4 + local.get $3 + i32.const 7 + i32.sub + end + local.set $3 + local.get $1 + i32.load offset=20 + local.set $2 + local.get $1 + i32.load offset=16 + local.tee $5 + if + local.get $5 + local.get $2 + i32.store offset=20 + end + local.get $2 + if + local.get $2 + local.get $5 + i32.store offset=16 + end + local.get $0 + local.get $3 + local.get $4 + call $assembly/index/getHead + local.get $1 + i32.eq + if + local.get $0 + local.get $3 + local.get $4 + local.get $2 + call $assembly/index/setHead + local.get $2 + i32.eqz + if + local.get $0 + local.get $3 + local.get $0 + local.get $3 + call $assembly/index/getSLMap + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $1 + call $assembly/index/setSLMap + local.get $1 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $3 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $assembly/index/insertBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $1 + i32.load + local.set $3 + local.get $1 + call $assembly/index/getRight + local.tee $4 + i32.load + local.tee $5 + i32.const 1 + i32.and + if + local.get $3 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const -4 + i32.and + i32.add + local.tee $2 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $4 + call $assembly/index/removeBlock + local.get $1 + local.get $3 + i32.const 3 + i32.and + local.get $2 + i32.or + local.tee $3 + i32.store + local.get $1 + call $assembly/index/getRight + local.tee $4 + i32.load + local.set $5 + end + end + local.get $3 + i32.const 2 + i32.and + if + local.get $1 + i32.const 4 + i32.sub + i32.load + local.tee $2 + i32.load + local.tee $6 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $3 + i32.const -4 + i32.and + i32.add + local.tee $7 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $2 + call $assembly/index/removeBlock + local.get $2 + local.get $6 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $3 + i32.store + local.get $2 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $0 + local.get $3 + i32.const -4 + i32.and + local.tee $2 + i32.const 256 + i32.lt_u + if (result i32) + local.get $2 + i32.const 16 + i32.div_u + local.set $3 + i32.const 0 + else + local.get $2 + local.get $2 + call $assembly/index/fls + local.tee $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $3 + local.get $2 + i32.const 7 + i32.sub + end + local.tee $2 + local.get $3 + call $assembly/index/getHead + local.set $4 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $4 + i32.store offset=20 + local.get $4 + if + local.get $4 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.get $2 + local.get $3 + local.get $1 + call $assembly/index/setHead + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $2 + i32.shl + i32.or + i32.store + local.get $0 + local.get $2 + local.get $0 + local.get $2 + call $assembly/index/getSLMap + i32.const 1 + local.get $3 + i32.shl + i32.or + call $assembly/index/setSLMap + ) + (func $assembly/index/addMemory (; 10 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + local.get $2 + block (result i32) + local.get $0 + i32.load offset=1568 + local.tee $2 + if + local.get $1 + i32.const 16 + i32.sub + local.get $2 + i32.eq + if + local.get $2 + i32.load + local.set $3 + local.get $1 + i32.const 16 + i32.sub + local.set $1 + end + end + local.get $1 + end + i32.sub + local.tee $2 + i32.const 48 + i32.lt_u + if + return + end + local.get $1 + local.get $3 + i32.const 2 + i32.and + local.get $2 + i32.const 32 + i32.sub + i32.const 1 + i32.or + i32.or + i32.store + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.tee $2 + i32.const 2 + i32.store + local.get $0 + local.get $2 + call $assembly/index/setTail + local.get $0 + local.get $1 + call $assembly/index/insertBlock + ) + (func $assembly/index/initialize (; 11 ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 112 + local.tee $3 + i32.const 67107 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.tee $1 + current_memory + local.tee $0 + i32.gt_s + if (result i32) + local.get $1 + local.get $0 + i32.sub + grow_memory + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $3 + local.tee $0 + i32.const 0 + i32.store + local.get $0 + i32.const 0 + call $assembly/index/setTail + loop $repeat|0 + block $break|0 + local.get $2 + i32.const 23 + i32.ge_u + br_if $break|0 + local.get $0 + local.get $2 + i32.const 0 + call $assembly/index/setSLMap + i32.const 0 + local.set $1 + loop $repeat|1 + block $break|1 + local.get $1 + i32.const 16 + i32.ge_u + br_if $break|1 + local.get $0 + local.get $2 + local.get $1 + i32.const 0 + call $assembly/index/setHead + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $repeat|1 + end + end + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $repeat|0 + end + end + local.get $0 + local.get $3 + i32.const 1587 + i32.add + i32.const -16 + i32.and + current_memory + i32.const 16 + i32.shl + call $assembly/index/addMemory + local.get $0 + ) + (func $assembly/index/searchBlock (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $0 + local.get $1 + i32.const 256 + i32.lt_u + if (result i32) + local.get $1 + i32.const 16 + i32.div_u + local.set $1 + i32.const 0 + else + block (result i32) + local.get $1 + i32.const 536870912 + i32.lt_u + if + local.get $1 + i32.const 1 + local.get $1 + call $assembly/index/fls + i32.const 4 + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.set $1 + end + local.get $1 + end + call $assembly/index/fls + local.set $2 + local.get $1 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $1 + local.get $2 + i32.const 7 + i32.sub + end + local.tee $2 + call $assembly/index/getSLMap + i32.const -1 + local.get $1 + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $2 + local.get $1 + i32.ctz + call $assembly/index/getHead + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.tee $1 + local.get $0 + local.get $1 + call $assembly/index/getSLMap + i32.ctz + call $assembly/index/getHead + else + i32.const 0 + end + end + ) + (func $assembly/index/growMemory (; 13 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + current_memory + local.tee $2 + local.tee $3 + local.get $1 + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.tee $1 + local.tee $4 + local.get $3 + local.get $4 + i32.gt_s + select + grow_memory + i32.const 0 + i32.lt_s + if + local.get $1 + grow_memory + i32.const 0 + i32.lt_s + if + unreachable + end + end + local.get $0 + local.get $2 + i32.const 16 + i32.shl + current_memory + i32.const 16 + i32.shl + call $assembly/index/addMemory + ) + (func $assembly/index/prepareBlock (; 14 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.load + local.set $3 + local.get $0 + local.get $1 + call $assembly/index/removeBlock + local.get $3 + i32.const -4 + i32.and + local.get $2 + i32.sub + local.tee $4 + i32.const 32 + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.tee $2 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $2 + call $assembly/index/insertBlock + else + local.get $1 + local.get $3 + i32.const -2 + i32.and + i32.store + local.get $1 + call $assembly/index/getRight + local.get $1 + call $assembly/index/getRight + i32.load + i32.const -3 + i32.and + i32.store + end + local.get $1 + i32.const 16 + i32.add + ) + (func $assembly/index/__mm_allocate (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + global.get $assembly/index/ROOT + local.tee $2 + i32.eqz + if + call $assembly/index/initialize + local.tee $2 + global.set $assembly/index/ROOT + end + local.get $0 + i32.const 1073741824 + i32.ge_u + if + i32.const 0 + i32.const 24 + i32.const 498 + i32.const 29 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $0 + i32.const 15 + i32.add + i32.const -16 + i32.and + local.tee $0 + i32.const 16 + local.tee $1 + local.get $0 + local.get $1 + i32.gt_u + select + local.tee $1 + call $assembly/index/searchBlock + local.tee $0 + i32.eqz + if + local.get $2 + local.get $1 + call $assembly/index/growMemory + local.get $2 + local.get $1 + call $assembly/index/searchBlock + local.set $0 + end + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $0 + local.get $1 + i32.store offset=12 + local.get $2 + local.get $0 + local.get $1 + call $assembly/index/prepareBlock + ) + (func $assembly/index/freeBlock (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + local.get $1 + local.get $1 + i32.load + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $assembly/index/insertBlock + ) + (func $assembly/index/__mm_free (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + if + global.get $assembly/index/ROOT + local.tee $1 + if + local.get $1 + local.get $0 + i32.const 16 + i32.sub + call $assembly/index/freeBlock + end + end + ) + (func $assembly/index/decrement (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + i32.load offset=4 + i32.const 268435455 + i32.and + i32.const 1 + i32.eq + i32.eqz + if + local.get $0 + i32.load offset=8 + drop + end + unreachable + ) + (func $assembly/index/markGray (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.ne + if + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.const 268435456 + i32.or + i32.store offset=4 + unreachable + end + ) + (func $assembly/index/scanBlack (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + local.get $0 + i32.load offset=4 + i32.const -1879048193 + i32.and + i32.store offset=4 + unreachable + ) + (func $assembly/index/scan (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.eq + if + local.get $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + if + local.get $0 + call $assembly/index/scanBlack + else + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.const 536870912 + i32.or + i32.store offset=4 + unreachable + end + end + ) + (func $assembly/index/collectWhite (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.const 0 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 536870912 + i32.eq + select + if + unreachable + end + global.get $assembly/index/ROOT + local.get $0 + call $assembly/index/freeBlock + ) + (func $assembly/index/__rt_visit (; 23 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + block $break|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + block $case0|0 + local.get $1 + i32.const 1 + i32.sub + br_table $case0|0 $case1|0 $case2|0 $case3|0 $case4|0 $break|0 + end + local.get $0 + call $assembly/index/decrement + br $break|0 + end + local.get $0 + local.get $0 + i32.load offset=4 + i32.const 1 + i32.sub + i32.store offset=4 + local.get $0 + call $assembly/index/markGray + br $break|0 + end + local.get $0 + call $assembly/index/scan + br $break|0 + end + local.get $0 + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1 + i32.add + i32.store offset=4 + local.get $1 + i32.const 1879048192 + i32.and + if + local.get $0 + call $assembly/index/scanBlack + end + br $break|0 + end + local.get $0 + call $assembly/index/collectWhite + end + ) + (func $assembly/index/__gc_retain (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + if + local.get $0 + i32.const 16 + i32.sub + local.tee $0 + local.get $0 + i32.load offset=4 + i32.const 1 + i32.add + i32.store offset=4 + end + ) + (func $assembly/index/__gc_release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + if + local.get $0 + i32.const 16 + i32.sub + call $assembly/index/decrement + end + ) + (func $assembly/index/collectCycles (; 26 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $assembly/index/ROOTS + local.tee $5 + local.tee $2 + local.set $3 + global.get $assembly/index/CUR + local.set $0 + loop $repeat|0 + block $break|0 + local.get $3 + local.get $0 + i32.ge_u + br_if $break|0 + local.get $3 + i32.load + local.tee $4 + i32.load offset=4 + local.tee $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + i32.const 0 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 805306368 + i32.eq + select + if + local.get $4 + call $assembly/index/markGray + local.get $2 + local.get $4 + i32.store + local.get $2 + i32.const 4 + i32.add + local.set $2 + else + i32.const 0 + local.get $1 + i32.const 268435455 + i32.and + i32.eqz + local.get $1 + i32.const 1879048192 + i32.and + select + if + global.get $assembly/index/ROOT + local.get $4 + call $assembly/index/freeBlock + else + local.get $4 + local.get $1 + i32.const 2147483647 + i32.and + i32.store offset=4 + end + end + local.get $3 + i32.const 4 + i32.add + local.set $3 + br $repeat|0 + end + end + local.get $2 + global.set $assembly/index/CUR + local.get $5 + local.set $0 + loop $repeat|1 + block $break|1 + local.get $0 + local.get $2 + i32.ge_u + br_if $break|1 + local.get $0 + i32.load + call $assembly/index/scan + local.get $0 + i32.const 4 + i32.add + local.set $0 + br $repeat|1 + end + end + local.get $5 + local.set $0 + loop $repeat|2 + block $break|2 + local.get $0 + local.get $2 + i32.ge_u + br_if $break|2 + local.get $0 + i32.load + local.tee $1 + local.get $1 + i32.load offset=4 + i32.const 2147483647 + i32.and + i32.store offset=4 + local.get $1 + call $assembly/index/collectWhite + local.get $0 + i32.const 4 + i32.add + local.set $0 + br $repeat|2 + end + end + local.get $5 + global.set $assembly/index/CUR + ) + (func $null (; 27 ;) (type $FUNCSIG$v) + nop + ) +) diff --git a/tests/runtime/package-lock.json b/tests/runtime/package-lock.json new file mode 100644 index 00000000..166100d4 --- /dev/null +++ b/tests/runtime/package-lock.json @@ -0,0 +1,213 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + }, + "corser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz", + "integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c=", + "dev": true + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ecstatic": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.1.tgz", + "integrity": "sha512-/rrctvxZ78HMI/tPIsqdvFKHHscxR3IJuKrZI2ZoUgkt2SiufyLFBmcco+aqQBIu6P1qBsUNG3drAAGLx80vTQ==", + "dev": true, + "requires": { + "he": "^1.1.1", + "mime": "^1.6.0", + "minimist": "^1.1.0", + "url-join": "^2.0.5" + } + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", + "dev": true + }, + "follow-redirects": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", + "integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==", + "dev": true, + "requires": { + "debug": "^3.2.6" + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "http-proxy": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "dev": true, + "requires": { + "eventemitter3": "^3.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-server": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/http-server/-/http-server-0.11.1.tgz", + "integrity": "sha512-6JeGDGoujJLmhjiRGlt8yK8Z9Kl0vnl/dQoQZlc4oeqaUoAKQg94NILLfrY3oWzSyFaQCVNTcKE5PZ3cH8VP9w==", + "dev": true, + "requires": { + "colors": "1.0.3", + "corser": "~2.0.0", + "ecstatic": "^3.0.0", + "http-proxy": "^1.8.1", + "opener": "~1.4.0", + "optimist": "0.6.x", + "portfinder": "^1.0.13", + "union": "~0.4.3" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "opener": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz", + "integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=", + "dev": true + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + } + } + }, + "portfinder": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.20.tgz", + "integrity": "sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw==", + "dev": true, + "requires": { + "async": "^1.5.2", + "debug": "^2.2.0", + "mkdirp": "0.5.x" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "qs": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz", + "integrity": "sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "union": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/union/-/union-0.4.6.tgz", + "integrity": "sha1-GY+9rrolTniLDvy2MLwR8kopWeA=", + "dev": true, + "requires": { + "qs": "~2.3.3" + } + }, + "url-join": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz", + "integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } +} diff --git a/tests/runtime/package.json b/tests/runtime/package.json new file mode 100644 index 00000000..e82de9a0 --- /dev/null +++ b/tests/runtime/package.json @@ -0,0 +1,12 @@ +{ + "private": true, + "scripts": { + "server": "http-server . -o -c-1", + "build": "npm run build:untouched && npm run build:optimized", + "build:untouched": "node ../../bin/asc assembly/index.ts -t untouched.wat -b untouched.wasm --runtime none --validate --sourceMap --measure", + "build:optimized": "node ../../bin/asc assembly/index.ts -t optimized.wat -b optimized.wasm --runtime none --validate --sourceMap --measure --noAssert --optimize" + }, + "devDependencies": { + "http-server": "^0.11.1" + } +} diff --git a/tests/compiler/runtime/asrt.untouched.wat b/tests/runtime/untouched.wat similarity index 77% rename from tests/compiler/runtime/asrt.untouched.wat rename to tests/runtime/untouched.wat index fc570174..b8251410 100644 --- a/tests/compiler/runtime/asrt.untouched.wat +++ b/tests/runtime/untouched.wat @@ -1,46 +1,46 @@ (module (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$i (func (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) - (data (i32.const 8) "\10\00\00\00\1e\00\00\00\00\00\00\00\00\00\00\00r\00u\00n\00t\00i\00m\00e\00/\00a\00s\00r\00t\00.\00t\00s\00") - (data (i32.const 56) "\10\00\00\00\1c\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s\00") + (data (i32.const 8) "\10\00\00\00\"\00\00\00\00\00\00\00\00\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00d\00e\00x\00.\00t\00s\00") + (data (i32.const 64) "\10\00\00\00\1c\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s\00") (table $0 1 funcref) (elem (i32.const 0) $null) - (global $runtime/asrt/ROOT (mut i32) (i32.const 0)) - (global $runtime/asrt/ACYCLIC_FLAG i32 (i32.const 0)) - (global $runtime/asrt/CUR (mut i32) (i32.const 0)) - (global $runtime/asrt/END (mut i32) (i32.const 0)) - (global $runtime/asrt/ROOTS (mut i32) (i32.const 0)) - (global $~lib/memory/HEAP_BASE i32 (i32.const 100)) + (global $assembly/index/ROOT (mut i32) (i32.const 0)) + (global $assembly/index/ACYCLIC_FLAG i32 (i32.const 0)) + (global $assembly/index/CUR (mut i32) (i32.const 0)) + (global $assembly/index/END (mut i32) (i32.const 0)) + (global $assembly/index/ROOTS (mut i32) (i32.const 0)) + (global $~lib/memory/HEAP_BASE i32 (i32.const 108)) (export "memory" (memory $0)) - (export "__mm_allocate" (func $runtime/asrt/__mm_allocate)) - (export "__mm_free" (func $runtime/asrt/__mm_free)) - (export "__rt_visit" (func $runtime/asrt/__rt_visit)) - (export "__gc_retain" (func $runtime/asrt/__gc_retain)) - (export "__gc_release" (func $runtime/asrt/__gc_release)) - (export "__gc_collect" (func $runtime/asrt/collectCycles)) - (func $runtime/asrt/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (export "__mm_allocate" (func $assembly/index/__mm_allocate)) + (export "__mm_free" (func $assembly/index/__mm_free)) + (export "__rt_visit" (func $assembly/index/__rt_visit)) + (export "__gc_retain" (func $assembly/index/__gc_retain)) + (export "__gc_release" (func $assembly/index/__gc_release)) + (export "__gc_collect" (func $assembly/index/collectCycles)) + (func $assembly/index/setTail (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) local.get $0 local.get $1 - i32.store offset=1504 + i32.store offset=1568 ) - (func $runtime/asrt/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $assembly/index/setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u i32.eqz if i32.const 0 i32.const 24 - i32.const 164 + i32.const 175 i32.const 13 call $~lib/builtins/abort unreachable @@ -53,9 +53,9 @@ local.get $2 i32.store offset=4 ) - (func $runtime/asrt/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $assembly/index/setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u if (result i32) local.get $2 @@ -68,7 +68,7 @@ if i32.const 0 i32.const 24 - i32.const 178 + i32.const 189 i32.const 13 call $~lib/builtins/abort unreachable @@ -85,11 +85,11 @@ local.get $3 i32.store offset=96 ) - (func $runtime/asrt/getTail (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/getTail (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - i32.load offset=1504 + i32.load offset=1568 ) - (func $runtime/asrt/getRight (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/getRight (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) local.get $0 @@ -104,7 +104,7 @@ if i32.const 0 i32.const 24 - i32.const 111 + i32.const 122 i32.const 13 call $~lib/builtins/abort unreachable @@ -124,14 +124,14 @@ if i32.const 0 i32.const 24 - i32.const 113 + i32.const 124 i32.const 13 call $~lib/builtins/abort unreachable end local.get $2 ) - (func $runtime/asrt/fls (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/fls (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 0 i32.ne @@ -139,7 +139,7 @@ if i32.const 0 i32.const 24 - i32.const 472 + i32.const 481 i32.const 13 call $~lib/builtins/abort unreachable @@ -149,9 +149,9 @@ i32.clz i32.sub ) - (func $runtime/asrt/getHead (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $assembly/index/getHead (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u if (result i32) local.get $2 @@ -164,7 +164,7 @@ if i32.const 0 i32.const 24 - i32.const 169 + i32.const 180 i32.const 13 call $~lib/builtins/abort unreachable @@ -180,15 +180,15 @@ i32.add i32.load offset=96 ) - (func $runtime/asrt/getSLMap (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $assembly/index/getSLMap (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $1 - i32.const 22 + i32.const 23 i32.lt_u i32.eqz if i32.const 0 i32.const 24 - i32.const 159 + i32.const 170 i32.const 13 call $~lib/builtins/abort unreachable @@ -200,7 +200,7 @@ i32.add i32.load offset=4 ) - (func $runtime/asrt/removeBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/index/removeBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -218,7 +218,7 @@ if i32.const 0 i32.const 24 - i32.const 259 + i32.const 275 i32.const 13 call $~lib/builtins/abort unreachable @@ -243,7 +243,7 @@ if i32.const 0 i32.const 24 - i32.const 261 + i32.const 277 i32.const 13 call $~lib/builtins/abort unreachable @@ -260,7 +260,7 @@ local.set $5 else local.get $3 - call $runtime/asrt/fls + call $assembly/index/fls local.set $4 local.get $3 local.get $4 @@ -301,20 +301,20 @@ local.get $0 local.get $4 local.get $5 - call $runtime/asrt/getHead + call $assembly/index/getHead i32.eq if local.get $0 local.get $4 local.get $5 local.get $7 - call $runtime/asrt/setHead + call $assembly/index/setHead local.get $7 i32.eqz if local.get $0 local.get $4 - call $runtime/asrt/getSLMap + call $assembly/index/getSLMap local.set $8 local.get $0 local.get $4 @@ -326,7 +326,7 @@ i32.xor i32.and local.tee $8 - call $runtime/asrt/setSLMap + call $assembly/index/setSLMap local.get $8 i32.eqz if @@ -344,7 +344,7 @@ end end ) - (func $runtime/asrt/getLeft (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/getLeft (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 i32.load @@ -354,7 +354,7 @@ if i32.const 0 i32.const 24 - i32.const 102 + i32.const 113 i32.const 13 call $~lib/builtins/abort unreachable @@ -369,14 +369,14 @@ if i32.const 0 i32.const 24 - i32.const 104 + i32.const 115 i32.const 13 call $~lib/builtins/abort unreachable end local.get $1 ) - (func $runtime/asrt/insertBlock (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/index/insertBlock (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -386,12 +386,13 @@ (local $8 i32) (local $9 i32) (local $10 i32) + (local $11 i32) local.get $1 i32.eqz if i32.const 0 i32.const 24 - i32.const 194 + i32.const 205 i32.const 13 call $~lib/builtins/abort unreachable @@ -406,13 +407,13 @@ if i32.const 0 i32.const 24 - i32.const 196 + i32.const 207 i32.const 13 call $~lib/builtins/abort unreachable end local.get $1 - call $runtime/asrt/getRight + call $assembly/index/getRight local.set $3 local.get $3 i32.load @@ -421,34 +422,49 @@ i32.const 1 i32.and if - local.get $0 - local.get $3 - call $runtime/asrt/removeBlock - local.get $1 local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and i32.const 16 + i32.add local.get $4 i32.const 3 i32.const -1 i32.xor i32.and i32.add - i32.add - local.tee $2 - i32.store - local.get $1 - call $runtime/asrt/getRight - local.set $3 - local.get $3 - i32.load - local.set $4 + local.set $5 + local.get $5 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $3 + call $assembly/index/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $5 + i32.or + local.tee $2 + i32.store + local.get $1 + call $assembly/index/getRight + local.set $3 + local.get $3 + i32.load + local.set $4 + end end local.get $2 i32.const 2 i32.and if local.get $1 - call $runtime/asrt/getLeft + call $assembly/index/getLeft local.set $5 local.get $5 i32.load @@ -460,30 +476,43 @@ if i32.const 0 i32.const 24 - i32.const 214 + i32.const 228 i32.const 15 call $~lib/builtins/abort unreachable end - local.get $0 - local.get $5 - call $runtime/asrt/removeBlock - local.get $5 local.get $6 + i32.const 3 + i32.const -1 + i32.xor + i32.and i32.const 16 + i32.add local.get $2 i32.const 3 i32.const -1 i32.xor i32.and i32.add - i32.add - local.tee $6 - i32.store - local.get $5 - local.set $1 - local.get $6 - local.set $2 + local.set $7 + local.get $7 + i32.const 1073741824 + i32.lt_u + if + local.get $0 + local.get $5 + call $assembly/index/removeBlock + local.get $5 + local.get $6 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $5 + local.set $1 + end end local.get $3 local.get $4 @@ -495,12 +524,12 @@ i32.const -1 i32.xor i32.and - local.set $7 - local.get $7 + local.set $8 + local.get $8 i32.const 16 i32.ge_u if (result i32) - local.get $7 + local.get $8 i32.const 1073741824 i32.lt_u else @@ -510,7 +539,7 @@ if i32.const 0 i32.const 24 - i32.const 227 + i32.const 243 i32.const 13 call $~lib/builtins/abort unreachable @@ -518,7 +547,7 @@ local.get $1 i32.const 16 i32.add - local.get $7 + local.get $8 i32.add local.get $3 i32.eq @@ -526,7 +555,7 @@ if i32.const 0 i32.const 24 - i32.const 228 + i32.const 244 i32.const 13 call $~lib/builtins/abort unreachable @@ -536,22 +565,22 @@ i32.sub local.get $1 i32.store - local.get $7 + local.get $8 i32.const 256 i32.lt_u if i32.const 0 - local.set $8 - local.get $7 + local.set $9 + local.get $8 i32.const 16 i32.div_u - local.set $9 + local.set $10 else - local.get $7 - call $runtime/asrt/fls - local.set $8 - local.get $7 local.get $8 + call $assembly/index/fls + local.set $9 + local.get $8 + local.get $9 i32.const 4 i32.sub i32.shr_u @@ -559,56 +588,56 @@ i32.const 4 i32.shl i32.xor - local.set $9 - local.get $8 + local.set $10 + local.get $9 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $8 + local.set $9 end local.get $0 - local.get $8 local.get $9 - call $runtime/asrt/getHead - local.set $10 + local.get $10 + call $assembly/index/getHead + local.set $11 local.get $1 i32.const 0 i32.store offset=16 local.get $1 - local.get $10 + local.get $11 i32.store offset=20 - local.get $10 + local.get $11 if - local.get $10 + local.get $11 local.get $1 i32.store offset=16 end local.get $0 - local.get $8 local.get $9 + local.get $10 local.get $1 - call $runtime/asrt/setHead + call $assembly/index/setHead local.get $0 local.get $0 i32.load i32.const 1 - local.get $8 + local.get $9 i32.shl i32.or i32.store local.get $0 - local.get $8 - local.get $0 - local.get $8 - call $runtime/asrt/getSLMap - i32.const 1 local.get $9 + local.get $0 + local.get $9 + call $assembly/index/getSLMap + i32.const 1 + local.get $10 i32.shl i32.or - call $runtime/asrt/setSLMap + call $assembly/index/setSLMap ) - (func $runtime/asrt/addMemory (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $assembly/index/addMemory (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -637,13 +666,13 @@ if i32.const 0 i32.const 24 - i32.const 371 + i32.const 387 i32.const 4 call $~lib/builtins/abort unreachable end local.get $0 - call $runtime/asrt/getTail + call $assembly/index/getTail local.set $3 i32.const 0 local.set $4 @@ -658,7 +687,7 @@ if i32.const 0 i32.const 24 - i32.const 381 + i32.const 397 i32.const 15 call $~lib/builtins/abort unreachable @@ -682,14 +711,14 @@ else local.get $1 local.get $0 - i32.const 1508 + i32.const 1572 i32.add i32.ge_u i32.eqz if i32.const 0 i32.const 24 - i32.const 393 + i32.const 409 i32.const 4 call $~lib/builtins/abort unreachable @@ -746,47 +775,19 @@ i32.store local.get $0 local.get $3 - call $runtime/asrt/setTail + call $assembly/index/setTail local.get $0 local.get $7 - call $runtime/asrt/insertBlock + call $assembly/index/insertBlock i32.const 1 ) - (func $runtime/asrt/initialize (; 13 ;) (type $FUNCSIG$i) (result i32) + (func $assembly/index/initialize (; 13 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - i32.const 256 - i32.const 256 - i32.eq - if (result i32) - i32.const 22 - i32.const 22 - i32.eq - else - i32.const 0 - end - if (result i32) - i32.const 22 - i32.const 16 - i32.mul - i32.const 352 - i32.eq - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 434 - i32.const 4 - call $~lib/builtins/abort - unreachable - end global.get $~lib/memory/HEAP_BASE i32.const 15 i32.add @@ -798,7 +799,7 @@ current_memory local.set $1 local.get $0 - i32.const 1508 + i32.const 1572 i32.add i32.const 65535 i32.add @@ -832,13 +833,13 @@ i32.store local.get $3 i32.const 0 - call $runtime/asrt/setTail + call $assembly/index/setTail block $break|0 i32.const 0 local.set $4 loop $repeat|0 local.get $4 - i32.const 22 + i32.const 23 i32.lt_u i32.eqz br_if $break|0 @@ -846,7 +847,7 @@ local.get $3 local.get $4 i32.const 0 - call $runtime/asrt/setSLMap + call $assembly/index/setSLMap block $break|1 i32.const 0 local.set $5 @@ -860,7 +861,7 @@ local.get $4 local.get $5 i32.const 0 - call $runtime/asrt/setHead + call $assembly/index/setHead local.get $5 i32.const 1 i32.add @@ -882,7 +883,7 @@ end local.get $3 local.get $0 - i32.const 1508 + i32.const 1572 i32.add i32.const 15 i32.add @@ -893,11 +894,11 @@ current_memory i32.const 16 i32.shl - call $runtime/asrt/addMemory + call $assembly/index/addMemory drop local.get $3 ) - (func $runtime/asrt/ffs (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/ffs (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 0 i32.ne @@ -905,7 +906,7 @@ if i32.const 0 i32.const 24 - i32.const 466 + i32.const 475 i32.const 13 call $~lib/builtins/abort unreachable @@ -913,7 +914,7 @@ local.get $0 i32.ctz ) - (func $runtime/asrt/ffs (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/ffs (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 0 i32.ne @@ -921,7 +922,7 @@ if i32.const 0 i32.const 24 - i32.const 466 + i32.const 475 i32.const 13 call $~lib/builtins/abort unreachable @@ -929,7 +930,7 @@ local.get $0 i32.ctz ) - (func $runtime/asrt/searchBlock (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $assembly/index/searchBlock (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -947,9 +948,27 @@ local.set $3 else local.get $1 - call $runtime/asrt/fls + i32.const 536870912 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + local.get $1 + call $assembly/index/fls + i32.const 4 + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + local.get $4 + call $assembly/index/fls local.set $2 - local.get $1 + local.get $4 local.get $2 i32.const 4 i32.sub @@ -965,36 +984,18 @@ i32.sub i32.sub local.set $2 - local.get $3 - i32.const 16 - i32.const 1 - i32.sub - i32.lt_u - if - local.get $3 - i32.const 1 - i32.add - local.set $3 - else - local.get $2 - i32.const 1 - i32.add - local.set $2 - i32.const 0 - local.set $3 - end end local.get $0 local.get $2 - call $runtime/asrt/getSLMap + call $assembly/index/getSLMap i32.const 0 i32.const -1 i32.xor local.get $3 i32.shl i32.and - local.set $4 - local.get $4 + local.set $5 + local.get $5 i32.eqz if local.get $0 @@ -1007,48 +1008,48 @@ i32.add i32.shl i32.and - local.set $6 - local.get $6 + local.set $4 + local.get $4 i32.eqz if i32.const 0 - local.set $5 + local.set $6 else - local.get $6 - call $runtime/asrt/ffs + local.get $4 + call $assembly/index/ffs local.set $2 local.get $0 local.get $2 - call $runtime/asrt/getSLMap - local.set $4 - local.get $4 + call $assembly/index/getSLMap + local.set $5 + local.get $5 i32.eqz if i32.const 0 i32.const 24 - i32.const 328 + i32.const 344 i32.const 17 call $~lib/builtins/abort unreachable end local.get $0 local.get $2 - local.get $4 - call $runtime/asrt/ffs - call $runtime/asrt/getHead - local.set $5 + local.get $5 + call $assembly/index/ffs + call $assembly/index/getHead + local.set $6 end else local.get $0 local.get $2 - local.get $4 - call $runtime/asrt/ffs - call $runtime/asrt/getHead - local.set $5 + local.get $5 + call $assembly/index/ffs + call $assembly/index/getHead + local.set $6 end - local.get $5 + local.get $6 ) - (func $runtime/asrt/growMemory (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/index/growMemory (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1098,10 +1099,10 @@ local.get $7 i32.const 16 i32.shl - call $runtime/asrt/addMemory + call $assembly/index/addMemory drop ) - (func $runtime/asrt/prepareBlock (; 18 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $assembly/index/prepareBlock (; 18 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1125,14 +1126,14 @@ if i32.const 0 i32.const 24 - i32.const 343 + i32.const 359 i32.const 4 call $~lib/builtins/abort unreachable end local.get $0 local.get $1 - call $runtime/asrt/removeBlock + call $assembly/index/removeBlock local.get $3 i32.const 3 i32.const -1 @@ -1169,7 +1170,7 @@ i32.store local.get $0 local.get $5 - call $runtime/asrt/insertBlock + call $assembly/index/insertBlock else local.get $1 local.get $3 @@ -1179,9 +1180,9 @@ i32.and i32.store local.get $1 - call $runtime/asrt/getRight + call $assembly/index/getRight local.get $1 - call $runtime/asrt/getRight + call $assembly/index/getRight i32.load i32.const 2 i32.const -1 @@ -1193,24 +1194,29 @@ i32.const 16 i32.add ) - (func $runtime/asrt/__mm_allocate (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/__mm_allocate (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) - global.get $runtime/asrt/ROOT + global.get $assembly/index/ROOT local.set $1 local.get $1 i32.eqz if - call $runtime/asrt/initialize + call $assembly/index/initialize local.tee $1 - global.set $runtime/asrt/ROOT + global.set $assembly/index/ROOT end local.get $0 i32.const 1073741824 - i32.gt_u + i32.ge_u if + i32.const 0 + i32.const 24 + i32.const 498 + i32.const 29 + call $~lib/builtins/abort unreachable end local.get $0 @@ -1230,24 +1236,24 @@ local.set $0 local.get $1 local.get $0 - call $runtime/asrt/searchBlock + call $assembly/index/searchBlock local.set $4 local.get $4 i32.eqz if local.get $1 local.get $0 - call $runtime/asrt/growMemory + call $assembly/index/growMemory local.get $1 local.get $0 - call $runtime/asrt/searchBlock + call $assembly/index/searchBlock local.set $4 local.get $4 i32.eqz if i32.const 0 i32.const 24 - i32.const 495 + i32.const 504 i32.const 15 call $~lib/builtins/abort unreachable @@ -1265,7 +1271,7 @@ if i32.const 0 i32.const 24 - i32.const 497 + i32.const 506 i32.const 13 call $~lib/builtins/abort unreachable @@ -1282,9 +1288,9 @@ local.get $1 local.get $4 local.get $0 - call $runtime/asrt/prepareBlock + call $assembly/index/prepareBlock ) - (func $runtime/asrt/freeBlock (; 20 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/index/freeBlock (; 20 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) local.get $1 i32.load @@ -1297,7 +1303,7 @@ if i32.const 0 i32.const 24 - i32.const 459 + i32.const 468 i32.const 2 call $~lib/builtins/abort unreachable @@ -1309,9 +1315,9 @@ i32.store local.get $0 local.get $1 - call $runtime/asrt/insertBlock + call $assembly/index/insertBlock ) - (func $runtime/asrt/__mm_free (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/__mm_free (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 if @@ -1323,12 +1329,12 @@ if i32.const 0 i32.const 24 - i32.const 508 + i32.const 517 i32.const 4 call $~lib/builtins/abort unreachable end - global.get $runtime/asrt/ROOT + global.get $assembly/index/ROOT local.set $1 local.get $1 if @@ -1336,19 +1342,19 @@ local.get $0 i32.const 16 i32.sub - call $runtime/asrt/freeBlock + call $assembly/index/freeBlock end end ) - (func $runtime/asrt/__rt_visit_members (; 22 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/index/__rt_visit_members (; 22 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) unreachable ) - (func $runtime/asrt/__rt_flags (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/__rt_flags (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) unreachable ) (func $~lib/memory/memory.allocate (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) i32.const 0 - i32.const 72 + i32.const 80 i32.const 61 i32.const 9 call $~lib/builtins/abort @@ -1563,16 +1569,16 @@ end end ) - (func $runtime/asrt/growRoots (; 26 ;) (type $FUNCSIG$v) + (func $assembly/index/growRoots (; 26 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - global.get $runtime/asrt/ROOTS + global.get $assembly/index/ROOTS local.set $0 - global.get $runtime/asrt/CUR + global.get $assembly/index/CUR local.get $0 i32.sub local.set $1 @@ -1597,26 +1603,26 @@ local.get $1 call $~lib/memory/memory.copy local.get $5 - global.set $runtime/asrt/ROOTS + global.set $assembly/index/ROOTS local.get $5 local.get $1 i32.add - global.set $runtime/asrt/CUR + global.set $assembly/index/CUR local.get $5 local.get $4 i32.add - global.set $runtime/asrt/END + global.set $assembly/index/END ) - (func $runtime/asrt/appendRoot (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/appendRoot (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) - global.get $runtime/asrt/CUR + global.get $assembly/index/CUR local.set $1 local.get $1 - global.get $runtime/asrt/END + global.get $assembly/index/END i32.ge_u if - call $runtime/asrt/growRoots - global.get $runtime/asrt/CUR + call $assembly/index/growRoots + global.get $assembly/index/CUR local.set $1 end local.get $1 @@ -1625,9 +1631,9 @@ local.get $1 i32.const 1 i32.add - global.set $runtime/asrt/CUR + global.set $assembly/index/CUR ) - (func $runtime/asrt/decrement (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/decrement (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -1643,15 +1649,15 @@ if local.get $0 i32.const 1 - call $runtime/asrt/__rt_visit_members + call $assembly/index/__rt_visit_members local.get $1 i32.const -2147483648 i32.and i32.eqz if - global.get $runtime/asrt/ROOT + global.get $assembly/index/ROOT local.get $0 - call $runtime/asrt/freeBlock + call $assembly/index/freeBlock else local.get $0 i32.const -2147483648 @@ -1669,15 +1675,15 @@ if i32.const 0 i32.const 24 - i32.const 631 + i32.const 640 i32.const 15 call $~lib/builtins/abort unreachable end local.get $0 i32.load offset=8 - call $runtime/asrt/__rt_flags - global.get $runtime/asrt/ACYCLIC_FLAG + call $assembly/index/__rt_flags + global.get $assembly/index/ACYCLIC_FLAG i32.and i32.eqz if @@ -1696,7 +1702,7 @@ i32.eqz if local.get $0 - call $runtime/asrt/appendRoot + call $assembly/index/appendRoot end else local.get $0 @@ -1713,7 +1719,7 @@ end end ) - (func $runtime/asrt/markGray (; 29 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/markGray (; 29 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -1735,10 +1741,10 @@ i32.store offset=4 local.get $0 i32.const 2 - call $runtime/asrt/__rt_visit_members + call $assembly/index/__rt_visit_members end ) - (func $runtime/asrt/scanBlack (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/scanBlack (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 local.get $0 i32.load offset=4 @@ -1751,9 +1757,9 @@ i32.store offset=4 local.get $0 i32.const 4 - call $runtime/asrt/__rt_visit_members + call $assembly/index/__rt_visit_members ) - (func $runtime/asrt/scan (; 31 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/scan (; 31 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -1771,7 +1777,7 @@ i32.gt_u if local.get $0 - call $runtime/asrt/scanBlack + call $assembly/index/scanBlack else local.get $0 local.get $1 @@ -1784,11 +1790,11 @@ i32.store offset=4 local.get $0 i32.const 3 - call $runtime/asrt/__rt_visit_members + call $assembly/index/__rt_visit_members end end ) - (func $runtime/asrt/collectWhite (; 32 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/collectWhite (; 32 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -1809,13 +1815,13 @@ if local.get $0 i32.const 5 - call $runtime/asrt/__rt_visit_members + call $assembly/index/__rt_visit_members end - global.get $runtime/asrt/ROOT + global.get $assembly/index/ROOT local.get $0 - call $runtime/asrt/freeBlock + call $assembly/index/freeBlock ) - (func $runtime/asrt/__rt_visit (; 33 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/index/__rt_visit (; 33 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) block $break|0 block $case5|0 @@ -1850,7 +1856,7 @@ end block local.get $0 - call $runtime/asrt/decrement + call $assembly/index/decrement br $break|0 unreachable end @@ -1867,7 +1873,7 @@ if i32.const 0 i32.const 24 - i32.const 586 + i32.const 595 i32.const 17 call $~lib/builtins/abort unreachable @@ -1879,7 +1885,7 @@ i32.sub i32.store offset=4 local.get $0 - call $runtime/asrt/markGray + call $assembly/index/markGray br $break|0 unreachable end @@ -1887,7 +1893,7 @@ end block local.get $0 - call $runtime/asrt/scan + call $assembly/index/scan br $break|0 unreachable end @@ -1914,7 +1920,7 @@ if i32.const 0 i32.const 24 - i32.const 597 + i32.const 606 i32.const 6 call $~lib/builtins/abort unreachable @@ -1931,7 +1937,7 @@ i32.ne if local.get $0 - call $runtime/asrt/scanBlack + call $assembly/index/scanBlack end br $break|0 unreachable @@ -1940,7 +1946,7 @@ end block local.get $0 - call $runtime/asrt/collectWhite + call $assembly/index/collectWhite br $break|0 unreachable end @@ -1951,14 +1957,14 @@ if i32.const 0 i32.const 24 - i32.const 608 + i32.const 617 i32.const 24 call $~lib/builtins/abort unreachable end end ) - (func $runtime/asrt/increment (; 34 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/increment (; 34 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -1980,7 +1986,7 @@ if i32.const 0 i32.const 24 - i32.const 615 + i32.const 624 i32.const 2 call $~lib/builtins/abort unreachable @@ -1991,32 +1997,32 @@ i32.add i32.store offset=4 ) - (func $runtime/asrt/__gc_retain (; 35 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/__gc_retain (; 35 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 if local.get $0 i32.const 16 i32.sub - call $runtime/asrt/increment + call $assembly/index/increment end ) - (func $runtime/asrt/__gc_release (; 36 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/__gc_release (; 36 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 if local.get $0 i32.const 16 i32.sub - call $runtime/asrt/decrement + call $assembly/index/decrement end ) - (func $runtime/asrt/collectCycles (; 37 ;) (type $FUNCSIG$v) + (func $assembly/index/collectCycles (; 37 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - global.get $runtime/asrt/ROOTS + global.get $assembly/index/ROOTS local.set $0 local.get $0 local.set $1 @@ -2024,7 +2030,7 @@ block local.get $1 local.set $2 - global.get $runtime/asrt/CUR + global.get $assembly/index/CUR local.set $3 end loop $repeat|0 @@ -2056,7 +2062,7 @@ end if local.get $4 - call $runtime/asrt/markGray + call $assembly/index/markGray local.get $1 local.get $4 i32.store @@ -2079,9 +2085,9 @@ i32.const 0 end if - global.get $runtime/asrt/ROOT + global.get $assembly/index/ROOT local.get $4 - call $runtime/asrt/freeBlock + call $assembly/index/freeBlock else local.get $4 local.get $5 @@ -2103,7 +2109,7 @@ unreachable end local.get $1 - global.set $runtime/asrt/CUR + global.set $assembly/index/CUR block $break|1 local.get $0 local.set $3 @@ -2115,7 +2121,7 @@ br_if $break|1 local.get $3 i32.load - call $runtime/asrt/scan + call $assembly/index/scan local.get $3 i32.const 4 i32.add @@ -2147,7 +2153,7 @@ i32.and i32.store offset=4 local.get $2 - call $runtime/asrt/collectWhite + call $assembly/index/collectWhite end local.get $3 i32.const 4 @@ -2159,7 +2165,7 @@ unreachable end local.get $0 - global.set $runtime/asrt/CUR + global.set $assembly/index/CUR ) (func $null (; 38 ;) (type $FUNCSIG$v) )