diff options
39 files changed, 2290 insertions, 2596 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 677f7ac62..b7e614fa5 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -906,8 +906,10 @@ public: BinaryConsts::ASTNodes readExpression(Expression*& curr); void pushBlockElements(Block* curr, size_t start, size_t end); void visitBlock(Block *curr); - Expression* getMaybeBlock(WasmType type); - Expression* getBlock(WasmType type); + + // Gets a block of expressions. If it's just one, return that singleton. + Expression* getBlockOrSingleton(WasmType type); + void visitIf(If *curr); void visitLoop(Loop *curr); BreakTarget getBreakTarget(int32_t offset); diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 68fb293e8..0d142cd8f 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -271,7 +271,7 @@ void WasmBinaryWriter::writeFunctions() { if (numLocalsByType[f32]) o << U32LEB(numLocalsByType[f32]) << binaryWasmType(f32); if (numLocalsByType[f64]) o << U32LEB(numLocalsByType[f64]) << binaryWasmType(f64); - writeExpression(function->body); + recursePossibleBlockContents(function->body); o << int8_t(BinaryConsts::End); size_t size = o.size() - start; assert(size <= std::numeric_limits<uint32_t>::max()); @@ -1633,7 +1633,7 @@ void WasmBinaryBuilder::readFunctions() { breakStack.emplace_back(RETURN_BREAK, func->result != none); // the break target for the function scope assert(expressionStack.empty()); assert(depth == 0); - func->body = getMaybeBlock(func->result); + func->body = getBlockOrSingleton(func->result); assert(depth == 0); assert(breakStack.size() == 1); breakStack.pop_back(); @@ -2225,28 +2225,24 @@ void WasmBinaryBuilder::visitBlock(Block *curr) { } } -Expression* WasmBinaryBuilder::getMaybeBlock(WasmType type) { +Expression* WasmBinaryBuilder::getBlockOrSingleton(WasmType type) { + Name label = getNextLabel(); + breakStack.push_back({label, type != none && type != unreachable}); auto start = expressionStack.size(); processExpressions(); size_t end = expressionStack.size(); - if (start - end == 1) { - return popExpression(); - } - if (start > end) { - throw ParseException("block cannot pop from outside"); - } + breakStack.pop_back(); auto* block = allocator.alloc<Block>(); pushBlockElements(block, start, end); + block->name = label; block->finalize(type); - return block; -} - -Expression* WasmBinaryBuilder::getBlock(WasmType type) { - Name label = getNextLabel(); - breakStack.push_back({label, type != none && type != unreachable}); - auto* block = Builder(wasm).blockify(getMaybeBlock(type)); - breakStack.pop_back(); - block->cast<Block>()->name = label; + // maybe we don't need a block here? + if (!brokenTo(block)) { + block->name = Name(); + if (block->list.size() == 1) { + return block->list[0]; + } + } return block; } @@ -2254,9 +2250,9 @@ void WasmBinaryBuilder::visitIf(If *curr) { if (debug) std::cerr << "zz node: If" << std::endl; curr->type = getWasmType(); curr->condition = popNonVoidExpression(); - curr->ifTrue = getBlock(curr->type); + curr->ifTrue = getBlockOrSingleton(curr->type); if (lastSeparator == BinaryConsts::Else) { - curr->ifFalse = getBlock(curr->type); + curr->ifFalse = getBlockOrSingleton(curr->type); } curr->finalize(curr->type); if (lastSeparator != BinaryConsts::End) { @@ -2269,7 +2265,25 @@ void WasmBinaryBuilder::visitLoop(Loop *curr) { curr->type = getWasmType(); curr->name = getNextLabel(); breakStack.push_back({curr->name, 0}); - curr->body = getMaybeBlock(curr->type); + // find the expressions in the block, and create the body + // a loop may have a list of instructions in wasm, much like + // a block, but it only has a label at the top of the loop, + // so even if we need a block (if there is more than 1 + // expression) we never need a label on the block. + auto start = expressionStack.size(); + processExpressions(); + size_t end = expressionStack.size(); + if (end - start == 1) { + curr->body = popExpression(); + } else { + if (start > end) { + throw ParseException("block cannot pop from outside"); + } + auto* block = allocator.alloc<Block>(); + pushBlockElements(block, start, end); + block->finalize(curr->type); + curr->body = block; + } breakStack.pop_back(); curr->finalize(curr->type); } diff --git a/test/atomics.wast.fromBinary b/test/atomics.wast.fromBinary index 31acc6635..26a70248f 100644 --- a/test/atomics.wast.fromBinary +++ b/test/atomics.wast.fromBinary @@ -4,165 +4,157 @@ (func $atomic-loadstore (type $0) (local $var$0 i32) (local $var$1 i64) - (block $label$0 - (drop - (i32.atomic.load8_u offset=4 - (get_local $var$0) - ) + (drop + (i32.atomic.load8_u offset=4 + (get_local $var$0) ) - (drop - (i32.atomic.load16_u offset=4 - (get_local $var$0) - ) + ) + (drop + (i32.atomic.load16_u offset=4 + (get_local $var$0) ) - (drop - (i32.atomic.load offset=4 - (get_local $var$0) - ) + ) + (drop + (i32.atomic.load offset=4 + (get_local $var$0) ) - (drop - (i64.atomic.load8_u - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load8_u + (get_local $var$0) ) - (drop - (i64.atomic.load16_u - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load16_u + (get_local $var$0) ) - (drop - (i64.atomic.load32_u - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load32_u + (get_local $var$0) ) - (drop - (i64.atomic.load - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load + (get_local $var$0) ) - (i32.atomic.store offset=4 + ) + (i32.atomic.store offset=4 + (get_local $var$0) + (get_local $var$0) + ) + (i32.atomic.store8 offset=4 + (get_local $var$0) + (get_local $var$0) + ) + (i32.atomic.store16 offset=4 + (get_local $var$0) + (get_local $var$0) + ) + (i64.atomic.store offset=4 + (get_local $var$0) + (get_local $var$1) + ) + (i64.atomic.store8 offset=4 + (get_local $var$0) + (get_local $var$1) + ) + (i64.atomic.store16 offset=4 + (get_local $var$0) + (get_local $var$1) + ) + (i64.atomic.store32 offset=4 + (get_local $var$0) + (get_local $var$1) + ) + ) + (func $atomic-rmw (type $0) + (local $var$0 i32) + (local $var$1 i64) + (drop + (i32.atomic.rmw.add offset=4 (get_local $var$0) (get_local $var$0) ) - (i32.atomic.store8 offset=4 + ) + (drop + (i32.atomic.rmw8_u.add offset=4 (get_local $var$0) (get_local $var$0) ) - (i32.atomic.store16 offset=4 + ) + (drop + (i32.atomic.rmw16_u.and (get_local $var$0) (get_local $var$0) ) - (i64.atomic.store offset=4 + ) + (drop + (i64.atomic.rmw32_u.or (get_local $var$0) (get_local $var$1) ) - (i64.atomic.store8 offset=4 + ) + (drop + (i32.atomic.rmw8_u.xchg + (get_local $var$0) (get_local $var$0) - (get_local $var$1) ) - (i64.atomic.store16 offset=4 + ) + ) + (func $atomic-cmpxchg (type $0) + (local $var$0 i32) + (local $var$1 i64) + (drop + (i32.atomic.rmw.cmpxchg offset=4 + (get_local $var$0) + (get_local $var$0) + (get_local $var$0) + ) + ) + (drop + (i32.atomic.rmw8_u.cmpxchg + (get_local $var$0) + (get_local $var$0) (get_local $var$0) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg offset=4 + (get_local $var$0) + (get_local $var$1) (get_local $var$1) ) - (i64.atomic.store32 offset=4 + ) + (drop + (i64.atomic.rmw32_u.cmpxchg (get_local $var$0) (get_local $var$1) + (get_local $var$1) ) ) ) - (func $atomic-rmw (type $0) + (func $atomic-wait-wake (type $0) (local $var$0 i32) (local $var$1 i64) - (block $label$0 - (drop - (i32.atomic.rmw.add offset=4 - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i32.atomic.rmw8_u.add offset=4 - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i32.atomic.rmw16_u.and - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i64.atomic.rmw32_u.or - (get_local $var$0) - (get_local $var$1) - ) - ) - (drop - (i32.atomic.rmw8_u.xchg - (get_local $var$0) - (get_local $var$0) - ) + (drop + (i32.wait + (get_local $var$0) + (get_local $var$0) + (get_local $var$1) ) ) - ) - (func $atomic-cmpxchg (type $0) - (local $var$0 i32) - (local $var$1 i64) - (block $label$0 - (drop - (i32.atomic.rmw.cmpxchg offset=4 - (get_local $var$0) - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i32.atomic.rmw8_u.cmpxchg - (get_local $var$0) - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i64.atomic.rmw.cmpxchg offset=4 - (get_local $var$0) - (get_local $var$1) - (get_local $var$1) - ) - ) - (drop - (i64.atomic.rmw32_u.cmpxchg - (get_local $var$0) - (get_local $var$1) - (get_local $var$1) - ) + (drop + (wake + (get_local $var$0) + (get_local $var$0) ) ) - ) - (func $atomic-wait-wake (type $0) - (local $var$0 i32) - (local $var$1 i64) - (block $label$0 - (drop - (i32.wait - (get_local $var$0) - (get_local $var$0) - (get_local $var$1) - ) - ) - (drop - (wake - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i64.wait - (get_local $var$0) - (get_local $var$1) - (get_local $var$1) - ) + (drop + (i64.wait + (get_local $var$0) + (get_local $var$1) + (get_local $var$1) ) ) ) diff --git a/test/atomics.wast.fromBinary.noDebugInfo b/test/atomics.wast.fromBinary.noDebugInfo index c45ae1fac..d9f18a221 100644 --- a/test/atomics.wast.fromBinary.noDebugInfo +++ b/test/atomics.wast.fromBinary.noDebugInfo @@ -4,165 +4,157 @@ (func $0 (type $0) (local $var$0 i32) (local $var$1 i64) - (block $label$0 - (drop - (i32.atomic.load8_u offset=4 - (get_local $var$0) - ) + (drop + (i32.atomic.load8_u offset=4 + (get_local $var$0) ) - (drop - (i32.atomic.load16_u offset=4 - (get_local $var$0) - ) + ) + (drop + (i32.atomic.load16_u offset=4 + (get_local $var$0) ) - (drop - (i32.atomic.load offset=4 - (get_local $var$0) - ) + ) + (drop + (i32.atomic.load offset=4 + (get_local $var$0) ) - (drop - (i64.atomic.load8_u - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load8_u + (get_local $var$0) ) - (drop - (i64.atomic.load16_u - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load16_u + (get_local $var$0) ) - (drop - (i64.atomic.load32_u - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load32_u + (get_local $var$0) ) - (drop - (i64.atomic.load - (get_local $var$0) - ) + ) + (drop + (i64.atomic.load + (get_local $var$0) ) - (i32.atomic.store offset=4 + ) + (i32.atomic.store offset=4 + (get_local $var$0) + (get_local $var$0) + ) + (i32.atomic.store8 offset=4 + (get_local $var$0) + (get_local $var$0) + ) + (i32.atomic.store16 offset=4 + (get_local $var$0) + (get_local $var$0) + ) + (i64.atomic.store offset=4 + (get_local $var$0) + (get_local $var$1) + ) + (i64.atomic.store8 offset=4 + (get_local $var$0) + (get_local $var$1) + ) + (i64.atomic.store16 offset=4 + (get_local $var$0) + (get_local $var$1) + ) + (i64.atomic.store32 offset=4 + (get_local $var$0) + (get_local $var$1) + ) + ) + (func $1 (type $0) + (local $var$0 i32) + (local $var$1 i64) + (drop + (i32.atomic.rmw.add offset=4 (get_local $var$0) (get_local $var$0) ) - (i32.atomic.store8 offset=4 + ) + (drop + (i32.atomic.rmw8_u.add offset=4 (get_local $var$0) (get_local $var$0) ) - (i32.atomic.store16 offset=4 + ) + (drop + (i32.atomic.rmw16_u.and (get_local $var$0) (get_local $var$0) ) - (i64.atomic.store offset=4 + ) + (drop + (i64.atomic.rmw32_u.or (get_local $var$0) (get_local $var$1) ) - (i64.atomic.store8 offset=4 + ) + (drop + (i32.atomic.rmw8_u.xchg + (get_local $var$0) (get_local $var$0) - (get_local $var$1) ) - (i64.atomic.store16 offset=4 + ) + ) + (func $2 (type $0) + (local $var$0 i32) + (local $var$1 i64) + (drop + (i32.atomic.rmw.cmpxchg offset=4 + (get_local $var$0) + (get_local $var$0) + (get_local $var$0) + ) + ) + (drop + (i32.atomic.rmw8_u.cmpxchg + (get_local $var$0) + (get_local $var$0) (get_local $var$0) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg offset=4 + (get_local $var$0) + (get_local $var$1) (get_local $var$1) ) - (i64.atomic.store32 offset=4 + ) + (drop + (i64.atomic.rmw32_u.cmpxchg (get_local $var$0) (get_local $var$1) + (get_local $var$1) ) ) ) - (func $1 (type $0) + (func $3 (type $0) (local $var$0 i32) (local $var$1 i64) - (block $label$0 - (drop - (i32.atomic.rmw.add offset=4 - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i32.atomic.rmw8_u.add offset=4 - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i32.atomic.rmw16_u.and - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i64.atomic.rmw32_u.or - (get_local $var$0) - (get_local $var$1) - ) - ) - (drop - (i32.atomic.rmw8_u.xchg - (get_local $var$0) - (get_local $var$0) - ) + (drop + (i32.wait + (get_local $var$0) + (get_local $var$0) + (get_local $var$1) ) ) - ) - (func $2 (type $0) - (local $var$0 i32) - (local $var$1 i64) - (block $label$0 - (drop - (i32.atomic.rmw.cmpxchg offset=4 - (get_local $var$0) - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i32.atomic.rmw8_u.cmpxchg - (get_local $var$0) - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i64.atomic.rmw.cmpxchg offset=4 - (get_local $var$0) - (get_local $var$1) - (get_local $var$1) - ) - ) - (drop - (i64.atomic.rmw32_u.cmpxchg - (get_local $var$0) - (get_local $var$1) - (get_local $var$1) - ) + (drop + (wake + (get_local $var$0) + (get_local $var$0) ) ) - ) - (func $3 (type $0) - (local $var$0 i32) - (local $var$1 i64) - (block $label$0 - (drop - (i32.wait - (get_local $var$0) - (get_local $var$0) - (get_local $var$1) - ) - ) - (drop - (wake - (get_local $var$0) - (get_local $var$0) - ) - ) - (drop - (i64.wait - (get_local $var$0) - (get_local $var$1) - (get_local $var$1) - ) + (drop + (i64.wait + (get_local $var$0) + (get_local $var$1) + (get_local $var$1) ) ) ) diff --git a/test/break-to-return.wasm.fromBinary b/test/break-to-return.wasm.fromBinary index 0bf75cc8b..d030ca7f0 100644 --- a/test/break-to-return.wasm.fromBinary +++ b/test/break-to-return.wasm.fromBinary @@ -3,8 +3,8 @@ (memory $0 256 256) (export "add" (func $0)) (func $0 (type $0) (param $var$0 i32) (param $var$1 i32) (result i32) - (block $binaryen|break-to-return (result i32) - (br $binaryen|break-to-return + (block $label$0 (result i32) + (br $label$0 (i32.add (get_local $var$0) (get_local $var$1) diff --git a/test/debugInfo.fromasm.clamp.map b/test/debugInfo.fromasm.clamp.map index 0828cfdec..838607f31 100644 --- a/test/debugInfo.fromasm.clamp.map +++ b/test/debugInfo.fromasm.clamp.map @@ -1 +1 @@ -{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"oKC8ylTA,UC7vlTA,OAkDA,aCnGA,OACA,OACA,0BCAA,wBAKA,MAJA,OADA,0BAKA,6FCsi1DA"}
\ No newline at end of file +{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"oKC8ylTA,QC7vlTA,OAkDA,UCnGA,OACA,OACA,uBCAA,wBAKA,MAJA,OADA,0BAKA,0FCsi1DA"}
\ No newline at end of file diff --git a/test/debugInfo.fromasm.clamp.no-opts.map b/test/debugInfo.fromasm.clamp.no-opts.map index 99fe86aab..fc2087bb3 100644 --- a/test/debugInfo.fromasm.clamp.no-opts.map +++ b/test/debugInfo.fromasm.clamp.no-opts.map @@ -1 +1 @@ -{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"+KAIA,IACA,ICyylTA,kBC7vlTA,OAkDA,+BCnGA,OACA,OACA,4BCAA,4BAKA,QAJA,OADA,8CAKA,8ICsi1DA"}
\ No newline at end of file +{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"6KAIA,IACA,ICyylTA,aC7vlTA,OAkDA,0BCnGA,OACA,OACA,uBCAA,4BAKA,QAJA,OADA,8CAKA,yICsi1DA"}
\ No newline at end of file diff --git a/test/debugInfo.fromasm.imprecise.map b/test/debugInfo.fromasm.imprecise.map index d588cfb87..2988459c5 100644 --- a/test/debugInfo.fromasm.imprecise.map +++ b/test/debugInfo.fromasm.imprecise.map @@ -1 +1 @@ -{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"oKC8ylTA,UC7vlTA,OAkDA,WCnGA,OACA,OACA,gBCAA,wBAKA,MAJA,OADA,0BAKA,6FCsi1DA"}
\ No newline at end of file +{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"oKC8ylTA,QC7vlTA,OAkDA,QCnGA,OACA,OACA,aCAA,wBAKA,MAJA,OADA,0BAKA,0FCsi1DA"}
\ No newline at end of file diff --git a/test/debugInfo.fromasm.imprecise.no-opts.map b/test/debugInfo.fromasm.imprecise.no-opts.map index 152b1ad8a..4dd296b9a 100644 --- a/test/debugInfo.fromasm.imprecise.no-opts.map +++ b/test/debugInfo.fromasm.imprecise.no-opts.map @@ -1 +1 @@ -{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"8KAIA,IACA,ICyylTA,kBC7vlTA,OAkDA,cCnGA,OACA,OACA,2BCAA,4BAKA,QAJA,OADA,8CAKA,8ICsi1DA"}
\ No newline at end of file +{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"4KAIA,IACA,ICyylTA,aC7vlTA,OAkDA,SCnGA,OACA,OACA,sBCAA,4BAKA,QAJA,OADA,8CAKA,yICsi1DA"}
\ No newline at end of file diff --git a/test/debugInfo.fromasm.map b/test/debugInfo.fromasm.map index 0828cfdec..838607f31 100644 --- a/test/debugInfo.fromasm.map +++ b/test/debugInfo.fromasm.map @@ -1 +1 @@ -{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"oKC8ylTA,UC7vlTA,OAkDA,aCnGA,OACA,OACA,0BCAA,wBAKA,MAJA,OADA,0BAKA,6FCsi1DA"}
\ No newline at end of file +{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"oKC8ylTA,QC7vlTA,OAkDA,UCnGA,OACA,OACA,uBCAA,wBAKA,MAJA,OADA,0BAKA,0FCsi1DA"}
\ No newline at end of file diff --git a/test/debugInfo.fromasm.no-opts.map b/test/debugInfo.fromasm.no-opts.map index 99fe86aab..fc2087bb3 100644 --- a/test/debugInfo.fromasm.no-opts.map +++ b/test/debugInfo.fromasm.no-opts.map @@ -1 +1 @@ -{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"+KAIA,IACA,ICyylTA,kBC7vlTA,OAkDA,+BCnGA,OACA,OACA,4BCAA,4BAKA,QAJA,OADA,8CAKA,8ICsi1DA"}
\ No newline at end of file +{"version":3,"sources":["tests/hello_world.c","tests/other_file.cpp","return.cpp","even-opted.cpp","fib.c","/tmp/emscripten_test_binaryen2_28hnAe/src.c"],"names":[],"mappings":"6KAIA,IACA,ICyylTA,aC7vlTA,OAkDA,0BCnGA,OACA,OACA,uBCAA,4BAKA,QAJA,OADA,8CAKA,yICsi1DA"}
\ No newline at end of file diff --git a/test/dylib.wasm.fromBinary b/test/dylib.wasm.fromBinary index aff341754..78d3d8ad4 100644 --- a/test/dylib.wasm.fromBinary +++ b/test/dylib.wasm.fromBinary @@ -16,7 +16,7 @@ (export "runPostSets" (func $1)) (export "_str" (global $global$2)) (func $0 (type $1) (result i32) - (block $label$0 (result i32) + (block $label$1 (result i32) (drop (call $import$1 (get_global $import$0) @@ -29,7 +29,7 @@ (nop) ) (func $2 (type $2) - (block $label$0 + (block $label$1 (set_global $global$0 (i32.add (get_global $import$0) diff --git a/test/example/c-api-unused-mem.txt b/test/example/c-api-unused-mem.txt index 60bdbe51d..6bb3c8a7c 100644 --- a/test/example/c-api-unused-mem.txt +++ b/test/example/c-api-unused-mem.txt @@ -46,7 +46,7 @@ (call $main) ) ) -177 +169 (module (type $0 (func)) (type $1 (func)) @@ -58,45 +58,41 @@ (local $var$0 i32) (local $var$1 i32) (local $var$2 i64) - (block $label$0 - (block $label$1 - (set_local $var$0 - (i32.load - (i32.const 0) - ) - ) - (block $label$2 - (br $label$1) + (block $label$1 + (set_local $var$0 + (i32.load + (i32.const 0) ) ) - (block $label$3 - (block $label$4 - (block $label$5 - ) - (block $label$6 - (br $label$4) - ) + (block $label$2 + (br $label$1) + ) + ) + (block $label$3 + (block $label$4 + (block $label$5 + ) + (block $label$6 + (br $label$4) ) - (block $label$7 - (block $label$8 - (i32.store - (i32.const 0) - (get_local $var$0) - ) - (return) + ) + (block $label$7 + (block $label$8 + (i32.store + (i32.const 0) + (get_local $var$0) ) - (unreachable) + (return) ) + (unreachable) ) ) ) (func $__wasm_start (type $1) - (block $label$0 - (i32.store - (i32.const 0) - (i32.const 65535) - ) - (call $main) + (i32.store + (i32.const 0) + (i32.const 65535) ) + (call $main) ) ) diff --git a/test/fib-dbg.wasm.fromBinary b/test/fib-dbg.wasm.fromBinary index 8f7193f8a..f028edda1 100644 --- a/test/fib-dbg.wasm.fromBinary +++ b/test/fib-dbg.wasm.fromBinary @@ -50,7 +50,7 @@ (export "stackAlloc" (func $stackAlloc)) (func $stackAlloc (type $1) (param $var$0 i32) (result i32) (local $var$1 i32) - (block $label$0 + (block $label$1 (set_local $var$1 (get_global $global$3) ) @@ -85,7 +85,7 @@ ) ) (func $establishStackSpace (type $0) (param $var$0 i32) (param $var$1 i32) - (block $label$0 + (block $label$1 (set_global $global$3 (get_local $var$0) ) @@ -100,7 +100,7 @@ (get_global $global$7) (i32.const 0) ) - (block $label$0 + (block (set_global $global$7 (get_local $var$0) ) @@ -123,7 +123,7 @@ (local $var$10 i32) (local $var$11 i32) ;;@ fib.c:8:0 - (block $label$0 + (block $label$1 (set_local $var$11 (get_global $global$3) ) @@ -138,7 +138,7 @@ (if ;;@ fib.c:3:0 (get_local $var$6) - (block $label$1 + (block (set_local $var$1 (i32.const 0) ) @@ -149,7 +149,7 @@ (i32.const 0) ) ) - (block $label$2 + (block (set_local $var$4 (i32.const 1) ) @@ -160,8 +160,8 @@ ) ) ;;@ fib.c:3:0 - (loop $label$3 - (block $label$4 + (loop $label$4 + (block $label$5 ;;@ fib.c:4:0 (set_local $var$3 (i32.add @@ -184,13 +184,13 @@ ) (if (get_local $var$7) - (block $label$5 + (block (set_local $var$4 (get_local $var$3) ) - (br $label$4) + (br $label$5) ) - (block $label$6 + (block (set_local $var$2 (get_local $var$5) ) @@ -205,7 +205,7 @@ ) ) ) - (br $label$3) + (br $label$4) ) ) ;;@ fib.c:8:0 diff --git a/test/kitchen_sink.wast.fromBinary b/test/kitchen_sink.wast.fromBinary index 9c6d2686a..c3b2f13fd 100644 --- a/test/kitchen_sink.wast.fromBinary +++ b/test/kitchen_sink.wast.fromBinary @@ -3,666 +3,664 @@ (memory $0 4096 4096) (data (i32.const 1026) "\14\00") (func $kitchensink (type $0) (result i32) - (block $label$0 (result i32) - (drop - (i32.add - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.sub - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.mul - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.div_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.div_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.rem_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.rem_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.and - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.or - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.xor - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.shl - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.shr_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.shr_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.eq - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.ne - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.lt_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.le_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.lt_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.le_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.gt_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.ge_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.gt_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.ge_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.clz - (i32.const 10) - ) - ) - (drop - (i32.ctz - (i32.const 10) - ) - ) - (drop - (i32.popcnt - (i32.const 10) - ) - ) - (drop - (i64.add - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.sub - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.mul - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.div_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.div_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.rem_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.rem_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.and - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.or - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.xor - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.shl - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.shr_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.shr_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.eq - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.ne - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.lt_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.le_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.lt_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.le_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.gt_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.ge_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.gt_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.ge_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.clz - (i64.const 100) - ) - ) - (drop - (i64.ctz - (i64.const 100) - ) - ) - (drop - (i64.popcnt - (i64.const 100) - ) - ) - (drop - (f32.add - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.sub - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.mul - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.div - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.min - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.max - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.abs - (f32.const 10) - ) - ) - (drop - (f32.neg - (f32.const 10) - ) - ) - (drop - (f32.copysign - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.ceil - (f32.const 10) - ) - ) - (drop - (f32.floor - (f32.const 10) - ) - ) - (drop - (f32.trunc - (f32.const 10) - ) - ) - (drop - (f32.nearest - (f32.const 10) - ) - ) - (drop - (f32.sqrt - (f32.const 10) - ) - ) - (drop - (f32.eq - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.ne - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.lt - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.le - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.gt - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.ge - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f64.add - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.sub - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.mul - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.div - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.min - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.max - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.abs - (f64.const 10) - ) - ) - (drop - (f64.neg - (f64.const 10) - ) - ) - (drop - (f64.copysign - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.ceil - (f64.const 10) - ) - ) - (drop - (f64.floor - (f64.const 10) - ) - ) - (drop - (f64.trunc - (f64.const 10) - ) - ) - (drop - (f64.nearest - (f64.const 10) - ) - ) - (drop - (f64.sqrt - (f64.const 10) - ) - ) - (drop - (f64.eq - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.ne - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.lt - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.le - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.gt - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.ge - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (i32.trunc_s/f32 - (f32.const 10) - ) - ) - (drop - (i32.trunc_s/f64 - (f64.const 10) - ) - ) - (drop - (i32.trunc_u/f32 - (f32.const 10) - ) - ) - (drop - (i32.trunc_u/f64 - (f64.const 10) - ) - ) - (drop - (i32.wrap/i64 - (i64.const 100) - ) - ) - (drop - (i64.trunc_s/f32 - (f32.const 10) - ) - ) - (drop - (i64.trunc_s/f64 - (f64.const 10) - ) - ) - (drop - (i64.trunc_u/f32 - (f32.const 10) - ) - ) - (drop - (i64.trunc_u/f64 - (f64.const 10) - ) - ) - (drop - (i64.extend_s/i32 - (i32.const 10) - ) - ) - (drop - (i64.extend_u/i32 - (i32.const 10) - ) - ) - (drop - (f32.convert_s/i32 - (i32.const 10) - ) - ) - (drop - (f32.convert_u/i32 - (i32.const 10) - ) - ) - (drop - (f32.convert_s/i64 - (i64.const 100) - ) - ) - (drop - (f32.convert_u/i64 - (i64.const 100) - ) - ) - (drop - (f32.demote/f64 - (f64.const 10) - ) - ) - (drop - (f32.reinterpret/i32 - (i32.const 10) - ) - ) - (drop - (f64.convert_s/i32 - (i32.const 10) - ) - ) - (drop - (f64.convert_u/i32 - (i32.const 10) - ) - ) - (drop - (f64.convert_s/i64 - (i64.const 100) - ) - ) - (drop - (f64.convert_u/i64 - (i64.const 100) - ) - ) - (drop - (f64.promote/f32 - (f32.const 10) - ) - ) - (drop - (f64.reinterpret/i64 - (i64.const 100) - ) - ) - (drop - (i32.reinterpret/f32 - (f32.const 10) - ) - ) - (drop - (i64.reinterpret/f64 - (f64.const 10) - ) - ) - (i32.const 0) + (drop + (i32.add + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.sub + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.mul + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.div_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.div_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.rem_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.rem_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.and + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.or + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.xor + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.shl + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.shr_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.shr_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.eq + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.ne + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.lt_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.le_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.lt_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.le_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.gt_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.ge_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.gt_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.ge_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.clz + (i32.const 10) + ) + ) + (drop + (i32.ctz + (i32.const 10) + ) + ) + (drop + (i32.popcnt + (i32.const 10) + ) + ) + (drop + (i64.add + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.sub + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.mul + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.div_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.div_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.rem_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.rem_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.and + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.or + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.xor + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.shl + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.shr_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.shr_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.eq + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.ne + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.lt_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.le_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.lt_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.le_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.gt_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.ge_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.gt_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.ge_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.clz + (i64.const 100) + ) + ) + (drop + (i64.ctz + (i64.const 100) + ) + ) + (drop + (i64.popcnt + (i64.const 100) + ) + ) + (drop + (f32.add + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.sub + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.mul + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.div + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.min + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.max + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.abs + (f32.const 10) + ) + ) + (drop + (f32.neg + (f32.const 10) + ) + ) + (drop + (f32.copysign + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.ceil + (f32.const 10) + ) + ) + (drop + (f32.floor + (f32.const 10) + ) + ) + (drop + (f32.trunc + (f32.const 10) + ) + ) + (drop + (f32.nearest + (f32.const 10) + ) + ) + (drop + (f32.sqrt + (f32.const 10) + ) + ) + (drop + (f32.eq + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.ne + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.lt + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.le + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.gt + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.ge + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f64.add + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.sub + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.mul + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.div + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.min + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.max + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.abs + (f64.const 10) + ) + ) + (drop + (f64.neg + (f64.const 10) + ) + ) + (drop + (f64.copysign + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.ceil + (f64.const 10) + ) + ) + (drop + (f64.floor + (f64.const 10) + ) + ) + (drop + (f64.trunc + (f64.const 10) + ) + ) + (drop + (f64.nearest + (f64.const 10) + ) + ) + (drop + (f64.sqrt + (f64.const 10) + ) + ) + (drop + (f64.eq + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.ne + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.lt + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.le + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.gt + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.ge + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (i32.trunc_s/f32 + (f32.const 10) + ) + ) + (drop + (i32.trunc_s/f64 + (f64.const 10) + ) + ) + (drop + (i32.trunc_u/f32 + (f32.const 10) + ) + ) + (drop + (i32.trunc_u/f64 + (f64.const 10) + ) + ) + (drop + (i32.wrap/i64 + (i64.const 100) + ) + ) + (drop + (i64.trunc_s/f32 + (f32.const 10) + ) + ) + (drop + (i64.trunc_s/f64 + (f64.const 10) + ) + ) + (drop + (i64.trunc_u/f32 + (f32.const 10) + ) + ) + (drop + (i64.trunc_u/f64 + (f64.const 10) + ) + ) + (drop + (i64.extend_s/i32 + (i32.const 10) + ) + ) + (drop + (i64.extend_u/i32 + (i32.const 10) + ) + ) + (drop + (f32.convert_s/i32 + (i32.const 10) + ) + ) + (drop + (f32.convert_u/i32 + (i32.const 10) + ) + ) + (drop + (f32.convert_s/i64 + (i64.const 100) + ) + ) + (drop + (f32.convert_u/i64 + (i64.const 100) + ) + ) + (drop + (f32.demote/f64 + (f64.const 10) + ) + ) + (drop + (f32.reinterpret/i32 + (i32.const 10) + ) + ) + (drop + (f64.convert_s/i32 + (i32.const 10) + ) + ) + (drop + (f64.convert_u/i32 + (i32.const 10) + ) + ) + (drop + (f64.convert_s/i64 + (i64.const 100) + ) + ) + (drop + (f64.convert_u/i64 + (i64.const 100) + ) + ) + (drop + (f64.promote/f32 + (f32.const 10) + ) + ) + (drop + (f64.reinterpret/i64 + (i64.const 100) + ) + ) + (drop + (i32.reinterpret/f32 + (f32.const 10) + ) + ) + (drop + (i64.reinterpret/f64 + (f64.const 10) + ) ) + (i32.const 0) ) ) diff --git a/test/kitchen_sink.wast.fromBinary.noDebugInfo b/test/kitchen_sink.wast.fromBinary.noDebugInfo index 4491d8048..58bc060aa 100644 --- a/test/kitchen_sink.wast.fromBinary.noDebugInfo +++ b/test/kitchen_sink.wast.fromBinary.noDebugInfo @@ -3,666 +3,664 @@ (memory $0 4096 4096) (data (i32.const 1026) "\14\00") (func $0 (type $0) (result i32) - (block $label$0 (result i32) - (drop - (i32.add - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.sub - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.mul - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.div_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.div_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.rem_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.rem_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.and - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.or - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.xor - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.shl - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.shr_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.shr_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.eq - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.ne - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.lt_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.le_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.lt_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.le_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.gt_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.ge_s - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.gt_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.ge_u - (i32.const 10) - (i32.const 10) - ) - ) - (drop - (i32.clz - (i32.const 10) - ) - ) - (drop - (i32.ctz - (i32.const 10) - ) - ) - (drop - (i32.popcnt - (i32.const 10) - ) - ) - (drop - (i64.add - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.sub - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.mul - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.div_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.div_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.rem_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.rem_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.and - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.or - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.xor - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.shl - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.shr_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.shr_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.eq - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.ne - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.lt_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.le_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.lt_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.le_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.gt_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.ge_s - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.gt_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.ge_u - (i64.const 100) - (i64.const 100) - ) - ) - (drop - (i64.clz - (i64.const 100) - ) - ) - (drop - (i64.ctz - (i64.const 100) - ) - ) - (drop - (i64.popcnt - (i64.const 100) - ) - ) - (drop - (f32.add - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.sub - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.mul - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.div - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.min - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.max - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.abs - (f32.const 10) - ) - ) - (drop - (f32.neg - (f32.const 10) - ) - ) - (drop - (f32.copysign - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.ceil - (f32.const 10) - ) - ) - (drop - (f32.floor - (f32.const 10) - ) - ) - (drop - (f32.trunc - (f32.const 10) - ) - ) - (drop - (f32.nearest - (f32.const 10) - ) - ) - (drop - (f32.sqrt - (f32.const 10) - ) - ) - (drop - (f32.eq - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.ne - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.lt - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.le - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.gt - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f32.ge - (f32.const 10) - (f32.const 10) - ) - ) - (drop - (f64.add - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.sub - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.mul - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.div - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.min - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.max - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.abs - (f64.const 10) - ) - ) - (drop - (f64.neg - (f64.const 10) - ) - ) - (drop - (f64.copysign - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.ceil - (f64.const 10) - ) - ) - (drop - (f64.floor - (f64.const 10) - ) - ) - (drop - (f64.trunc - (f64.const 10) - ) - ) - (drop - (f64.nearest - (f64.const 10) - ) - ) - (drop - (f64.sqrt - (f64.const 10) - ) - ) - (drop - (f64.eq - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.ne - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.lt - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.le - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.gt - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (f64.ge - (f64.const 10) - (f64.const 10) - ) - ) - (drop - (i32.trunc_s/f32 - (f32.const 10) - ) - ) - (drop - (i32.trunc_s/f64 - (f64.const 10) - ) - ) - (drop - (i32.trunc_u/f32 - (f32.const 10) - ) - ) - (drop - (i32.trunc_u/f64 - (f64.const 10) - ) - ) - (drop - (i32.wrap/i64 - (i64.const 100) - ) - ) - (drop - (i64.trunc_s/f32 - (f32.const 10) - ) - ) - (drop - (i64.trunc_s/f64 - (f64.const 10) - ) - ) - (drop - (i64.trunc_u/f32 - (f32.const 10) - ) - ) - (drop - (i64.trunc_u/f64 - (f64.const 10) - ) - ) - (drop - (i64.extend_s/i32 - (i32.const 10) - ) - ) - (drop - (i64.extend_u/i32 - (i32.const 10) - ) - ) - (drop - (f32.convert_s/i32 - (i32.const 10) - ) - ) - (drop - (f32.convert_u/i32 - (i32.const 10) - ) - ) - (drop - (f32.convert_s/i64 - (i64.const 100) - ) - ) - (drop - (f32.convert_u/i64 - (i64.const 100) - ) - ) - (drop - (f32.demote/f64 - (f64.const 10) - ) - ) - (drop - (f32.reinterpret/i32 - (i32.const 10) - ) - ) - (drop - (f64.convert_s/i32 - (i32.const 10) - ) - ) - (drop - (f64.convert_u/i32 - (i32.const 10) - ) - ) - (drop - (f64.convert_s/i64 - (i64.const 100) - ) - ) - (drop - (f64.convert_u/i64 - (i64.const 100) - ) - ) - (drop - (f64.promote/f32 - (f32.const 10) - ) - ) - (drop - (f64.reinterpret/i64 - (i64.const 100) - ) - ) - (drop - (i32.reinterpret/f32 - (f32.const 10) - ) - ) - (drop - (i64.reinterpret/f64 - (f64.const 10) - ) - ) - (i32.const 0) + (drop + (i32.add + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.sub + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.mul + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.div_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.div_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.rem_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.rem_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.and + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.or + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.xor + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.shl + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.shr_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.shr_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.eq + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.ne + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.lt_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.le_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.lt_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.le_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.gt_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.ge_s + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.gt_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.ge_u + (i32.const 10) + (i32.const 10) + ) + ) + (drop + (i32.clz + (i32.const 10) + ) + ) + (drop + (i32.ctz + (i32.const 10) + ) + ) + (drop + (i32.popcnt + (i32.const 10) + ) + ) + (drop + (i64.add + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.sub + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.mul + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.div_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.div_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.rem_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.rem_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.and + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.or + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.xor + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.shl + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.shr_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.shr_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.eq + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.ne + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.lt_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.le_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.lt_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.le_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.gt_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.ge_s + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.gt_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.ge_u + (i64.const 100) + (i64.const 100) + ) + ) + (drop + (i64.clz + (i64.const 100) + ) + ) + (drop + (i64.ctz + (i64.const 100) + ) + ) + (drop + (i64.popcnt + (i64.const 100) + ) + ) + (drop + (f32.add + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.sub + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.mul + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.div + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.min + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.max + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.abs + (f32.const 10) + ) + ) + (drop + (f32.neg + (f32.const 10) + ) + ) + (drop + (f32.copysign + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.ceil + (f32.const 10) + ) + ) + (drop + (f32.floor + (f32.const 10) + ) + ) + (drop + (f32.trunc + (f32.const 10) + ) + ) + (drop + (f32.nearest + (f32.const 10) + ) + ) + (drop + (f32.sqrt + (f32.const 10) + ) + ) + (drop + (f32.eq + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.ne + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.lt + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.le + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.gt + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f32.ge + (f32.const 10) + (f32.const 10) + ) + ) + (drop + (f64.add + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.sub + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.mul + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.div + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.min + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.max + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.abs + (f64.const 10) + ) + ) + (drop + (f64.neg + (f64.const 10) + ) + ) + (drop + (f64.copysign + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.ceil + (f64.const 10) + ) + ) + (drop + (f64.floor + (f64.const 10) + ) + ) + (drop + (f64.trunc + (f64.const 10) + ) + ) + (drop + (f64.nearest + (f64.const 10) + ) + ) + (drop + (f64.sqrt + (f64.const 10) + ) + ) + (drop + (f64.eq + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.ne + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.lt + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.le + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.gt + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (f64.ge + (f64.const 10) + (f64.const 10) + ) + ) + (drop + (i32.trunc_s/f32 + (f32.const 10) + ) + ) + (drop + (i32.trunc_s/f64 + (f64.const 10) + ) + ) + (drop + (i32.trunc_u/f32 + (f32.const 10) + ) + ) + (drop + (i32.trunc_u/f64 + (f64.const 10) + ) + ) + (drop + (i32.wrap/i64 + (i64.const 100) + ) + ) + (drop + (i64.trunc_s/f32 + (f32.const 10) + ) + ) + (drop + (i64.trunc_s/f64 + (f64.const 10) + ) + ) + (drop + (i64.trunc_u/f32 + (f32.const 10) + ) + ) + (drop + (i64.trunc_u/f64 + (f64.const 10) + ) + ) + (drop + (i64.extend_s/i32 + (i32.const 10) + ) + ) + (drop + (i64.extend_u/i32 + (i32.const 10) + ) + ) + (drop + (f32.convert_s/i32 + (i32.const 10) + ) + ) + (drop + (f32.convert_u/i32 + (i32.const 10) + ) + ) + (drop + (f32.convert_s/i64 + (i64.const 100) + ) + ) + (drop + (f32.convert_u/i64 + (i64.const 100) + ) + ) + (drop + (f32.demote/f64 + (f64.const 10) + ) + ) + (drop + (f32.reinterpret/i32 + (i32.const 10) + ) + ) + (drop + (f64.convert_s/i32 + (i32.const 10) + ) + ) + (drop + (f64.convert_u/i32 + (i32.const 10) + ) + ) + (drop + (f64.convert_s/i64 + (i64.const 100) + ) + ) + (drop + (f64.convert_u/i64 + (i64.const 100) + ) + ) + (drop + (f64.promote/f32 + (f32.const 10) + ) + ) + (drop + (f64.reinterpret/i64 + (i64.const 100) + ) + ) + (drop + (i32.reinterpret/f32 + (f32.const 10) + ) + ) + (drop + (i64.reinterpret/f64 + (f64.const 10) + ) ) + (i32.const 0) ) ) diff --git a/test/merge/dylib.wasm.combined b/test/merge/dylib.wasm.combined index 71df67356..eea90db8e 100644 --- a/test/merge/dylib.wasm.combined +++ b/test/merge/dylib.wasm.combined @@ -26,8 +26,8 @@ (export "_str" (global $global$2)) (export "_foo" (func $_foo)) (func $_main (type $2) (result i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (drop (call $import$1 (get_global $import$0) @@ -38,36 +38,34 @@ ) ) (func $runPostSets (type $3) - (block $label$0 + (block $label$1 (nop) ) ) (func $__post_instantiate (type $3) (call $__post_instantiate$0) - (block - (block $label$0 - (block $label$1 - (set_global $global$0 - (i32.add - (get_global $import$0) - (i32.const 16) - ) + (block $label$1 + (block $label$2 + (set_global $global$0 + (i32.add + (get_global $import$0) + (i32.const 16) ) - (set_global $global$1 - (i32.add - (get_global $global$0) - (i32.const 32) - ) + ) + (set_global $global$1 + (i32.add + (get_global $global$0) + (i32.const 32) ) - (call $runPostSets) ) + (call $runPostSets) ) ) ) (func $_foo (type $1$0) (result i32) (local $var$0 i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (set_local $var$0 (call $_main) ) @@ -76,13 +74,13 @@ ) ) (func $runPostSets$0 (type $2$0) - (block $label$0 + (block $label$1 (nop) ) ) (func $__post_instantiate$0 (type $2$0) - (block $label$0 - (block $label$1 + (block $label$1 + (block $label$2 (set_global $global$0$0 (i32.add (get_global $import$0$0) diff --git a/test/merge/dylib.wasm.combined.finalized b/test/merge/dylib.wasm.combined.finalized index 2ef9ed135..1a6ae5400 100644 --- a/test/merge/dylib.wasm.combined.finalized +++ b/test/merge/dylib.wasm.combined.finalized @@ -26,8 +26,8 @@ (export "_str" (global $global$2)) (export "_foo" (func $_foo)) (func $_main (type $2) (result i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (drop (call $import$1 (i32.const 1024) @@ -38,36 +38,34 @@ ) ) (func $runPostSets (type $3) - (block $label$0 + (block $label$1 (nop) ) ) (func $__post_instantiate (type $3) (call $__post_instantiate$0) - (block - (block $label$0 - (block $label$1 - (set_global $global$0 - (i32.add - (i32.const 1024) - (i32.const 16) - ) + (block $label$1 + (block $label$2 + (set_global $global$0 + (i32.add + (i32.const 1024) + (i32.const 16) ) - (set_global $global$1 - (i32.add - (get_global $global$0) - (i32.const 32) - ) + ) + (set_global $global$1 + (i32.add + (get_global $global$0) + (i32.const 32) ) - (call $runPostSets) ) + (call $runPostSets) ) ) ) (func $_foo (type $1$0) (result i32) (local $var$0 i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (set_local $var$0 (call $_main) ) @@ -76,13 +74,13 @@ ) ) (func $runPostSets$0 (type $2$0) - (block $label$0 + (block $label$1 (nop) ) ) (func $__post_instantiate$0 (type $2$0) - (block $label$0 - (block $label$1 + (block $label$1 + (block $label$2 (set_global $global$0$0 (i32.add (i32.const 1024) diff --git a/test/merge/dylib.wasm.combined.finalized.opt b/test/merge/dylib.wasm.combined.finalized.opt index 41a24ce30..fa3f7bd70 100644 --- a/test/merge/dylib.wasm.combined.finalized.opt +++ b/test/merge/dylib.wasm.combined.finalized.opt @@ -18,8 +18,8 @@ (export "_str" (global $global$2)) (export "_foo" (func $_foo)) (func $_main (type $2) (result i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (drop (call $import$1 (i32.const 1024) @@ -34,27 +34,25 @@ ) (func $__post_instantiate (type $3) (call $__post_instantiate$0) - (block - (block $label$0 - (block $label$1 - (set_global $global$0 - (i32.const 1040) - ) - (set_global $global$1 - (i32.add - (get_global $global$0) - (i32.const 32) - ) + (block $label$1 + (block $label$2 + (set_global $global$0 + (i32.const 1040) + ) + (set_global $global$1 + (i32.add + (get_global $global$0) + (i32.const 32) ) - (call $runPostSets) ) + (call $runPostSets) ) ) ) (func $_foo (type $2) (result i32) (local $var$0 i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (set_local $var$0 (call $_main) ) @@ -66,8 +64,8 @@ (nop) ) (func $__post_instantiate$0 (type $3) - (block $label$0 - (block $label$1 + (block $label$1 + (block $label$2 (set_global $global$0$0 (i32.const 1072) ) diff --git a/test/merge/dylib.wasm.combined.opt b/test/merge/dylib.wasm.combined.opt index 351d05b41..046fe9e48 100644 --- a/test/merge/dylib.wasm.combined.opt +++ b/test/merge/dylib.wasm.combined.opt @@ -21,8 +21,8 @@ (export "_str" (global $global$2)) (export "_foo" (func $_foo)) (func $_main (type $2) (result i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (drop (call $import$1 (get_global $import$0) @@ -37,30 +37,28 @@ ) (func $__post_instantiate (type $3) (call $__post_instantiate$0) - (block - (block $label$0 - (block $label$1 - (set_global $global$0 - (i32.add - (get_global $import$0) - (i32.const 16) - ) + (block $label$1 + (block $label$2 + (set_global $global$0 + (i32.add + (get_global $import$0) + (i32.const 16) ) - (set_global $global$1 - (i32.add - (get_global $global$0) - (i32.const 32) - ) + ) + (set_global $global$1 + (i32.add + (get_global $global$0) + (i32.const 32) ) - (call $runPostSets) ) + (call $runPostSets) ) ) ) (func $_foo (type $2) (result i32) (local $var$0 i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (set_local $var$0 (call $_main) ) @@ -72,8 +70,8 @@ (nop) ) (func $__post_instantiate$0 (type $3) - (block $label$0 - (block $label$1 + (block $label$1 + (block $label$2 (set_global $global$0$0 (i32.add (get_global $import$0$0) diff --git a/test/min.wast.fromBinary b/test/min.wast.fromBinary index f25c51044..9017a76df 100644 --- a/test/min.wast.fromBinary +++ b/test/min.wast.fromBinary @@ -16,7 +16,7 @@ (local $var$2 f32) (tee_local $var$2 (f32.neg - (block $label$0 (result f32) + (block $label$1 (result f32) (i32.store (get_local $var$0) (get_local $var$1) @@ -29,29 +29,27 @@ ) ) (func $littleswitch (type $2) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (block $label$1 - (block $label$2 - (br_table $label$2 $label$1 $label$2 + (block $label$1 (result i32) + (block $label$2 + (block $label$3 + (br_table $label$3 $label$2 $label$3 (i32.sub (get_local $var$0) (i32.const 1) ) ) ) - (br $label$0 + (br $label$1 (i32.const 1) ) ) - (br $label$0 + (br $label$1 (i32.const 2) ) ) ) (func $f1 (type $3) (param $var$0 i32) (param $var$1 i32) (param $var$2 i32) (result i32) - (block $label$0 (result i32) - (get_local $var$2) - ) + (get_local $var$2) ) ) diff --git a/test/min.wast.fromBinary.noDebugInfo b/test/min.wast.fromBinary.noDebugInfo index b7407584e..75718561b 100644 --- a/test/min.wast.fromBinary.noDebugInfo +++ b/test/min.wast.fromBinary.noDebugInfo @@ -16,7 +16,7 @@ (local $var$2 f32) (tee_local $var$2 (f32.neg - (block $label$0 (result f32) + (block $label$1 (result f32) (i32.store (get_local $var$0) (get_local $var$1) @@ -29,29 +29,27 @@ ) ) (func $2 (type $2) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (block $label$1 - (block $label$2 - (br_table $label$2 $label$1 $label$2 + (block $label$1 (result i32) + (block $label$2 + (block $label$3 + (br_table $label$3 $label$2 $label$3 (i32.sub (get_local $var$0) (i32.const 1) ) ) ) - (br $label$0 + (br $label$1 (i32.const 1) ) ) - (br $label$0 + (br $label$1 (i32.const 2) ) ) ) (func $3 (type $3) (param $var$0 i32) (param $var$1 i32) (param $var$2 i32) (result i32) - (block $label$0 (result i32) - (get_local $var$2) - ) + (get_local $var$2) ) ) diff --git a/test/passes/O.bin.txt b/test/passes/O.bin.txt index 9c68478ac..ae707917c 100644 --- a/test/passes/O.bin.txt +++ b/test/passes/O.bin.txt @@ -50,7 +50,7 @@ (set_local $1 (i64.const 1) ) - (loop $label$2 + (loop $label$3 (if (i64.ne (get_local $0) @@ -69,7 +69,7 @@ (i64.const 1) ) ) - (br $label$2) + (br $label$3) ) ) ) @@ -85,14 +85,14 @@ (get_local $0) (i64.const 2) ) - (loop $label$2 + (loop $label$3 (set_local $1 (i64.mul (get_local $1) (get_local $0) ) ) - (br_if $label$2 + (br_if $label$3 (i64.gt_s (tee_local $0 (i64.add diff --git a/test/passes/dce_vacuum.bin.txt b/test/passes/dce_vacuum.bin.txt index d4be4d1f4..9cc1cba3c 100644 --- a/test/passes/dce_vacuum.bin.txt +++ b/test/passes/dce_vacuum.bin.txt @@ -5,9 +5,9 @@ (export "f32.compute_radix" (func $0)) (export "f64.compute_radix" (func $1)) (func $0 (type $0) (param $var$0 f32) (param $var$1 f32) (result f32) - (block $label$0 - (loop $label$1 - (br_if $label$1 + (block $label$1 + (loop $label$2 + (br_if $label$2 (f32.eq (f32.add (f32.sub @@ -48,9 +48,9 @@ ) ) (func $1 (type $1) (param $var$0 f64) (param $var$1 f64) (result f64) - (block $label$0 (result f64) - (loop $label$1 - (br_if $label$1 + (block $label$1 (result f64) + (loop $label$2 + (br_if $label$2 (f64.eq (f64.add (f64.sub @@ -71,8 +71,8 @@ ) ) ) - (loop $label$2 - (br_if $label$2 + (loop $label$3 + (br_if $label$3 (f64.ne (f64.sub (f64.sub diff --git a/test/passes/flatten-control-flow.bin.txt b/test/passes/flatten-control-flow.bin.txt index 5de52bb3c..93fbff864 100644 --- a/test/passes/flatten-control-flow.bin.txt +++ b/test/passes/flatten-control-flow.bin.txt @@ -22,102 +22,38 @@ (export "read" (func $9)) (func $0 (type $0) (result i32) (local $var$0 i32) - (local $1 i32) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $1 (type $1) (result i64) (local $var$0 i64) - (local $1 i64) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $2 (type $2) (result f32) (local $var$0 f32) - (local $1 f32) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $3 (type $3) (result f64) (local $var$0 f64) - (local $1 f64) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $4 (type $4) (param $var$0 i32) (result i32) - (local $1 i32) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $5 (type $5) (param $var$0 i64) (result i64) - (local $1 i64) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $6 (type $6) (param $var$0 f32) (result f32) - (local $1 f32) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $7 (type $7) (param $var$0 f64) (result f64) - (local $1 f64) - (block - (set_local $1 - (get_local $var$0) - ) - ) - (return - (get_local $1) - ) + (get_local $var$0) ) (func $8 (type $8) (param $var$0 i64) (param $var$1 f32) (param $var$2 f64) (param $var$3 i32) (param $var$4 i32) (local $var$5 i64) (local $var$6 i64) (local $var$7 f32) (local $var$8 f64) - (block $label$0 + (block $label$1 (nop) (unreachable) ) @@ -128,53 +64,48 @@ (local $var$7 f32) (local $var$8 f64) (local $9 f64) - (local $10 f64) - (block - (block - (block $label$0 - (set_local $var$7 - (f32.const 5.5) - ) - (set_local $var$5 - (i64.const 6) - ) - (set_local $var$8 - (f64.const 8) + (block $label$1 + (set_local $var$7 + (f32.const 5.5) + ) + (set_local $var$5 + (i64.const 6) + ) + (set_local $var$8 + (f64.const 8) + ) + (set_local $9 + (f64.add + (f64.convert_u/i64 + (get_local $var$0) ) - (set_local $9 + (f64.add + (f64.promote/f32 + (get_local $var$1) + ) (f64.add - (f64.convert_u/i64 - (get_local $var$0) - ) + (get_local $var$2) (f64.add - (f64.promote/f32 - (get_local $var$1) + (f64.convert_u/i32 + (get_local $var$3) ) (f64.add - (get_local $var$2) + (f64.convert_s/i32 + (get_local $var$4) + ) (f64.add - (f64.convert_u/i32 - (get_local $var$3) + (f64.promote/f32 + (get_local $var$7) ) (f64.add - (f64.convert_s/i32 - (get_local $var$4) + (f64.convert_u/i64 + (get_local $var$5) ) (f64.add - (f64.promote/f32 - (get_local $var$7) - ) - (f64.add - (f64.convert_u/i64 - (get_local $var$5) - ) - (f64.add - (f64.convert_u/i64 - (get_local $var$6) - ) - (get_local $var$8) - ) + (f64.convert_u/i64 + (get_local $var$6) ) + (get_local $var$8) ) ) ) @@ -183,13 +114,10 @@ ) ) ) - (set_local $10 - (get_local $9) - ) ) ) (return - (get_local $10) + (get_local $9) ) ) ) diff --git a/test/polymorphic_stack.wast.fromBinary b/test/polymorphic_stack.wast.fromBinary index 709d131c0..35617d34b 100644 --- a/test/polymorphic_stack.wast.fromBinary +++ b/test/polymorphic_stack.wast.fromBinary @@ -6,36 +6,30 @@ (import "env" "table" (table 9 9 anyfunc)) (memory $0 0) (func $break-and-binary (type $1) (result i32) - (block $label$0 (result i32) + (block $label$1 (result i32) (unreachable) ) ) (func $call-and-unary (type $0) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (unreachable) - ) + (unreachable) ) (func $tee (type $2) (param $var$0 i32) (local $var$1 f32) - (block $label$0 - (unreachable) - ) + (unreachable) ) (func $tee2 (type $3) (local $var$0 f32) (if (i32.const 259) - (block $label$0 - (unreachable) - ) + (unreachable) ) ) (func $select (type $3) (unreachable) ) (func $untaken-break-should-have-value (type $1) (result i32) - (block $label$0 (result i32) - (block $label$1 + (block $label$1 (result i32) + (block $label$2 (drop (i32.const 0) ) @@ -45,43 +39,35 @@ ) ) (func $unreachable-in-block-but-code-before (type $0) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (if - (get_local $var$0) - (block $label$1 - (return - (i32.const 127) - ) - ) + (if + (get_local $var$0) + (return + (i32.const 127) ) - (block $label$2 (result i32) - (drop - (i32.const 0) - ) - (return - (i32.const -32) - ) + ) + (block $label$2 (result i32) + (drop + (i32.const 0) + ) + (return + (i32.const -32) ) ) ) (func $br_table_unreachable_to_also_unreachable (type $1) (result i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (unreachable) ) ) ) (func $untaken-br_if (type $1) (result i32) - (block $label$0 (result i32) - (block $label$1 + (block $label$1 (result i32) + (block $label$2 (if (i32.const 0) - (block $label$2 - (unreachable) - ) - (block $label$3 - (unreachable) - ) + (unreachable) + (unreachable) ) ) (unreachable) diff --git a/test/polymorphic_stack.wast.fromBinary.noDebugInfo b/test/polymorphic_stack.wast.fromBinary.noDebugInfo index 3c0af4265..b521d43ed 100644 --- a/test/polymorphic_stack.wast.fromBinary.noDebugInfo +++ b/test/polymorphic_stack.wast.fromBinary.noDebugInfo @@ -6,36 +6,30 @@ (import "env" "table" (table 9 9 anyfunc)) (memory $0 0) (func $0 (type $1) (result i32) - (block $label$0 (result i32) + (block $label$1 (result i32) (unreachable) ) ) (func $1 (type $0) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (unreachable) - ) + (unreachable) ) (func $2 (type $2) (param $var$0 i32) (local $var$1 f32) - (block $label$0 - (unreachable) - ) + (unreachable) ) (func $3 (type $3) (local $var$0 f32) (if (i32.const 259) - (block $label$0 - (unreachable) - ) + (unreachable) ) ) (func $4 (type $3) (unreachable) ) (func $5 (type $1) (result i32) - (block $label$0 (result i32) - (block $label$1 + (block $label$1 (result i32) + (block $label$2 (drop (i32.const 0) ) @@ -45,43 +39,35 @@ ) ) (func $6 (type $0) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (if - (get_local $var$0) - (block $label$1 - (return - (i32.const 127) - ) - ) + (if + (get_local $var$0) + (return + (i32.const 127) ) - (block $label$2 (result i32) - (drop - (i32.const 0) - ) - (return - (i32.const -32) - ) + ) + (block $label$2 (result i32) + (drop + (i32.const 0) + ) + (return + (i32.const -32) ) ) ) (func $7 (type $1) (result i32) - (block $label$0 (result i32) - (block $label$1 (result i32) + (block $label$1 (result i32) + (block $label$2 (result i32) (unreachable) ) ) ) (func $8 (type $1) (result i32) - (block $label$0 (result i32) - (block $label$1 + (block $label$1 (result i32) + (block $label$2 (if (i32.const 0) - (block $label$2 - (unreachable) - ) - (block $label$3 - (unreachable) - ) + (unreachable) + (unreachable) ) ) (unreachable) diff --git a/test/reduce/memory_table.wast.txt b/test/reduce/memory_table.wast.txt index 08918c9f3..005493040 100644 --- a/test/reduce/memory_table.wast.txt +++ b/test/reduce/memory_table.wast.txt @@ -24,14 +24,12 @@ (nop) ) (func $3 (type $0) (result i32) - (block $label$0 (result i32) - (i32.store - (i32.const 0) - (i32.const 65530) - ) - (i32.load - (i32.const 0) - ) + (i32.store + (i32.const 0) + (i32.const 65530) + ) + (i32.load + (i32.const 0) ) ) ) diff --git a/test/reg_switch.wast.fromBinary b/test/reg_switch.wast.fromBinary index e68e8c153..00b78d79c 100644 --- a/test/reg_switch.wast.fromBinary +++ b/test/reg_switch.wast.fromBinary @@ -4,11 +4,9 @@ (func $0 (type $0) (if (i32.const 0) - (block $label$0 - (block $label$1 - (br_table $label$1 - (i32.const 0) - ) + (block $label$2 + (br_table $label$2 + (i32.const 0) ) ) ) diff --git a/test/reg_switch.wast.fromBinary.noDebugInfo b/test/reg_switch.wast.fromBinary.noDebugInfo index e68e8c153..00b78d79c 100644 --- a/test/reg_switch.wast.fromBinary.noDebugInfo +++ b/test/reg_switch.wast.fromBinary.noDebugInfo @@ -4,11 +4,9 @@ (func $0 (type $0) (if (i32.const 0) - (block $label$0 - (block $label$1 - (br_table $label$1 - (i32.const 0) - ) + (block $label$2 + (br_table $label$2 + (i32.const 0) ) ) ) diff --git a/test/signext.wast.fromBinary b/test/signext.wast.fromBinary index ec9b50aa2..920340ccc 100644 --- a/test/signext.wast.fromBinary +++ b/test/signext.wast.fromBinary @@ -4,31 +4,29 @@ (func $signext (type $0) (local $var$0 i32) (local $var$1 i64) - (block $label$0 - (drop - (i32.extend8_s - (get_local $var$0) - ) + (drop + (i32.extend8_s + (get_local $var$0) ) - (drop - (i32.extend16_s - (get_local $var$0) - ) + ) + (drop + (i32.extend16_s + (get_local $var$0) ) - (drop - (i64.extend8_s - (get_local $var$1) - ) + ) + (drop + (i64.extend8_s + (get_local $var$1) ) - (drop - (i64.extend16_s - (get_local $var$1) - ) + ) + (drop + (i64.extend16_s + (get_local $var$1) ) - (drop - (i64.extend32_s - (get_local $var$1) - ) + ) + (drop + (i64.extend32_s + (get_local $var$1) ) ) ) diff --git a/test/signext.wast.fromBinary.noDebugInfo b/test/signext.wast.fromBinary.noDebugInfo index 04ada421c..770b19baf 100644 --- a/test/signext.wast.fromBinary.noDebugInfo +++ b/test/signext.wast.fromBinary.noDebugInfo @@ -4,31 +4,29 @@ (func $0 (type $0) (local $var$0 i32) (local $var$1 i64) - (block $label$0 - (drop - (i32.extend8_s - (get_local $var$0) - ) + (drop + (i32.extend8_s + (get_local $var$0) ) - (drop - (i32.extend16_s - (get_local $var$0) - ) + ) + (drop + (i32.extend16_s + (get_local $var$0) ) - (drop - (i64.extend8_s - (get_local $var$1) - ) + ) + (drop + (i64.extend8_s + (get_local $var$1) ) - (drop - (i64.extend16_s - (get_local $var$1) - ) + ) + (drop + (i64.extend16_s + (get_local $var$1) ) - (drop - (i64.extend32_s - (get_local $var$1) - ) + ) + (drop + (i64.extend32_s + (get_local $var$1) ) ) ) diff --git a/test/unit.wast.fromBinary b/test/unit.wast.fromBinary index 817cc3c7a..f4e9f88b9 100644 --- a/test/unit.wast.fromBinary +++ b/test/unit.wast.fromBinary @@ -19,27 +19,25 @@ (export "big_negative" (func $big_negative)) (func $big_negative (type $1) (local $var$0 f64) - (block $label$0 - (set_local $var$0 - (f64.const -2147483648) - ) - (set_local $var$0 - (f64.const -2147483648) - ) - (set_local $var$0 - (f64.const -21474836480) - ) - (set_local $var$0 - (f64.const 0.039625) - ) - (set_local $var$0 - (f64.const -0.039625) - ) + (set_local $var$0 + (f64.const -2147483648) + ) + (set_local $var$0 + (f64.const -2147483648) + ) + (set_local $var$0 + (f64.const -21474836480) + ) + (set_local $var$0 + (f64.const 0.039625) + ) + (set_local $var$0 + (f64.const -0.039625) ) ) (func $importedDoubles (type $4) (result f64) (local $var$0 f64) - (block $label$0 (result f64) + (block $label$1 (result f64) (set_local $var$0 (f64.add (f64.add @@ -71,10 +69,8 @@ ) (i32.const 0) ) - (block $label$1 - (br $label$0 - (f64.const -3.4) - ) + (br $label$1 + (f64.const -3.4) ) ) (if @@ -84,10 +80,8 @@ ) (f64.const 0) ) - (block $label$2 - (br $label$0 - (f64.const 5.6) - ) + (br $label$1 + (f64.const 5.6) ) ) (f64.const 1.2) @@ -97,16 +91,14 @@ (local $var$2 i32) (local $var$3 f64) (local $var$4 f64) - (block $label$0 (result f64) + (block $label$1 (result f64) (if (f64.gt (get_local $var$0) (f64.const 0) ) - (block $label$1 - (br $label$0 - (f64.const 1.2) - ) + (br $label$1 + (f64.const 1.2) ) ) (if @@ -114,10 +106,8 @@ (get_local $var$4) (f64.const 0) ) - (block $label$2 - (br $label$0 - (f64.const -3.4) - ) + (br $label$1 + (f64.const -3.4) ) ) (if @@ -125,10 +115,8 @@ (get_local $var$2) (i32.const 0) ) - (block $label$3 - (br $label$0 - (f64.const 5.6) - ) + (br $label$1 + (f64.const 5.6) ) ) (if @@ -136,10 +124,8 @@ (get_local $var$0) (get_local $var$1) ) - (block $label$4 - (br $label$0 - (get_local $var$0) - ) + (br $label$1 + (get_local $var$0) ) ) (get_local $var$1) @@ -166,23 +152,21 @@ (func $conversions (type $1) (local $var$0 i32) (local $var$1 f64) - (block $label$0 - (set_local $var$0 - (call $import$1 - (get_local $var$1) - ) + (set_local $var$0 + (call $import$1 + (get_local $var$1) ) - (set_local $var$1 - (f64.convert_s/i32 - (get_local $var$0) - ) + ) + (set_local $var$1 + (f64.convert_s/i32 + (get_local $var$0) ) - (set_local $var$1 - (f64.convert_u/i32 - (i32.shr_u - (get_local $var$0) - (i32.const 0) - ) + ) + (set_local $var$1 + (f64.convert_u/i32 + (i32.shr_u + (get_local $var$0) + (i32.const 0) ) ) ) @@ -191,13 +175,13 @@ (local $var$0 f64) (set_local $var$0 (f64.sub - (block $label$0 (result f64) + (block $label$1 (result f64) (drop (f64.const 0.1) ) (f64.const 5.1) ) - (block $label$1 (result f64) + (block $label$2 (result f64) (drop (f64.const 3.2) ) @@ -207,75 +191,75 @@ ) ) (func $switcher (type $6) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (block $label$1 - (block $label$2 - (block $label$3 - (block $label$4 - (br_table $label$4 $label$3 $label$2 + (block $label$1 (result i32) + (block $label$2 + (block $label$3 + (block $label$4 + (block $label$5 + (br_table $label$5 $label$4 $label$3 (i32.sub (get_local $var$0) (i32.const 1) ) ) ) - (br $label$0 + (br $label$1 (i32.const 1) ) ) - (br $label$0 + (br $label$1 (i32.const 2) ) ) (nop) ) - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (br_table $label$7 $label$6 $label$6 $label$6 $label$6 $label$6 $label$6 $label$8 $label$6 + (block $label$6 + (block $label$7 + (block $label$8 + (block $label$9 + (br_table $label$8 $label$7 $label$7 $label$7 $label$7 $label$7 $label$7 $label$9 $label$7 (i32.sub (get_local $var$0) (i32.const 5) ) ) ) - (br $label$0 + (br $label$1 (i32.const 121) ) ) - (br $label$0 + (br $label$1 (i32.const 51) ) ) (nop) ) - (block $label$9 - (block $label$10 - (block $label$11 - (block $label$12 - (block $label$13 - (block $label$14 - (br_table $label$11 $label$10 $label$10 $label$12 $label$10 $label$10 $label$10 $label$10 $label$13 $label$10 $label$14 $label$10 + (block $label$10 + (block $label$11 + (block $label$12 + (block $label$13 + (block $label$14 + (block $label$15 + (br_table $label$12 $label$11 $label$11 $label$13 $label$11 $label$11 $label$11 $label$11 $label$14 $label$11 $label$15 $label$11 (i32.sub (get_local $var$0) (i32.const 2) ) ) ) - (br $label$9) + (br $label$10) ) - (br $label$9) + (br $label$10) ) - (block $label$15 - (loop $label$16 - (br $label$15) + (block $label$16 + (loop $label$17 + (br $label$16) ) ) ) - (block $label$17 - (loop $label$18 - (br $label$9) + (block $label$18 + (loop $label$19 + (br $label$10) ) ) ) @@ -285,8 +269,8 @@ ) ) (func $blocker (type $1) - (block $label$0 - (br $label$0) + (block $label$1 + (br $label$1) ) ) (func $frem (type $4) (result f64) @@ -297,44 +281,40 @@ ) (func $big_uint_div_u (type $5) (result i32) (local $var$0 i32) - (block $label$0 (result i32) - (set_local $var$0 - (i32.and - (i32.div_u - (i32.const -1) - (i32.const 2) - ) + (set_local $var$0 + (i32.and + (i32.div_u (i32.const -1) + (i32.const 2) ) + (i32.const -1) ) - (get_local $var$0) ) + (get_local $var$0) ) (func $fr (type $0) (param $var$0 f32) (local $var$1 f32) (local $var$2 f64) - (block $label$0 - (drop - (f32.demote/f64 - (get_local $var$2) - ) - ) - (drop - (get_local $var$1) - ) - (drop - (f32.const 5) - ) - (drop - (f32.const 0) - ) - (drop - (f32.const 5) - ) - (drop - (f32.const 0) + (drop + (f32.demote/f64 + (get_local $var$2) ) ) + (drop + (get_local $var$1) + ) + (drop + (f32.const 5) + ) + (drop + (f32.const 0) + ) + (drop + (f32.const 5) + ) + (drop + (f32.const 0) + ) ) (func $negZero (type $4) (result f64) (f64.const -0) @@ -344,54 +324,50 @@ (local $var$1 i32) (local $var$2 f32) (local $var$3 f64) - (block $label$0 - (set_local $var$0 - (block $label$1 (result i32) - (set_local $var$1 + (set_local $var$0 + (block $label$1 (result i32) + (set_local $var$1 + (i32.const 0) + ) + (select + (i32.sub (i32.const 0) + (get_local $var$1) ) - (select - (i32.sub - (i32.const 0) - (get_local $var$1) - ) + (get_local $var$1) + (i32.lt_s (get_local $var$1) - (i32.lt_s - (get_local $var$1) - (i32.const 0) - ) + (i32.const 0) ) ) ) - (set_local $var$3 - (f64.abs - (f64.const 0) - ) + ) + (set_local $var$3 + (f64.abs + (f64.const 0) ) - (set_local $var$2 - (f32.abs - (f32.const 0) - ) + ) + (set_local $var$2 + (f32.abs + (f32.const 0) ) ) ) (func $neg (type $1) (local $var$0 f32) - (block $label$0 - (set_local $var$0 - (f32.neg - (get_local $var$0) - ) - ) - (call_indirect $0 + (set_local $var$0 + (f32.neg (get_local $var$0) - (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) - (i32.const 8) + ) + ) + (call_indirect $0 + (get_local $var$0) + (i32.add + (i32.and + (i32.const 1) + (i32.const 7) ) + (i32.const 8) ) ) ) @@ -426,18 +402,16 @@ (nop) ) (func $block_and_after (type $5) (result i32) - (block $label$0 (result i32) - (block $label$1 - (drop - (i32.const 1) - ) - (br $label$1) + (block $label$1 + (drop + (i32.const 1) ) - (i32.const 0) + (br $label$1) ) + (i32.const 0) ) (func $loop-roundtrip (type $7) (param $var$0 f64) (result f64) - (loop $label$0 (result f64) + (loop $label$1 (result f64) (drop (get_local $var$0) ) @@ -459,7 +433,7 @@ ) ) (func $unreachable-block (type $5) (result i32) - (block $label$0 + (block $label$1 (drop (i32.const 1) ) @@ -469,72 +443,58 @@ ) ) (func $unreachable-block-toplevel (type $5) (result i32) - (block $label$0 - (drop - (i32.const 1) - ) - (return - (i32.const 2) - ) + (drop + (i32.const 1) + ) + (return + (i32.const 2) ) ) (func $unreachable-block0 (type $5) (result i32) - (block $label$0 + (block $label$1 (return (i32.const 2) ) ) ) (func $unreachable-block0-toplevel (type $5) (result i32) - (block $label$0 - (return - (i32.const 2) - ) + (return + (i32.const 2) ) ) (func $unreachable-block-with-br (type $5) (result i32) - (block $label$0 (result i32) - (block $label$1 - (drop - (i32.const 1) - ) - (br $label$1) + (block $label$1 + (drop + (i32.const 1) ) - (i32.const 1) + (br $label$1) ) + (i32.const 1) ) (func $unreachable-if (type $5) (result i32) (if (i32.const 3) - (block $label$0 - (return - (i32.const 2) - ) + (return + (i32.const 2) ) - (block $label$1 - (return - (i32.const 1) - ) + (return + (i32.const 1) ) ) ) (func $unreachable-if-toplevel (type $5) (result i32) (if (i32.const 3) - (block $label$0 - (return - (i32.const 2) - ) + (return + (i32.const 2) ) - (block $label$1 - (return - (i32.const 1) - ) + (return + (i32.const 1) ) ) ) (func $unreachable-loop (type $5) (result i32) - (loop $label$0 + (loop $label$1 (nop) (return (i32.const 1) @@ -542,14 +502,14 @@ ) ) (func $unreachable-loop0 (type $5) (result i32) - (loop $label$0 + (loop $label$1 (return (i32.const 1) ) ) ) (func $unreachable-loop-toplevel (type $5) (result i32) - (loop $label$0 + (loop $label$1 (nop) (return (i32.const 1) @@ -557,26 +517,20 @@ ) ) (func $unreachable-loop0-toplevel (type $5) (result i32) - (loop $label$0 + (loop $label$1 (return (i32.const 1) ) ) ) (func $unreachable-ifs (type $1) - (block $label$0 - (unreachable) - ) + (unreachable) ) (func $unreachable-if-arm (type $1) (if (i32.const 1) - (block $label$0 - (nop) - ) - (block $label$1 - (unreachable) - ) + (nop) + (unreachable) ) ) ) diff --git a/test/unit.wast.fromBinary.noDebugInfo b/test/unit.wast.fromBinary.noDebugInfo index 46b86e86b..2a07740b4 100644 --- a/test/unit.wast.fromBinary.noDebugInfo +++ b/test/unit.wast.fromBinary.noDebugInfo @@ -19,27 +19,25 @@ (export "big_negative" (func $0)) (func $0 (type $1) (local $var$0 f64) - (block $label$0 - (set_local $var$0 - (f64.const -2147483648) - ) - (set_local $var$0 - (f64.const -2147483648) - ) - (set_local $var$0 - (f64.const -21474836480) - ) - (set_local $var$0 - (f64.const 0.039625) - ) - (set_local $var$0 - (f64.const -0.039625) - ) + (set_local $var$0 + (f64.const -2147483648) + ) + (set_local $var$0 + (f64.const -2147483648) + ) + (set_local $var$0 + (f64.const -21474836480) + ) + (set_local $var$0 + (f64.const 0.039625) + ) + (set_local $var$0 + (f64.const -0.039625) ) ) (func $1 (type $4) (result f64) (local $var$0 f64) - (block $label$0 (result f64) + (block $label$1 (result f64) (set_local $var$0 (f64.add (f64.add @@ -71,10 +69,8 @@ ) (i32.const 0) ) - (block $label$1 - (br $label$0 - (f64.const -3.4) - ) + (br $label$1 + (f64.const -3.4) ) ) (if @@ -84,10 +80,8 @@ ) (f64.const 0) ) - (block $label$2 - (br $label$0 - (f64.const 5.6) - ) + (br $label$1 + (f64.const 5.6) ) ) (f64.const 1.2) @@ -97,16 +91,14 @@ (local $var$2 i32) (local $var$3 f64) (local $var$4 f64) - (block $label$0 (result f64) + (block $label$1 (result f64) (if (f64.gt (get_local $var$0) (f64.const 0) ) - (block $label$1 - (br $label$0 - (f64.const 1.2) - ) + (br $label$1 + (f64.const 1.2) ) ) (if @@ -114,10 +106,8 @@ (get_local $var$4) (f64.const 0) ) - (block $label$2 - (br $label$0 - (f64.const -3.4) - ) + (br $label$1 + (f64.const -3.4) ) ) (if @@ -125,10 +115,8 @@ (get_local $var$2) (i32.const 0) ) - (block $label$3 - (br $label$0 - (f64.const 5.6) - ) + (br $label$1 + (f64.const 5.6) ) ) (if @@ -136,10 +124,8 @@ (get_local $var$0) (get_local $var$1) ) - (block $label$4 - (br $label$0 - (get_local $var$0) - ) + (br $label$1 + (get_local $var$0) ) ) (get_local $var$1) @@ -166,23 +152,21 @@ (func $5 (type $1) (local $var$0 i32) (local $var$1 f64) - (block $label$0 - (set_local $var$0 - (call $import$1 - (get_local $var$1) - ) + (set_local $var$0 + (call $import$1 + (get_local $var$1) ) - (set_local $var$1 - (f64.convert_s/i32 - (get_local $var$0) - ) + ) + (set_local $var$1 + (f64.convert_s/i32 + (get_local $var$0) ) - (set_local $var$1 - (f64.convert_u/i32 - (i32.shr_u - (get_local $var$0) - (i32.const 0) - ) + ) + (set_local $var$1 + (f64.convert_u/i32 + (i32.shr_u + (get_local $var$0) + (i32.const 0) ) ) ) @@ -191,13 +175,13 @@ (local $var$0 f64) (set_local $var$0 (f64.sub - (block $label$0 (result f64) + (block $label$1 (result f64) (drop (f64.const 0.1) ) (f64.const 5.1) ) - (block $label$1 (result f64) + (block $label$2 (result f64) (drop (f64.const 3.2) ) @@ -207,75 +191,75 @@ ) ) (func $7 (type $6) (param $var$0 i32) (result i32) - (block $label$0 (result i32) - (block $label$1 - (block $label$2 - (block $label$3 - (block $label$4 - (br_table $label$4 $label$3 $label$2 + (block $label$1 (result i32) + (block $label$2 + (block $label$3 + (block $label$4 + (block $label$5 + (br_table $label$5 $label$4 $label$3 (i32.sub (get_local $var$0) (i32.const 1) ) ) ) - (br $label$0 + (br $label$1 (i32.const 1) ) ) - (br $label$0 + (br $label$1 (i32.const 2) ) ) (nop) ) - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (br_table $label$7 $label$6 $label$6 $label$6 $label$6 $label$6 $label$6 $label$8 $label$6 + (block $label$6 + (block $label$7 + (block $label$8 + (block $label$9 + (br_table $label$8 $label$7 $label$7 $label$7 $label$7 $label$7 $label$7 $label$9 $label$7 (i32.sub (get_local $var$0) (i32.const 5) ) ) ) - (br $label$0 + (br $label$1 (i32.const 121) ) ) - (br $label$0 + (br $label$1 (i32.const 51) ) ) (nop) ) - (block $label$9 - (block $label$10 - (block $label$11 - (block $label$12 - (block $label$13 - (block $label$14 - (br_table $label$11 $label$10 $label$10 $label$12 $label$10 $label$10 $label$10 $label$10 $label$13 $label$10 $label$14 $label$10 + (block $label$10 + (block $label$11 + (block $label$12 + (block $label$13 + (block $label$14 + (block $label$15 + (br_table $label$12 $label$11 $label$11 $label$13 $label$11 $label$11 $label$11 $label$11 $label$14 $label$11 $label$15 $label$11 (i32.sub (get_local $var$0) (i32.const 2) ) ) ) - (br $label$9) + (br $label$10) ) - (br $label$9) + (br $label$10) ) - (block $label$15 - (loop $label$16 - (br $label$15) + (block $label$16 + (loop $label$17 + (br $label$16) ) ) ) - (block $label$17 - (loop $label$18 - (br $label$9) + (block $label$18 + (loop $label$19 + (br $label$10) ) ) ) @@ -285,8 +269,8 @@ ) ) (func $8 (type $1) - (block $label$0 - (br $label$0) + (block $label$1 + (br $label$1) ) ) (func $9 (type $4) (result f64) @@ -297,44 +281,40 @@ ) (func $10 (type $5) (result i32) (local $var$0 i32) - (block $label$0 (result i32) - (set_local $var$0 - (i32.and - (i32.div_u - (i32.const -1) - (i32.const 2) - ) + (set_local $var$0 + (i32.and + (i32.div_u (i32.const -1) + (i32.const 2) ) + (i32.const -1) ) - (get_local $var$0) ) + (get_local $var$0) ) (func $11 (type $0) (param $var$0 f32) (local $var$1 f32) (local $var$2 f64) - (block $label$0 - (drop - (f32.demote/f64 - (get_local $var$2) - ) - ) - (drop - (get_local $var$1) - ) - (drop - (f32.const 5) - ) - (drop - (f32.const 0) - ) - (drop - (f32.const 5) - ) - (drop - (f32.const 0) + (drop + (f32.demote/f64 + (get_local $var$2) ) ) + (drop + (get_local $var$1) + ) + (drop + (f32.const 5) + ) + (drop + (f32.const 0) + ) + (drop + (f32.const 5) + ) + (drop + (f32.const 0) + ) ) (func $12 (type $4) (result f64) (f64.const -0) @@ -344,54 +324,50 @@ (local $var$1 i32) (local $var$2 f32) (local $var$3 f64) - (block $label$0 - (set_local $var$0 - (block $label$1 (result i32) - (set_local $var$1 + (set_local $var$0 + (block $label$1 (result i32) + (set_local $var$1 + (i32.const 0) + ) + (select + (i32.sub (i32.const 0) + (get_local $var$1) ) - (select - (i32.sub - (i32.const 0) - (get_local $var$1) - ) + (get_local $var$1) + (i32.lt_s (get_local $var$1) - (i32.lt_s - (get_local $var$1) - (i32.const 0) - ) + (i32.const 0) ) ) ) - (set_local $var$3 - (f64.abs - (f64.const 0) - ) + ) + (set_local $var$3 + (f64.abs + (f64.const 0) ) - (set_local $var$2 - (f32.abs - (f32.const 0) - ) + ) + (set_local $var$2 + (f32.abs + (f32.const 0) ) ) ) (func $14 (type $1) (local $var$0 f32) - (block $label$0 - (set_local $var$0 - (f32.neg - (get_local $var$0) - ) - ) - (call_indirect $0 + (set_local $var$0 + (f32.neg (get_local $var$0) - (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) - (i32.const 8) + ) + ) + (call_indirect $0 + (get_local $var$0) + (i32.add + (i32.and + (i32.const 1) + (i32.const 7) ) + (i32.const 8) ) ) ) @@ -426,18 +402,16 @@ (nop) ) (func $19 (type $5) (result i32) - (block $label$0 (result i32) - (block $label$1 - (drop - (i32.const 1) - ) - (br $label$1) + (block $label$1 + (drop + (i32.const 1) ) - (i32.const 0) + (br $label$1) ) + (i32.const 0) ) (func $20 (type $7) (param $var$0 f64) (result f64) - (loop $label$0 (result f64) + (loop $label$1 (result f64) (drop (get_local $var$0) ) @@ -459,7 +433,7 @@ ) ) (func $24 (type $5) (result i32) - (block $label$0 + (block $label$1 (drop (i32.const 1) ) @@ -469,72 +443,58 @@ ) ) (func $25 (type $5) (result i32) - (block $label$0 - (drop - (i32.const 1) - ) - (return - (i32.const 2) - ) + (drop + (i32.const 1) + ) + (return + (i32.const 2) ) ) (func $26 (type $5) (result i32) - (block $label$0 + (block $label$1 (return (i32.const 2) ) ) ) (func $27 (type $5) (result i32) - (block $label$0 - (return - (i32.const 2) - ) + (return + (i32.const 2) ) ) (func $28 (type $5) (result i32) - (block $label$0 (result i32) - (block $label$1 - (drop - (i32.const 1) - ) - (br $label$1) + (block $label$1 + (drop + (i32.const 1) ) - (i32.const 1) + (br $label$1) ) + (i32.const 1) ) (func $29 (type $5) (result i32) (if (i32.const 3) - (block $label$0 - (return - (i32.const 2) - ) + (return + (i32.const 2) ) - (block $label$1 - (return - (i32.const 1) - ) + (return + (i32.const 1) ) ) ) (func $30 (type $5) (result i32) (if (i32.const 3) - (block $label$0 - (return - (i32.const 2) - ) + (return + (i32.const 2) ) - (block $label$1 - (return - (i32.const 1) - ) + (return + (i32.const 1) ) ) ) (func $31 (type $5) (result i32) - (loop $label$0 + (loop $label$1 (nop) (return (i32.const 1) @@ -542,14 +502,14 @@ ) ) (func $32 (type $5) (result i32) - (loop $label$0 + (loop $label$1 (return (i32.const 1) ) ) ) (func $33 (type $5) (result i32) - (loop $label$0 + (loop $label$1 (nop) (return (i32.const 1) @@ -557,26 +517,20 @@ ) ) (func $34 (type $5) (result i32) - (loop $label$0 + (loop $label$1 (return (i32.const 1) ) ) ) (func $35 (type $1) - (block $label$0 - (unreachable) - ) + (unreachable) ) (func $36 (type $1) (if (i32.const 1) - (block $label$0 - (nop) - ) - (block $label$1 - (unreachable) - ) + (nop) + (unreachable) ) ) ) diff --git a/test/unreachable-code.wast.fromBinary b/test/unreachable-code.wast.fromBinary index d27da2201..e9489293e 100644 --- a/test/unreachable-code.wast.fromBinary +++ b/test/unreachable-code.wast.fromBinary @@ -4,117 +4,79 @@ (func $a (type $0) (if (i32.const 1) - (block $label$0 - (unreachable) - ) + (unreachable) ) ) (func $b (type $0) (if (i32.const 1) - (block $label$0 - (unreachable) - ) - (block $label$1 - (unreachable) - ) + (unreachable) + (unreachable) ) ) (func $a-block (type $0) - (block $label$0 - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - ) + (if + (i32.const 1) + (unreachable) ) ) (func $b-block (type $0) - (block $label$0 - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - (block $label$2 - (unreachable) - ) - ) + (if + (i32.const 1) + (unreachable) + (unreachable) ) ) (func $a-prepost (type $0) - (block $label$0 - (nop) - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - ) - (nop) + (nop) + (if + (i32.const 1) + (unreachable) ) + (nop) ) (func $b-prepost (type $0) - (block $label$0 - (nop) - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - (block $label$2 - (unreachable) - ) - ) + (nop) + (if + (i32.const 1) + (unreachable) + (unreachable) ) ) (func $a-block-prepost (type $0) - (block $label$0 - (nop) - (block $label$1 - (if - (i32.const 1) - (block $label$2 - (unreachable) - ) - ) + (nop) + (block $label$1 + (if + (i32.const 1) + (unreachable) ) - (nop) ) + (nop) ) (func $b-block-prepost (type $0) - (block $label$0 - (nop) - (block $label$1 - (if - (i32.const 1) - (block $label$2 - (unreachable) - ) - (block $label$3 - (unreachable) - ) - ) + (nop) + (block $label$1 + (if + (i32.const 1) + (unreachable) + (unreachable) ) ) ) (func $recurse (type $0) - (block $label$0 - (nop) - (block $label$1 - (nop) - (br $label$1) - ) + (nop) + (block $label$1 (nop) + (br $label$1) ) + (nop) ) (func $recurse-b (type $0) - (block $label$0 + (block $label$1 (nop) - (block $label$1 + (block $label$2 (nop) - (br $label$0) + (br $label$1) ) ) ) diff --git a/test/unreachable-code.wast.fromBinary.noDebugInfo b/test/unreachable-code.wast.fromBinary.noDebugInfo index 288a24f4a..f6c06972e 100644 --- a/test/unreachable-code.wast.fromBinary.noDebugInfo +++ b/test/unreachable-code.wast.fromBinary.noDebugInfo @@ -4,117 +4,79 @@ (func $0 (type $0) (if (i32.const 1) - (block $label$0 - (unreachable) - ) + (unreachable) ) ) (func $1 (type $0) (if (i32.const 1) - (block $label$0 - (unreachable) - ) - (block $label$1 - (unreachable) - ) + (unreachable) + (unreachable) ) ) (func $2 (type $0) - (block $label$0 - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - ) + (if + (i32.const 1) + (unreachable) ) ) (func $3 (type $0) - (block $label$0 - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - (block $label$2 - (unreachable) - ) - ) + (if + (i32.const 1) + (unreachable) + (unreachable) ) ) (func $4 (type $0) - (block $label$0 - (nop) - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - ) - (nop) + (nop) + (if + (i32.const 1) + (unreachable) ) + (nop) ) (func $5 (type $0) - (block $label$0 - (nop) - (if - (i32.const 1) - (block $label$1 - (unreachable) - ) - (block $label$2 - (unreachable) - ) - ) + (nop) + (if + (i32.const 1) + (unreachable) + (unreachable) ) ) (func $6 (type $0) - (block $label$0 - (nop) - (block $label$1 - (if - (i32.const 1) - (block $label$2 - (unreachable) - ) - ) + (nop) + (block $label$1 + (if + (i32.const 1) + (unreachable) ) - (nop) ) + (nop) ) (func $7 (type $0) - (block $label$0 - (nop) - (block $label$1 - (if - (i32.const 1) - (block $label$2 - (unreachable) - ) - (block $label$3 - (unreachable) - ) - ) + (nop) + (block $label$1 + (if + (i32.const 1) + (unreachable) + (unreachable) ) ) ) (func $8 (type $0) - (block $label$0 - (nop) - (block $label$1 - (nop) - (br $label$1) - ) + (nop) + (block $label$1 (nop) + (br $label$1) ) + (nop) ) (func $9 (type $0) - (block $label$0 + (block $label$1 (nop) - (block $label$1 + (block $label$2 (nop) - (br $label$0) + (br $label$1) ) ) ) diff --git a/test/unreachable-pops.wasm.fromBinary b/test/unreachable-pops.wasm.fromBinary index 4e14995cf..3f3c51b13 100644 --- a/test/unreachable-pops.wasm.fromBinary +++ b/test/unreachable-pops.wasm.fromBinary @@ -2,7 +2,7 @@ (type $0 (func (result i32))) (memory $0 0) (func $0 (type $0) (result i32) - (block $label$0 (result i32) + (block $label$1 (result i32) (unreachable) ) ) diff --git a/test/untaken-br_if.wast.fromBinary b/test/untaken-br_if.wast.fromBinary index fc2e7f215..7a6a4a714 100644 --- a/test/untaken-br_if.wast.fromBinary +++ b/test/untaken-br_if.wast.fromBinary @@ -4,16 +4,12 @@ (func $binaryify-untaken-br_if (type $0) (result f32) (if (result f32) (i32.const 1) - (block $label$0 (result f32) - (unreachable) - ) - (block $label$1 (result f32) - (block $label$2 (result f32) - (drop - (f32.const 1) - ) - (unreachable) + (unreachable) + (block $label$3 (result f32) + (drop + (f32.const 1) ) + (unreachable) ) ) ) diff --git a/test/untaken-br_if.wast.fromBinary.noDebugInfo b/test/untaken-br_if.wast.fromBinary.noDebugInfo index b15b0f0b4..94da1d4e7 100644 --- a/test/untaken-br_if.wast.fromBinary.noDebugInfo +++ b/test/untaken-br_if.wast.fromBinary.noDebugInfo @@ -4,16 +4,12 @@ (func $0 (type $0) (result f32) (if (result f32) (i32.const 1) - (block $label$0 (result f32) - (unreachable) - ) - (block $label$1 (result f32) - (block $label$2 (result f32) - (drop - (f32.const 1) - ) - (unreachable) + (unreachable) + (block $label$3 (result f32) + (drop + (f32.const 1) ) + (unreachable) ) ) ) |