Skip to content

Instantly share code, notes, and snippets.

@timo

timo/bloop.patch Secret

Created February 12, 2019 17:09
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/57a034a32526b4a5f8d13d196d86b562 to your computer and use it in GitHub Desktop.
Save timo/57a034a32526b4a5f8d13d196d86b562 to your computer and use it in GitHub Desktop.
attempt to jit sp_get_i32 and sp_bind_i32
diff --git a/src/jit/graph.c b/src/jit/graph.c
index ffec2f464..e6979326c 100644
--- a/src/jit/graph.c
+++ b/src/jit/graph.c
@@ -1789,11 +1789,13 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
case MVM_OP_sp_p6obind_o:
case MVM_OP_sp_p6obind_i32:
case MVM_OP_sp_bind_i64:
+ case MVM_OP_sp_bind_i32:
case MVM_OP_sp_bind_n:
case MVM_OP_sp_bind_s:
case MVM_OP_sp_bind_s_nowb:
case MVM_OP_sp_bind_o:
case MVM_OP_sp_get_i64:
+ case MVM_OP_sp_get_i32:
case MVM_OP_sp_get_n:
case MVM_OP_sp_get_s:
case MVM_OP_sp_get_o:
diff --git a/src/jit/x64/emit.dasc b/src/jit/x64/emit.dasc
index ec4042e14..c94bbee35 100644
--- a/src/jit/x64/emit.dasc
+++ b/src/jit/x64/emit.dasc
@@ -779,6 +779,15 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJ
| mov qword [TMP1+offset], TMP2; // store value into body
break;
}
+ case MVM_OP_sp_bind_i32: {
+ MVMint16 obj = ins->operands[0].reg.orig;
+ MVMint16 offset = ins->operands[1].lit_i16;
+ MVMint16 val = ins->operands[2].reg.orig;
+ | mov TMP1, WORK[obj]; // object
+ | mov TMP2, WORK[val]; // value
+ | mov dword [TMP1+offset], TMP2d; // store value into body
+ break;
+ }
case MVM_OP_sp_get_i64:
case MVM_OP_sp_get_n:
case MVM_OP_sp_get_s:
@@ -791,6 +800,16 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJ
| mov WORK[dst], TMP2;
break;
}
+ case MVM_OP_sp_get_i32: {
+ MVMint16 dst = ins->operands[0].reg.orig;
+ MVMint16 obj = ins->operands[1].reg.orig;
+ MVMint16 offset = ins->operands[2].lit_i16;
+ | mov TMP1, WORK[obj]; // object
+ | mov RV, [TMP1+offset]; // get value from body
+ | cdqe;
+ | mov WORK[dst], RV;
+ break;
+ }
case MVM_OP_sp_deref_bind_i64:
case MVM_OP_sp_deref_bind_n: {
MVMint16 obj = ins->operands[0].reg.orig;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment