Skip to content

Instantly share code, notes, and snippets.

@timo
Created August 17, 2014 06:49
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/a9c5a2476b63a9afe842 to your computer and use it in GitHub Desktop.
Save timo/a9c5a2476b63a9afe842 to your computer and use it in GitHub Desktop.
diff --git a/src/jit/emit_x64.dasc b/src/jit/emit_x64.dasc
index d659d04..2f4eaee 100644
--- a/src/jit/emit_x64.dasc
+++ b/src/jit/emit_x64.dasc
@@ -24,6 +24,7 @@
|.type STRING, MVMString*
|.type OBJECTPTR, MVMObject*
|.type CONTAINERSPEC, MVMContainerSpec
+|.type STORAGESPEC, MVMStorageSpec
|.type HLLCONFIG, MVMHLLConfig;
|.type U8, MVMuint8
|.type U16, MVMuint16
@@ -871,6 +872,23 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitGraph *jg,
|2:
break;
}
+ case MVM_OP_objprimspec: {
+ MVMint16 dst = ins->operands[0].reg.orig;
+ MVMint16 type = ins->operands[1].reg.orig;
+ | mov TMP1, aword WORK[type];
+ | test TMP1, TMP1;
+ | jz >1;
+ | mov TMP1, OBJECT:TMP1->st;
+ | mov TMP2, STABLE:TMP1->REPR;
+ | mov FUNCTION, REPR:TMP2->get_storage_spec;
+ | mov ARG1, TC;
+ | mov ARG2, TMP1;
+ | call FUNCTION;
+ | mov TMP1, STORAGESPEC:RV->boxed_primitive;
+ |1:
+ | mov aword WORK[dst], TMP1;
+ break;
+ }
case MVM_OP_isnonnull: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 obj = ins->operands[1].reg.orig;
diff --git a/src/jit/graph.c b/src/jit/graph.c
index 0bc63b2..80b5d0d 100644
--- a/src/jit/graph.c
+++ b/src/jit/graph.c
@@ -692,6 +692,7 @@ static MVMint32 jgb_consume_ins(MVMThreadContext *tc, JitGraphBuilder *jgb,
case MVM_OP_isstr:
case MVM_OP_islist:
case MVM_OP_ishash:
+ case MVM_OP_objprimspec:
case MVM_OP_takehandlerresult:
case MVM_OP_lexoticresult:
case MVM_OP_scwbdisable:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment