Skip to content

Commit

Permalink
Turn elems On VMArray Into Direct Memory Access
Browse files Browse the repository at this point in the history
replace the full function call, which was far
too much overhead just to read an integer at
an offset inside the object.
  • Loading branch information
timo committed Dec 26, 2018
1 parent afd8f93 commit 45d15ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/6model/reprs/VMArray.c
Expand Up @@ -1363,6 +1363,18 @@ static void spesh(MVMThreadContext *tc, MVMSTable *st, MVMSpeshGraph *g, MVMSpes
}
break;
}
case MVM_OP_elems: {
MVMSpeshOperand target = ins->operands[0];
MVMSpeshOperand obj = ins->operands[1];

MVM_spesh_graph_add_comment(tc, g, ins, "specialized from elems on VMArray");

ins->info = MVM_op_get_op(MVM_OP_sp_get_i64);
ins->operands = MVM_spesh_alloc(tc, g, 3 * sizeof(MVMSpeshOperand));
ins->operands[0] = target;
ins->operands[1] = obj;
ins->operands[2].lit_i16 = offsetof(MVMArray, body.elems);
}
}
}

Expand Down

0 comments on commit 45d15ef

Please sign in to comment.