diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 8c27338c24..9e4320505e 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -207,14 +207,11 @@ function insertBlock(root: Root, block: Block): void { // merge with right block if also free if (rightInfo & FREE) { - 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 - } + removeBlock(root, right); + block.mmInfo = blockInfo = blockInfo + BLOCK_OVERHEAD + (rightInfo & ~TAGS_MASK); // keep block tags + right = GETRIGHT(block); + rightInfo = right.mmInfo; + // 'back' is set below } // merge with left block if also free @@ -222,13 +219,10 @@ function insertBlock(root: Root, block: Block): void { let left = GETFREELEFT(block); let leftInfo = left.mmInfo; if (DEBUG) assert(leftInfo & FREE); // must be free according to right tags - 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 - } + removeBlock(root, left); + block = left; + block.mmInfo = blockInfo = leftInfo + BLOCK_OVERHEAD + (blockInfo & ~TAGS_MASK); // keep left tags + // 'back' is set below } right.mmInfo = rightInfo | LEFTFREE; @@ -236,7 +230,7 @@ function insertBlock(root: Root, block: Block): void { // we now know the size of the block var size = blockInfo & ~TAGS_MASK; - if (DEBUG) assert(size >= BLOCK_MINSIZE && size < BLOCK_MAXSIZE); // must be a valid size + if (DEBUG) assert(size >= BLOCK_MINSIZE); // must be a valid size if (DEBUG) assert(changetype(block) + BLOCK_OVERHEAD + size == changetype(right)); // must match // set 'back' to itself at the end of block @@ -249,8 +243,9 @@ function insertBlock(root: Root, block: Block): void { sl = (size >> AL_BITS); } else { const inv: usize = sizeof() * 8 - 1; - fl = inv - clz(size); - sl = ((size >> (fl - SL_BITS)) ^ (1 << SL_BITS)); + let boundedSize = min(size, BLOCK_MAXSIZE); + fl = inv - clz(boundedSize); + sl = ((boundedSize >> (fl - SL_BITS)) ^ (1 << SL_BITS)); fl -= SB_BITS - 1; } if (DEBUG) assert(fl < FL_BITS && sl < SL_SIZE); // fl/sl out of range @@ -272,7 +267,7 @@ function removeBlock(root: Root, block: Block): void { var blockInfo = block.mmInfo; if (DEBUG) assert(blockInfo & FREE); // must be free var size = blockInfo & ~TAGS_MASK; - if (DEBUG) assert(size >= BLOCK_MINSIZE && size < BLOCK_MAXSIZE); // must be valid + if (DEBUG) assert(size >= BLOCK_MINSIZE); // must be valid // mapping_insert var fl: usize, sl: u32; @@ -281,8 +276,9 @@ function removeBlock(root: Root, block: Block): void { sl = (size >> AL_BITS); } else { const inv: usize = sizeof() * 8 - 1; - fl = inv - clz(size); - sl = ((size >> (fl - SL_BITS)) ^ (1 << SL_BITS)); + let boundedSize = min(size, BLOCK_MAXSIZE); + fl = inv - clz(boundedSize); + sl = ((boundedSize >> (fl - SL_BITS)) ^ (1 << SL_BITS)); fl -= SB_BITS - 1; } if (DEBUG) assert(fl < FL_BITS && sl < SL_SIZE); // fl/sl out of range @@ -528,8 +524,6 @@ export function reallocateBlock(root: Root, block: Block, size: usize): Block { let mergeSize = blockSize + BLOCK_OVERHEAD + (rightInfo & ~TAGS_MASK); if (mergeSize >= payloadSize) { removeBlock(root, right); - // TODO: this can yield an intermediate block larger than BLOCK_MAXSIZE, which - // is immediately split though. does this trigger any assertions / issues? block.mmInfo = (blockInfo & TAGS_MASK) | mergeSize; prepareBlock(root, block, payloadSize); if (isDefined(ASC_RTRACE)) onresize(block, BLOCK_OVERHEAD + blockSize); diff --git a/tests/compiler/call-super.optimized.wat b/tests/compiler/call-super.optimized.wat index 93d903019d..830675ff78 100644 --- a/tests/compiler/call-super.optimized.wat +++ b/tests/compiler/call-super.optimized.wat @@ -274,7 +274,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -283,18 +283,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -308,12 +302,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -337,7 +338,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -422,8 +423,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -436,7 +435,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -456,15 +455,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -472,34 +473,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -507,76 +494,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -586,12 +551,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -599,34 +564,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -634,14 +603,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -664,7 +633,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -677,12 +646,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -704,7 +673,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -732,7 +701,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -760,7 +729,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1108,7 +1077,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1196,7 +1165,7 @@ if i32.const 0 i32.const 1440 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1248,7 +1217,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1279,7 +1248,7 @@ if i32.const 1104 i32.const 1440 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1370,7 +1339,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1385,7 +1354,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1404,7 +1373,7 @@ if i32.const 0 i32.const 1440 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/call-super.untouched.wat b/tests/compiler/call-super.untouched.wat index c2c5be54d7..f98bf0941c 100644 --- a/tests/compiler/call-super.untouched.wat +++ b/tests/compiler/call-super.untouched.wat @@ -398,7 +398,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -414,18 +414,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -441,12 +434,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -479,41 +481,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -526,55 +528,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -653,86 +655,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -741,25 +730,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -771,24 +743,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -798,7 +763,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -806,7 +771,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -816,24 +781,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -841,21 +815,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -865,18 +839,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -901,14 +875,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -922,17 +896,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -941,16 +915,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -970,7 +944,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1013,7 +987,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1046,7 +1020,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1289,7 +1263,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1620,7 +1594,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1704,7 +1678,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1769,7 +1743,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1920,7 +1894,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2029,7 +2003,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2049,7 +2023,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-implements.optimized.wat b/tests/compiler/class-implements.optimized.wat index 29a70a548a..a7decd8243 100644 --- a/tests/compiler/class-implements.optimized.wat +++ b/tests/compiler/class-implements.optimized.wat @@ -295,7 +295,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -304,18 +304,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -329,12 +323,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -358,7 +359,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -443,8 +444,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -457,7 +456,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -477,15 +476,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -493,34 +494,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -528,76 +515,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -607,12 +572,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -620,34 +585,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -655,14 +624,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -685,7 +654,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -698,12 +667,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -725,7 +694,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -753,7 +722,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -781,7 +750,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1129,7 +1098,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1197,7 +1166,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1278,7 +1247,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1293,7 +1262,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-implements.untouched.wat b/tests/compiler/class-implements.untouched.wat index a67a4aafb2..4d5c022163 100644 --- a/tests/compiler/class-implements.untouched.wat +++ b/tests/compiler/class-implements.untouched.wat @@ -408,7 +408,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,18 +424,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -451,12 +444,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -489,41 +491,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -536,55 +538,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -663,86 +665,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -751,25 +740,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -781,24 +753,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -808,7 +773,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -816,7 +781,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -826,24 +791,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -851,21 +825,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -875,18 +849,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -911,14 +885,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -932,17 +906,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -951,16 +925,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -980,7 +954,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1023,7 +997,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1056,7 +1030,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1299,7 +1273,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1630,7 +1604,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1714,7 +1688,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1779,7 +1753,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1930,7 +1904,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2039,7 +2013,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2059,7 +2033,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-overloading.optimized.wat b/tests/compiler/class-overloading.optimized.wat index ece8075025..61a709c927 100644 --- a/tests/compiler/class-overloading.optimized.wat +++ b/tests/compiler/class-overloading.optimized.wat @@ -333,7 +333,7 @@ if i32.const 0 i32.const 1424 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -342,18 +342,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -367,12 +361,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -396,7 +397,7 @@ if i32.const 0 i32.const 1424 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -481,8 +482,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -495,7 +494,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -515,15 +514,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -531,34 +532,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -566,76 +553,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1424 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -645,12 +610,12 @@ if i32.const 0 i32.const 1424 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -658,34 +623,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -693,14 +662,14 @@ if i32.const 0 i32.const 1424 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -723,7 +692,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -736,12 +705,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -763,7 +732,7 @@ if i32.const 0 i32.const 1424 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -791,7 +760,7 @@ if i32.const 0 i32.const 1424 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -819,7 +788,7 @@ if i32.const 0 i32.const 1424 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1167,7 +1136,7 @@ if i32.const 0 i32.const 1424 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1235,7 +1204,7 @@ if i32.const 0 i32.const 1424 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1316,7 +1285,7 @@ if i32.const 0 i32.const 1424 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1331,7 +1300,7 @@ if i32.const 0 i32.const 1424 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-overloading.untouched.wat b/tests/compiler/class-overloading.untouched.wat index bdfba52cd7..f65017f8bb 100644 --- a/tests/compiler/class-overloading.untouched.wat +++ b/tests/compiler/class-overloading.untouched.wat @@ -414,7 +414,7 @@ if i32.const 0 i32.const 400 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -430,18 +430,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -457,12 +450,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -495,41 +497,41 @@ if i32.const 0 i32.const 400 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -542,55 +544,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -669,86 +671,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 400 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -757,25 +746,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -787,24 +759,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -814,7 +779,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -822,7 +787,7 @@ if i32.const 0 i32.const 400 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -832,24 +797,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -857,21 +831,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -881,18 +855,18 @@ if i32.const 0 i32.const 400 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -917,14 +891,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -938,17 +912,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -957,16 +931,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -986,7 +960,7 @@ if i32.const 0 i32.const 400 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1029,7 +1003,7 @@ if i32.const 0 i32.const 400 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1062,7 +1036,7 @@ if i32.const 0 i32.const 400 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1305,7 +1279,7 @@ if i32.const 0 i32.const 400 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1636,7 +1610,7 @@ if i32.const 64 i32.const 400 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1720,7 +1694,7 @@ if i32.const 0 i32.const 400 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1785,7 +1759,7 @@ if i32.const 0 i32.const 400 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1936,7 +1910,7 @@ if i32.const 0 i32.const 400 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2045,7 +2019,7 @@ if i32.const 0 i32.const 400 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2065,7 +2039,7 @@ if i32.const 0 i32.const 400 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class.optimized.wat b/tests/compiler/class.optimized.wat index c8e25cb77f..ece2fbb193 100644 --- a/tests/compiler/class.optimized.wat +++ b/tests/compiler/class.optimized.wat @@ -281,7 +281,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -290,18 +290,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -315,12 +309,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -344,7 +345,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -429,8 +430,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -443,7 +442,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -463,15 +462,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -479,34 +480,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -514,76 +501,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -593,12 +558,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -606,34 +571,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -641,14 +610,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -671,7 +640,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -684,12 +653,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -711,7 +680,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -739,7 +708,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -767,7 +736,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1115,7 +1084,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1203,7 +1172,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1255,7 +1224,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1286,7 +1255,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1377,7 +1346,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1392,7 +1361,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1411,7 +1380,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class.untouched.wat b/tests/compiler/class.untouched.wat index 7ae42ab119..7b8f71d527 100644 --- a/tests/compiler/class.untouched.wat +++ b/tests/compiler/class.untouched.wat @@ -510,7 +510,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -526,18 +526,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -553,12 +546,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -591,41 +593,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -638,55 +640,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -765,86 +767,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -853,25 +842,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -883,24 +855,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -910,7 +875,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -918,7 +883,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -928,24 +893,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -953,21 +927,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -977,18 +951,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1013,14 +987,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1034,17 +1008,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1053,16 +1027,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1082,7 +1056,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1125,7 +1099,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1158,7 +1132,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1401,7 +1375,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1732,7 +1706,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1816,7 +1790,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1881,7 +1855,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2032,7 +2006,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2141,7 +2115,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2161,7 +2135,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/constructor.optimized.wat b/tests/compiler/constructor.optimized.wat index 6539c146f2..689db7a8d4 100644 --- a/tests/compiler/constructor.optimized.wat +++ b/tests/compiler/constructor.optimized.wat @@ -342,7 +342,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -351,18 +351,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -376,12 +370,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -405,7 +406,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -490,8 +491,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -504,7 +503,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -524,15 +523,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -540,34 +541,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -575,76 +562,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -654,12 +619,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -667,34 +632,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -702,14 +671,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -732,7 +701,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -745,12 +714,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -772,7 +741,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -800,7 +769,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -828,7 +797,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1176,7 +1145,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1264,7 +1233,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1316,7 +1285,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1347,7 +1316,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1438,7 +1407,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1453,7 +1422,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1472,7 +1441,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/constructor.untouched.wat b/tests/compiler/constructor.untouched.wat index 158cf4f587..9a8bd7953f 100644 --- a/tests/compiler/constructor.untouched.wat +++ b/tests/compiler/constructor.untouched.wat @@ -408,7 +408,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,18 +424,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -451,12 +444,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -489,41 +491,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -536,55 +538,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -663,86 +665,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -751,25 +740,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -781,24 +753,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -808,7 +773,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -816,7 +781,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -826,24 +791,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -851,21 +825,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -875,18 +849,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -911,14 +885,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -932,17 +906,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -951,16 +925,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -980,7 +954,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1023,7 +997,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1056,7 +1030,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1299,7 +1273,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1630,7 +1604,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1714,7 +1688,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1779,7 +1753,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1930,7 +1904,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2039,7 +2013,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2059,7 +2033,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/do.optimized.wat b/tests/compiler/do.optimized.wat index 2d411408b7..b081c8036a 100644 --- a/tests/compiler/do.optimized.wat +++ b/tests/compiler/do.optimized.wat @@ -273,7 +273,7 @@ if i32.const 0 i32.const 1424 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -282,18 +282,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -307,12 +301,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -336,7 +337,7 @@ if i32.const 0 i32.const 1424 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -421,8 +422,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -435,7 +434,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -455,15 +454,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -471,34 +472,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -506,76 +493,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1424 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -585,12 +550,12 @@ if i32.const 0 i32.const 1424 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -598,34 +563,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -633,14 +602,14 @@ if i32.const 0 i32.const 1424 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -663,7 +632,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -676,12 +645,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -703,7 +672,7 @@ if i32.const 0 i32.const 1424 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -731,7 +700,7 @@ if i32.const 0 i32.const 1424 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -759,7 +728,7 @@ if i32.const 0 i32.const 1424 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1107,7 +1076,7 @@ if i32.const 0 i32.const 1424 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1175,7 +1144,7 @@ if i32.const 0 i32.const 1424 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1256,7 +1225,7 @@ if i32.const 0 i32.const 1424 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1271,7 +1240,7 @@ if i32.const 0 i32.const 1424 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/do.untouched.wat b/tests/compiler/do.untouched.wat index deb5cde058..c28ec1fd83 100644 --- a/tests/compiler/do.untouched.wat +++ b/tests/compiler/do.untouched.wat @@ -811,7 +811,7 @@ if i32.const 0 i32.const 400 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -827,18 +827,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -854,12 +847,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -892,41 +894,41 @@ if i32.const 0 i32.const 400 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -939,55 +941,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1066,86 +1068,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 400 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1154,25 +1143,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1184,24 +1156,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1211,7 +1176,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1219,7 +1184,7 @@ if i32.const 0 i32.const 400 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1229,24 +1194,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1254,21 +1228,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1278,18 +1252,18 @@ if i32.const 0 i32.const 400 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1314,14 +1288,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1335,17 +1309,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1354,16 +1328,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1383,7 +1357,7 @@ if i32.const 0 i32.const 400 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1426,7 +1400,7 @@ if i32.const 0 i32.const 400 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1459,7 +1433,7 @@ if i32.const 0 i32.const 400 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1702,7 +1676,7 @@ if i32.const 0 i32.const 400 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -2033,7 +2007,7 @@ if i32.const 64 i32.const 400 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2117,7 +2091,7 @@ if i32.const 0 i32.const 400 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2182,7 +2156,7 @@ if i32.const 0 i32.const 400 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2333,7 +2307,7 @@ if i32.const 0 i32.const 400 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2442,7 +2416,7 @@ if i32.const 0 i32.const 400 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2462,7 +2436,7 @@ if i32.const 0 i32.const 400 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/empty-exportruntime.optimized.wat b/tests/compiler/empty-exportruntime.optimized.wat index e8eb27890d..ab75059b7f 100644 --- a/tests/compiler/empty-exportruntime.optimized.wat +++ b/tests/compiler/empty-exportruntime.optimized.wat @@ -292,7 +292,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -301,18 +301,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -326,12 +320,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -355,7 +356,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -440,8 +441,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -454,7 +453,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -474,15 +473,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -490,34 +491,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -525,76 +512,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -604,12 +569,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -617,34 +582,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -652,14 +621,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -682,7 +651,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -695,12 +664,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -722,7 +691,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -750,7 +719,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -778,7 +747,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1126,7 +1095,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1214,7 +1183,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1266,7 +1235,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1297,7 +1266,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1388,7 +1357,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1403,7 +1372,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1422,7 +1391,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/empty-exportruntime.untouched.wat b/tests/compiler/empty-exportruntime.untouched.wat index 8b7ff30ef2..bd4a300f3d 100644 --- a/tests/compiler/empty-exportruntime.untouched.wat +++ b/tests/compiler/empty-exportruntime.untouched.wat @@ -404,7 +404,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -420,18 +420,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -447,12 +440,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -485,41 +487,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -532,55 +534,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -659,86 +661,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -747,25 +736,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -777,24 +749,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -804,7 +769,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -812,7 +777,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -822,24 +787,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -847,21 +821,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -871,18 +845,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -907,14 +881,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -928,17 +902,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -947,16 +921,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -976,7 +950,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1019,7 +993,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1052,7 +1026,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1295,7 +1269,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1626,7 +1600,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1710,7 +1684,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1775,7 +1749,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1926,7 +1900,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2035,7 +2009,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2055,7 +2029,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/empty-new.optimized.wat b/tests/compiler/empty-new.optimized.wat index 3b52fdedc5..8b2b140510 100644 --- a/tests/compiler/empty-new.optimized.wat +++ b/tests/compiler/empty-new.optimized.wat @@ -269,7 +269,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -278,18 +278,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -303,12 +297,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -332,7 +333,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -417,8 +418,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -431,7 +430,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -451,15 +450,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -467,34 +468,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -502,76 +489,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -581,12 +546,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -594,34 +559,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -629,14 +598,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -659,7 +628,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -672,12 +641,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -699,7 +668,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -727,7 +696,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -755,7 +724,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1103,7 +1072,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1171,7 +1140,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1252,7 +1221,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1267,7 +1236,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/empty-new.untouched.wat b/tests/compiler/empty-new.untouched.wat index 8056b409d4..be731b7c9e 100644 --- a/tests/compiler/empty-new.untouched.wat +++ b/tests/compiler/empty-new.untouched.wat @@ -397,7 +397,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -413,18 +413,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -440,12 +433,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -478,41 +480,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -525,55 +527,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -652,86 +654,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -740,25 +729,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -770,24 +742,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -797,7 +762,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -805,7 +770,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -815,24 +780,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -840,21 +814,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -864,18 +838,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -900,14 +874,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -921,17 +895,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -940,16 +914,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -969,7 +943,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1012,7 +986,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1045,7 +1019,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1288,7 +1262,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1619,7 +1593,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1703,7 +1677,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1768,7 +1742,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1919,7 +1893,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2028,7 +2002,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2048,7 +2022,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index 016fa0e46d..4c7ecc8a1f 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -323,7 +323,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -332,18 +332,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -357,12 +351,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -386,7 +387,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -471,8 +472,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -485,7 +484,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -505,15 +504,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -521,34 +522,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -556,76 +543,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -635,12 +600,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -648,34 +613,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -683,14 +652,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -713,7 +682,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -726,12 +695,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -753,7 +722,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -781,7 +750,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -809,7 +778,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1157,7 +1126,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1225,7 +1194,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1306,7 +1275,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1321,7 +1290,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/exports.untouched.wat b/tests/compiler/exports.untouched.wat index 572844ee65..32e3e862dd 100644 --- a/tests/compiler/exports.untouched.wat +++ b/tests/compiler/exports.untouched.wat @@ -461,7 +461,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -477,18 +477,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -504,12 +497,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -542,41 +544,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -589,55 +591,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -716,86 +718,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -804,25 +793,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -834,24 +806,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -861,7 +826,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -869,7 +834,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -879,24 +844,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -904,21 +878,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -928,18 +902,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -964,14 +938,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -985,17 +959,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1004,16 +978,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1033,7 +1007,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1076,7 +1050,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1109,7 +1083,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1352,7 +1326,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1683,7 +1657,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1767,7 +1741,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1832,7 +1806,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1983,7 +1957,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2092,7 +2066,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2112,7 +2086,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/exportstar-rereexport.optimized.wat b/tests/compiler/exportstar-rereexport.optimized.wat index 8e3baf1299..519291f42c 100644 --- a/tests/compiler/exportstar-rereexport.optimized.wat +++ b/tests/compiler/exportstar-rereexport.optimized.wat @@ -324,7 +324,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -333,18 +333,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -358,12 +352,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -387,7 +388,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -472,8 +473,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -486,7 +485,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -506,15 +505,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -522,34 +523,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -557,76 +544,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -636,12 +601,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -649,34 +614,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -684,14 +653,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -714,7 +683,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -727,12 +696,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -754,7 +723,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -782,7 +751,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -810,7 +779,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1158,7 +1127,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1226,7 +1195,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1307,7 +1276,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1322,7 +1291,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/exportstar-rereexport.untouched.wat b/tests/compiler/exportstar-rereexport.untouched.wat index 242197f518..f35a7c83bc 100644 --- a/tests/compiler/exportstar-rereexport.untouched.wat +++ b/tests/compiler/exportstar-rereexport.untouched.wat @@ -442,7 +442,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -458,18 +458,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -485,12 +478,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -523,41 +525,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -570,55 +572,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -697,86 +699,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -785,25 +774,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -815,24 +787,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -842,7 +807,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -850,7 +815,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -860,24 +825,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -885,21 +859,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -909,18 +883,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -945,14 +919,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -966,17 +940,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -985,16 +959,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1014,7 +988,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1057,7 +1031,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1090,7 +1064,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1333,7 +1307,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1664,7 +1638,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1748,7 +1722,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1813,7 +1787,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1964,7 +1938,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2073,7 +2047,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2093,7 +2067,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-baseaggregate.optimized.wat b/tests/compiler/extends-baseaggregate.optimized.wat index c31f102dce..71e9b4d692 100644 --- a/tests/compiler/extends-baseaggregate.optimized.wat +++ b/tests/compiler/extends-baseaggregate.optimized.wat @@ -288,7 +288,7 @@ if i32.const 0 i32.const 1552 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -297,18 +297,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1552 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -322,12 +316,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -351,7 +352,7 @@ if i32.const 0 i32.const 1552 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -436,8 +437,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -450,7 +449,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -470,15 +469,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -486,34 +487,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -521,76 +508,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1552 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1552 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -600,12 +565,12 @@ if i32.const 0 i32.const 1552 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -613,34 +578,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -648,14 +617,14 @@ if i32.const 0 i32.const 1552 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -678,7 +647,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -691,12 +660,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -718,7 +687,7 @@ if i32.const 0 i32.const 1552 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -746,7 +715,7 @@ if i32.const 0 i32.const 1552 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -774,7 +743,7 @@ if i32.const 0 i32.const 1552 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1122,7 +1091,7 @@ if i32.const 0 i32.const 1552 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1210,7 +1179,7 @@ if i32.const 0 i32.const 1552 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1262,7 +1231,7 @@ if i32.const 0 i32.const 1552 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1293,7 +1262,7 @@ if i32.const 1216 i32.const 1552 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1384,7 +1353,7 @@ if i32.const 0 i32.const 1552 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1399,7 +1368,7 @@ if i32.const 0 i32.const 1552 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1418,7 +1387,7 @@ if i32.const 0 i32.const 1552 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-baseaggregate.untouched.wat b/tests/compiler/extends-baseaggregate.untouched.wat index ac9236c7f8..fdebdd8066 100644 --- a/tests/compiler/extends-baseaggregate.untouched.wat +++ b/tests/compiler/extends-baseaggregate.untouched.wat @@ -406,7 +406,7 @@ if i32.const 0 i32.const 528 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -422,18 +422,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 528 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -449,12 +442,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -487,41 +489,41 @@ if i32.const 0 i32.const 528 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -534,55 +536,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -661,86 +663,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 528 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -749,25 +738,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -779,24 +751,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 528 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -806,7 +771,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -814,7 +779,7 @@ if i32.const 0 i32.const 528 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -824,24 +789,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -849,21 +823,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -873,18 +847,18 @@ if i32.const 0 i32.const 528 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -909,14 +883,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -930,17 +904,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -949,16 +923,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -978,7 +952,7 @@ if i32.const 0 i32.const 528 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1021,7 +995,7 @@ if i32.const 0 i32.const 528 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1054,7 +1028,7 @@ if i32.const 0 i32.const 528 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1297,7 +1271,7 @@ if i32.const 0 i32.const 528 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1628,7 +1602,7 @@ if i32.const 192 i32.const 528 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1712,7 +1686,7 @@ if i32.const 0 i32.const 528 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1777,7 +1751,7 @@ if i32.const 0 i32.const 528 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1928,7 +1902,7 @@ if i32.const 0 i32.const 528 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2037,7 +2011,7 @@ if i32.const 0 i32.const 528 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2057,7 +2031,7 @@ if i32.const 0 i32.const 528 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-recursive.optimized.wat b/tests/compiler/extends-recursive.optimized.wat index 7962787d99..78aa7e5bc7 100644 --- a/tests/compiler/extends-recursive.optimized.wat +++ b/tests/compiler/extends-recursive.optimized.wat @@ -276,7 +276,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -285,18 +285,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -310,12 +304,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -339,7 +340,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,8 +425,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -438,7 +437,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -458,15 +457,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -474,34 +475,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -509,76 +496,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -588,12 +553,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -601,34 +566,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -636,14 +605,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -666,7 +635,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -679,12 +648,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -706,7 +675,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -734,7 +703,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -762,7 +731,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1110,7 +1079,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1178,7 +1147,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1259,7 +1228,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1274,7 +1243,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-recursive.untouched.wat b/tests/compiler/extends-recursive.untouched.wat index 57f3927dbe..3a2c29d05b 100644 --- a/tests/compiler/extends-recursive.untouched.wat +++ b/tests/compiler/extends-recursive.untouched.wat @@ -402,7 +402,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -418,18 +418,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -445,12 +438,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -483,41 +485,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -530,55 +532,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -657,86 +659,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -745,25 +734,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -775,24 +747,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -802,7 +767,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -810,7 +775,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -820,24 +785,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -845,21 +819,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -869,18 +843,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -905,14 +879,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -926,17 +900,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -945,16 +919,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -974,7 +948,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1017,7 +991,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1050,7 +1024,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1293,7 +1267,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1624,7 +1598,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1708,7 +1682,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1773,7 +1747,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1924,7 +1898,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2033,7 +2007,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2053,7 +2027,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/features/simd.optimized.wat b/tests/compiler/features/simd.optimized.wat index 055f07438e..9a1ae55a67 100644 --- a/tests/compiler/features/simd.optimized.wat +++ b/tests/compiler/features/simd.optimized.wat @@ -31,7 +31,7 @@ if i32.const 0 i32.const 1056 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -40,18 +40,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1056 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -65,12 +59,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -94,7 +95,7 @@ if i32.const 0 i32.const 1056 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -179,8 +180,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -193,7 +192,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -213,15 +212,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -229,34 +230,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -264,76 +251,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1056 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1056 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -343,12 +308,12 @@ if i32.const 0 i32.const 1056 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -356,34 +321,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -391,14 +360,14 @@ if i32.const 0 i32.const 1056 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -421,7 +390,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -434,12 +403,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -461,7 +430,7 @@ if i32.const 0 i32.const 1056 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -489,7 +458,7 @@ if i32.const 0 i32.const 1056 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -517,7 +486,7 @@ if i32.const 0 i32.const 1056 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -699,7 +668,7 @@ if i32.const 0 i32.const 1056 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -751,7 +720,7 @@ if i32.const 0 i32.const 1056 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -782,7 +751,7 @@ if i32.const 1120 i32.const 1056 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -873,7 +842,7 @@ if i32.const 0 i32.const 1056 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -888,7 +857,7 @@ if i32.const 0 i32.const 1056 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -907,7 +876,7 @@ if i32.const 0 i32.const 1056 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -1022,7 +991,7 @@ if i32.const 0 i32.const 1056 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/features/simd.untouched.wat b/tests/compiler/features/simd.untouched.wat index d7e783a1f3..bb52bdfa0f 100644 --- a/tests/compiler/features/simd.untouched.wat +++ b/tests/compiler/features/simd.untouched.wat @@ -70,7 +70,7 @@ if i32.const 0 i32.const 32 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -86,18 +86,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 32 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -113,12 +106,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -151,41 +153,41 @@ if i32.const 0 i32.const 32 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -198,55 +200,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -325,86 +327,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 32 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -413,25 +402,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -443,24 +415,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 32 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -470,7 +435,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -478,7 +443,7 @@ if i32.const 0 i32.const 32 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -488,24 +453,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -513,21 +487,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -537,18 +511,18 @@ if i32.const 0 i32.const 32 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -573,14 +547,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -594,17 +568,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -613,16 +587,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -642,7 +616,7 @@ if i32.const 0 i32.const 32 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -685,7 +659,7 @@ if i32.const 0 i32.const 32 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -718,7 +692,7 @@ if i32.const 0 i32.const 32 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -958,7 +932,7 @@ if i32.const 96 i32.const 32 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1042,7 +1016,7 @@ if i32.const 0 i32.const 32 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1107,7 +1081,7 @@ if i32.const 0 i32.const 32 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1258,7 +1232,7 @@ if i32.const 0 i32.const 32 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -1367,7 +1341,7 @@ if i32.const 0 i32.const 32 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1387,7 +1361,7 @@ if i32.const 0 i32.const 32 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1445,7 +1419,7 @@ if i32.const 0 i32.const 32 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/field-initialization.optimized.wat b/tests/compiler/field-initialization.optimized.wat index 2db7885209..1b8f48cf39 100644 --- a/tests/compiler/field-initialization.optimized.wat +++ b/tests/compiler/field-initialization.optimized.wat @@ -294,7 +294,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -303,18 +303,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -328,12 +322,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -357,7 +358,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -442,8 +443,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -456,7 +455,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -476,15 +475,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -492,34 +493,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -527,76 +514,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -606,12 +571,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -619,34 +584,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -654,14 +623,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -684,7 +653,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -697,12 +666,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -724,7 +693,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -752,7 +721,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -780,7 +749,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1128,7 +1097,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1216,7 +1185,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1268,7 +1237,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1299,7 +1268,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1390,7 +1359,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1405,7 +1374,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1424,7 +1393,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/field-initialization.untouched.wat b/tests/compiler/field-initialization.untouched.wat index a2ec7e420d..0676d2cf82 100644 --- a/tests/compiler/field-initialization.untouched.wat +++ b/tests/compiler/field-initialization.untouched.wat @@ -406,7 +406,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -422,18 +422,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -449,12 +442,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -487,41 +489,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -534,55 +536,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -661,86 +663,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -749,25 +738,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -779,24 +751,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -806,7 +771,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -814,7 +779,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -824,24 +789,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -849,21 +823,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -873,18 +847,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -909,14 +883,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -930,17 +904,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -949,16 +923,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -978,7 +952,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1021,7 +995,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1054,7 +1028,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1297,7 +1271,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1628,7 +1602,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1712,7 +1686,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1777,7 +1751,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1928,7 +1902,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2037,7 +2011,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2057,7 +2031,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/for.optimized.wat b/tests/compiler/for.optimized.wat index 303f05027b..20d1e37b15 100644 --- a/tests/compiler/for.optimized.wat +++ b/tests/compiler/for.optimized.wat @@ -273,7 +273,7 @@ if i32.const 0 i32.const 1424 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -282,18 +282,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -307,12 +301,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -336,7 +337,7 @@ if i32.const 0 i32.const 1424 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -421,8 +422,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -435,7 +434,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -455,15 +454,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -471,34 +472,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -506,76 +493,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1424 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -585,12 +550,12 @@ if i32.const 0 i32.const 1424 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -598,34 +563,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -633,14 +602,14 @@ if i32.const 0 i32.const 1424 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -663,7 +632,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -676,12 +645,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -703,7 +672,7 @@ if i32.const 0 i32.const 1424 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -731,7 +700,7 @@ if i32.const 0 i32.const 1424 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -759,7 +728,7 @@ if i32.const 0 i32.const 1424 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1107,7 +1076,7 @@ if i32.const 0 i32.const 1424 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1175,7 +1144,7 @@ if i32.const 0 i32.const 1424 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1256,7 +1225,7 @@ if i32.const 0 i32.const 1424 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1271,7 +1240,7 @@ if i32.const 0 i32.const 1424 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/for.untouched.wat b/tests/compiler/for.untouched.wat index 88a9566870..261dbdbb5f 100644 --- a/tests/compiler/for.untouched.wat +++ b/tests/compiler/for.untouched.wat @@ -824,7 +824,7 @@ if i32.const 0 i32.const 400 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -840,18 +840,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -867,12 +860,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -905,41 +907,41 @@ if i32.const 0 i32.const 400 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -952,55 +954,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1079,86 +1081,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 400 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1167,25 +1156,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1197,24 +1169,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1224,7 +1189,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1232,7 +1197,7 @@ if i32.const 0 i32.const 400 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1242,24 +1207,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1267,21 +1241,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1291,18 +1265,18 @@ if i32.const 0 i32.const 400 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1327,14 +1301,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1348,17 +1322,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1367,16 +1341,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1396,7 +1370,7 @@ if i32.const 0 i32.const 400 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1439,7 +1413,7 @@ if i32.const 0 i32.const 400 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1472,7 +1446,7 @@ if i32.const 0 i32.const 400 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1715,7 +1689,7 @@ if i32.const 0 i32.const 400 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -2046,7 +2020,7 @@ if i32.const 64 i32.const 400 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2130,7 +2104,7 @@ if i32.const 0 i32.const 400 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2195,7 +2169,7 @@ if i32.const 0 i32.const 400 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2346,7 +2320,7 @@ if i32.const 0 i32.const 400 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2455,7 +2429,7 @@ if i32.const 0 i32.const 400 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2475,7 +2449,7 @@ if i32.const 0 i32.const 400 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-call.optimized.wat b/tests/compiler/function-call.optimized.wat index 9da69712cd..ee42b6a0ae 100644 --- a/tests/compiler/function-call.optimized.wat +++ b/tests/compiler/function-call.optimized.wat @@ -311,7 +311,7 @@ if i32.const 0 i32.const 1616 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -320,18 +320,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -345,12 +339,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -374,7 +375,7 @@ if i32.const 0 i32.const 1616 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -459,8 +460,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -473,7 +472,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -493,15 +492,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -509,34 +510,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -544,76 +531,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1616 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -623,12 +588,12 @@ if i32.const 0 i32.const 1616 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -636,34 +601,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -671,14 +640,14 @@ if i32.const 0 i32.const 1616 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -701,7 +670,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -714,12 +683,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -741,7 +710,7 @@ if i32.const 0 i32.const 1616 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -769,7 +738,7 @@ if i32.const 0 i32.const 1616 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -797,7 +766,7 @@ if i32.const 0 i32.const 1616 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1145,7 +1114,7 @@ if i32.const 0 i32.const 1616 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1213,7 +1182,7 @@ if i32.const 0 i32.const 1616 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1294,7 +1263,7 @@ if i32.const 0 i32.const 1616 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1309,7 +1278,7 @@ if i32.const 0 i32.const 1616 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-call.untouched.wat b/tests/compiler/function-call.untouched.wat index 547f6c35a4..76822492b5 100644 --- a/tests/compiler/function-call.untouched.wat +++ b/tests/compiler/function-call.untouched.wat @@ -433,7 +433,7 @@ if i32.const 0 i32.const 592 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -449,18 +449,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -476,12 +469,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -514,41 +516,41 @@ if i32.const 0 i32.const 592 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -561,55 +563,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -688,86 +690,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 592 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -776,25 +765,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -806,24 +778,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -833,7 +798,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -841,7 +806,7 @@ if i32.const 0 i32.const 592 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -851,24 +816,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -876,21 +850,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -900,18 +874,18 @@ if i32.const 0 i32.const 592 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -936,14 +910,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -957,17 +931,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -976,16 +950,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1005,7 +979,7 @@ if i32.const 0 i32.const 592 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1048,7 +1022,7 @@ if i32.const 0 i32.const 592 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1081,7 +1055,7 @@ if i32.const 0 i32.const 592 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1324,7 +1298,7 @@ if i32.const 0 i32.const 592 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1655,7 +1629,7 @@ if i32.const 256 i32.const 592 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1739,7 +1713,7 @@ if i32.const 0 i32.const 592 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1804,7 +1778,7 @@ if i32.const 0 i32.const 592 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1955,7 +1929,7 @@ if i32.const 0 i32.const 592 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2064,7 +2038,7 @@ if i32.const 0 i32.const 592 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2084,7 +2058,7 @@ if i32.const 0 i32.const 592 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-expression.optimized.wat b/tests/compiler/function-expression.optimized.wat index 364af50f36..c9b4308cbb 100644 --- a/tests/compiler/function-expression.optimized.wat +++ b/tests/compiler/function-expression.optimized.wat @@ -340,7 +340,7 @@ if i32.const 0 i32.const 1936 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -349,18 +349,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1936 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -374,12 +368,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -403,7 +404,7 @@ if i32.const 0 i32.const 1936 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -488,8 +489,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -502,7 +501,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -522,15 +521,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -538,34 +539,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -573,76 +560,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1936 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1936 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -652,12 +617,12 @@ if i32.const 0 i32.const 1936 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -665,34 +630,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -700,14 +669,14 @@ if i32.const 0 i32.const 1936 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -730,7 +699,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -743,12 +712,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -770,7 +739,7 @@ if i32.const 0 i32.const 1936 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -798,7 +767,7 @@ if i32.const 0 i32.const 1936 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -826,7 +795,7 @@ if i32.const 0 i32.const 1936 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1174,7 +1143,7 @@ if i32.const 0 i32.const 1936 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1242,7 +1211,7 @@ if i32.const 0 i32.const 1936 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1323,7 +1292,7 @@ if i32.const 0 i32.const 1936 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1338,7 +1307,7 @@ if i32.const 0 i32.const 1936 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-expression.untouched.wat b/tests/compiler/function-expression.untouched.wat index 347bb22919..e705997d21 100644 --- a/tests/compiler/function-expression.untouched.wat +++ b/tests/compiler/function-expression.untouched.wat @@ -589,7 +589,7 @@ if i32.const 0 i32.const 912 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -605,18 +605,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 912 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -632,12 +625,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -670,41 +672,41 @@ if i32.const 0 i32.const 912 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -717,55 +719,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -844,86 +846,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 912 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -932,25 +921,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -962,24 +934,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 912 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -989,7 +954,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -997,7 +962,7 @@ if i32.const 0 i32.const 912 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1007,24 +972,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1032,21 +1006,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1056,18 +1030,18 @@ if i32.const 0 i32.const 912 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1092,14 +1066,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1113,17 +1087,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1132,16 +1106,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1161,7 +1135,7 @@ if i32.const 0 i32.const 912 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1204,7 +1178,7 @@ if i32.const 0 i32.const 912 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1237,7 +1211,7 @@ if i32.const 0 i32.const 912 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1480,7 +1454,7 @@ if i32.const 0 i32.const 912 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1811,7 +1785,7 @@ if i32.const 576 i32.const 912 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1895,7 +1869,7 @@ if i32.const 0 i32.const 912 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1960,7 +1934,7 @@ if i32.const 0 i32.const 912 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2111,7 +2085,7 @@ if i32.const 0 i32.const 912 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2220,7 +2194,7 @@ if i32.const 0 i32.const 912 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2240,7 +2214,7 @@ if i32.const 0 i32.const 912 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/getter-call.optimized.wat b/tests/compiler/getter-call.optimized.wat index 84fd405f36..71de45b04a 100644 --- a/tests/compiler/getter-call.optimized.wat +++ b/tests/compiler/getter-call.optimized.wat @@ -276,7 +276,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -285,18 +285,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -310,12 +304,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -339,7 +340,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,8 +425,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -438,7 +437,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -458,15 +457,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -474,34 +475,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -509,76 +496,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -588,12 +553,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -601,34 +566,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -636,14 +605,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -666,7 +635,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -679,12 +648,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -706,7 +675,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -734,7 +703,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -762,7 +731,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1110,7 +1079,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1178,7 +1147,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1259,7 +1228,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1274,7 +1243,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/getter-call.untouched.wat b/tests/compiler/getter-call.untouched.wat index 043c10875d..fcbe9778fc 100644 --- a/tests/compiler/getter-call.untouched.wat +++ b/tests/compiler/getter-call.untouched.wat @@ -401,7 +401,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -417,18 +417,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -444,12 +437,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -482,41 +484,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -529,55 +531,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -656,86 +658,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -744,25 +733,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -774,24 +746,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -801,7 +766,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -809,7 +774,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -819,24 +784,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -844,21 +818,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -868,18 +842,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -904,14 +878,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -925,17 +899,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -944,16 +918,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -973,7 +947,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1016,7 +990,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1049,7 +1023,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1292,7 +1266,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1623,7 +1597,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1707,7 +1681,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1772,7 +1746,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1923,7 +1897,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2032,7 +2006,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2052,7 +2026,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/heap.optimized.wat b/tests/compiler/heap.optimized.wat index 4adfcfccc3..9d323557f7 100644 --- a/tests/compiler/heap.optimized.wat +++ b/tests/compiler/heap.optimized.wat @@ -39,7 +39,7 @@ if i32.const 0 i32.const 1056 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -48,18 +48,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1056 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -73,12 +67,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -102,7 +103,7 @@ if i32.const 0 i32.const 1056 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -187,8 +188,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -201,7 +200,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -221,15 +220,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -237,34 +238,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -272,76 +259,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1056 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1056 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -351,12 +316,12 @@ if i32.const 0 i32.const 1056 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -364,34 +329,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -399,14 +368,14 @@ if i32.const 0 i32.const 1056 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -429,7 +398,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -442,12 +411,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -469,7 +438,7 @@ if i32.const 0 i32.const 1056 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -497,7 +466,7 @@ if i32.const 0 i32.const 1056 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -525,7 +494,7 @@ if i32.const 0 i32.const 1056 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -658,7 +627,7 @@ if i32.const 1120 i32.const 1056 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -732,7 +701,7 @@ if i32.const 0 i32.const 1056 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -784,7 +753,7 @@ if i32.const 0 i32.const 1056 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -819,7 +788,7 @@ if i32.const 0 i32.const 1056 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -961,7 +930,7 @@ if i32.const 0 i32.const 1056 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -976,7 +945,7 @@ if i32.const 0 i32.const 1056 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1028,7 +997,7 @@ if i32.const 0 i32.const 1056 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/heap.untouched.wat b/tests/compiler/heap.untouched.wat index b205d12a8e..153a22402a 100644 --- a/tests/compiler/heap.untouched.wat +++ b/tests/compiler/heap.untouched.wat @@ -70,7 +70,7 @@ if i32.const 0 i32.const 32 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -86,18 +86,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 32 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -113,12 +106,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -151,41 +153,41 @@ if i32.const 0 i32.const 32 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -198,55 +200,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -325,86 +327,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 32 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -413,25 +402,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -443,24 +415,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 32 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -470,7 +435,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -478,7 +443,7 @@ if i32.const 0 i32.const 32 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -488,24 +453,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -513,21 +487,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -537,18 +511,18 @@ if i32.const 0 i32.const 32 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -573,14 +547,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -594,17 +568,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -613,16 +587,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -642,7 +616,7 @@ if i32.const 0 i32.const 32 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -685,7 +659,7 @@ if i32.const 0 i32.const 32 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -718,7 +692,7 @@ if i32.const 0 i32.const 32 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -958,7 +932,7 @@ if i32.const 96 i32.const 32 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1042,7 +1016,7 @@ if i32.const 0 i32.const 32 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1107,7 +1081,7 @@ if i32.const 0 i32.const 32 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1258,7 +1232,7 @@ if i32.const 0 i32.const 32 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -1367,7 +1341,7 @@ if i32.const 0 i32.const 32 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1387,7 +1361,7 @@ if i32.const 0 i32.const 32 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1449,7 +1423,7 @@ if i32.const 0 i32.const 32 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/implicit-getter-setter.optimized.wat b/tests/compiler/implicit-getter-setter.optimized.wat index ee9a27cb5b..36e76ad769 100644 --- a/tests/compiler/implicit-getter-setter.optimized.wat +++ b/tests/compiler/implicit-getter-setter.optimized.wat @@ -282,7 +282,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -291,18 +291,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -316,12 +310,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -345,7 +346,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -430,8 +431,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -444,7 +443,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -464,15 +463,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -480,34 +481,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -515,76 +502,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -594,12 +559,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -607,34 +572,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -642,14 +611,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -672,7 +641,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -685,12 +654,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -712,7 +681,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -740,7 +709,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -768,7 +737,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1116,7 +1085,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1184,7 +1153,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1265,7 +1234,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1280,7 +1249,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/implicit-getter-setter.untouched.wat b/tests/compiler/implicit-getter-setter.untouched.wat index ffba3a548c..9e3db25658 100644 --- a/tests/compiler/implicit-getter-setter.untouched.wat +++ b/tests/compiler/implicit-getter-setter.untouched.wat @@ -407,7 +407,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -423,18 +423,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -450,12 +443,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -488,41 +490,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -535,55 +537,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -662,86 +664,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -750,25 +739,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -780,24 +752,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -807,7 +772,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -815,7 +780,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -825,24 +790,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -850,21 +824,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -874,18 +848,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -910,14 +884,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -931,17 +905,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -950,16 +924,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -979,7 +953,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1022,7 +996,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1055,7 +1029,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1298,7 +1272,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1629,7 +1603,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1713,7 +1687,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1778,7 +1752,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1929,7 +1903,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2038,7 +2012,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2058,7 +2032,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/infer-array.optimized.wat b/tests/compiler/infer-array.optimized.wat index 7d1851937b..cfff8e5413 100644 --- a/tests/compiler/infer-array.optimized.wat +++ b/tests/compiler/infer-array.optimized.wat @@ -309,7 +309,7 @@ if i32.const 0 i32.const 1424 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -318,18 +318,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -343,12 +337,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -372,7 +373,7 @@ if i32.const 0 i32.const 1424 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -457,8 +458,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -471,7 +470,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -491,15 +490,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -507,34 +508,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -542,76 +529,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1424 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -621,12 +586,12 @@ if i32.const 0 i32.const 1424 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -634,34 +599,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -669,14 +638,14 @@ if i32.const 0 i32.const 1424 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -699,7 +668,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -712,12 +681,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -739,7 +708,7 @@ if i32.const 0 i32.const 1424 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -767,7 +736,7 @@ if i32.const 0 i32.const 1424 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -795,7 +764,7 @@ if i32.const 0 i32.const 1424 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1143,7 +1112,7 @@ if i32.const 0 i32.const 1424 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1231,7 +1200,7 @@ if i32.const 0 i32.const 1424 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1283,7 +1252,7 @@ if i32.const 0 i32.const 1424 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1314,7 +1283,7 @@ if i32.const 1088 i32.const 1424 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1405,7 +1374,7 @@ if i32.const 0 i32.const 1424 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1420,7 +1389,7 @@ if i32.const 0 i32.const 1424 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1439,7 +1408,7 @@ if i32.const 0 i32.const 1424 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/infer-array.untouched.wat b/tests/compiler/infer-array.untouched.wat index 7c2233ced1..26528f50f9 100644 --- a/tests/compiler/infer-array.untouched.wat +++ b/tests/compiler/infer-array.untouched.wat @@ -416,7 +416,7 @@ if i32.const 0 i32.const 400 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -432,18 +432,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -459,12 +452,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -497,41 +499,41 @@ if i32.const 0 i32.const 400 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -544,55 +546,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -671,86 +673,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 400 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -759,25 +748,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -789,24 +761,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -816,7 +781,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -824,7 +789,7 @@ if i32.const 0 i32.const 400 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -834,24 +799,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -859,21 +833,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -883,18 +857,18 @@ if i32.const 0 i32.const 400 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -919,14 +893,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -940,17 +914,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -959,16 +933,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -988,7 +962,7 @@ if i32.const 0 i32.const 400 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1031,7 +1005,7 @@ if i32.const 0 i32.const 400 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1064,7 +1038,7 @@ if i32.const 0 i32.const 400 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1307,7 +1281,7 @@ if i32.const 0 i32.const 400 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1638,7 +1612,7 @@ if i32.const 64 i32.const 400 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1722,7 +1696,7 @@ if i32.const 0 i32.const 400 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1787,7 +1761,7 @@ if i32.const 0 i32.const 400 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1938,7 +1912,7 @@ if i32.const 0 i32.const 400 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2047,7 +2021,7 @@ if i32.const 0 i32.const 400 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2067,7 +2041,7 @@ if i32.const 0 i32.const 400 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index 82a052f5e1..c32bb3f224 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -285,7 +285,7 @@ if i32.const 0 i32.const 1472 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -294,18 +294,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1472 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -319,12 +313,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -348,7 +349,7 @@ if i32.const 0 i32.const 1472 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -433,8 +434,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -447,7 +446,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -467,15 +466,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -483,34 +484,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -518,76 +505,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1472 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1472 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -597,12 +562,12 @@ if i32.const 0 i32.const 1472 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -610,34 +575,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -645,14 +614,14 @@ if i32.const 0 i32.const 1472 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -675,7 +644,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -688,12 +657,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -715,7 +684,7 @@ if i32.const 0 i32.const 1472 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -743,7 +712,7 @@ if i32.const 0 i32.const 1472 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1472 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1119,7 +1088,7 @@ if i32.const 0 i32.const 1472 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1207,7 +1176,7 @@ if i32.const 0 i32.const 1472 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1259,7 +1228,7 @@ if i32.const 0 i32.const 1472 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1290,7 +1259,7 @@ if i32.const 1136 i32.const 1472 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1381,7 +1350,7 @@ if i32.const 0 i32.const 1472 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1396,7 +1365,7 @@ if i32.const 0 i32.const 1472 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1415,7 +1384,7 @@ if i32.const 0 i32.const 1472 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 9cc05286f1..32542e66c1 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -607,7 +607,7 @@ if i32.const 0 i32.const 448 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -623,18 +623,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 448 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -650,12 +643,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -688,41 +690,41 @@ if i32.const 0 i32.const 448 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -735,55 +737,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -862,86 +864,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 448 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -950,25 +939,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -980,24 +952,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 448 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1007,7 +972,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1015,7 +980,7 @@ if i32.const 0 i32.const 448 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1025,24 +990,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1050,21 +1024,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1074,18 +1048,18 @@ if i32.const 0 i32.const 448 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1110,14 +1084,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1131,17 +1105,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1150,16 +1124,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1179,7 +1153,7 @@ if i32.const 0 i32.const 448 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1222,7 +1196,7 @@ if i32.const 0 i32.const 448 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1255,7 +1229,7 @@ if i32.const 0 i32.const 448 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1498,7 +1472,7 @@ if i32.const 0 i32.const 448 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1829,7 +1803,7 @@ if i32.const 112 i32.const 448 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1913,7 +1887,7 @@ if i32.const 0 i32.const 448 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1978,7 +1952,7 @@ if i32.const 0 i32.const 448 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2129,7 +2103,7 @@ if i32.const 0 i32.const 448 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2238,7 +2212,7 @@ if i32.const 0 i32.const 448 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2258,7 +2232,7 @@ if i32.const 0 i32.const 448 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/instanceof-class.optimized.wat b/tests/compiler/instanceof-class.optimized.wat index de75f9c667..62850cd734 100644 --- a/tests/compiler/instanceof-class.optimized.wat +++ b/tests/compiler/instanceof-class.optimized.wat @@ -288,7 +288,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -297,18 +297,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -322,12 +316,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -351,7 +352,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -436,8 +437,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -450,7 +449,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -470,15 +469,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -486,34 +487,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -521,76 +508,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -600,12 +565,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -613,34 +578,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -648,14 +617,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -678,7 +647,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -691,12 +660,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -718,7 +687,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -746,7 +715,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -774,7 +743,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1122,7 +1091,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1190,7 +1159,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1271,7 +1240,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1286,7 +1255,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/instanceof-class.untouched.wat b/tests/compiler/instanceof-class.untouched.wat index a8a91cd9cd..1e83e93d9e 100644 --- a/tests/compiler/instanceof-class.untouched.wat +++ b/tests/compiler/instanceof-class.untouched.wat @@ -400,7 +400,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -416,18 +416,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -443,12 +436,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -481,41 +483,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -528,55 +530,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -655,86 +657,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -743,25 +732,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -773,24 +745,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -800,7 +765,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -808,7 +773,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -818,24 +783,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -843,21 +817,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -867,18 +841,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -903,14 +877,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -924,17 +898,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -943,16 +917,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -972,7 +946,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1015,7 +989,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1048,7 +1022,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1291,7 +1265,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1622,7 +1596,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1706,7 +1680,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1771,7 +1745,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1922,7 +1896,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2031,7 +2005,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2051,7 +2025,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1095.optimized.wat b/tests/compiler/issues/1095.optimized.wat index dd8a04e22f..a4bdf5a994 100644 --- a/tests/compiler/issues/1095.optimized.wat +++ b/tests/compiler/issues/1095.optimized.wat @@ -276,7 +276,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -285,18 +285,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -310,12 +304,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -339,7 +340,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,8 +425,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -438,7 +437,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -458,15 +457,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -474,34 +475,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -509,76 +496,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -588,12 +553,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -601,34 +566,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -636,14 +605,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -666,7 +635,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -679,12 +648,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -706,7 +675,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -734,7 +703,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -762,7 +731,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1110,7 +1079,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1178,7 +1147,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1259,7 +1228,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1274,7 +1243,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1095.untouched.wat b/tests/compiler/issues/1095.untouched.wat index ab16c21e9e..28e3ed47d1 100644 --- a/tests/compiler/issues/1095.untouched.wat +++ b/tests/compiler/issues/1095.untouched.wat @@ -400,7 +400,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -416,18 +416,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -443,12 +436,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -481,41 +483,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -528,55 +530,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -655,86 +657,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -743,25 +732,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -773,24 +745,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -800,7 +765,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -808,7 +773,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -818,24 +783,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -843,21 +817,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -867,18 +841,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -903,14 +877,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -924,17 +898,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -943,16 +917,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -972,7 +946,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1015,7 +989,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1048,7 +1022,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1291,7 +1265,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1622,7 +1596,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1706,7 +1680,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1771,7 +1745,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1922,7 +1896,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2031,7 +2005,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2051,7 +2025,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1225.optimized.wat b/tests/compiler/issues/1225.optimized.wat index f378537fa9..bdea2c460c 100644 --- a/tests/compiler/issues/1225.optimized.wat +++ b/tests/compiler/issues/1225.optimized.wat @@ -282,7 +282,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -291,18 +291,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -316,12 +310,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -345,7 +346,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -430,8 +431,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -444,7 +443,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -464,15 +463,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -480,34 +481,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -515,76 +502,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -594,12 +559,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -607,34 +572,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -642,14 +611,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -672,7 +641,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -685,12 +654,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -712,7 +681,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -740,7 +709,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -768,7 +737,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1116,7 +1085,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1184,7 +1153,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1265,7 +1234,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1280,7 +1249,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1225.untouched.wat b/tests/compiler/issues/1225.untouched.wat index aad5b3befa..bd75003b0d 100644 --- a/tests/compiler/issues/1225.untouched.wat +++ b/tests/compiler/issues/1225.untouched.wat @@ -411,7 +411,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -427,18 +427,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -454,12 +447,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -492,41 +494,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -539,55 +541,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -666,86 +668,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -754,25 +743,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -784,24 +756,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -811,7 +776,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -819,7 +784,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -829,24 +794,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -854,21 +828,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -878,18 +852,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -914,14 +888,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -935,17 +909,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -954,16 +928,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -983,7 +957,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1026,7 +1000,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1059,7 +1033,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1302,7 +1276,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1633,7 +1607,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1717,7 +1691,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1782,7 +1756,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1933,7 +1907,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2042,7 +2016,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2062,7 +2036,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1699.optimized.wat b/tests/compiler/issues/1699.optimized.wat index 2f64508585..0f22d6a56c 100644 --- a/tests/compiler/issues/1699.optimized.wat +++ b/tests/compiler/issues/1699.optimized.wat @@ -284,7 +284,7 @@ if i32.const 0 i32.const 1488 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -293,18 +293,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1488 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -318,12 +312,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -347,7 +348,7 @@ if i32.const 0 i32.const 1488 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -432,8 +433,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -446,7 +445,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -466,15 +465,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -482,34 +483,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -517,76 +504,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1488 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1488 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -596,12 +561,12 @@ if i32.const 0 i32.const 1488 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -609,34 +574,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -644,14 +613,14 @@ if i32.const 0 i32.const 1488 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -674,7 +643,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -687,12 +656,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -714,7 +683,7 @@ if i32.const 0 i32.const 1488 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -742,7 +711,7 @@ if i32.const 0 i32.const 1488 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -770,7 +739,7 @@ if i32.const 0 i32.const 1488 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1118,7 +1087,7 @@ if i32.const 0 i32.const 1488 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1206,7 +1175,7 @@ if i32.const 0 i32.const 1488 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1258,7 +1227,7 @@ if i32.const 0 i32.const 1488 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1289,7 +1258,7 @@ if i32.const 1152 i32.const 1488 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1380,7 +1349,7 @@ if i32.const 0 i32.const 1488 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1395,7 +1364,7 @@ if i32.const 0 i32.const 1488 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1414,7 +1383,7 @@ if i32.const 0 i32.const 1488 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1699.untouched.wat b/tests/compiler/issues/1699.untouched.wat index df5f89edf0..9fb98ff516 100644 --- a/tests/compiler/issues/1699.untouched.wat +++ b/tests/compiler/issues/1699.untouched.wat @@ -401,7 +401,7 @@ if i32.const 0 i32.const 464 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -417,18 +417,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 464 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -444,12 +437,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -482,41 +484,41 @@ if i32.const 0 i32.const 464 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -529,55 +531,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -656,86 +658,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 464 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -744,25 +733,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -774,24 +746,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 464 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -801,7 +766,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -809,7 +774,7 @@ if i32.const 0 i32.const 464 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -819,24 +784,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -844,21 +818,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -868,18 +842,18 @@ if i32.const 0 i32.const 464 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -904,14 +878,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -925,17 +899,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -944,16 +918,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -973,7 +947,7 @@ if i32.const 0 i32.const 464 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1016,7 +990,7 @@ if i32.const 0 i32.const 464 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1049,7 +1023,7 @@ if i32.const 0 i32.const 464 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1292,7 +1266,7 @@ if i32.const 0 i32.const 464 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1623,7 +1597,7 @@ if i32.const 128 i32.const 464 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1707,7 +1681,7 @@ if i32.const 0 i32.const 464 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1772,7 +1746,7 @@ if i32.const 0 i32.const 464 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1923,7 +1897,7 @@ if i32.const 0 i32.const 464 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2032,7 +2006,7 @@ if i32.const 0 i32.const 464 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2052,7 +2026,7 @@ if i32.const 0 i32.const 464 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/logical.optimized.wat b/tests/compiler/logical.optimized.wat index e76e95a33c..c68cc29bc4 100644 --- a/tests/compiler/logical.optimized.wat +++ b/tests/compiler/logical.optimized.wat @@ -273,7 +273,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -282,18 +282,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -307,12 +301,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -336,7 +337,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -421,8 +422,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -435,7 +434,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -455,15 +454,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -471,34 +472,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -506,76 +493,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -585,12 +550,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -598,34 +563,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -633,14 +602,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -663,7 +632,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -676,12 +645,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -703,7 +672,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -731,7 +700,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -759,7 +728,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1107,7 +1076,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1175,7 +1144,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1256,7 +1225,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1271,7 +1240,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/logical.untouched.wat b/tests/compiler/logical.untouched.wat index e168639e19..ff384cf84b 100644 --- a/tests/compiler/logical.untouched.wat +++ b/tests/compiler/logical.untouched.wat @@ -423,7 +423,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -439,18 +439,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -466,12 +459,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -504,41 +506,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -551,55 +553,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -678,86 +680,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -766,25 +755,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -796,24 +768,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -823,7 +788,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -831,7 +796,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -841,24 +806,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -866,21 +840,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -890,18 +864,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -926,14 +900,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -947,17 +921,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -966,16 +940,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -995,7 +969,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1038,7 +1012,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1071,7 +1045,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1314,7 +1288,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1645,7 +1619,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1729,7 +1703,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1794,7 +1768,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1945,7 +1919,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2054,7 +2028,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2074,7 +2048,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/managed-cast.optimized.wat b/tests/compiler/managed-cast.optimized.wat index fc5bd74fe3..7f011117f6 100644 --- a/tests/compiler/managed-cast.optimized.wat +++ b/tests/compiler/managed-cast.optimized.wat @@ -277,7 +277,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -286,18 +286,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -311,12 +305,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -340,7 +341,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -425,8 +426,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -439,7 +438,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -459,15 +458,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -475,34 +476,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -510,76 +497,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -589,12 +554,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -602,34 +567,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -637,14 +606,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -667,7 +636,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -680,12 +649,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -707,7 +676,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -735,7 +704,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -763,7 +732,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1111,7 +1080,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1179,7 +1148,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1260,7 +1229,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1275,7 +1244,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/managed-cast.untouched.wat b/tests/compiler/managed-cast.untouched.wat index b96559a6cf..72985b6e63 100644 --- a/tests/compiler/managed-cast.untouched.wat +++ b/tests/compiler/managed-cast.untouched.wat @@ -400,7 +400,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -416,18 +416,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -443,12 +436,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -481,41 +483,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -528,55 +530,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -655,86 +657,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -743,25 +732,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -773,24 +745,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -800,7 +765,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -808,7 +773,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -818,24 +783,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -843,21 +817,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -867,18 +841,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -903,14 +877,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -924,17 +898,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -943,16 +917,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -972,7 +946,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1015,7 +989,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1048,7 +1022,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1291,7 +1265,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1622,7 +1596,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1706,7 +1680,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1771,7 +1745,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1922,7 +1896,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2031,7 +2005,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2051,7 +2025,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/new.optimized.wat b/tests/compiler/new.optimized.wat index 72c41d4dec..32b508fdbf 100644 --- a/tests/compiler/new.optimized.wat +++ b/tests/compiler/new.optimized.wat @@ -313,7 +313,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -322,18 +322,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -347,12 +341,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -376,7 +377,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -461,8 +462,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -475,7 +474,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -495,15 +494,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -511,34 +512,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -546,76 +533,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -625,12 +590,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -638,34 +603,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -673,14 +642,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -703,7 +672,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -716,12 +685,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -743,7 +712,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -799,7 +768,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1147,7 +1116,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1215,7 +1184,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1296,7 +1265,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1311,7 +1280,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/new.untouched.wat b/tests/compiler/new.untouched.wat index 558fe96bc4..efb70a1f7a 100644 --- a/tests/compiler/new.untouched.wat +++ b/tests/compiler/new.untouched.wat @@ -403,7 +403,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -419,18 +419,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -446,12 +439,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -484,41 +486,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -531,55 +533,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -658,86 +660,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -746,25 +735,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -776,24 +748,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -803,7 +768,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -811,7 +776,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -821,24 +786,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -846,21 +820,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -870,18 +844,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -906,14 +880,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -927,17 +901,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -946,16 +920,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -975,7 +949,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1018,7 +992,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1051,7 +1025,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1294,7 +1268,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1625,7 +1599,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1709,7 +1683,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1774,7 +1748,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1925,7 +1899,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2034,7 +2008,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2054,7 +2028,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/number.optimized.wat b/tests/compiler/number.optimized.wat index 9395112a60..402a0479de 100644 --- a/tests/compiler/number.optimized.wat +++ b/tests/compiler/number.optimized.wat @@ -359,7 +359,7 @@ if i32.const 0 i32.const 1616 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -368,18 +368,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -393,12 +387,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -422,7 +423,7 @@ if i32.const 0 i32.const 1616 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -507,8 +508,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -521,7 +520,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -541,15 +540,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -557,34 +558,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -592,76 +579,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1616 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -671,12 +636,12 @@ if i32.const 0 i32.const 1616 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -684,34 +649,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -719,14 +688,14 @@ if i32.const 0 i32.const 1616 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -749,7 +718,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -762,12 +731,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -789,7 +758,7 @@ if i32.const 0 i32.const 1616 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -817,7 +786,7 @@ if i32.const 0 i32.const 1616 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -845,7 +814,7 @@ if i32.const 0 i32.const 1616 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1193,7 +1162,7 @@ if i32.const 0 i32.const 1616 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1281,7 +1250,7 @@ if i32.const 0 i32.const 1616 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1333,7 +1302,7 @@ if i32.const 0 i32.const 1616 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1364,7 +1333,7 @@ if i32.const 1280 i32.const 1616 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1455,7 +1424,7 @@ if i32.const 0 i32.const 1616 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1470,7 +1439,7 @@ if i32.const 0 i32.const 1616 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1489,7 +1458,7 @@ if i32.const 0 i32.const 1616 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/number.untouched.wat b/tests/compiler/number.untouched.wat index 0eb745e636..20f81edaf4 100644 --- a/tests/compiler/number.untouched.wat +++ b/tests/compiler/number.untouched.wat @@ -501,7 +501,7 @@ if i32.const 0 i32.const 592 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -517,18 +517,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -544,12 +537,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -582,41 +584,41 @@ if i32.const 0 i32.const 592 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -629,55 +631,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -756,86 +758,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 592 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -844,25 +833,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -874,24 +846,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -901,7 +866,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -909,7 +874,7 @@ if i32.const 0 i32.const 592 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -919,24 +884,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -944,21 +918,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -968,18 +942,18 @@ if i32.const 0 i32.const 592 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1004,14 +978,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1025,17 +999,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1044,16 +1018,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1073,7 +1047,7 @@ if i32.const 0 i32.const 592 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1116,7 +1090,7 @@ if i32.const 0 i32.const 592 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1149,7 +1123,7 @@ if i32.const 0 i32.const 592 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1392,7 +1366,7 @@ if i32.const 0 i32.const 592 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1723,7 +1697,7 @@ if i32.const 256 i32.const 592 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1807,7 +1781,7 @@ if i32.const 0 i32.const 592 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1872,7 +1846,7 @@ if i32.const 0 i32.const 592 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2023,7 +1997,7 @@ if i32.const 0 i32.const 592 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2132,7 +2106,7 @@ if i32.const 0 i32.const 592 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2152,7 +2126,7 @@ if i32.const 0 i32.const 592 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index f38c58628e..526c424157 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -352,7 +352,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -361,18 +361,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -386,12 +380,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -415,7 +416,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -500,8 +501,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -514,7 +513,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -534,15 +533,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -550,34 +551,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -585,76 +572,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -664,12 +629,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -677,34 +642,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -712,14 +681,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -742,7 +711,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -755,12 +724,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -782,7 +751,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -810,7 +779,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -838,7 +807,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1003,7 +972,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1279,7 +1248,7 @@ if i32.const 0 i32.const 1440 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1331,7 +1300,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1362,7 +1331,7 @@ if i32.const 1312 i32.const 1440 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1453,7 +1422,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1468,7 +1437,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1487,7 +1456,7 @@ if i32.const 0 i32.const 1440 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/object-literal.untouched.wat b/tests/compiler/object-literal.untouched.wat index 37a5c0a3bf..6f930884e3 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -490,7 +490,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -506,18 +506,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -533,12 +526,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -571,41 +573,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -618,55 +620,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -745,86 +747,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -833,25 +822,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -863,24 +835,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -890,7 +855,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -898,7 +863,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -908,24 +873,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -933,21 +907,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -957,18 +931,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -993,14 +967,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1014,17 +988,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1033,16 +1007,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1062,7 +1036,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1105,7 +1079,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1138,7 +1112,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1381,7 +1355,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1712,7 +1686,7 @@ if i32.const 288 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1796,7 +1770,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1861,7 +1835,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2012,7 +1986,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2121,7 +2095,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2141,7 +2115,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/optional-typeparameters.optimized.wat b/tests/compiler/optional-typeparameters.optimized.wat index bb73075173..b455ab9959 100644 --- a/tests/compiler/optional-typeparameters.optimized.wat +++ b/tests/compiler/optional-typeparameters.optimized.wat @@ -285,7 +285,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -294,18 +294,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -319,12 +313,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -348,7 +349,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -433,8 +434,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -447,7 +446,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -467,15 +466,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -483,34 +484,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -518,76 +505,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -597,12 +562,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -610,34 +575,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -645,14 +614,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -675,7 +644,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -688,12 +657,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -715,7 +684,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -743,7 +712,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1119,7 +1088,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1187,7 +1156,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1268,7 +1237,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1283,7 +1252,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/optional-typeparameters.untouched.wat b/tests/compiler/optional-typeparameters.untouched.wat index 2c25945ad9..5e250f884c 100644 --- a/tests/compiler/optional-typeparameters.untouched.wat +++ b/tests/compiler/optional-typeparameters.untouched.wat @@ -406,7 +406,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -422,18 +422,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -449,12 +442,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -487,41 +489,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -534,55 +536,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -661,86 +663,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -749,25 +738,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -779,24 +751,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -806,7 +771,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -814,7 +779,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -824,24 +789,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -849,21 +823,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -873,18 +847,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -909,14 +883,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -930,17 +904,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -949,16 +923,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -978,7 +952,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1021,7 +995,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1054,7 +1028,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1297,7 +1271,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1628,7 +1602,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1712,7 +1686,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1777,7 +1751,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1928,7 +1902,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2037,7 +2011,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2057,7 +2031,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/reexport.optimized.wat b/tests/compiler/reexport.optimized.wat index 630523b70d..a991b92d0d 100644 --- a/tests/compiler/reexport.optimized.wat +++ b/tests/compiler/reexport.optimized.wat @@ -362,7 +362,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -371,18 +371,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -396,12 +390,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -425,7 +426,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -510,8 +511,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -524,7 +523,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -544,15 +543,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -560,34 +561,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -595,76 +582,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -674,12 +639,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -687,34 +652,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -722,14 +691,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -752,7 +721,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -765,12 +734,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -792,7 +761,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -820,7 +789,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -848,7 +817,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1196,7 +1165,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1264,7 +1233,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1345,7 +1314,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1360,7 +1329,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/reexport.untouched.wat b/tests/compiler/reexport.untouched.wat index aa34cc9ddc..606aa107fe 100644 --- a/tests/compiler/reexport.untouched.wat +++ b/tests/compiler/reexport.untouched.wat @@ -490,7 +490,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -506,18 +506,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -533,12 +526,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -571,41 +573,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -618,55 +620,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -745,86 +747,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -833,25 +822,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -863,24 +835,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -890,7 +855,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -898,7 +863,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -908,24 +873,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -933,21 +907,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -957,18 +931,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -993,14 +967,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1014,17 +988,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1033,16 +1007,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1062,7 +1036,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1105,7 +1079,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1138,7 +1112,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1381,7 +1355,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1712,7 +1686,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1796,7 +1770,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1861,7 +1835,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2012,7 +1986,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2121,7 +2095,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2141,7 +2115,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rereexport.optimized.wat b/tests/compiler/rereexport.optimized.wat index 05ce79caf2..149580ad4d 100644 --- a/tests/compiler/rereexport.optimized.wat +++ b/tests/compiler/rereexport.optimized.wat @@ -324,7 +324,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -333,18 +333,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -358,12 +352,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -387,7 +388,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -472,8 +473,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -486,7 +485,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -506,15 +505,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -522,34 +523,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -557,76 +544,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -636,12 +601,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -649,34 +614,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -684,14 +653,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -714,7 +683,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -727,12 +696,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -754,7 +723,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -782,7 +751,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -810,7 +779,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1158,7 +1127,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1226,7 +1195,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1307,7 +1276,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1322,7 +1291,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rereexport.untouched.wat b/tests/compiler/rereexport.untouched.wat index b1b3235a18..06e53c71cf 100644 --- a/tests/compiler/rereexport.untouched.wat +++ b/tests/compiler/rereexport.untouched.wat @@ -442,7 +442,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -458,18 +458,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -485,12 +478,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -523,41 +525,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -570,55 +572,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -697,86 +699,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -785,25 +774,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -815,24 +787,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -842,7 +807,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -850,7 +815,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -860,24 +825,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -885,21 +859,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -909,18 +883,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -945,14 +919,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -966,17 +940,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -985,16 +959,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1014,7 +988,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1057,7 +1031,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1090,7 +1064,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1333,7 +1307,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1664,7 +1638,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1748,7 +1722,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1813,7 +1787,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1964,7 +1938,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2073,7 +2047,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2093,7 +2067,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-access.optimized.wat b/tests/compiler/resolve-access.optimized.wat index e8761a4ae4..8cb1f9e864 100644 --- a/tests/compiler/resolve-access.optimized.wat +++ b/tests/compiler/resolve-access.optimized.wat @@ -290,7 +290,7 @@ if i32.const 0 i32.const 1424 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -299,18 +299,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -324,12 +318,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -353,7 +354,7 @@ if i32.const 0 i32.const 1424 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -438,8 +439,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -452,7 +451,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -472,15 +471,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -488,34 +489,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -523,76 +510,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1424 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -602,12 +567,12 @@ if i32.const 0 i32.const 1424 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -615,34 +580,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -650,14 +619,14 @@ if i32.const 0 i32.const 1424 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -680,7 +649,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -693,12 +662,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -720,7 +689,7 @@ if i32.const 0 i32.const 1424 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -748,7 +717,7 @@ if i32.const 0 i32.const 1424 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -776,7 +745,7 @@ if i32.const 0 i32.const 1424 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1124,7 +1093,7 @@ if i32.const 0 i32.const 1424 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1212,7 +1181,7 @@ if i32.const 0 i32.const 1424 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1264,7 +1233,7 @@ if i32.const 0 i32.const 1424 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1295,7 +1264,7 @@ if i32.const 1088 i32.const 1424 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1386,7 +1355,7 @@ if i32.const 0 i32.const 1424 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1401,7 +1370,7 @@ if i32.const 0 i32.const 1424 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1420,7 +1389,7 @@ if i32.const 0 i32.const 1424 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-access.untouched.wat b/tests/compiler/resolve-access.untouched.wat index d435639121..2b89777621 100644 --- a/tests/compiler/resolve-access.untouched.wat +++ b/tests/compiler/resolve-access.untouched.wat @@ -416,7 +416,7 @@ if i32.const 0 i32.const 400 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -432,18 +432,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -459,12 +452,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -497,41 +499,41 @@ if i32.const 0 i32.const 400 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -544,55 +546,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -671,86 +673,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 400 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -759,25 +748,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -789,24 +761,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -816,7 +781,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -824,7 +789,7 @@ if i32.const 0 i32.const 400 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -834,24 +799,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -859,21 +833,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -883,18 +857,18 @@ if i32.const 0 i32.const 400 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -919,14 +893,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -940,17 +914,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -959,16 +933,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -988,7 +962,7 @@ if i32.const 0 i32.const 400 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1031,7 +1005,7 @@ if i32.const 0 i32.const 400 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1064,7 +1038,7 @@ if i32.const 0 i32.const 400 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1307,7 +1281,7 @@ if i32.const 0 i32.const 400 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1638,7 +1612,7 @@ if i32.const 64 i32.const 400 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1722,7 +1696,7 @@ if i32.const 0 i32.const 400 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1787,7 +1761,7 @@ if i32.const 0 i32.const 400 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1938,7 +1912,7 @@ if i32.const 0 i32.const 400 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2047,7 +2021,7 @@ if i32.const 0 i32.const 400 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2067,7 +2041,7 @@ if i32.const 0 i32.const 400 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-binary.optimized.wat b/tests/compiler/resolve-binary.optimized.wat index c95f4d6be4..c1ac3cb273 100644 --- a/tests/compiler/resolve-binary.optimized.wat +++ b/tests/compiler/resolve-binary.optimized.wat @@ -521,7 +521,7 @@ if i32.const 0 i32.const 1776 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -530,18 +530,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1776 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -555,12 +549,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -584,7 +585,7 @@ if i32.const 0 i32.const 1776 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -669,8 +670,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -683,7 +682,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -703,15 +702,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -719,34 +720,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -754,76 +741,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1776 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1776 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -833,12 +798,12 @@ if i32.const 0 i32.const 1776 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -846,34 +811,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -881,14 +850,14 @@ if i32.const 0 i32.const 1776 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -911,7 +880,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -924,12 +893,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -951,7 +920,7 @@ if i32.const 0 i32.const 1776 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -979,7 +948,7 @@ if i32.const 0 i32.const 1776 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1007,7 +976,7 @@ if i32.const 0 i32.const 1776 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1355,7 +1324,7 @@ if i32.const 0 i32.const 1776 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1443,7 +1412,7 @@ if i32.const 0 i32.const 1776 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1495,7 +1464,7 @@ if i32.const 0 i32.const 1776 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1526,7 +1495,7 @@ if i32.const 1440 i32.const 1776 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1617,7 +1586,7 @@ if i32.const 0 i32.const 1776 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1632,7 +1601,7 @@ if i32.const 0 i32.const 1776 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1651,7 +1620,7 @@ if i32.const 0 i32.const 1776 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-binary.untouched.wat b/tests/compiler/resolve-binary.untouched.wat index 1e357f06f6..afb5a71f3e 100644 --- a/tests/compiler/resolve-binary.untouched.wat +++ b/tests/compiler/resolve-binary.untouched.wat @@ -676,7 +676,7 @@ if i32.const 0 i32.const 752 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -692,18 +692,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 752 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -719,12 +712,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -757,41 +759,41 @@ if i32.const 0 i32.const 752 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -804,55 +806,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -931,86 +933,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 752 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1019,25 +1008,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1049,24 +1021,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 752 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1076,7 +1041,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1084,7 +1049,7 @@ if i32.const 0 i32.const 752 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1094,24 +1059,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1119,21 +1093,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1143,18 +1117,18 @@ if i32.const 0 i32.const 752 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1179,14 +1153,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1200,17 +1174,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1219,16 +1193,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1248,7 +1222,7 @@ if i32.const 0 i32.const 752 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1291,7 +1265,7 @@ if i32.const 0 i32.const 752 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1324,7 +1298,7 @@ if i32.const 0 i32.const 752 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1567,7 +1541,7 @@ if i32.const 0 i32.const 752 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1898,7 +1872,7 @@ if i32.const 416 i32.const 752 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1982,7 +1956,7 @@ if i32.const 0 i32.const 752 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2047,7 +2021,7 @@ if i32.const 0 i32.const 752 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2198,7 +2172,7 @@ if i32.const 0 i32.const 752 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2307,7 +2281,7 @@ if i32.const 0 i32.const 752 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2327,7 +2301,7 @@ if i32.const 0 i32.const 752 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.optimized.wat b/tests/compiler/resolve-elementaccess.optimized.wat index 6913350711..8ae6c33db6 100644 --- a/tests/compiler/resolve-elementaccess.optimized.wat +++ b/tests/compiler/resolve-elementaccess.optimized.wat @@ -341,7 +341,7 @@ if i32.const 0 i32.const 1504 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -350,18 +350,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -375,12 +369,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -404,7 +405,7 @@ if i32.const 0 i32.const 1504 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -489,8 +490,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -503,7 +502,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -523,15 +522,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -539,34 +540,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -574,76 +561,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1504 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -653,12 +618,12 @@ if i32.const 0 i32.const 1504 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -666,34 +631,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -701,14 +670,14 @@ if i32.const 0 i32.const 1504 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -731,7 +700,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -744,12 +713,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1504 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -799,7 +768,7 @@ if i32.const 0 i32.const 1504 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -827,7 +796,7 @@ if i32.const 0 i32.const 1504 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1175,7 +1144,7 @@ if i32.const 0 i32.const 1504 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1263,7 +1232,7 @@ if i32.const 0 i32.const 1504 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1315,7 +1284,7 @@ if i32.const 0 i32.const 1504 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1346,7 +1315,7 @@ if i32.const 1168 i32.const 1504 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1437,7 +1406,7 @@ if i32.const 0 i32.const 1504 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1452,7 +1421,7 @@ if i32.const 0 i32.const 1504 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1471,7 +1440,7 @@ if i32.const 0 i32.const 1504 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.untouched.wat b/tests/compiler/resolve-elementaccess.untouched.wat index af6fe8d1b0..313896f16d 100644 --- a/tests/compiler/resolve-elementaccess.untouched.wat +++ b/tests/compiler/resolve-elementaccess.untouched.wat @@ -439,7 +439,7 @@ if i32.const 0 i32.const 480 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -455,18 +455,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -482,12 +475,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -520,41 +522,41 @@ if i32.const 0 i32.const 480 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -567,55 +569,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -694,86 +696,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 480 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -782,25 +771,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -812,24 +784,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -839,7 +804,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -847,7 +812,7 @@ if i32.const 0 i32.const 480 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -857,24 +822,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -882,21 +856,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -906,18 +880,18 @@ if i32.const 0 i32.const 480 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -942,14 +916,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -963,17 +937,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -982,16 +956,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1011,7 +985,7 @@ if i32.const 0 i32.const 480 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1054,7 +1028,7 @@ if i32.const 0 i32.const 480 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1087,7 +1061,7 @@ if i32.const 0 i32.const 480 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1330,7 +1304,7 @@ if i32.const 0 i32.const 480 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1661,7 +1635,7 @@ if i32.const 144 i32.const 480 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1745,7 +1719,7 @@ if i32.const 0 i32.const 480 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1810,7 +1784,7 @@ if i32.const 0 i32.const 480 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1961,7 +1935,7 @@ if i32.const 0 i32.const 480 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2070,7 +2044,7 @@ if i32.const 0 i32.const 480 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2090,7 +2064,7 @@ if i32.const 0 i32.const 480 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-function-expression.optimized.wat b/tests/compiler/resolve-function-expression.optimized.wat index 362612b299..f73276880e 100644 --- a/tests/compiler/resolve-function-expression.optimized.wat +++ b/tests/compiler/resolve-function-expression.optimized.wat @@ -308,7 +308,7 @@ if i32.const 0 i32.const 1792 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -317,18 +317,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1792 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -342,12 +336,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -371,7 +372,7 @@ if i32.const 0 i32.const 1792 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -456,8 +457,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -470,7 +469,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -490,15 +489,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -506,34 +507,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -541,76 +528,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1792 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1792 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -620,12 +585,12 @@ if i32.const 0 i32.const 1792 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -633,34 +598,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -668,14 +637,14 @@ if i32.const 0 i32.const 1792 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -698,7 +667,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -711,12 +680,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -738,7 +707,7 @@ if i32.const 0 i32.const 1792 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -766,7 +735,7 @@ if i32.const 0 i32.const 1792 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -794,7 +763,7 @@ if i32.const 0 i32.const 1792 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1142,7 +1111,7 @@ if i32.const 0 i32.const 1792 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1230,7 +1199,7 @@ if i32.const 0 i32.const 1792 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1282,7 +1251,7 @@ if i32.const 0 i32.const 1792 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1313,7 +1282,7 @@ if i32.const 1456 i32.const 1792 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1404,7 +1373,7 @@ if i32.const 0 i32.const 1792 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1419,7 +1388,7 @@ if i32.const 0 i32.const 1792 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1438,7 +1407,7 @@ if i32.const 0 i32.const 1792 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-function-expression.untouched.wat b/tests/compiler/resolve-function-expression.untouched.wat index efdbd5097e..56b6e90d2b 100644 --- a/tests/compiler/resolve-function-expression.untouched.wat +++ b/tests/compiler/resolve-function-expression.untouched.wat @@ -484,7 +484,7 @@ if i32.const 0 i32.const 768 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -500,18 +500,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 768 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -527,12 +520,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -565,41 +567,41 @@ if i32.const 0 i32.const 768 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -612,55 +614,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -739,86 +741,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 768 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -827,25 +816,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -857,24 +829,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 768 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -884,7 +849,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -892,7 +857,7 @@ if i32.const 0 i32.const 768 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -902,24 +867,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -927,21 +901,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -951,18 +925,18 @@ if i32.const 0 i32.const 768 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -987,14 +961,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1008,17 +982,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1027,16 +1001,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1056,7 +1030,7 @@ if i32.const 0 i32.const 768 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1099,7 +1073,7 @@ if i32.const 0 i32.const 768 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1132,7 +1106,7 @@ if i32.const 0 i32.const 768 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1375,7 +1349,7 @@ if i32.const 0 i32.const 768 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1706,7 +1680,7 @@ if i32.const 432 i32.const 768 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1790,7 +1764,7 @@ if i32.const 0 i32.const 768 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1855,7 +1829,7 @@ if i32.const 0 i32.const 768 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2006,7 +1980,7 @@ if i32.const 0 i32.const 768 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2115,7 +2089,7 @@ if i32.const 0 i32.const 768 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2135,7 +2109,7 @@ if i32.const 0 i32.const 768 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-nested.optimized.wat b/tests/compiler/resolve-nested.optimized.wat index 0e1749d64a..ddec423331 100644 --- a/tests/compiler/resolve-nested.optimized.wat +++ b/tests/compiler/resolve-nested.optimized.wat @@ -282,7 +282,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -291,18 +291,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -316,12 +310,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -345,7 +346,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -430,8 +431,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -444,7 +443,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -464,15 +463,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -480,34 +481,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -515,76 +502,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -594,12 +559,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -607,34 +572,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -642,14 +611,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -672,7 +641,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -685,12 +654,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -712,7 +681,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -740,7 +709,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -768,7 +737,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1116,7 +1085,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1184,7 +1153,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1265,7 +1234,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1280,7 +1249,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-nested.untouched.wat b/tests/compiler/resolve-nested.untouched.wat index 5b0143a85d..d02fe50cb8 100644 --- a/tests/compiler/resolve-nested.untouched.wat +++ b/tests/compiler/resolve-nested.untouched.wat @@ -422,7 +422,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -438,18 +438,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -465,12 +458,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -503,41 +505,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -550,55 +552,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -677,86 +679,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -765,25 +754,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -795,24 +767,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -822,7 +787,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -830,7 +795,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -840,24 +805,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -865,21 +839,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -889,18 +863,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -925,14 +899,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -946,17 +920,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -965,16 +939,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -994,7 +968,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1037,7 +1011,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1070,7 +1044,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1313,7 +1287,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1644,7 +1618,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1728,7 +1702,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1793,7 +1767,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1944,7 +1918,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2053,7 +2027,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2073,7 +2047,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-new.optimized.wat b/tests/compiler/resolve-new.optimized.wat index 7b54a60a16..5ec45ba2d7 100644 --- a/tests/compiler/resolve-new.optimized.wat +++ b/tests/compiler/resolve-new.optimized.wat @@ -278,7 +278,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -287,18 +287,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -312,12 +306,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -341,7 +342,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -426,8 +427,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -440,7 +439,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -460,15 +459,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -476,34 +477,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -511,76 +498,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -590,12 +555,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -603,34 +568,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -638,14 +607,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -668,7 +637,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -681,12 +650,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -708,7 +677,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -736,7 +705,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -764,7 +733,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1112,7 +1081,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1180,7 +1149,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1261,7 +1230,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1276,7 +1245,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-new.untouched.wat b/tests/compiler/resolve-new.untouched.wat index 8c4f1f9590..f333c2c578 100644 --- a/tests/compiler/resolve-new.untouched.wat +++ b/tests/compiler/resolve-new.untouched.wat @@ -398,7 +398,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -414,18 +414,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -441,12 +434,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -479,41 +481,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -526,55 +528,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -653,86 +655,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -741,25 +730,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -771,24 +743,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -798,7 +763,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -806,7 +771,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -816,24 +781,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -841,21 +815,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -865,18 +839,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -901,14 +875,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -922,17 +896,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -941,16 +915,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -970,7 +944,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1013,7 +987,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1046,7 +1020,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1289,7 +1263,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1620,7 +1594,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1704,7 +1678,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1769,7 +1743,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1920,7 +1894,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2029,7 +2003,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2049,7 +2023,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-propertyaccess.optimized.wat b/tests/compiler/resolve-propertyaccess.optimized.wat index e182317432..ae7fef3b2b 100644 --- a/tests/compiler/resolve-propertyaccess.optimized.wat +++ b/tests/compiler/resolve-propertyaccess.optimized.wat @@ -308,7 +308,7 @@ if i32.const 0 i32.const 1616 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -317,18 +317,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -342,12 +336,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -371,7 +372,7 @@ if i32.const 0 i32.const 1616 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -456,8 +457,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -470,7 +469,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -490,15 +489,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -506,34 +507,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -541,76 +528,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1616 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -620,12 +585,12 @@ if i32.const 0 i32.const 1616 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -633,34 +598,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -668,14 +637,14 @@ if i32.const 0 i32.const 1616 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -698,7 +667,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -711,12 +680,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -738,7 +707,7 @@ if i32.const 0 i32.const 1616 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -766,7 +735,7 @@ if i32.const 0 i32.const 1616 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -794,7 +763,7 @@ if i32.const 0 i32.const 1616 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1142,7 +1111,7 @@ if i32.const 0 i32.const 1616 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1230,7 +1199,7 @@ if i32.const 0 i32.const 1616 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1282,7 +1251,7 @@ if i32.const 0 i32.const 1616 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1313,7 +1282,7 @@ if i32.const 1280 i32.const 1616 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1404,7 +1373,7 @@ if i32.const 0 i32.const 1616 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1419,7 +1388,7 @@ if i32.const 0 i32.const 1616 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1438,7 +1407,7 @@ if i32.const 0 i32.const 1616 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-propertyaccess.untouched.wat b/tests/compiler/resolve-propertyaccess.untouched.wat index d250136ea7..21d0298c84 100644 --- a/tests/compiler/resolve-propertyaccess.untouched.wat +++ b/tests/compiler/resolve-propertyaccess.untouched.wat @@ -484,7 +484,7 @@ if i32.const 0 i32.const 592 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -500,18 +500,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -527,12 +520,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -565,41 +567,41 @@ if i32.const 0 i32.const 592 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -612,55 +614,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -739,86 +741,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 592 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -827,25 +816,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -857,24 +829,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -884,7 +849,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -892,7 +857,7 @@ if i32.const 0 i32.const 592 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -902,24 +867,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -927,21 +901,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -951,18 +925,18 @@ if i32.const 0 i32.const 592 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -987,14 +961,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1008,17 +982,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1027,16 +1001,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1056,7 +1030,7 @@ if i32.const 0 i32.const 592 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1099,7 +1073,7 @@ if i32.const 0 i32.const 592 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1132,7 +1106,7 @@ if i32.const 0 i32.const 592 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1375,7 +1349,7 @@ if i32.const 0 i32.const 592 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1706,7 +1680,7 @@ if i32.const 256 i32.const 592 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1790,7 +1764,7 @@ if i32.const 0 i32.const 592 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1855,7 +1829,7 @@ if i32.const 0 i32.const 592 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2006,7 +1980,7 @@ if i32.const 0 i32.const 592 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2115,7 +2089,7 @@ if i32.const 0 i32.const 592 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2135,7 +2109,7 @@ if i32.const 0 i32.const 592 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-ternary.optimized.wat b/tests/compiler/resolve-ternary.optimized.wat index 041027649e..0f8cf28191 100644 --- a/tests/compiler/resolve-ternary.optimized.wat +++ b/tests/compiler/resolve-ternary.optimized.wat @@ -354,7 +354,7 @@ if i32.const 0 i32.const 1616 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -363,18 +363,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -388,12 +382,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -417,7 +418,7 @@ if i32.const 0 i32.const 1616 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -502,8 +503,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -516,7 +515,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -536,15 +535,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -552,34 +553,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -587,76 +574,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1616 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -666,12 +631,12 @@ if i32.const 0 i32.const 1616 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -679,34 +644,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -714,14 +683,14 @@ if i32.const 0 i32.const 1616 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -744,7 +713,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -757,12 +726,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -784,7 +753,7 @@ if i32.const 0 i32.const 1616 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -812,7 +781,7 @@ if i32.const 0 i32.const 1616 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -840,7 +809,7 @@ if i32.const 0 i32.const 1616 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1188,7 +1157,7 @@ if i32.const 0 i32.const 1616 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1276,7 +1245,7 @@ if i32.const 0 i32.const 1616 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1328,7 +1297,7 @@ if i32.const 0 i32.const 1616 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1359,7 +1328,7 @@ if i32.const 1280 i32.const 1616 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1450,7 +1419,7 @@ if i32.const 0 i32.const 1616 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1465,7 +1434,7 @@ if i32.const 0 i32.const 1616 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1484,7 +1453,7 @@ if i32.const 0 i32.const 1616 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-ternary.untouched.wat b/tests/compiler/resolve-ternary.untouched.wat index 1e63d91110..38b120b62a 100644 --- a/tests/compiler/resolve-ternary.untouched.wat +++ b/tests/compiler/resolve-ternary.untouched.wat @@ -492,7 +492,7 @@ if i32.const 0 i32.const 592 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -508,18 +508,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -535,12 +528,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -573,41 +575,41 @@ if i32.const 0 i32.const 592 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -620,55 +622,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -747,86 +749,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 592 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -835,25 +824,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -865,24 +837,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -892,7 +857,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -900,7 +865,7 @@ if i32.const 0 i32.const 592 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -910,24 +875,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -935,21 +909,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -959,18 +933,18 @@ if i32.const 0 i32.const 592 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -995,14 +969,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1016,17 +990,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1035,16 +1009,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1064,7 +1038,7 @@ if i32.const 0 i32.const 592 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1107,7 +1081,7 @@ if i32.const 0 i32.const 592 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1140,7 +1114,7 @@ if i32.const 0 i32.const 592 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1383,7 +1357,7 @@ if i32.const 0 i32.const 592 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1714,7 +1688,7 @@ if i32.const 256 i32.const 592 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1798,7 +1772,7 @@ if i32.const 0 i32.const 592 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1863,7 +1837,7 @@ if i32.const 0 i32.const 592 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2014,7 +1988,7 @@ if i32.const 0 i32.const 592 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2123,7 +2097,7 @@ if i32.const 0 i32.const 592 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2143,7 +2117,7 @@ if i32.const 0 i32.const 592 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-unary.optimized.wat b/tests/compiler/resolve-unary.optimized.wat index cc80dd20f9..cc227f63c1 100644 --- a/tests/compiler/resolve-unary.optimized.wat +++ b/tests/compiler/resolve-unary.optimized.wat @@ -328,7 +328,7 @@ if i32.const 0 i32.const 1616 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -337,18 +337,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -362,12 +356,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -391,7 +392,7 @@ if i32.const 0 i32.const 1616 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -476,8 +477,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -490,7 +489,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -510,15 +509,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -526,34 +527,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -561,76 +548,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1616 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -640,12 +605,12 @@ if i32.const 0 i32.const 1616 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -653,34 +618,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -688,14 +657,14 @@ if i32.const 0 i32.const 1616 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -718,7 +687,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -731,12 +700,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -758,7 +727,7 @@ if i32.const 0 i32.const 1616 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -786,7 +755,7 @@ if i32.const 0 i32.const 1616 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -814,7 +783,7 @@ if i32.const 0 i32.const 1616 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1162,7 +1131,7 @@ if i32.const 0 i32.const 1616 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1250,7 +1219,7 @@ if i32.const 0 i32.const 1616 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1302,7 +1271,7 @@ if i32.const 0 i32.const 1616 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1333,7 +1302,7 @@ if i32.const 1280 i32.const 1616 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1424,7 +1393,7 @@ if i32.const 0 i32.const 1616 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1439,7 +1408,7 @@ if i32.const 0 i32.const 1616 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1458,7 +1427,7 @@ if i32.const 0 i32.const 1616 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-unary.untouched.wat b/tests/compiler/resolve-unary.untouched.wat index 29898b7da9..d6283701d4 100644 --- a/tests/compiler/resolve-unary.untouched.wat +++ b/tests/compiler/resolve-unary.untouched.wat @@ -481,7 +481,7 @@ if i32.const 0 i32.const 592 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -497,18 +497,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -524,12 +517,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -562,41 +564,41 @@ if i32.const 0 i32.const 592 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -609,55 +611,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -736,86 +738,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 592 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -824,25 +813,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -854,24 +826,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -881,7 +846,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -889,7 +854,7 @@ if i32.const 0 i32.const 592 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -899,24 +864,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -924,21 +898,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -948,18 +922,18 @@ if i32.const 0 i32.const 592 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -984,14 +958,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1005,17 +979,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1024,16 +998,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1053,7 +1027,7 @@ if i32.const 0 i32.const 592 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1096,7 +1070,7 @@ if i32.const 0 i32.const 592 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1129,7 +1103,7 @@ if i32.const 0 i32.const 592 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1372,7 +1346,7 @@ if i32.const 0 i32.const 592 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1703,7 +1677,7 @@ if i32.const 256 i32.const 592 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1787,7 +1761,7 @@ if i32.const 0 i32.const 592 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1852,7 +1826,7 @@ if i32.const 0 i32.const 592 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2003,7 +1977,7 @@ if i32.const 0 i32.const 592 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2112,7 +2086,7 @@ if i32.const 0 i32.const 592 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2132,7 +2106,7 @@ if i32.const 0 i32.const 592 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.optimized.wat b/tests/compiler/rt/finalize.optimized.wat index be16fffa83..035c1ff28c 100644 --- a/tests/compiler/rt/finalize.optimized.wat +++ b/tests/compiler/rt/finalize.optimized.wat @@ -276,7 +276,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -285,18 +285,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -310,12 +304,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -339,7 +340,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,8 +425,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -438,7 +437,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -458,15 +457,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -474,34 +475,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -509,76 +496,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -588,12 +553,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -601,34 +566,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -636,14 +605,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -666,7 +635,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -679,12 +648,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -706,7 +675,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -734,7 +703,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -762,7 +731,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -963,7 +932,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1198,7 +1167,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1279,7 +1248,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1294,7 +1263,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.untouched.wat b/tests/compiler/rt/finalize.untouched.wat index e131fb6a65..9825ae6c15 100644 --- a/tests/compiler/rt/finalize.untouched.wat +++ b/tests/compiler/rt/finalize.untouched.wat @@ -417,7 +417,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -433,18 +433,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -460,12 +453,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -498,41 +500,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -545,55 +547,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -672,86 +674,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -760,25 +749,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -790,24 +762,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -817,7 +782,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -825,7 +790,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -835,24 +800,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -860,21 +834,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -884,18 +858,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -920,14 +894,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -941,17 +915,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -960,16 +934,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -989,7 +963,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1032,7 +1006,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1065,7 +1039,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1308,7 +1282,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1643,7 +1617,7 @@ if i32.const 32 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1727,7 +1701,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1792,7 +1766,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1943,7 +1917,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2052,7 +2026,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2072,7 +2046,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/instanceof.optimized.wat b/tests/compiler/rt/instanceof.optimized.wat index 448cacaf17..80e2b88973 100644 --- a/tests/compiler/rt/instanceof.optimized.wat +++ b/tests/compiler/rt/instanceof.optimized.wat @@ -317,7 +317,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -326,18 +326,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -351,12 +345,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -380,7 +381,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -465,8 +466,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -479,7 +478,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -499,15 +498,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -515,34 +516,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -550,76 +537,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -629,12 +594,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -642,34 +607,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -677,14 +646,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -707,7 +676,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -720,12 +689,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -747,7 +716,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -775,7 +744,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -803,7 +772,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1151,7 +1120,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1219,7 +1188,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1300,7 +1269,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1315,7 +1284,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/instanceof.untouched.wat b/tests/compiler/rt/instanceof.untouched.wat index 6ad476960b..a5356c9353 100644 --- a/tests/compiler/rt/instanceof.untouched.wat +++ b/tests/compiler/rt/instanceof.untouched.wat @@ -408,7 +408,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,18 +424,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -451,12 +444,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -489,41 +491,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -536,55 +538,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -663,86 +665,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -751,25 +740,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -781,24 +753,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -808,7 +773,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -816,7 +781,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -826,24 +791,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -851,21 +825,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -875,18 +849,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -911,14 +885,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -932,17 +906,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -951,16 +925,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -980,7 +954,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1023,7 +997,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1056,7 +1030,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1299,7 +1273,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1630,7 +1604,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1714,7 +1688,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1779,7 +1753,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1930,7 +1904,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2039,7 +2013,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2059,7 +2033,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-incremental-export.optimized.wat b/tests/compiler/rt/runtime-incremental-export.optimized.wat index e8eb27890d..ab75059b7f 100644 --- a/tests/compiler/rt/runtime-incremental-export.optimized.wat +++ b/tests/compiler/rt/runtime-incremental-export.optimized.wat @@ -292,7 +292,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -301,18 +301,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -326,12 +320,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -355,7 +356,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -440,8 +441,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -454,7 +453,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -474,15 +473,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -490,34 +491,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -525,76 +512,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -604,12 +569,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -617,34 +582,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -652,14 +621,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -682,7 +651,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -695,12 +664,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -722,7 +691,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -750,7 +719,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -778,7 +747,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1126,7 +1095,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1214,7 +1183,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1266,7 +1235,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1297,7 +1266,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1388,7 +1357,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1403,7 +1372,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1422,7 +1391,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-incremental-export.untouched.wat b/tests/compiler/rt/runtime-incremental-export.untouched.wat index 8b7ff30ef2..bd4a300f3d 100644 --- a/tests/compiler/rt/runtime-incremental-export.untouched.wat +++ b/tests/compiler/rt/runtime-incremental-export.untouched.wat @@ -404,7 +404,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -420,18 +420,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -447,12 +440,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -485,41 +487,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -532,55 +534,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -659,86 +661,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -747,25 +736,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -777,24 +749,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -804,7 +769,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -812,7 +777,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -822,24 +787,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -847,21 +821,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -871,18 +845,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -907,14 +881,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -928,17 +902,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -947,16 +921,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -976,7 +950,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1019,7 +993,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1052,7 +1026,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1295,7 +1269,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1626,7 +1600,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1710,7 +1684,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1775,7 +1749,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1926,7 +1900,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2035,7 +2009,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2055,7 +2029,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-minimal-export.optimized.wat b/tests/compiler/rt/runtime-minimal-export.optimized.wat index 33d7d7cdc7..01a0b2e97a 100644 --- a/tests/compiler/rt/runtime-minimal-export.optimized.wat +++ b/tests/compiler/rt/runtime-minimal-export.optimized.wat @@ -47,7 +47,7 @@ if i32.const 0 i32.const 1184 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -56,18 +56,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1184 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -81,12 +75,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -110,7 +111,7 @@ if i32.const 0 i32.const 1184 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -195,8 +196,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -209,7 +208,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -229,15 +228,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -245,34 +246,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -280,76 +267,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1184 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1184 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -359,12 +324,12 @@ if i32.const 0 i32.const 1184 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -372,34 +337,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -407,14 +376,14 @@ if i32.const 0 i32.const 1184 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -437,7 +406,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -450,12 +419,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -477,7 +446,7 @@ if i32.const 0 i32.const 1184 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -505,7 +474,7 @@ if i32.const 0 i32.const 1184 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -533,7 +502,7 @@ if i32.const 0 i32.const 1184 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -715,7 +684,7 @@ if i32.const 0 i32.const 1184 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -767,7 +736,7 @@ if i32.const 0 i32.const 1184 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -798,7 +767,7 @@ if i32.const 1056 i32.const 1184 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -889,7 +858,7 @@ if i32.const 0 i32.const 1184 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -904,7 +873,7 @@ if i32.const 0 i32.const 1184 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -923,7 +892,7 @@ if i32.const 0 i32.const 1184 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -1357,7 +1326,7 @@ if i32.const 0 i32.const 1184 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-minimal-export.untouched.wat b/tests/compiler/rt/runtime-minimal-export.untouched.wat index bb07803434..4b1307c062 100644 --- a/tests/compiler/rt/runtime-minimal-export.untouched.wat +++ b/tests/compiler/rt/runtime-minimal-export.untouched.wat @@ -78,7 +78,7 @@ if i32.const 0 i32.const 160 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -94,18 +94,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 160 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -121,12 +114,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -159,41 +161,41 @@ if i32.const 0 i32.const 160 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -206,55 +208,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -333,86 +335,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 160 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -421,25 +410,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -451,24 +423,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 160 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -478,7 +443,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -486,7 +451,7 @@ if i32.const 0 i32.const 160 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -496,24 +461,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -521,21 +495,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -545,18 +519,18 @@ if i32.const 0 i32.const 160 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -581,14 +555,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -602,17 +576,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -621,16 +595,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -650,7 +624,7 @@ if i32.const 0 i32.const 160 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -693,7 +667,7 @@ if i32.const 0 i32.const 160 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -726,7 +700,7 @@ if i32.const 0 i32.const 160 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -966,7 +940,7 @@ if i32.const 32 i32.const 160 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1050,7 +1024,7 @@ if i32.const 0 i32.const 160 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1115,7 +1089,7 @@ if i32.const 0 i32.const 160 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1266,7 +1240,7 @@ if i32.const 0 i32.const 160 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -1375,7 +1349,7 @@ if i32.const 0 i32.const 160 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1395,7 +1369,7 @@ if i32.const 0 i32.const 160 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1690,7 +1664,7 @@ if i32.const 0 i32.const 160 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std-wasi/console.optimized.wat b/tests/compiler/std-wasi/console.optimized.wat index 48cfbddc72..1cccf9a240 100644 --- a/tests/compiler/std-wasi/console.optimized.wat +++ b/tests/compiler/std-wasi/console.optimized.wat @@ -942,7 +942,7 @@ if i32.const 0 i32.const 4224 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -951,18 +951,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 4224 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -976,12 +970,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -1005,7 +1006,7 @@ if i32.const 0 i32.const 4224 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1090,8 +1091,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -1104,7 +1103,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -1124,15 +1123,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -1140,34 +1141,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -1175,76 +1162,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 4224 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 4224 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1254,12 +1219,12 @@ if i32.const 0 i32.const 4224 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1267,34 +1232,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1302,14 +1271,14 @@ if i32.const 0 i32.const 4224 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1332,7 +1301,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1345,12 +1314,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1372,7 +1341,7 @@ if i32.const 0 i32.const 4224 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1400,7 +1369,7 @@ if i32.const 0 i32.const 4224 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1428,7 +1397,7 @@ if i32.const 0 i32.const 4224 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -1610,7 +1579,7 @@ if i32.const 0 i32.const 4224 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1662,7 +1631,7 @@ if i32.const 0 i32.const 4224 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -1693,7 +1662,7 @@ if i32.const 4288 i32.const 4224 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -1784,7 +1753,7 @@ if i32.const 0 i32.const 4224 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1799,7 +1768,7 @@ if i32.const 0 i32.const 4224 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1818,7 +1787,7 @@ if i32.const 0 i32.const 4224 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1933,7 +1902,7 @@ if i32.const 0 i32.const 4224 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std-wasi/console.untouched.wat b/tests/compiler/std-wasi/console.untouched.wat index 4bbaf7f5a8..0c22c4089a 100644 --- a/tests/compiler/std-wasi/console.untouched.wat +++ b/tests/compiler/std-wasi/console.untouched.wat @@ -1393,7 +1393,7 @@ if i32.const 0 i32.const 3200 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1409,18 +1409,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 3200 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1436,12 +1429,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -1474,41 +1476,41 @@ if i32.const 0 i32.const 3200 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -1521,55 +1523,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1648,86 +1650,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 3200 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1736,25 +1725,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1766,24 +1738,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 3200 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1793,7 +1758,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1801,7 +1766,7 @@ if i32.const 0 i32.const 3200 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1811,24 +1776,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1836,21 +1810,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1860,18 +1834,18 @@ if i32.const 0 i32.const 3200 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1896,14 +1870,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1917,17 +1891,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1936,16 +1910,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1965,7 +1939,7 @@ if i32.const 0 i32.const 3200 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2008,7 +1982,7 @@ if i32.const 0 i32.const 3200 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -2041,7 +2015,7 @@ if i32.const 0 i32.const 3200 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -2281,7 +2255,7 @@ if i32.const 3264 i32.const 3200 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -2365,7 +2339,7 @@ if i32.const 0 i32.const 3200 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2430,7 +2404,7 @@ if i32.const 0 i32.const 3200 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -2581,7 +2555,7 @@ if i32.const 0 i32.const 3200 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2690,7 +2664,7 @@ if i32.const 0 i32.const 3200 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -2710,7 +2684,7 @@ if i32.const 0 i32.const 3200 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2768,7 +2742,7 @@ if i32.const 0 i32.const 3200 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std-wasi/crypto.optimized.wat b/tests/compiler/std-wasi/crypto.optimized.wat index db24d5fef1..8bc98540d0 100644 --- a/tests/compiler/std-wasi/crypto.optimized.wat +++ b/tests/compiler/std-wasi/crypto.optimized.wat @@ -832,7 +832,7 @@ if i32.const 0 i32.const 1504 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -841,18 +841,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -866,12 +860,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -895,7 +896,7 @@ if i32.const 0 i32.const 1504 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -980,8 +981,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -994,7 +993,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -1014,15 +1013,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -1030,34 +1031,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -1065,76 +1052,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1504 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1144,12 +1109,12 @@ if i32.const 0 i32.const 1504 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1157,34 +1122,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1192,14 +1161,14 @@ if i32.const 0 i32.const 1504 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1222,7 +1191,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1235,12 +1204,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1262,7 +1231,7 @@ if i32.const 0 i32.const 1504 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1290,7 +1259,7 @@ if i32.const 0 i32.const 1504 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1318,7 +1287,7 @@ if i32.const 0 i32.const 1504 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -1483,7 +1452,7 @@ if i32.const 0 i32.const 1504 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable @@ -1759,7 +1728,7 @@ if i32.const 0 i32.const 1504 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1811,7 +1780,7 @@ if i32.const 0 i32.const 1504 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -1842,7 +1811,7 @@ if i32.const 1168 i32.const 1504 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -1933,7 +1902,7 @@ if i32.const 0 i32.const 1504 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1948,7 +1917,7 @@ if i32.const 0 i32.const 1504 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1967,7 +1936,7 @@ if i32.const 0 i32.const 1504 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std-wasi/crypto.untouched.wat b/tests/compiler/std-wasi/crypto.untouched.wat index cef52d8a40..2f4a2b0e81 100644 --- a/tests/compiler/std-wasi/crypto.untouched.wat +++ b/tests/compiler/std-wasi/crypto.untouched.wat @@ -952,7 +952,7 @@ if i32.const 0 i32.const 480 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -968,18 +968,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -995,12 +988,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -1033,41 +1035,41 @@ if i32.const 0 i32.const 480 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -1080,55 +1082,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1207,86 +1209,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 480 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1295,25 +1284,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1325,24 +1297,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1352,7 +1317,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1360,7 +1325,7 @@ if i32.const 0 i32.const 480 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1370,24 +1335,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1395,21 +1369,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1419,18 +1393,18 @@ if i32.const 0 i32.const 480 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1455,14 +1429,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1476,17 +1450,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1495,16 +1469,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1524,7 +1498,7 @@ if i32.const 0 i32.const 480 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1567,7 +1541,7 @@ if i32.const 0 i32.const 480 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1600,7 +1574,7 @@ if i32.const 0 i32.const 480 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -1843,7 +1817,7 @@ if i32.const 0 i32.const 480 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable @@ -2174,7 +2148,7 @@ if i32.const 144 i32.const 480 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -2258,7 +2232,7 @@ if i32.const 0 i32.const 480 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2323,7 +2297,7 @@ if i32.const 0 i32.const 480 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -2474,7 +2448,7 @@ if i32.const 0 i32.const 480 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2583,7 +2557,7 @@ if i32.const 0 i32.const 480 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -2603,7 +2577,7 @@ if i32.const 0 i32.const 480 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std-wasi/process.optimized.wat b/tests/compiler/std-wasi/process.optimized.wat index 77829af1b9..8a27466d87 100644 --- a/tests/compiler/std-wasi/process.optimized.wat +++ b/tests/compiler/std-wasi/process.optimized.wat @@ -930,7 +930,7 @@ if i32.const 0 i32.const 4176 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -939,18 +939,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 4176 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -964,12 +958,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -993,7 +994,7 @@ if i32.const 0 i32.const 4176 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1078,8 +1079,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -1092,7 +1091,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -1112,15 +1111,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -1128,34 +1129,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -1163,76 +1150,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 4176 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 4176 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1242,12 +1207,12 @@ if i32.const 0 i32.const 4176 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1255,34 +1220,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1290,14 +1259,14 @@ if i32.const 0 i32.const 4176 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1320,7 +1289,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1333,12 +1302,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1360,7 +1329,7 @@ if i32.const 0 i32.const 4176 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1388,7 +1357,7 @@ if i32.const 0 i32.const 4176 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1416,7 +1385,7 @@ if i32.const 0 i32.const 4176 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -1598,7 +1567,7 @@ if i32.const 0 i32.const 4176 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1650,7 +1619,7 @@ if i32.const 0 i32.const 4176 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -1681,7 +1650,7 @@ if i32.const 4240 i32.const 4176 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -1772,7 +1741,7 @@ if i32.const 0 i32.const 4176 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1787,7 +1756,7 @@ if i32.const 0 i32.const 4176 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1806,7 +1775,7 @@ if i32.const 0 i32.const 4176 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1921,7 +1890,7 @@ if i32.const 0 i32.const 4176 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std-wasi/process.untouched.wat b/tests/compiler/std-wasi/process.untouched.wat index 128d645bb2..980dc7776f 100644 --- a/tests/compiler/std-wasi/process.untouched.wat +++ b/tests/compiler/std-wasi/process.untouched.wat @@ -1392,7 +1392,7 @@ if i32.const 0 i32.const 3152 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1408,18 +1408,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 3152 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1435,12 +1428,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -1473,41 +1475,41 @@ if i32.const 0 i32.const 3152 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -1520,55 +1522,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1647,86 +1649,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 3152 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1735,25 +1724,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1765,24 +1737,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 3152 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1792,7 +1757,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1800,7 +1765,7 @@ if i32.const 0 i32.const 3152 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1810,24 +1775,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1835,21 +1809,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1859,18 +1833,18 @@ if i32.const 0 i32.const 3152 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1895,14 +1869,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1916,17 +1890,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1935,16 +1909,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1964,7 +1938,7 @@ if i32.const 0 i32.const 3152 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2007,7 +1981,7 @@ if i32.const 0 i32.const 3152 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -2040,7 +2014,7 @@ if i32.const 0 i32.const 3152 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -2280,7 +2254,7 @@ if i32.const 3216 i32.const 3152 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -2364,7 +2338,7 @@ if i32.const 0 i32.const 3152 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2429,7 +2403,7 @@ if i32.const 0 i32.const 3152 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -2580,7 +2554,7 @@ if i32.const 0 i32.const 3152 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2689,7 +2663,7 @@ if i32.const 0 i32.const 3152 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -2709,7 +2683,7 @@ if i32.const 0 i32.const 3152 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2767,7 +2741,7 @@ if i32.const 0 i32.const 3152 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index 080ca27869..ecebceccea 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -368,7 +368,7 @@ if i32.const 0 i32.const 1744 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -377,18 +377,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1744 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -402,12 +396,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -431,7 +432,7 @@ if i32.const 0 i32.const 1744 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -516,8 +517,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -530,7 +529,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -550,15 +549,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -566,34 +567,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -601,76 +588,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1744 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1744 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -680,12 +645,12 @@ if i32.const 0 i32.const 1744 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -693,34 +658,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -728,14 +697,14 @@ if i32.const 0 i32.const 1744 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -758,7 +727,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -771,12 +740,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -798,7 +767,7 @@ if i32.const 0 i32.const 1744 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -826,7 +795,7 @@ if i32.const 0 i32.const 1744 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -854,7 +823,7 @@ if i32.const 0 i32.const 1744 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1202,7 +1171,7 @@ if i32.const 0 i32.const 1744 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1290,7 +1259,7 @@ if i32.const 0 i32.const 1744 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1342,7 +1311,7 @@ if i32.const 0 i32.const 1744 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1373,7 +1342,7 @@ if i32.const 1472 i32.const 1744 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1464,7 +1433,7 @@ if i32.const 0 i32.const 1744 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1479,7 +1448,7 @@ if i32.const 0 i32.const 1744 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1498,7 +1467,7 @@ if i32.const 0 i32.const 1744 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index a582a60cb7..0cb189f943 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -474,7 +474,7 @@ if i32.const 0 i32.const 720 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -490,18 +490,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 720 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -517,12 +510,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -555,41 +557,41 @@ if i32.const 0 i32.const 720 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -602,55 +604,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -729,86 +731,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 720 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -817,25 +806,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -847,24 +819,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 720 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -874,7 +839,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -882,7 +847,7 @@ if i32.const 0 i32.const 720 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -892,24 +857,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -917,21 +891,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -941,18 +915,18 @@ if i32.const 0 i32.const 720 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -977,14 +951,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -998,17 +972,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1017,16 +991,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1046,7 +1020,7 @@ if i32.const 0 i32.const 720 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1089,7 +1063,7 @@ if i32.const 0 i32.const 720 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1122,7 +1096,7 @@ if i32.const 0 i32.const 720 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1365,7 +1339,7 @@ if i32.const 0 i32.const 720 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1696,7 +1670,7 @@ if i32.const 448 i32.const 720 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1780,7 +1754,7 @@ if i32.const 0 i32.const 720 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1845,7 +1819,7 @@ if i32.const 0 i32.const 720 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1996,7 +1970,7 @@ if i32.const 0 i32.const 720 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2105,7 +2079,7 @@ if i32.const 0 i32.const 720 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2125,7 +2099,7 @@ if i32.const 0 i32.const 720 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 3be032c00c..381d338b31 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -924,7 +924,7 @@ if i32.const 0 i32.const 1488 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -933,18 +933,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1488 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -958,12 +952,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -987,7 +988,7 @@ if i32.const 0 i32.const 1488 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -1072,8 +1073,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -1086,7 +1085,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -1106,15 +1105,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -1122,34 +1123,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -1157,76 +1144,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1488 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1488 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1236,12 +1201,12 @@ if i32.const 0 i32.const 1488 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1249,34 +1214,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1284,14 +1253,14 @@ if i32.const 0 i32.const 1488 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1314,7 +1283,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1327,12 +1296,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1354,7 +1323,7 @@ if i32.const 0 i32.const 1488 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1382,7 +1351,7 @@ if i32.const 0 i32.const 1488 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1410,7 +1379,7 @@ if i32.const 0 i32.const 1488 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1575,7 +1544,7 @@ if i32.const 0 i32.const 1488 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1851,7 +1820,7 @@ if i32.const 0 i32.const 1488 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1903,7 +1872,7 @@ if i32.const 0 i32.const 1488 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1934,7 +1903,7 @@ if i32.const 1152 i32.const 1488 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2025,7 +1994,7 @@ if i32.const 0 i32.const 1488 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2040,7 +2009,7 @@ if i32.const 0 i32.const 1488 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -2059,7 +2028,7 @@ if i32.const 0 i32.const 1488 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 57db8f91f4..5738d1e534 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -788,7 +788,7 @@ if i32.const 0 i32.const 464 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -804,18 +804,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 464 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -831,12 +824,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -869,41 +871,41 @@ if i32.const 0 i32.const 464 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -916,55 +918,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1043,86 +1045,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 464 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1131,25 +1120,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1161,24 +1133,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 464 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1188,7 +1153,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1196,7 +1161,7 @@ if i32.const 0 i32.const 464 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1206,24 +1171,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1231,21 +1205,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1255,18 +1229,18 @@ if i32.const 0 i32.const 464 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1291,14 +1265,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1312,17 +1286,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1331,16 +1305,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1360,7 +1334,7 @@ if i32.const 0 i32.const 464 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1403,7 +1377,7 @@ if i32.const 0 i32.const 464 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1436,7 +1410,7 @@ if i32.const 0 i32.const 464 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1679,7 +1653,7 @@ if i32.const 0 i32.const 464 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -2010,7 +1984,7 @@ if i32.const 128 i32.const 464 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2094,7 +2068,7 @@ if i32.const 0 i32.const 464 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2159,7 +2133,7 @@ if i32.const 0 i32.const 464 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2310,7 +2284,7 @@ if i32.const 0 i32.const 464 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2419,7 +2393,7 @@ if i32.const 0 i32.const 464 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2439,7 +2413,7 @@ if i32.const 0 i32.const 464 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index edefbfb8af..4fcd5d091d 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -285,7 +285,7 @@ if i32.const 0 i32.const 1504 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -294,18 +294,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -319,12 +313,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -348,7 +349,7 @@ if i32.const 0 i32.const 1504 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -433,8 +434,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -447,7 +446,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -467,15 +466,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -483,34 +484,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -518,76 +505,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1504 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -597,12 +562,12 @@ if i32.const 0 i32.const 1504 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -610,34 +575,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -645,14 +614,14 @@ if i32.const 0 i32.const 1504 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -675,7 +644,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -688,12 +657,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -715,7 +684,7 @@ if i32.const 0 i32.const 1504 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -743,7 +712,7 @@ if i32.const 0 i32.const 1504 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1504 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1119,7 +1088,7 @@ if i32.const 0 i32.const 1504 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1207,7 +1176,7 @@ if i32.const 0 i32.const 1504 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1259,7 +1228,7 @@ if i32.const 0 i32.const 1504 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1290,7 +1259,7 @@ if i32.const 1168 i32.const 1504 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1381,7 +1350,7 @@ if i32.const 0 i32.const 1504 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1396,7 +1365,7 @@ if i32.const 0 i32.const 1504 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1415,7 +1384,7 @@ if i32.const 0 i32.const 1504 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 73e39580c4..1449f6b80c 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -404,7 +404,7 @@ if i32.const 0 i32.const 480 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -420,18 +420,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -447,12 +440,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -485,41 +487,41 @@ if i32.const 0 i32.const 480 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -532,55 +534,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -659,86 +661,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 480 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -747,25 +736,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -777,24 +749,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -804,7 +769,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -812,7 +777,7 @@ if i32.const 0 i32.const 480 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -822,24 +787,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -847,21 +821,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -871,18 +845,18 @@ if i32.const 0 i32.const 480 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -907,14 +881,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -928,17 +902,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -947,16 +921,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -976,7 +950,7 @@ if i32.const 0 i32.const 480 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1019,7 +993,7 @@ if i32.const 0 i32.const 480 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1052,7 +1026,7 @@ if i32.const 0 i32.const 480 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1295,7 +1269,7 @@ if i32.const 0 i32.const 480 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1626,7 +1600,7 @@ if i32.const 144 i32.const 480 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1710,7 +1684,7 @@ if i32.const 0 i32.const 480 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1775,7 +1749,7 @@ if i32.const 0 i32.const 480 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1926,7 +1900,7 @@ if i32.const 0 i32.const 480 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2035,7 +2009,7 @@ if i32.const 0 i32.const 480 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2055,7 +2029,7 @@ if i32.const 0 i32.const 480 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index ef01115839..91afc24b3d 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -292,7 +292,7 @@ if i32.const 0 i32.const 1504 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -301,18 +301,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -326,12 +320,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -355,7 +356,7 @@ if i32.const 0 i32.const 1504 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -440,8 +441,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -454,7 +453,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -474,15 +473,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -490,34 +491,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -525,76 +512,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1504 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -604,12 +569,12 @@ if i32.const 0 i32.const 1504 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -617,34 +582,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -652,14 +621,14 @@ if i32.const 0 i32.const 1504 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -682,7 +651,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -695,12 +664,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -722,7 +691,7 @@ if i32.const 0 i32.const 1504 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -750,7 +719,7 @@ if i32.const 0 i32.const 1504 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -778,7 +747,7 @@ if i32.const 0 i32.const 1504 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1126,7 +1095,7 @@ if i32.const 0 i32.const 1504 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1214,7 +1183,7 @@ if i32.const 0 i32.const 1504 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1266,7 +1235,7 @@ if i32.const 0 i32.const 1504 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1297,7 +1266,7 @@ if i32.const 1168 i32.const 1504 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1388,7 +1357,7 @@ if i32.const 0 i32.const 1504 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1403,7 +1372,7 @@ if i32.const 0 i32.const 1504 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1422,7 +1391,7 @@ if i32.const 0 i32.const 1504 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 02400d5588..48136ef6aa 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -411,7 +411,7 @@ if i32.const 0 i32.const 480 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -427,18 +427,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -454,12 +447,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -492,41 +494,41 @@ if i32.const 0 i32.const 480 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -539,55 +541,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -666,86 +668,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 480 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -754,25 +743,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -784,24 +756,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -811,7 +776,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -819,7 +784,7 @@ if i32.const 0 i32.const 480 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -829,24 +794,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -854,21 +828,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -878,18 +852,18 @@ if i32.const 0 i32.const 480 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -914,14 +888,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -935,17 +909,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -954,16 +928,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -983,7 +957,7 @@ if i32.const 0 i32.const 480 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1026,7 +1000,7 @@ if i32.const 0 i32.const 480 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1059,7 +1033,7 @@ if i32.const 0 i32.const 480 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1302,7 +1276,7 @@ if i32.const 0 i32.const 480 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1633,7 +1607,7 @@ if i32.const 144 i32.const 480 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1717,7 +1691,7 @@ if i32.const 0 i32.const 480 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1782,7 +1756,7 @@ if i32.const 0 i32.const 480 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1933,7 +1907,7 @@ if i32.const 0 i32.const 480 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2042,7 +2016,7 @@ if i32.const 0 i32.const 480 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2062,7 +2036,7 @@ if i32.const 0 i32.const 480 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/date.optimized.wat b/tests/compiler/std/date.optimized.wat index b0b9904199..cadec315ca 100644 --- a/tests/compiler/std/date.optimized.wat +++ b/tests/compiler/std/date.optimized.wat @@ -285,7 +285,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -294,18 +294,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -319,12 +313,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -348,7 +349,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -433,8 +434,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -447,7 +446,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -467,15 +466,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -483,34 +484,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -518,76 +505,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -597,12 +562,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -610,34 +575,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -645,14 +614,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -675,7 +644,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -688,12 +657,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -715,7 +684,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -743,7 +712,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1119,7 +1088,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1187,7 +1156,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1268,7 +1237,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1283,7 +1252,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/date.untouched.wat b/tests/compiler/std/date.untouched.wat index 06e5eaf644..5d626f364a 100644 --- a/tests/compiler/std/date.untouched.wat +++ b/tests/compiler/std/date.untouched.wat @@ -413,7 +413,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -429,18 +429,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -456,12 +449,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -494,41 +496,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -541,55 +543,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -668,86 +670,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -756,25 +745,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -786,24 +758,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -813,7 +778,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -821,7 +786,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -831,24 +796,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -856,21 +830,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -880,18 +854,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -916,14 +890,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -937,17 +911,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -956,16 +930,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -985,7 +959,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1028,7 +1002,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1061,7 +1035,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1304,7 +1278,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1635,7 +1609,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1719,7 +1693,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1784,7 +1758,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1935,7 +1909,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2044,7 +2018,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2064,7 +2038,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index d14215a39c..5fd8875b69 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -308,7 +308,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -317,18 +317,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -342,12 +336,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -371,7 +372,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -456,8 +457,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -470,7 +469,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -490,15 +489,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -506,34 +507,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -541,76 +528,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -620,12 +585,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -633,34 +598,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -668,14 +637,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -698,7 +667,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -711,12 +680,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -738,7 +707,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -766,7 +735,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -794,7 +763,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1142,7 +1111,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1230,7 +1199,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1282,7 +1251,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1313,7 +1282,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1404,7 +1373,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1419,7 +1388,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1438,7 +1407,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index a717de95f6..2f2a1a6138 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -424,7 +424,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -440,18 +440,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -467,12 +460,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -505,41 +507,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -552,55 +554,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -679,86 +681,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -767,25 +756,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -797,24 +769,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -824,7 +789,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -832,7 +797,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -842,24 +807,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -867,21 +841,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -891,18 +865,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -927,14 +901,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -948,17 +922,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -967,16 +941,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -996,7 +970,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1039,7 +1013,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1072,7 +1046,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1315,7 +1289,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1646,7 +1620,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1730,7 +1704,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1795,7 +1769,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1946,7 +1920,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2055,7 +2029,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2075,7 +2049,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index befc2361b6..88733b3508 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -278,7 +278,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -287,18 +287,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -312,12 +306,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -341,7 +342,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -426,8 +427,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -440,7 +439,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -460,15 +459,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -476,34 +477,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -511,76 +498,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -590,12 +555,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -603,34 +568,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -638,14 +607,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -668,7 +637,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -681,12 +650,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -708,7 +677,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -736,7 +705,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -764,7 +733,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1112,7 +1081,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1180,7 +1149,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1261,7 +1230,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1276,7 +1245,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/new.untouched.wat b/tests/compiler/std/new.untouched.wat index 78fcc95b18..bcf3caf17a 100644 --- a/tests/compiler/std/new.untouched.wat +++ b/tests/compiler/std/new.untouched.wat @@ -411,7 +411,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -427,18 +427,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -454,12 +447,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -492,41 +494,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -539,55 +541,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -666,86 +668,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -754,25 +743,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -784,24 +756,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -811,7 +776,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -819,7 +784,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -829,24 +794,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -854,21 +828,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -878,18 +852,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -914,14 +888,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -935,17 +909,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -954,16 +928,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -983,7 +957,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1026,7 +1000,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1059,7 +1033,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1302,7 +1276,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1633,7 +1607,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1717,7 +1691,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1782,7 +1756,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1933,7 +1907,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2042,7 +2016,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2062,7 +2036,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index 25aa6479a0..8bdf61ac85 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -337,7 +337,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -346,18 +346,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -371,12 +365,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -400,7 +401,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -485,8 +486,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -499,7 +498,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -519,15 +518,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -535,34 +536,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -570,76 +557,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -649,12 +614,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -662,34 +627,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -697,14 +666,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -727,7 +696,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -740,12 +709,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -767,7 +736,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -795,7 +764,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -823,7 +792,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1171,7 +1140,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1239,7 +1208,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1320,7 +1289,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1335,7 +1304,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index 95d7fa95a8..8ef485fe7c 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -465,7 +465,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -481,18 +481,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -508,12 +501,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -546,41 +548,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -593,55 +595,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -720,86 +722,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -808,25 +797,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -838,24 +810,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -865,7 +830,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -873,7 +838,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -883,24 +848,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -908,21 +882,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -932,18 +906,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -968,14 +942,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -989,17 +963,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1008,16 +982,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1037,7 +1011,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1080,7 +1054,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1113,7 +1087,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1356,7 +1330,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1687,7 +1661,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1771,7 +1745,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1836,7 +1810,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1987,7 +1961,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2096,7 +2070,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2116,7 +2090,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 440277b2b4..dc6b765f06 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -299,7 +299,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -308,18 +308,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -333,12 +327,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -362,7 +363,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -447,8 +448,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -461,7 +460,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -481,15 +480,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -497,34 +498,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -532,76 +519,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -611,12 +576,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -624,34 +589,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -659,14 +628,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -689,7 +658,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -702,12 +671,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -729,7 +698,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -757,7 +726,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -785,7 +754,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1133,7 +1102,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1221,7 +1190,7 @@ if i32.const 0 i32.const 1392 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1273,7 +1242,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1304,7 +1273,7 @@ if i32.const 1056 i32.const 1392 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1395,7 +1364,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1410,7 +1379,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1429,7 +1398,7 @@ if i32.const 0 i32.const 1392 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 89ab5db681..5c7bee8bb2 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -419,7 +419,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -435,18 +435,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -462,12 +455,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -500,41 +502,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -547,55 +549,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -674,86 +676,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -762,25 +751,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -792,24 +764,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -819,7 +784,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -827,7 +792,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -837,24 +802,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -862,21 +836,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -886,18 +860,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -922,14 +896,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -943,17 +917,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -962,16 +936,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -991,7 +965,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1034,7 +1008,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1067,7 +1041,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1310,7 +1284,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1641,7 +1615,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1725,7 +1699,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1790,7 +1764,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1941,7 +1915,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2050,7 +2024,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2070,7 +2044,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/static-array.optimized.wat b/tests/compiler/std/static-array.optimized.wat index 733aa7c4d2..f788031ed0 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -329,7 +329,7 @@ if i32.const 0 i32.const 1904 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -338,18 +338,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1904 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -363,12 +357,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -392,7 +393,7 @@ if i32.const 0 i32.const 1904 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -477,8 +478,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -491,7 +490,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -511,15 +510,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -527,34 +528,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -562,76 +549,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1904 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1904 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -641,12 +606,12 @@ if i32.const 0 i32.const 1904 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -654,34 +619,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -689,14 +658,14 @@ if i32.const 0 i32.const 1904 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -719,7 +688,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -732,12 +701,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -759,7 +728,7 @@ if i32.const 0 i32.const 1904 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -787,7 +756,7 @@ if i32.const 0 i32.const 1904 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -815,7 +784,7 @@ if i32.const 0 i32.const 1904 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1163,7 +1132,7 @@ if i32.const 0 i32.const 1904 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1251,7 +1220,7 @@ if i32.const 0 i32.const 1904 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1303,7 +1272,7 @@ if i32.const 0 i32.const 1904 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1334,7 +1303,7 @@ if i32.const 1632 i32.const 1904 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1425,7 +1394,7 @@ if i32.const 0 i32.const 1904 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1440,7 +1409,7 @@ if i32.const 0 i32.const 1904 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1459,7 +1428,7 @@ if i32.const 0 i32.const 1904 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index 779e1c4d95..b467e5415e 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -453,7 +453,7 @@ if i32.const 0 i32.const 880 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -469,18 +469,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 880 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -496,12 +489,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -534,41 +536,41 @@ if i32.const 0 i32.const 880 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -581,55 +583,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -708,86 +710,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 880 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -796,25 +785,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -826,24 +798,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 880 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -853,7 +818,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -861,7 +826,7 @@ if i32.const 0 i32.const 880 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -871,24 +836,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -896,21 +870,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -920,18 +894,18 @@ if i32.const 0 i32.const 880 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -956,14 +930,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -977,17 +951,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -996,16 +970,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1025,7 +999,7 @@ if i32.const 0 i32.const 880 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1068,7 +1042,7 @@ if i32.const 0 i32.const 880 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1101,7 +1075,7 @@ if i32.const 0 i32.const 880 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1344,7 +1318,7 @@ if i32.const 0 i32.const 880 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1675,7 +1649,7 @@ if i32.const 608 i32.const 880 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1759,7 +1733,7 @@ if i32.const 0 i32.const 880 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1824,7 +1798,7 @@ if i32.const 0 i32.const 880 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1975,7 +1949,7 @@ if i32.const 0 i32.const 880 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2084,7 +2058,7 @@ if i32.const 0 i32.const 880 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2104,7 +2078,7 @@ if i32.const 0 i32.const 880 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.optimized.wat b/tests/compiler/std/staticarray.optimized.wat index c7dfad1e64..a7ca0ec334 100644 --- a/tests/compiler/std/staticarray.optimized.wat +++ b/tests/compiler/std/staticarray.optimized.wat @@ -420,7 +420,7 @@ if i32.const 0 i32.const 1616 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -429,18 +429,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -454,12 +448,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -483,7 +484,7 @@ if i32.const 0 i32.const 1616 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -568,8 +569,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -582,7 +581,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -602,15 +601,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -618,34 +619,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -653,76 +640,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1616 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1616 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -732,12 +697,12 @@ if i32.const 0 i32.const 1616 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -745,34 +710,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -780,14 +749,14 @@ if i32.const 0 i32.const 1616 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -810,7 +779,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -823,12 +792,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -850,7 +819,7 @@ if i32.const 0 i32.const 1616 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -878,7 +847,7 @@ if i32.const 0 i32.const 1616 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -906,7 +875,7 @@ if i32.const 0 i32.const 1616 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1254,7 +1223,7 @@ if i32.const 0 i32.const 1616 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1342,7 +1311,7 @@ if i32.const 0 i32.const 1616 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1394,7 +1363,7 @@ if i32.const 0 i32.const 1616 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1425,7 +1394,7 @@ if i32.const 1344 i32.const 1616 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1516,7 +1485,7 @@ if i32.const 0 i32.const 1616 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1531,7 +1500,7 @@ if i32.const 0 i32.const 1616 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1550,7 +1519,7 @@ if i32.const 0 i32.const 1616 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.untouched.wat b/tests/compiler/std/staticarray.untouched.wat index 17cb9e1f70..1973eadef4 100644 --- a/tests/compiler/std/staticarray.untouched.wat +++ b/tests/compiler/std/staticarray.untouched.wat @@ -509,7 +509,7 @@ if i32.const 0 i32.const 592 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -525,18 +525,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -552,12 +545,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -590,41 +592,41 @@ if i32.const 0 i32.const 592 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -637,55 +639,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -764,86 +766,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 592 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -852,25 +841,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -882,24 +854,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 592 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -909,7 +874,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -917,7 +882,7 @@ if i32.const 0 i32.const 592 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -927,24 +892,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -952,21 +926,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -976,18 +950,18 @@ if i32.const 0 i32.const 592 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1012,14 +986,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1033,17 +1007,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1052,16 +1026,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1081,7 +1055,7 @@ if i32.const 0 i32.const 592 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1124,7 +1098,7 @@ if i32.const 0 i32.const 592 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1157,7 +1131,7 @@ if i32.const 0 i32.const 592 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1400,7 +1374,7 @@ if i32.const 0 i32.const 592 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1731,7 +1705,7 @@ if i32.const 320 i32.const 592 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1815,7 +1789,7 @@ if i32.const 0 i32.const 592 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1880,7 +1854,7 @@ if i32.const 0 i32.const 592 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2031,7 +2005,7 @@ if i32.const 0 i32.const 592 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2140,7 +2114,7 @@ if i32.const 0 i32.const 592 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2160,7 +2134,7 @@ if i32.const 0 i32.const 592 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-casemapping.optimized.wat b/tests/compiler/std/string-casemapping.optimized.wat index bfbf31cea8..093242efdc 100644 --- a/tests/compiler/std/string-casemapping.optimized.wat +++ b/tests/compiler/std/string-casemapping.optimized.wat @@ -719,7 +719,7 @@ if i32.const 0 i32.const 1424 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -728,18 +728,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -753,12 +747,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -782,7 +783,7 @@ if i32.const 0 i32.const 1424 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -867,8 +868,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -881,7 +880,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -901,15 +900,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -917,34 +918,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -952,76 +939,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1424 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1424 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1031,12 +996,12 @@ if i32.const 0 i32.const 1424 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1044,34 +1009,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1079,14 +1048,14 @@ if i32.const 0 i32.const 1424 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1109,7 +1078,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1122,12 +1091,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1149,7 +1118,7 @@ if i32.const 0 i32.const 1424 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1177,7 +1146,7 @@ if i32.const 0 i32.const 1424 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1205,7 +1174,7 @@ if i32.const 0 i32.const 1424 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1553,7 +1522,7 @@ if i32.const 0 i32.const 1424 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1641,7 +1610,7 @@ if i32.const 0 i32.const 1424 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1693,7 +1662,7 @@ if i32.const 0 i32.const 1424 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1724,7 +1693,7 @@ if i32.const 1088 i32.const 1424 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1815,7 +1784,7 @@ if i32.const 0 i32.const 1424 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1830,7 +1799,7 @@ if i32.const 0 i32.const 1424 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1849,7 +1818,7 @@ if i32.const 0 i32.const 1424 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-casemapping.untouched.wat b/tests/compiler/std/string-casemapping.untouched.wat index acbcd862f6..a6b1e75463 100644 --- a/tests/compiler/std/string-casemapping.untouched.wat +++ b/tests/compiler/std/string-casemapping.untouched.wat @@ -586,7 +586,7 @@ if i32.const 0 i32.const 400 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -602,18 +602,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -629,12 +622,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -667,41 +669,41 @@ if i32.const 0 i32.const 400 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -714,55 +716,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -841,86 +843,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 400 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -929,25 +918,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -959,24 +931,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 400 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -986,7 +951,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -994,7 +959,7 @@ if i32.const 0 i32.const 400 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1004,24 +969,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1029,21 +1003,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1053,18 +1027,18 @@ if i32.const 0 i32.const 400 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1089,14 +1063,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1110,17 +1084,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1129,16 +1103,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1158,7 +1132,7 @@ if i32.const 0 i32.const 400 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1201,7 +1175,7 @@ if i32.const 0 i32.const 400 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1234,7 +1208,7 @@ if i32.const 0 i32.const 400 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1477,7 +1451,7 @@ if i32.const 0 i32.const 400 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1808,7 +1782,7 @@ if i32.const 64 i32.const 400 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1892,7 +1866,7 @@ if i32.const 0 i32.const 400 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1957,7 +1931,7 @@ if i32.const 0 i32.const 400 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2108,7 +2082,7 @@ if i32.const 0 i32.const 400 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2217,7 +2191,7 @@ if i32.const 0 i32.const 400 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2237,7 +2211,7 @@ if i32.const 0 i32.const 400 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-encoding.optimized.wat b/tests/compiler/std/string-encoding.optimized.wat index 410c4ad402..443bb457ba 100644 --- a/tests/compiler/std/string-encoding.optimized.wat +++ b/tests/compiler/std/string-encoding.optimized.wat @@ -300,7 +300,7 @@ if i32.const 0 i32.const 1488 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -309,18 +309,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1488 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -334,12 +328,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -363,7 +364,7 @@ if i32.const 0 i32.const 1488 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -448,8 +449,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -462,7 +461,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -482,15 +481,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -498,34 +499,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -533,76 +520,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1488 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1488 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -612,12 +577,12 @@ if i32.const 0 i32.const 1488 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -625,34 +590,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -660,14 +629,14 @@ if i32.const 0 i32.const 1488 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -690,7 +659,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -703,12 +672,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -730,7 +699,7 @@ if i32.const 0 i32.const 1488 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -758,7 +727,7 @@ if i32.const 0 i32.const 1488 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -786,7 +755,7 @@ if i32.const 0 i32.const 1488 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1134,7 +1103,7 @@ if i32.const 0 i32.const 1488 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1222,7 +1191,7 @@ if i32.const 0 i32.const 1488 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1274,7 +1243,7 @@ if i32.const 0 i32.const 1488 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1305,7 +1274,7 @@ if i32.const 1152 i32.const 1488 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1396,7 +1365,7 @@ if i32.const 0 i32.const 1488 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1411,7 +1380,7 @@ if i32.const 0 i32.const 1488 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1430,7 +1399,7 @@ if i32.const 0 i32.const 1488 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-encoding.untouched.wat b/tests/compiler/std/string-encoding.untouched.wat index e72b3b5d89..416b9939f1 100644 --- a/tests/compiler/std/string-encoding.untouched.wat +++ b/tests/compiler/std/string-encoding.untouched.wat @@ -419,7 +419,7 @@ if i32.const 0 i32.const 464 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -435,18 +435,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 464 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -462,12 +455,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -500,41 +502,41 @@ if i32.const 0 i32.const 464 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -547,55 +549,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -674,86 +676,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 464 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -762,25 +751,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -792,24 +764,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 464 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -819,7 +784,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -827,7 +792,7 @@ if i32.const 0 i32.const 464 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -837,24 +802,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -862,21 +836,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -886,18 +860,18 @@ if i32.const 0 i32.const 464 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -922,14 +896,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -943,17 +917,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -962,16 +936,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -991,7 +965,7 @@ if i32.const 0 i32.const 464 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1034,7 +1008,7 @@ if i32.const 0 i32.const 464 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1067,7 +1041,7 @@ if i32.const 0 i32.const 464 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1310,7 +1284,7 @@ if i32.const 0 i32.const 464 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1641,7 +1615,7 @@ if i32.const 128 i32.const 464 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1725,7 +1699,7 @@ if i32.const 0 i32.const 464 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1790,7 +1764,7 @@ if i32.const 0 i32.const 464 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1941,7 +1915,7 @@ if i32.const 0 i32.const 464 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2050,7 +2024,7 @@ if i32.const 0 i32.const 464 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2070,7 +2044,7 @@ if i32.const 0 i32.const 464 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 3ac63f9a92..4337cdb1a0 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -1313,7 +1313,7 @@ if i32.const 0 i32.const 1648 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -1322,18 +1322,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1648 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -1347,12 +1341,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -1376,7 +1377,7 @@ if i32.const 0 i32.const 1648 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -1461,8 +1462,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -1475,7 +1474,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -1495,15 +1494,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -1511,34 +1512,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -1546,76 +1533,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1648 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1648 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1625,12 +1590,12 @@ if i32.const 0 i32.const 1648 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1638,34 +1603,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1673,14 +1642,14 @@ if i32.const 0 i32.const 1648 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1703,7 +1672,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1716,12 +1685,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1743,7 +1712,7 @@ if i32.const 0 i32.const 1648 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1771,7 +1740,7 @@ if i32.const 0 i32.const 1648 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1799,7 +1768,7 @@ if i32.const 0 i32.const 1648 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -2147,7 +2116,7 @@ if i32.const 0 i32.const 1648 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -2235,7 +2204,7 @@ if i32.const 0 i32.const 1648 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2287,7 +2256,7 @@ if i32.const 0 i32.const 1648 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2318,7 +2287,7 @@ if i32.const 1376 i32.const 1648 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2409,7 +2378,7 @@ if i32.const 0 i32.const 1648 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2424,7 +2393,7 @@ if i32.const 0 i32.const 1648 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -2443,7 +2412,7 @@ if i32.const 0 i32.const 1648 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index a73886baf7..f03080123f 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -1122,7 +1122,7 @@ if i32.const 0 i32.const 624 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -1138,18 +1138,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 624 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -1165,12 +1158,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -1203,41 +1205,41 @@ if i32.const 0 i32.const 624 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -1250,55 +1252,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1377,86 +1379,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 624 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1465,25 +1454,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1495,24 +1467,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 624 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1522,7 +1487,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1530,7 +1495,7 @@ if i32.const 0 i32.const 624 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1540,24 +1505,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1565,21 +1539,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1589,18 +1563,18 @@ if i32.const 0 i32.const 624 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1625,14 +1599,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1646,17 +1620,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1665,16 +1639,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1694,7 +1668,7 @@ if i32.const 0 i32.const 624 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1737,7 +1711,7 @@ if i32.const 0 i32.const 624 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1770,7 +1744,7 @@ if i32.const 0 i32.const 624 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -2013,7 +1987,7 @@ if i32.const 0 i32.const 624 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -2344,7 +2318,7 @@ if i32.const 352 i32.const 624 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2428,7 +2402,7 @@ if i32.const 0 i32.const 624 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2493,7 +2467,7 @@ if i32.const 0 i32.const 624 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2644,7 +2618,7 @@ if i32.const 0 i32.const 624 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2753,7 +2727,7 @@ if i32.const 0 i32.const 624 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2773,7 +2747,7 @@ if i32.const 0 i32.const 624 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index d8e02f48eb..6c8b9aa8d1 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -390,7 +390,7 @@ if i32.const 0 i32.const 1472 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -399,18 +399,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1472 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -424,12 +418,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -453,7 +454,7 @@ if i32.const 0 i32.const 1472 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -538,8 +539,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -552,7 +551,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -572,15 +571,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -588,34 +589,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -623,76 +610,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1472 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1472 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -702,12 +667,12 @@ if i32.const 0 i32.const 1472 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -715,34 +680,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -750,14 +719,14 @@ if i32.const 0 i32.const 1472 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -780,7 +749,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -793,12 +762,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -820,7 +789,7 @@ if i32.const 0 i32.const 1472 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -848,7 +817,7 @@ if i32.const 0 i32.const 1472 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -876,7 +845,7 @@ if i32.const 0 i32.const 1472 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1224,7 +1193,7 @@ if i32.const 0 i32.const 1472 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1312,7 +1281,7 @@ if i32.const 0 i32.const 1472 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1364,7 +1333,7 @@ if i32.const 0 i32.const 1472 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1395,7 +1364,7 @@ if i32.const 1136 i32.const 1472 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1486,7 +1455,7 @@ if i32.const 0 i32.const 1472 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1501,7 +1470,7 @@ if i32.const 0 i32.const 1472 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1520,7 +1489,7 @@ if i32.const 0 i32.const 1472 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 826640a867..78ee1c0fce 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -456,7 +456,7 @@ if i32.const 0 i32.const 448 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -472,18 +472,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 448 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -499,12 +492,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -537,41 +539,41 @@ if i32.const 0 i32.const 448 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -584,55 +586,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -711,86 +713,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 448 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -799,25 +788,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -829,24 +801,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 448 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -856,7 +821,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -864,7 +829,7 @@ if i32.const 0 i32.const 448 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -874,24 +839,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -899,21 +873,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -923,18 +897,18 @@ if i32.const 0 i32.const 448 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -959,14 +933,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -980,17 +954,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -999,16 +973,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1028,7 +1002,7 @@ if i32.const 0 i32.const 448 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1071,7 +1045,7 @@ if i32.const 0 i32.const 448 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1104,7 +1078,7 @@ if i32.const 0 i32.const 448 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1347,7 +1321,7 @@ if i32.const 0 i32.const 448 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1678,7 +1652,7 @@ if i32.const 112 i32.const 448 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1762,7 +1736,7 @@ if i32.const 0 i32.const 448 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1827,7 +1801,7 @@ if i32.const 0 i32.const 448 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1978,7 +1952,7 @@ if i32.const 0 i32.const 448 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2087,7 +2061,7 @@ if i32.const 0 i32.const 448 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2107,7 +2081,7 @@ if i32.const 0 i32.const 448 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 2fa5396bb8..d582f9817b 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -891,7 +891,7 @@ if i32.const 0 i32.const 1504 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -900,18 +900,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -925,12 +919,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -954,7 +955,7 @@ if i32.const 0 i32.const 1504 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -1039,8 +1040,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -1053,7 +1052,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -1073,15 +1072,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -1089,34 +1090,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -1124,76 +1111,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1504 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1504 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -1203,12 +1168,12 @@ if i32.const 0 i32.const 1504 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -1216,34 +1181,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -1251,14 +1220,14 @@ if i32.const 0 i32.const 1504 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1281,7 +1250,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -1294,12 +1263,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -1321,7 +1290,7 @@ if i32.const 0 i32.const 1504 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1349,7 +1318,7 @@ if i32.const 0 i32.const 1504 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1377,7 +1346,7 @@ if i32.const 0 i32.const 1504 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1542,7 +1511,7 @@ if i32.const 0 i32.const 1504 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1818,7 +1787,7 @@ if i32.const 0 i32.const 1504 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1870,7 +1839,7 @@ if i32.const 0 i32.const 1504 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1901,7 +1870,7 @@ if i32.const 1168 i32.const 1504 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1992,7 +1961,7 @@ if i32.const 0 i32.const 1504 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2007,7 +1976,7 @@ if i32.const 0 i32.const 1504 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -2026,7 +1995,7 @@ if i32.const 0 i32.const 1504 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 1e7673f0be..473249329b 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -743,7 +743,7 @@ if i32.const 0 i32.const 480 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -759,18 +759,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -786,12 +779,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -824,41 +826,41 @@ if i32.const 0 i32.const 480 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -871,55 +873,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -998,86 +1000,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 480 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1086,25 +1075,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1116,24 +1088,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 480 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1143,7 +1108,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1151,7 +1116,7 @@ if i32.const 0 i32.const 480 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1161,24 +1126,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1186,21 +1160,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1210,18 +1184,18 @@ if i32.const 0 i32.const 480 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1246,14 +1220,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1267,17 +1241,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1286,16 +1260,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1315,7 +1289,7 @@ if i32.const 0 i32.const 480 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1358,7 +1332,7 @@ if i32.const 0 i32.const 480 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1391,7 +1365,7 @@ if i32.const 0 i32.const 480 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1634,7 +1608,7 @@ if i32.const 0 i32.const 480 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1965,7 +1939,7 @@ if i32.const 144 i32.const 480 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2049,7 +2023,7 @@ if i32.const 0 i32.const 480 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2114,7 +2088,7 @@ if i32.const 0 i32.const 480 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2265,7 +2239,7 @@ if i32.const 0 i32.const 480 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2374,7 +2348,7 @@ if i32.const 0 i32.const 480 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2394,7 +2368,7 @@ if i32.const 0 i32.const 480 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/super-inline.optimized.wat b/tests/compiler/super-inline.optimized.wat index 69d4c391ba..7cda0d1cc4 100644 --- a/tests/compiler/super-inline.optimized.wat +++ b/tests/compiler/super-inline.optimized.wat @@ -285,7 +285,7 @@ if i32.const 0 i32.const 1392 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -294,18 +294,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -319,12 +313,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -348,7 +349,7 @@ if i32.const 0 i32.const 1392 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -433,8 +434,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -447,7 +446,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -467,15 +466,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -483,34 +484,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -518,76 +505,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1392 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1392 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -597,12 +562,12 @@ if i32.const 0 i32.const 1392 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -610,34 +575,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -645,14 +614,14 @@ if i32.const 0 i32.const 1392 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -675,7 +644,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -688,12 +657,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -715,7 +684,7 @@ if i32.const 0 i32.const 1392 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -743,7 +712,7 @@ if i32.const 0 i32.const 1392 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -771,7 +740,7 @@ if i32.const 0 i32.const 1392 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1119,7 +1088,7 @@ if i32.const 0 i32.const 1392 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1187,7 +1156,7 @@ if i32.const 0 i32.const 1392 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1268,7 +1237,7 @@ if i32.const 0 i32.const 1392 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1283,7 +1252,7 @@ if i32.const 0 i32.const 1392 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/super-inline.untouched.wat b/tests/compiler/super-inline.untouched.wat index fd1f3407c7..e52852f9e8 100644 --- a/tests/compiler/super-inline.untouched.wat +++ b/tests/compiler/super-inline.untouched.wat @@ -399,7 +399,7 @@ if i32.const 0 i32.const 368 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -415,18 +415,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -442,12 +435,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -480,41 +482,41 @@ if i32.const 0 i32.const 368 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -527,55 +529,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -654,86 +656,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 368 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -742,25 +731,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -772,24 +744,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 368 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -799,7 +764,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -807,7 +772,7 @@ if i32.const 0 i32.const 368 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -817,24 +782,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -842,21 +816,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -866,18 +840,18 @@ if i32.const 0 i32.const 368 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -902,14 +876,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -923,17 +897,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -942,16 +916,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -971,7 +945,7 @@ if i32.const 0 i32.const 368 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1014,7 +988,7 @@ if i32.const 0 i32.const 368 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1047,7 +1021,7 @@ if i32.const 0 i32.const 368 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1290,7 +1264,7 @@ if i32.const 0 i32.const 368 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1621,7 +1595,7 @@ if i32.const 32 i32.const 368 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1705,7 +1679,7 @@ if i32.const 0 i32.const 368 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1770,7 +1744,7 @@ if i32.const 0 i32.const 368 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1921,7 +1895,7 @@ if i32.const 0 i32.const 368 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2030,7 +2004,7 @@ if i32.const 0 i32.const 368 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2050,7 +2024,7 @@ if i32.const 0 i32.const 368 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/templateliteral.optimized.wat b/tests/compiler/templateliteral.optimized.wat index cb6d15913a..28c23cc739 100644 --- a/tests/compiler/templateliteral.optimized.wat +++ b/tests/compiler/templateliteral.optimized.wat @@ -429,7 +429,7 @@ if i32.const 0 i32.const 1520 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -438,18 +438,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1520 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -463,12 +457,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -492,7 +493,7 @@ if i32.const 0 i32.const 1520 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -577,8 +578,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -591,7 +590,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -611,15 +610,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -627,34 +628,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -662,76 +649,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1520 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1520 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -741,12 +706,12 @@ if i32.const 0 i32.const 1520 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -754,34 +719,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -789,14 +758,14 @@ if i32.const 0 i32.const 1520 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -819,7 +788,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -832,12 +801,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -859,7 +828,7 @@ if i32.const 0 i32.const 1520 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -887,7 +856,7 @@ if i32.const 0 i32.const 1520 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -915,7 +884,7 @@ if i32.const 0 i32.const 1520 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1263,7 +1232,7 @@ if i32.const 0 i32.const 1520 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1351,7 +1320,7 @@ if i32.const 0 i32.const 1520 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1403,7 +1372,7 @@ if i32.const 0 i32.const 1520 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1434,7 +1403,7 @@ if i32.const 1392 i32.const 1520 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1525,7 +1494,7 @@ if i32.const 0 i32.const 1520 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1540,7 +1509,7 @@ if i32.const 0 i32.const 1520 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable @@ -1559,7 +1528,7 @@ if i32.const 0 i32.const 1520 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/templateliteral.untouched.wat b/tests/compiler/templateliteral.untouched.wat index 34c67aca1e..f2eb191d5b 100644 --- a/tests/compiler/templateliteral.untouched.wat +++ b/tests/compiler/templateliteral.untouched.wat @@ -556,7 +556,7 @@ if i32.const 0 i32.const 496 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -572,18 +572,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 496 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -599,12 +592,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -637,41 +639,41 @@ if i32.const 0 i32.const 496 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -684,55 +686,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -811,86 +813,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 496 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -899,25 +888,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -929,24 +901,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 496 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -956,7 +921,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -964,7 +929,7 @@ if i32.const 0 i32.const 496 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -974,24 +939,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -999,21 +973,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1023,18 +997,18 @@ if i32.const 0 i32.const 496 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1059,14 +1033,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1080,17 +1054,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1099,16 +1073,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1128,7 +1102,7 @@ if i32.const 0 i32.const 496 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1171,7 +1145,7 @@ if i32.const 0 i32.const 496 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1204,7 +1178,7 @@ if i32.const 0 i32.const 496 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1447,7 +1421,7 @@ if i32.const 0 i32.const 496 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1778,7 +1752,7 @@ if i32.const 368 i32.const 496 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1862,7 +1836,7 @@ if i32.const 0 i32.const 496 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1927,7 +1901,7 @@ if i32.const 0 i32.const 496 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2078,7 +2052,7 @@ if i32.const 0 i32.const 496 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2187,7 +2161,7 @@ if i32.const 0 i32.const 496 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2207,7 +2181,7 @@ if i32.const 0 i32.const 496 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/throw.optimized.wat b/tests/compiler/throw.optimized.wat index c330466311..a4267c8755 100644 --- a/tests/compiler/throw.optimized.wat +++ b/tests/compiler/throw.optimized.wat @@ -280,7 +280,7 @@ if i32.const 0 i32.const 1632 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -289,18 +289,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1632 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -314,12 +308,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -343,7 +344,7 @@ if i32.const 0 i32.const 1632 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -428,8 +429,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -442,7 +441,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -462,15 +461,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -478,34 +479,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -513,76 +500,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1632 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1632 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -592,12 +557,12 @@ if i32.const 0 i32.const 1632 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -605,34 +570,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -640,14 +609,14 @@ if i32.const 0 i32.const 1632 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -670,7 +639,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -683,12 +652,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -710,7 +679,7 @@ if i32.const 0 i32.const 1632 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -730,7 +699,7 @@ if i32.const 0 i32.const 1632 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -901,7 +870,7 @@ if i32.const 0 i32.const 1632 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/throw.untouched.wat b/tests/compiler/throw.untouched.wat index 715c1c03ad..b9ddee99f3 100644 --- a/tests/compiler/throw.untouched.wat +++ b/tests/compiler/throw.untouched.wat @@ -514,7 +514,7 @@ if i32.const 0 i32.const 608 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -530,18 +530,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 608 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -557,12 +550,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -595,41 +597,41 @@ if i32.const 0 i32.const 608 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -642,55 +644,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -769,86 +771,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 608 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -857,25 +846,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -887,24 +859,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 608 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -914,7 +879,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -922,7 +887,7 @@ if i32.const 0 i32.const 608 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -932,24 +897,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -957,21 +931,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -981,18 +955,18 @@ if i32.const 0 i32.const 608 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1017,14 +991,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1038,17 +1012,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1057,16 +1031,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1086,7 +1060,7 @@ if i32.const 0 i32.const 608 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1129,7 +1103,7 @@ if i32.const 0 i32.const 608 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1162,7 +1136,7 @@ if i32.const 0 i32.const 608 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1405,7 +1379,7 @@ if i32.const 0 i32.const 608 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/typeof.optimized.wat b/tests/compiler/typeof.optimized.wat index d202aabca6..19e3abd356 100644 --- a/tests/compiler/typeof.optimized.wat +++ b/tests/compiler/typeof.optimized.wat @@ -416,7 +416,7 @@ if i32.const 0 i32.const 1696 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -425,18 +425,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1696 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -450,12 +444,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -479,7 +480,7 @@ if i32.const 0 i32.const 1696 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -564,8 +565,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -578,7 +577,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -598,15 +597,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -614,34 +615,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -649,76 +636,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1696 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1696 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -728,12 +693,12 @@ if i32.const 0 i32.const 1696 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -741,34 +706,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -776,14 +745,14 @@ if i32.const 0 i32.const 1696 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -806,7 +775,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -819,12 +788,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -846,7 +815,7 @@ if i32.const 0 i32.const 1696 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -874,7 +843,7 @@ if i32.const 0 i32.const 1696 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -902,7 +871,7 @@ if i32.const 0 i32.const 1696 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1250,7 +1219,7 @@ if i32.const 0 i32.const 1696 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1318,7 +1287,7 @@ if i32.const 0 i32.const 1696 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1399,7 +1368,7 @@ if i32.const 0 i32.const 1696 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1414,7 +1383,7 @@ if i32.const 0 i32.const 1696 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/typeof.untouched.wat b/tests/compiler/typeof.untouched.wat index 283c18eb34..2de06c596a 100644 --- a/tests/compiler/typeof.untouched.wat +++ b/tests/compiler/typeof.untouched.wat @@ -578,7 +578,7 @@ if i32.const 0 i32.const 672 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -594,18 +594,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 672 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -621,12 +614,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -659,41 +661,41 @@ if i32.const 0 i32.const 672 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -706,55 +708,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -833,86 +835,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 672 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -921,25 +910,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -951,24 +923,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 672 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -978,7 +943,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -986,7 +951,7 @@ if i32.const 0 i32.const 672 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -996,24 +961,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1021,21 +995,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1045,18 +1019,18 @@ if i32.const 0 i32.const 672 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1081,14 +1055,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1102,17 +1076,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1121,16 +1095,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1150,7 +1124,7 @@ if i32.const 0 i32.const 672 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1193,7 +1167,7 @@ if i32.const 0 i32.const 672 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1226,7 +1200,7 @@ if i32.const 0 i32.const 672 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1469,7 +1443,7 @@ if i32.const 0 i32.const 672 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1800,7 +1774,7 @@ if i32.const 336 i32.const 672 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -1884,7 +1858,7 @@ if i32.const 0 i32.const 672 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -1949,7 +1923,7 @@ if i32.const 0 i32.const 672 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2100,7 +2074,7 @@ if i32.const 0 i32.const 672 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2209,7 +2183,7 @@ if i32.const 0 i32.const 672 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2229,7 +2203,7 @@ if i32.const 0 i32.const 672 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/wasi/trace.optimized.wat b/tests/compiler/wasi/trace.optimized.wat index 54ca8ba739..ec02beb3db 100644 --- a/tests/compiler/wasi/trace.optimized.wat +++ b/tests/compiler/wasi/trace.optimized.wat @@ -387,7 +387,7 @@ if i32.const 0 i32.const 1104 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -396,18 +396,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1104 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -421,12 +415,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -450,7 +451,7 @@ if i32.const 0 i32.const 1104 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -535,8 +536,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -549,7 +548,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -569,15 +568,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -585,34 +586,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -620,76 +607,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1104 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1104 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -699,12 +664,12 @@ if i32.const 0 i32.const 1104 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -712,34 +677,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -747,14 +716,14 @@ if i32.const 0 i32.const 1104 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -777,7 +746,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -790,12 +759,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -817,7 +786,7 @@ if i32.const 0 i32.const 1104 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -845,7 +814,7 @@ if i32.const 0 i32.const 1104 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -873,7 +842,7 @@ if i32.const 0 i32.const 1104 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -1055,7 +1024,7 @@ if i32.const 0 i32.const 1104 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1107,7 +1076,7 @@ if i32.const 0 i32.const 1104 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -1138,7 +1107,7 @@ if i32.const 1168 i32.const 1104 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -1229,7 +1198,7 @@ if i32.const 0 i32.const 1104 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1244,7 +1213,7 @@ if i32.const 0 i32.const 1104 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1263,7 +1232,7 @@ if i32.const 0 i32.const 1104 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -2795,7 +2764,7 @@ if i32.const 0 i32.const 1104 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/wasi/trace.untouched.wat b/tests/compiler/wasi/trace.untouched.wat index 1163603473..e43979d4a6 100644 --- a/tests/compiler/wasi/trace.untouched.wat +++ b/tests/compiler/wasi/trace.untouched.wat @@ -629,7 +629,7 @@ if i32.const 0 i32.const 80 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -645,18 +645,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 80 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -672,12 +665,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -710,41 +712,41 @@ if i32.const 0 i32.const 80 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -757,55 +759,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -884,86 +886,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 80 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/wasi/index/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -972,25 +961,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1002,24 +974,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 80 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1029,7 +994,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1037,7 +1002,7 @@ if i32.const 0 i32.const 80 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1047,24 +1012,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1072,21 +1046,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1096,18 +1070,18 @@ if i32.const 0 i32.const 80 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/wasi/index/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1132,14 +1106,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1153,17 +1127,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1172,16 +1146,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1201,7 +1175,7 @@ if i32.const 0 i32.const 80 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1244,7 +1218,7 @@ if i32.const 0 i32.const 80 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1277,7 +1251,7 @@ if i32.const 0 i32.const 80 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -1517,7 +1491,7 @@ if i32.const 144 i32.const 80 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/wasi/index/abort unreachable @@ -1601,7 +1575,7 @@ if i32.const 0 i32.const 80 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1666,7 +1640,7 @@ if i32.const 0 i32.const 80 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/wasi/index/abort unreachable @@ -1817,7 +1791,7 @@ if i32.const 0 i32.const 80 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -1926,7 +1900,7 @@ if i32.const 0 i32.const 80 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/wasi/index/abort unreachable @@ -1946,7 +1920,7 @@ if i32.const 0 i32.const 80 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/wasi/index/abort unreachable @@ -4720,7 +4694,7 @@ if i32.const 0 i32.const 80 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/while.optimized.wat b/tests/compiler/while.optimized.wat index fe2f06312b..becc247f9e 100644 --- a/tests/compiler/while.optimized.wat +++ b/tests/compiler/while.optimized.wat @@ -362,7 +362,7 @@ if i32.const 0 i32.const 1440 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -371,18 +371,12 @@ i32.const -4 i32.and local.tee $2 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $2 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -396,12 +390,19 @@ i32.shr_u local.set $2 else - local.get $2 i32.const 31 local.get $2 + i32.const 1073741820 + local.get $2 + i32.const 1073741820 + i32.lt_u + select + local.tee $2 i32.clz i32.sub - local.tee $3 + local.set $3 + local.get $2 + local.get $3 i32.const 4 i32.sub i32.shr_u @@ -425,7 +426,7 @@ if i32.const 0 i32.const 1440 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable @@ -510,8 +511,6 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - (local $8 i32) local.get $1 i32.eqz if @@ -524,7 +523,7 @@ end local.get $1 i32.load - local.tee $4 + local.tee $3 i32.const 1 i32.and i32.eqz @@ -544,15 +543,17 @@ i32.const -4 i32.and i32.add - local.tee $5 + local.tee $4 i32.load local.tee $2 i32.const 1 i32.and if + local.get $0 local.get $4 - i32.const -4 - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 i32.const 4 i32.add local.get $2 @@ -560,34 +561,20 @@ i32.and i32.add local.tee $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 4 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end + i32.store + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 end - local.get $4 + local.get $3 i32.const 2 i32.and if @@ -595,76 +582,54 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $1 i32.load - local.tee $7 + local.tee $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 1440 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end - local.get $7 - i32.const -4 - i32.and + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 i32.const 4 i32.add - local.get $4 + local.get $3 i32.const -4 i32.and i32.add - local.tee $8 - i32.const 1073741820 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 + local.tee $3 + i32.store end - local.get $5 + local.get $4 local.get $2 i32.const 2 i32.or i32.store - local.get $4 + local.get $3 i32.const -4 i32.and local.tee $3 - i32.const 1073741820 - i32.lt_u - i32.const 0 - local.get $3 i32.const 12 - i32.ge_u - select - i32.eqz + i32.lt_u if i32.const 0 i32.const 1440 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $3 local.get $1 i32.const 4 @@ -674,12 +639,12 @@ if i32.const 0 i32.const 1440 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 4 i32.sub local.get $1 @@ -687,34 +652,38 @@ local.get $3 i32.const 256 i32.lt_u - if + if (result i32) local.get $3 i32.const 4 i32.shr_u - local.set $3 else - local.get $3 i32.const 31 local.get $3 + i32.const 1073741820 + local.get $3 + i32.const 1073741820 + i32.lt_u + select + local.tee $3 i32.clz i32.sub local.tee $4 + i32.const 7 + i32.sub + local.set $5 + local.get $3 + local.get $4 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 end - local.get $3 + local.tee $3 i32.const 16 i32.lt_u i32.const 0 - local.get $6 + local.get $5 i32.const 23 i32.lt_u select @@ -722,14 +691,14 @@ if i32.const 0 i32.const 1440 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -752,7 +721,7 @@ end local.get $0 local.get $3 - local.get $6 + local.get $5 i32.const 4 i32.shl i32.add @@ -765,12 +734,12 @@ local.get $0 i32.load i32.const 1 - local.get $6 + local.get $5 i32.shl i32.or i32.store local.get $0 - local.get $6 + local.get $5 i32.const 2 i32.shl i32.add @@ -792,7 +761,7 @@ if i32.const 0 i32.const 1440 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -820,7 +789,7 @@ if i32.const 0 i32.const 1440 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -848,7 +817,7 @@ if i32.const 0 i32.const 1440 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1196,7 +1165,7 @@ if i32.const 0 i32.const 1440 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -1264,7 +1233,7 @@ if i32.const 0 i32.const 1440 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -1345,7 +1314,7 @@ if i32.const 0 i32.const 1440 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -1360,7 +1329,7 @@ if i32.const 0 i32.const 1440 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/while.untouched.wat b/tests/compiler/while.untouched.wat index 7cb806f183..f609d4b6ba 100644 --- a/tests/compiler/while.untouched.wat +++ b/tests/compiler/while.untouched.wat @@ -853,7 +853,7 @@ if i32.const 0 i32.const 416 - i32.const 273 + i32.const 268 i32.const 14 call $~lib/builtins/abort unreachable @@ -869,18 +869,11 @@ local.get $3 i32.const 12 i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 275 + i32.const 270 i32.const 14 call $~lib/builtins/abort unreachable @@ -896,12 +889,21 @@ i32.shr_u local.set $5 else - i32.const 31 local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $6 + i32.const 31 + local.get $6 i32.clz i32.sub local.set $4 - local.get $3 + local.get $6 local.get $4 i32.const 4 i32.sub @@ -934,41 +936,41 @@ if i32.const 0 i32.const 416 - i32.const 288 + i32.const 284 i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 i32.load offset=4 - local.set $6 + local.set $8 local.get $1 i32.load offset=8 - local.set $7 - local.get $6 + local.set $9 + local.get $8 if - local.get $6 - local.get $7 + local.get $8 + local.get $9 call $~lib/rt/tlsf/Block#set:next end - local.get $7 + local.get $9 if - local.get $7 - local.get $6 + local.get $9 + local.get $8 call $~lib/rt/tlsf/Block#set:prev end local.get $1 local.get $0 local.set $10 local.get $4 - local.set $9 + local.set $6 local.get $5 - local.set $8 + local.set $7 local.get $10 - local.get $9 + local.get $6 i32.const 4 i32.shl - local.get $8 + local.get $7 i32.add i32.const 2 i32.shl @@ -981,55 +983,55 @@ local.get $4 local.set $10 local.get $5 - local.set $9 - local.get $7 - local.set $8 + local.set $6 + local.get $9 + local.set $7 local.get $11 local.get $10 i32.const 4 i32.shl - local.get $9 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $8 - i32.store offset=96 local.get $7 + i32.store offset=96 + local.get $9 i32.eqz if local.get $0 - local.set $9 + local.set $6 local.get $4 - local.set $8 - local.get $9 - local.get $8 + local.set $7 + local.get $6 + local.get $7 i32.const 2 i32.shl i32.add i32.load offset=4 - local.set $9 + local.set $6 local.get $0 - local.set $8 + local.set $7 local.get $4 local.set $11 - local.get $9 + local.get $6 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $9 + local.tee $6 local.set $10 - local.get $8 + local.get $7 local.get $11 i32.const 2 i32.shl i32.add local.get $10 i32.store offset=4 - local.get $9 + local.get $6 i32.eqz if local.get $0 @@ -1108,86 +1110,73 @@ i32.const 1 i32.and if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + local.set $3 + local.get $3 i32.const 4 i32.add - local.get $5 + local.get $3 + i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $3 - local.get $3 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end + local.set $4 + local.get $4 + i32.load + local.set $5 end local.get $2 i32.const 2 i32.and if local.get $1 - local.set $6 - local.get $6 + local.set $3 + local.get $3 i32.const 4 i32.sub i32.load - local.set $6 - local.get $6 - i32.load local.set $3 + local.get $3 + i32.load + local.set $6 i32.const 1 drop - local.get $3 + local.get $6 i32.const 1 i32.and i32.eqz if i32.const 0 i32.const 416 - i32.const 224 + i32.const 221 i32.const 16 call $~lib/builtins/abort unreachable end + local.get $0 local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.set $1 + local.get $1 + local.get $6 i32.const 4 i32.add local.get $2 @@ -1196,25 +1185,8 @@ i32.xor i32.and i32.add - local.set $7 - local.get $7 - i32.const 1073741820 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - call $~lib/rt/common/BLOCK#set:mmInfo - local.get $6 - local.set $1 - end + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo end local.get $4 local.get $5 @@ -1226,24 +1198,17 @@ i32.const -1 i32.xor i32.and - local.set $8 + local.set $7 i32.const 1 drop - local.get $8 + local.get $7 i32.const 12 i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741820 - i32.lt_u - else - i32.const 0 - end i32.eqz if i32.const 0 i32.const 416 - i32.const 239 + i32.const 233 i32.const 14 call $~lib/builtins/abort unreachable @@ -1253,7 +1218,7 @@ local.get $1 i32.const 4 i32.add - local.get $8 + local.get $7 i32.add local.get $4 i32.eq @@ -1261,7 +1226,7 @@ if i32.const 0 i32.const 416 - i32.const 240 + i32.const 234 i32.const 14 call $~lib/builtins/abort unreachable @@ -1271,24 +1236,33 @@ i32.sub local.get $1 i32.store - local.get $8 + local.get $7 i32.const 256 i32.lt_u if i32.const 0 - local.set $9 - local.get $8 + local.set $8 + local.get $7 i32.const 4 i32.shr_u - local.set $10 + local.set $9 else + local.get $7 + local.tee $3 + i32.const 1073741820 + local.tee $6 + local.get $3 + local.get $6 + i32.lt_u + select + local.set $3 i32.const 31 - local.get $8 + local.get $3 i32.clz i32.sub - local.set $9 + local.set $8 + local.get $3 local.get $8 - local.get $9 i32.const 4 i32.sub i32.shr_u @@ -1296,21 +1270,21 @@ i32.const 4 i32.shl i32.xor - local.set $10 - local.get $9 + local.set $9 + local.get $8 i32.const 8 i32.const 1 i32.sub i32.sub - local.set $9 + local.set $8 end i32.const 1 drop - local.get $9 + local.get $8 i32.const 23 i32.lt_u if (result i32) - local.get $10 + local.get $9 i32.const 16 i32.lt_u else @@ -1320,18 +1294,18 @@ if i32.const 0 i32.const 416 - i32.const 256 + i32.const 251 i32.const 14 call $~lib/builtins/abort unreachable end local.get $0 - local.set $7 - local.get $9 + local.set $10 + local.get $8 local.set $3 - local.get $10 + local.get $9 local.set $6 - local.get $7 + local.get $10 local.get $3 i32.const 4 i32.shl @@ -1356,14 +1330,14 @@ end local.get $0 local.set $12 + local.get $8 + local.set $10 local.get $9 - local.set $7 - local.get $10 local.set $3 local.get $1 local.set $6 local.get $12 - local.get $7 + local.get $10 i32.const 4 i32.shl local.get $3 @@ -1377,17 +1351,17 @@ local.get $0 i32.load i32.const 1 - local.get $9 + local.get $8 i32.shl i32.or call $~lib/rt/tlsf/Root#set:flMap local.get $0 local.set $13 - local.get $9 + local.get $8 local.set $12 local.get $0 local.set $3 - local.get $9 + local.get $8 local.set $6 local.get $3 local.get $6 @@ -1396,16 +1370,16 @@ i32.add i32.load offset=4 i32.const 1 - local.get $10 + local.get $9 i32.shl i32.or - local.set $7 + local.set $10 local.get $13 local.get $12 i32.const 2 i32.shl i32.add - local.get $7 + local.get $10 i32.store offset=4 ) (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -1425,7 +1399,7 @@ if i32.const 0 i32.const 416 - i32.const 381 + i32.const 377 i32.const 14 call $~lib/builtins/abort unreachable @@ -1468,7 +1442,7 @@ if i32.const 0 i32.const 416 - i32.const 388 + i32.const 384 i32.const 16 call $~lib/builtins/abort unreachable @@ -1501,7 +1475,7 @@ if i32.const 0 i32.const 416 - i32.const 401 + i32.const 397 i32.const 5 call $~lib/builtins/abort unreachable @@ -1744,7 +1718,7 @@ if i32.const 0 i32.const 416 - i32.const 565 + i32.const 559 i32.const 3 call $~lib/builtins/abort unreachable @@ -2075,7 +2049,7 @@ if i32.const 80 i32.const 416 - i32.const 462 + i32.const 458 i32.const 30 call $~lib/builtins/abort unreachable @@ -2159,7 +2133,7 @@ if i32.const 0 i32.const 416 - i32.const 334 + i32.const 330 i32.const 14 call $~lib/builtins/abort unreachable @@ -2224,7 +2198,7 @@ if i32.const 0 i32.const 416 - i32.const 347 + i32.const 343 i32.const 18 call $~lib/builtins/abort unreachable @@ -2375,7 +2349,7 @@ if i32.const 0 i32.const 416 - i32.const 361 + i32.const 357 i32.const 14 call $~lib/builtins/abort unreachable @@ -2484,7 +2458,7 @@ if i32.const 0 i32.const 416 - i32.const 500 + i32.const 496 i32.const 16 call $~lib/builtins/abort unreachable @@ -2504,7 +2478,7 @@ if i32.const 0 i32.const 416 - i32.const 502 + i32.const 498 i32.const 14 call $~lib/builtins/abort unreachable