From 7b7bf0fd51270e835c9fd55bfe7767681262f41c Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 15 Feb 2023 17:24:22 +0800 Subject: [PATCH 1/6] fix: add BLOCK_OVERHEAD before round size --- std/assembly/rt/tlsf.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 1d25919168..ebb18a7111 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -427,16 +427,16 @@ function growMemory(root: Root, size: usize): void { unreachable(); return; } + // and additional BLOCK_OVERHEAD must be taken into account. If we are going + // to merge with the tail block, that's one time, otherwise it's two times. + let pagesBefore = memory.size(); + size += BLOCK_OVERHEAD << usize((pagesBefore << 16) - BLOCK_OVERHEAD != changetype(GETTAIL(root))); // Here, both rounding performed in searchBlock ... const halfMaxSize = BLOCK_MAXSIZE >> 1; if (size < halfMaxSize) { // don't round last fl const invRound = (sizeof() * 8 - 1) - SL_BITS; - size += (1 << (invRound - clz(size))) - 1; + size += (1 << (invRound - clz(size))) - 1; // size should be larger than 15 } - // and additional BLOCK_OVERHEAD must be taken into account. If we are going - // to merge with the tail block, that's one time, otherwise it's two times. - let pagesBefore = memory.size(); - size += BLOCK_OVERHEAD << usize((pagesBefore << 16) - BLOCK_OVERHEAD != changetype(GETTAIL(root))); let pagesNeeded = (((size + 0xffff) & ~0xffff) >>> 16); let pagesWanted = max(pagesBefore, pagesNeeded); // double memory if (memory.grow(pagesWanted) < 0) { From ed1ea91b7edeae8e88a9c38b548e3fba7a8335f5 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 15 Feb 2023 17:59:37 +0800 Subject: [PATCH 2/6] update test --- tests/compiler/bindings/esm.debug.wat | 32 ++-- tests/compiler/bindings/esm.release.wat | 59 +++--- .../bindings/noExportRuntime.debug.wat | 32 ++-- .../bindings/noExportRuntime.release.wat | 59 +++--- tests/compiler/bindings/raw.debug.wat | 32 ++-- tests/compiler/bindings/raw.release.wat | 59 +++--- tests/compiler/call-super.debug.wat | 32 ++-- tests/compiler/call-super.release.wat | 59 +++--- tests/compiler/class-implements.debug.wat | 32 ++-- tests/compiler/class-implements.release.wat | 59 +++--- .../compiler/class-overloading-cast.debug.wat | 32 ++-- .../class-overloading-cast.release.wat | 19 +- tests/compiler/class-overloading.debug.wat | 32 ++-- tests/compiler/class-overloading.release.wat | 19 +- tests/compiler/class.debug.wat | 32 ++-- tests/compiler/class.release.wat | 59 +++--- tests/compiler/constructor.debug.wat | 32 ++-- tests/compiler/constructor.release.wat | 59 +++--- tests/compiler/do.debug.wat | 32 ++-- tests/compiler/do.release.wat | 19 +- tests/compiler/duplicate-fields.debug.wat | 32 ++-- tests/compiler/duplicate-fields.release.wat | 59 +++--- tests/compiler/empty-exportruntime.debug.wat | 32 ++-- .../compiler/empty-exportruntime.release.wat | 59 +++--- tests/compiler/empty-new.debug.wat | 32 ++-- tests/compiler/empty-new.release.wat | 19 +- .../compiler/exportstar-rereexport.debug.wat | 32 ++-- .../exportstar-rereexport.release.wat | 19 +- .../compiler/extends-baseaggregate.debug.wat | 32 ++-- .../extends-baseaggregate.release.wat | 59 +++--- tests/compiler/extends-recursive.debug.wat | 32 ++-- tests/compiler/extends-recursive.release.wat | 59 +++--- tests/compiler/field-initialization.debug.wat | 32 ++-- .../compiler/field-initialization.release.wat | 59 +++--- tests/compiler/field.debug.wat | 32 ++-- tests/compiler/field.release.wat | 59 +++--- tests/compiler/for.debug.wat | 32 ++-- tests/compiler/for.release.wat | 19 +- tests/compiler/function-call.debug.wat | 32 ++-- tests/compiler/function-call.release.wat | 19 +- tests/compiler/function-expression.debug.wat | 32 ++-- .../compiler/function-expression.release.wat | 19 +- tests/compiler/getter-call.debug.wat | 32 ++-- tests/compiler/getter-call.release.wat | 19 +- tests/compiler/heap.debug.wat | 32 ++-- tests/compiler/heap.release.wat | 41 ++-- tests/compiler/infer-array.debug.wat | 32 ++-- tests/compiler/infer-array.release.wat | 59 +++--- tests/compiler/infer-generic.debug.wat | 32 ++-- tests/compiler/infer-generic.release.wat | 59 +++--- tests/compiler/inlining.debug.wat | 32 ++-- tests/compiler/inlining.release.wat | 59 +++--- tests/compiler/instanceof.debug.wat | 32 ++-- tests/compiler/instanceof.release.wat | 19 +- tests/compiler/issues/1095.debug.wat | 32 ++-- tests/compiler/issues/1095.release.wat | 59 +++--- tests/compiler/issues/1225.debug.wat | 32 ++-- tests/compiler/issues/1225.release.wat | 19 +- tests/compiler/issues/1699.debug.wat | 32 ++-- tests/compiler/issues/1699.release.wat | 59 +++--- tests/compiler/issues/2166.debug.wat | 32 ++-- tests/compiler/issues/2166.release.wat | 19 +- tests/compiler/issues/2322/index.debug.wat | 32 ++-- tests/compiler/issues/2322/index.release.wat | 59 +++--- tests/compiler/issues/2622.debug.wat | 32 ++-- tests/compiler/issues/2622.release.wat | 19 +- tests/compiler/logical.debug.wat | 32 ++-- tests/compiler/logical.release.wat | 19 +- tests/compiler/managed-cast.debug.wat | 32 ++-- tests/compiler/managed-cast.release.wat | 19 +- tests/compiler/new.debug.wat | 32 ++-- tests/compiler/new.release.wat | 19 +- tests/compiler/object-literal.debug.wat | 32 ++-- tests/compiler/object-literal.release.wat | 45 +++-- .../optional-typeparameters.debug.wat | 32 ++-- .../optional-typeparameters.release.wat | 19 +- tests/compiler/reexport.debug.wat | 32 ++-- tests/compiler/reexport.release.wat | 19 +- tests/compiler/rereexport.debug.wat | 32 ++-- tests/compiler/rereexport.release.wat | 19 +- tests/compiler/resolve-access.debug.wat | 32 ++-- tests/compiler/resolve-access.release.wat | 59 +++--- tests/compiler/resolve-binary.debug.wat | 32 ++-- tests/compiler/resolve-binary.release.wat | 59 +++--- .../compiler/resolve-elementaccess.debug.wat | 32 ++-- .../resolve-elementaccess.release.wat | 59 +++--- .../resolve-function-expression.debug.wat | 32 ++-- .../resolve-function-expression.release.wat | 179 +++++++++--------- tests/compiler/resolve-new.debug.wat | 32 ++-- tests/compiler/resolve-new.release.wat | 19 +- .../compiler/resolve-propertyaccess.debug.wat | 32 ++-- .../resolve-propertyaccess.release.wat | 59 +++--- tests/compiler/resolve-ternary.debug.wat | 32 ++-- tests/compiler/resolve-ternary.release.wat | 59 +++--- tests/compiler/resolve-unary.debug.wat | 32 ++-- tests/compiler/resolve-unary.release.wat | 59 +++--- tests/compiler/return-unreachable.debug.wat | 32 ++-- tests/compiler/return-unreachable.release.wat | 59 +++--- tests/compiler/rt/finalize.debug.wat | 32 ++-- tests/compiler/rt/finalize.release.wat | 19 +- .../rt/runtime-incremental-export.debug.wat | 32 ++-- .../rt/runtime-incremental-export.release.wat | 59 +++--- .../rt/runtime-minimal-export.debug.wat | 32 ++-- .../rt/runtime-minimal-export.release.wat | 59 +++--- tests/compiler/simd.debug.wat | 32 ++-- tests/compiler/simd.release.wat | 45 +++-- tests/compiler/std/array-literal.debug.wat | 32 ++-- tests/compiler/std/array-literal.release.wat | 59 +++--- tests/compiler/std/array.debug.wat | 32 ++-- tests/compiler/std/array.release.wat | 45 +++-- tests/compiler/std/arraybuffer.debug.wat | 32 ++-- tests/compiler/std/arraybuffer.release.wat | 59 +++--- tests/compiler/std/dataview.debug.wat | 32 ++-- tests/compiler/std/dataview.release.wat | 59 +++--- tests/compiler/std/date.debug.wat | 32 ++-- tests/compiler/std/date.release.wat | 59 +++--- tests/compiler/std/map.debug.wat | 32 ++-- tests/compiler/std/map.release.wat | 59 +++--- tests/compiler/std/new.debug.wat | 32 ++-- tests/compiler/std/new.release.wat | 19 +- .../std/operator-overloading.debug.wat | 32 ++-- .../std/operator-overloading.release.wat | 19 +- tests/compiler/std/set.debug.wat | 32 ++-- tests/compiler/std/set.release.wat | 59 +++--- tests/compiler/std/static-array.debug.wat | 32 ++-- tests/compiler/std/static-array.release.wat | 85 +++++---- tests/compiler/std/staticarray.debug.wat | 32 ++-- tests/compiler/std/staticarray.release.wat | 45 +++-- .../compiler/std/string-casemapping.debug.wat | 32 ++-- .../std/string-casemapping.release.wat | 59 +++--- tests/compiler/std/string-encoding.debug.wat | 32 ++-- .../compiler/std/string-encoding.release.wat | 59 +++--- tests/compiler/std/string.debug.wat | 32 ++-- tests/compiler/std/string.release.wat | 59 +++--- tests/compiler/std/symbol.debug.wat | 32 ++-- tests/compiler/std/symbol.release.wat | 59 +++--- tests/compiler/std/typedarray.debug.wat | 32 ++-- tests/compiler/std/typedarray.release.wat | 45 +++-- tests/compiler/std/uri.debug.wat | 32 ++-- tests/compiler/std/uri.release.wat | 59 +++--- tests/compiler/super-inline.debug.wat | 32 ++-- tests/compiler/super-inline.release.wat | 19 +- tests/compiler/templateliteral.debug.wat | 32 ++-- tests/compiler/templateliteral.release.wat | 59 +++--- tests/compiler/typeof.debug.wat | 32 ++-- tests/compiler/typeof.release.wat | 19 +- tests/compiler/while.debug.wat | 32 ++-- tests/compiler/while.release.wat | 19 +- 148 files changed, 3169 insertions(+), 2583 deletions(-) diff --git a/tests/compiler/bindings/esm.debug.wat b/tests/compiler/bindings/esm.debug.wat index d5d22b6aef..fc771caa73 100644 --- a/tests/compiler/bindings/esm.debug.wat +++ b/tests/compiler/bindings/esm.debug.wat @@ -2026,22 +2026,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2063,6 +2047,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/bindings/esm.release.wat b/tests/compiler/bindings/esm.release.wat index ad9d048a83..7ea107e5e0 100644 --- a/tests/compiler/bindings/esm.release.wat +++ b/tests/compiler/bindings/esm.release.wat @@ -1386,7 +1386,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1401,7 +1401,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1421,8 +1421,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1431,38 +1432,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1470,7 +1473,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1479,7 +1482,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1507,12 +1510,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1526,7 +1529,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1537,7 +1540,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1547,19 +1550,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/bindings/noExportRuntime.debug.wat b/tests/compiler/bindings/noExportRuntime.debug.wat index b08ffb88b4..12861353dc 100644 --- a/tests/compiler/bindings/noExportRuntime.debug.wat +++ b/tests/compiler/bindings/noExportRuntime.debug.wat @@ -1941,22 +1941,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1978,6 +1962,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/bindings/noExportRuntime.release.wat b/tests/compiler/bindings/noExportRuntime.release.wat index e3acf8a363..42395d225e 100644 --- a/tests/compiler/bindings/noExportRuntime.release.wat +++ b/tests/compiler/bindings/noExportRuntime.release.wat @@ -1319,7 +1319,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1334,7 +1334,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1354,8 +1354,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1364,38 +1365,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1403,7 +1406,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1412,7 +1415,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1440,12 +1443,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1459,7 +1462,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1470,7 +1473,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1480,19 +1483,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/bindings/raw.debug.wat b/tests/compiler/bindings/raw.debug.wat index d4393ad921..169584997b 100644 --- a/tests/compiler/bindings/raw.debug.wat +++ b/tests/compiler/bindings/raw.debug.wat @@ -2029,22 +2029,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2066,6 +2050,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/bindings/raw.release.wat b/tests/compiler/bindings/raw.release.wat index 38613cc3db..6a02844128 100644 --- a/tests/compiler/bindings/raw.release.wat +++ b/tests/compiler/bindings/raw.release.wat @@ -1386,7 +1386,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1401,7 +1401,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1421,8 +1421,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1431,38 +1432,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1470,7 +1473,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1479,7 +1482,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1507,12 +1510,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1526,7 +1529,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1537,7 +1540,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1547,19 +1550,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/call-super.debug.wat b/tests/compiler/call-super.debug.wat index ee0438c5cd..bb0fbf5be7 100644 --- a/tests/compiler/call-super.debug.wat +++ b/tests/compiler/call-super.debug.wat @@ -1916,22 +1916,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1953,6 +1937,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/call-super.release.wat b/tests/compiler/call-super.release.wat index 96f5a06379..6b0e435383 100644 --- a/tests/compiler/call-super.release.wat +++ b/tests/compiler/call-super.release.wat @@ -1266,7 +1266,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1281,7 +1281,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1301,8 +1301,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1311,38 +1312,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1350,7 +1353,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1359,7 +1362,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1387,12 +1390,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1406,7 +1409,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1417,7 +1420,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1427,19 +1430,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/class-implements.debug.wat b/tests/compiler/class-implements.debug.wat index 513488c3b1..9f22c76fac 100644 --- a/tests/compiler/class-implements.debug.wat +++ b/tests/compiler/class-implements.debug.wat @@ -1919,22 +1919,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1956,6 +1940,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/class-implements.release.wat b/tests/compiler/class-implements.release.wat index 8241ee895b..faeba1b411 100644 --- a/tests/compiler/class-implements.release.wat +++ b/tests/compiler/class-implements.release.wat @@ -1315,7 +1315,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1330,7 +1330,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1350,8 +1350,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1360,38 +1361,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1399,7 +1402,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1408,7 +1411,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1436,12 +1439,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1455,7 +1458,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1466,7 +1469,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1476,19 +1479,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/class-overloading-cast.debug.wat b/tests/compiler/class-overloading-cast.debug.wat index 5d6b4c4440..6720450fb6 100644 --- a/tests/compiler/class-overloading-cast.debug.wat +++ b/tests/compiler/class-overloading-cast.debug.wat @@ -1925,22 +1925,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1962,6 +1946,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/class-overloading-cast.release.wat b/tests/compiler/class-overloading-cast.release.wat index 7f8807e5d0..478f4c6602 100644 --- a/tests/compiler/class-overloading-cast.release.wat +++ b/tests/compiler/class-overloading-cast.release.wat @@ -1229,6 +1229,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1239,7 +1241,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/class-overloading.debug.wat b/tests/compiler/class-overloading.debug.wat index 68188c2423..eda76bb665 100644 --- a/tests/compiler/class-overloading.debug.wat +++ b/tests/compiler/class-overloading.debug.wat @@ -1929,22 +1929,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1966,6 +1950,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/class-overloading.release.wat b/tests/compiler/class-overloading.release.wat index 7c2ae8c167..2fd778bd2a 100644 --- a/tests/compiler/class-overloading.release.wat +++ b/tests/compiler/class-overloading.release.wat @@ -1251,6 +1251,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1261,7 +1263,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/class.debug.wat b/tests/compiler/class.debug.wat index d982de291a..8ed8a94538 100644 --- a/tests/compiler/class.debug.wat +++ b/tests/compiler/class.debug.wat @@ -1997,22 +1997,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2034,6 +2018,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/class.release.wat b/tests/compiler/class.release.wat index d09c997d7e..2fad2a7e61 100644 --- a/tests/compiler/class.release.wat +++ b/tests/compiler/class.release.wat @@ -1272,7 +1272,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1287,7 +1287,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1307,8 +1307,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1317,38 +1318,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1356,7 +1359,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1365,7 +1368,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1393,12 +1396,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1412,7 +1415,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1423,7 +1426,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1433,19 +1436,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/constructor.debug.wat b/tests/compiler/constructor.debug.wat index fea14b0274..9216498de6 100644 --- a/tests/compiler/constructor.debug.wat +++ b/tests/compiler/constructor.debug.wat @@ -1925,22 +1925,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1962,6 +1946,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/constructor.release.wat b/tests/compiler/constructor.release.wat index e90dc84a66..5dd74c0ea1 100644 --- a/tests/compiler/constructor.release.wat +++ b/tests/compiler/constructor.release.wat @@ -1329,7 +1329,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1344,7 +1344,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1364,8 +1364,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1374,38 +1375,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1413,7 +1416,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1422,7 +1425,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1450,12 +1453,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1469,7 +1472,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1480,7 +1483,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1490,19 +1493,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/do.debug.wat b/tests/compiler/do.debug.wat index 8432628da9..28cbc57b85 100644 --- a/tests/compiler/do.debug.wat +++ b/tests/compiler/do.debug.wat @@ -2320,22 +2320,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2357,6 +2341,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/do.release.wat b/tests/compiler/do.release.wat index eae6e23206..5a45e4bfd3 100644 --- a/tests/compiler/do.release.wat +++ b/tests/compiler/do.release.wat @@ -1191,6 +1191,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1201,7 +1203,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/duplicate-fields.debug.wat b/tests/compiler/duplicate-fields.debug.wat index 7bf87ccaba..3baed526a1 100644 --- a/tests/compiler/duplicate-fields.debug.wat +++ b/tests/compiler/duplicate-fields.debug.wat @@ -1919,22 +1919,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1956,6 +1940,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/duplicate-fields.release.wat b/tests/compiler/duplicate-fields.release.wat index 493ded77a6..5c036eb335 100644 --- a/tests/compiler/duplicate-fields.release.wat +++ b/tests/compiler/duplicate-fields.release.wat @@ -1279,7 +1279,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1294,7 +1294,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1314,8 +1314,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1324,38 +1325,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1363,7 +1366,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1372,7 +1375,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1400,12 +1403,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1419,7 +1422,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1430,7 +1433,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1440,19 +1443,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/empty-exportruntime.debug.wat b/tests/compiler/empty-exportruntime.debug.wat index 8f69345eb5..74ed896650 100644 --- a/tests/compiler/empty-exportruntime.debug.wat +++ b/tests/compiler/empty-exportruntime.debug.wat @@ -1918,22 +1918,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1955,6 +1939,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/empty-exportruntime.release.wat b/tests/compiler/empty-exportruntime.release.wat index caf4fb6744..ad569bd9d1 100644 --- a/tests/compiler/empty-exportruntime.release.wat +++ b/tests/compiler/empty-exportruntime.release.wat @@ -1280,7 +1280,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1295,7 +1295,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1315,8 +1315,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1325,38 +1326,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1364,7 +1367,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1373,7 +1376,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1401,12 +1404,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1420,7 +1423,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1431,7 +1434,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1441,19 +1444,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/empty-new.debug.wat b/tests/compiler/empty-new.debug.wat index de8b37131f..b52f87fc68 100644 --- a/tests/compiler/empty-new.debug.wat +++ b/tests/compiler/empty-new.debug.wat @@ -1911,22 +1911,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1948,6 +1932,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/empty-new.release.wat b/tests/compiler/empty-new.release.wat index 9cce3d1af5..04804b1681 100644 --- a/tests/compiler/empty-new.release.wat +++ b/tests/compiler/empty-new.release.wat @@ -1188,6 +1188,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1198,7 +1200,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/exportstar-rereexport.debug.wat b/tests/compiler/exportstar-rereexport.debug.wat index 6ab32b9f63..690306b090 100644 --- a/tests/compiler/exportstar-rereexport.debug.wat +++ b/tests/compiler/exportstar-rereexport.debug.wat @@ -1951,22 +1951,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1988,6 +1972,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/exportstar-rereexport.release.wat b/tests/compiler/exportstar-rereexport.release.wat index 2579e676cb..da22a078d6 100644 --- a/tests/compiler/exportstar-rereexport.release.wat +++ b/tests/compiler/exportstar-rereexport.release.wat @@ -1222,6 +1222,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1232,7 +1234,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/extends-baseaggregate.debug.wat b/tests/compiler/extends-baseaggregate.debug.wat index b4ad0cd136..89cc377a38 100644 --- a/tests/compiler/extends-baseaggregate.debug.wat +++ b/tests/compiler/extends-baseaggregate.debug.wat @@ -1921,22 +1921,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1958,6 +1942,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/extends-baseaggregate.release.wat b/tests/compiler/extends-baseaggregate.release.wat index e7f2d48b36..8dba9f2522 100644 --- a/tests/compiler/extends-baseaggregate.release.wat +++ b/tests/compiler/extends-baseaggregate.release.wat @@ -1282,7 +1282,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1297,7 +1297,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1317,8 +1317,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1327,38 +1328,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1366,7 +1369,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1375,7 +1378,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1403,12 +1406,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1422,7 +1425,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1433,7 +1436,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1443,19 +1446,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/extends-recursive.debug.wat b/tests/compiler/extends-recursive.debug.wat index cc418dc5a2..2d6cbbf6c3 100644 --- a/tests/compiler/extends-recursive.debug.wat +++ b/tests/compiler/extends-recursive.debug.wat @@ -1911,22 +1911,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1948,6 +1932,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/extends-recursive.release.wat b/tests/compiler/extends-recursive.release.wat index 55177fd2de..62c1f1ec2c 100644 --- a/tests/compiler/extends-recursive.release.wat +++ b/tests/compiler/extends-recursive.release.wat @@ -1263,7 +1263,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1278,7 +1278,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1298,8 +1298,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1308,38 +1309,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1347,7 +1350,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1356,7 +1359,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1384,12 +1387,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1403,7 +1406,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1414,7 +1417,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1424,19 +1427,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/field-initialization.debug.wat b/tests/compiler/field-initialization.debug.wat index 8d33900225..70fc4cbf86 100644 --- a/tests/compiler/field-initialization.debug.wat +++ b/tests/compiler/field-initialization.debug.wat @@ -1922,22 +1922,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1959,6 +1943,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/field-initialization.release.wat b/tests/compiler/field-initialization.release.wat index 2b12e4b206..e11b78fbbe 100644 --- a/tests/compiler/field-initialization.release.wat +++ b/tests/compiler/field-initialization.release.wat @@ -1283,7 +1283,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1298,7 +1298,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1318,8 +1318,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1328,38 +1329,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1367,7 +1370,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1376,7 +1379,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1404,12 +1407,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1423,7 +1426,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1434,7 +1437,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1444,19 +1447,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/field.debug.wat b/tests/compiler/field.debug.wat index 8ba0b11431..a7bc14e656 100644 --- a/tests/compiler/field.debug.wat +++ b/tests/compiler/field.debug.wat @@ -1914,22 +1914,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1951,6 +1935,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/field.release.wat b/tests/compiler/field.release.wat index 17ce80649a..ceaa337513 100644 --- a/tests/compiler/field.release.wat +++ b/tests/compiler/field.release.wat @@ -1266,7 +1266,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1281,7 +1281,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1301,8 +1301,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1311,38 +1312,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1350,7 +1353,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1359,7 +1362,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1387,12 +1390,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1406,7 +1409,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1417,7 +1420,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1427,19 +1430,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/for.debug.wat b/tests/compiler/for.debug.wat index 407a1ca890..3b2eaae0f5 100644 --- a/tests/compiler/for.debug.wat +++ b/tests/compiler/for.debug.wat @@ -2301,22 +2301,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2338,6 +2322,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/for.release.wat b/tests/compiler/for.release.wat index 008278b7d7..fd4c568c64 100644 --- a/tests/compiler/for.release.wat +++ b/tests/compiler/for.release.wat @@ -1191,6 +1191,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1201,7 +1203,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/function-call.debug.wat b/tests/compiler/function-call.debug.wat index fafbdad6aa..344385ebb1 100644 --- a/tests/compiler/function-call.debug.wat +++ b/tests/compiler/function-call.debug.wat @@ -1950,22 +1950,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1987,6 +1971,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/function-call.release.wat b/tests/compiler/function-call.release.wat index c784df4f93..e7727aaa89 100644 --- a/tests/compiler/function-call.release.wat +++ b/tests/compiler/function-call.release.wat @@ -1230,6 +1230,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1240,7 +1242,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/function-expression.debug.wat b/tests/compiler/function-expression.debug.wat index d4bb092868..69f2e816c1 100644 --- a/tests/compiler/function-expression.debug.wat +++ b/tests/compiler/function-expression.debug.wat @@ -2107,22 +2107,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2144,6 +2128,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/function-expression.release.wat b/tests/compiler/function-expression.release.wat index 81beccd9b2..b965a4fd37 100644 --- a/tests/compiler/function-expression.release.wat +++ b/tests/compiler/function-expression.release.wat @@ -1256,6 +1256,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1266,7 +1268,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/getter-call.debug.wat b/tests/compiler/getter-call.debug.wat index 35e9824008..7bf4d92bc9 100644 --- a/tests/compiler/getter-call.debug.wat +++ b/tests/compiler/getter-call.debug.wat @@ -1914,22 +1914,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1951,6 +1935,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/getter-call.release.wat b/tests/compiler/getter-call.release.wat index 76889b92a2..22f92a9c05 100644 --- a/tests/compiler/getter-call.release.wat +++ b/tests/compiler/getter-call.release.wat @@ -1194,6 +1194,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1204,7 +1206,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/heap.debug.wat b/tests/compiler/heap.debug.wat index 15b46c46c7..f667dd37e4 100644 --- a/tests/compiler/heap.debug.wat +++ b/tests/compiler/heap.debug.wat @@ -1229,22 +1229,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1266,6 +1250,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/heap.release.wat b/tests/compiler/heap.release.wat index baefb0fa14..980583dc5f 100644 --- a/tests/compiler/heap.release.wat +++ b/tests/compiler/heap.release.wat @@ -844,49 +844,52 @@ i32.eqz if memory.size $0 - local.tee $3 + local.tee $1 + local.get $2 i32.const 4 local.get $0 i32.load $0 offset=1568 - local.get $3 + local.get $1 i32.const 16 i32.shl i32.const 4 i32.sub i32.ne i32.shl - local.get $2 - i32.const 1 - i32.const 27 - local.get $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $2 - local.get $2 + local.tee $3 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $3 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $1 + local.tee $3 local.get $1 local.get $3 - i32.lt_s + i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $1 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -895,7 +898,7 @@ end end local.get $0 - local.get $3 + local.get $1 i32.const 16 i32.shl memory.size $0 diff --git a/tests/compiler/infer-array.debug.wat b/tests/compiler/infer-array.debug.wat index 6a0d4d81de..454d8cc54c 100644 --- a/tests/compiler/infer-array.debug.wat +++ b/tests/compiler/infer-array.debug.wat @@ -1933,22 +1933,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1970,6 +1954,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/infer-array.release.wat b/tests/compiler/infer-array.release.wat index ecdace4dee..b223a04cfb 100644 --- a/tests/compiler/infer-array.release.wat +++ b/tests/compiler/infer-array.release.wat @@ -1305,7 +1305,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1320,7 +1320,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1340,8 +1340,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1350,38 +1351,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1389,7 +1392,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1398,7 +1401,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1426,12 +1429,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1445,7 +1448,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1456,7 +1459,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1466,19 +1469,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/infer-generic.debug.wat b/tests/compiler/infer-generic.debug.wat index 8f233ef65a..dbbcceae69 100644 --- a/tests/compiler/infer-generic.debug.wat +++ b/tests/compiler/infer-generic.debug.wat @@ -1960,22 +1960,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1997,6 +1981,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/infer-generic.release.wat b/tests/compiler/infer-generic.release.wat index a3aa2380b5..6757093aca 100644 --- a/tests/compiler/infer-generic.release.wat +++ b/tests/compiler/infer-generic.release.wat @@ -1292,7 +1292,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1307,7 +1307,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1327,8 +1327,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1337,38 +1338,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1376,7 +1379,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1385,7 +1388,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1413,12 +1416,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1432,7 +1435,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1443,7 +1446,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1453,19 +1456,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/inlining.debug.wat b/tests/compiler/inlining.debug.wat index 9aa02eb8e6..1167081230 100644 --- a/tests/compiler/inlining.debug.wat +++ b/tests/compiler/inlining.debug.wat @@ -2179,22 +2179,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2216,6 +2200,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/inlining.release.wat b/tests/compiler/inlining.release.wat index 86a09559d2..c3c6a9d101 100644 --- a/tests/compiler/inlining.release.wat +++ b/tests/compiler/inlining.release.wat @@ -1278,7 +1278,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1293,7 +1293,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1313,8 +1313,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1323,38 +1324,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1362,7 +1365,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1371,7 +1374,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1399,12 +1402,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1418,7 +1421,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1429,7 +1432,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1439,19 +1442,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/instanceof.debug.wat b/tests/compiler/instanceof.debug.wat index 7a6e9d3571..28035e3e45 100644 --- a/tests/compiler/instanceof.debug.wat +++ b/tests/compiler/instanceof.debug.wat @@ -1935,22 +1935,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1972,6 +1956,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/instanceof.release.wat b/tests/compiler/instanceof.release.wat index 6e380ceb09..4b259edb94 100644 --- a/tests/compiler/instanceof.release.wat +++ b/tests/compiler/instanceof.release.wat @@ -1296,6 +1296,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1306,7 +1308,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/issues/1095.debug.wat b/tests/compiler/issues/1095.debug.wat index 7bc52ec422..14eae4a300 100644 --- a/tests/compiler/issues/1095.debug.wat +++ b/tests/compiler/issues/1095.debug.wat @@ -1914,22 +1914,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1951,6 +1935,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/issues/1095.release.wat b/tests/compiler/issues/1095.release.wat index 833d7bb9b4..6bdf62d977 100644 --- a/tests/compiler/issues/1095.release.wat +++ b/tests/compiler/issues/1095.release.wat @@ -1269,7 +1269,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1284,7 +1284,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1304,8 +1304,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1314,38 +1315,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1353,7 +1356,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1362,7 +1365,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1390,12 +1393,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1409,7 +1412,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1420,7 +1423,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1430,19 +1433,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/issues/1225.debug.wat b/tests/compiler/issues/1225.debug.wat index 5766a3ebaa..924c093308 100644 --- a/tests/compiler/issues/1225.debug.wat +++ b/tests/compiler/issues/1225.debug.wat @@ -1929,22 +1929,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1966,6 +1950,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/issues/1225.release.wat b/tests/compiler/issues/1225.release.wat index 27ad0ab4d1..df14a60cb1 100644 --- a/tests/compiler/issues/1225.release.wat +++ b/tests/compiler/issues/1225.release.wat @@ -1200,6 +1200,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1210,7 +1212,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/issues/1699.debug.wat b/tests/compiler/issues/1699.debug.wat index 6fa0fa92a5..b34102eabd 100644 --- a/tests/compiler/issues/1699.debug.wat +++ b/tests/compiler/issues/1699.debug.wat @@ -1916,22 +1916,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1953,6 +1937,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/issues/1699.release.wat b/tests/compiler/issues/1699.release.wat index 2228f68687..c9293bf7f6 100644 --- a/tests/compiler/issues/1699.release.wat +++ b/tests/compiler/issues/1699.release.wat @@ -1276,7 +1276,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1291,7 +1291,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1311,8 +1311,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1321,38 +1322,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1360,7 +1363,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1369,7 +1372,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1397,12 +1400,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1416,7 +1419,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1427,7 +1430,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1437,19 +1440,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/issues/2166.debug.wat b/tests/compiler/issues/2166.debug.wat index 95bcc64d24..519bbe7aa2 100644 --- a/tests/compiler/issues/2166.debug.wat +++ b/tests/compiler/issues/2166.debug.wat @@ -1918,22 +1918,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1955,6 +1939,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/issues/2166.release.wat b/tests/compiler/issues/2166.release.wat index 50358d77ee..5fd708b17e 100644 --- a/tests/compiler/issues/2166.release.wat +++ b/tests/compiler/issues/2166.release.wat @@ -1200,6 +1200,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1210,7 +1212,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/issues/2322/index.debug.wat b/tests/compiler/issues/2322/index.debug.wat index 12436fad86..da27323fae 100644 --- a/tests/compiler/issues/2322/index.debug.wat +++ b/tests/compiler/issues/2322/index.debug.wat @@ -1912,22 +1912,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1949,6 +1933,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/issues/2322/index.release.wat b/tests/compiler/issues/2322/index.release.wat index 0d93ed1ae6..90b5d9497d 100644 --- a/tests/compiler/issues/2322/index.release.wat +++ b/tests/compiler/issues/2322/index.release.wat @@ -1264,7 +1264,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1279,7 +1279,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1299,8 +1299,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1309,38 +1310,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1348,7 +1351,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1357,7 +1360,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1385,12 +1388,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1404,7 +1407,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1415,7 +1418,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1425,19 +1428,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/issues/2622.debug.wat b/tests/compiler/issues/2622.debug.wat index 114640c3e5..31d5d2f1f5 100644 --- a/tests/compiler/issues/2622.debug.wat +++ b/tests/compiler/issues/2622.debug.wat @@ -1915,22 +1915,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1952,6 +1936,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/issues/2622.release.wat b/tests/compiler/issues/2622.release.wat index b2ba09af23..69246ec0b6 100644 --- a/tests/compiler/issues/2622.release.wat +++ b/tests/compiler/issues/2622.release.wat @@ -1229,6 +1229,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1239,7 +1241,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/logical.debug.wat b/tests/compiler/logical.debug.wat index fca6162159..1d7cd41ec0 100644 --- a/tests/compiler/logical.debug.wat +++ b/tests/compiler/logical.debug.wat @@ -1941,22 +1941,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1978,6 +1962,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/logical.release.wat b/tests/compiler/logical.release.wat index 5a368d6b60..bf8f9bca5e 100644 --- a/tests/compiler/logical.release.wat +++ b/tests/compiler/logical.release.wat @@ -1205,6 +1205,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1215,7 +1217,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/managed-cast.debug.wat b/tests/compiler/managed-cast.debug.wat index e18897dfca..eed301a93b 100644 --- a/tests/compiler/managed-cast.debug.wat +++ b/tests/compiler/managed-cast.debug.wat @@ -1914,22 +1914,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1951,6 +1935,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/managed-cast.release.wat b/tests/compiler/managed-cast.release.wat index 19cbe6d573..60c36eacf2 100644 --- a/tests/compiler/managed-cast.release.wat +++ b/tests/compiler/managed-cast.release.wat @@ -1195,6 +1195,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1205,7 +1207,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/new.debug.wat b/tests/compiler/new.debug.wat index fecb460f29..031886a92d 100644 --- a/tests/compiler/new.debug.wat +++ b/tests/compiler/new.debug.wat @@ -1917,22 +1917,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1954,6 +1938,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/new.release.wat b/tests/compiler/new.release.wat index f99abb0702..1708f931f0 100644 --- a/tests/compiler/new.release.wat +++ b/tests/compiler/new.release.wat @@ -1231,6 +1231,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1241,7 +1243,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/object-literal.debug.wat b/tests/compiler/object-literal.debug.wat index b520990ae2..083253fbb3 100644 --- a/tests/compiler/object-literal.debug.wat +++ b/tests/compiler/object-literal.debug.wat @@ -2009,22 +2009,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2046,6 +2030,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/object-literal.release.wat b/tests/compiler/object-literal.release.wat index 18760fe16f..9b5a943385 100644 --- a/tests/compiler/object-literal.release.wat +++ b/tests/compiler/object-literal.release.wat @@ -1252,6 +1252,7 @@ if memory.size $0 local.tee $1 + local.get $3 i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1262,22 +1263,24 @@ i32.sub i32.ne i32.shl - local.get $3 - i32.const 1 - i32.const 27 - local.get $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $3 - local.get $3 + local.tee $2 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $2 + i32.const 1 + i32.const 27 + local.get $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $2 + end i32.const 65535 i32.add i32.const -65536 @@ -1343,7 +1346,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $4 + local.set $2 local.get $3 i32.const 4 i32.add @@ -1357,18 +1360,18 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $2 i32.const -4 i32.and local.get $3 i32.sub - local.tee $2 + local.tee $4 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $4 + local.get $2 i32.const 2 i32.and i32.or @@ -1378,19 +1381,19 @@ i32.add local.get $3 i32.add - local.tee $3 - local.get $2 + local.tee $2 + local.get $4 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $3 + local.get $2 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $4 + local.get $2 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/optional-typeparameters.debug.wat b/tests/compiler/optional-typeparameters.debug.wat index 39e9976fbe..c34269a79a 100644 --- a/tests/compiler/optional-typeparameters.debug.wat +++ b/tests/compiler/optional-typeparameters.debug.wat @@ -1925,22 +1925,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1962,6 +1946,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/optional-typeparameters.release.wat b/tests/compiler/optional-typeparameters.release.wat index 59d641d65d..fcbfbdfd7f 100644 --- a/tests/compiler/optional-typeparameters.release.wat +++ b/tests/compiler/optional-typeparameters.release.wat @@ -1217,6 +1217,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1227,7 +1229,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/reexport.debug.wat b/tests/compiler/reexport.debug.wat index b1c039ccac..c8e6eff590 100644 --- a/tests/compiler/reexport.debug.wat +++ b/tests/compiler/reexport.debug.wat @@ -1958,22 +1958,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1995,6 +1979,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/reexport.release.wat b/tests/compiler/reexport.release.wat index 9baabf7a00..c16716f4df 100644 --- a/tests/compiler/reexport.release.wat +++ b/tests/compiler/reexport.release.wat @@ -1224,6 +1224,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1234,7 +1236,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/rereexport.debug.wat b/tests/compiler/rereexport.debug.wat index 7cdcb0dad0..9ddeb4f6cc 100644 --- a/tests/compiler/rereexport.debug.wat +++ b/tests/compiler/rereexport.debug.wat @@ -1951,22 +1951,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1988,6 +1972,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/rereexport.release.wat b/tests/compiler/rereexport.release.wat index 61f2435b7e..b0ad13ee2a 100644 --- a/tests/compiler/rereexport.release.wat +++ b/tests/compiler/rereexport.release.wat @@ -1222,6 +1222,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1232,7 +1234,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/resolve-access.debug.wat b/tests/compiler/resolve-access.debug.wat index 8d2e51b106..daf6e5fd01 100644 --- a/tests/compiler/resolve-access.debug.wat +++ b/tests/compiler/resolve-access.debug.wat @@ -1933,22 +1933,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1970,6 +1954,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-access.release.wat b/tests/compiler/resolve-access.release.wat index 0482bf6e60..73cee4b805 100644 --- a/tests/compiler/resolve-access.release.wat +++ b/tests/compiler/resolve-access.release.wat @@ -1287,7 +1287,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1302,7 +1302,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1322,8 +1322,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1332,38 +1333,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1371,7 +1374,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1380,7 +1383,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1408,12 +1411,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1427,7 +1430,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1438,7 +1441,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1448,19 +1451,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-binary.debug.wat b/tests/compiler/resolve-binary.debug.wat index ff19ed12e8..aff7b19103 100644 --- a/tests/compiler/resolve-binary.debug.wat +++ b/tests/compiler/resolve-binary.debug.wat @@ -2153,22 +2153,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2190,6 +2174,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-binary.release.wat b/tests/compiler/resolve-binary.release.wat index 030896d69b..3de8b92cca 100644 --- a/tests/compiler/resolve-binary.release.wat +++ b/tests/compiler/resolve-binary.release.wat @@ -1496,7 +1496,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1511,7 +1511,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1531,8 +1531,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1541,38 +1542,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1580,7 +1583,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1589,7 +1592,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1617,12 +1620,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1636,7 +1639,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1647,7 +1650,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1657,19 +1660,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-elementaccess.debug.wat b/tests/compiler/resolve-elementaccess.debug.wat index 1dc9378ea1..a7934ab754 100644 --- a/tests/compiler/resolve-elementaccess.debug.wat +++ b/tests/compiler/resolve-elementaccess.debug.wat @@ -1956,22 +1956,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1993,6 +1977,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-elementaccess.release.wat b/tests/compiler/resolve-elementaccess.release.wat index 1951c93145..8288a81d5a 100644 --- a/tests/compiler/resolve-elementaccess.release.wat +++ b/tests/compiler/resolve-elementaccess.release.wat @@ -1339,7 +1339,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1354,7 +1354,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1374,8 +1374,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1384,38 +1385,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1423,7 +1426,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1432,7 +1435,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1460,12 +1463,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1479,7 +1482,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1490,7 +1493,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1500,19 +1503,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-function-expression.debug.wat b/tests/compiler/resolve-function-expression.debug.wat index 94f52e0a6d..a9eda91089 100644 --- a/tests/compiler/resolve-function-expression.debug.wat +++ b/tests/compiler/resolve-function-expression.debug.wat @@ -1999,22 +1999,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2036,6 +2020,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-function-expression.release.wat b/tests/compiler/resolve-function-expression.release.wat index 733cf16d8e..dc311a0352 100644 --- a/tests/compiler/resolve-function-expression.release.wat +++ b/tests/compiler/resolve-function-expression.release.wat @@ -1275,11 +1275,11 @@ i32.add global.set $~lib/memory/__stack_pointer i32.const 1424 - local.set $1 + local.set $2 br $__inlined_func$~lib/util/number/itoa32 end global.get $~lib/memory/__stack_pointer - local.set $5 + local.set $4 i32.const 0 local.get $0 i32.sub @@ -1337,12 +1337,12 @@ i32.add end end - local.tee $2 + local.tee $1 i32.const 1 i32.shl local.get $3 i32.add - local.tee $6 + local.tee $7 i32.const 1073741804 i32.ge_u if @@ -1359,12 +1359,12 @@ if block $__inlined_func$~lib/rt/itcms/interrupt i32.const 2048 - local.set $1 + local.set $2 loop $do-loop|0 - local.get $1 + local.get $2 call $~lib/rt/itcms/step i32.sub - local.set $1 + local.set $2 global.get $~lib/rt/itcms/state i32.eqz if @@ -1380,20 +1380,20 @@ global.set $~lib/rt/itcms/threshold br $__inlined_func$~lib/rt/itcms/interrupt end - local.get $1 + local.get $2 i32.const 0 i32.gt_s br_if $do-loop|0 end global.get $~lib/rt/itcms/total - local.tee $1 + local.tee $2 global.get $~lib/rt/itcms/threshold i32.sub i32.const 1024 i32.lt_u i32.const 10 i32.shl - local.get $1 + local.get $2 i32.add global.set $~lib/rt/itcms/threshold end @@ -1404,11 +1404,11 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $7 - local.get $6 + local.set $5 + local.get $7 i32.const 16 i32.add - local.tee $1 + local.tee $2 i32.const 1073741820 i32.gt_u if @@ -1419,68 +1419,71 @@ call $~lib/builtins/abort unreachable end - local.get $7 + local.get $5 i32.const 12 - local.get $1 + local.get $2 i32.const 19 i32.add i32.const -16 i32.and i32.const 4 i32.sub - local.get $1 + local.get $2 i32.const 12 i32.le_u select local.tee $8 call $~lib/rt/tlsf/searchBlock - local.tee $1 + local.tee $2 i32.eqz if memory.size $0 - local.tee $1 + local.tee $2 + local.get $8 i32.const 4 - local.get $7 + local.get $5 i32.load $0 offset=1568 - local.get $1 + local.get $2 i32.const 16 i32.shl i32.const 4 i32.sub i32.ne i32.shl - local.get $8 - i32.const 1 - i32.const 27 - local.get $8 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $8 - local.get $8 + local.tee $6 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $6 + i32.const 1 + i32.const 27 + local.get $6 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $6 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 - local.get $1 - local.get $4 + local.tee $6 + local.get $2 + local.get $6 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $6 memory.grow $0 i32.const 0 i32.lt_s @@ -1488,8 +1491,8 @@ unreachable end end - local.get $7 - local.get $1 + local.get $5 + local.get $2 i32.const 16 i32.shl memory.size $0 @@ -1497,10 +1500,10 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $7 + local.get $5 local.get $8 call $~lib/rt/tlsf/searchBlock - local.tee $1 + local.tee $2 i32.eqz if i32.const 0 @@ -1512,7 +1515,7 @@ end end local.get $8 - local.get $1 + local.get $2 i32.load $0 i32.const -4 i32.and @@ -1525,12 +1528,12 @@ call $~lib/builtins/abort unreachable end - local.get $7 - local.get $1 + local.get $5 + local.get $2 call $~lib/rt/tlsf/removeBlock - local.get $1 + local.get $2 i32.load $0 - local.set $4 + local.set $6 local.get $8 i32.const 4 i32.add @@ -1544,7 +1547,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $6 i32.const -4 i32.and local.get $8 @@ -1553,80 +1556,80 @@ i32.const 16 i32.ge_u if - local.get $1 + local.get $2 local.get $8 - local.get $4 + local.get $6 i32.const 2 i32.and i32.or i32.store $0 - local.get $1 + local.get $2 i32.const 4 i32.add local.get $8 i32.add - local.tee $4 + local.tee $6 local.get $9 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $7 - local.get $4 + local.get $5 + local.get $6 call $~lib/rt/tlsf/insertBlock else - local.get $1 - local.get $4 + local.get $2 + local.get $6 i32.const -2 i32.and i32.store $0 - local.get $1 + local.get $2 i32.const 4 i32.add - local.get $1 + local.get $2 i32.load $0 i32.const -4 i32.and i32.add - local.tee $4 - local.get $4 + local.tee $5 + local.get $5 i32.load $0 i32.const -3 i32.and i32.store $0 end - local.get $1 + local.get $2 i32.const 2 i32.store $0 offset=12 - local.get $1 - local.get $6 + local.get $2 + local.get $7 i32.store $0 offset=16 global.get $~lib/rt/itcms/fromSpace - local.tee $4 + local.tee $5 i32.load $0 offset=8 - local.set $7 - local.get $1 - local.get $4 + local.set $6 + local.get $2 + local.get $5 global.get $~lib/rt/itcms/white i32.or i32.store $0 offset=4 - local.get $1 - local.get $7 + local.get $2 + local.get $6 i32.store $0 offset=8 - local.get $7 - local.get $1 - local.get $7 + local.get $6 + local.get $2 + local.get $6 i32.load $0 offset=4 i32.const 3 i32.and i32.or i32.store $0 offset=4 - local.get $4 - local.get $1 + local.get $5 + local.get $2 i32.store $0 offset=8 global.get $~lib/rt/itcms/total - local.get $1 + local.get $2 i32.load $0 i32.const -4 i32.and @@ -1634,17 +1637,17 @@ i32.add i32.add global.set $~lib/rt/itcms/total - local.get $1 + local.get $2 i32.const 20 i32.add - local.tee $1 + local.tee $2 i32.const 0 - local.get $6 + local.get $7 memory.fill $0 - local.get $5 - local.get $1 + local.get $4 + local.get $2 i32.store $0 - local.get $1 + local.get $2 local.get $3 i32.add local.set $4 @@ -1662,10 +1665,10 @@ i32.div_u local.set $0 local.get $4 - local.get $2 + local.get $1 i32.const 4 i32.sub - local.tee $2 + local.tee $1 i32.const 1 i32.shl i32.add @@ -1697,10 +1700,10 @@ i32.ge_u if local.get $4 - local.get $2 + local.get $1 i32.const 2 i32.sub - local.tee $2 + local.tee $1 i32.const 1 i32.shl i32.add @@ -1723,7 +1726,7 @@ i32.ge_u if local.get $4 - local.get $2 + local.get $1 i32.const 2 i32.sub i32.const 1 @@ -1738,7 +1741,7 @@ i32.store $0 else local.get $4 - local.get $2 + local.get $1 i32.const 1 i32.sub i32.const 1 @@ -1751,7 +1754,7 @@ end local.get $3 if - local.get $1 + local.get $2 i32.const 45 i32.store16 $0 end @@ -1760,7 +1763,7 @@ i32.add global.set $~lib/memory/__stack_pointer end - local.get $1 + local.get $2 ) (func $~lib/rt/__visit_members (param $0 i32) (local $1 i32) diff --git a/tests/compiler/resolve-new.debug.wat b/tests/compiler/resolve-new.debug.wat index 75e158d7ce..b046c451f7 100644 --- a/tests/compiler/resolve-new.debug.wat +++ b/tests/compiler/resolve-new.debug.wat @@ -1912,22 +1912,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1949,6 +1933,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-new.release.wat b/tests/compiler/resolve-new.release.wat index 6b37e50151..0dcc1f4e14 100644 --- a/tests/compiler/resolve-new.release.wat +++ b/tests/compiler/resolve-new.release.wat @@ -1196,6 +1196,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1206,7 +1208,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/resolve-propertyaccess.debug.wat b/tests/compiler/resolve-propertyaccess.debug.wat index 18abec093b..1c86828188 100644 --- a/tests/compiler/resolve-propertyaccess.debug.wat +++ b/tests/compiler/resolve-propertyaccess.debug.wat @@ -1999,22 +1999,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2036,6 +2020,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-propertyaccess.release.wat b/tests/compiler/resolve-propertyaccess.release.wat index 83043d29eb..00d6dd4941 100644 --- a/tests/compiler/resolve-propertyaccess.release.wat +++ b/tests/compiler/resolve-propertyaccess.release.wat @@ -1305,7 +1305,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1320,7 +1320,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1340,8 +1340,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1350,38 +1351,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1389,7 +1392,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1398,7 +1401,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1426,12 +1429,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1445,7 +1448,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1456,7 +1459,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1466,19 +1469,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-ternary.debug.wat b/tests/compiler/resolve-ternary.debug.wat index 821f870592..248a1f1a26 100644 --- a/tests/compiler/resolve-ternary.debug.wat +++ b/tests/compiler/resolve-ternary.debug.wat @@ -2007,22 +2007,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2044,6 +2028,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-ternary.release.wat b/tests/compiler/resolve-ternary.release.wat index 6cf4ecb8c6..c829aa7cf8 100644 --- a/tests/compiler/resolve-ternary.release.wat +++ b/tests/compiler/resolve-ternary.release.wat @@ -1311,7 +1311,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $2 local.get $0 i32.const 16 i32.add @@ -1326,7 +1326,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 12 local.get $1 i32.const 19 @@ -1346,8 +1346,9 @@ if memory.size $0 local.tee $1 + local.get $4 i32.const 4 - local.get $3 + local.get $2 i32.load $0 offset=1568 local.get $1 i32.const 16 @@ -1356,38 +1357,40 @@ i32.sub i32.ne i32.shl - local.get $4 - i32.const 1 - i32.const 27 - local.get $4 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $4 - local.get $4 + local.tee $3 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $3 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $2 + local.tee $3 local.get $1 - local.get $2 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $2 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1395,7 +1398,7 @@ unreachable end end - local.get $3 + local.get $2 local.get $1 i32.const 16 i32.shl @@ -1404,7 +1407,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $2 local.get $4 call $~lib/rt/tlsf/searchBlock local.tee $1 @@ -1432,12 +1435,12 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 local.get $1 call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $2 + local.set $3 local.get $4 i32.const 4 i32.add @@ -1451,7 +1454,7 @@ call $~lib/builtins/abort unreachable end - local.get $2 + local.get $3 i32.const -4 i32.and local.get $4 @@ -1462,7 +1465,7 @@ if local.get $1 local.get $4 - local.get $2 + local.get $3 i32.const 2 i32.and i32.or @@ -1472,19 +1475,19 @@ i32.add local.get $4 i32.add - local.tee $2 + local.tee $3 local.get $5 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $2 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $2 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-unary.debug.wat b/tests/compiler/resolve-unary.debug.wat index 8050d737ca..d39dc935b0 100644 --- a/tests/compiler/resolve-unary.debug.wat +++ b/tests/compiler/resolve-unary.debug.wat @@ -1999,22 +1999,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2036,6 +2020,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/resolve-unary.release.wat b/tests/compiler/resolve-unary.release.wat index c9f0c6ac9f..717bb060c0 100644 --- a/tests/compiler/resolve-unary.release.wat +++ b/tests/compiler/resolve-unary.release.wat @@ -1331,7 +1331,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1346,7 +1346,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1366,8 +1366,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1376,38 +1377,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1415,7 +1418,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1424,7 +1427,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1452,12 +1455,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1471,7 +1474,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1482,7 +1485,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1492,19 +1495,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/return-unreachable.debug.wat b/tests/compiler/return-unreachable.debug.wat index d74a223b13..67223199b9 100644 --- a/tests/compiler/return-unreachable.debug.wat +++ b/tests/compiler/return-unreachable.debug.wat @@ -1915,22 +1915,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1952,6 +1936,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/return-unreachable.release.wat b/tests/compiler/return-unreachable.release.wat index 3242386a34..77b8a23234 100644 --- a/tests/compiler/return-unreachable.release.wat +++ b/tests/compiler/return-unreachable.release.wat @@ -1271,7 +1271,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1286,7 +1286,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1306,8 +1306,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1316,38 +1317,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1355,7 +1358,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1364,7 +1367,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1392,12 +1395,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1411,7 +1414,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1422,7 +1425,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1432,19 +1435,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/rt/finalize.debug.wat b/tests/compiler/rt/finalize.debug.wat index 06dbe11c5e..b4e86d0a1c 100644 --- a/tests/compiler/rt/finalize.debug.wat +++ b/tests/compiler/rt/finalize.debug.wat @@ -1935,22 +1935,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1972,6 +1956,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/rt/finalize.release.wat b/tests/compiler/rt/finalize.release.wat index eb2ad2c237..0c1e01ce82 100644 --- a/tests/compiler/rt/finalize.release.wat +++ b/tests/compiler/rt/finalize.release.wat @@ -1209,6 +1209,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1219,7 +1221,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/rt/runtime-incremental-export.debug.wat b/tests/compiler/rt/runtime-incremental-export.debug.wat index 8f69345eb5..74ed896650 100644 --- a/tests/compiler/rt/runtime-incremental-export.debug.wat +++ b/tests/compiler/rt/runtime-incremental-export.debug.wat @@ -1918,22 +1918,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1955,6 +1939,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/rt/runtime-incremental-export.release.wat b/tests/compiler/rt/runtime-incremental-export.release.wat index caf4fb6744..ad569bd9d1 100644 --- a/tests/compiler/rt/runtime-incremental-export.release.wat +++ b/tests/compiler/rt/runtime-incremental-export.release.wat @@ -1280,7 +1280,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1295,7 +1295,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1315,8 +1315,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1325,38 +1326,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1364,7 +1367,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1373,7 +1376,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1401,12 +1404,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1420,7 +1423,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1431,7 +1434,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1441,19 +1444,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/rt/runtime-minimal-export.debug.wat b/tests/compiler/rt/runtime-minimal-export.debug.wat index 54358318b2..6b66b131e6 100644 --- a/tests/compiler/rt/runtime-minimal-export.debug.wat +++ b/tests/compiler/rt/runtime-minimal-export.debug.wat @@ -1243,22 +1243,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1280,6 +1264,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/rt/runtime-minimal-export.release.wat b/tests/compiler/rt/runtime-minimal-export.release.wat index 75dd8c40f7..43657b23ab 100644 --- a/tests/compiler/rt/runtime-minimal-export.release.wat +++ b/tests/compiler/rt/runtime-minimal-export.release.wat @@ -775,7 +775,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -790,7 +790,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -810,8 +810,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -820,38 +821,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -859,7 +862,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -868,7 +871,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -896,12 +899,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -915,7 +918,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -926,7 +929,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -936,19 +939,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/simd.debug.wat b/tests/compiler/simd.debug.wat index 25b57509d5..44e5fc9f13 100644 --- a/tests/compiler/simd.debug.wat +++ b/tests/compiler/simd.debug.wat @@ -1951,22 +1951,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1988,6 +1972,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/simd.release.wat b/tests/compiler/simd.release.wat index b026f5e615..175bff7fd1 100644 --- a/tests/compiler/simd.release.wat +++ b/tests/compiler/simd.release.wat @@ -1269,6 +1269,7 @@ if memory.size $0 local.tee $1 + local.get $3 i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1279,22 +1280,24 @@ i32.sub i32.ne i32.shl - local.get $3 - i32.const 1 - i32.const 27 - local.get $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $3 - local.get $3 + local.tee $2 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $2 + i32.const 1 + i32.const 27 + local.get $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $2 + end i32.const 65535 i32.add i32.const -65536 @@ -1360,7 +1363,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $4 + local.set $2 local.get $3 i32.const 4 i32.add @@ -1374,18 +1377,18 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $2 i32.const -4 i32.and local.get $3 i32.sub - local.tee $2 + local.tee $4 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $4 + local.get $2 i32.const 2 i32.and i32.or @@ -1395,19 +1398,19 @@ i32.add local.get $3 i32.add - local.tee $3 - local.get $2 + local.tee $2 + local.get $4 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $3 + local.get $2 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $4 + local.get $2 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/array-literal.debug.wat b/tests/compiler/std/array-literal.debug.wat index 0deecacc2b..ce60559f0b 100644 --- a/tests/compiler/std/array-literal.debug.wat +++ b/tests/compiler/std/array-literal.debug.wat @@ -1947,22 +1947,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1984,6 +1968,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/array-literal.release.wat b/tests/compiler/std/array-literal.release.wat index ae18a3e5d8..feebdc2325 100644 --- a/tests/compiler/std/array-literal.release.wat +++ b/tests/compiler/std/array-literal.release.wat @@ -1326,7 +1326,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1341,7 +1341,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1361,8 +1361,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1371,38 +1372,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1410,7 +1413,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1419,7 +1422,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1447,12 +1450,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1466,7 +1469,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1477,7 +1480,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1487,19 +1490,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/array.debug.wat b/tests/compiler/std/array.debug.wat index c369626cc6..36502659fb 100644 --- a/tests/compiler/std/array.debug.wat +++ b/tests/compiler/std/array.debug.wat @@ -2256,22 +2256,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2293,6 +2277,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/array.release.wat b/tests/compiler/std/array.release.wat index a4ec0c631e..d5f9f8ba73 100644 --- a/tests/compiler/std/array.release.wat +++ b/tests/compiler/std/array.release.wat @@ -1894,6 +1894,7 @@ if memory.size $0 local.tee $1 + local.get $3 i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1904,22 +1905,24 @@ i32.sub i32.ne i32.shl - local.get $3 - i32.const 1 - i32.const 27 - local.get $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $3 - local.get $3 + local.tee $2 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $2 + i32.const 1 + i32.const 27 + local.get $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $2 + end i32.const 65535 i32.add i32.const -65536 @@ -1985,7 +1988,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $4 + local.set $2 local.get $3 i32.const 4 i32.add @@ -1999,18 +2002,18 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $2 i32.const -4 i32.and local.get $3 i32.sub - local.tee $2 + local.tee $4 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $4 + local.get $2 i32.const 2 i32.and i32.or @@ -2020,19 +2023,19 @@ i32.add local.get $3 i32.add - local.tee $3 - local.get $2 + local.tee $2 + local.get $4 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $3 + local.get $2 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $4 + local.get $2 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/arraybuffer.debug.wat b/tests/compiler/std/arraybuffer.debug.wat index c530705661..19f1fa7b77 100644 --- a/tests/compiler/std/arraybuffer.debug.wat +++ b/tests/compiler/std/arraybuffer.debug.wat @@ -1920,22 +1920,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1957,6 +1941,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/arraybuffer.release.wat b/tests/compiler/std/arraybuffer.release.wat index 4721f6b330..8ea81ac2a1 100644 --- a/tests/compiler/std/arraybuffer.release.wat +++ b/tests/compiler/std/arraybuffer.release.wat @@ -1277,7 +1277,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1292,7 +1292,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1312,8 +1312,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1322,38 +1323,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1361,7 +1364,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1370,7 +1373,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1398,12 +1401,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1417,7 +1420,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1428,7 +1431,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1438,19 +1441,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/dataview.debug.wat b/tests/compiler/std/dataview.debug.wat index 473b0b0151..04047fb7bb 100644 --- a/tests/compiler/std/dataview.debug.wat +++ b/tests/compiler/std/dataview.debug.wat @@ -1926,22 +1926,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1963,6 +1947,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/dataview.release.wat b/tests/compiler/std/dataview.release.wat index 656ba6b9f3..e076874dbd 100644 --- a/tests/compiler/std/dataview.release.wat +++ b/tests/compiler/std/dataview.release.wat @@ -1285,7 +1285,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1300,7 +1300,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1320,8 +1320,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1330,38 +1331,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1369,7 +1372,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1378,7 +1381,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1406,12 +1409,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1425,7 +1428,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1436,7 +1439,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1446,19 +1449,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/date.debug.wat b/tests/compiler/std/date.debug.wat index bec755f84e..26ae929c5d 100644 --- a/tests/compiler/std/date.debug.wat +++ b/tests/compiler/std/date.debug.wat @@ -2304,22 +2304,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2341,6 +2325,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/date.release.wat b/tests/compiler/std/date.release.wat index 32d84a1f6a..88226d73c1 100644 --- a/tests/compiler/std/date.release.wat +++ b/tests/compiler/std/date.release.wat @@ -1651,7 +1651,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1666,7 +1666,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1686,8 +1686,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1696,38 +1697,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1735,7 +1738,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1744,7 +1747,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1772,12 +1775,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1791,7 +1794,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1802,7 +1805,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1812,19 +1815,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/map.debug.wat b/tests/compiler/std/map.debug.wat index 01a174d157..9d026b4c0f 100644 --- a/tests/compiler/std/map.debug.wat +++ b/tests/compiler/std/map.debug.wat @@ -1943,22 +1943,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1980,6 +1964,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/map.release.wat b/tests/compiler/std/map.release.wat index 758503f2bd..78d44727d1 100644 --- a/tests/compiler/std/map.release.wat +++ b/tests/compiler/std/map.release.wat @@ -1297,7 +1297,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1312,7 +1312,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1332,8 +1332,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1342,38 +1343,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1381,7 +1384,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1390,7 +1393,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1418,12 +1421,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1437,7 +1440,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1448,7 +1451,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1458,19 +1461,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/new.debug.wat b/tests/compiler/std/new.debug.wat index aac8f3b069..2d72a8ee0a 100644 --- a/tests/compiler/std/new.debug.wat +++ b/tests/compiler/std/new.debug.wat @@ -1929,22 +1929,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1966,6 +1950,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/new.release.wat b/tests/compiler/std/new.release.wat index 0ca01c2f2c..51c7f66e60 100644 --- a/tests/compiler/std/new.release.wat +++ b/tests/compiler/std/new.release.wat @@ -1196,6 +1196,8 @@ if memory.size $0 local.tee $0 + i32.const 1 + i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1206,7 +1208,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $2 + i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/std/operator-overloading.debug.wat b/tests/compiler/std/operator-overloading.debug.wat index 8ad0f46599..79a9d7736b 100644 --- a/tests/compiler/std/operator-overloading.debug.wat +++ b/tests/compiler/std/operator-overloading.debug.wat @@ -1985,22 +1985,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2022,6 +2006,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/operator-overloading.release.wat b/tests/compiler/std/operator-overloading.release.wat index 909368dfce..a9a7997be8 100644 --- a/tests/compiler/std/operator-overloading.release.wat +++ b/tests/compiler/std/operator-overloading.release.wat @@ -1129,6 +1129,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1139,7 +1141,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/std/set.debug.wat b/tests/compiler/std/set.debug.wat index a04dae3ba0..15152949f8 100644 --- a/tests/compiler/std/set.debug.wat +++ b/tests/compiler/std/set.debug.wat @@ -1938,22 +1938,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1975,6 +1959,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/set.release.wat b/tests/compiler/std/set.release.wat index ad66b0a6d0..3b5e7bb9a2 100644 --- a/tests/compiler/std/set.release.wat +++ b/tests/compiler/std/set.release.wat @@ -1288,7 +1288,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1303,7 +1303,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1323,8 +1323,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1333,38 +1334,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1372,7 +1375,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1381,7 +1384,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1409,12 +1412,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1428,7 +1431,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1439,7 +1442,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1449,19 +1452,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/static-array.debug.wat b/tests/compiler/std/static-array.debug.wat index e01afe16c2..e9e29fe286 100644 --- a/tests/compiler/std/static-array.debug.wat +++ b/tests/compiler/std/static-array.debug.wat @@ -1954,22 +1954,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1991,6 +1975,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/static-array.release.wat b/tests/compiler/std/static-array.release.wat index d502efedf2..5be99d0f5a 100644 --- a/tests/compiler/std/static-array.release.wat +++ b/tests/compiler/std/static-array.release.wat @@ -1465,7 +1465,7 @@ local.tee $2 i32.const 20 i32.sub - local.tee $6 + local.tee $4 i32.load $0 i32.const -4 i32.and @@ -1473,14 +1473,14 @@ i32.sub i32.le_u if - local.get $6 + local.get $4 local.get $3 i32.store $0 offset=16 local.get $2 local.set $1 br $__inlined_func$~lib/rt/itcms/__renew end - local.get $6 + local.get $4 i32.load $0 offset=12 local.set $7 local.get $3 @@ -1545,7 +1545,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $5 local.get $3 i32.const 16 i32.add @@ -1560,7 +1560,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.const 12 local.get $1 i32.const 19 @@ -1580,8 +1580,9 @@ if memory.size $0 local.tee $1 + local.get $8 i32.const 4 - local.get $4 + local.get $5 i32.load $0 offset=1568 local.get $1 i32.const 16 @@ -1590,38 +1591,40 @@ i32.sub i32.ne i32.shl - local.get $8 - i32.const 1 - i32.const 27 - local.get $8 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $8 - local.get $8 + local.tee $6 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $6 + i32.const 1 + i32.const 27 + local.get $6 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $6 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $5 + local.tee $6 local.get $1 - local.get $5 + local.get $6 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $5 + local.get $6 memory.grow $0 i32.const 0 i32.lt_s @@ -1629,7 +1632,7 @@ unreachable end end - local.get $4 + local.get $5 local.get $1 i32.const 16 i32.shl @@ -1638,7 +1641,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $5 local.get $8 call $~lib/rt/tlsf/searchBlock local.tee $1 @@ -1666,12 +1669,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 local.get $1 call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $5 + local.set $6 local.get $8 i32.const 4 i32.add @@ -1685,7 +1688,7 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $6 i32.const -4 i32.and local.get $8 @@ -1696,7 +1699,7 @@ if local.get $1 local.get $8 - local.get $5 + local.get $6 i32.const 2 i32.and i32.or @@ -1706,19 +1709,19 @@ i32.add local.get $8 i32.add - local.tee $5 + local.tee $6 local.get $9 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $5 + local.get $6 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $5 + local.get $6 i32.const -2 i32.and i32.store $0 @@ -1730,8 +1733,8 @@ i32.const -4 i32.and i32.add - local.tee $4 - local.get $4 + local.tee $5 + local.get $5 i32.load $0 i32.const -3 i32.and @@ -1744,26 +1747,26 @@ local.get $3 i32.store $0 offset=16 global.get $~lib/rt/itcms/fromSpace - local.tee $4 + local.tee $5 i32.load $0 offset=8 - local.set $5 + local.set $6 local.get $1 - local.get $4 + local.get $5 global.get $~lib/rt/itcms/white i32.or i32.store $0 offset=4 local.get $1 - local.get $5 + local.get $6 i32.store $0 offset=8 - local.get $5 + local.get $6 local.get $1 - local.get $5 + local.get $6 i32.load $0 offset=4 i32.const 3 i32.and i32.or i32.store $0 offset=4 - local.get $4 + local.get $5 local.get $1 i32.store $0 offset=8 global.get $~lib/rt/itcms/total @@ -1785,7 +1788,7 @@ local.get $1 local.get $2 local.get $3 - local.get $6 + local.get $4 i32.load $0 offset=16 local.tee $4 local.get $3 diff --git a/tests/compiler/std/staticarray.debug.wat b/tests/compiler/std/staticarray.debug.wat index a3c675da3c..93273d1928 100644 --- a/tests/compiler/std/staticarray.debug.wat +++ b/tests/compiler/std/staticarray.debug.wat @@ -2015,22 +2015,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2052,6 +2036,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/staticarray.release.wat b/tests/compiler/std/staticarray.release.wat index a04bc8b7d8..438c83e5d5 100644 --- a/tests/compiler/std/staticarray.release.wat +++ b/tests/compiler/std/staticarray.release.wat @@ -1387,6 +1387,7 @@ if memory.size $0 local.tee $1 + local.get $3 i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1397,22 +1398,24 @@ i32.sub i32.ne i32.shl - local.get $3 - i32.const 1 - i32.const 27 - local.get $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $3 - local.get $3 + local.tee $2 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $2 + i32.const 1 + i32.const 27 + local.get $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $2 + end i32.const 65535 i32.add i32.const -65536 @@ -1478,7 +1481,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $4 + local.set $2 local.get $3 i32.const 4 i32.add @@ -1492,18 +1495,18 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $2 i32.const -4 i32.and local.get $3 i32.sub - local.tee $2 + local.tee $4 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $4 + local.get $2 i32.const 2 i32.and i32.or @@ -1513,19 +1516,19 @@ i32.add local.get $3 i32.add - local.tee $3 - local.get $2 + local.tee $2 + local.get $4 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $3 + local.get $2 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $4 + local.get $2 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/string-casemapping.debug.wat b/tests/compiler/std/string-casemapping.debug.wat index 52f384ab23..8ff8bb0d05 100644 --- a/tests/compiler/std/string-casemapping.debug.wat +++ b/tests/compiler/std/string-casemapping.debug.wat @@ -2106,22 +2106,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2143,6 +2127,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/string-casemapping.release.wat b/tests/compiler/std/string-casemapping.release.wat index 07b351bde9..e042af53ba 100644 --- a/tests/compiler/std/string-casemapping.release.wat +++ b/tests/compiler/std/string-casemapping.release.wat @@ -1719,7 +1719,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1734,7 +1734,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1754,8 +1754,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1764,38 +1765,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1803,7 +1806,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1812,7 +1815,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1840,12 +1843,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1859,7 +1862,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1870,7 +1873,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1880,19 +1883,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/string-encoding.debug.wat b/tests/compiler/std/string-encoding.debug.wat index 4460a39e87..53baf231a5 100644 --- a/tests/compiler/std/string-encoding.debug.wat +++ b/tests/compiler/std/string-encoding.debug.wat @@ -1945,22 +1945,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1982,6 +1966,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/string-encoding.release.wat b/tests/compiler/std/string-encoding.release.wat index abe6d3822a..f38daf34fc 100644 --- a/tests/compiler/std/string-encoding.release.wat +++ b/tests/compiler/std/string-encoding.release.wat @@ -1306,7 +1306,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1321,7 +1321,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1341,8 +1341,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1351,38 +1352,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1390,7 +1393,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1399,7 +1402,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1427,12 +1430,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1446,7 +1449,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1457,7 +1460,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1467,19 +1470,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/string.debug.wat b/tests/compiler/std/string.debug.wat index f0e0fa679f..bc04b64a18 100644 --- a/tests/compiler/std/string.debug.wat +++ b/tests/compiler/std/string.debug.wat @@ -2536,22 +2536,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2573,6 +2557,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/string.release.wat b/tests/compiler/std/string.release.wat index a5c74289b8..e024eaa3ed 100644 --- a/tests/compiler/std/string.release.wat +++ b/tests/compiler/std/string.release.wat @@ -2298,7 +2298,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -2313,7 +2313,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -2333,8 +2333,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -2343,38 +2344,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -2382,7 +2385,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -2391,7 +2394,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -2419,12 +2422,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -2438,7 +2441,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -2449,7 +2452,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -2459,19 +2462,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/symbol.debug.wat b/tests/compiler/std/symbol.debug.wat index e97c478ab3..c0035e3635 100644 --- a/tests/compiler/std/symbol.debug.wat +++ b/tests/compiler/std/symbol.debug.wat @@ -1974,22 +1974,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2011,6 +1995,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/symbol.release.wat b/tests/compiler/std/symbol.release.wat index 5a815c1b93..e5324e4b6b 100644 --- a/tests/compiler/std/symbol.release.wat +++ b/tests/compiler/std/symbol.release.wat @@ -1369,7 +1369,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1384,7 +1384,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1404,8 +1404,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1414,38 +1415,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1453,7 +1456,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1462,7 +1465,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1490,12 +1493,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1509,7 +1512,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1520,7 +1523,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1530,19 +1533,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index c1cb45a49d..3d1643f8b4 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -2283,22 +2283,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2320,6 +2304,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/typedarray.release.wat b/tests/compiler/std/typedarray.release.wat index a321d5a075..ae671ce8fe 100644 --- a/tests/compiler/std/typedarray.release.wat +++ b/tests/compiler/std/typedarray.release.wat @@ -1903,6 +1903,7 @@ if memory.size $0 local.tee $1 + local.get $3 i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1913,22 +1914,24 @@ i32.sub i32.ne i32.shl - local.get $3 - i32.const 1 - i32.const 27 - local.get $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $3 - local.get $3 + local.tee $2 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $2 + i32.const 1 + i32.const 27 + local.get $2 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $2 + end i32.const 65535 i32.add i32.const -65536 @@ -1994,7 +1997,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $4 + local.set $2 local.get $3 i32.const 4 i32.add @@ -2008,18 +2011,18 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $2 i32.const -4 i32.and local.get $3 i32.sub - local.tee $2 + local.tee $4 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $4 + local.get $2 i32.const 2 i32.and i32.or @@ -2029,19 +2032,19 @@ i32.add local.get $3 i32.add - local.tee $3 - local.get $2 + local.tee $2 + local.get $4 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $3 + local.get $2 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $4 + local.get $2 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/uri.debug.wat b/tests/compiler/std/uri.debug.wat index 2ebe24dff2..2964c24d61 100644 --- a/tests/compiler/std/uri.debug.wat +++ b/tests/compiler/std/uri.debug.wat @@ -1988,22 +1988,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2025,6 +2009,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/std/uri.release.wat b/tests/compiler/std/uri.release.wat index 19c6803f62..1afc83fa9e 100644 --- a/tests/compiler/std/uri.release.wat +++ b/tests/compiler/std/uri.release.wat @@ -1386,7 +1386,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1401,7 +1401,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1421,8 +1421,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1431,38 +1432,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1470,7 +1473,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1479,7 +1482,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1507,12 +1510,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1526,7 +1529,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1537,7 +1540,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1547,19 +1550,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/super-inline.debug.wat b/tests/compiler/super-inline.debug.wat index f308e52d90..73694af3ad 100644 --- a/tests/compiler/super-inline.debug.wat +++ b/tests/compiler/super-inline.debug.wat @@ -1913,22 +1913,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -1950,6 +1934,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/super-inline.release.wat b/tests/compiler/super-inline.release.wat index 19e7500ee8..01a5f720e5 100644 --- a/tests/compiler/super-inline.release.wat +++ b/tests/compiler/super-inline.release.wat @@ -1203,6 +1203,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1213,7 +1215,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/templateliteral.debug.wat b/tests/compiler/templateliteral.debug.wat index df057be5d8..b4a1c473a3 100644 --- a/tests/compiler/templateliteral.debug.wat +++ b/tests/compiler/templateliteral.debug.wat @@ -2094,22 +2094,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2131,6 +2115,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/templateliteral.release.wat b/tests/compiler/templateliteral.release.wat index 9f8bf21cc3..0bb25866a9 100644 --- a/tests/compiler/templateliteral.release.wat +++ b/tests/compiler/templateliteral.release.wat @@ -1366,7 +1366,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $4 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1381,7 +1381,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const 12 local.get $2 i32.const 19 @@ -1401,8 +1401,9 @@ if memory.size $0 local.tee $2 + local.get $5 i32.const 4 - local.get $4 + local.get $3 i32.load $0 offset=1568 local.get $2 i32.const 16 @@ -1411,38 +1412,40 @@ i32.sub i32.ne i32.shl - local.get $5 - i32.const 1 - i32.const 27 - local.get $5 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub i32.add - local.get $5 - local.get $5 + local.tee $4 i32.const 536870910 i32.lt_u - select - i32.add + if (result i32) + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + else + local.get $4 + end i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $4 local.get $2 - local.get $3 + local.get $4 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $4 memory.grow $0 i32.const 0 i32.lt_s @@ -1450,7 +1453,7 @@ unreachable end end - local.get $4 + local.get $3 local.get $2 i32.const 16 i32.shl @@ -1459,7 +1462,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $4 + local.get $3 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1487,12 +1490,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $3 + local.set $4 local.get $5 i32.const 4 i32.add @@ -1506,7 +1509,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const -4 i32.and local.get $5 @@ -1517,7 +1520,7 @@ if local.get $2 local.get $5 - local.get $3 + local.get $4 i32.const 2 i32.and i32.or @@ -1527,19 +1530,19 @@ i32.add local.get $5 i32.add - local.tee $3 + local.tee $4 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $4 local.get $3 + local.get $4 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $3 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/typeof.debug.wat b/tests/compiler/typeof.debug.wat index 09f0b882ed..0c49daea4b 100644 --- a/tests/compiler/typeof.debug.wat +++ b/tests/compiler/typeof.debug.wat @@ -2052,22 +2052,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2089,6 +2073,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/typeof.release.wat b/tests/compiler/typeof.release.wat index cd688379c0..2f7a48acd1 100644 --- a/tests/compiler/typeof.release.wat +++ b/tests/compiler/typeof.release.wat @@ -1219,6 +1219,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1229,7 +1231,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and diff --git a/tests/compiler/while.debug.wat b/tests/compiler/while.debug.wat index 2e2d3d5025..bc1b1980ee 100644 --- a/tests/compiler/while.debug.wat +++ b/tests/compiler/while.debug.wat @@ -2335,22 +2335,6 @@ (local $pagesAfter i32) i32.const 0 drop - local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end memory.size $0 local.set $pagesBefore local.get $size @@ -2372,6 +2356,22 @@ i32.add local.set $size local.get $size + i32.const 536870910 + i32.lt_u + if + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $size + end + local.get $size i32.const 65535 i32.add i32.const 65535 diff --git a/tests/compiler/while.release.wat b/tests/compiler/while.release.wat index 1c6e3ebbe4..c34d8a74e5 100644 --- a/tests/compiler/while.release.wat +++ b/tests/compiler/while.release.wat @@ -1191,6 +1191,8 @@ if memory.size $0 local.tee $1 + i32.const 1 + i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1201,7 +1203,22 @@ i32.sub i32.ne i32.shl - i32.const 65563 + i32.const 28 + i32.add + local.tee $3 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + local.get $3 + i32.add + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + i32.const 65535 i32.add i32.const -65536 i32.and From 52b6713e70e10a718b04d13fc9017152301892f7 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Fri, 28 Apr 2023 22:35:10 +0200 Subject: [PATCH 3/6] Revert "fix: add BLOCK_OVERHEAD before round size" This reverts commit 7b7bf0fd51270e835c9fd55bfe7767681262f41c. --- std/assembly/rt/tlsf.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index ebb18a7111..1d25919168 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -427,16 +427,16 @@ function growMemory(root: Root, size: usize): void { unreachable(); return; } - // and additional BLOCK_OVERHEAD must be taken into account. If we are going - // to merge with the tail block, that's one time, otherwise it's two times. - let pagesBefore = memory.size(); - size += BLOCK_OVERHEAD << usize((pagesBefore << 16) - BLOCK_OVERHEAD != changetype(GETTAIL(root))); // Here, both rounding performed in searchBlock ... const halfMaxSize = BLOCK_MAXSIZE >> 1; if (size < halfMaxSize) { // don't round last fl const invRound = (sizeof() * 8 - 1) - SL_BITS; - size += (1 << (invRound - clz(size))) - 1; // size should be larger than 15 + size += (1 << (invRound - clz(size))) - 1; } + // and additional BLOCK_OVERHEAD must be taken into account. If we are going + // to merge with the tail block, that's one time, otherwise it's two times. + let pagesBefore = memory.size(); + size += BLOCK_OVERHEAD << usize((pagesBefore << 16) - BLOCK_OVERHEAD != changetype(GETTAIL(root))); let pagesNeeded = (((size + 0xffff) & ~0xffff) >>> 16); let pagesWanted = max(pagesBefore, pagesNeeded); // double memory if (memory.grow(pagesWanted) < 0) { From 5e6e17f2befb808649817e8889b70bba9e147676 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Fri, 28 Apr 2023 22:44:02 +0200 Subject: [PATCH 4/6] refactor fix --- std/assembly/rt/tlsf.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 1d25919168..298a0eb861 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -307,6 +307,15 @@ function removeBlock(root: Root, block: Block): void { // must perform those updates. } +function roundSize(size: usize): usize { + const halfMaxSize = BLOCK_MAXSIZE >> 1; // don't round last fl + const inv: usize = sizeof() * 8 - 1; + const invRound = inv - SL_BITS; + return size < halfMaxSize + ? size + (1 << (invRound - clz(size))) - 1 + : size; +} + /** Searches for a free block of at least the specified size. */ function searchBlock(root: Root, size: usize): Block | null { // size was already asserted by caller @@ -317,13 +326,8 @@ function searchBlock(root: Root, size: usize): Block | null { fl = 0; sl = (size >> AL_BITS); } else { - const halfMaxSize = BLOCK_MAXSIZE >> 1; // don't round last fl - const inv: usize = sizeof() * 8 - 1; - const invRound = inv - SL_BITS; - let requestSize = size < halfMaxSize - ? size + (1 << (invRound - clz(size))) - 1 - : size; - fl = inv - clz(requestSize); + const requestSize = roundSize(size); + fl = sizeof() * 8 - 1 - clz(requestSize); sl = ((requestSize >> (fl - SL_BITS)) ^ (1 << SL_BITS)); fl -= SB_BITS - 1; } @@ -428,10 +432,8 @@ function growMemory(root: Root, size: usize): void { return; } // Here, both rounding performed in searchBlock ... - const halfMaxSize = BLOCK_MAXSIZE >> 1; - if (size < halfMaxSize) { // don't round last fl - const invRound = (sizeof() * 8 - 1) - SL_BITS; - size += (1 << (invRound - clz(size))) - 1; + if (size > SB_SIZE) { // don't round last fl + size = roundSize(size); } // and additional BLOCK_OVERHEAD must be taken into account. If we are going // to merge with the tail block, that's one time, otherwise it's two times. From 4ac70f7a29772562c063ed3041167e752be143dd Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Fri, 28 Apr 2023 22:44:13 +0200 Subject: [PATCH 5/6] update test --- .../bindings/noExportRuntime.debug.wat | 87 ++++++------- .../bindings/noExportRuntime.release.wat | 88 +++++++------- tests/compiler/call-super.debug.wat | 87 ++++++------- tests/compiler/call-super.release.wat | 88 +++++++------- tests/compiler/class-implements.debug.wat | 87 ++++++------- tests/compiler/class-implements.release.wat | 88 +++++++------- .../compiler/class-overloading-cast.debug.wat | 87 ++++++------- .../class-overloading-cast.release.wat | 33 ++--- tests/compiler/class-overloading.debug.wat | 87 ++++++------- tests/compiler/class-overloading.release.wat | 33 ++--- tests/compiler/class.debug.wat | 87 ++++++------- tests/compiler/class.release.wat | 88 +++++++------- tests/compiler/constructor.debug.wat | 87 ++++++------- tests/compiler/constructor.release.wat | 88 +++++++------- tests/compiler/do.debug.wat | 87 ++++++------- tests/compiler/do.release.wat | 33 ++--- tests/compiler/duplicate-fields.debug.wat | 87 ++++++------- tests/compiler/duplicate-fields.release.wat | 88 +++++++------- tests/compiler/empty-exportruntime.debug.wat | 87 ++++++------- .../compiler/empty-exportruntime.release.wat | 88 +++++++------- tests/compiler/empty-new.debug.wat | 89 +++++++------- tests/compiler/empty-new.release.wat | 33 ++--- .../compiler/exportstar-rereexport.debug.wat | 87 ++++++------- .../exportstar-rereexport.release.wat | 33 ++--- .../compiler/extends-baseaggregate.debug.wat | 87 ++++++------- .../extends-baseaggregate.release.wat | 88 +++++++------- tests/compiler/extends-recursive.debug.wat | 89 +++++++------- tests/compiler/extends-recursive.release.wat | 88 +++++++------- tests/compiler/field-initialization.debug.wat | 87 ++++++------- .../compiler/field-initialization.release.wat | 88 +++++++------- tests/compiler/field.debug.wat | 89 +++++++------- tests/compiler/field.release.wat | 88 +++++++------- tests/compiler/for.debug.wat | 87 ++++++------- tests/compiler/for.release.wat | 33 ++--- tests/compiler/function-call.debug.wat | 87 ++++++------- tests/compiler/function-call.release.wat | 33 ++--- tests/compiler/function-expression.debug.wat | 87 ++++++------- .../compiler/function-expression.release.wat | 33 ++--- tests/compiler/getter-call.debug.wat | 87 ++++++------- tests/compiler/getter-call.release.wat | 33 ++--- tests/compiler/heap.debug.wat | 87 ++++++------- tests/compiler/heap.release.wat | 70 ++++++----- tests/compiler/infer-array.debug.wat | 87 ++++++------- tests/compiler/infer-array.release.wat | 88 +++++++------- tests/compiler/infer-generic.debug.wat | 87 ++++++------- tests/compiler/infer-generic.release.wat | 88 +++++++------- tests/compiler/inlining.debug.wat | 87 ++++++------- tests/compiler/inlining.release.wat | 88 +++++++------- tests/compiler/instanceof.debug.wat | 87 ++++++------- tests/compiler/instanceof.release.wat | 33 ++--- tests/compiler/issues/1095.debug.wat | 87 ++++++------- tests/compiler/issues/1095.release.wat | 88 +++++++------- tests/compiler/issues/1225.debug.wat | 87 ++++++------- tests/compiler/issues/1225.release.wat | 33 ++--- tests/compiler/issues/1699.debug.wat | 87 ++++++------- tests/compiler/issues/1699.release.wat | 88 +++++++------- tests/compiler/issues/2166.debug.wat | 87 ++++++------- tests/compiler/issues/2166.release.wat | 33 ++--- tests/compiler/issues/2322/index.debug.wat | 87 ++++++------- tests/compiler/issues/2322/index.release.wat | 88 +++++++------- tests/compiler/issues/2622.debug.wat | 87 ++++++------- tests/compiler/issues/2622.release.wat | 33 ++--- tests/compiler/logical.debug.wat | 87 ++++++------- tests/compiler/logical.release.wat | 33 ++--- tests/compiler/managed-cast.debug.wat | 87 ++++++------- tests/compiler/managed-cast.release.wat | 33 ++--- tests/compiler/new.debug.wat | 87 ++++++------- tests/compiler/new.release.wat | 33 ++--- tests/compiler/object-literal.debug.wat | 87 ++++++------- tests/compiler/object-literal.release.wat | 74 ++++++------ .../optional-typeparameters.debug.wat | 87 ++++++------- .../optional-typeparameters.release.wat | 33 ++--- tests/compiler/reexport.debug.wat | 87 ++++++------- tests/compiler/reexport.release.wat | 33 ++--- tests/compiler/rereexport.debug.wat | 87 ++++++------- tests/compiler/rereexport.release.wat | 33 ++--- tests/compiler/resolve-access.debug.wat | 87 ++++++------- tests/compiler/resolve-access.release.wat | 88 +++++++------- tests/compiler/resolve-binary.debug.wat | 87 ++++++------- tests/compiler/resolve-binary.release.wat | 88 +++++++------- .../compiler/resolve-elementaccess.debug.wat | 87 ++++++------- .../resolve-elementaccess.release.wat | 88 +++++++------- .../resolve-function-expression.debug.wat | 87 ++++++------- .../resolve-function-expression.release.wat | 110 +++++++++-------- tests/compiler/resolve-new.debug.wat | 87 ++++++------- tests/compiler/resolve-new.release.wat | 33 ++--- .../compiler/resolve-propertyaccess.debug.wat | 87 ++++++------- .../resolve-propertyaccess.release.wat | 88 +++++++------- tests/compiler/resolve-ternary.debug.wat | 87 ++++++------- tests/compiler/resolve-ternary.release.wat | 88 +++++++------- tests/compiler/resolve-unary.debug.wat | 87 ++++++------- tests/compiler/resolve-unary.release.wat | 88 +++++++------- tests/compiler/return-unreachable.debug.wat | 87 ++++++------- tests/compiler/return-unreachable.release.wat | 88 +++++++------- .../compiler/rt/alloc-large-memory.debug.wat | 75 ++++++------ .../rt/alloc-large-memory.release.wat | 55 +++++---- tests/compiler/rt/finalize.debug.wat | 87 ++++++------- tests/compiler/rt/finalize.release.wat | 33 ++--- .../rt/runtime-incremental-export.debug.wat | 87 ++++++------- .../rt/runtime-incremental-export.release.wat | 88 +++++++------- .../rt/runtime-minimal-export.debug.wat | 87 ++++++------- .../rt/runtime-minimal-export.release.wat | 88 +++++++------- tests/compiler/simd.debug.wat | 89 +++++++------- tests/compiler/simd.release.wat | 74 ++++++------ tests/compiler/std/array-literal.debug.wat | 87 ++++++------- tests/compiler/std/array-literal.release.wat | 88 +++++++------- tests/compiler/std/array.debug.wat | 87 ++++++------- tests/compiler/std/array.release.wat | 74 ++++++------ tests/compiler/std/arraybuffer.debug.wat | 87 ++++++------- tests/compiler/std/arraybuffer.release.wat | 88 +++++++------- tests/compiler/std/dataview.debug.wat | 87 ++++++------- tests/compiler/std/dataview.release.wat | 88 +++++++------- tests/compiler/std/date.debug.wat | 87 ++++++------- tests/compiler/std/date.release.wat | 88 +++++++------- tests/compiler/std/map.debug.wat | 87 ++++++------- tests/compiler/std/map.release.wat | 88 +++++++------- tests/compiler/std/new.debug.wat | 87 ++++++------- tests/compiler/std/new.release.wat | 33 ++--- .../std/operator-overloading.debug.wat | 87 ++++++------- .../std/operator-overloading.release.wat | 33 ++--- tests/compiler/std/set.debug.wat | 87 ++++++------- tests/compiler/std/set.release.wat | 88 +++++++------- tests/compiler/std/static-array.debug.wat | 87 ++++++------- tests/compiler/std/static-array.release.wat | 114 +++++++++--------- tests/compiler/std/staticarray.debug.wat | 87 ++++++------- tests/compiler/std/staticarray.release.wat | 74 ++++++------ .../compiler/std/string-casemapping.debug.wat | 87 ++++++------- .../std/string-casemapping.release.wat | 88 +++++++------- tests/compiler/std/string-encoding.debug.wat | 87 ++++++------- .../compiler/std/string-encoding.release.wat | 88 +++++++------- tests/compiler/std/string.debug.wat | 87 ++++++------- tests/compiler/std/string.release.wat | 88 +++++++------- tests/compiler/std/symbol.debug.wat | 87 ++++++------- tests/compiler/std/symbol.release.wat | 88 +++++++------- tests/compiler/std/typedarray.debug.wat | 87 ++++++------- tests/compiler/std/typedarray.release.wat | 74 ++++++------ tests/compiler/std/uri.debug.wat | 87 ++++++------- tests/compiler/std/uri.release.wat | 88 +++++++------- tests/compiler/super-inline.debug.wat | 87 ++++++------- tests/compiler/super-inline.release.wat | 33 ++--- tests/compiler/templateliteral.debug.wat | 87 ++++++------- tests/compiler/templateliteral.release.wat | 88 +++++++------- tests/compiler/throw.debug.wat | 8 +- tests/compiler/throw.release.wat | 6 +- tests/compiler/typeof.debug.wat | 87 ++++++------- tests/compiler/typeof.release.wat | 33 ++--- tests/compiler/while.debug.wat | 89 +++++++------- tests/compiler/while.release.wat | 33 ++--- 148 files changed, 5553 insertions(+), 5731 deletions(-) diff --git a/tests/compiler/bindings/noExportRuntime.debug.wat b/tests/compiler/bindings/noExportRuntime.debug.wat index 12861353dc..d629548a71 100644 --- a/tests/compiler/bindings/noExportRuntime.debug.wat +++ b/tests/compiler/bindings/noExportRuntime.debug.wat @@ -1062,7 +1062,7 @@ if i32.const 0 i32.const 512 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1108,7 +1108,7 @@ if i32.const 0 i32.const 512 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1141,7 +1141,7 @@ if i32.const 0 i32.const 512 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1385,7 +1385,7 @@ if i32.const 0 i32.const 512 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1714,7 +1714,7 @@ if i32.const 176 i32.const 512 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1723,6 +1723,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1752,24 +1772,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1807,7 +1816,7 @@ if i32.const 0 i32.const 512 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1878,7 +1887,7 @@ if i32.const 0 i32.const 512 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1941,6 +1950,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1962,22 +1979,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2043,7 +2044,7 @@ if i32.const 0 i32.const 512 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2158,7 +2159,7 @@ if i32.const 0 i32.const 512 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2178,7 +2179,7 @@ if i32.const 0 i32.const 512 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/bindings/noExportRuntime.release.wat b/tests/compiler/bindings/noExportRuntime.release.wat index 42395d225e..9cd8ab715a 100644 --- a/tests/compiler/bindings/noExportRuntime.release.wat +++ b/tests/compiler/bindings/noExportRuntime.release.wat @@ -674,7 +674,7 @@ if i32.const 0 i32.const 1536 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -699,7 +699,7 @@ if i32.const 0 i32.const 1536 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -727,7 +727,7 @@ if i32.const 0 i32.const 1536 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1094,7 +1094,7 @@ if i32.const 0 i32.const 1536 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1178,7 +1178,7 @@ if i32.const 0 i32.const 1536 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1230,7 +1230,7 @@ if i32.const 0 i32.const 1536 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1319,7 +1319,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1329,12 +1329,12 @@ if i32.const 1200 i32.const 1536 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1355,50 +1355,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1406,7 +1410,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1415,7 +1419,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1423,7 +1427,7 @@ if i32.const 0 i32.const 1536 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1438,17 +1442,17 @@ if i32.const 0 i32.const 1536 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1457,12 +1461,12 @@ if i32.const 0 i32.const 1536 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1473,7 +1477,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1483,19 +1487,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/call-super.debug.wat b/tests/compiler/call-super.debug.wat index bb0fbf5be7..d87cce208b 100644 --- a/tests/compiler/call-super.debug.wat +++ b/tests/compiler/call-super.debug.wat @@ -1037,7 +1037,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1083,7 +1083,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1116,7 +1116,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1360,7 +1360,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1689,7 +1689,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1698,6 +1698,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1727,24 +1747,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1782,7 +1791,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1853,7 +1862,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1916,6 +1925,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1937,22 +1954,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2018,7 +2019,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2133,7 +2134,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2153,7 +2154,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/call-super.release.wat b/tests/compiler/call-super.release.wat index 6b0e435383..8d78be23e0 100644 --- a/tests/compiler/call-super.release.wat +++ b/tests/compiler/call-super.release.wat @@ -621,7 +621,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -646,7 +646,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -674,7 +674,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1041,7 +1041,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 1440 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1177,7 +1177,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1266,7 +1266,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1276,12 +1276,12 @@ if i32.const 1104 i32.const 1440 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1302,50 +1302,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1353,7 +1357,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1362,7 +1366,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1370,7 +1374,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1385,17 +1389,17 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1404,12 +1408,12 @@ if i32.const 0 i32.const 1440 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1420,7 +1424,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1430,19 +1434,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/class-implements.debug.wat b/tests/compiler/class-implements.debug.wat index 9f22c76fac..efe07a0255 100644 --- a/tests/compiler/class-implements.debug.wat +++ b/tests/compiler/class-implements.debug.wat @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1086,7 +1086,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1119,7 +1119,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1363,7 +1363,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1692,7 +1692,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1701,6 +1701,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1730,24 +1750,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1785,7 +1794,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1856,7 +1865,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1919,6 +1928,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1940,22 +1957,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2021,7 +2022,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2136,7 +2137,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2156,7 +2157,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-implements.release.wat b/tests/compiler/class-implements.release.wat index faeba1b411..fc679c7dc0 100644 --- a/tests/compiler/class-implements.release.wat +++ b/tests/compiler/class-implements.release.wat @@ -670,7 +670,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -695,7 +695,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -723,7 +723,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1090,7 +1090,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1174,7 +1174,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1226,7 +1226,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1315,7 +1315,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1325,12 +1325,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1351,50 +1351,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1402,7 +1406,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1411,7 +1415,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1419,7 +1423,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1434,17 +1438,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1453,12 +1457,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1469,7 +1473,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1479,19 +1483,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/class-overloading-cast.debug.wat b/tests/compiler/class-overloading-cast.debug.wat index 6720450fb6..5bae901b5f 100644 --- a/tests/compiler/class-overloading-cast.debug.wat +++ b/tests/compiler/class-overloading-cast.debug.wat @@ -1046,7 +1046,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1092,7 +1092,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1369,7 +1369,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1698,7 +1698,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1707,6 +1707,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1736,24 +1756,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1791,7 +1800,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1862,7 +1871,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1925,6 +1934,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1946,22 +1963,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2027,7 +2028,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2142,7 +2143,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2162,7 +2163,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-overloading-cast.release.wat b/tests/compiler/class-overloading-cast.release.wat index 478f4c6602..14a24afc68 100644 --- a/tests/compiler/class-overloading-cast.release.wat +++ b/tests/compiler/class-overloading-cast.release.wat @@ -658,7 +658,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -683,7 +683,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -711,7 +711,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1078,7 +1078,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1145,7 +1145,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1229,8 +1229,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1241,22 +1239,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1295,7 +1278,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1310,7 +1293,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-overloading.debug.wat b/tests/compiler/class-overloading.debug.wat index eda76bb665..49e9025b55 100644 --- a/tests/compiler/class-overloading.debug.wat +++ b/tests/compiler/class-overloading.debug.wat @@ -1050,7 +1050,7 @@ if i32.const 0 i32.const 400 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1096,7 +1096,7 @@ if i32.const 0 i32.const 400 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1129,7 +1129,7 @@ if i32.const 0 i32.const 400 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1373,7 +1373,7 @@ if i32.const 0 i32.const 400 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1702,7 +1702,7 @@ if i32.const 64 i32.const 400 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1711,6 +1711,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1740,24 +1760,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1795,7 +1804,7 @@ if i32.const 0 i32.const 400 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1866,7 +1875,7 @@ if i32.const 0 i32.const 400 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1929,6 +1938,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1950,22 +1967,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2031,7 +2032,7 @@ if i32.const 0 i32.const 400 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2146,7 +2147,7 @@ if i32.const 0 i32.const 400 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2166,7 +2167,7 @@ if i32.const 0 i32.const 400 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class-overloading.release.wat b/tests/compiler/class-overloading.release.wat index 2fd778bd2a..8b358295ca 100644 --- a/tests/compiler/class-overloading.release.wat +++ b/tests/compiler/class-overloading.release.wat @@ -680,7 +680,7 @@ if i32.const 0 i32.const 1424 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -705,7 +705,7 @@ if i32.const 0 i32.const 1424 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -733,7 +733,7 @@ if i32.const 0 i32.const 1424 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1100,7 +1100,7 @@ if i32.const 0 i32.const 1424 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1167,7 +1167,7 @@ if i32.const 0 i32.const 1424 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1251,8 +1251,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1263,22 +1261,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1317,7 +1300,7 @@ if i32.const 0 i32.const 1424 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1332,7 +1315,7 @@ if i32.const 0 i32.const 1424 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class.debug.wat b/tests/compiler/class.debug.wat index 8ed8a94538..97363304a7 100644 --- a/tests/compiler/class.debug.wat +++ b/tests/compiler/class.debug.wat @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1164,7 +1164,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1197,7 +1197,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1441,7 +1441,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1770,7 +1770,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1779,6 +1779,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1808,24 +1828,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1863,7 +1872,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1934,7 +1943,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1997,6 +2006,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2018,22 +2035,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2099,7 +2100,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2214,7 +2215,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2234,7 +2235,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/class.release.wat b/tests/compiler/class.release.wat index 2fad2a7e61..a6e51d1ca7 100644 --- a/tests/compiler/class.release.wat +++ b/tests/compiler/class.release.wat @@ -627,7 +627,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -652,7 +652,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -680,7 +680,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1047,7 +1047,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1131,7 +1131,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1183,7 +1183,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1272,7 +1272,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1282,12 +1282,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1308,50 +1308,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1359,7 +1363,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1368,7 +1372,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1376,7 +1380,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1391,17 +1395,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1410,12 +1414,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1426,7 +1430,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1436,19 +1440,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/constructor.debug.wat b/tests/compiler/constructor.debug.wat index 9216498de6..a65369e7b8 100644 --- a/tests/compiler/constructor.debug.wat +++ b/tests/compiler/constructor.debug.wat @@ -1046,7 +1046,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1092,7 +1092,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1369,7 +1369,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1698,7 +1698,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1707,6 +1707,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1736,24 +1756,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1791,7 +1800,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1862,7 +1871,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1925,6 +1934,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1946,22 +1963,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2027,7 +2028,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2142,7 +2143,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2162,7 +2163,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/constructor.release.wat b/tests/compiler/constructor.release.wat index 5dd74c0ea1..48f2049abe 100644 --- a/tests/compiler/constructor.release.wat +++ b/tests/compiler/constructor.release.wat @@ -684,7 +684,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -709,7 +709,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -737,7 +737,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1104,7 +1104,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1188,7 +1188,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1240,7 +1240,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1329,7 +1329,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1339,12 +1339,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1365,50 +1365,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1416,7 +1420,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1425,7 +1429,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1433,7 +1437,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1448,17 +1452,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1467,12 +1471,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1483,7 +1487,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1493,19 +1497,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/do.debug.wat b/tests/compiler/do.debug.wat index 28cbc57b85..6044e3e331 100644 --- a/tests/compiler/do.debug.wat +++ b/tests/compiler/do.debug.wat @@ -1441,7 +1441,7 @@ if i32.const 0 i32.const 400 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1487,7 +1487,7 @@ if i32.const 0 i32.const 400 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1520,7 +1520,7 @@ if i32.const 0 i32.const 400 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1764,7 +1764,7 @@ if i32.const 0 i32.const 400 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2093,7 +2093,7 @@ if i32.const 64 i32.const 400 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2102,6 +2102,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2131,24 +2151,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2186,7 +2195,7 @@ if i32.const 0 i32.const 400 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2257,7 +2266,7 @@ if i32.const 0 i32.const 400 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2320,6 +2329,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2341,22 +2358,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2422,7 +2423,7 @@ if i32.const 0 i32.const 400 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2537,7 +2538,7 @@ if i32.const 0 i32.const 400 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2557,7 +2558,7 @@ if i32.const 0 i32.const 400 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/do.release.wat b/tests/compiler/do.release.wat index 5a45e4bfd3..0bcfedbba6 100644 --- a/tests/compiler/do.release.wat +++ b/tests/compiler/do.release.wat @@ -620,7 +620,7 @@ if i32.const 0 i32.const 1424 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -645,7 +645,7 @@ if i32.const 0 i32.const 1424 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -673,7 +673,7 @@ if i32.const 0 i32.const 1424 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 1424 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1107,7 +1107,7 @@ if i32.const 0 i32.const 1424 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1191,8 +1191,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1203,22 +1201,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1257,7 +1240,7 @@ if i32.const 0 i32.const 1424 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1272,7 +1255,7 @@ if i32.const 0 i32.const 1424 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/duplicate-fields.debug.wat b/tests/compiler/duplicate-fields.debug.wat index 3baed526a1..bdca8f9f99 100644 --- a/tests/compiler/duplicate-fields.debug.wat +++ b/tests/compiler/duplicate-fields.debug.wat @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1086,7 +1086,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1119,7 +1119,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1363,7 +1363,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1692,7 +1692,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1701,6 +1701,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1730,24 +1750,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1785,7 +1794,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1856,7 +1865,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1919,6 +1928,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1940,22 +1957,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2021,7 +2022,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2136,7 +2137,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2156,7 +2157,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/duplicate-fields.release.wat b/tests/compiler/duplicate-fields.release.wat index 5c036eb335..37f5bf4983 100644 --- a/tests/compiler/duplicate-fields.release.wat +++ b/tests/compiler/duplicate-fields.release.wat @@ -634,7 +634,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -659,7 +659,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -687,7 +687,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1054,7 +1054,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1138,7 +1138,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1190,7 +1190,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1279,7 +1279,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1289,12 +1289,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1315,50 +1315,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1366,7 +1370,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1375,7 +1379,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1383,7 +1387,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1398,17 +1402,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1417,12 +1421,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1433,7 +1437,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1443,19 +1447,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/empty-exportruntime.debug.wat b/tests/compiler/empty-exportruntime.debug.wat index 74ed896650..a00bf7a6a5 100644 --- a/tests/compiler/empty-exportruntime.debug.wat +++ b/tests/compiler/empty-exportruntime.debug.wat @@ -1039,7 +1039,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1085,7 +1085,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1362,7 +1362,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1691,7 +1691,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1700,6 +1700,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1729,24 +1749,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1784,7 +1793,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1855,7 +1864,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1918,6 +1927,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1939,22 +1956,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2020,7 +2021,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2135,7 +2136,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2155,7 +2156,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/empty-exportruntime.release.wat b/tests/compiler/empty-exportruntime.release.wat index ad569bd9d1..5a50aa6cf1 100644 --- a/tests/compiler/empty-exportruntime.release.wat +++ b/tests/compiler/empty-exportruntime.release.wat @@ -635,7 +635,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -660,7 +660,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -688,7 +688,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1055,7 +1055,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1139,7 +1139,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1191,7 +1191,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1280,7 +1280,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1290,12 +1290,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1316,50 +1316,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1367,7 +1371,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1376,7 +1380,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1384,7 +1388,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1399,17 +1403,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1418,12 +1422,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1434,7 +1438,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1444,19 +1448,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/empty-new.debug.wat b/tests/compiler/empty-new.debug.wat index b52f87fc68..dbf2a1c810 100644 --- a/tests/compiler/empty-new.debug.wat +++ b/tests/compiler/empty-new.debug.wat @@ -1,6 +1,6 @@ (module - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -1032,7 +1032,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1078,7 +1078,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1111,7 +1111,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1355,7 +1355,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1684,7 +1684,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1693,6 +1693,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1722,24 +1742,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1777,7 +1786,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1848,7 +1857,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1911,6 +1920,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1932,22 +1949,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2013,7 +2014,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2128,7 +2129,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2148,7 +2149,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/empty-new.release.wat b/tests/compiler/empty-new.release.wat index 04804b1681..af3b8bd9f4 100644 --- a/tests/compiler/empty-new.release.wat +++ b/tests/compiler/empty-new.release.wat @@ -617,7 +617,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -642,7 +642,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -670,7 +670,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1037,7 +1037,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1104,7 +1104,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1188,8 +1188,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1200,22 +1198,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1254,7 +1237,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1269,7 +1252,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/exportstar-rereexport.debug.wat b/tests/compiler/exportstar-rereexport.debug.wat index 690306b090..e8465ebf88 100644 --- a/tests/compiler/exportstar-rereexport.debug.wat +++ b/tests/compiler/exportstar-rereexport.debug.wat @@ -1072,7 +1072,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1151,7 +1151,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1395,7 +1395,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1724,7 +1724,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1733,6 +1733,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1762,24 +1782,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1817,7 +1826,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1888,7 +1897,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1951,6 +1960,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1972,22 +1989,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2053,7 +2054,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2168,7 +2169,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2188,7 +2189,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/exportstar-rereexport.release.wat b/tests/compiler/exportstar-rereexport.release.wat index da22a078d6..622828f662 100644 --- a/tests/compiler/exportstar-rereexport.release.wat +++ b/tests/compiler/exportstar-rereexport.release.wat @@ -651,7 +651,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -676,7 +676,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -704,7 +704,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1071,7 +1071,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1138,7 +1138,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1222,8 +1222,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1234,22 +1232,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1288,7 +1271,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1303,7 +1286,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-baseaggregate.debug.wat b/tests/compiler/extends-baseaggregate.debug.wat index 89cc377a38..b997ecd00a 100644 --- a/tests/compiler/extends-baseaggregate.debug.wat +++ b/tests/compiler/extends-baseaggregate.debug.wat @@ -1042,7 +1042,7 @@ if i32.const 0 i32.const 528 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1088,7 +1088,7 @@ if i32.const 0 i32.const 528 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1121,7 +1121,7 @@ if i32.const 0 i32.const 528 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1365,7 +1365,7 @@ if i32.const 0 i32.const 528 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1694,7 +1694,7 @@ if i32.const 192 i32.const 528 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1703,6 +1703,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1732,24 +1752,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1787,7 +1796,7 @@ if i32.const 0 i32.const 528 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1858,7 +1867,7 @@ if i32.const 0 i32.const 528 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1921,6 +1930,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1942,22 +1959,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2023,7 +2024,7 @@ if i32.const 0 i32.const 528 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2138,7 +2139,7 @@ if i32.const 0 i32.const 528 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2158,7 +2159,7 @@ if i32.const 0 i32.const 528 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-baseaggregate.release.wat b/tests/compiler/extends-baseaggregate.release.wat index 8dba9f2522..6777e32bd1 100644 --- a/tests/compiler/extends-baseaggregate.release.wat +++ b/tests/compiler/extends-baseaggregate.release.wat @@ -637,7 +637,7 @@ if i32.const 0 i32.const 1552 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -662,7 +662,7 @@ if i32.const 0 i32.const 1552 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -690,7 +690,7 @@ if i32.const 0 i32.const 1552 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1057,7 +1057,7 @@ if i32.const 0 i32.const 1552 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1141,7 +1141,7 @@ if i32.const 0 i32.const 1552 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1193,7 +1193,7 @@ if i32.const 0 i32.const 1552 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1282,7 +1282,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1292,12 +1292,12 @@ if i32.const 1216 i32.const 1552 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1318,50 +1318,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1369,7 +1373,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1378,7 +1382,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1386,7 +1390,7 @@ if i32.const 0 i32.const 1552 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1401,17 +1405,17 @@ if i32.const 0 i32.const 1552 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1420,12 +1424,12 @@ if i32.const 0 i32.const 1552 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1436,7 +1440,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1446,19 +1450,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/extends-recursive.debug.wat b/tests/compiler/extends-recursive.debug.wat index 2d6cbbf6c3..c899183397 100644 --- a/tests/compiler/extends-recursive.debug.wat +++ b/tests/compiler/extends-recursive.debug.wat @@ -1,6 +1,6 @@ (module - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -1032,7 +1032,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1078,7 +1078,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1111,7 +1111,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1355,7 +1355,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1684,7 +1684,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1693,6 +1693,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1722,24 +1742,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1777,7 +1786,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1848,7 +1857,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1911,6 +1920,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1932,22 +1949,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2013,7 +2014,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2128,7 +2129,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2148,7 +2149,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-recursive.release.wat b/tests/compiler/extends-recursive.release.wat index 62c1f1ec2c..3ca5ea2b9e 100644 --- a/tests/compiler/extends-recursive.release.wat +++ b/tests/compiler/extends-recursive.release.wat @@ -618,7 +618,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -643,7 +643,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -671,7 +671,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1038,7 +1038,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1122,7 +1122,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1174,7 +1174,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1263,7 +1263,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1273,12 +1273,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1299,50 +1299,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1350,7 +1354,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1359,7 +1363,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1367,7 +1371,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1382,17 +1386,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1401,12 +1405,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1417,7 +1421,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1427,19 +1431,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/field-initialization.debug.wat b/tests/compiler/field-initialization.debug.wat index 70fc4cbf86..ef1323b876 100644 --- a/tests/compiler/field-initialization.debug.wat +++ b/tests/compiler/field-initialization.debug.wat @@ -1043,7 +1043,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1089,7 +1089,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1122,7 +1122,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1366,7 +1366,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1695,7 +1695,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1704,6 +1704,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1733,24 +1753,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1788,7 +1797,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1859,7 +1868,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1922,6 +1931,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1943,22 +1960,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2024,7 +2025,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2139,7 +2140,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2159,7 +2160,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/field-initialization.release.wat b/tests/compiler/field-initialization.release.wat index e11b78fbbe..af791f87d2 100644 --- a/tests/compiler/field-initialization.release.wat +++ b/tests/compiler/field-initialization.release.wat @@ -638,7 +638,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -663,7 +663,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -691,7 +691,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1058,7 +1058,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1142,7 +1142,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1194,7 +1194,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1283,7 +1283,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1293,12 +1293,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1319,50 +1319,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1370,7 +1374,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1379,7 +1383,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1387,7 +1391,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1402,17 +1406,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1421,12 +1425,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1437,7 +1441,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1447,19 +1451,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/field.debug.wat b/tests/compiler/field.debug.wat index a7bc14e656..322d3e396b 100644 --- a/tests/compiler/field.debug.wat +++ b/tests/compiler/field.debug.wat @@ -1,6 +1,6 @@ (module - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -1035,7 +1035,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1114,7 +1114,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1358,7 +1358,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1687,7 +1687,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1696,6 +1696,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1725,24 +1745,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1780,7 +1789,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1851,7 +1860,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1914,6 +1923,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1935,22 +1952,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2016,7 +2017,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2131,7 +2132,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2151,7 +2152,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/field.release.wat b/tests/compiler/field.release.wat index ceaa337513..2300126bd0 100644 --- a/tests/compiler/field.release.wat +++ b/tests/compiler/field.release.wat @@ -621,7 +621,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -646,7 +646,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -674,7 +674,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1041,7 +1041,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1177,7 +1177,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1266,7 +1266,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1276,12 +1276,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1302,50 +1302,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1353,7 +1357,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1362,7 +1366,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1370,7 +1374,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1385,17 +1389,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1404,12 +1408,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1420,7 +1424,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1430,19 +1434,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/for.debug.wat b/tests/compiler/for.debug.wat index 3b2eaae0f5..8903c24f85 100644 --- a/tests/compiler/for.debug.wat +++ b/tests/compiler/for.debug.wat @@ -1422,7 +1422,7 @@ if i32.const 0 i32.const 400 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1468,7 +1468,7 @@ if i32.const 0 i32.const 400 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1501,7 +1501,7 @@ if i32.const 0 i32.const 400 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1745,7 +1745,7 @@ if i32.const 0 i32.const 400 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2074,7 +2074,7 @@ if i32.const 64 i32.const 400 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2083,6 +2083,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2112,24 +2132,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2167,7 +2176,7 @@ if i32.const 0 i32.const 400 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2238,7 +2247,7 @@ if i32.const 0 i32.const 400 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2301,6 +2310,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2322,22 +2339,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2403,7 +2404,7 @@ if i32.const 0 i32.const 400 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2518,7 +2519,7 @@ if i32.const 0 i32.const 400 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2538,7 +2539,7 @@ if i32.const 0 i32.const 400 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/for.release.wat b/tests/compiler/for.release.wat index fd4c568c64..da3cbbfa5b 100644 --- a/tests/compiler/for.release.wat +++ b/tests/compiler/for.release.wat @@ -620,7 +620,7 @@ if i32.const 0 i32.const 1424 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -645,7 +645,7 @@ if i32.const 0 i32.const 1424 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -673,7 +673,7 @@ if i32.const 0 i32.const 1424 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 1424 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1107,7 +1107,7 @@ if i32.const 0 i32.const 1424 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1191,8 +1191,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1203,22 +1201,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1257,7 +1240,7 @@ if i32.const 0 i32.const 1424 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1272,7 +1255,7 @@ if i32.const 0 i32.const 1424 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-call.debug.wat b/tests/compiler/function-call.debug.wat index 344385ebb1..9b77989134 100644 --- a/tests/compiler/function-call.debug.wat +++ b/tests/compiler/function-call.debug.wat @@ -1071,7 +1071,7 @@ if i32.const 0 i32.const 592 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1117,7 +1117,7 @@ if i32.const 0 i32.const 592 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1150,7 +1150,7 @@ if i32.const 0 i32.const 592 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1394,7 +1394,7 @@ if i32.const 0 i32.const 592 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1723,7 +1723,7 @@ if i32.const 256 i32.const 592 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1732,6 +1732,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1761,24 +1781,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1816,7 +1825,7 @@ if i32.const 0 i32.const 592 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1887,7 +1896,7 @@ if i32.const 0 i32.const 592 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1950,6 +1959,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1971,22 +1988,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2052,7 +2053,7 @@ if i32.const 0 i32.const 592 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2167,7 +2168,7 @@ if i32.const 0 i32.const 592 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2187,7 +2188,7 @@ if i32.const 0 i32.const 592 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-call.release.wat b/tests/compiler/function-call.release.wat index e7727aaa89..29e7b4f8cc 100644 --- a/tests/compiler/function-call.release.wat +++ b/tests/compiler/function-call.release.wat @@ -659,7 +659,7 @@ if i32.const 0 i32.const 1616 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -684,7 +684,7 @@ if i32.const 0 i32.const 1616 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -712,7 +712,7 @@ if i32.const 0 i32.const 1616 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1079,7 +1079,7 @@ if i32.const 0 i32.const 1616 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1146,7 +1146,7 @@ if i32.const 0 i32.const 1616 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1230,8 +1230,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1242,22 +1240,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1296,7 +1279,7 @@ if i32.const 0 i32.const 1616 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1311,7 +1294,7 @@ if i32.const 0 i32.const 1616 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-expression.debug.wat b/tests/compiler/function-expression.debug.wat index 69f2e816c1..5046ce76dc 100644 --- a/tests/compiler/function-expression.debug.wat +++ b/tests/compiler/function-expression.debug.wat @@ -1228,7 +1228,7 @@ if i32.const 0 i32.const 912 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1274,7 +1274,7 @@ if i32.const 0 i32.const 912 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1307,7 +1307,7 @@ if i32.const 0 i32.const 912 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1551,7 +1551,7 @@ if i32.const 0 i32.const 912 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1880,7 +1880,7 @@ if i32.const 576 i32.const 912 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1889,6 +1889,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1918,24 +1938,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1973,7 +1982,7 @@ if i32.const 0 i32.const 912 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2044,7 +2053,7 @@ if i32.const 0 i32.const 912 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2107,6 +2116,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2128,22 +2145,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2209,7 +2210,7 @@ if i32.const 0 i32.const 912 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2324,7 +2325,7 @@ if i32.const 0 i32.const 912 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2344,7 +2345,7 @@ if i32.const 0 i32.const 912 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/function-expression.release.wat b/tests/compiler/function-expression.release.wat index b965a4fd37..04e328f81d 100644 --- a/tests/compiler/function-expression.release.wat +++ b/tests/compiler/function-expression.release.wat @@ -685,7 +685,7 @@ if i32.const 0 i32.const 1936 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -710,7 +710,7 @@ if i32.const 0 i32.const 1936 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -738,7 +738,7 @@ if i32.const 0 i32.const 1936 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1105,7 +1105,7 @@ if i32.const 0 i32.const 1936 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1172,7 +1172,7 @@ if i32.const 0 i32.const 1936 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1256,8 +1256,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1268,22 +1266,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1322,7 +1305,7 @@ if i32.const 0 i32.const 1936 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1337,7 +1320,7 @@ if i32.const 0 i32.const 1936 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/getter-call.debug.wat b/tests/compiler/getter-call.debug.wat index 7bf4d92bc9..155d9a23f9 100644 --- a/tests/compiler/getter-call.debug.wat +++ b/tests/compiler/getter-call.debug.wat @@ -1035,7 +1035,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1114,7 +1114,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1358,7 +1358,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1687,7 +1687,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1696,6 +1696,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1725,24 +1745,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1780,7 +1789,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1851,7 +1860,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1914,6 +1923,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1935,22 +1952,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2016,7 +2017,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2131,7 +2132,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2151,7 +2152,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/getter-call.release.wat b/tests/compiler/getter-call.release.wat index 22f92a9c05..485f0d940a 100644 --- a/tests/compiler/getter-call.release.wat +++ b/tests/compiler/getter-call.release.wat @@ -623,7 +623,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -648,7 +648,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -676,7 +676,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1043,7 +1043,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1110,7 +1110,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1194,8 +1194,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1206,22 +1204,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1260,7 +1243,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1275,7 +1258,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/heap.debug.wat b/tests/compiler/heap.debug.wat index f667dd37e4..47594e99a5 100644 --- a/tests/compiler/heap.debug.wat +++ b/tests/compiler/heap.debug.wat @@ -681,7 +681,7 @@ if i32.const 0 i32.const 32 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -727,7 +727,7 @@ if i32.const 0 i32.const 32 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -760,7 +760,7 @@ if i32.const 0 i32.const 32 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1002,7 +1002,7 @@ if i32.const 96 i32.const 32 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1011,6 +1011,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1040,24 +1060,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1095,7 +1104,7 @@ if i32.const 0 i32.const 32 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1166,7 +1175,7 @@ if i32.const 0 i32.const 32 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1229,6 +1238,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1250,22 +1267,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -1331,7 +1332,7 @@ if i32.const 0 i32.const 32 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -1446,7 +1447,7 @@ if i32.const 0 i32.const 32 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1466,7 +1467,7 @@ if i32.const 0 i32.const 32 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1531,7 +1532,7 @@ if i32.const 0 i32.const 32 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/heap.release.wat b/tests/compiler/heap.release.wat index 980583dc5f..7a632743d3 100644 --- a/tests/compiler/heap.release.wat +++ b/tests/compiler/heap.release.wat @@ -425,7 +425,7 @@ if i32.const 0 i32.const 1056 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -450,7 +450,7 @@ if i32.const 0 i32.const 1056 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -478,7 +478,7 @@ if i32.const 0 i32.const 1056 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -616,7 +616,7 @@ if i32.const 1120 i32.const 1056 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -687,7 +687,7 @@ if i32.const 0 i32.const 1056 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -739,7 +739,7 @@ if i32.const 0 i32.const 1056 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -774,7 +774,7 @@ if i32.const 0 i32.const 1056 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -844,52 +844,56 @@ i32.eqz if memory.size $0 - local.tee $1 - local.get $2 - i32.const 4 - local.get $0 - i32.load $0 offset=1568 - local.get $1 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add local.tee $3 - i32.const 536870910 - i32.lt_u + local.get $2 + i32.const 256 + i32.gt_u if (result i32) - local.get $3 + local.get $2 i32.const 1 i32.const 27 - local.get $3 + local.get $2 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $2 + local.get $2 + i32.const 536870910 + i32.lt_u + select else - local.get $3 + local.get $2 end + i32.const 4 + local.get $0 + i32.load $0 offset=1568 + local.get $3 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $1 local.get $1 local.get $3 - i32.gt_s + i32.lt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $1 memory.grow $0 i32.const 0 i32.lt_s @@ -898,7 +902,7 @@ end end local.get $0 - local.get $1 + local.get $3 i32.const 16 i32.shl memory.size $0 @@ -914,7 +918,7 @@ if i32.const 0 i32.const 1056 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -929,7 +933,7 @@ if i32.const 0 i32.const 1056 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -966,7 +970,7 @@ if i32.const 0 i32.const 1056 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/infer-array.debug.wat b/tests/compiler/infer-array.debug.wat index 454d8cc54c..c55dd55044 100644 --- a/tests/compiler/infer-array.debug.wat +++ b/tests/compiler/infer-array.debug.wat @@ -1054,7 +1054,7 @@ if i32.const 0 i32.const 400 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1100,7 +1100,7 @@ if i32.const 0 i32.const 400 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1133,7 +1133,7 @@ if i32.const 0 i32.const 400 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1377,7 +1377,7 @@ if i32.const 0 i32.const 400 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1706,7 +1706,7 @@ if i32.const 64 i32.const 400 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1715,6 +1715,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1744,24 +1764,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1799,7 +1808,7 @@ if i32.const 0 i32.const 400 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1870,7 +1879,7 @@ if i32.const 0 i32.const 400 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1933,6 +1942,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1954,22 +1971,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2035,7 +2036,7 @@ if i32.const 0 i32.const 400 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2150,7 +2151,7 @@ if i32.const 0 i32.const 400 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2170,7 +2171,7 @@ if i32.const 0 i32.const 400 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/infer-array.release.wat b/tests/compiler/infer-array.release.wat index b223a04cfb..151309b54b 100644 --- a/tests/compiler/infer-array.release.wat +++ b/tests/compiler/infer-array.release.wat @@ -660,7 +660,7 @@ if i32.const 0 i32.const 1424 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -685,7 +685,7 @@ if i32.const 0 i32.const 1424 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -713,7 +713,7 @@ if i32.const 0 i32.const 1424 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1080,7 +1080,7 @@ if i32.const 0 i32.const 1424 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1164,7 +1164,7 @@ if i32.const 0 i32.const 1424 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1216,7 +1216,7 @@ if i32.const 0 i32.const 1424 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1305,7 +1305,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1315,12 +1315,12 @@ if i32.const 1088 i32.const 1424 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1341,50 +1341,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1392,7 +1396,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1401,7 +1405,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1409,7 +1413,7 @@ if i32.const 0 i32.const 1424 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1424,17 +1428,17 @@ if i32.const 0 i32.const 1424 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1443,12 +1447,12 @@ if i32.const 0 i32.const 1424 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1459,7 +1463,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1469,19 +1473,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/infer-generic.debug.wat b/tests/compiler/infer-generic.debug.wat index dbbcceae69..2ce836c200 100644 --- a/tests/compiler/infer-generic.debug.wat +++ b/tests/compiler/infer-generic.debug.wat @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 544 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1127,7 +1127,7 @@ if i32.const 0 i32.const 544 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1160,7 +1160,7 @@ if i32.const 0 i32.const 544 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1404,7 +1404,7 @@ if i32.const 0 i32.const 544 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1733,7 +1733,7 @@ if i32.const 208 i32.const 544 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1742,6 +1742,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1771,24 +1791,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1826,7 +1835,7 @@ if i32.const 0 i32.const 544 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1897,7 +1906,7 @@ if i32.const 0 i32.const 544 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1960,6 +1969,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1981,22 +1998,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2062,7 +2063,7 @@ if i32.const 0 i32.const 544 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2177,7 +2178,7 @@ if i32.const 0 i32.const 544 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2197,7 +2198,7 @@ if i32.const 0 i32.const 544 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/infer-generic.release.wat b/tests/compiler/infer-generic.release.wat index 6757093aca..d03a066665 100644 --- a/tests/compiler/infer-generic.release.wat +++ b/tests/compiler/infer-generic.release.wat @@ -647,7 +647,7 @@ if i32.const 0 i32.const 1568 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -672,7 +672,7 @@ if i32.const 0 i32.const 1568 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -700,7 +700,7 @@ if i32.const 0 i32.const 1568 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1067,7 +1067,7 @@ if i32.const 0 i32.const 1568 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1151,7 +1151,7 @@ if i32.const 0 i32.const 1568 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1203,7 +1203,7 @@ if i32.const 0 i32.const 1568 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1292,7 +1292,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1302,12 +1302,12 @@ if i32.const 1232 i32.const 1568 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1328,50 +1328,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1379,7 +1383,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1388,7 +1392,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1396,7 +1400,7 @@ if i32.const 0 i32.const 1568 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1411,17 +1415,17 @@ if i32.const 0 i32.const 1568 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1430,12 +1434,12 @@ if i32.const 0 i32.const 1568 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1446,7 +1450,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1456,19 +1460,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/inlining.debug.wat b/tests/compiler/inlining.debug.wat index 1167081230..fd4c7b34a2 100644 --- a/tests/compiler/inlining.debug.wat +++ b/tests/compiler/inlining.debug.wat @@ -1300,7 +1300,7 @@ if i32.const 0 i32.const 448 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1346,7 +1346,7 @@ if i32.const 0 i32.const 448 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1379,7 +1379,7 @@ if i32.const 0 i32.const 448 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1623,7 +1623,7 @@ if i32.const 0 i32.const 448 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1952,7 +1952,7 @@ if i32.const 112 i32.const 448 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1961,6 +1961,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1990,24 +2010,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2045,7 +2054,7 @@ if i32.const 0 i32.const 448 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2116,7 +2125,7 @@ if i32.const 0 i32.const 448 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2179,6 +2188,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2200,22 +2217,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2281,7 +2282,7 @@ if i32.const 0 i32.const 448 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2396,7 +2397,7 @@ if i32.const 0 i32.const 448 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2416,7 +2417,7 @@ if i32.const 0 i32.const 448 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/inlining.release.wat b/tests/compiler/inlining.release.wat index c3c6a9d101..dff7a7d023 100644 --- a/tests/compiler/inlining.release.wat +++ b/tests/compiler/inlining.release.wat @@ -633,7 +633,7 @@ if i32.const 0 i32.const 1472 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -658,7 +658,7 @@ if i32.const 0 i32.const 1472 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -686,7 +686,7 @@ if i32.const 0 i32.const 1472 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1053,7 +1053,7 @@ if i32.const 0 i32.const 1472 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1137,7 +1137,7 @@ if i32.const 0 i32.const 1472 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1189,7 +1189,7 @@ if i32.const 0 i32.const 1472 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1278,7 +1278,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1288,12 +1288,12 @@ if i32.const 1136 i32.const 1472 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1314,50 +1314,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1365,7 +1369,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1374,7 +1378,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1382,7 +1386,7 @@ if i32.const 0 i32.const 1472 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1397,17 +1401,17 @@ if i32.const 0 i32.const 1472 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1416,12 +1420,12 @@ if i32.const 0 i32.const 1472 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1432,7 +1436,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1442,19 +1446,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/instanceof.debug.wat b/tests/compiler/instanceof.debug.wat index 28035e3e45..9a6aa3be38 100644 --- a/tests/compiler/instanceof.debug.wat +++ b/tests/compiler/instanceof.debug.wat @@ -1056,7 +1056,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1102,7 +1102,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1135,7 +1135,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1379,7 +1379,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1708,7 +1708,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1717,6 +1717,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1746,24 +1766,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1801,7 +1810,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1872,7 +1881,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1935,6 +1944,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1956,22 +1973,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2037,7 +2038,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2152,7 +2153,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2172,7 +2173,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/instanceof.release.wat b/tests/compiler/instanceof.release.wat index 4b259edb94..e5507b780a 100644 --- a/tests/compiler/instanceof.release.wat +++ b/tests/compiler/instanceof.release.wat @@ -725,7 +725,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -750,7 +750,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -778,7 +778,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1145,7 +1145,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1212,7 +1212,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1296,8 +1296,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1308,22 +1306,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1362,7 +1345,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1377,7 +1360,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1095.debug.wat b/tests/compiler/issues/1095.debug.wat index 14eae4a300..2555d645a1 100644 --- a/tests/compiler/issues/1095.debug.wat +++ b/tests/compiler/issues/1095.debug.wat @@ -1035,7 +1035,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1114,7 +1114,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1358,7 +1358,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1687,7 +1687,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1696,6 +1696,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1725,24 +1745,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1780,7 +1789,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1851,7 +1860,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1914,6 +1923,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1935,22 +1952,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2016,7 +2017,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2131,7 +2132,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2151,7 +2152,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1095.release.wat b/tests/compiler/issues/1095.release.wat index 6bdf62d977..bd0b4fc950 100644 --- a/tests/compiler/issues/1095.release.wat +++ b/tests/compiler/issues/1095.release.wat @@ -624,7 +624,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -649,7 +649,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -677,7 +677,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1044,7 +1044,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1128,7 +1128,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1180,7 +1180,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1269,7 +1269,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1279,12 +1279,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1305,50 +1305,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1356,7 +1360,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1365,7 +1369,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1373,7 +1377,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1388,17 +1392,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1407,12 +1411,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1423,7 +1427,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1433,19 +1437,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/issues/1225.debug.wat b/tests/compiler/issues/1225.debug.wat index 924c093308..badb0e817a 100644 --- a/tests/compiler/issues/1225.debug.wat +++ b/tests/compiler/issues/1225.debug.wat @@ -1050,7 +1050,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1096,7 +1096,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1129,7 +1129,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1373,7 +1373,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1702,7 +1702,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1711,6 +1711,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1740,24 +1760,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1795,7 +1804,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1866,7 +1875,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1929,6 +1938,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1950,22 +1967,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2031,7 +2032,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2146,7 +2147,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2166,7 +2167,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1225.release.wat b/tests/compiler/issues/1225.release.wat index df14a60cb1..40774e3a59 100644 --- a/tests/compiler/issues/1225.release.wat +++ b/tests/compiler/issues/1225.release.wat @@ -629,7 +629,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -654,7 +654,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -682,7 +682,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1049,7 +1049,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1116,7 +1116,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1200,8 +1200,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1212,22 +1210,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1266,7 +1249,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1281,7 +1264,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1699.debug.wat b/tests/compiler/issues/1699.debug.wat index b34102eabd..dba0719212 100644 --- a/tests/compiler/issues/1699.debug.wat +++ b/tests/compiler/issues/1699.debug.wat @@ -1037,7 +1037,7 @@ if i32.const 0 i32.const 464 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1083,7 +1083,7 @@ if i32.const 0 i32.const 464 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1116,7 +1116,7 @@ if i32.const 0 i32.const 464 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1360,7 +1360,7 @@ if i32.const 0 i32.const 464 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1689,7 +1689,7 @@ if i32.const 128 i32.const 464 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1698,6 +1698,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1727,24 +1747,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1782,7 +1791,7 @@ if i32.const 0 i32.const 464 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1853,7 +1862,7 @@ if i32.const 0 i32.const 464 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1916,6 +1925,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1937,22 +1954,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2018,7 +2019,7 @@ if i32.const 0 i32.const 464 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2133,7 +2134,7 @@ if i32.const 0 i32.const 464 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2153,7 +2154,7 @@ if i32.const 0 i32.const 464 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1699.release.wat b/tests/compiler/issues/1699.release.wat index c9293bf7f6..daf415c9bd 100644 --- a/tests/compiler/issues/1699.release.wat +++ b/tests/compiler/issues/1699.release.wat @@ -631,7 +631,7 @@ if i32.const 0 i32.const 1488 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -656,7 +656,7 @@ if i32.const 0 i32.const 1488 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -684,7 +684,7 @@ if i32.const 0 i32.const 1488 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1051,7 +1051,7 @@ if i32.const 0 i32.const 1488 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1135,7 +1135,7 @@ if i32.const 0 i32.const 1488 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1187,7 +1187,7 @@ if i32.const 0 i32.const 1488 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1276,7 +1276,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1286,12 +1286,12 @@ if i32.const 1152 i32.const 1488 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1312,50 +1312,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1363,7 +1367,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1372,7 +1376,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1380,7 +1384,7 @@ if i32.const 0 i32.const 1488 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1395,17 +1399,17 @@ if i32.const 0 i32.const 1488 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1414,12 +1418,12 @@ if i32.const 0 i32.const 1488 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1430,7 +1434,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1440,19 +1444,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/issues/2166.debug.wat b/tests/compiler/issues/2166.debug.wat index 519bbe7aa2..d48a8fec48 100644 --- a/tests/compiler/issues/2166.debug.wat +++ b/tests/compiler/issues/2166.debug.wat @@ -1039,7 +1039,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1085,7 +1085,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1362,7 +1362,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1691,7 +1691,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1700,6 +1700,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1729,24 +1749,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1784,7 +1793,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1855,7 +1864,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1918,6 +1927,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1939,22 +1956,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2020,7 +2021,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2135,7 +2136,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2155,7 +2156,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/2166.release.wat b/tests/compiler/issues/2166.release.wat index 5fd708b17e..addb2abaee 100644 --- a/tests/compiler/issues/2166.release.wat +++ b/tests/compiler/issues/2166.release.wat @@ -629,7 +629,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -654,7 +654,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -682,7 +682,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1049,7 +1049,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1116,7 +1116,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1200,8 +1200,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1212,22 +1210,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1266,7 +1249,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1281,7 +1264,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/2322/index.debug.wat b/tests/compiler/issues/2322/index.debug.wat index da27323fae..a9bd22aa50 100644 --- a/tests/compiler/issues/2322/index.debug.wat +++ b/tests/compiler/issues/2322/index.debug.wat @@ -1033,7 +1033,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1079,7 +1079,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1112,7 +1112,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1356,7 +1356,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1685,7 +1685,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1694,6 +1694,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1723,24 +1743,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1778,7 +1787,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1849,7 +1858,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1912,6 +1921,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1933,22 +1950,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2014,7 +2015,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2129,7 +2130,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2149,7 +2150,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/2322/index.release.wat b/tests/compiler/issues/2322/index.release.wat index 90b5d9497d..6bb07a8639 100644 --- a/tests/compiler/issues/2322/index.release.wat +++ b/tests/compiler/issues/2322/index.release.wat @@ -619,7 +619,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -644,7 +644,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -672,7 +672,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1039,7 +1039,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1123,7 +1123,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1175,7 +1175,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1264,7 +1264,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1274,12 +1274,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1300,50 +1300,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1351,7 +1355,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1360,7 +1364,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1368,7 +1372,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1383,17 +1387,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1402,12 +1406,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1418,7 +1422,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1428,19 +1432,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/issues/2622.debug.wat b/tests/compiler/issues/2622.debug.wat index 31d5d2f1f5..f655c1e3d7 100644 --- a/tests/compiler/issues/2622.debug.wat +++ b/tests/compiler/issues/2622.debug.wat @@ -1036,7 +1036,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1082,7 +1082,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1115,7 +1115,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1359,7 +1359,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1688,7 +1688,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1697,6 +1697,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1726,24 +1746,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1781,7 +1790,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1852,7 +1861,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1915,6 +1924,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1936,22 +1953,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2017,7 +2018,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2132,7 +2133,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2152,7 +2153,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/2622.release.wat b/tests/compiler/issues/2622.release.wat index 69246ec0b6..2b438537a0 100644 --- a/tests/compiler/issues/2622.release.wat +++ b/tests/compiler/issues/2622.release.wat @@ -658,7 +658,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -683,7 +683,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -711,7 +711,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1078,7 +1078,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1145,7 +1145,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1229,8 +1229,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1241,22 +1239,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1295,7 +1278,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1310,7 +1293,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/logical.debug.wat b/tests/compiler/logical.debug.wat index 1d7cd41ec0..0a4fee03b8 100644 --- a/tests/compiler/logical.debug.wat +++ b/tests/compiler/logical.debug.wat @@ -1062,7 +1062,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1108,7 +1108,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1141,7 +1141,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1385,7 +1385,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1714,7 +1714,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1723,6 +1723,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1752,24 +1772,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1807,7 +1816,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1878,7 +1887,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1941,6 +1950,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1962,22 +1979,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2043,7 +2044,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2158,7 +2159,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2178,7 +2179,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/logical.release.wat b/tests/compiler/logical.release.wat index bf8f9bca5e..abc2afedfa 100644 --- a/tests/compiler/logical.release.wat +++ b/tests/compiler/logical.release.wat @@ -634,7 +634,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -659,7 +659,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -687,7 +687,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1054,7 +1054,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1121,7 +1121,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1205,8 +1205,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1217,22 +1215,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1271,7 +1254,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1286,7 +1269,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/managed-cast.debug.wat b/tests/compiler/managed-cast.debug.wat index eed301a93b..fca4fa77c3 100644 --- a/tests/compiler/managed-cast.debug.wat +++ b/tests/compiler/managed-cast.debug.wat @@ -1035,7 +1035,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1114,7 +1114,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1358,7 +1358,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1687,7 +1687,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1696,6 +1696,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1725,24 +1745,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1780,7 +1789,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1851,7 +1860,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1914,6 +1923,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1935,22 +1952,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2016,7 +2017,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2131,7 +2132,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2151,7 +2152,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/managed-cast.release.wat b/tests/compiler/managed-cast.release.wat index 60c36eacf2..5e26cf390f 100644 --- a/tests/compiler/managed-cast.release.wat +++ b/tests/compiler/managed-cast.release.wat @@ -624,7 +624,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -649,7 +649,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -677,7 +677,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1044,7 +1044,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1111,7 +1111,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1195,8 +1195,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1207,22 +1205,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1261,7 +1244,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1276,7 +1259,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/new.debug.wat b/tests/compiler/new.debug.wat index 031886a92d..caaa70e8d0 100644 --- a/tests/compiler/new.debug.wat +++ b/tests/compiler/new.debug.wat @@ -1038,7 +1038,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1084,7 +1084,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1117,7 +1117,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1361,7 +1361,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1690,7 +1690,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1699,6 +1699,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1728,24 +1748,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1783,7 +1792,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1854,7 +1863,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1917,6 +1926,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1938,22 +1955,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2019,7 +2020,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2134,7 +2135,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2154,7 +2155,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/new.release.wat b/tests/compiler/new.release.wat index 1708f931f0..438eba16e8 100644 --- a/tests/compiler/new.release.wat +++ b/tests/compiler/new.release.wat @@ -660,7 +660,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -685,7 +685,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -713,7 +713,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1080,7 +1080,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1147,7 +1147,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1231,8 +1231,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1243,22 +1241,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1297,7 +1280,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1312,7 +1295,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/object-literal.debug.wat b/tests/compiler/object-literal.debug.wat index 083253fbb3..2e3e82b42c 100644 --- a/tests/compiler/object-literal.debug.wat +++ b/tests/compiler/object-literal.debug.wat @@ -1130,7 +1130,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1176,7 +1176,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1209,7 +1209,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1453,7 +1453,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1782,7 +1782,7 @@ if i32.const 288 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1791,6 +1791,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1820,24 +1840,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1875,7 +1884,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1946,7 +1955,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2009,6 +2018,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2030,22 +2047,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2111,7 +2112,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2226,7 +2227,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2246,7 +2247,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/object-literal.release.wat b/tests/compiler/object-literal.release.wat index 9b5a943385..3527d533f4 100644 --- a/tests/compiler/object-literal.release.wat +++ b/tests/compiler/object-literal.release.wat @@ -634,7 +634,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -659,7 +659,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -687,7 +687,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -855,7 +855,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1144,7 +1144,7 @@ if i32.const 0 i32.const 1440 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1196,7 +1196,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1227,7 +1227,7 @@ if i32.const 1312 i32.const 1440 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1253,6 +1253,27 @@ memory.size $0 local.tee $1 local.get $3 + i32.const 256 + i32.gt_u + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + else + local.get $3 + end i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1264,23 +1285,6 @@ i32.ne i32.shl i32.add - local.tee $2 - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $2 - i32.const 1 - i32.const 27 - local.get $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - else - local.get $2 - end i32.const 65535 i32.add i32.const -65536 @@ -1321,7 +1325,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1336,7 +1340,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1346,7 +1350,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $2 + local.set $4 local.get $3 i32.const 4 i32.add @@ -1355,23 +1359,23 @@ if i32.const 0 i32.const 1440 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $4 i32.const -4 i32.and local.get $3 i32.sub - local.tee $4 + local.tee $2 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $2 + local.get $4 i32.const 2 i32.and i32.or @@ -1381,19 +1385,19 @@ i32.add local.get $3 i32.add - local.tee $2 - local.get $4 + local.tee $3 + local.get $2 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $2 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $2 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/optional-typeparameters.debug.wat b/tests/compiler/optional-typeparameters.debug.wat index c34269a79a..c57a209c6b 100644 --- a/tests/compiler/optional-typeparameters.debug.wat +++ b/tests/compiler/optional-typeparameters.debug.wat @@ -1046,7 +1046,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1092,7 +1092,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1369,7 +1369,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1698,7 +1698,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1707,6 +1707,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1736,24 +1756,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1791,7 +1800,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1862,7 +1871,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1925,6 +1934,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1946,22 +1963,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2027,7 +2028,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2142,7 +2143,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2162,7 +2163,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/optional-typeparameters.release.wat b/tests/compiler/optional-typeparameters.release.wat index fcbfbdfd7f..338470aae5 100644 --- a/tests/compiler/optional-typeparameters.release.wat +++ b/tests/compiler/optional-typeparameters.release.wat @@ -646,7 +646,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -671,7 +671,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -699,7 +699,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1066,7 +1066,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1133,7 +1133,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1217,8 +1217,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1229,22 +1227,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1283,7 +1266,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1298,7 +1281,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/reexport.debug.wat b/tests/compiler/reexport.debug.wat index c8e6eff590..473585d7ca 100644 --- a/tests/compiler/reexport.debug.wat +++ b/tests/compiler/reexport.debug.wat @@ -1079,7 +1079,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1158,7 +1158,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1402,7 +1402,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1731,7 +1731,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1740,6 +1740,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1769,24 +1789,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1824,7 +1833,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1895,7 +1904,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1958,6 +1967,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1979,22 +1996,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2060,7 +2061,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2175,7 +2176,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2195,7 +2196,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/reexport.release.wat b/tests/compiler/reexport.release.wat index c16716f4df..aa6cf67823 100644 --- a/tests/compiler/reexport.release.wat +++ b/tests/compiler/reexport.release.wat @@ -653,7 +653,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -678,7 +678,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -706,7 +706,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1073,7 +1073,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1140,7 +1140,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1224,8 +1224,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1236,22 +1234,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1290,7 +1273,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1305,7 +1288,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rereexport.debug.wat b/tests/compiler/rereexport.debug.wat index 9ddeb4f6cc..02f9068d90 100644 --- a/tests/compiler/rereexport.debug.wat +++ b/tests/compiler/rereexport.debug.wat @@ -1072,7 +1072,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1151,7 +1151,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1395,7 +1395,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1724,7 +1724,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1733,6 +1733,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1762,24 +1782,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1817,7 +1826,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1888,7 +1897,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1951,6 +1960,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1972,22 +1989,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2053,7 +2054,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2168,7 +2169,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2188,7 +2189,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rereexport.release.wat b/tests/compiler/rereexport.release.wat index b0ad13ee2a..4ca358b3ef 100644 --- a/tests/compiler/rereexport.release.wat +++ b/tests/compiler/rereexport.release.wat @@ -651,7 +651,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -676,7 +676,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -704,7 +704,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1071,7 +1071,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1138,7 +1138,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1222,8 +1222,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1234,22 +1232,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1288,7 +1271,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1303,7 +1286,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-access.debug.wat b/tests/compiler/resolve-access.debug.wat index daf6e5fd01..4e1ab4917d 100644 --- a/tests/compiler/resolve-access.debug.wat +++ b/tests/compiler/resolve-access.debug.wat @@ -1054,7 +1054,7 @@ if i32.const 0 i32.const 400 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1100,7 +1100,7 @@ if i32.const 0 i32.const 400 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1133,7 +1133,7 @@ if i32.const 0 i32.const 400 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1377,7 +1377,7 @@ if i32.const 0 i32.const 400 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1706,7 +1706,7 @@ if i32.const 64 i32.const 400 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1715,6 +1715,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1744,24 +1764,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1799,7 +1808,7 @@ if i32.const 0 i32.const 400 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1870,7 +1879,7 @@ if i32.const 0 i32.const 400 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1933,6 +1942,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1954,22 +1971,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2035,7 +2036,7 @@ if i32.const 0 i32.const 400 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2150,7 +2151,7 @@ if i32.const 0 i32.const 400 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2170,7 +2171,7 @@ if i32.const 0 i32.const 400 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-access.release.wat b/tests/compiler/resolve-access.release.wat index 73cee4b805..39d0b4b8b2 100644 --- a/tests/compiler/resolve-access.release.wat +++ b/tests/compiler/resolve-access.release.wat @@ -642,7 +642,7 @@ if i32.const 0 i32.const 1424 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -667,7 +667,7 @@ if i32.const 0 i32.const 1424 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -695,7 +695,7 @@ if i32.const 0 i32.const 1424 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1062,7 +1062,7 @@ if i32.const 0 i32.const 1424 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1146,7 +1146,7 @@ if i32.const 0 i32.const 1424 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1198,7 +1198,7 @@ if i32.const 0 i32.const 1424 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1287,7 +1287,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1297,12 +1297,12 @@ if i32.const 1088 i32.const 1424 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1323,50 +1323,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1374,7 +1378,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1383,7 +1387,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1391,7 +1395,7 @@ if i32.const 0 i32.const 1424 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1406,17 +1410,17 @@ if i32.const 0 i32.const 1424 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1425,12 +1429,12 @@ if i32.const 0 i32.const 1424 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1441,7 +1445,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1451,19 +1455,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-binary.debug.wat b/tests/compiler/resolve-binary.debug.wat index aff7b19103..3e1672f864 100644 --- a/tests/compiler/resolve-binary.debug.wat +++ b/tests/compiler/resolve-binary.debug.wat @@ -1274,7 +1274,7 @@ if i32.const 0 i32.const 720 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1320,7 +1320,7 @@ if i32.const 0 i32.const 720 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1353,7 +1353,7 @@ if i32.const 0 i32.const 720 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1597,7 +1597,7 @@ if i32.const 0 i32.const 720 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1926,7 +1926,7 @@ if i32.const 384 i32.const 720 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1935,6 +1935,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1964,24 +1984,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2019,7 +2028,7 @@ if i32.const 0 i32.const 720 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2090,7 +2099,7 @@ if i32.const 0 i32.const 720 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2153,6 +2162,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2174,22 +2191,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2255,7 +2256,7 @@ if i32.const 0 i32.const 720 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2370,7 +2371,7 @@ if i32.const 0 i32.const 720 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2390,7 +2391,7 @@ if i32.const 0 i32.const 720 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-binary.release.wat b/tests/compiler/resolve-binary.release.wat index 3de8b92cca..477bdf5494 100644 --- a/tests/compiler/resolve-binary.release.wat +++ b/tests/compiler/resolve-binary.release.wat @@ -851,7 +851,7 @@ if i32.const 0 i32.const 1744 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -876,7 +876,7 @@ if i32.const 0 i32.const 1744 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -904,7 +904,7 @@ if i32.const 0 i32.const 1744 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1271,7 +1271,7 @@ if i32.const 0 i32.const 1744 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1355,7 +1355,7 @@ if i32.const 0 i32.const 1744 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1407,7 +1407,7 @@ if i32.const 0 i32.const 1744 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1496,7 +1496,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1506,12 +1506,12 @@ if i32.const 1408 i32.const 1744 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1532,50 +1532,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1583,7 +1587,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1592,7 +1596,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1600,7 +1604,7 @@ if i32.const 0 i32.const 1744 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1615,17 +1619,17 @@ if i32.const 0 i32.const 1744 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1634,12 +1638,12 @@ if i32.const 0 i32.const 1744 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1650,7 +1654,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1660,19 +1664,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-elementaccess.debug.wat b/tests/compiler/resolve-elementaccess.debug.wat index a7934ab754..be10da9c86 100644 --- a/tests/compiler/resolve-elementaccess.debug.wat +++ b/tests/compiler/resolve-elementaccess.debug.wat @@ -1077,7 +1077,7 @@ if i32.const 0 i32.const 480 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1123,7 +1123,7 @@ if i32.const 0 i32.const 480 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1156,7 +1156,7 @@ if i32.const 0 i32.const 480 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1400,7 +1400,7 @@ if i32.const 0 i32.const 480 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1729,7 +1729,7 @@ if i32.const 144 i32.const 480 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1738,6 +1738,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1767,24 +1787,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1822,7 +1831,7 @@ if i32.const 0 i32.const 480 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1893,7 +1902,7 @@ if i32.const 0 i32.const 480 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1956,6 +1965,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1977,22 +1994,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2058,7 +2059,7 @@ if i32.const 0 i32.const 480 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2173,7 +2174,7 @@ if i32.const 0 i32.const 480 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2193,7 +2194,7 @@ if i32.const 0 i32.const 480 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.release.wat b/tests/compiler/resolve-elementaccess.release.wat index 8288a81d5a..6c6e033861 100644 --- a/tests/compiler/resolve-elementaccess.release.wat +++ b/tests/compiler/resolve-elementaccess.release.wat @@ -694,7 +694,7 @@ if i32.const 0 i32.const 1504 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -719,7 +719,7 @@ if i32.const 0 i32.const 1504 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -747,7 +747,7 @@ if i32.const 0 i32.const 1504 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1114,7 +1114,7 @@ if i32.const 0 i32.const 1504 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1198,7 +1198,7 @@ if i32.const 0 i32.const 1504 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1250,7 +1250,7 @@ if i32.const 0 i32.const 1504 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1339,7 +1339,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1349,12 +1349,12 @@ if i32.const 1168 i32.const 1504 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1375,50 +1375,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1426,7 +1430,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1435,7 +1439,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1443,7 +1447,7 @@ if i32.const 0 i32.const 1504 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1458,17 +1462,17 @@ if i32.const 0 i32.const 1504 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1477,12 +1481,12 @@ if i32.const 0 i32.const 1504 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1493,7 +1497,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1503,19 +1507,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-function-expression.debug.wat b/tests/compiler/resolve-function-expression.debug.wat index a9eda91089..961f263a2d 100644 --- a/tests/compiler/resolve-function-expression.debug.wat +++ b/tests/compiler/resolve-function-expression.debug.wat @@ -1120,7 +1120,7 @@ if i32.const 0 i32.const 768 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1166,7 +1166,7 @@ if i32.const 0 i32.const 768 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1199,7 +1199,7 @@ if i32.const 0 i32.const 768 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1443,7 +1443,7 @@ if i32.const 0 i32.const 768 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1772,7 +1772,7 @@ if i32.const 432 i32.const 768 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1781,6 +1781,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1810,24 +1830,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1865,7 +1874,7 @@ if i32.const 0 i32.const 768 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1936,7 +1945,7 @@ if i32.const 0 i32.const 768 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1999,6 +2008,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2020,22 +2037,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2101,7 +2102,7 @@ if i32.const 0 i32.const 768 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2216,7 +2217,7 @@ if i32.const 0 i32.const 768 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2236,7 +2237,7 @@ if i32.const 0 i32.const 768 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-function-expression.release.wat b/tests/compiler/resolve-function-expression.release.wat index dc311a0352..f050247a6c 100644 --- a/tests/compiler/resolve-function-expression.release.wat +++ b/tests/compiler/resolve-function-expression.release.wat @@ -661,7 +661,7 @@ if i32.const 0 i32.const 1792 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -686,7 +686,7 @@ if i32.const 0 i32.const 1792 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -714,7 +714,7 @@ if i32.const 0 i32.const 1792 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 1792 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1165,7 +1165,7 @@ if i32.const 0 i32.const 1792 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1217,7 +1217,7 @@ if i32.const 0 i32.const 1792 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1342,7 +1342,7 @@ i32.shl local.get $3 i32.add - local.tee $7 + local.tee $6 i32.const 1073741804 i32.ge_u if @@ -1404,8 +1404,8 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $5 - local.get $7 + local.set $7 + local.get $6 i32.const 16 i32.add local.tee $2 @@ -1414,12 +1414,12 @@ if i32.const 1456 i32.const 1792 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $7 i32.const 12 local.get $2 i32.const 19 @@ -1440,50 +1440,54 @@ memory.size $0 local.tee $2 local.get $8 - i32.const 4 - local.get $5 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $6 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $6 + local.get $8 i32.const 1 i32.const 27 - local.get $6 + local.get $8 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $8 + local.get $8 + i32.const 536870910 + i32.lt_u + select else - local.get $6 + local.get $8 end + i32.const 4 + local.get $7 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $6 + local.tee $5 local.get $2 - local.get $6 + local.get $5 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $6 + local.get $5 memory.grow $0 i32.const 0 i32.lt_s @@ -1491,7 +1495,7 @@ unreachable end end - local.get $5 + local.get $7 local.get $2 i32.const 16 i32.shl @@ -1500,7 +1504,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $5 + local.get $7 local.get $8 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1508,7 +1512,7 @@ if i32.const 0 i32.const 1792 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1523,17 +1527,17 @@ if i32.const 0 i32.const 1792 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $7 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $6 + local.set $9 local.get $8 i32.const 4 i32.add @@ -1542,23 +1546,23 @@ if i32.const 0 i32.const 1792 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $6 + local.get $9 i32.const -4 i32.and local.get $8 i32.sub - local.tee $9 + local.tee $5 i32.const 16 i32.ge_u if local.get $2 local.get $8 - local.get $6 + local.get $9 i32.const 2 i32.and i32.or @@ -1568,19 +1572,19 @@ i32.add local.get $8 i32.add - local.tee $6 - local.get $9 + local.tee $8 + local.get $5 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $5 - local.get $6 + local.get $7 + local.get $8 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $6 + local.get $9 i32.const -2 i32.and i32.store $0 @@ -1603,23 +1607,23 @@ i32.const 2 i32.store $0 offset=12 local.get $2 - local.get $7 + local.get $6 i32.store $0 offset=16 global.get $~lib/rt/itcms/fromSpace local.tee $5 i32.load $0 offset=8 - local.set $6 + local.set $7 local.get $2 local.get $5 global.get $~lib/rt/itcms/white i32.or i32.store $0 offset=4 local.get $2 - local.get $6 + local.get $7 i32.store $0 offset=8 - local.get $6 + local.get $7 local.get $2 - local.get $6 + local.get $7 i32.load $0 offset=4 i32.const 3 i32.and @@ -1642,7 +1646,7 @@ i32.add local.tee $2 i32.const 0 - local.get $7 + local.get $6 memory.fill $0 local.get $4 local.get $2 diff --git a/tests/compiler/resolve-new.debug.wat b/tests/compiler/resolve-new.debug.wat index b046c451f7..9f6cc8d10b 100644 --- a/tests/compiler/resolve-new.debug.wat +++ b/tests/compiler/resolve-new.debug.wat @@ -1033,7 +1033,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1079,7 +1079,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1112,7 +1112,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1356,7 +1356,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1685,7 +1685,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1694,6 +1694,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1723,24 +1743,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1778,7 +1787,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1849,7 +1858,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1912,6 +1921,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1933,22 +1950,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2014,7 +2015,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2129,7 +2130,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2149,7 +2150,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-new.release.wat b/tests/compiler/resolve-new.release.wat index 0dcc1f4e14..78f4407d8e 100644 --- a/tests/compiler/resolve-new.release.wat +++ b/tests/compiler/resolve-new.release.wat @@ -625,7 +625,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -650,7 +650,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -678,7 +678,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1045,7 +1045,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1112,7 +1112,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1196,8 +1196,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1208,22 +1206,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1262,7 +1245,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1277,7 +1260,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-propertyaccess.debug.wat b/tests/compiler/resolve-propertyaccess.debug.wat index 1c86828188..15989dd841 100644 --- a/tests/compiler/resolve-propertyaccess.debug.wat +++ b/tests/compiler/resolve-propertyaccess.debug.wat @@ -1120,7 +1120,7 @@ if i32.const 0 i32.const 592 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1166,7 +1166,7 @@ if i32.const 0 i32.const 592 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1199,7 +1199,7 @@ if i32.const 0 i32.const 592 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1443,7 +1443,7 @@ if i32.const 0 i32.const 592 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1772,7 +1772,7 @@ if i32.const 256 i32.const 592 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1781,6 +1781,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1810,24 +1830,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1865,7 +1874,7 @@ if i32.const 0 i32.const 592 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1936,7 +1945,7 @@ if i32.const 0 i32.const 592 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1999,6 +2008,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2020,22 +2037,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2101,7 +2102,7 @@ if i32.const 0 i32.const 592 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2216,7 +2217,7 @@ if i32.const 0 i32.const 592 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2236,7 +2237,7 @@ if i32.const 0 i32.const 592 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-propertyaccess.release.wat b/tests/compiler/resolve-propertyaccess.release.wat index 00d6dd4941..08d1c03e72 100644 --- a/tests/compiler/resolve-propertyaccess.release.wat +++ b/tests/compiler/resolve-propertyaccess.release.wat @@ -660,7 +660,7 @@ if i32.const 0 i32.const 1616 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -685,7 +685,7 @@ if i32.const 0 i32.const 1616 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -713,7 +713,7 @@ if i32.const 0 i32.const 1616 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1080,7 +1080,7 @@ if i32.const 0 i32.const 1616 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1164,7 +1164,7 @@ if i32.const 0 i32.const 1616 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1216,7 +1216,7 @@ if i32.const 0 i32.const 1616 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1305,7 +1305,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1315,12 +1315,12 @@ if i32.const 1280 i32.const 1616 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1341,50 +1341,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1392,7 +1396,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1401,7 +1405,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1409,7 +1413,7 @@ if i32.const 0 i32.const 1616 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1424,17 +1428,17 @@ if i32.const 0 i32.const 1616 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1443,12 +1447,12 @@ if i32.const 0 i32.const 1616 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1459,7 +1463,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1469,19 +1473,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-ternary.debug.wat b/tests/compiler/resolve-ternary.debug.wat index 248a1f1a26..071964f8f5 100644 --- a/tests/compiler/resolve-ternary.debug.wat +++ b/tests/compiler/resolve-ternary.debug.wat @@ -1128,7 +1128,7 @@ if i32.const 0 i32.const 592 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1174,7 +1174,7 @@ if i32.const 0 i32.const 592 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1207,7 +1207,7 @@ if i32.const 0 i32.const 592 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1451,7 +1451,7 @@ if i32.const 0 i32.const 592 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1780,7 +1780,7 @@ if i32.const 256 i32.const 592 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1789,6 +1789,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1818,24 +1838,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1873,7 +1882,7 @@ if i32.const 0 i32.const 592 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1944,7 +1953,7 @@ if i32.const 0 i32.const 592 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2007,6 +2016,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2028,22 +2045,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2109,7 +2110,7 @@ if i32.const 0 i32.const 592 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2224,7 +2225,7 @@ if i32.const 0 i32.const 592 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2244,7 +2245,7 @@ if i32.const 0 i32.const 592 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-ternary.release.wat b/tests/compiler/resolve-ternary.release.wat index c829aa7cf8..a1f9ac86ec 100644 --- a/tests/compiler/resolve-ternary.release.wat +++ b/tests/compiler/resolve-ternary.release.wat @@ -666,7 +666,7 @@ if i32.const 0 i32.const 1616 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -691,7 +691,7 @@ if i32.const 0 i32.const 1616 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -719,7 +719,7 @@ if i32.const 0 i32.const 1616 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1086,7 +1086,7 @@ if i32.const 0 i32.const 1616 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1170,7 +1170,7 @@ if i32.const 0 i32.const 1616 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1222,7 +1222,7 @@ if i32.const 0 i32.const 1616 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1311,7 +1311,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $2 + local.set $3 local.get $0 i32.const 16 i32.add @@ -1321,12 +1321,12 @@ if i32.const 1280 i32.const 1616 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $3 i32.const 12 local.get $1 i32.const 19 @@ -1347,50 +1347,54 @@ memory.size $0 local.tee $1 local.get $4 - i32.const 4 - local.get $2 - i32.load $0 offset=1568 - local.get $1 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $3 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $3 + local.get $4 i32.const 1 i32.const 27 - local.get $3 + local.get $4 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $4 + local.get $4 + i32.const 536870910 + i32.lt_u + select else - local.get $3 + local.get $4 end + i32.const 4 + local.get $3 + i32.load $0 offset=1568 + local.get $1 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $3 + local.tee $2 local.get $1 - local.get $3 + local.get $2 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $3 + local.get $2 memory.grow $0 i32.const 0 i32.lt_s @@ -1398,7 +1402,7 @@ unreachable end end - local.get $2 + local.get $3 local.get $1 i32.const 16 i32.shl @@ -1407,7 +1411,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $2 + local.get $3 local.get $4 call $~lib/rt/tlsf/searchBlock local.tee $1 @@ -1415,7 +1419,7 @@ if i32.const 0 i32.const 1616 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1430,17 +1434,17 @@ if i32.const 0 i32.const 1616 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $3 local.get $1 call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $3 + local.set $2 local.get $4 i32.const 4 i32.add @@ -1449,12 +1453,12 @@ if i32.const 0 i32.const 1616 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const -4 i32.and local.get $4 @@ -1465,7 +1469,7 @@ if local.get $1 local.get $4 - local.get $3 + local.get $2 i32.const 2 i32.and i32.or @@ -1475,19 +1479,19 @@ i32.add local.get $4 i32.add - local.tee $3 + local.tee $2 local.get $5 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $2 local.get $3 + local.get $2 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $3 + local.get $2 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/resolve-unary.debug.wat b/tests/compiler/resolve-unary.debug.wat index d39dc935b0..ef15f895fa 100644 --- a/tests/compiler/resolve-unary.debug.wat +++ b/tests/compiler/resolve-unary.debug.wat @@ -1120,7 +1120,7 @@ if i32.const 0 i32.const 592 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1166,7 +1166,7 @@ if i32.const 0 i32.const 592 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1199,7 +1199,7 @@ if i32.const 0 i32.const 592 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1443,7 +1443,7 @@ if i32.const 0 i32.const 592 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1772,7 +1772,7 @@ if i32.const 256 i32.const 592 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1781,6 +1781,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1810,24 +1830,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1865,7 +1874,7 @@ if i32.const 0 i32.const 592 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1936,7 +1945,7 @@ if i32.const 0 i32.const 592 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1999,6 +2008,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2020,22 +2037,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2101,7 +2102,7 @@ if i32.const 0 i32.const 592 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2216,7 +2217,7 @@ if i32.const 0 i32.const 592 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2236,7 +2237,7 @@ if i32.const 0 i32.const 592 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-unary.release.wat b/tests/compiler/resolve-unary.release.wat index 717bb060c0..3456e0764f 100644 --- a/tests/compiler/resolve-unary.release.wat +++ b/tests/compiler/resolve-unary.release.wat @@ -686,7 +686,7 @@ if i32.const 0 i32.const 1616 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -711,7 +711,7 @@ if i32.const 0 i32.const 1616 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -739,7 +739,7 @@ if i32.const 0 i32.const 1616 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1106,7 +1106,7 @@ if i32.const 0 i32.const 1616 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1190,7 +1190,7 @@ if i32.const 0 i32.const 1616 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1242,7 +1242,7 @@ if i32.const 0 i32.const 1616 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1331,7 +1331,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1341,12 +1341,12 @@ if i32.const 1280 i32.const 1616 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1367,50 +1367,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1418,7 +1422,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1427,7 +1431,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1435,7 +1439,7 @@ if i32.const 0 i32.const 1616 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1450,17 +1454,17 @@ if i32.const 0 i32.const 1616 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1469,12 +1473,12 @@ if i32.const 0 i32.const 1616 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1485,7 +1489,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1495,19 +1499,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/return-unreachable.debug.wat b/tests/compiler/return-unreachable.debug.wat index 67223199b9..747c070aa5 100644 --- a/tests/compiler/return-unreachable.debug.wat +++ b/tests/compiler/return-unreachable.debug.wat @@ -1036,7 +1036,7 @@ if i32.const 0 i32.const 464 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1082,7 +1082,7 @@ if i32.const 0 i32.const 464 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1115,7 +1115,7 @@ if i32.const 0 i32.const 464 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1359,7 +1359,7 @@ if i32.const 0 i32.const 464 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1688,7 +1688,7 @@ if i32.const 128 i32.const 464 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1697,6 +1697,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1726,24 +1746,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1781,7 +1790,7 @@ if i32.const 0 i32.const 464 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1852,7 +1861,7 @@ if i32.const 0 i32.const 464 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1915,6 +1924,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1936,22 +1953,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2017,7 +2018,7 @@ if i32.const 0 i32.const 464 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2132,7 +2133,7 @@ if i32.const 0 i32.const 464 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2152,7 +2153,7 @@ if i32.const 0 i32.const 464 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/return-unreachable.release.wat b/tests/compiler/return-unreachable.release.wat index 77b8a23234..12060fa296 100644 --- a/tests/compiler/return-unreachable.release.wat +++ b/tests/compiler/return-unreachable.release.wat @@ -626,7 +626,7 @@ if i32.const 0 i32.const 1488 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -651,7 +651,7 @@ if i32.const 0 i32.const 1488 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -679,7 +679,7 @@ if i32.const 0 i32.const 1488 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1046,7 +1046,7 @@ if i32.const 0 i32.const 1488 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1130,7 +1130,7 @@ if i32.const 0 i32.const 1488 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1182,7 +1182,7 @@ if i32.const 0 i32.const 1488 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1271,7 +1271,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1281,12 +1281,12 @@ if i32.const 1152 i32.const 1488 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1307,50 +1307,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1358,7 +1362,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1367,7 +1371,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1375,7 +1379,7 @@ if i32.const 0 i32.const 1488 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1390,17 +1394,17 @@ if i32.const 0 i32.const 1488 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1409,12 +1413,12 @@ if i32.const 0 i32.const 1488 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1425,7 +1429,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1435,19 +1439,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/rt/alloc-large-memory.debug.wat b/tests/compiler/rt/alloc-large-memory.debug.wat index a2586176b7..a08978650b 100644 --- a/tests/compiler/rt/alloc-large-memory.debug.wat +++ b/tests/compiler/rt/alloc-large-memory.debug.wat @@ -678,7 +678,7 @@ if i32.const 0 i32.const 32 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -724,7 +724,7 @@ if i32.const 0 i32.const 32 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -757,7 +757,7 @@ if i32.const 0 i32.const 32 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -999,7 +999,7 @@ if i32.const 96 i32.const 32 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1008,6 +1008,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1037,24 +1057,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1092,7 +1101,7 @@ if i32.const 0 i32.const 32 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1163,7 +1172,7 @@ if i32.const 0 i32.const 32 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1227,19 +1236,11 @@ i32.const 0 drop local.get $size - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add + call $~lib/rt/tlsf/roundSize local.set $size end memory.size $0 @@ -1328,7 +1329,7 @@ if i32.const 0 i32.const 32 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -1443,7 +1444,7 @@ if i32.const 0 i32.const 32 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1463,7 +1464,7 @@ if i32.const 0 i32.const 32 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/alloc-large-memory.release.wat b/tests/compiler/rt/alloc-large-memory.release.wat index 52be1f0c56..fcb383a6b7 100644 --- a/tests/compiler/rt/alloc-large-memory.release.wat +++ b/tests/compiler/rt/alloc-large-memory.release.wat @@ -423,7 +423,7 @@ if i32.const 0 i32.const 1056 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -448,7 +448,7 @@ if i32.const 0 i32.const 1056 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -476,7 +476,7 @@ if i32.const 0 i32.const 1056 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -580,7 +580,7 @@ if i32.const 0 i32.const 1056 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -632,7 +632,7 @@ if i32.const 0 i32.const 1056 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -746,7 +746,7 @@ if i32.const 1120 i32.const 1056 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -771,6 +771,28 @@ if memory.size $0 local.tee $1 + local.get $0 + i32.const 256 + i32.gt_u + if (result i32) + local.get $0 + i32.const 1 + i32.const 27 + local.get $0 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $0 + local.get $0 + i32.const 536870910 + i32.lt_u + select + else + local.get $0 + end i32.const 4 local.get $3 i32.load $0 offset=1568 @@ -781,21 +803,6 @@ i32.sub i32.ne i32.shl - local.get $0 - i32.const 1 - i32.const 27 - local.get $0 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.get $0 - local.get $0 - i32.const 536870910 - i32.lt_u - select i32.add i32.const 65535 i32.add @@ -837,7 +844,7 @@ if i32.const 0 i32.const 1056 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -852,7 +859,7 @@ if i32.const 0 i32.const 1056 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -871,7 +878,7 @@ if i32.const 0 i32.const 1056 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.debug.wat b/tests/compiler/rt/finalize.debug.wat index b4e86d0a1c..61f29f55a5 100644 --- a/tests/compiler/rt/finalize.debug.wat +++ b/tests/compiler/rt/finalize.debug.wat @@ -1052,7 +1052,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1098,7 +1098,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1131,7 +1131,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1375,7 +1375,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1708,7 +1708,7 @@ if i32.const 32 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1717,6 +1717,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1746,24 +1766,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1801,7 +1810,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1872,7 +1881,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1935,6 +1944,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1956,22 +1973,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2037,7 +2038,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2152,7 +2153,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2172,7 +2173,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.release.wat b/tests/compiler/rt/finalize.release.wat index 0c1e01ce82..c72c96d7a2 100644 --- a/tests/compiler/rt/finalize.release.wat +++ b/tests/compiler/rt/finalize.release.wat @@ -623,7 +623,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -648,7 +648,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -676,7 +676,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1058,7 +1058,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1125,7 +1125,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1209,8 +1209,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1221,22 +1219,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1275,7 +1258,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1290,7 +1273,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-incremental-export.debug.wat b/tests/compiler/rt/runtime-incremental-export.debug.wat index 74ed896650..a00bf7a6a5 100644 --- a/tests/compiler/rt/runtime-incremental-export.debug.wat +++ b/tests/compiler/rt/runtime-incremental-export.debug.wat @@ -1039,7 +1039,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1085,7 +1085,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1362,7 +1362,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1691,7 +1691,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1700,6 +1700,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1729,24 +1749,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1784,7 +1793,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1855,7 +1864,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1918,6 +1927,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1939,22 +1956,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2020,7 +2021,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2135,7 +2136,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2155,7 +2156,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-incremental-export.release.wat b/tests/compiler/rt/runtime-incremental-export.release.wat index ad569bd9d1..5a50aa6cf1 100644 --- a/tests/compiler/rt/runtime-incremental-export.release.wat +++ b/tests/compiler/rt/runtime-incremental-export.release.wat @@ -635,7 +635,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -660,7 +660,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -688,7 +688,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1055,7 +1055,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1139,7 +1139,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1191,7 +1191,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1280,7 +1280,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1290,12 +1290,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1316,50 +1316,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1367,7 +1371,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1376,7 +1380,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1384,7 +1388,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1399,17 +1403,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1418,12 +1422,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1434,7 +1438,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1444,19 +1448,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/rt/runtime-minimal-export.debug.wat b/tests/compiler/rt/runtime-minimal-export.debug.wat index 6b66b131e6..fea06dd65c 100644 --- a/tests/compiler/rt/runtime-minimal-export.debug.wat +++ b/tests/compiler/rt/runtime-minimal-export.debug.wat @@ -695,7 +695,7 @@ if i32.const 0 i32.const 160 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -741,7 +741,7 @@ if i32.const 0 i32.const 160 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -774,7 +774,7 @@ if i32.const 0 i32.const 160 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1016,7 +1016,7 @@ if i32.const 32 i32.const 160 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1025,6 +1025,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1054,24 +1074,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1109,7 +1118,7 @@ if i32.const 0 i32.const 160 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1180,7 +1189,7 @@ if i32.const 0 i32.const 160 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1243,6 +1252,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1264,22 +1281,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -1345,7 +1346,7 @@ if i32.const 0 i32.const 160 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -1460,7 +1461,7 @@ if i32.const 0 i32.const 160 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1480,7 +1481,7 @@ if i32.const 0 i32.const 160 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1791,7 +1792,7 @@ if i32.const 0 i32.const 160 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/runtime-minimal-export.release.wat b/tests/compiler/rt/runtime-minimal-export.release.wat index 43657b23ab..d137bd0a13 100644 --- a/tests/compiler/rt/runtime-minimal-export.release.wat +++ b/tests/compiler/rt/runtime-minimal-export.release.wat @@ -442,7 +442,7 @@ if i32.const 0 i32.const 1184 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -467,7 +467,7 @@ if i32.const 0 i32.const 1184 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -495,7 +495,7 @@ if i32.const 0 i32.const 1184 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -679,7 +679,7 @@ if i32.const 0 i32.const 1184 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -731,7 +731,7 @@ if i32.const 0 i32.const 1184 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -775,7 +775,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -785,12 +785,12 @@ if i32.const 1056 i32.const 1184 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -811,50 +811,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -862,7 +866,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -871,7 +875,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -879,7 +883,7 @@ if i32.const 0 i32.const 1184 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -894,17 +898,17 @@ if i32.const 0 i32.const 1184 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -913,12 +917,12 @@ if i32.const 0 i32.const 1184 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -929,7 +933,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -939,19 +943,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 @@ -1341,7 +1345,7 @@ if i32.const 0 i32.const 1184 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/simd.debug.wat b/tests/compiler/simd.debug.wat index 44e5fc9f13..e298582400 100644 --- a/tests/compiler/simd.debug.wat +++ b/tests/compiler/simd.debug.wat @@ -1,6 +1,6 @@ (module - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -1072,7 +1072,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1118,7 +1118,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1151,7 +1151,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1395,7 +1395,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1724,7 +1724,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1733,6 +1733,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1762,24 +1782,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1817,7 +1826,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1888,7 +1897,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1951,6 +1960,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1972,22 +1989,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2053,7 +2054,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2168,7 +2169,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2188,7 +2189,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/simd.release.wat b/tests/compiler/simd.release.wat index 175bff7fd1..71eb05033c 100644 --- a/tests/compiler/simd.release.wat +++ b/tests/compiler/simd.release.wat @@ -651,7 +651,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -676,7 +676,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -704,7 +704,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -872,7 +872,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1161,7 +1161,7 @@ if i32.const 0 i32.const 1440 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1213,7 +1213,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1244,7 +1244,7 @@ if i32.const 1104 i32.const 1440 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1270,6 +1270,27 @@ memory.size $0 local.tee $1 local.get $3 + i32.const 256 + i32.gt_u + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + else + local.get $3 + end i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1281,23 +1302,6 @@ i32.ne i32.shl i32.add - local.tee $2 - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $2 - i32.const 1 - i32.const 27 - local.get $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - else - local.get $2 - end i32.const 65535 i32.add i32.const -65536 @@ -1338,7 +1342,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1353,7 +1357,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1363,7 +1367,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $2 + local.set $4 local.get $3 i32.const 4 i32.add @@ -1372,23 +1376,23 @@ if i32.const 0 i32.const 1440 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $4 i32.const -4 i32.and local.get $3 i32.sub - local.tee $4 + local.tee $2 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $2 + local.get $4 i32.const 2 i32.and i32.or @@ -1398,19 +1402,19 @@ i32.add local.get $3 i32.add - local.tee $2 - local.get $4 + local.tee $3 + local.get $2 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $2 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $2 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/array-literal.debug.wat b/tests/compiler/std/array-literal.debug.wat index ce60559f0b..9176dcf2e4 100644 --- a/tests/compiler/std/array-literal.debug.wat +++ b/tests/compiler/std/array-literal.debug.wat @@ -1068,7 +1068,7 @@ if i32.const 0 i32.const 720 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1114,7 +1114,7 @@ if i32.const 0 i32.const 720 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1147,7 +1147,7 @@ if i32.const 0 i32.const 720 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1391,7 +1391,7 @@ if i32.const 0 i32.const 720 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1720,7 +1720,7 @@ if i32.const 448 i32.const 720 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1729,6 +1729,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1758,24 +1778,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1813,7 +1822,7 @@ if i32.const 0 i32.const 720 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1884,7 +1893,7 @@ if i32.const 0 i32.const 720 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1947,6 +1956,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1968,22 +1985,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2049,7 +2050,7 @@ if i32.const 0 i32.const 720 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2164,7 +2165,7 @@ if i32.const 0 i32.const 720 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2184,7 +2185,7 @@ if i32.const 0 i32.const 720 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array-literal.release.wat b/tests/compiler/std/array-literal.release.wat index feebdc2325..9c0e2cda60 100644 --- a/tests/compiler/std/array-literal.release.wat +++ b/tests/compiler/std/array-literal.release.wat @@ -681,7 +681,7 @@ if i32.const 0 i32.const 1744 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -706,7 +706,7 @@ if i32.const 0 i32.const 1744 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -734,7 +734,7 @@ if i32.const 0 i32.const 1744 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1101,7 +1101,7 @@ if i32.const 0 i32.const 1744 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1185,7 +1185,7 @@ if i32.const 0 i32.const 1744 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1237,7 +1237,7 @@ if i32.const 0 i32.const 1744 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1326,7 +1326,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1336,12 +1336,12 @@ if i32.const 1472 i32.const 1744 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1362,50 +1362,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1413,7 +1417,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1422,7 +1426,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1430,7 +1434,7 @@ if i32.const 0 i32.const 1744 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1445,17 +1449,17 @@ if i32.const 0 i32.const 1744 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1464,12 +1468,12 @@ if i32.const 0 i32.const 1744 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1480,7 +1484,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1490,19 +1494,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/array.debug.wat b/tests/compiler/std/array.debug.wat index 36502659fb..005d640cc3 100644 --- a/tests/compiler/std/array.debug.wat +++ b/tests/compiler/std/array.debug.wat @@ -1377,7 +1377,7 @@ if i32.const 0 i32.const 464 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1423,7 +1423,7 @@ if i32.const 0 i32.const 464 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1456,7 +1456,7 @@ if i32.const 0 i32.const 464 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1700,7 +1700,7 @@ if i32.const 0 i32.const 464 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2029,7 +2029,7 @@ if i32.const 128 i32.const 464 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2038,6 +2038,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2067,24 +2087,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2122,7 +2131,7 @@ if i32.const 0 i32.const 464 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2193,7 +2202,7 @@ if i32.const 0 i32.const 464 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2256,6 +2265,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2277,22 +2294,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2358,7 +2359,7 @@ if i32.const 0 i32.const 464 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2473,7 +2474,7 @@ if i32.const 0 i32.const 464 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2493,7 +2494,7 @@ if i32.const 0 i32.const 464 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.release.wat b/tests/compiler/std/array.release.wat index d5f9f8ba73..69654bf0ad 100644 --- a/tests/compiler/std/array.release.wat +++ b/tests/compiler/std/array.release.wat @@ -1276,7 +1276,7 @@ if i32.const 0 i32.const 1488 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1301,7 +1301,7 @@ if i32.const 0 i32.const 1488 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1329,7 +1329,7 @@ if i32.const 0 i32.const 1488 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1497,7 +1497,7 @@ if i32.const 0 i32.const 1488 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1786,7 +1786,7 @@ if i32.const 0 i32.const 1488 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1838,7 +1838,7 @@ if i32.const 0 i32.const 1488 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1869,7 +1869,7 @@ if i32.const 1152 i32.const 1488 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1895,6 +1895,27 @@ memory.size $0 local.tee $1 local.get $3 + i32.const 256 + i32.gt_u + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + else + local.get $3 + end i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1906,23 +1927,6 @@ i32.ne i32.shl i32.add - local.tee $2 - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $2 - i32.const 1 - i32.const 27 - local.get $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - else - local.get $2 - end i32.const 65535 i32.add i32.const -65536 @@ -1963,7 +1967,7 @@ if i32.const 0 i32.const 1488 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1978,7 +1982,7 @@ if i32.const 0 i32.const 1488 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1988,7 +1992,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $2 + local.set $4 local.get $3 i32.const 4 i32.add @@ -1997,23 +2001,23 @@ if i32.const 0 i32.const 1488 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $4 i32.const -4 i32.and local.get $3 i32.sub - local.tee $4 + local.tee $2 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $2 + local.get $4 i32.const 2 i32.and i32.or @@ -2023,19 +2027,19 @@ i32.add local.get $3 i32.add - local.tee $2 - local.get $4 + local.tee $3 + local.get $2 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $2 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $2 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/arraybuffer.debug.wat b/tests/compiler/std/arraybuffer.debug.wat index 19f1fa7b77..4a68f00b1b 100644 --- a/tests/compiler/std/arraybuffer.debug.wat +++ b/tests/compiler/std/arraybuffer.debug.wat @@ -1041,7 +1041,7 @@ if i32.const 0 i32.const 480 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1087,7 +1087,7 @@ if i32.const 0 i32.const 480 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1120,7 +1120,7 @@ if i32.const 0 i32.const 480 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1364,7 +1364,7 @@ if i32.const 0 i32.const 480 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1693,7 +1693,7 @@ if i32.const 144 i32.const 480 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1702,6 +1702,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1731,24 +1751,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1786,7 +1795,7 @@ if i32.const 0 i32.const 480 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1857,7 +1866,7 @@ if i32.const 0 i32.const 480 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1920,6 +1929,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1941,22 +1958,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2022,7 +2023,7 @@ if i32.const 0 i32.const 480 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2137,7 +2138,7 @@ if i32.const 0 i32.const 480 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2157,7 +2158,7 @@ if i32.const 0 i32.const 480 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/arraybuffer.release.wat b/tests/compiler/std/arraybuffer.release.wat index 8ea81ac2a1..694d0d8bae 100644 --- a/tests/compiler/std/arraybuffer.release.wat +++ b/tests/compiler/std/arraybuffer.release.wat @@ -632,7 +632,7 @@ if i32.const 0 i32.const 1504 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -657,7 +657,7 @@ if i32.const 0 i32.const 1504 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -685,7 +685,7 @@ if i32.const 0 i32.const 1504 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1052,7 +1052,7 @@ if i32.const 0 i32.const 1504 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1136,7 +1136,7 @@ if i32.const 0 i32.const 1504 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1188,7 +1188,7 @@ if i32.const 0 i32.const 1504 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1277,7 +1277,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1287,12 +1287,12 @@ if i32.const 1168 i32.const 1504 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1313,50 +1313,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1364,7 +1368,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1373,7 +1377,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1381,7 +1385,7 @@ if i32.const 0 i32.const 1504 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1396,17 +1400,17 @@ if i32.const 0 i32.const 1504 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1415,12 +1419,12 @@ if i32.const 0 i32.const 1504 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1431,7 +1435,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1441,19 +1445,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/dataview.debug.wat b/tests/compiler/std/dataview.debug.wat index 04047fb7bb..0af1e509aa 100644 --- a/tests/compiler/std/dataview.debug.wat +++ b/tests/compiler/std/dataview.debug.wat @@ -1047,7 +1047,7 @@ if i32.const 0 i32.const 480 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1093,7 +1093,7 @@ if i32.const 0 i32.const 480 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1126,7 +1126,7 @@ if i32.const 0 i32.const 480 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1370,7 +1370,7 @@ if i32.const 0 i32.const 480 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1699,7 +1699,7 @@ if i32.const 144 i32.const 480 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1708,6 +1708,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1737,24 +1757,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1792,7 +1801,7 @@ if i32.const 0 i32.const 480 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1863,7 +1872,7 @@ if i32.const 0 i32.const 480 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1926,6 +1935,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1947,22 +1964,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2028,7 +2029,7 @@ if i32.const 0 i32.const 480 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2143,7 +2144,7 @@ if i32.const 0 i32.const 480 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2163,7 +2164,7 @@ if i32.const 0 i32.const 480 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/dataview.release.wat b/tests/compiler/std/dataview.release.wat index e076874dbd..5106bbec41 100644 --- a/tests/compiler/std/dataview.release.wat +++ b/tests/compiler/std/dataview.release.wat @@ -640,7 +640,7 @@ if i32.const 0 i32.const 1504 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -665,7 +665,7 @@ if i32.const 0 i32.const 1504 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -693,7 +693,7 @@ if i32.const 0 i32.const 1504 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1060,7 +1060,7 @@ if i32.const 0 i32.const 1504 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1144,7 +1144,7 @@ if i32.const 0 i32.const 1504 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1196,7 +1196,7 @@ if i32.const 0 i32.const 1504 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1285,7 +1285,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1295,12 +1295,12 @@ if i32.const 1168 i32.const 1504 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1321,50 +1321,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1372,7 +1376,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1381,7 +1385,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1389,7 +1393,7 @@ if i32.const 0 i32.const 1504 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1404,17 +1408,17 @@ if i32.const 0 i32.const 1504 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1423,12 +1427,12 @@ if i32.const 0 i32.const 1504 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1439,7 +1443,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1449,19 +1453,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/date.debug.wat b/tests/compiler/std/date.debug.wat index 26ae929c5d..72bb6b0dbb 100644 --- a/tests/compiler/std/date.debug.wat +++ b/tests/compiler/std/date.debug.wat @@ -1425,7 +1425,7 @@ if i32.const 0 i32.const 512 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1471,7 +1471,7 @@ if i32.const 0 i32.const 512 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1504,7 +1504,7 @@ if i32.const 0 i32.const 512 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1748,7 +1748,7 @@ if i32.const 0 i32.const 512 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2077,7 +2077,7 @@ if i32.const 176 i32.const 512 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2086,6 +2086,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2115,24 +2135,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2170,7 +2179,7 @@ if i32.const 0 i32.const 512 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2241,7 +2250,7 @@ if i32.const 0 i32.const 512 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2304,6 +2313,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2325,22 +2342,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2406,7 +2407,7 @@ if i32.const 0 i32.const 512 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2521,7 +2522,7 @@ if i32.const 0 i32.const 512 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2541,7 +2542,7 @@ if i32.const 0 i32.const 512 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/date.release.wat b/tests/compiler/std/date.release.wat index 88226d73c1..336a12ad9c 100644 --- a/tests/compiler/std/date.release.wat +++ b/tests/compiler/std/date.release.wat @@ -1006,7 +1006,7 @@ if i32.const 0 i32.const 1536 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1031,7 +1031,7 @@ if i32.const 0 i32.const 1536 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1059,7 +1059,7 @@ if i32.const 0 i32.const 1536 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1426,7 +1426,7 @@ if i32.const 0 i32.const 1536 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1510,7 +1510,7 @@ if i32.const 0 i32.const 1536 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1562,7 +1562,7 @@ if i32.const 0 i32.const 1536 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1651,7 +1651,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1661,12 +1661,12 @@ if i32.const 1200 i32.const 1536 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1687,50 +1687,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1738,7 +1742,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1747,7 +1751,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1755,7 +1759,7 @@ if i32.const 0 i32.const 1536 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1770,17 +1774,17 @@ if i32.const 0 i32.const 1536 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1789,12 +1793,12 @@ if i32.const 0 i32.const 1536 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1805,7 +1809,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1815,19 +1819,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/map.debug.wat b/tests/compiler/std/map.debug.wat index 9d026b4c0f..e3552d1feb 100644 --- a/tests/compiler/std/map.debug.wat +++ b/tests/compiler/std/map.debug.wat @@ -1064,7 +1064,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1110,7 +1110,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1143,7 +1143,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1387,7 +1387,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1716,7 +1716,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1725,6 +1725,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1754,24 +1774,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1809,7 +1818,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1880,7 +1889,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1943,6 +1952,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1964,22 +1981,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2045,7 +2046,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2160,7 +2161,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2180,7 +2181,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/map.release.wat b/tests/compiler/std/map.release.wat index 78d44727d1..36a6217732 100644 --- a/tests/compiler/std/map.release.wat +++ b/tests/compiler/std/map.release.wat @@ -652,7 +652,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -677,7 +677,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -705,7 +705,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1072,7 +1072,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1156,7 +1156,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1208,7 +1208,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1297,7 +1297,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1307,12 +1307,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1333,50 +1333,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1384,7 +1388,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1393,7 +1397,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1401,7 +1405,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1416,17 +1420,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1435,12 +1439,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1451,7 +1455,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1461,19 +1465,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/new.debug.wat b/tests/compiler/std/new.debug.wat index 2d72a8ee0a..2f4bbe4dd8 100644 --- a/tests/compiler/std/new.debug.wat +++ b/tests/compiler/std/new.debug.wat @@ -1050,7 +1050,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1096,7 +1096,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1129,7 +1129,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1373,7 +1373,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1702,7 +1702,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1711,6 +1711,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1740,24 +1760,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1795,7 +1804,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1866,7 +1875,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1929,6 +1938,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1950,22 +1967,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2031,7 +2032,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2146,7 +2147,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2166,7 +2167,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/new.release.wat b/tests/compiler/std/new.release.wat index 51c7f66e60..f42da5d035 100644 --- a/tests/compiler/std/new.release.wat +++ b/tests/compiler/std/new.release.wat @@ -625,7 +625,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -650,7 +650,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -678,7 +678,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1045,7 +1045,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1112,7 +1112,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1196,8 +1196,6 @@ if memory.size $0 local.tee $0 - i32.const 1 - i32.const 27 i32.const 4 local.get $1 i32.load $0 offset=1568 @@ -1208,22 +1206,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $2 - i32.add - local.get $2 - local.get $2 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1262,7 +1245,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1277,7 +1260,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/operator-overloading.debug.wat b/tests/compiler/std/operator-overloading.debug.wat index 79a9d7736b..a5cb8b49a8 100644 --- a/tests/compiler/std/operator-overloading.debug.wat +++ b/tests/compiler/std/operator-overloading.debug.wat @@ -1106,7 +1106,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1152,7 +1152,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1185,7 +1185,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1429,7 +1429,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1758,7 +1758,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1767,6 +1767,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1796,24 +1816,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1851,7 +1860,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1922,7 +1931,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1985,6 +1994,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2006,22 +2023,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2087,7 +2088,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2202,7 +2203,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2222,7 +2223,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/operator-overloading.release.wat b/tests/compiler/std/operator-overloading.release.wat index a9a7997be8..5e5f9130c8 100644 --- a/tests/compiler/std/operator-overloading.release.wat +++ b/tests/compiler/std/operator-overloading.release.wat @@ -558,7 +558,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -583,7 +583,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -611,7 +611,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -978,7 +978,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1045,7 +1045,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1129,8 +1129,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1141,22 +1139,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1195,7 +1178,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1210,7 +1193,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.debug.wat b/tests/compiler/std/set.debug.wat index 15152949f8..f1ab038bca 100644 --- a/tests/compiler/std/set.debug.wat +++ b/tests/compiler/std/set.debug.wat @@ -1059,7 +1059,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1105,7 +1105,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1138,7 +1138,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1382,7 +1382,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1711,7 +1711,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1720,6 +1720,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1749,24 +1769,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1804,7 +1813,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1875,7 +1884,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1938,6 +1947,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1959,22 +1976,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2040,7 +2041,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2155,7 +2156,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2175,7 +2176,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.release.wat b/tests/compiler/std/set.release.wat index 3b5e7bb9a2..3e7d9edf5e 100644 --- a/tests/compiler/std/set.release.wat +++ b/tests/compiler/std/set.release.wat @@ -643,7 +643,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -668,7 +668,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -696,7 +696,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1063,7 +1063,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1147,7 +1147,7 @@ if i32.const 0 i32.const 1392 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1199,7 +1199,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1288,7 +1288,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1298,12 +1298,12 @@ if i32.const 1056 i32.const 1392 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1324,50 +1324,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1375,7 +1379,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1384,7 +1388,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1392,7 +1396,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1407,17 +1411,17 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1426,12 +1430,12 @@ if i32.const 0 i32.const 1392 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1442,7 +1446,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1452,19 +1456,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/static-array.debug.wat b/tests/compiler/std/static-array.debug.wat index e9e29fe286..fd9a4a452d 100644 --- a/tests/compiler/std/static-array.debug.wat +++ b/tests/compiler/std/static-array.debug.wat @@ -1075,7 +1075,7 @@ if i32.const 0 i32.const 880 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1121,7 +1121,7 @@ if i32.const 0 i32.const 880 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1154,7 +1154,7 @@ if i32.const 0 i32.const 880 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1398,7 +1398,7 @@ if i32.const 0 i32.const 880 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1727,7 +1727,7 @@ if i32.const 608 i32.const 880 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1736,6 +1736,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1765,24 +1785,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1820,7 +1829,7 @@ if i32.const 0 i32.const 880 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1891,7 +1900,7 @@ if i32.const 0 i32.const 880 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1954,6 +1963,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1975,22 +1992,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2056,7 +2057,7 @@ if i32.const 0 i32.const 880 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2171,7 +2172,7 @@ if i32.const 0 i32.const 880 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2191,7 +2192,7 @@ if i32.const 0 i32.const 880 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/static-array.release.wat b/tests/compiler/std/static-array.release.wat index 5be99d0f5a..9ca7df78b3 100644 --- a/tests/compiler/std/static-array.release.wat +++ b/tests/compiler/std/static-array.release.wat @@ -655,7 +655,7 @@ if i32.const 0 i32.const 1904 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -680,7 +680,7 @@ if i32.const 0 i32.const 1904 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -708,7 +708,7 @@ if i32.const 0 i32.const 1904 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1075,7 +1075,7 @@ if i32.const 0 i32.const 1904 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1159,7 +1159,7 @@ if i32.const 0 i32.const 1904 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1211,7 +1211,7 @@ if i32.const 0 i32.const 1904 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1465,7 +1465,7 @@ local.tee $2 i32.const 20 i32.sub - local.tee $4 + local.tee $6 i32.load $0 i32.const -4 i32.and @@ -1473,14 +1473,14 @@ i32.sub i32.le_u if - local.get $4 + local.get $6 local.get $3 i32.store $0 offset=16 local.get $2 local.set $1 br $__inlined_func$~lib/rt/itcms/__renew end - local.get $4 + local.get $6 i32.load $0 offset=12 local.set $7 local.get $3 @@ -1545,7 +1545,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $5 + local.set $4 local.get $3 i32.const 16 i32.add @@ -1555,12 +1555,12 @@ if i32.const 1632 i32.const 1904 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 12 local.get $1 i32.const 19 @@ -1581,50 +1581,54 @@ memory.size $0 local.tee $1 local.get $8 - i32.const 4 - local.get $5 - i32.load $0 offset=1568 - local.get $1 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $6 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $6 + local.get $8 i32.const 1 i32.const 27 - local.get $6 + local.get $8 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $8 + local.get $8 + i32.const 536870910 + i32.lt_u + select else - local.get $6 + local.get $8 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $1 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $6 + local.tee $5 local.get $1 - local.get $6 + local.get $5 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $6 + local.get $5 memory.grow $0 i32.const 0 i32.lt_s @@ -1632,7 +1636,7 @@ unreachable end end - local.get $5 + local.get $4 local.get $1 i32.const 16 i32.shl @@ -1641,7 +1645,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $5 + local.get $4 local.get $8 call $~lib/rt/tlsf/searchBlock local.tee $1 @@ -1649,7 +1653,7 @@ if i32.const 0 i32.const 1904 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1664,17 +1668,17 @@ if i32.const 0 i32.const 1904 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 local.get $1 call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $6 + local.set $5 local.get $8 i32.const 4 i32.add @@ -1683,12 +1687,12 @@ if i32.const 0 i32.const 1904 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $6 + local.get $5 i32.const -4 i32.and local.get $8 @@ -1699,7 +1703,7 @@ if local.get $1 local.get $8 - local.get $6 + local.get $5 i32.const 2 i32.and i32.or @@ -1709,19 +1713,19 @@ i32.add local.get $8 i32.add - local.tee $6 + local.tee $5 local.get $9 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 + local.get $4 local.get $5 - local.get $6 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $6 + local.get $5 i32.const -2 i32.and i32.store $0 @@ -1733,8 +1737,8 @@ i32.const -4 i32.and i32.add - local.tee $5 - local.get $5 + local.tee $4 + local.get $4 i32.load $0 i32.const -3 i32.and @@ -1747,26 +1751,26 @@ local.get $3 i32.store $0 offset=16 global.get $~lib/rt/itcms/fromSpace - local.tee $5 + local.tee $4 i32.load $0 offset=8 - local.set $6 + local.set $5 local.get $1 - local.get $5 + local.get $4 global.get $~lib/rt/itcms/white i32.or i32.store $0 offset=4 local.get $1 - local.get $6 + local.get $5 i32.store $0 offset=8 - local.get $6 + local.get $5 local.get $1 - local.get $6 + local.get $5 i32.load $0 offset=4 i32.const 3 i32.and i32.or i32.store $0 offset=4 - local.get $5 + local.get $4 local.get $1 i32.store $0 offset=8 global.get $~lib/rt/itcms/total @@ -1788,7 +1792,7 @@ local.get $1 local.get $2 local.get $3 - local.get $4 + local.get $6 i32.load $0 offset=16 local.tee $4 local.get $3 diff --git a/tests/compiler/std/staticarray.debug.wat b/tests/compiler/std/staticarray.debug.wat index 93273d1928..8ee445629c 100644 --- a/tests/compiler/std/staticarray.debug.wat +++ b/tests/compiler/std/staticarray.debug.wat @@ -1136,7 +1136,7 @@ if i32.const 0 i32.const 592 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1182,7 +1182,7 @@ if i32.const 0 i32.const 592 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1215,7 +1215,7 @@ if i32.const 0 i32.const 592 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1459,7 +1459,7 @@ if i32.const 0 i32.const 592 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1788,7 +1788,7 @@ if i32.const 320 i32.const 592 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1797,6 +1797,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1826,24 +1846,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1881,7 +1890,7 @@ if i32.const 0 i32.const 592 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1952,7 +1961,7 @@ if i32.const 0 i32.const 592 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2015,6 +2024,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2036,22 +2053,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2117,7 +2118,7 @@ if i32.const 0 i32.const 592 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2232,7 +2233,7 @@ if i32.const 0 i32.const 592 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2252,7 +2253,7 @@ if i32.const 0 i32.const 592 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.release.wat b/tests/compiler/std/staticarray.release.wat index 438c83e5d5..1557094b2f 100644 --- a/tests/compiler/std/staticarray.release.wat +++ b/tests/compiler/std/staticarray.release.wat @@ -769,7 +769,7 @@ if i32.const 0 i32.const 1616 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -794,7 +794,7 @@ if i32.const 0 i32.const 1616 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -822,7 +822,7 @@ if i32.const 0 i32.const 1616 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -990,7 +990,7 @@ if i32.const 0 i32.const 1616 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1279,7 +1279,7 @@ if i32.const 0 i32.const 1616 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1331,7 +1331,7 @@ if i32.const 0 i32.const 1616 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1362,7 +1362,7 @@ if i32.const 1344 i32.const 1616 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1388,6 +1388,27 @@ memory.size $0 local.tee $1 local.get $3 + i32.const 256 + i32.gt_u + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + else + local.get $3 + end i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1399,23 +1420,6 @@ i32.ne i32.shl i32.add - local.tee $2 - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $2 - i32.const 1 - i32.const 27 - local.get $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - else - local.get $2 - end i32.const 65535 i32.add i32.const -65536 @@ -1456,7 +1460,7 @@ if i32.const 0 i32.const 1616 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1471,7 +1475,7 @@ if i32.const 0 i32.const 1616 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1481,7 +1485,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $2 + local.set $4 local.get $3 i32.const 4 i32.add @@ -1490,23 +1494,23 @@ if i32.const 0 i32.const 1616 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $4 i32.const -4 i32.and local.get $3 i32.sub - local.tee $4 + local.tee $2 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $2 + local.get $4 i32.const 2 i32.and i32.or @@ -1516,19 +1520,19 @@ i32.add local.get $3 i32.add - local.tee $2 - local.get $4 + local.tee $3 + local.get $2 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $2 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $2 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/string-casemapping.debug.wat b/tests/compiler/std/string-casemapping.debug.wat index 8ff8bb0d05..5cbd00a572 100644 --- a/tests/compiler/std/string-casemapping.debug.wat +++ b/tests/compiler/std/string-casemapping.debug.wat @@ -1227,7 +1227,7 @@ if i32.const 0 i32.const 400 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1273,7 +1273,7 @@ if i32.const 0 i32.const 400 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1306,7 +1306,7 @@ if i32.const 0 i32.const 400 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1550,7 +1550,7 @@ if i32.const 0 i32.const 400 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1879,7 +1879,7 @@ if i32.const 64 i32.const 400 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1888,6 +1888,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1917,24 +1937,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1972,7 +1981,7 @@ if i32.const 0 i32.const 400 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2043,7 +2052,7 @@ if i32.const 0 i32.const 400 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2106,6 +2115,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2127,22 +2144,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2208,7 +2209,7 @@ if i32.const 0 i32.const 400 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2323,7 +2324,7 @@ if i32.const 0 i32.const 400 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2343,7 +2344,7 @@ if i32.const 0 i32.const 400 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-casemapping.release.wat b/tests/compiler/std/string-casemapping.release.wat index e042af53ba..47600923d5 100644 --- a/tests/compiler/std/string-casemapping.release.wat +++ b/tests/compiler/std/string-casemapping.release.wat @@ -1074,7 +1074,7 @@ if i32.const 0 i32.const 1424 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1099,7 +1099,7 @@ if i32.const 0 i32.const 1424 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1127,7 +1127,7 @@ if i32.const 0 i32.const 1424 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1494,7 +1494,7 @@ if i32.const 0 i32.const 1424 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1578,7 +1578,7 @@ if i32.const 0 i32.const 1424 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1630,7 +1630,7 @@ if i32.const 0 i32.const 1424 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1719,7 +1719,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1729,12 +1729,12 @@ if i32.const 1088 i32.const 1424 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1755,50 +1755,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1806,7 +1810,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1815,7 +1819,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1823,7 +1827,7 @@ if i32.const 0 i32.const 1424 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1838,17 +1842,17 @@ if i32.const 0 i32.const 1424 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1857,12 +1861,12 @@ if i32.const 0 i32.const 1424 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1873,7 +1877,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1883,19 +1887,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/string-encoding.debug.wat b/tests/compiler/std/string-encoding.debug.wat index 53baf231a5..fd03ee0eee 100644 --- a/tests/compiler/std/string-encoding.debug.wat +++ b/tests/compiler/std/string-encoding.debug.wat @@ -1066,7 +1066,7 @@ if i32.const 0 i32.const 464 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1112,7 +1112,7 @@ if i32.const 0 i32.const 464 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1145,7 +1145,7 @@ if i32.const 0 i32.const 464 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1389,7 +1389,7 @@ if i32.const 0 i32.const 464 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1718,7 +1718,7 @@ if i32.const 128 i32.const 464 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1727,6 +1727,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1756,24 +1776,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1811,7 +1820,7 @@ if i32.const 0 i32.const 464 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1882,7 +1891,7 @@ if i32.const 0 i32.const 464 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1945,6 +1954,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1966,22 +1983,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2047,7 +2048,7 @@ if i32.const 0 i32.const 464 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2162,7 +2163,7 @@ if i32.const 0 i32.const 464 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2182,7 +2183,7 @@ if i32.const 0 i32.const 464 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-encoding.release.wat b/tests/compiler/std/string-encoding.release.wat index f38daf34fc..010e40240e 100644 --- a/tests/compiler/std/string-encoding.release.wat +++ b/tests/compiler/std/string-encoding.release.wat @@ -661,7 +661,7 @@ if i32.const 0 i32.const 1488 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -686,7 +686,7 @@ if i32.const 0 i32.const 1488 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -714,7 +714,7 @@ if i32.const 0 i32.const 1488 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1081,7 +1081,7 @@ if i32.const 0 i32.const 1488 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1165,7 +1165,7 @@ if i32.const 0 i32.const 1488 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1217,7 +1217,7 @@ if i32.const 0 i32.const 1488 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1306,7 +1306,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1316,12 +1316,12 @@ if i32.const 1152 i32.const 1488 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1342,50 +1342,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1393,7 +1397,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1402,7 +1406,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1410,7 +1414,7 @@ if i32.const 0 i32.const 1488 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1425,17 +1429,17 @@ if i32.const 0 i32.const 1488 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1444,12 +1448,12 @@ if i32.const 0 i32.const 1488 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1460,7 +1464,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1470,19 +1474,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/string.debug.wat b/tests/compiler/std/string.debug.wat index bc04b64a18..817f6e7ed6 100644 --- a/tests/compiler/std/string.debug.wat +++ b/tests/compiler/std/string.debug.wat @@ -1657,7 +1657,7 @@ if i32.const 0 i32.const 624 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1703,7 +1703,7 @@ if i32.const 0 i32.const 624 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1736,7 +1736,7 @@ if i32.const 0 i32.const 624 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1980,7 +1980,7 @@ if i32.const 0 i32.const 624 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2309,7 +2309,7 @@ if i32.const 352 i32.const 624 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2318,6 +2318,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2347,24 +2367,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2402,7 +2411,7 @@ if i32.const 0 i32.const 624 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2473,7 +2482,7 @@ if i32.const 0 i32.const 624 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2536,6 +2545,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2557,22 +2574,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2638,7 +2639,7 @@ if i32.const 0 i32.const 624 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2753,7 +2754,7 @@ if i32.const 0 i32.const 624 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2773,7 +2774,7 @@ if i32.const 0 i32.const 624 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string.release.wat b/tests/compiler/std/string.release.wat index e024eaa3ed..af2294838d 100644 --- a/tests/compiler/std/string.release.wat +++ b/tests/compiler/std/string.release.wat @@ -1653,7 +1653,7 @@ if i32.const 0 i32.const 1648 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1678,7 +1678,7 @@ if i32.const 0 i32.const 1648 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1706,7 +1706,7 @@ if i32.const 0 i32.const 1648 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -2073,7 +2073,7 @@ if i32.const 0 i32.const 1648 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2157,7 +2157,7 @@ if i32.const 0 i32.const 1648 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2209,7 +2209,7 @@ if i32.const 0 i32.const 1648 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2298,7 +2298,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -2308,12 +2308,12 @@ if i32.const 1376 i32.const 1648 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -2334,50 +2334,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -2385,7 +2389,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -2394,7 +2398,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -2402,7 +2406,7 @@ if i32.const 0 i32.const 1648 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2417,17 +2421,17 @@ if i32.const 0 i32.const 1648 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -2436,12 +2440,12 @@ if i32.const 0 i32.const 1648 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -2452,7 +2456,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -2462,19 +2466,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/symbol.debug.wat b/tests/compiler/std/symbol.debug.wat index c0035e3635..99c3023b30 100644 --- a/tests/compiler/std/symbol.debug.wat +++ b/tests/compiler/std/symbol.debug.wat @@ -1095,7 +1095,7 @@ if i32.const 0 i32.const 448 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1141,7 +1141,7 @@ if i32.const 0 i32.const 448 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1174,7 +1174,7 @@ if i32.const 0 i32.const 448 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1418,7 +1418,7 @@ if i32.const 0 i32.const 448 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1747,7 +1747,7 @@ if i32.const 112 i32.const 448 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1756,6 +1756,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1785,24 +1805,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1840,7 +1849,7 @@ if i32.const 0 i32.const 448 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1911,7 +1920,7 @@ if i32.const 0 i32.const 448 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1974,6 +1983,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1995,22 +2012,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2076,7 +2077,7 @@ if i32.const 0 i32.const 448 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2191,7 +2192,7 @@ if i32.const 0 i32.const 448 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2211,7 +2212,7 @@ if i32.const 0 i32.const 448 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/symbol.release.wat b/tests/compiler/std/symbol.release.wat index e5324e4b6b..7a32b25636 100644 --- a/tests/compiler/std/symbol.release.wat +++ b/tests/compiler/std/symbol.release.wat @@ -724,7 +724,7 @@ if i32.const 0 i32.const 1472 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -749,7 +749,7 @@ if i32.const 0 i32.const 1472 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -777,7 +777,7 @@ if i32.const 0 i32.const 1472 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1144,7 +1144,7 @@ if i32.const 0 i32.const 1472 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1228,7 +1228,7 @@ if i32.const 0 i32.const 1472 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1280,7 +1280,7 @@ if i32.const 0 i32.const 1472 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1369,7 +1369,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1379,12 +1379,12 @@ if i32.const 1136 i32.const 1472 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1405,50 +1405,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1456,7 +1460,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1465,7 +1469,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1473,7 +1477,7 @@ if i32.const 0 i32.const 1472 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1488,17 +1492,17 @@ if i32.const 0 i32.const 1472 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1507,12 +1511,12 @@ if i32.const 0 i32.const 1472 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1523,7 +1527,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1533,19 +1537,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index 3d1643f8b4..73304b1ae6 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -1404,7 +1404,7 @@ if i32.const 0 i32.const 480 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1450,7 +1450,7 @@ if i32.const 0 i32.const 480 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1483,7 +1483,7 @@ if i32.const 0 i32.const 480 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1727,7 +1727,7 @@ if i32.const 0 i32.const 480 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2056,7 +2056,7 @@ if i32.const 144 i32.const 480 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2065,6 +2065,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2094,24 +2114,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2149,7 +2158,7 @@ if i32.const 0 i32.const 480 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2220,7 +2229,7 @@ if i32.const 0 i32.const 480 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2283,6 +2292,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2304,22 +2321,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2385,7 +2386,7 @@ if i32.const 0 i32.const 480 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2500,7 +2501,7 @@ if i32.const 0 i32.const 480 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2520,7 +2521,7 @@ if i32.const 0 i32.const 480 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.release.wat b/tests/compiler/std/typedarray.release.wat index ae671ce8fe..d85b5ea703 100644 --- a/tests/compiler/std/typedarray.release.wat +++ b/tests/compiler/std/typedarray.release.wat @@ -1285,7 +1285,7 @@ if i32.const 0 i32.const 1504 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1310,7 +1310,7 @@ if i32.const 0 i32.const 1504 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1338,7 +1338,7 @@ if i32.const 0 i32.const 1504 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1506,7 +1506,7 @@ if i32.const 0 i32.const 1504 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1795,7 +1795,7 @@ if i32.const 0 i32.const 1504 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1847,7 +1847,7 @@ if i32.const 0 i32.const 1504 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1878,7 +1878,7 @@ if i32.const 1168 i32.const 1504 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1904,6 +1904,27 @@ memory.size $0 local.tee $1 local.get $3 + i32.const 256 + i32.gt_u + if (result i32) + local.get $3 + i32.const 1 + i32.const 27 + local.get $3 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $3 + local.get $3 + i32.const 536870910 + i32.lt_u + select + else + local.get $3 + end i32.const 4 local.get $0 i32.load $0 offset=1568 @@ -1915,23 +1936,6 @@ i32.ne i32.shl i32.add - local.tee $2 - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $2 - i32.const 1 - i32.const 27 - local.get $2 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - else - local.get $2 - end i32.const 65535 i32.add i32.const -65536 @@ -1972,7 +1976,7 @@ if i32.const 0 i32.const 1504 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1987,7 +1991,7 @@ if i32.const 0 i32.const 1504 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable @@ -1997,7 +2001,7 @@ call $~lib/rt/tlsf/removeBlock local.get $1 i32.load $0 - local.set $2 + local.set $4 local.get $3 i32.const 4 i32.add @@ -2006,23 +2010,23 @@ if i32.const 0 i32.const 1504 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $2 + local.get $4 i32.const -4 i32.and local.get $3 i32.sub - local.tee $4 + local.tee $2 i32.const 16 i32.ge_u if local.get $1 local.get $3 - local.get $2 + local.get $4 i32.const 2 i32.and i32.or @@ -2032,19 +2036,19 @@ i32.add local.get $3 i32.add - local.tee $2 - local.get $4 + local.tee $3 + local.get $2 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 local.get $0 - local.get $2 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $1 - local.get $2 + local.get $4 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/std/uri.debug.wat b/tests/compiler/std/uri.debug.wat index 2964c24d61..019cbd90f6 100644 --- a/tests/compiler/std/uri.debug.wat +++ b/tests/compiler/std/uri.debug.wat @@ -1109,7 +1109,7 @@ if i32.const 0 i32.const 496 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1155,7 +1155,7 @@ if i32.const 0 i32.const 496 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1188,7 +1188,7 @@ if i32.const 0 i32.const 496 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1432,7 +1432,7 @@ if i32.const 0 i32.const 496 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1761,7 +1761,7 @@ if i32.const 160 i32.const 496 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1770,6 +1770,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1799,24 +1819,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1854,7 +1863,7 @@ if i32.const 0 i32.const 496 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1925,7 +1934,7 @@ if i32.const 0 i32.const 496 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1988,6 +1997,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2009,22 +2026,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2090,7 +2091,7 @@ if i32.const 0 i32.const 496 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2205,7 +2206,7 @@ if i32.const 0 i32.const 496 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2225,7 +2226,7 @@ if i32.const 0 i32.const 496 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/uri.release.wat b/tests/compiler/std/uri.release.wat index 1afc83fa9e..ec1f5e36ec 100644 --- a/tests/compiler/std/uri.release.wat +++ b/tests/compiler/std/uri.release.wat @@ -741,7 +741,7 @@ if i32.const 0 i32.const 1520 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -766,7 +766,7 @@ if i32.const 0 i32.const 1520 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -794,7 +794,7 @@ if i32.const 0 i32.const 1520 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1161,7 +1161,7 @@ if i32.const 0 i32.const 1520 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1245,7 +1245,7 @@ if i32.const 0 i32.const 1520 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1297,7 +1297,7 @@ if i32.const 0 i32.const 1520 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1386,7 +1386,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1396,12 +1396,12 @@ if i32.const 1184 i32.const 1520 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1422,50 +1422,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1473,7 +1477,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1482,7 +1486,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1490,7 +1494,7 @@ if i32.const 0 i32.const 1520 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1505,17 +1509,17 @@ if i32.const 0 i32.const 1520 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1524,12 +1528,12 @@ if i32.const 0 i32.const 1520 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1540,7 +1544,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1550,19 +1554,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/super-inline.debug.wat b/tests/compiler/super-inline.debug.wat index 73694af3ad..c2aa6ae08c 100644 --- a/tests/compiler/super-inline.debug.wat +++ b/tests/compiler/super-inline.debug.wat @@ -1034,7 +1034,7 @@ if i32.const 0 i32.const 368 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1080,7 +1080,7 @@ if i32.const 0 i32.const 368 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1113,7 +1113,7 @@ if i32.const 0 i32.const 368 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1357,7 +1357,7 @@ if i32.const 0 i32.const 368 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1686,7 +1686,7 @@ if i32.const 32 i32.const 368 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1695,6 +1695,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1724,24 +1744,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1779,7 +1788,7 @@ if i32.const 0 i32.const 368 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1850,7 +1859,7 @@ if i32.const 0 i32.const 368 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1913,6 +1922,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -1934,22 +1951,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2015,7 +2016,7 @@ if i32.const 0 i32.const 368 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2130,7 +2131,7 @@ if i32.const 0 i32.const 368 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2150,7 +2151,7 @@ if i32.const 0 i32.const 368 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/super-inline.release.wat b/tests/compiler/super-inline.release.wat index 01a5f720e5..ba821f9359 100644 --- a/tests/compiler/super-inline.release.wat +++ b/tests/compiler/super-inline.release.wat @@ -632,7 +632,7 @@ if i32.const 0 i32.const 1392 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -657,7 +657,7 @@ if i32.const 0 i32.const 1392 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -685,7 +685,7 @@ if i32.const 0 i32.const 1392 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1052,7 +1052,7 @@ if i32.const 0 i32.const 1392 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1119,7 +1119,7 @@ if i32.const 0 i32.const 1392 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1203,8 +1203,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1215,22 +1213,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1269,7 +1252,7 @@ if i32.const 0 i32.const 1392 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1284,7 +1267,7 @@ if i32.const 0 i32.const 1392 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/templateliteral.debug.wat b/tests/compiler/templateliteral.debug.wat index b4a1c473a3..f8fab71ccc 100644 --- a/tests/compiler/templateliteral.debug.wat +++ b/tests/compiler/templateliteral.debug.wat @@ -1215,7 +1215,7 @@ if i32.const 0 i32.const 528 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1261,7 +1261,7 @@ if i32.const 0 i32.const 528 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1294,7 +1294,7 @@ if i32.const 0 i32.const 528 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1538,7 +1538,7 @@ if i32.const 0 i32.const 528 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1867,7 +1867,7 @@ if i32.const 192 i32.const 528 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1876,6 +1876,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1905,24 +1925,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1960,7 +1969,7 @@ if i32.const 0 i32.const 528 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2031,7 +2040,7 @@ if i32.const 0 i32.const 528 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2094,6 +2103,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2115,22 +2132,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2196,7 +2197,7 @@ if i32.const 0 i32.const 528 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2311,7 +2312,7 @@ if i32.const 0 i32.const 528 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2331,7 +2332,7 @@ if i32.const 0 i32.const 528 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/templateliteral.release.wat b/tests/compiler/templateliteral.release.wat index 0bb25866a9..278e501b2f 100644 --- a/tests/compiler/templateliteral.release.wat +++ b/tests/compiler/templateliteral.release.wat @@ -721,7 +721,7 @@ if i32.const 0 i32.const 1552 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -746,7 +746,7 @@ if i32.const 0 i32.const 1552 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -774,7 +774,7 @@ if i32.const 0 i32.const 1552 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1141,7 +1141,7 @@ if i32.const 0 i32.const 1552 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1225,7 +1225,7 @@ if i32.const 0 i32.const 1552 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1277,7 +1277,7 @@ if i32.const 0 i32.const 1552 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1366,7 +1366,7 @@ call $~lib/rt/tlsf/initialize end global.get $~lib/rt/tlsf/ROOT - local.set $3 + local.set $4 local.get $0 i32.const 16 i32.add @@ -1376,12 +1376,12 @@ if i32.const 1216 i32.const 1552 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 i32.const 12 local.get $2 i32.const 19 @@ -1402,50 +1402,54 @@ memory.size $0 local.tee $2 local.get $5 - i32.const 4 - local.get $3 - i32.load $0 offset=1568 - local.get $2 - i32.const 16 - i32.shl - i32.const 4 - i32.sub - i32.ne - i32.shl - i32.add - local.tee $4 - i32.const 536870910 - i32.lt_u + i32.const 256 + i32.gt_u if (result i32) - local.get $4 + local.get $5 i32.const 1 i32.const 27 - local.get $4 + local.get $5 i32.clz i32.sub i32.shl + i32.add i32.const 1 i32.sub - i32.add + local.get $5 + local.get $5 + i32.const 536870910 + i32.lt_u + select else - local.get $4 + local.get $5 end + i32.const 4 + local.get $4 + i32.load $0 offset=1568 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $4 + local.tee $3 local.get $2 - local.get $4 + local.get $3 i32.gt_s select memory.grow $0 i32.const 0 i32.lt_s if - local.get $4 + local.get $3 memory.grow $0 i32.const 0 i32.lt_s @@ -1453,7 +1457,7 @@ unreachable end end - local.get $3 + local.get $4 local.get $2 i32.const 16 i32.shl @@ -1462,7 +1466,7 @@ i64.const 16 i64.shl call $~lib/rt/tlsf/addMemory - local.get $3 + local.get $4 local.get $5 call $~lib/rt/tlsf/searchBlock local.tee $2 @@ -1470,7 +1474,7 @@ if i32.const 0 i32.const 1552 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1485,17 +1489,17 @@ if i32.const 0 i32.const 1552 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $3 + local.get $4 local.get $2 call $~lib/rt/tlsf/removeBlock local.get $2 i32.load $0 - local.set $4 + local.set $3 local.get $5 i32.const 4 i32.add @@ -1504,12 +1508,12 @@ if i32.const 0 i32.const 1552 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable end - local.get $4 + local.get $3 i32.const -4 i32.and local.get $5 @@ -1520,7 +1524,7 @@ if local.get $2 local.get $5 - local.get $4 + local.get $3 i32.const 2 i32.and i32.or @@ -1530,19 +1534,19 @@ i32.add local.get $5 i32.add - local.tee $4 + local.tee $3 local.get $6 i32.const 4 i32.sub i32.const 1 i32.or i32.store $0 - local.get $3 local.get $4 + local.get $3 call $~lib/rt/tlsf/insertBlock else local.get $2 - local.get $4 + local.get $3 i32.const -2 i32.and i32.store $0 diff --git a/tests/compiler/throw.debug.wat b/tests/compiler/throw.debug.wat index 48e30b244d..e18fa212c9 100644 --- a/tests/compiler/throw.debug.wat +++ b/tests/compiler/throw.debug.wat @@ -1146,7 +1146,7 @@ if i32.const 0 i32.const 608 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1192,7 +1192,7 @@ if i32.const 0 i32.const 608 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1225,7 +1225,7 @@ if i32.const 0 i32.const 608 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1469,7 +1469,7 @@ if i32.const 0 i32.const 608 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/throw.release.wat b/tests/compiler/throw.release.wat index 0ad7784a30..66c340701c 100644 --- a/tests/compiler/throw.release.wat +++ b/tests/compiler/throw.release.wat @@ -921,7 +921,7 @@ if i32.const 0 i32.const 1632 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -940,7 +940,7 @@ if i32.const 0 i32.const 1632 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1028,7 +1028,7 @@ if i32.const 0 i32.const 1632 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/typeof.debug.wat b/tests/compiler/typeof.debug.wat index 0c49daea4b..89aecf0b7c 100644 --- a/tests/compiler/typeof.debug.wat +++ b/tests/compiler/typeof.debug.wat @@ -1173,7 +1173,7 @@ if i32.const 0 i32.const 672 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1219,7 +1219,7 @@ if i32.const 0 i32.const 672 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1252,7 +1252,7 @@ if i32.const 0 i32.const 672 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1496,7 +1496,7 @@ if i32.const 0 i32.const 672 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1825,7 +1825,7 @@ if i32.const 336 i32.const 672 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -1834,6 +1834,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -1863,24 +1883,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -1918,7 +1927,7 @@ if i32.const 0 i32.const 672 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -1989,7 +1998,7 @@ if i32.const 0 i32.const 672 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2052,6 +2061,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2073,22 +2090,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2154,7 +2155,7 @@ if i32.const 0 i32.const 672 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2269,7 +2270,7 @@ if i32.const 0 i32.const 672 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2289,7 +2290,7 @@ if i32.const 0 i32.const 672 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/typeof.release.wat b/tests/compiler/typeof.release.wat index 2f7a48acd1..34f7c56d60 100644 --- a/tests/compiler/typeof.release.wat +++ b/tests/compiler/typeof.release.wat @@ -648,7 +648,7 @@ if i32.const 0 i32.const 1696 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -673,7 +673,7 @@ if i32.const 0 i32.const 1696 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -701,7 +701,7 @@ if i32.const 0 i32.const 1696 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1068,7 +1068,7 @@ if i32.const 0 i32.const 1696 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1135,7 +1135,7 @@ if i32.const 0 i32.const 1696 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1219,8 +1219,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1231,22 +1229,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1285,7 +1268,7 @@ if i32.const 0 i32.const 1696 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1300,7 +1283,7 @@ if i32.const 0 i32.const 1696 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/while.debug.wat b/tests/compiler/while.debug.wat index bc1b1980ee..ba0638f446 100644 --- a/tests/compiler/while.debug.wat +++ b/tests/compiler/while.debug.wat @@ -1,6 +1,6 @@ (module - (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $none_=>_none (func)) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_i32 (func (result i32))) @@ -1456,7 +1456,7 @@ if i32.const 0 i32.const 416 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -1502,7 +1502,7 @@ if i32.const 0 i32.const 416 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -1535,7 +1535,7 @@ if i32.const 0 i32.const 416 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1779,7 +1779,7 @@ if i32.const 0 i32.const 416 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -2108,7 +2108,7 @@ if i32.const 80 i32.const 416 - i32.const 459 + i32.const 461 i32.const 29 call $~lib/builtins/abort unreachable @@ -2117,6 +2117,26 @@ call $~lib/rt/tlsf/computeSize return ) + (func $~lib/rt/tlsf/roundSize (param $size i32) (result i32) + local.get $size + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $size + i32.const 1 + i32.const 27 + local.get $size + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $size + end + return + ) (func $~lib/rt/tlsf/searchBlock (param $root i32) (param $size i32) (result i32) (local $fl i32) (local $sl i32) @@ -2146,24 +2166,13 @@ local.set $sl else local.get $size - i32.const 536870910 - i32.lt_u - if (result i32) - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $size - end + call $~lib/rt/tlsf/roundSize local.set $requestSize - i32.const 31 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub local.get $requestSize i32.clz i32.sub @@ -2201,7 +2210,7 @@ if i32.const 0 i32.const 416 - i32.const 330 + i32.const 334 i32.const 14 call $~lib/builtins/abort unreachable @@ -2272,7 +2281,7 @@ if i32.const 0 i32.const 416 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -2335,6 +2344,14 @@ (local $pagesAfter i32) i32.const 0 drop + local.get $size + i32.const 256 + i32.gt_u + if + local.get $size + call $~lib/rt/tlsf/roundSize + local.set $size + end memory.size $0 local.set $pagesBefore local.get $size @@ -2356,22 +2373,6 @@ i32.add local.set $size local.get $size - i32.const 536870910 - i32.lt_u - if - local.get $size - i32.const 1 - i32.const 27 - local.get $size - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $size - end - local.get $size i32.const 65535 i32.add i32.const 65535 @@ -2437,7 +2438,7 @@ if i32.const 0 i32.const 416 - i32.const 357 + i32.const 361 i32.const 14 call $~lib/builtins/abort unreachable @@ -2552,7 +2553,7 @@ if i32.const 0 i32.const 416 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -2572,7 +2573,7 @@ if i32.const 0 i32.const 416 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/while.release.wat b/tests/compiler/while.release.wat index c34d8a74e5..b6ef7b8ce6 100644 --- a/tests/compiler/while.release.wat +++ b/tests/compiler/while.release.wat @@ -620,7 +620,7 @@ if i32.const 0 i32.const 1440 - i32.const 378 + i32.const 382 i32.const 14 call $~lib/builtins/abort unreachable @@ -645,7 +645,7 @@ if i32.const 0 i32.const 1440 - i32.const 385 + i32.const 389 i32.const 16 call $~lib/builtins/abort unreachable @@ -673,7 +673,7 @@ if i32.const 0 i32.const 1440 - i32.const 398 + i32.const 402 i32.const 5 call $~lib/builtins/abort unreachable @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 1440 - i32.const 560 + i32.const 562 i32.const 3 call $~lib/builtins/abort unreachable @@ -1107,7 +1107,7 @@ if i32.const 0 i32.const 1440 - i32.const 343 + i32.const 347 i32.const 18 call $~lib/builtins/abort unreachable @@ -1191,8 +1191,6 @@ if memory.size $0 local.tee $1 - i32.const 1 - i32.const 27 i32.const 4 local.get $2 i32.load $0 offset=1568 @@ -1203,22 +1201,7 @@ i32.sub i32.ne i32.shl - i32.const 28 - i32.add - local.tee $3 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - local.get $3 - i32.add - local.get $3 - local.get $3 - i32.const 536870910 - i32.lt_u - select - i32.const 65535 + i32.const 65563 i32.add i32.const -65536 i32.and @@ -1257,7 +1240,7 @@ if i32.const 0 i32.const 1440 - i32.const 497 + i32.const 499 i32.const 16 call $~lib/builtins/abort unreachable @@ -1272,7 +1255,7 @@ if i32.const 0 i32.const 1440 - i32.const 499 + i32.const 501 i32.const 14 call $~lib/builtins/abort unreachable From b06c0690ca120e7922483b58b8b687862fc420d7 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 29 Apr 2023 22:14:12 +0200 Subject: [PATCH 6/6] update --- std/assembly/rt/tlsf.ts | 2 +- tests/compiler/bindings/noExportRuntime.debug.wat | 2 +- tests/compiler/bindings/noExportRuntime.release.wat | 2 +- tests/compiler/call-super.debug.wat | 2 +- tests/compiler/call-super.release.wat | 2 +- tests/compiler/class-implements.debug.wat | 2 +- tests/compiler/class-implements.release.wat | 2 +- tests/compiler/class-overloading-cast.debug.wat | 2 +- tests/compiler/class-overloading.debug.wat | 2 +- tests/compiler/class.debug.wat | 2 +- tests/compiler/class.release.wat | 2 +- tests/compiler/constructor.debug.wat | 2 +- tests/compiler/constructor.release.wat | 2 +- tests/compiler/do.debug.wat | 2 +- tests/compiler/duplicate-fields.debug.wat | 2 +- tests/compiler/duplicate-fields.release.wat | 2 +- tests/compiler/empty-exportruntime.debug.wat | 2 +- tests/compiler/empty-exportruntime.release.wat | 2 +- tests/compiler/empty-new.debug.wat | 2 +- tests/compiler/exportstar-rereexport.debug.wat | 2 +- tests/compiler/extends-baseaggregate.debug.wat | 2 +- tests/compiler/extends-baseaggregate.release.wat | 2 +- tests/compiler/extends-recursive.debug.wat | 2 +- tests/compiler/extends-recursive.release.wat | 2 +- tests/compiler/field-initialization.debug.wat | 2 +- tests/compiler/field-initialization.release.wat | 2 +- tests/compiler/field.debug.wat | 2 +- tests/compiler/field.release.wat | 2 +- tests/compiler/for.debug.wat | 2 +- tests/compiler/function-call.debug.wat | 2 +- tests/compiler/function-expression.debug.wat | 2 +- tests/compiler/getter-call.debug.wat | 2 +- tests/compiler/heap.debug.wat | 2 +- tests/compiler/heap.release.wat | 2 +- tests/compiler/infer-array.debug.wat | 2 +- tests/compiler/infer-array.release.wat | 2 +- tests/compiler/infer-generic.debug.wat | 2 +- tests/compiler/infer-generic.release.wat | 2 +- tests/compiler/inlining.debug.wat | 2 +- tests/compiler/inlining.release.wat | 2 +- tests/compiler/instanceof.debug.wat | 2 +- tests/compiler/issues/1095.debug.wat | 2 +- tests/compiler/issues/1095.release.wat | 2 +- tests/compiler/issues/1225.debug.wat | 2 +- tests/compiler/issues/1699.debug.wat | 2 +- tests/compiler/issues/1699.release.wat | 2 +- tests/compiler/issues/2166.debug.wat | 2 +- tests/compiler/issues/2322/index.debug.wat | 2 +- tests/compiler/issues/2322/index.release.wat | 2 +- tests/compiler/issues/2622.debug.wat | 2 +- tests/compiler/logical.debug.wat | 2 +- tests/compiler/managed-cast.debug.wat | 2 +- tests/compiler/new.debug.wat | 2 +- tests/compiler/object-literal.debug.wat | 2 +- tests/compiler/object-literal.release.wat | 2 +- tests/compiler/optional-typeparameters.debug.wat | 2 +- tests/compiler/reexport.debug.wat | 2 +- tests/compiler/rereexport.debug.wat | 2 +- tests/compiler/resolve-access.debug.wat | 2 +- tests/compiler/resolve-access.release.wat | 2 +- tests/compiler/resolve-binary.debug.wat | 2 +- tests/compiler/resolve-binary.release.wat | 2 +- tests/compiler/resolve-elementaccess.debug.wat | 2 +- tests/compiler/resolve-elementaccess.release.wat | 2 +- tests/compiler/resolve-function-expression.debug.wat | 2 +- tests/compiler/resolve-function-expression.release.wat | 2 +- tests/compiler/resolve-new.debug.wat | 2 +- tests/compiler/resolve-propertyaccess.debug.wat | 2 +- tests/compiler/resolve-propertyaccess.release.wat | 2 +- tests/compiler/resolve-ternary.debug.wat | 2 +- tests/compiler/resolve-ternary.release.wat | 2 +- tests/compiler/resolve-unary.debug.wat | 2 +- tests/compiler/resolve-unary.release.wat | 2 +- tests/compiler/return-unreachable.debug.wat | 2 +- tests/compiler/return-unreachable.release.wat | 2 +- tests/compiler/rt/alloc-large-memory.debug.wat | 2 +- tests/compiler/rt/alloc-large-memory.release.wat | 2 +- tests/compiler/rt/finalize.debug.wat | 2 +- tests/compiler/rt/runtime-incremental-export.debug.wat | 2 +- tests/compiler/rt/runtime-incremental-export.release.wat | 2 +- tests/compiler/rt/runtime-minimal-export.debug.wat | 2 +- tests/compiler/rt/runtime-minimal-export.release.wat | 2 +- tests/compiler/simd.debug.wat | 2 +- tests/compiler/simd.release.wat | 2 +- tests/compiler/std/array-literal.debug.wat | 2 +- tests/compiler/std/array-literal.release.wat | 2 +- tests/compiler/std/array.debug.wat | 2 +- tests/compiler/std/array.release.wat | 2 +- tests/compiler/std/arraybuffer.debug.wat | 2 +- tests/compiler/std/arraybuffer.release.wat | 2 +- tests/compiler/std/dataview.debug.wat | 2 +- tests/compiler/std/dataview.release.wat | 2 +- tests/compiler/std/date.debug.wat | 2 +- tests/compiler/std/date.release.wat | 2 +- tests/compiler/std/map.debug.wat | 2 +- tests/compiler/std/map.release.wat | 2 +- tests/compiler/std/new.debug.wat | 2 +- tests/compiler/std/operator-overloading.debug.wat | 2 +- tests/compiler/std/set.debug.wat | 2 +- tests/compiler/std/set.release.wat | 2 +- tests/compiler/std/static-array.debug.wat | 2 +- tests/compiler/std/static-array.release.wat | 2 +- tests/compiler/std/staticarray.debug.wat | 2 +- tests/compiler/std/staticarray.release.wat | 2 +- tests/compiler/std/string-casemapping.debug.wat | 2 +- tests/compiler/std/string-casemapping.release.wat | 2 +- tests/compiler/std/string-encoding.debug.wat | 2 +- tests/compiler/std/string-encoding.release.wat | 2 +- tests/compiler/std/string.debug.wat | 2 +- tests/compiler/std/string.release.wat | 2 +- tests/compiler/std/symbol.debug.wat | 2 +- tests/compiler/std/symbol.release.wat | 2 +- tests/compiler/std/typedarray.debug.wat | 2 +- tests/compiler/std/typedarray.release.wat | 2 +- tests/compiler/std/uri.debug.wat | 2 +- tests/compiler/std/uri.release.wat | 2 +- tests/compiler/super-inline.debug.wat | 2 +- tests/compiler/templateliteral.debug.wat | 2 +- tests/compiler/templateliteral.release.wat | 2 +- tests/compiler/typeof.debug.wat | 2 +- tests/compiler/while.debug.wat | 2 +- 121 files changed, 121 insertions(+), 121 deletions(-) diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 298a0eb861..3d135a3bee 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -432,7 +432,7 @@ function growMemory(root: Root, size: usize): void { return; } // Here, both rounding performed in searchBlock ... - if (size > SB_SIZE) { // don't round last fl + if (size >= SB_SIZE) { size = roundSize(size); } // and additional BLOCK_OVERHEAD must be taken into account. If we are going diff --git a/tests/compiler/bindings/noExportRuntime.debug.wat b/tests/compiler/bindings/noExportRuntime.debug.wat index d629548a71..d6621948a3 100644 --- a/tests/compiler/bindings/noExportRuntime.debug.wat +++ b/tests/compiler/bindings/noExportRuntime.debug.wat @@ -1952,7 +1952,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/bindings/noExportRuntime.release.wat b/tests/compiler/bindings/noExportRuntime.release.wat index 9cd8ab715a..759421547c 100644 --- a/tests/compiler/bindings/noExportRuntime.release.wat +++ b/tests/compiler/bindings/noExportRuntime.release.wat @@ -1356,7 +1356,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/call-super.debug.wat b/tests/compiler/call-super.debug.wat index d87cce208b..fb91ea7874 100644 --- a/tests/compiler/call-super.debug.wat +++ b/tests/compiler/call-super.debug.wat @@ -1927,7 +1927,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/call-super.release.wat b/tests/compiler/call-super.release.wat index 8d78be23e0..bdcc3e03e7 100644 --- a/tests/compiler/call-super.release.wat +++ b/tests/compiler/call-super.release.wat @@ -1303,7 +1303,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/class-implements.debug.wat b/tests/compiler/class-implements.debug.wat index efe07a0255..bfeec249ca 100644 --- a/tests/compiler/class-implements.debug.wat +++ b/tests/compiler/class-implements.debug.wat @@ -1930,7 +1930,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/class-implements.release.wat b/tests/compiler/class-implements.release.wat index fc679c7dc0..d9ef9d7e18 100644 --- a/tests/compiler/class-implements.release.wat +++ b/tests/compiler/class-implements.release.wat @@ -1352,7 +1352,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/class-overloading-cast.debug.wat b/tests/compiler/class-overloading-cast.debug.wat index 5bae901b5f..c4342ebc91 100644 --- a/tests/compiler/class-overloading-cast.debug.wat +++ b/tests/compiler/class-overloading-cast.debug.wat @@ -1936,7 +1936,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/class-overloading.debug.wat b/tests/compiler/class-overloading.debug.wat index 49e9025b55..dc394bbf8e 100644 --- a/tests/compiler/class-overloading.debug.wat +++ b/tests/compiler/class-overloading.debug.wat @@ -1940,7 +1940,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/class.debug.wat b/tests/compiler/class.debug.wat index 97363304a7..afda7eb500 100644 --- a/tests/compiler/class.debug.wat +++ b/tests/compiler/class.debug.wat @@ -2008,7 +2008,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/class.release.wat b/tests/compiler/class.release.wat index a6e51d1ca7..c3107e7912 100644 --- a/tests/compiler/class.release.wat +++ b/tests/compiler/class.release.wat @@ -1309,7 +1309,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/constructor.debug.wat b/tests/compiler/constructor.debug.wat index a65369e7b8..4a1a9a65b2 100644 --- a/tests/compiler/constructor.debug.wat +++ b/tests/compiler/constructor.debug.wat @@ -1936,7 +1936,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/constructor.release.wat b/tests/compiler/constructor.release.wat index 48f2049abe..60eea444fc 100644 --- a/tests/compiler/constructor.release.wat +++ b/tests/compiler/constructor.release.wat @@ -1366,7 +1366,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/do.debug.wat b/tests/compiler/do.debug.wat index 6044e3e331..91f52ccdb5 100644 --- a/tests/compiler/do.debug.wat +++ b/tests/compiler/do.debug.wat @@ -2331,7 +2331,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/duplicate-fields.debug.wat b/tests/compiler/duplicate-fields.debug.wat index bdca8f9f99..e637ab0c4b 100644 --- a/tests/compiler/duplicate-fields.debug.wat +++ b/tests/compiler/duplicate-fields.debug.wat @@ -1930,7 +1930,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/duplicate-fields.release.wat b/tests/compiler/duplicate-fields.release.wat index 37f5bf4983..53dedcd810 100644 --- a/tests/compiler/duplicate-fields.release.wat +++ b/tests/compiler/duplicate-fields.release.wat @@ -1316,7 +1316,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/empty-exportruntime.debug.wat b/tests/compiler/empty-exportruntime.debug.wat index a00bf7a6a5..1c5c21375c 100644 --- a/tests/compiler/empty-exportruntime.debug.wat +++ b/tests/compiler/empty-exportruntime.debug.wat @@ -1929,7 +1929,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/empty-exportruntime.release.wat b/tests/compiler/empty-exportruntime.release.wat index 5a50aa6cf1..8ac160e12a 100644 --- a/tests/compiler/empty-exportruntime.release.wat +++ b/tests/compiler/empty-exportruntime.release.wat @@ -1317,7 +1317,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/empty-new.debug.wat b/tests/compiler/empty-new.debug.wat index dbf2a1c810..9d3c257697 100644 --- a/tests/compiler/empty-new.debug.wat +++ b/tests/compiler/empty-new.debug.wat @@ -1922,7 +1922,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/exportstar-rereexport.debug.wat b/tests/compiler/exportstar-rereexport.debug.wat index e8465ebf88..663ea26eea 100644 --- a/tests/compiler/exportstar-rereexport.debug.wat +++ b/tests/compiler/exportstar-rereexport.debug.wat @@ -1962,7 +1962,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/extends-baseaggregate.debug.wat b/tests/compiler/extends-baseaggregate.debug.wat index b997ecd00a..264ed92d68 100644 --- a/tests/compiler/extends-baseaggregate.debug.wat +++ b/tests/compiler/extends-baseaggregate.debug.wat @@ -1932,7 +1932,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/extends-baseaggregate.release.wat b/tests/compiler/extends-baseaggregate.release.wat index 6777e32bd1..402d658397 100644 --- a/tests/compiler/extends-baseaggregate.release.wat +++ b/tests/compiler/extends-baseaggregate.release.wat @@ -1319,7 +1319,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/extends-recursive.debug.wat b/tests/compiler/extends-recursive.debug.wat index c899183397..b83754c683 100644 --- a/tests/compiler/extends-recursive.debug.wat +++ b/tests/compiler/extends-recursive.debug.wat @@ -1922,7 +1922,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/extends-recursive.release.wat b/tests/compiler/extends-recursive.release.wat index 3ca5ea2b9e..ee63b3d673 100644 --- a/tests/compiler/extends-recursive.release.wat +++ b/tests/compiler/extends-recursive.release.wat @@ -1300,7 +1300,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/field-initialization.debug.wat b/tests/compiler/field-initialization.debug.wat index ef1323b876..36c8f24582 100644 --- a/tests/compiler/field-initialization.debug.wat +++ b/tests/compiler/field-initialization.debug.wat @@ -1933,7 +1933,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/field-initialization.release.wat b/tests/compiler/field-initialization.release.wat index af791f87d2..4636553fa0 100644 --- a/tests/compiler/field-initialization.release.wat +++ b/tests/compiler/field-initialization.release.wat @@ -1320,7 +1320,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/field.debug.wat b/tests/compiler/field.debug.wat index 322d3e396b..e20ed15673 100644 --- a/tests/compiler/field.debug.wat +++ b/tests/compiler/field.debug.wat @@ -1925,7 +1925,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/field.release.wat b/tests/compiler/field.release.wat index 2300126bd0..dc9afffca7 100644 --- a/tests/compiler/field.release.wat +++ b/tests/compiler/field.release.wat @@ -1303,7 +1303,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/for.debug.wat b/tests/compiler/for.debug.wat index 8903c24f85..aa94a43a4f 100644 --- a/tests/compiler/for.debug.wat +++ b/tests/compiler/for.debug.wat @@ -2312,7 +2312,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/function-call.debug.wat b/tests/compiler/function-call.debug.wat index 9b77989134..5f87d1289e 100644 --- a/tests/compiler/function-call.debug.wat +++ b/tests/compiler/function-call.debug.wat @@ -1961,7 +1961,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/function-expression.debug.wat b/tests/compiler/function-expression.debug.wat index 5046ce76dc..37be0f6fd1 100644 --- a/tests/compiler/function-expression.debug.wat +++ b/tests/compiler/function-expression.debug.wat @@ -2118,7 +2118,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/getter-call.debug.wat b/tests/compiler/getter-call.debug.wat index 155d9a23f9..c0548a9af5 100644 --- a/tests/compiler/getter-call.debug.wat +++ b/tests/compiler/getter-call.debug.wat @@ -1925,7 +1925,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/heap.debug.wat b/tests/compiler/heap.debug.wat index 47594e99a5..bf6e6caca9 100644 --- a/tests/compiler/heap.debug.wat +++ b/tests/compiler/heap.debug.wat @@ -1240,7 +1240,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/heap.release.wat b/tests/compiler/heap.release.wat index 7a632743d3..417f51de5b 100644 --- a/tests/compiler/heap.release.wat +++ b/tests/compiler/heap.release.wat @@ -847,7 +847,7 @@ local.tee $3 local.get $2 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $2 i32.const 1 diff --git a/tests/compiler/infer-array.debug.wat b/tests/compiler/infer-array.debug.wat index c55dd55044..2ee919b26d 100644 --- a/tests/compiler/infer-array.debug.wat +++ b/tests/compiler/infer-array.debug.wat @@ -1944,7 +1944,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/infer-array.release.wat b/tests/compiler/infer-array.release.wat index 151309b54b..b2492c4fa9 100644 --- a/tests/compiler/infer-array.release.wat +++ b/tests/compiler/infer-array.release.wat @@ -1342,7 +1342,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/infer-generic.debug.wat b/tests/compiler/infer-generic.debug.wat index 2ce836c200..84daed223d 100644 --- a/tests/compiler/infer-generic.debug.wat +++ b/tests/compiler/infer-generic.debug.wat @@ -1971,7 +1971,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/infer-generic.release.wat b/tests/compiler/infer-generic.release.wat index d03a066665..f62702fe86 100644 --- a/tests/compiler/infer-generic.release.wat +++ b/tests/compiler/infer-generic.release.wat @@ -1329,7 +1329,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/inlining.debug.wat b/tests/compiler/inlining.debug.wat index fd4c7b34a2..3740c9af7c 100644 --- a/tests/compiler/inlining.debug.wat +++ b/tests/compiler/inlining.debug.wat @@ -2190,7 +2190,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/inlining.release.wat b/tests/compiler/inlining.release.wat index dff7a7d023..77804a8363 100644 --- a/tests/compiler/inlining.release.wat +++ b/tests/compiler/inlining.release.wat @@ -1315,7 +1315,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/instanceof.debug.wat b/tests/compiler/instanceof.debug.wat index 9a6aa3be38..a0d0a1b0aa 100644 --- a/tests/compiler/instanceof.debug.wat +++ b/tests/compiler/instanceof.debug.wat @@ -1946,7 +1946,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/issues/1095.debug.wat b/tests/compiler/issues/1095.debug.wat index 2555d645a1..3885debe7a 100644 --- a/tests/compiler/issues/1095.debug.wat +++ b/tests/compiler/issues/1095.debug.wat @@ -1925,7 +1925,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/issues/1095.release.wat b/tests/compiler/issues/1095.release.wat index bd0b4fc950..4ac8523a24 100644 --- a/tests/compiler/issues/1095.release.wat +++ b/tests/compiler/issues/1095.release.wat @@ -1306,7 +1306,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/issues/1225.debug.wat b/tests/compiler/issues/1225.debug.wat index badb0e817a..9514862a47 100644 --- a/tests/compiler/issues/1225.debug.wat +++ b/tests/compiler/issues/1225.debug.wat @@ -1940,7 +1940,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/issues/1699.debug.wat b/tests/compiler/issues/1699.debug.wat index dba0719212..8181dca210 100644 --- a/tests/compiler/issues/1699.debug.wat +++ b/tests/compiler/issues/1699.debug.wat @@ -1927,7 +1927,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/issues/1699.release.wat b/tests/compiler/issues/1699.release.wat index daf415c9bd..227931cb74 100644 --- a/tests/compiler/issues/1699.release.wat +++ b/tests/compiler/issues/1699.release.wat @@ -1313,7 +1313,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/issues/2166.debug.wat b/tests/compiler/issues/2166.debug.wat index d48a8fec48..39c49cc006 100644 --- a/tests/compiler/issues/2166.debug.wat +++ b/tests/compiler/issues/2166.debug.wat @@ -1929,7 +1929,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/issues/2322/index.debug.wat b/tests/compiler/issues/2322/index.debug.wat index a9bd22aa50..7ff1a4a09b 100644 --- a/tests/compiler/issues/2322/index.debug.wat +++ b/tests/compiler/issues/2322/index.debug.wat @@ -1923,7 +1923,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/issues/2322/index.release.wat b/tests/compiler/issues/2322/index.release.wat index 6bb07a8639..f1d42124ee 100644 --- a/tests/compiler/issues/2322/index.release.wat +++ b/tests/compiler/issues/2322/index.release.wat @@ -1301,7 +1301,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/issues/2622.debug.wat b/tests/compiler/issues/2622.debug.wat index f655c1e3d7..860a0a0b91 100644 --- a/tests/compiler/issues/2622.debug.wat +++ b/tests/compiler/issues/2622.debug.wat @@ -1926,7 +1926,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/logical.debug.wat b/tests/compiler/logical.debug.wat index 0a4fee03b8..fad4d4ffc2 100644 --- a/tests/compiler/logical.debug.wat +++ b/tests/compiler/logical.debug.wat @@ -1952,7 +1952,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/managed-cast.debug.wat b/tests/compiler/managed-cast.debug.wat index fca4fa77c3..4fb7b175d9 100644 --- a/tests/compiler/managed-cast.debug.wat +++ b/tests/compiler/managed-cast.debug.wat @@ -1925,7 +1925,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/new.debug.wat b/tests/compiler/new.debug.wat index caaa70e8d0..b0a882fcdb 100644 --- a/tests/compiler/new.debug.wat +++ b/tests/compiler/new.debug.wat @@ -1928,7 +1928,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/object-literal.debug.wat b/tests/compiler/object-literal.debug.wat index 2e3e82b42c..34b20b48dc 100644 --- a/tests/compiler/object-literal.debug.wat +++ b/tests/compiler/object-literal.debug.wat @@ -2020,7 +2020,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/object-literal.release.wat b/tests/compiler/object-literal.release.wat index 3527d533f4..6aed498155 100644 --- a/tests/compiler/object-literal.release.wat +++ b/tests/compiler/object-literal.release.wat @@ -1254,7 +1254,7 @@ local.tee $1 local.get $3 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $3 i32.const 1 diff --git a/tests/compiler/optional-typeparameters.debug.wat b/tests/compiler/optional-typeparameters.debug.wat index c57a209c6b..ea99c2b3f8 100644 --- a/tests/compiler/optional-typeparameters.debug.wat +++ b/tests/compiler/optional-typeparameters.debug.wat @@ -1936,7 +1936,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/reexport.debug.wat b/tests/compiler/reexport.debug.wat index 473585d7ca..b19004b09e 100644 --- a/tests/compiler/reexport.debug.wat +++ b/tests/compiler/reexport.debug.wat @@ -1969,7 +1969,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/rereexport.debug.wat b/tests/compiler/rereexport.debug.wat index 02f9068d90..b409499e1b 100644 --- a/tests/compiler/rereexport.debug.wat +++ b/tests/compiler/rereexport.debug.wat @@ -1962,7 +1962,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-access.debug.wat b/tests/compiler/resolve-access.debug.wat index 4e1ab4917d..daff744a0a 100644 --- a/tests/compiler/resolve-access.debug.wat +++ b/tests/compiler/resolve-access.debug.wat @@ -1944,7 +1944,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-access.release.wat b/tests/compiler/resolve-access.release.wat index 39d0b4b8b2..81f11c300d 100644 --- a/tests/compiler/resolve-access.release.wat +++ b/tests/compiler/resolve-access.release.wat @@ -1324,7 +1324,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/resolve-binary.debug.wat b/tests/compiler/resolve-binary.debug.wat index 3e1672f864..8e4d5246fe 100644 --- a/tests/compiler/resolve-binary.debug.wat +++ b/tests/compiler/resolve-binary.debug.wat @@ -2164,7 +2164,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-binary.release.wat b/tests/compiler/resolve-binary.release.wat index 477bdf5494..361d585398 100644 --- a/tests/compiler/resolve-binary.release.wat +++ b/tests/compiler/resolve-binary.release.wat @@ -1533,7 +1533,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/resolve-elementaccess.debug.wat b/tests/compiler/resolve-elementaccess.debug.wat index be10da9c86..4f7f102983 100644 --- a/tests/compiler/resolve-elementaccess.debug.wat +++ b/tests/compiler/resolve-elementaccess.debug.wat @@ -1967,7 +1967,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-elementaccess.release.wat b/tests/compiler/resolve-elementaccess.release.wat index 6c6e033861..b08ff52596 100644 --- a/tests/compiler/resolve-elementaccess.release.wat +++ b/tests/compiler/resolve-elementaccess.release.wat @@ -1376,7 +1376,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/resolve-function-expression.debug.wat b/tests/compiler/resolve-function-expression.debug.wat index 961f263a2d..a9cdc844bf 100644 --- a/tests/compiler/resolve-function-expression.debug.wat +++ b/tests/compiler/resolve-function-expression.debug.wat @@ -2010,7 +2010,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-function-expression.release.wat b/tests/compiler/resolve-function-expression.release.wat index f050247a6c..27215c7055 100644 --- a/tests/compiler/resolve-function-expression.release.wat +++ b/tests/compiler/resolve-function-expression.release.wat @@ -1441,7 +1441,7 @@ local.tee $2 local.get $8 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $8 i32.const 1 diff --git a/tests/compiler/resolve-new.debug.wat b/tests/compiler/resolve-new.debug.wat index 9f6cc8d10b..3b02a74784 100644 --- a/tests/compiler/resolve-new.debug.wat +++ b/tests/compiler/resolve-new.debug.wat @@ -1923,7 +1923,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-propertyaccess.debug.wat b/tests/compiler/resolve-propertyaccess.debug.wat index 15989dd841..c40972e4f0 100644 --- a/tests/compiler/resolve-propertyaccess.debug.wat +++ b/tests/compiler/resolve-propertyaccess.debug.wat @@ -2010,7 +2010,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-propertyaccess.release.wat b/tests/compiler/resolve-propertyaccess.release.wat index 08d1c03e72..05ca990b33 100644 --- a/tests/compiler/resolve-propertyaccess.release.wat +++ b/tests/compiler/resolve-propertyaccess.release.wat @@ -1342,7 +1342,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/resolve-ternary.debug.wat b/tests/compiler/resolve-ternary.debug.wat index 071964f8f5..88fe3f8e4c 100644 --- a/tests/compiler/resolve-ternary.debug.wat +++ b/tests/compiler/resolve-ternary.debug.wat @@ -2018,7 +2018,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-ternary.release.wat b/tests/compiler/resolve-ternary.release.wat index a1f9ac86ec..fd5bc84dca 100644 --- a/tests/compiler/resolve-ternary.release.wat +++ b/tests/compiler/resolve-ternary.release.wat @@ -1348,7 +1348,7 @@ local.tee $1 local.get $4 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $4 i32.const 1 diff --git a/tests/compiler/resolve-unary.debug.wat b/tests/compiler/resolve-unary.debug.wat index ef15f895fa..862a3d4188 100644 --- a/tests/compiler/resolve-unary.debug.wat +++ b/tests/compiler/resolve-unary.debug.wat @@ -2010,7 +2010,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/resolve-unary.release.wat b/tests/compiler/resolve-unary.release.wat index 3456e0764f..446dbe2298 100644 --- a/tests/compiler/resolve-unary.release.wat +++ b/tests/compiler/resolve-unary.release.wat @@ -1368,7 +1368,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/return-unreachable.debug.wat b/tests/compiler/return-unreachable.debug.wat index 747c070aa5..ce61a8bc37 100644 --- a/tests/compiler/return-unreachable.debug.wat +++ b/tests/compiler/return-unreachable.debug.wat @@ -1926,7 +1926,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/return-unreachable.release.wat b/tests/compiler/return-unreachable.release.wat index 12060fa296..a30d733294 100644 --- a/tests/compiler/return-unreachable.release.wat +++ b/tests/compiler/return-unreachable.release.wat @@ -1308,7 +1308,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/rt/alloc-large-memory.debug.wat b/tests/compiler/rt/alloc-large-memory.debug.wat index a08978650b..e2aa202376 100644 --- a/tests/compiler/rt/alloc-large-memory.debug.wat +++ b/tests/compiler/rt/alloc-large-memory.debug.wat @@ -1237,7 +1237,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/rt/alloc-large-memory.release.wat b/tests/compiler/rt/alloc-large-memory.release.wat index fcb383a6b7..dcdd6257a6 100644 --- a/tests/compiler/rt/alloc-large-memory.release.wat +++ b/tests/compiler/rt/alloc-large-memory.release.wat @@ -773,7 +773,7 @@ local.tee $1 local.get $0 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $0 i32.const 1 diff --git a/tests/compiler/rt/finalize.debug.wat b/tests/compiler/rt/finalize.debug.wat index 61f29f55a5..95ff6cc8a3 100644 --- a/tests/compiler/rt/finalize.debug.wat +++ b/tests/compiler/rt/finalize.debug.wat @@ -1946,7 +1946,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/rt/runtime-incremental-export.debug.wat b/tests/compiler/rt/runtime-incremental-export.debug.wat index a00bf7a6a5..1c5c21375c 100644 --- a/tests/compiler/rt/runtime-incremental-export.debug.wat +++ b/tests/compiler/rt/runtime-incremental-export.debug.wat @@ -1929,7 +1929,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/rt/runtime-incremental-export.release.wat b/tests/compiler/rt/runtime-incremental-export.release.wat index 5a50aa6cf1..8ac160e12a 100644 --- a/tests/compiler/rt/runtime-incremental-export.release.wat +++ b/tests/compiler/rt/runtime-incremental-export.release.wat @@ -1317,7 +1317,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/rt/runtime-minimal-export.debug.wat b/tests/compiler/rt/runtime-minimal-export.debug.wat index fea06dd65c..c667c5ca2c 100644 --- a/tests/compiler/rt/runtime-minimal-export.debug.wat +++ b/tests/compiler/rt/runtime-minimal-export.debug.wat @@ -1254,7 +1254,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/rt/runtime-minimal-export.release.wat b/tests/compiler/rt/runtime-minimal-export.release.wat index d137bd0a13..5c5459a0d3 100644 --- a/tests/compiler/rt/runtime-minimal-export.release.wat +++ b/tests/compiler/rt/runtime-minimal-export.release.wat @@ -812,7 +812,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/simd.debug.wat b/tests/compiler/simd.debug.wat index e298582400..bb810b7e42 100644 --- a/tests/compiler/simd.debug.wat +++ b/tests/compiler/simd.debug.wat @@ -1962,7 +1962,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/simd.release.wat b/tests/compiler/simd.release.wat index 71eb05033c..deba7d8f6d 100644 --- a/tests/compiler/simd.release.wat +++ b/tests/compiler/simd.release.wat @@ -1271,7 +1271,7 @@ local.tee $1 local.get $3 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $3 i32.const 1 diff --git a/tests/compiler/std/array-literal.debug.wat b/tests/compiler/std/array-literal.debug.wat index 9176dcf2e4..fd50847553 100644 --- a/tests/compiler/std/array-literal.debug.wat +++ b/tests/compiler/std/array-literal.debug.wat @@ -1958,7 +1958,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/array-literal.release.wat b/tests/compiler/std/array-literal.release.wat index 9c0e2cda60..4455e67b59 100644 --- a/tests/compiler/std/array-literal.release.wat +++ b/tests/compiler/std/array-literal.release.wat @@ -1363,7 +1363,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/array.debug.wat b/tests/compiler/std/array.debug.wat index 005d640cc3..f90bea8d07 100644 --- a/tests/compiler/std/array.debug.wat +++ b/tests/compiler/std/array.debug.wat @@ -2267,7 +2267,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/array.release.wat b/tests/compiler/std/array.release.wat index 69654bf0ad..bfbd7b033c 100644 --- a/tests/compiler/std/array.release.wat +++ b/tests/compiler/std/array.release.wat @@ -1896,7 +1896,7 @@ local.tee $1 local.get $3 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $3 i32.const 1 diff --git a/tests/compiler/std/arraybuffer.debug.wat b/tests/compiler/std/arraybuffer.debug.wat index 4a68f00b1b..2021918c55 100644 --- a/tests/compiler/std/arraybuffer.debug.wat +++ b/tests/compiler/std/arraybuffer.debug.wat @@ -1931,7 +1931,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/arraybuffer.release.wat b/tests/compiler/std/arraybuffer.release.wat index 694d0d8bae..9080c7e14f 100644 --- a/tests/compiler/std/arraybuffer.release.wat +++ b/tests/compiler/std/arraybuffer.release.wat @@ -1314,7 +1314,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/dataview.debug.wat b/tests/compiler/std/dataview.debug.wat index 0af1e509aa..a8aac60b96 100644 --- a/tests/compiler/std/dataview.debug.wat +++ b/tests/compiler/std/dataview.debug.wat @@ -1937,7 +1937,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/dataview.release.wat b/tests/compiler/std/dataview.release.wat index 5106bbec41..d21469f6ec 100644 --- a/tests/compiler/std/dataview.release.wat +++ b/tests/compiler/std/dataview.release.wat @@ -1322,7 +1322,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/date.debug.wat b/tests/compiler/std/date.debug.wat index 72bb6b0dbb..bcef75a417 100644 --- a/tests/compiler/std/date.debug.wat +++ b/tests/compiler/std/date.debug.wat @@ -2315,7 +2315,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/date.release.wat b/tests/compiler/std/date.release.wat index 336a12ad9c..51c30d67aa 100644 --- a/tests/compiler/std/date.release.wat +++ b/tests/compiler/std/date.release.wat @@ -1688,7 +1688,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/map.debug.wat b/tests/compiler/std/map.debug.wat index e3552d1feb..f8b67fdf6a 100644 --- a/tests/compiler/std/map.debug.wat +++ b/tests/compiler/std/map.debug.wat @@ -1954,7 +1954,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/map.release.wat b/tests/compiler/std/map.release.wat index 36a6217732..65fa89cce5 100644 --- a/tests/compiler/std/map.release.wat +++ b/tests/compiler/std/map.release.wat @@ -1334,7 +1334,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/new.debug.wat b/tests/compiler/std/new.debug.wat index 2f4bbe4dd8..e8912548ca 100644 --- a/tests/compiler/std/new.debug.wat +++ b/tests/compiler/std/new.debug.wat @@ -1940,7 +1940,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/operator-overloading.debug.wat b/tests/compiler/std/operator-overloading.debug.wat index a5cb8b49a8..b262deed12 100644 --- a/tests/compiler/std/operator-overloading.debug.wat +++ b/tests/compiler/std/operator-overloading.debug.wat @@ -1996,7 +1996,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/set.debug.wat b/tests/compiler/std/set.debug.wat index f1ab038bca..0bba1a96ff 100644 --- a/tests/compiler/std/set.debug.wat +++ b/tests/compiler/std/set.debug.wat @@ -1949,7 +1949,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/set.release.wat b/tests/compiler/std/set.release.wat index 3e7d9edf5e..19b518d3f0 100644 --- a/tests/compiler/std/set.release.wat +++ b/tests/compiler/std/set.release.wat @@ -1325,7 +1325,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/static-array.debug.wat b/tests/compiler/std/static-array.debug.wat index fd9a4a452d..1da1570de1 100644 --- a/tests/compiler/std/static-array.debug.wat +++ b/tests/compiler/std/static-array.debug.wat @@ -1965,7 +1965,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/static-array.release.wat b/tests/compiler/std/static-array.release.wat index 9ca7df78b3..9f31ef8c98 100644 --- a/tests/compiler/std/static-array.release.wat +++ b/tests/compiler/std/static-array.release.wat @@ -1582,7 +1582,7 @@ local.tee $1 local.get $8 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $8 i32.const 1 diff --git a/tests/compiler/std/staticarray.debug.wat b/tests/compiler/std/staticarray.debug.wat index 8ee445629c..46165bea4d 100644 --- a/tests/compiler/std/staticarray.debug.wat +++ b/tests/compiler/std/staticarray.debug.wat @@ -2026,7 +2026,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/staticarray.release.wat b/tests/compiler/std/staticarray.release.wat index 1557094b2f..e074cbf905 100644 --- a/tests/compiler/std/staticarray.release.wat +++ b/tests/compiler/std/staticarray.release.wat @@ -1389,7 +1389,7 @@ local.tee $1 local.get $3 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $3 i32.const 1 diff --git a/tests/compiler/std/string-casemapping.debug.wat b/tests/compiler/std/string-casemapping.debug.wat index 5cbd00a572..ee2b866fe8 100644 --- a/tests/compiler/std/string-casemapping.debug.wat +++ b/tests/compiler/std/string-casemapping.debug.wat @@ -2117,7 +2117,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/string-casemapping.release.wat b/tests/compiler/std/string-casemapping.release.wat index 47600923d5..f4ffed5598 100644 --- a/tests/compiler/std/string-casemapping.release.wat +++ b/tests/compiler/std/string-casemapping.release.wat @@ -1756,7 +1756,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/string-encoding.debug.wat b/tests/compiler/std/string-encoding.debug.wat index fd03ee0eee..05b49de702 100644 --- a/tests/compiler/std/string-encoding.debug.wat +++ b/tests/compiler/std/string-encoding.debug.wat @@ -1956,7 +1956,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/string-encoding.release.wat b/tests/compiler/std/string-encoding.release.wat index 010e40240e..e6c6135966 100644 --- a/tests/compiler/std/string-encoding.release.wat +++ b/tests/compiler/std/string-encoding.release.wat @@ -1343,7 +1343,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/string.debug.wat b/tests/compiler/std/string.debug.wat index 817f6e7ed6..594709c44f 100644 --- a/tests/compiler/std/string.debug.wat +++ b/tests/compiler/std/string.debug.wat @@ -2547,7 +2547,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/string.release.wat b/tests/compiler/std/string.release.wat index af2294838d..db65c7ba36 100644 --- a/tests/compiler/std/string.release.wat +++ b/tests/compiler/std/string.release.wat @@ -2335,7 +2335,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/symbol.debug.wat b/tests/compiler/std/symbol.debug.wat index 99c3023b30..38d21d35f4 100644 --- a/tests/compiler/std/symbol.debug.wat +++ b/tests/compiler/std/symbol.debug.wat @@ -1985,7 +1985,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/symbol.release.wat b/tests/compiler/std/symbol.release.wat index 7a32b25636..daa6a5d421 100644 --- a/tests/compiler/std/symbol.release.wat +++ b/tests/compiler/std/symbol.release.wat @@ -1406,7 +1406,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index 73304b1ae6..4196d9a65b 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -2294,7 +2294,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/typedarray.release.wat b/tests/compiler/std/typedarray.release.wat index d85b5ea703..2cf1a259c5 100644 --- a/tests/compiler/std/typedarray.release.wat +++ b/tests/compiler/std/typedarray.release.wat @@ -1905,7 +1905,7 @@ local.tee $1 local.get $3 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $3 i32.const 1 diff --git a/tests/compiler/std/uri.debug.wat b/tests/compiler/std/uri.debug.wat index 019cbd90f6..0a61dbfdb2 100644 --- a/tests/compiler/std/uri.debug.wat +++ b/tests/compiler/std/uri.debug.wat @@ -1999,7 +1999,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/std/uri.release.wat b/tests/compiler/std/uri.release.wat index ec1f5e36ec..f72e4f3bee 100644 --- a/tests/compiler/std/uri.release.wat +++ b/tests/compiler/std/uri.release.wat @@ -1423,7 +1423,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/super-inline.debug.wat b/tests/compiler/super-inline.debug.wat index c2aa6ae08c..a82a1ae02d 100644 --- a/tests/compiler/super-inline.debug.wat +++ b/tests/compiler/super-inline.debug.wat @@ -1924,7 +1924,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/templateliteral.debug.wat b/tests/compiler/templateliteral.debug.wat index f8fab71ccc..75092f31b9 100644 --- a/tests/compiler/templateliteral.debug.wat +++ b/tests/compiler/templateliteral.debug.wat @@ -2105,7 +2105,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/templateliteral.release.wat b/tests/compiler/templateliteral.release.wat index 278e501b2f..4f4a8d016b 100644 --- a/tests/compiler/templateliteral.release.wat +++ b/tests/compiler/templateliteral.release.wat @@ -1403,7 +1403,7 @@ local.tee $2 local.get $5 i32.const 256 - i32.gt_u + i32.ge_u if (result i32) local.get $5 i32.const 1 diff --git a/tests/compiler/typeof.debug.wat b/tests/compiler/typeof.debug.wat index 89aecf0b7c..53a934fd4e 100644 --- a/tests/compiler/typeof.debug.wat +++ b/tests/compiler/typeof.debug.wat @@ -2063,7 +2063,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize diff --git a/tests/compiler/while.debug.wat b/tests/compiler/while.debug.wat index ba0638f446..27f83c7032 100644 --- a/tests/compiler/while.debug.wat +++ b/tests/compiler/while.debug.wat @@ -2346,7 +2346,7 @@ drop local.get $size i32.const 256 - i32.gt_u + i32.ge_u if local.get $size call $~lib/rt/tlsf/roundSize