From: Brendan Hansen Date: Thu, 30 Jul 2020 22:58:47 +0000 (-0500) Subject: deferred statement bugfixes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=f3d4d0cdf4ea3e62f1c625d91b8199af1a3d8172;p=onyx.git deferred statement bugfixes --- diff --git a/onyx b/onyx index 1950f6fb..3cab3d48 100755 Binary files a/onyx and b/onyx differ diff --git a/src/onyxwasm.c b/src/onyxwasm.c index 2b2c8e85..c1d963aa 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -549,11 +549,11 @@ COMPILE_FUNC(while, AstWhile* while_node) { compile_statement(mod, &code, while_node->stmt); } + compile_deferred_stmts(mod, &code, (AstNode *) while_node); + bh_arr_pop(mod->structured_jump_target); bh_arr_pop(mod->structured_jump_target); - compile_deferred_stmts(mod, &code, (AstNode *) while_node); - WID(WI_JUMP, 0x00); WI(WI_LOOP_END); @@ -618,6 +618,8 @@ COMPILE_FUNC(defer, AstDefer* defer) { } COMPILE_FUNC(deferred_stmts, AstNode* node) { + if (bh_arr_length(mod->deferred_stmts) == 0) return; + bh_arr(WasmInstruction) code = *pcode; u64 depth = bh_arr_length(mod->structured_jump_target);