Skip to content

Commit

Permalink
Optimize bindattr_o on P6opaque when possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Apr 6, 2014
1 parent 646affd commit c2eae34
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/6model/reprs/P6opaque.c
Expand Up @@ -1313,8 +1313,22 @@ static void spesh(MVMThreadContext *tc, MVMSTable *st, MVMSpeshGraph *g, MVMSpes
ins->operands[1].lit_i16 = st->size;
ins->operands[2].lit_i16 = MVM_spesh_add_spesh_slot(tc, g, (MVMCollectable *)st);
MVM_spesh_get_facts(tc, g, type)->usages--;
break;
}
break;
}
case MVM_OP_bindattr_o: {
MVMSpeshFacts *ch_facts = MVM_spesh_get_facts(tc, g, ins->operands[1]);
if (ch_facts->flags & MVM_SPESH_FACT_KNOWN_TYPE && ch_facts->type) {
MVMint64 slot = try_get_slot(tc, repr_data, ch_facts->type,
MVM_spesh_get_string(tc, g, ins->operands[2]));
if (slot >= 0 && !repr_data->flattened_stables[slot]) {
MVM_spesh_get_facts(tc, g, ins->operands[1])->usages--;
ins->info = MVM_op_get_op(MVM_OP_sp_p6obind_o);
ins->operands[1].lit_i16 = repr_data->attribute_offsets[slot];
ins->operands[2] = ins->operands[3];
}
}
break;
}
}
}
Expand Down

0 comments on commit c2eae34

Please sign in to comment.