From 2ea673dc23c00030985c10301daf5a72c23f9889 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Fri, 23 Sep 2016 00:13:02 +0000 Subject: [PATCH] fixed some comments --- stix/lib/comp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stix/lib/comp.c b/stix/lib/comp.c index 4d3b334..5cc51a3 100644 --- a/stix/lib/comp.c +++ b/stix/lib/comp.c @@ -3081,7 +3081,7 @@ static int compile_block_expression (stix_t* stix) } /* store the accumulated number of temporaries for the current block. - * block depth is not rasised as it's not entering a new block but + * block depth is not raised as it's not entering a new block but * updating the temporaries count for the current block. */ if (store_tmpr_count_for_block (stix, stix->c->mth.tmpr_count) <= -1) return -1; @@ -3130,6 +3130,7 @@ static int compile_block_expression (stix_t* stix) if (emit_byte_instruction(stix, BCODE_RETURN_FROM_BLOCK) <= -1) return -1; + /* STIX_BCODE_LONG_PARAM_SIZE + 1 => size of the long JUMP_FORWARD instruction */ block_code_size = stix->c->mth.code.len - jump_inst_pos - (STIX_BCODE_LONG_PARAM_SIZE + 1); if (block_code_size > MAX_CODE_JUMP * 2) { @@ -3142,6 +3143,8 @@ static int compile_block_expression (stix_t* stix) if (block_code_size > MAX_CODE_JUMP) { + /* switch to JUMP2 instruction to allow a bigger jump offset. + * up to twice MAX_CODE_JUMP only */ stix->c->mth.code.ptr[jump_inst_pos] = BCODE_JUMP2_FORWARD; jump_offset = block_code_size - MAX_CODE_JUMP; }