Skip to content

Commit

Permalink
[JIT] Implement ctxouter
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw committed Jun 24, 2018
1 parent 10f915d commit f14f023
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/jit/graph.c
Expand Up @@ -1628,6 +1628,7 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
case MVM_OP_takedispatcher:
case MVM_OP_setdispatcher:
case MVM_OP_ctx:
case MVM_OP_ctxouter:
case MVM_OP_ctxlexpad:
case MVM_OP_curcode:
case MVM_OP_getcode:
Expand Down
24 changes: 24 additions & 0 deletions src/jit/x64/emit.dasc
Expand Up @@ -839,6 +839,30 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJ
| mov WORK[dst], RV;
break;
}
case MVM_OP_ctxouter: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 ctx = ins->operands[1].reg.orig;
| mov TMP1, WORK[ctx];
| test_type_object TMP1;
| jnz >1;
| cmp_repr_id TMP1, TMP2, MVM_REPR_ID_MVMContext;
| je >2;
|1:
| throw_adhoc "ctxouter needs an MVMContext";
|2:
| mov TMP2, CONTEXT:TMP1->body.context;
| mov ARG2, FRAME:TMP2->outer;
| test ARG2, ARG2;
| jz >3;
| mov ARG1, TC;
| callp &MVM_frame_context_wrapper;
| jmp >4;
|3:
| get_vmnull RV;
|4:
| mov WORK[dst], RV;
break;
}
case MVM_OP_ctxlexpad: {
MVMint16 src = ins->operands[1].reg.orig;
MVMint16 dst = ins->operands[0].reg.orig;
Expand Down

0 comments on commit f14f023

Please sign in to comment.