Skip to content

Instantly share code, notes, and snippets.

@timo
Created August 16, 2014 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/4dc3eb65b316b9adfc3c to your computer and use it in GitHub Desktop.
Save timo/4dc3eb65b316b9adfc3c to your computer and use it in GitHub Desktop.
diff --git a/src/jit/emit_x64.dasc b/src/jit/emit_x64.dasc
index 8e83090..666e7e8 100644
--- a/src/jit/emit_x64.dasc
+++ b/src/jit/emit_x64.dasc
@@ -929,6 +929,26 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitGraph *jg,
|2:
break;
}
+ case MVM_OP_iscont: {
+ MVMint16 dst = ins->operands[0].reg.orig;
+ MVMint16 src = ins->operands[1].reg.orig;
+ | mov TMP1, WORK[src];
+ | test TMP1, TMP1;
+ // obj is null
+ | jz >1;
+ | mov TMP2, OBJECT:TMP1->st;
+ | mov TMP2, STABLE:TMP2->container_spec;
+ | test TMP2, TMP2;
+ // container spec is zero
+ | jz >1;
+ // we're here: obj is non-null and container_spec is non-null.
+ | mov qword WORK[dst], 1;
+ | jmp >2;
+ |1:
+ | mov qword WORK[dst], 0;
+ |2:
+ break;
+ }
case MVM_OP_sp_namedarg_used: {
MVMuint16 param = ins->operands[0].lit_i16;
| mov TMP1, FRAME->params.named_used;
diff --git a/src/jit/graph.c b/src/jit/graph.c
index c02bb08..5a0864b 100644
--- a/src/jit/graph.c
+++ b/src/jit/graph.c
@@ -674,6 +674,7 @@ static MVMint32 jgb_consume_ins(MVMThreadContext *tc, JitGraphBuilder *jgb,
case MVM_OP_getcode:
case MVM_OP_sp_fastcreate:
case MVM_OP_decont:
+ case MVM_OP_iscont:
case MVM_OP_sp_namedarg_used:
case MVM_OP_sp_findmeth:
case MVM_OP_hllboxtype_i:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment