Skip to content

Commit

Permalink
Add missing inline arg count check.
Browse files Browse the repository at this point in the history
We only collect information on up to a certain number of args. Without
this, we try to resolve arg instructions beyond the end of the buffer,
which innevitably works out rather badly.
  • Loading branch information
jnthn committed Feb 8, 2015
1 parent 71fd576 commit 679d06f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/spesh/inline.c
Expand Up @@ -99,6 +99,15 @@ MVMSpeshGraph * MVM_spesh_inline_try_get_graph(MVMThreadContext *tc, MVMSpeshGra
goto not_inlinable;
}

/* Check we don't have too many args for inlining to work out. */
if (ins->info->opcode == MVM_OP_sp_getarg_o ||
ins->info->opcode == MVM_OP_sp_getarg_i ||
ins->info->opcode == MVM_OP_sp_getarg_n ||
ins->info->opcode == MVM_OP_sp_getarg_s) {
if (ins->operands[1].lit_i16 >= MAX_ARGS_FOR_OPT)
goto not_inlinable;
}

/* Ext-ops need special care in inter-comp-unit inlines. */
if (ins->info->opcode == (MVMuint16)-1) {
MVMCompUnit *target_cu = inliner->sf->body.cu;
Expand Down

0 comments on commit 679d06f

Please sign in to comment.