Skip to content

Commit

Permalink
Correct various missing usage bumps
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jul 9, 2018
1 parent 59fc280 commit 0ef24ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/spesh/inline.c
Expand Up @@ -372,6 +372,7 @@ static void rewrite_outer_lookup(MVMThreadContext *tc, MVMSpeshGraph *g,
new_operands[3] = code_ref_reg;
ins->info = MVM_op_get_op(op);
ins->operands = new_operands;
MVM_spesh_usages_add_by_reg(tc, g, code_ref_reg, ins);
}

/* Merges the inlinee's spesh graph into the inliner. */
Expand Down Expand Up @@ -767,14 +768,14 @@ static void return_to_box(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshBB *re
box_operands[2] = type_temp;
MVM_spesh_manipulate_insert_ins(tc, return_bb, return_ins, box_ins);
MVM_spesh_get_facts(tc, g, target)->writer = box_ins;
MVM_spesh_usages_add_by_reg(tc, g, box_operands[1], box_ins);
MVM_spesh_usages_add_by_reg(tc, g, box_operands[2], box_ins);

/* Now turn return instruction node into lookup of appropriate box
* type. */
return_ins->info = MVM_op_get_op(box_type_op);
return_ins->operands[0] = type_temp;

MVM_spesh_get_facts(tc, g, type_temp)->writer = return_ins;

MVM_spesh_manipulate_release_temp_reg(tc, g, type_temp);
}

Expand Down
4 changes: 3 additions & 1 deletion src/spesh/optimize.c
Expand Up @@ -1152,12 +1152,12 @@ static void optimize_object_conditional(MVMThreadContext *tc, MVMSpeshGraph *g,
new_ins->operands[0] = temp;
new_ins->operands[1] = target;
MVM_spesh_manipulate_insert_ins(tc, bb, ins, new_ins);
MVM_spesh_usages_add(tc, g, temp_facts, new_ins);

/* Tweak existing instruction to istrue */
ins->info = MVM_op_get_op(MVM_OP_istrue);
ins->operands[0] = temp;
ins->operands[1] = condition;
MVM_spesh_usages_add(tc, g, temp_facts, ins);
temp_facts->writer = ins;

/* try to optimize the istrue */
Expand Down Expand Up @@ -1389,6 +1389,7 @@ static void insert_arg_type_guard(MVMThreadContext *tc, MVMSpeshGraph *g,
guard->operands[2].lit_ui32 = deopt_target;
MVM_spesh_manipulate_insert_ins(tc, arg_info->prepargs_bb,
arg_info->prepargs_ins->prev, guard);
MVM_spesh_usages_add_by_reg(tc, g, arg_info->arg_ins[arg_idx]->operands[1], guard);

/* Also give the instruction a deopt annotation. */
MVM_spesh_graph_add_deopt_annotation(tc, g, guard, deopt_target,
Expand Down Expand Up @@ -1551,6 +1552,7 @@ static void tweak_for_target_sf(MVMThreadContext *tc, MVMSpeshGraph *g,
MVM_spesh_manipulate_insert_ins(tc, arg_info->prepargs_bb,
arg_info->prepargs_ins->prev, resolve);
MVM_spesh_get_facts(tc, g, temp)->writer = resolve;
MVM_spesh_usages_add_by_reg(tc, g, resolve->operands[1], resolve);

/* Insert guard instruction before the prepargs. */
deopt_target = find_deopt_target(tc, g, arg_info->prepargs_ins);
Expand Down

0 comments on commit 0ef24ff

Please sign in to comment.