diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-22 21:29:14 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-07 09:55:06 -0700 |
commit | 31fca059e62a10b0f1d3de3a3f517721a41a7595 (patch) | |
tree | 931b37495f61d3cc7e37a90e7665699d99edc9d3 /src/asm2wasm.h | |
parent | c9b4cd0716ddd1b0def1cc7b26aa94355ab9ef6f (diff) | |
download | binaryen-31fca059e62a10b0f1d3de3a3f517721a41a7595.tar.gz binaryen-31fca059e62a10b0f1d3de3a3f517721a41a7595.tar.bz2 binaryen-31fca059e62a10b0f1d3de3a3f517721a41a7595.zip |
finalize loops in asm2wasm, which is now necessary as they may need to be dropped
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r-- | src/asm2wasm.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index abe6e2f25..d11fb3cfb 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -1492,7 +1492,9 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { auto continuer = allocator.alloc<Break>(); continuer->name = ret->name; block->list.push_back(continuer); + block->finalize(); ret->body = block; + ret->finalize(); continueStack.pop_back(); breakStack.pop_back(); return ret; @@ -1528,6 +1530,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { auto loop = allocator.alloc<Loop>(); loop->body = child; loop->name = more; + loop->finalize(); return builder.blockifyWithName(loop, stop); } } @@ -1553,6 +1556,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { continuer->condition = process(ast[1]); Block *block = builder.blockifyWithName(loop->body, out, continuer); loop->body = block; + loop->finalize(); return loop; } else if (what == FOR) { Ref finit = ast[1], @@ -1588,6 +1592,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { continuer->name = ret->name; Block* block = builder.blockifyWithName(ret->body, out, continuer); ret->body = block; + ret->finalize(); continueStack.pop_back(); breakStack.pop_back(); Block *outer = allocator.alloc<Block>(); |