got rid of short jump instructions(jump offset encoded in the last 2 bits of the instruction)

added jump_backward_if_false/true instruction and the like
This commit is contained in:
hyunghwan.chung 2019-08-02 09:23:08 +00:00
parent 3b6e59d98c
commit bd3fc07aaa
5 changed files with 314 additions and 336 deletions

View File

@ -2522,36 +2522,14 @@ static int emit_single_param_instruction (moo_t* moo, int cmd, moo_oow_t param_1
goto write_long; goto write_long;
} }
case BCODE_JUMP_FORWARD_0: case BCODE_JUMP_BACKWARD:
case BCODE_JUMP_BACKWARD_0: case BCODE_JMPOP_BACKWARD_IF_FALSE:
case BCODE_JUMPOP_BACKWARD_IF_FALSE_0: case BCODE_JMPOP_BACKWARD_IF_TRUE:
case BCODE_JUMPOP_BACKWARD_IF_TRUE_0: case BCODE_JUMP_FORWARD:
if (param_1 < 4)
{
/* low 2 bits to hold the parameter */
bc = (moo_oob_t)(cmd & 0xFC) | (moo_oob_t)param_1;
goto write_short;
}
else
{
/* convert the instruction to a long version (_X) */
bc = cmd | 0x80;
if (param_1 > MAX_CODE_JUMP)
{
cmd = cmd + 1; /* convert to a JUMP2 instruction */
param_1 = param_1 - MAX_CODE_JUMP;
}
goto write_long;
}
case BCODE_JUMP_BACKWARD_X:
case BCODE_JUMPOP_BACKWARD_IF_FALSE_X:
case BCODE_JUMPOP_BACKWARD_IF_TRUE_X:
case BCODE_JUMP_FORWARD_X:
case BCODE_JUMP_FORWARD_IF_TRUE: case BCODE_JUMP_FORWARD_IF_TRUE:
case BCODE_JUMP_FORWARD_IF_FALSE: case BCODE_JUMP_FORWARD_IF_FALSE:
case BCODE_JUMPOP_FORWARD_IF_FALSE: case BCODE_JMPOP_FORWARD_IF_FALSE:
case BCODE_JUMPOP_FORWARD_IF_TRUE: case BCODE_JMPOP_FORWARD_IF_TRUE:
if (param_1 > MAX_CODE_JUMP) if (param_1 > MAX_CODE_JUMP)
{ {
cmd = cmd + 1; /* convert to a JUMP2 instruction */ cmd = cmd + 1; /* convert to a JUMP2 instruction */
@ -2562,10 +2540,10 @@ static int emit_single_param_instruction (moo_t* moo, int cmd, moo_oow_t param_1
case BCODE_JUMP2_FORWARD_IF_TRUE: case BCODE_JUMP2_FORWARD_IF_TRUE:
case BCODE_JUMP2_FORWARD_IF_FALSE: case BCODE_JUMP2_FORWARD_IF_FALSE:
case BCODE_JUMP2_BACKWARD: case BCODE_JUMP2_BACKWARD:
case BCODE_JUMPOP2_BACKWARD_IF_FALSE: case BCODE_JMPOP2_BACKWARD_IF_FALSE:
case BCODE_JUMPOP2_BACKWARD_IF_TRUE: case BCODE_JMPOP2_BACKWARD_IF_TRUE:
case BCODE_JUMPOP2_FORWARD_IF_FALSE: case BCODE_JMPOP2_FORWARD_IF_FALSE:
case BCODE_JUMPOP2_FORWARD_IF_TRUE: case BCODE_JMPOP2_FORWARD_IF_TRUE:
case BCODE_PUSH_INTLIT: case BCODE_PUSH_INTLIT:
case BCODE_PUSH_NEGINTLIT: case BCODE_PUSH_NEGINTLIT:
case BCODE_PUSH_CHARLIT: case BCODE_PUSH_CHARLIT:
@ -2718,17 +2696,11 @@ static MOO_INLINE int emit_backward_jump_instruction (moo_t* moo, int cmd, moo_o
{ {
moo_oow_t adj; moo_oow_t adj;
MOO_ASSERT (moo, cmd == BCODE_JUMP_BACKWARD_0 || MOO_ASSERT (moo, cmd == BCODE_JUMP_BACKWARD ||
cmd == BCODE_JUMPOP_BACKWARD_IF_FALSE_0 || cmd == BCODE_JMPOP_BACKWARD_IF_FALSE ||
cmd == BCODE_JUMPOP_BACKWARD_IF_TRUE_0); cmd == BCODE_JMPOP_BACKWARD_IF_TRUE);
/* the short BCODE_JUMP_BACKWARD instructions use low 2 bits to encode
* the jump offset. so it can encode 0, 1, 2, 3. the instruction itself
* is 1 byte long. the offset value of 0, 1, 2 can get encoded into the
* instruction, which result in 1, 2, 3 when combined with the length 1
* of the instruction itself */
adj = (offset < 3)? 1: (MOO_BCODE_LONG_PARAM_SIZE + 1); adj = MOO_BCODE_LONG_PARAM_SIZE + 1; /* adjust by the size of instruction */
return emit_single_param_instruction(moo, cmd, offset + adj, srcloc); return emit_single_param_instruction(moo, cmd, offset + adj, srcloc);
} }
@ -2738,13 +2710,52 @@ static int patch_long_forward_jump_instruction (moo_t* moo, moo_oow_t jip, moo_o
moo_oow_t code_size; moo_oow_t code_size;
moo_oow_t jump_offset; moo_oow_t jump_offset;
/* jip - jump instruction pointer, jt - jump target * MOO_ASSERT (moo, cc->mth.code.ptr[jip] == BCODE_JUMP_FORWARD ||
* cc->mth.code.ptr[jip] == BCODE_JUMP_FORWARD_IF_FALSE ||
* when this jump instruction is executed, the instruction pointer advances cc->mth.code.ptr[jip] == BCODE_JUMP_FORWARD_IF_TRUE ||
* to the next instruction. so the actual jump size gets offset by the size cc->mth.code.ptr[jip] == BCODE_JMPOP_FORWARD_IF_FALSE ||
* of this jump instruction. MOO_BCODE_LONG_PARAM_SIZE + 1 is the size of cc->mth.code.ptr[jip] == BCODE_JMPOP_FORWARD_IF_TRUE);
* the long JUMP_FORWARD instruction */
code_size = jt - jip - (MOO_BCODE_LONG_PARAM_SIZE + 1); if (jt < jip)
{
/* backward jump */
switch (cc->mth.code.ptr[jip])
{
case BCODE_JUMP_FORWARD:
cc->mth.code.ptr[jip] = BCODE_JUMP_BACKWARD;
break;
case BCODE_JUMP_FORWARD_IF_FALSE:
cc->mth.code.ptr[jip] = BCODE_JUMP_BACKWARD_IF_FALSE;
break;
case BCODE_JUMP_FORWARD_IF_TRUE:
cc->mth.code.ptr[jip] == BCODE_JUMP_BACKWARD_IF_TRUE;
break;
case BCODE_JMPOP_FORWARD_IF_FALSE:
cc->mth.code.ptr[jip] = BCODE_JMPOP_BACKWARD_IF_FALSE;
break;
case BCODE_JMPOP_FORWARD_IF_TRUE:
cc->mth.code.ptr[jip] = BCODE_JMPOP_BACKWARD_IF_TRUE;
break;
}
code_size = jip - jt + (MOO_BCODE_LONG_PARAM_SIZE + 1);
}
else
{
/* jip - jump instruction pointer, jt - jump target *
*
* when this jump instruction is executed, the instruction pointer advances
* to the next instruction. so the actual jump size gets offset by the size
* of this jump instruction. MOO_BCODE_LONG_PARAM_SIZE + 1 is the size of
* the long JUMP_FORWARD instruction */
code_size = jt - jip - (MOO_BCODE_LONG_PARAM_SIZE + 1);
}
if (code_size > MAX_CODE_JUMP * 2) if (code_size > MAX_CODE_JUMP * 2)
{ {
/* TODO: change error code or get it as a parameter */ /* TODO: change error code or get it as a parameter */
@ -2752,12 +2763,6 @@ static int patch_long_forward_jump_instruction (moo_t* moo, moo_oow_t jip, moo_o
return -1; return -1;
} }
MOO_ASSERT (moo, cc->mth.code.ptr[jip] == BCODE_JUMP_FORWARD_X ||
cc->mth.code.ptr[jip] == BCODE_JUMP_FORWARD_IF_FALSE ||
cc->mth.code.ptr[jip] == BCODE_JUMP_FORWARD_IF_TRUE ||
cc->mth.code.ptr[jip] == BCODE_JUMPOP_FORWARD_IF_FALSE ||
cc->mth.code.ptr[jip] == BCODE_JUMPOP_FORWARD_IF_TRUE);
if (code_size > MAX_CODE_JUMP) if (code_size > MAX_CODE_JUMP)
{ {
/* switch to JUMP2 instruction to allow a bigger jump offset. /* switch to JUMP2 instruction to allow a bigger jump offset.
@ -2898,7 +2903,7 @@ static MOO_INLINE int inject_break_to_loop (moo_t* moo, const moo_ioloc_t* srclo
{ {
moo_cunit_class_t* cc = (moo_cunit_class_t*)moo->c->cunit; moo_cunit_class_t* cc = (moo_cunit_class_t*)moo->c->cunit;
if (add_to_oow_pool(moo, &cc->mth.loop->break_ip_pool, cc->mth.code.len) <= -1 || if (add_to_oow_pool(moo, &cc->mth.loop->break_ip_pool, cc->mth.code.len) <= -1 ||
emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, srcloc) <= -1) return -1; emit_single_param_instruction(moo, BCODE_JUMP_FORWARD, MAX_CODE_JUMP, srcloc) <= -1) return -1;
return 0; return 0;
} }
@ -2908,7 +2913,7 @@ static MOO_INLINE int inject_continue_to_loop (moo_t* moo, const moo_ioloc_t* sr
/* used for a do-while loop. jump forward because the conditional /* used for a do-while loop. jump forward because the conditional
* is at the end of the do-while loop */ * is at the end of the do-while loop */
if (add_to_oow_pool(moo, &cc->mth.loop->continue_ip_pool, cc->mth.code.len) <= -1 || if (add_to_oow_pool(moo, &cc->mth.loop->continue_ip_pool, cc->mth.code.len) <= -1 ||
emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, srcloc) <= -1) return -1; emit_single_param_instruction(moo, BCODE_JUMP_FORWARD, MAX_CODE_JUMP, srcloc) <= -1) return -1;
return 0; return 0;
} }
@ -4871,8 +4876,8 @@ static int compile_block_expression (moo_t* moo)
/* insert dummy instructions before replacing them with a jump instruction */ /* insert dummy instructions before replacing them with a jump instruction */
jump_inst_pos = cc->mth.code.len; jump_inst_pos = cc->mth.code.len;
/* specifying MAX_CODE_JUMP causes emit_single_param_instruction() to /* specifying MAX_CODE_JUMP causes emit_single_param_instruction() to
* produce the long jump instruction (BCODE_JUMP_FORWARD_X) */ * produce the long jump instruction (BCODE_JUMP_FORWARD) */
if (emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, &block_loc) <= -1) return -1; if (emit_single_param_instruction(moo, BCODE_JUMP_FORWARD, MAX_CODE_JUMP, &block_loc) <= -1) return -1;
/* compile statements inside a block */ /* compile statements inside a block */
#if 0 #if 0
@ -6094,7 +6099,7 @@ static int compile_if_expression (moo_t* moo)
moo_oow_t i, j; moo_oow_t i, j;
moo_oow_t jumptonext, precondpos, postcondpos, endoftrueblock; moo_oow_t jumptonext, precondpos, postcondpos, endoftrueblock;
moo_ioloc_t if_loc, brace_loc; moo_ioloc_t if_loc, brace_loc;
int jumpop_inst, push_true_inst, push_false_inst; int jmpop_inst, push_true_inst, push_false_inst;
MOO_ASSERT (moo, TOKEN_TYPE(moo) == MOO_IOTOK_IF || TOKEN_TYPE(moo) == MOO_IOTOK_IFNOT); MOO_ASSERT (moo, TOKEN_TYPE(moo) == MOO_IOTOK_IF || TOKEN_TYPE(moo) == MOO_IOTOK_IFNOT);
if_loc = *TOKEN_LOC(moo); if_loc = *TOKEN_LOC(moo);
@ -6107,13 +6112,13 @@ static int compile_if_expression (moo_t* moo)
{ {
push_true_inst = BCODE_PUSH_TRUE; push_true_inst = BCODE_PUSH_TRUE;
push_false_inst = BCODE_PUSH_FALSE; push_false_inst = BCODE_PUSH_FALSE;
jumpop_inst = BCODE_JUMPOP_FORWARD_IF_FALSE; jmpop_inst = BCODE_JMPOP_FORWARD_IF_FALSE;
} }
else else
{ {
push_true_inst = BCODE_PUSH_FALSE; push_true_inst = BCODE_PUSH_FALSE;
push_false_inst = BCODE_PUSH_TRUE; push_false_inst = BCODE_PUSH_TRUE;
jumpop_inst = BCODE_JUMPOP_FORWARD_IF_TRUE; jmpop_inst = BCODE_JMPOP_FORWARD_IF_TRUE;
} }
do do
@ -6147,11 +6152,11 @@ static int compile_if_expression (moo_t* moo)
} }
else else
{ {
/* remember position of the jumpop_forward_if_false instruction to be generated */ /* remember position of the jmpop_forward_if_false instruction to be generated */
jumptonext = cc->mth.code.len; jumptonext = cc->mth.code.len;
/* BCODE_JUMPOP_FORWARD_IF_FALSE is always a long jump instruction. /* BCODE_JMPOP_FORWARD_IF_FALSE is always a long jump instruction.
* just specify MAX_CODE_JUMP for consistency with short jump variants */ * just specify MAX_CODE_JUMP for consistency with short jump variants */
if (emit_single_param_instruction(moo, jumpop_inst, MAX_CODE_JUMP, &if_loc) <= -1) goto oops; if (emit_single_param_instruction(moo, jmpop_inst, MAX_CODE_JUMP, &if_loc) <= -1) goto oops;
} }
GET_TOKEN (moo); /* get { */ GET_TOKEN (moo); /* get { */
@ -6179,7 +6184,7 @@ static int compile_if_expression (moo_t* moo)
{ {
/* emit an instruction to jump to the end */ /* emit an instruction to jump to the end */
if (add_to_oow_pool(moo, &jumptoend, cc->mth.code.len) <= -1 || if (add_to_oow_pool(moo, &jumptoend, cc->mth.code.len) <= -1 ||
emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1) goto oops; emit_single_param_instruction(moo, BCODE_JUMP_FORWARD, MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1) goto oops;
} }
} }
@ -6191,13 +6196,13 @@ static int compile_if_expression (moo_t* moo)
{ {
push_true_inst = BCODE_PUSH_TRUE; push_true_inst = BCODE_PUSH_TRUE;
push_false_inst = BCODE_PUSH_FALSE; push_false_inst = BCODE_PUSH_FALSE;
jumpop_inst = BCODE_JUMPOP_FORWARD_IF_FALSE; jmpop_inst = BCODE_JMPOP_FORWARD_IF_FALSE;
} }
else else
{ {
push_true_inst = BCODE_PUSH_FALSE; push_true_inst = BCODE_PUSH_FALSE;
push_false_inst = BCODE_PUSH_TRUE; push_false_inst = BCODE_PUSH_TRUE;
jumpop_inst = BCODE_JUMPOP_FORWARD_IF_TRUE; jmpop_inst = BCODE_JMPOP_FORWARD_IF_TRUE;
} }
} }
while (1); while (1);
@ -6297,9 +6302,9 @@ static int compile_while_expression (moo_t* moo) /* or compile_until_expression
if (cond_style != 1) if (cond_style != 1)
{ {
/* BCODE_JUMPOP_FORWARD_IF_FALSE is always a long jump instruction. /* BCODE_JMPOP_FORWARD_IF_FALSE is always a long jump instruction.
* just specify MAX_CODE_JUMP for consistency with short jump variants */ * just specify MAX_CODE_JUMP for consistency with short jump variants */
if (emit_single_param_instruction(moo, (is_until_loop? BCODE_JUMPOP_FORWARD_IF_TRUE: BCODE_JUMPOP_FORWARD_IF_FALSE), MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1) goto oops; if (emit_single_param_instruction(moo, (is_until_loop? BCODE_JMPOP_FORWARD_IF_TRUE: BCODE_JMPOP_FORWARD_IF_FALSE), MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1) goto oops;
} }
/* remember information about this while loop. */ /* remember information about this while loop. */
@ -6328,7 +6333,7 @@ static int compile_while_expression (moo_t* moo) /* or compile_until_expression
} }
/* emit an instruction to jump back to the condition */ /* emit an instruction to jump back to the condition */
if (emit_backward_jump_instruction(moo, BCODE_JUMP_BACKWARD_0, cc->mth.code.len - precondpos, &closing_brace_loc) <= -1) if (emit_backward_jump_instruction(moo, BCODE_JUMP_BACKWARD, cc->mth.code.len - precondpos, &closing_brace_loc) <= -1)
{ {
if (moo->errnum == MOO_ERANGE) if (moo->errnum == MOO_ERANGE)
{ {
@ -6427,7 +6432,7 @@ static int compile_do_while_expression (moo_t* moo)
if (compile_conditional (moo) <= -1) goto oops; if (compile_conditional (moo) <= -1) goto oops;
postcondpos = cc->mth.code.len; postcondpos = cc->mth.code.len;
jbinst = (is_until_loop? BCODE_JUMPOP_BACKWARD_IF_FALSE_0: BCODE_JUMPOP_BACKWARD_IF_TRUE_0); jbinst = (is_until_loop? BCODE_JMPOP_BACKWARD_IF_FALSE: BCODE_JMPOP_BACKWARD_IF_TRUE);
if (precondpos + 1 == postcondpos) if (precondpos + 1 == postcondpos)
{ {
/* simple optimization - /* simple optimization -
@ -6438,7 +6443,7 @@ static int compile_do_while_expression (moo_t* moo)
/* the conditional is always true. eliminate PUSH_TRUE and emit an absolute jump */ /* the conditional is always true. eliminate PUSH_TRUE and emit an absolute jump */
eliminate_instructions (moo, precondpos, cc->mth.code.len - 1); eliminate_instructions (moo, precondpos, cc->mth.code.len - 1);
postcondpos = precondpos; postcondpos = precondpos;
jbinst = BCODE_JUMP_BACKWARD_0; jbinst = BCODE_JUMP_BACKWARD;
} }
else if (cc->mth.code.ptr[precondpos] == (is_until_loop? BCODE_PUSH_TRUE: BCODE_PUSH_FALSE)) else if (cc->mth.code.ptr[precondpos] == (is_until_loop? BCODE_PUSH_TRUE: BCODE_PUSH_FALSE))
{ {
@ -6651,18 +6656,8 @@ static MOO_INLINE int resolve_goto_label (moo_t* moo, moo_goto_t* _goto)
return -1; return -1;
} }
/* TODO: patch instruction */
MOO_ASSERT (moo, _goto->ip != _label->ip); MOO_ASSERT (moo, _goto->ip != _label->ip);
if (_goto->ip > _label->ip) if (patch_long_forward_jump_instruction (moo, _goto->ip, _label->ip, &_goto->loc) <= -1) return -1;
{
/* jump backward */
/* TODO: */
}
else
{
/* jump forward */
if (patch_long_forward_jump_instruction (moo, _goto->ip, _label->ip, &_goto->loc) <= -1) return -1;
}
return 0; return 0;
} }
_label = _label->next; _label = _label->next;
@ -6749,7 +6744,7 @@ static int compile_goto_statement (moo_t* moo)
nptr[target->len] = '\0'; nptr[target->len] = '\0';
_goto->ip = cc->mth.code.len; _goto->ip = cc->mth.code.len;
if (emit_single_param_instruction(moo, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1) if (emit_single_param_instruction(moo, BCODE_JUMP_FORWARD, MAX_CODE_JUMP, TOKEN_LOC(moo)) <= -1)
{ {
moo_freemem (moo, _goto); moo_freemem (moo, _goto);
return -1; return -1;
@ -6819,7 +6814,7 @@ static int compile_special_statement (moo_t* moo)
return (cc->mth.loop->type == MOO_LOOP_DO_WHILE)? return (cc->mth.loop->type == MOO_LOOP_DO_WHILE)?
inject_continue_to_loop(moo, &start_loc): /* in a do-while loop, the position to the conditional is not known yet */ inject_continue_to_loop(moo, &start_loc): /* in a do-while loop, the position to the conditional is not known yet */
emit_backward_jump_instruction(moo, BCODE_JUMP_BACKWARD_0, cc->mth.code.len - cc->mth.loop->startpos, &start_loc); emit_backward_jump_instruction(moo, BCODE_JUMP_BACKWARD, cc->mth.code.len - cc->mth.loop->startpos, &start_loc);
} }
else if (TOKEN_TYPE(moo) == MOO_IOTOK_KEYWORD) else if (TOKEN_TYPE(moo) == MOO_IOTOK_KEYWORD)
{ {

View File

@ -240,108 +240,111 @@ int moo_decode (moo_t* moo, moo_oop_method_t mth, const moo_oocs_t* classfqn)
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
case BCODE_JUMP_FORWARD_X: case BCODE_JUMP_FORWARD:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump_forward %zu", b1); LOG_INST_1 (moo, "jump_forward %zu", b1);
break; break;
case BCODE_JUMP_FORWARD_0:
case BCODE_JUMP_FORWARD_1:
case BCODE_JUMP_FORWARD_2:
case BCODE_JUMP_FORWARD_3:
LOG_INST_1 (moo, "jump_forward %zu", (moo_oow_t)(bcode & 0x3)); /* low 2 bits */
break;
case BCODE_JUMP_BACKWARD_X:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump_backward %zu", b1);
break;
case BCODE_JUMP_BACKWARD_0:
case BCODE_JUMP_BACKWARD_1:
case BCODE_JUMP_BACKWARD_2:
case BCODE_JUMP_BACKWARD_3:
LOG_INST_1 (moo, "jump_backward %zu", (moo_oow_t)(bcode & 0x3)); /* low 2 bits */
break;
case BCODE_JUMP2_FORWARD: case BCODE_JUMP2_FORWARD:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump2_forward %zu", b1); LOG_INST_1 (moo, "jump2_forward %zu", b1);
break; break;
case BCODE_JUMP2_BACKWARD:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump2_backward %zu", b1);
break;
case BCODE_JUMP_FORWARD_IF_TRUE: case BCODE_JUMP_FORWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump_forward_if_true %zu", b1); LOG_INST_1 (moo, "jump_forward_if_true %zu", b1);
break; break;
case BCODE_JUMP_FORWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump_forward_if_false %zu", b1);
break;
case BCODE_JUMP2_FORWARD_IF_TRUE: case BCODE_JUMP2_FORWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump2_forward_if_true %zu", b1); LOG_INST_1 (moo, "jump2_forward_if_true %zu", b1);
break; break;
case BCODE_JUMP_FORWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump_forward_if_false %zu", b1);
break;
case BCODE_JUMP2_FORWARD_IF_FALSE: case BCODE_JUMP2_FORWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jump2_forward_if_false %zu", b1); LOG_INST_1 (moo, "jump2_forward_if_false %zu", b1);
break; break;
case BCODE_JUMPOP_BACKWARD_IF_FALSE_X: /* -- */
case BCODE_JUMP_BACKWARD:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop_backward_if_false %zu", b1); LOG_INST_1 (moo, "jump_backward %zu", b1);
break; break;
case BCODE_JUMPOP_BACKWARD_IF_FALSE_0: case BCODE_JUMP2_BACKWARD:
case BCODE_JUMPOP_BACKWARD_IF_FALSE_1:
case BCODE_JUMPOP_BACKWARD_IF_FALSE_2:
case BCODE_JUMPOP_BACKWARD_IF_FALSE_3:
LOG_INST_1 (moo, "jumpop_backward_if_false %zu", (moo_oow_t)(bcode & 0x3)); /* low 2 bits */
break;
case BCODE_JUMPOP_BACKWARD_IF_TRUE_X:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop_backward_if_true %zu", b1); LOG_INST_1 (moo, "jump2_backward %zu", b1);
break; break;
case BCODE_JUMPOP_BACKWARD_IF_TRUE_0: case BCODE_JUMP_BACKWARD_IF_TRUE:
case BCODE_JUMPOP_BACKWARD_IF_TRUE_1:
case BCODE_JUMPOP_BACKWARD_IF_TRUE_2:
case BCODE_JUMPOP_BACKWARD_IF_TRUE_3:
LOG_INST_1 (moo, "jumpop_backward_if_true %zu", (moo_oow_t)(bcode & 0x3)); /* low 2 bits */
break;
case BCODE_JUMPOP_FORWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop_forward_if_false %zu", b1); LOG_INST_1 (moo, "jump_backward_if_true %zu", b1);
break; break;
case BCODE_JUMPOP_FORWARD_IF_TRUE: case BCODE_JUMP2_BACKWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop_forward_if_true %zu", b1); LOG_INST_1 (moo, "jump2_backward_if_true %zu", b1);
break; break;
case BCODE_JUMPOP2_FORWARD_IF_FALSE: case BCODE_JUMP_BACKWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop2_forward_if_false %zu", b1); LOG_INST_1 (moo, "jump_backward_if_false %zu", b1);
break; break;
case BCODE_JUMPOP2_BACKWARD_IF_FALSE: case BCODE_JUMP2_BACKWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop2_backward_if_false %zu", b1); LOG_INST_1 (moo, "jump2_backward_if_false %zu", b1);
break; break;
case BCODE_JUMPOP2_BACKWARD_IF_TRUE: /* -- */
case BCODE_JMPOP_FORWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jumpop2_backward_if_true %zu", b1); LOG_INST_1 (moo, "jmpop_forward_if_true %zu", b1);
break; break;
case BCODE_JMPOP2_FORWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop2_forward_if_true %zu", b1);
break;
case BCODE_JMPOP_FORWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop_forward_if_false %zu", b1);
break;
case BCODE_JMPOP2_FORWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop2_forward_if_false %zu", b1);
break;
/* -- */
case BCODE_JMPOP_BACKWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop_backward_if_true %zu", b1);
break;
case BCODE_JMPOP2_BACKWARD_IF_TRUE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop2_backward_if_true %zu", b1);
break;
case BCODE_JMPOP_BACKWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop_backward_if_false %zu", b1);
break;
case BCODE_JMPOP2_BACKWARD_IF_FALSE:
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST_1 (moo, "jmpop2_backward_if_false %zu", b1);
break;
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
case BCODE_PUSH_CTXTEMPVAR_X: case BCODE_PUSH_CTXTEMPVAR_X:

View File

@ -5486,150 +5486,140 @@ static int __execute (moo_t* moo)
} }
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
ON_INST(BCODE_JUMP_FORWARD) /* 0xC4 */
ON_INST(BCODE_JUMP_FORWARD_X)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump_forward %zu", b1); LOG_INST1 (moo, "jump_forward %zu", b1);
moo->ip += b1; moo->ip += b1;
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMP_FORWARD_0) ON_INST(BCODE_JUMP2_FORWARD) /* 0xC5 */
ON_INST(BCODE_JUMP_FORWARD_1)
ON_INST(BCODE_JUMP_FORWARD_2)
ON_INST(BCODE_JUMP_FORWARD_3)
LOG_INST1 (moo, "jump_forward %zu", (moo_oow_t)(bcode & 0x3));
moo->ip += (bcode & 0x3); /* low 2 bits */
NEXT_INST();
ON_INST(BCODE_JUMP_BACKWARD_X)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump_backward %zu", b1);
moo->ip -= b1;
NEXT_INST();
ON_INST(BCODE_JUMP_BACKWARD_0)
ON_INST(BCODE_JUMP_BACKWARD_1)
ON_INST(BCODE_JUMP_BACKWARD_2)
ON_INST(BCODE_JUMP_BACKWARD_3)
LOG_INST1 (moo, "jump_backward %zu", (moo_oow_t)(bcode & 0x3));
moo->ip -= (bcode & 0x3); /* low 2 bits */
NEXT_INST();
ON_INST(BCODE_JUMP2_FORWARD)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump2_forward %zu", b1); LOG_INST1 (moo, "jump2_forward %zu", b1);
moo->ip += MAX_CODE_JUMP + b1; moo->ip += MAX_CODE_JUMP + b1;
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMP2_BACKWARD) ON_INST(BCODE_JUMP_FORWARD_IF_TRUE) /* 0xC6 */
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump2_backward %zu", b1);
moo->ip -= MAX_CODE_JUMP + b1;
NEXT_INST();
ON_INST(BCODE_JUMP_FORWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump_forward_if_true %zu", b1); LOG_INST1 (moo, "jump_forward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += b1; if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += b1;
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMP_FORWARD_IF_FALSE) ON_INST(BCODE_JUMP2_FORWARD_IF_TRUE) /* 0xC7 */
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump_forward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += b1;
NEXT_INST();
ON_INST(BCODE_JUMP2_FORWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump2_forward_if_true %zu", b1); LOG_INST1 (moo, "jump2_forward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += MAX_CODE_JUMP + b1; if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += MAX_CODE_JUMP + b1;
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMP2_FORWARD_IF_FALSE) ON_INST(BCODE_JUMP_FORWARD_IF_FALSE) /* 0xC8 */
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump_forward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += b1;
NEXT_INST();
ON_INST(BCODE_JUMP2_FORWARD_IF_FALSE) /* 0xC9 */
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump2_forward_if_false %zu", b1); LOG_INST1 (moo, "jump2_forward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += MAX_CODE_JUMP + b1; if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += MAX_CODE_JUMP + b1;
NEXT_INST(); NEXT_INST();
/* -- */
ON_INST(BCODE_JUMPOP_BACKWARD_IF_FALSE_X) ON_INST(BCODE_JUMP_BACKWARD) /* 0xCA */
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop_backward_if_false %zu", b1); LOG_INST1 (moo, "jump_backward %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= b1; moo->ip -= b1;
MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP_BACKWARD_IF_FALSE_0) ON_INST(BCODE_JUMP2_BACKWARD) /* 0xCB */
ON_INST(BCODE_JUMPOP_BACKWARD_IF_FALSE_1) FETCH_PARAM_CODE_TO (moo, b1);
ON_INST(BCODE_JUMPOP_BACKWARD_IF_FALSE_2) LOG_INST1 (moo, "jump2_backward %zu", b1);
ON_INST(BCODE_JUMPOP_BACKWARD_IF_FALSE_3) moo->ip -= MAX_CODE_JUMP + b1;
LOG_INST1 (moo, "jumpop_backward_if_false %zu", (moo_oow_t)(bcode & 0x3));
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= (bcode & 0x3); /* low 2 bits */
MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP_BACKWARD_IF_TRUE_X) ON_INST(BCODE_JUMP_BACKWARD_IF_TRUE) /* 0xCC */
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop_backward_if_true %zu", b1); LOG_INST1 (moo, "jump_backward_if_true %zu", b1);
/*if (MOO_STACK_GETTOP(moo) == moo->_true) moo->ip -= b1;*/
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= b1; if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= b1;
MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP_BACKWARD_IF_TRUE_0) ON_INST(BCODE_JUMP2_BACKWARD_IF_TRUE) /* 0xCD */
ON_INST(BCODE_JUMPOP_BACKWARD_IF_TRUE_1)
ON_INST(BCODE_JUMPOP_BACKWARD_IF_TRUE_2)
ON_INST(BCODE_JUMPOP_BACKWARD_IF_TRUE_3)
LOG_INST1 (moo, "jumpop_backward_if_true %zu", (moo_oow_t)(bcode & 0x3));
/*if (MOO_STACK_GETTOP(moo) == moo->_true) moo->ip -= (bcode & 0x3);*/ /* low 2 bits */
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= (bcode & 0x3);
MOO_STACK_POP (moo);
NEXT_INST();
ON_INST(BCODE_JUMPOP_FORWARD_IF_FALSE)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop_forward_if_false %zu", b1); LOG_INST1 (moo, "jump2_backward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += b1; if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP_FORWARD_IF_TRUE) ON_INST(BCODE_JUMP_BACKWARD_IF_FALSE) /* 0xCE */
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop_forward_if_true %zu", b1); LOG_INST1 (moo, "jump_backward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= b1;
NEXT_INST();
ON_INST(BCODE_JUMP2_BACKWARD_IF_FALSE) /* 0xCF */
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jump2_backward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= MAX_CODE_JUMP + b1;
NEXT_INST();
/* -- */
ON_INST(BCODE_JMPOP_FORWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jmpop_forward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += b1; if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += b1;
MOO_STACK_POP (moo); MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP2_FORWARD_IF_FALSE) ON_INST(BCODE_JMPOP2_FORWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop2_forward_if_false %zu", b1); LOG_INST1 (moo, "jmpop2_forward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo);
NEXT_INST();
ON_INST(BCODE_JUMPOP2_FORWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop2_forward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += MAX_CODE_JUMP + b1; if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip += MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo); MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP2_BACKWARD_IF_FALSE) ON_INST(BCODE_JMPOP_FORWARD_IF_FALSE)
FETCH_PARAM_CODE_TO (moo, b1); FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop2_backward_if_false %zu", b1); LOG_INST1 (moo, "jmpop_forward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += b1;
MOO_STACK_POP (moo);
NEXT_INST();
ON_INST(BCODE_JMPOP2_FORWARD_IF_FALSE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jmpop2_forward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip += MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo);
NEXT_INST();
/* -- */
ON_INST(BCODE_JMPOP2_BACKWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jmpop2_backward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo);
NEXT_INST();
ON_INST(BCODE_JMPOP_BACKWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jmpop_backward_if_true %zu", b1);
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= b1;
MOO_STACK_POP (moo);
NEXT_INST();
ON_INST(BCODE_JMPOP_BACKWARD_IF_FALSE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jmpop_backward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= b1;
MOO_STACK_POP (moo);
NEXT_INST();
ON_INST(BCODE_JMPOP2_BACKWARD_IF_FALSE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jmpop2_backward_if_false %zu", b1);
if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= MAX_CODE_JUMP + b1; if (MOO_STACK_GETTOP(moo) == moo->_false) moo->ip -= MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo); MOO_STACK_POP (moo);
NEXT_INST(); NEXT_INST();
ON_INST(BCODE_JUMPOP2_BACKWARD_IF_TRUE)
FETCH_PARAM_CODE_TO (moo, b1);
LOG_INST1 (moo, "jumpop2_backward_if_true %zu", b1);
/* if (MOO_STACK_GETTOP(moo) == moo->_true) moo->ip -= MAX_CODE_JUMP + b1; */
if (MOO_STACK_GETTOP(moo) != moo->_false) moo->ip -= MAX_CODE_JUMP + b1;
MOO_STACK_POP (moo);
NEXT_INST();
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
ON_INST(BCODE_PUSH_CTXTEMPVAR_X) ON_INST(BCODE_PUSH_CTXTEMPVAR_X)
ON_INST(BCODE_STORE_INTO_CTXTEMPVAR_X) ON_INST(BCODE_STORE_INTO_CTXTEMPVAR_X)
ON_INST(BCODE_POP_INTO_CTXTEMPVAR_X) ON_INST(BCODE_POP_INTO_CTXTEMPVAR_X)

View File

@ -68,22 +68,22 @@
/* 65 */ &&case_BCODE_PUSH_OBJECT_1, /* 65 */ &&case_BCODE_PUSH_OBJECT_1,
/* 66 */ &&case_BCODE_PUSH_OBJECT_2, /* 66 */ &&case_BCODE_PUSH_OBJECT_2,
/* 67 */ &&case_BCODE_PUSH_OBJECT_3, /* 67 */ &&case_BCODE_PUSH_OBJECT_3,
/* 68 */ &&case_BCODE_JUMP_FORWARD_0, /* 68 */ &&case_DEFAULT,
/* 69 */ &&case_BCODE_JUMP_FORWARD_1, /* 69 */ &&case_DEFAULT,
/* 70 */ &&case_BCODE_JUMP_FORWARD_2, /* 70 */ &&case_DEFAULT,
/* 71 */ &&case_BCODE_JUMP_FORWARD_3, /* 71 */ &&case_DEFAULT,
/* 72 */ &&case_BCODE_JUMP_BACKWARD_0, /* 72 */ &&case_DEFAULT,
/* 73 */ &&case_BCODE_JUMP_BACKWARD_1, /* 73 */ &&case_DEFAULT,
/* 74 */ &&case_BCODE_JUMP_BACKWARD_2, /* 74 */ &&case_DEFAULT,
/* 75 */ &&case_BCODE_JUMP_BACKWARD_3, /* 75 */ &&case_DEFAULT,
/* 76 */ &&case_BCODE_JUMPOP_BACKWARD_IF_FALSE_0, /* 76 */ &&case_DEFAULT,
/* 77 */ &&case_BCODE_JUMPOP_BACKWARD_IF_FALSE_1, /* 77 */ &&case_DEFAULT,
/* 78 */ &&case_BCODE_JUMPOP_BACKWARD_IF_FALSE_2, /* 78 */ &&case_DEFAULT,
/* 79 */ &&case_BCODE_JUMPOP_BACKWARD_IF_FALSE_3, /* 79 */ &&case_DEFAULT,
/* 80 */ &&case_BCODE_JUMPOP_BACKWARD_IF_TRUE_0, /* 80 */ &&case_DEFAULT,
/* 81 */ &&case_BCODE_JUMPOP_BACKWARD_IF_TRUE_1, /* 81 */ &&case_DEFAULT,
/* 82 */ &&case_BCODE_JUMPOP_BACKWARD_IF_TRUE_2, /* 82 */ &&case_DEFAULT,
/* 83 */ &&case_BCODE_JUMPOP_BACKWARD_IF_TRUE_3, /* 83 */ &&case_DEFAULT,
/* 84 */ &&case_DEFAULT, /* 84 */ &&case_DEFAULT,
/* 85 */ &&case_DEFAULT, /* 85 */ &&case_DEFAULT,
/* 86 */ &&case_DEFAULT, /* 86 */ &&case_DEFAULT,
@ -196,26 +196,26 @@
/* 193 */ &&case_DEFAULT, /* 193 */ &&case_DEFAULT,
/* 194 */ &&case_DEFAULT, /* 194 */ &&case_DEFAULT,
/* 195 */ &&case_DEFAULT, /* 195 */ &&case_DEFAULT,
/* 196 */ &&case_BCODE_JUMP_FORWARD_X, /* 196 */ &&case_BCODE_JUMP_FORWARD,
/* 197 */ &&case_BCODE_JUMP2_FORWARD, /* 197 */ &&case_BCODE_JUMP2_FORWARD,
/* 198 */ &&case_BCODE_JUMP_FORWARD_IF_TRUE, /* 198 */ &&case_BCODE_JUMP_FORWARD_IF_TRUE,
/* 199 */ &&case_BCODE_JUMP2_FORWARD_IF_TRUE, /* 199 */ &&case_BCODE_JUMP2_FORWARD_IF_TRUE,
/* 200 */ &&case_BCODE_JUMP_BACKWARD_X, /* 200 */ &&case_BCODE_JUMP_FORWARD_IF_FALSE,
/* 201 */ &&case_BCODE_JUMP2_BACKWARD, /* 201 */ &&case_BCODE_JUMP2_FORWARD_IF_FALSE,
/* 202 */ &&case_DEFAULT, /* 202 */ &&case_BCODE_JUMP_BACKWARD,
/* 203 */ &&case_DEFAULT, /* 203 */ &&case_BCODE_JUMP2_BACKWARD,
/* 204 */ &&case_BCODE_JUMPOP_BACKWARD_IF_FALSE_X, /* 204 */ &&case_BCODE_JUMP_BACKWARD_IF_TRUE,
/* 205 */ &&case_BCODE_JUMPOP2_BACKWARD_IF_FALSE, /* 205 */ &&case_BCODE_JUMP2_BACKWARD_IF_TRUE,
/* 206 */ &&case_DEFAULT, /* 206 */ &&case_BCODE_JUMP_BACKWARD_IF_FALSE,
/* 207 */ &&case_DEFAULT, /* 207 */ &&case_BCODE_JUMP2_BACKWARD_IF_FALSE,
/* 208 */ &&case_BCODE_JUMPOP_BACKWARD_IF_TRUE_X, /* 208 */ &&case_BCODE_JMPOP_FORWARD_IF_TRUE,
/* 209 */ &&case_BCODE_JUMPOP2_BACKWARD_IF_TRUE, /* 209 */ &&case_BCODE_JMPOP2_FORWARD_IF_TRUE,
/* 210 */ &&case_BCODE_JUMP_FORWARD_IF_FALSE, /* 210 */ &&case_BCODE_JMPOP_FORWARD_IF_FALSE,
/* 211 */ &&case_BCODE_JUMP2_FORWARD_IF_FALSE, /* 211 */ &&case_BCODE_JMPOP2_FORWARD_IF_FALSE,
/* 212 */ &&case_BCODE_JUMPOP_FORWARD_IF_FALSE, /* 212 */ &&case_BCODE_JMPOP_BACKWARD_IF_TRUE,
/* 213 */ &&case_BCODE_JUMPOP2_FORWARD_IF_FALSE, /* 213 */ &&case_BCODE_JMPOP2_BACKWARD_IF_TRUE,
/* 214 */ &&case_BCODE_JUMPOP_FORWARD_IF_TRUE, /* 214 */ &&case_BCODE_JMPOP_BACKWARD_IF_FALSE,
/* 215 */ &&case_BCODE_JUMPOP2_FORWARD_IF_TRUE, /* 215 */ &&case_BCODE_JMPOP2_BACKWARD_IF_FALSE,
/* 216 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_X, /* 216 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_X,
/* 217 */ &&case_DEFAULT, /* 217 */ &&case_DEFAULT,
/* 218 */ &&case_DEFAULT, /* 218 */ &&case_DEFAULT,

View File

@ -738,22 +738,26 @@ SHORT INSTRUCTION CODE LONG INSTRUCTION C
64-67 0100 00XX PUSH_OBJECT 192 1100 0000 XXXXXXXX PUSH_OBJECT (bit 3 off) 64-67 0100 00XX PUSH_OBJECT 192 1100 0000 XXXXXXXX PUSH_OBJECT (bit 3 off)
68-71 0100 01XX JUMP_FORWARD 196 1100 0100 XXXXXXXX JUMP_FORWARD_X 68-87 0100 01XX UNUSED 196 1100 0100 XXXXXXXX JUMP_FORWARD
197 1100 0101 XXXXXXXX JUMP2_FORWARD 197 1100 0101 XXXXXXXX JUMP2_FORWARD
198 1100 0110 XXXXXXXX JUMP_FORWARD_IF_TRUE 198 1100 0110 XXXXXXXX JUMP_FORWARD_IF_TRUE
199 1100 0111 XXXXXXXX JUMP2_FORWARD_IF_TRUE 199 1100 0111 XXXXXXXX JUMP2_FORWARD_IF_TRUE
72-75 0100 10XX JUMP_BACKWARD 200 1100 1000 XXXXXXXX JUMP_BACKWARD_X 200 1100 1000 XXXXXXXX JUMP_FORWARD_IF_FALSE
201 1101 1001 XXXXXXXX JUMP2_BACKWARD 201 1100 1001 XXXXXXXX JUMP2_FORWARD_IF_FALSE
76-79 0100 11XX JUMPOP_BACKWARD_IF_FALSE 204 1100 1100 XXXXXXXX JUMPOP_BACKWARD_IF_FALSE_X 202 1100 1010 XXXXXXXX JUMP_BACKWARD
205 1101 1101 XXXXXXXX JUMPOP2_BACKWARD_IF_FALSE 203 1100 1011 XXXXXXXX JUMP2_BACKWARD
80-83 0101 00XX JUMPOP_BACKWARD_IF_TRUE 208 1101 0000 XXXXXXXX JUMPOP_BACKWARD_IF_TRUE_X 204 1100 1100 XXXXXXXX JUMP_BACKWARD_IF_TRUE
209 1101 0001 XXXXXXXX JUMPOP2_FORWARD_IF_TRUE 205 1100 1101 XXXXXXXX JUMP2_BACKWARD_IF_TRUE
84-87 0101 01XX UNUSED 210 1101 0010 XXXXXXXX JUMP_FORWARD_IF_FALSE 206 1100 1110 XXXXXXXX JUMP_BACKWARD_IF_FALSE
211 1101 0011 XXXXXXXX JUMP2_FORWARD_IF_FALSE 207 1100 1111 XXXXXXXX JUMP2_BACKWARD_IF_FALSE
212 1101 0100 XXXXXXXX JUMPOP_FORWARD_IF_FALSE 208 1101 0000 XXXXXXXX JMPOP_FORWARD_IF_TRUE
213 1101 0101 XXXXXXXX JUMPOP2_FORWARD_IF_FALSE 209 1101 0001 XXXXXXXX JMPOP2_FORWARD_IF_TRUE
214 1101 0110 XXXXXXXX JUMPOP_FORWARD_IF_TRUE 210 1101 0010 XXXXXXXX JMPOP_FORWARD_IF_FALSE
215 1101 0111 XXXXXXXX JUMPOP2_FORWARD_IF_TRUE 211 1101 0011 XXXXXXXX JMPOP2_FORWARD_IF_FALSE
212 1101 0100 XXXXXXXX JMPOP_BACKWARD_IF_TRUE
213 1101 0101 XXXXXXXX JMPOP2_BACKWARD_IF_TRUE
214 1101 0110 XXXXXXXX JMPOP_BACKWARD_IF_FALSE
215 1101 0111 XXXXXXXX JMPOP2_BACKWARD_IF_FALSE
vv vv
88-91 0101 10XX YYYYYYYY STORE_INTO_CTXTEMPVAR 216 1101 1000 XXXXXXXX YYYYYYYY STORE_INTO_CTXTEMPVAR_X (bit 3 on, bit 2 off) 88-91 0101 10XX YYYYYYYY STORE_INTO_CTXTEMPVAR 216 1101 1000 XXXXXXXX YYYYYYYY STORE_INTO_CTXTEMPVAR_X (bit 3 on, bit 2 off)
@ -867,30 +871,9 @@ enum moo_bcode_t
BCODE_PUSH_OBJECT_0 = 0x40, BCODE_PUSH_OBJECT_0 = 0x40,
BCODE_PUSH_OBJECT_1 = 0x41, BCODE_PUSH_OBJECT_1 = 0x41,
BCODE_PUSH_OBJECT_2 = 0x42, BCODE_PUSH_OBJECT_2 = 0x42,
BCODE_PUSH_OBJECT_3 = 0x43, BCODE_PUSH_OBJECT_3 = 0x43, /* 67 */
BCODE_JUMP_FORWARD_0 = 0x44, /* 68 */ /* UNUSED 0x44 - 0x57 */
BCODE_JUMP_FORWARD_1 = 0x45, /* 69 */
BCODE_JUMP_FORWARD_2 = 0x46, /* 70 */
BCODE_JUMP_FORWARD_3 = 0x47, /* 71 */
BCODE_JUMP_BACKWARD_0 = 0x48, /* 72 */
BCODE_JUMP_BACKWARD_1 = 0x49, /* 73 */
BCODE_JUMP_BACKWARD_2 = 0x4A, /* 74 */
BCODE_JUMP_BACKWARD_3 = 0x4B, /* 75 */
/* JUMPOP = JUMP + POP */
BCODE_JUMPOP_BACKWARD_IF_FALSE_0 = 0x4C, /* 76 */
BCODE_JUMPOP_BACKWARD_IF_FALSE_1 = 0x4D, /* 77 */
BCODE_JUMPOP_BACKWARD_IF_FALSE_2 = 0x4E, /* 78 */
BCODE_JUMPOP_BACKWARD_IF_FALSE_3 = 0x4F, /* 79 */
BCODE_JUMPOP_BACKWARD_IF_TRUE_0 = 0x50, /* 80 */
BCODE_JUMPOP_BACKWARD_IF_TRUE_1 = 0x51, /* 81 */
BCODE_JUMPOP_BACKWARD_IF_TRUE_2 = 0x52, /* 82 */
BCODE_JUMPOP_BACKWARD_IF_TRUE_3 = 0x53, /* 83 */
/* UNUSED 0x54 - 0x57 */
BCODE_STORE_INTO_CTXTEMPVAR_0 = 0x58, /* 88 */ BCODE_STORE_INTO_CTXTEMPVAR_0 = 0x58, /* 88 */
BCODE_STORE_INTO_CTXTEMPVAR_1 = 0x59, /* 89 */ BCODE_STORE_INTO_CTXTEMPVAR_1 = 0x59, /* 89 */
@ -958,6 +941,7 @@ enum moo_bcode_t
BCODE_PUSH_LITERAL_X = 0xB0, /* 176 ## */ BCODE_PUSH_LITERAL_X = 0xB0, /* 176 ## */
/* UNUSED - 0xB1 */ /* UNUSED - 0xB1 */
BCODE_PUSH_INTLIT = 0xB2, /* 178 */ BCODE_PUSH_INTLIT = 0xB2, /* 178 */
BCODE_PUSH_NEGINTLIT = 0xB3, /* 179 */ BCODE_PUSH_NEGINTLIT = 0xB3, /* 179 */
BCODE_PUSH_CHARLIT = 0xB4, /* 180 */ BCODE_PUSH_CHARLIT = 0xB4, /* 180 */
@ -966,24 +950,30 @@ enum moo_bcode_t
BCODE_POP_INTO_OBJECT_X = 0xBC, /* 188 ## */ BCODE_POP_INTO_OBJECT_X = 0xBC, /* 188 ## */
BCODE_PUSH_OBJECT_X = 0xC0, /* 192 ## */ BCODE_PUSH_OBJECT_X = 0xC0, /* 192 ## */
BCODE_JUMP_FORWARD_X = 0xC4, /* 196 ## */ BCODE_JUMP_FORWARD = 0xC4, /* 196 ## */
BCODE_JUMP2_FORWARD = 0xC5, /* 197 */ BCODE_JUMP2_FORWARD = 0xC5, /* 197 ## */
BCODE_JUMP_FORWARD_IF_TRUE = 0xC6, /* 198 ## */ BCODE_JUMP_FORWARD_IF_TRUE = 0xC6, /* 198 ## */
BCODE_JUMP2_FORWARD_IF_TRUE = 0xC7, /* 199 */ BCODE_JUMP2_FORWARD_IF_TRUE = 0xC7, /* 199 ## */
BCODE_JUMP_BACKWARD_X = 0xC8, /* 200 ## */ BCODE_JUMP_FORWARD_IF_FALSE = 0xC8, /* 200 ## */
BCODE_JUMP2_BACKWARD = 0xC9, /* 201 */ BCODE_JUMP2_FORWARD_IF_FALSE = 0xC9, /* 201 ## */
BCODE_JUMPOP_BACKWARD_IF_FALSE_X = 0xCC, /* 204 ## */ BCODE_JUMP_BACKWARD = 0xCA, /* 202 ## */
BCODE_JUMPOP2_BACKWARD_IF_FALSE = 0xCD, /* 205 */ BCODE_JUMP2_BACKWARD = 0xCB, /* 203 ## */
BCODE_JUMPOP_BACKWARD_IF_TRUE_X = 0xD0, /* 208 ## */ BCODE_JUMP_BACKWARD_IF_TRUE = 0xCC, /* 204 ## */
BCODE_JUMPOP2_BACKWARD_IF_TRUE = 0xD1, /* 209 */ BCODE_JUMP2_BACKWARD_IF_TRUE = 0xCD, /* 205 ## */
BCODE_JUMP_BACKWARD_IF_FALSE = 0xCE, /* 206 ## */
BCODE_JUMP2_BACKWARD_IF_FALSE = 0xCF, /* 207 ## */
BCODE_JUMP_FORWARD_IF_FALSE = 0xD2, /* 210 ## */ /* JMPOP = JUMP + POP */
BCODE_JUMP2_FORWARD_IF_FALSE = 0xD3, /* 211 */ BCODE_JMPOP_FORWARD_IF_TRUE = 0xD0, /* 208 ## */
BCODE_JUMPOP_FORWARD_IF_FALSE = 0xD4, /* 212 ## */ BCODE_JMPOP2_FORWARD_IF_TRUE = 0xD1, /* 209 ## */
BCODE_JUMPOP2_FORWARD_IF_FALSE = 0xD5, /* 213 */ BCODE_JMPOP_FORWARD_IF_FALSE = 0xD2, /* 210 ## */
BCODE_JUMPOP_FORWARD_IF_TRUE = 0xD6, /* 214 ## */ BCODE_JMPOP2_FORWARD_IF_FALSE = 0xD3, /* 211 ## */
BCODE_JUMPOP2_FORWARD_IF_TRUE = 0xD7, /* 215 */
BCODE_JMPOP_BACKWARD_IF_TRUE = 0xD4, /* 212 ## */
BCODE_JMPOP2_BACKWARD_IF_TRUE = 0xD5, /* 213 ## */
BCODE_JMPOP_BACKWARD_IF_FALSE = 0xD6, /* 214 ## */
BCODE_JMPOP2_BACKWARD_IF_FALSE = 0xD7, /* 215 ## */
BCODE_STORE_INTO_CTXTEMPVAR_X = 0xD8, /* 216 ## */ BCODE_STORE_INTO_CTXTEMPVAR_X = 0xD8, /* 216 ## */
BCODE_POP_INTO_CTXTEMPVAR_X = 0xDC, /* 220 ## */ BCODE_POP_INTO_CTXTEMPVAR_X = 0xDC, /* 220 ## */
@ -994,28 +984,28 @@ enum moo_bcode_t
BCODE_POP_INTO_OBJVAR_X = 0xEC, /* 236 ## */ BCODE_POP_INTO_OBJVAR_X = 0xEC, /* 236 ## */
/* UNUSED 237 */ /* UNUSED 237 */
BCODE_MAKE_BYTEARRAY = 0xEE, /* 238 */ BCODE_MAKE_BYTEARRAY = 0xEE, /* 238 */
BCODE_POP_INTO_BYTEARRAY = 0xEF, /* 239 */ BCODE_POP_INTO_BYTEARRAY = 0xEF, /* 239 */
BCODE_SEND_MESSAGE_X = 0xF0, /* 240 ## */ BCODE_SEND_MESSAGE_X = 0xF0, /* 240 ## */
/* UNUSED 241 */ /* UNUSED 241 */
BCODE_MAKE_DICTIONARY = 0xF2, /* 242 */ BCODE_MAKE_DICTIONARY = 0xF2, /* 242 */
BCODE_POP_INTO_DICTIONARY = 0xF3, /* 243 */ BCODE_POP_INTO_DICTIONARY = 0xF3, /* 243 */
BCODE_SEND_MESSAGE_TO_SUPER_X = 0xF4, /* 244 ## */ BCODE_SEND_MESSAGE_TO_SUPER_X = 0xF4, /* 244 ## */
/* -------------------------------------- */ /* -------------------------------------- */
BCODE_MAKE_ARRAY = 0xF5, /* 245 */ BCODE_MAKE_ARRAY = 0xF5, /* 245 */
BCODE_POP_INTO_ARRAY = 0xF6, /* 246 */ BCODE_POP_INTO_ARRAY = 0xF6, /* 246 */
BCODE_DUP_STACKTOP = 0xF7, /* 247 */ BCODE_DUP_STACKTOP = 0xF7, /* 247 */
BCODE_POP_STACKTOP = 0xF8, BCODE_POP_STACKTOP = 0xF8,
BCODE_RETURN_STACKTOP = 0xF9, /* ^something */ BCODE_RETURN_STACKTOP = 0xF9, /* ^something */
BCODE_RETURN_RECEIVER = 0xFA, /* ^self */ BCODE_RETURN_RECEIVER = 0xFA, /* ^self */
BCODE_RETURN_FROM_BLOCK = 0xFB, /* return the stack top from a block */ BCODE_RETURN_FROM_BLOCK = 0xFB, /* return the stack top from a block */
BCODE_LOCAL_RETURN = 0xFC, BCODE_LOCAL_RETURN = 0xFC,
BCODE_MAKE_BLOCK = 0xFD, BCODE_MAKE_BLOCK = 0xFD,
BCODE_SEND_BLOCK_COPY = 0xFE, BCODE_SEND_BLOCK_COPY = 0xFE,
BCODE_NOOP = 0xFF BCODE_NOOP = 0xFF
}; };
/* i don't want an error raised inside the callback to override /* i don't want an error raised inside the callback to override