Skip to content

Commit

Permalink
Find deopt target correctly in JIT for new guards
Browse files Browse the repository at this point in the history
Some of them have 2 operands, not 3.
  • Loading branch information
jnthn committed Jun 20, 2018
1 parent c14094a commit 39b7b33
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/jit/graph.c
Expand Up @@ -369,7 +369,7 @@ static void * op_to_func(MVMThreadContext *tc, MVMint16 opcode) {
}

static void jg_append_guard(MVMThreadContext *tc, MVMJitGraph *jg,
MVMSpeshIns *ins) {
MVMSpeshIns *ins, MVMuint32 target_operand) {
MVMSpeshAnn *ann = ins->annotations;
MVMJitNode *node = MVM_spesh_alloc(tc, jg->sg, sizeof(MVMJitNode));
MVMint32 deopt_idx;
Expand All @@ -387,7 +387,7 @@ static void jg_append_guard(MVMThreadContext *tc, MVMJitGraph *jg,
MVM_oops(tc, "Can't find deopt idx annotation on spesh ins <%s>",
ins->info->name);
}
node->u.guard.deopt_target = ins->operands[2].lit_ui32;
node->u.guard.deopt_target = ins->operands[target_operand].lit_ui32;
node->u.guard.deopt_offset = jg->sg->deopt_addrs[2 * deopt_idx + 1];
jg_append_node(jg, node);
}
Expand Down Expand Up @@ -3212,9 +3212,11 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
case MVM_OP_sp_guardtype:
case MVM_OP_sp_guardsf:
case MVM_OP_sp_guardobj:
jg_append_guard(tc, jg, ins, 2);
break;
case MVM_OP_sp_guardjustconc:
case MVM_OP_sp_guardjusttype:
jg_append_guard(tc, jg, ins);
jg_append_guard(tc, jg, ins, 1);
break;
case MVM_OP_sp_resolvecode: {
MVMint16 dst = ins->operands[0].reg.orig;
Expand Down

0 comments on commit 39b7b33

Please sign in to comment.