Skip to content

Commit

Permalink
jit throw[cat]{dyn,lex,lexotic}
Browse files Browse the repository at this point in the history
currently hangs execution.
  • Loading branch information
timo committed May 28, 2015
1 parent de45927 commit 4affad6
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/core/oplist
Expand Up @@ -207,12 +207,12 @@ bindexcategory r(obj) r(int64)
getexmessage w(str) r(obj) :pure
getexpayload w(obj) r(obj) :pure
getexcategory w(int64) r(obj) :pure
throwdyn w(obj) r(obj)
throwlex w(obj) r(obj)
throwlexotic w(obj) r(obj)
throwcatdyn w(obj) int64
throwcatlex w(obj) int64
throwcatlexotic w(obj) int64
throwdyn w(obj) r(obj) :throwish
throwlex w(obj) r(obj) :throwish
throwlexotic w(obj) r(obj) :throwish
throwcatdyn w(obj) int64 :throwish
throwcatlex w(obj) int64 :throwish
throwcatlexotic w(obj) int64 :throwish
die w(obj) r(str) :throwish
rethrow r(obj)
resume r(obj)
Expand Down
12 changes: 6 additions & 6 deletions src/core/ops.c
Expand Up @@ -1877,7 +1877,7 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
0,
0,
0,
2,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_obj }
},
{
Expand All @@ -1888,7 +1888,7 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
0,
0,
0,
2,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_obj }
},
{
Expand All @@ -1899,7 +1899,7 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
0,
0,
0,
2,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_obj }
},
{
Expand All @@ -1910,7 +1910,7 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
0,
0,
0,
2,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_int64 }
},
{
Expand All @@ -1921,7 +1921,7 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
0,
0,
0,
2,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_int64 }
},
{
Expand All @@ -1932,7 +1932,7 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
0,
0,
0,
2,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_int64 }
},
{
Expand Down
40 changes: 40 additions & 0 deletions src/jit/graph.c
Expand Up @@ -201,6 +201,12 @@ static void * op_to_func(MVMThreadContext *tc, MVMint16 opcode) {
case MVM_OP_iter: return &MVM_iter;
case MVM_OP_iterval: return &MVM_iterval;
case MVM_OP_die: return &MVM_exception_die;
case MVM_OP_throwdyn:
case MVM_OP_throwlex:
case MVM_OP_throwlexotic: return &MVM_exception_throwobj;
case MVM_OP_throwcatdyn:
case MVM_OP_throwcatlex:
case MVM_OP_throwcatlexotic: return &MVM_exception_throwcat;
case MVM_OP_smrt_numify: return &MVM_coerce_smart_numify;
case MVM_OP_smrt_strify: return &MVM_coerce_smart_stringify;
case MVM_OP_write_fhs: return &MVM_io_write_string;
Expand Down Expand Up @@ -1557,6 +1563,40 @@ static MVMint32 jgb_consume_ins(MVMThreadContext *tc, JitGraphBuilder *jgb,
jgb_append_call_c(tc, jgb, op_to_func(tc, op), 4, args, MVM_JIT_RV_PTR, dst);
break;
}
case MVM_OP_throwdyn:
case MVM_OP_throwlex:
case MVM_OP_throwlexotic: {
MVMint16 regi = ins->operands[0].reg.orig;
MVMint16 object = ins->operands[1].reg.orig;
MVMJitCallArg args[] = { { MVM_JIT_INTERP_VAR, { MVM_JIT_INTERP_TC } },
{ MVM_JIT_LITERAL, {
op == MVM_OP_throwdyn ? MVM_EX_THROW_DYN :
op == MVM_OP_throwlex ? MVM_EX_THROW_LEX :
MVM_EX_THROW_LEXOTIC
} },
{ MVM_JIT_REG_VAL, { object } },
{ MVM_JIT_REG_ADDR, { regi } }};
jgb_append_call_c(tc, jgb, op_to_func(tc, op),
4, args, MVM_JIT_RV_VOID, -1);
break;
}
case MVM_OP_throwcatdyn:
case MVM_OP_throwcatlex:
case MVM_OP_throwcatlexotic: {
MVMint16 regi = ins->operands[0].reg.orig;
MVMint32 category = (MVMuint32)ins->operands[1].lit_i64;
MVMJitCallArg args[] = { { MVM_JIT_INTERP_VAR, { MVM_JIT_INTERP_TC } },
{ MVM_JIT_LITERAL, {
op == MVM_OP_throwdyn ? MVM_EX_THROW_DYN :
op == MVM_OP_throwlex ? MVM_EX_THROW_LEX :
MVM_EX_THROW_LEXOTIC
} },
{ MVM_JIT_LITERAL, { category } },
{ MVM_JIT_REG_ADDR, { regi } }};
jgb_append_call_c(tc, jgb, op_to_func(tc, op),
4, args, MVM_JIT_RV_VOID, -1);
break;
}
case MVM_OP_die: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 str = ins->operands[1].reg.orig;
Expand Down

0 comments on commit 4affad6

Please sign in to comment.