Skip to content

Instantly share code, notes, and snippets.

@timo
Created August 16, 2014 08:55
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/ccf81437e03e276d8a88 to your computer and use it in GitHub Desktop.
Save timo/ccf81437e03e276d8a88 to your computer and use it in GitHub Desktop.
diff --git a/src/core/oplist b/src/core/oplist
index a476a83..f5d5d3d 100644
--- a/src/core/oplist
+++ b/src/core/oplist
@@ -593,7 +593,7 @@ continuationcontrol w(obj) r(int64) r(obj) r(obj)
continuationinvoke w(obj) r(obj) r(obj)
randscale_n w(num64) r(num64) :pure
uniisblock w(int64) r(str) r(int64) r(str) :pure
-assertparamcheck r(int64) :noinline
+assertparamcheck r(int64) :noinline :throwish
hintfor w(int64) r(obj) r(str)
paramnamesused :noinline
getuniname w(str) r(int64)
diff --git a/src/core/ops.c b/src/core/ops.c
index 27e4a38..5d9cb55 100644
--- a/src/core/ops.c
+++ b/src/core/ops.c
@@ -6128,7 +6128,7 @@ static MVMOpInfo MVM_op_infos[] = {
0,
0,
1,
- 0,
+ 2,
{ MVM_operand_read_reg | MVM_operand_int64 }
},
{
diff --git a/src/jit/emit_x64.dasc b/src/jit/emit_x64.dasc
index 6b72f79..b015896 100644
--- a/src/jit/emit_x64.dasc
+++ b/src/jit/emit_x64.dasc
@@ -1061,6 +1061,15 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitGraph *jg,
| callp &MVM_args_assert_nameds_used;
|1:
break;
+ case MVM_OP_assertparamcheck: {
+ MVMint16 ok = ins->operands[0].reg.orig;
+ | mov TMP1, qword WORK[ok];
+ | test TMP1, TMP1;
+ | jz >1;
+ | callp &MVM_args_bind_failed;
+ |1:
+ break;
+ }
default:
MVM_exception_throw_adhoc(tc, "Can't JIT opcode <%s>", ins->info->name);
}
diff --git a/src/jit/graph.c b/src/jit/graph.c
index 64f0524..88ffcd4 100644
--- a/src/jit/graph.c
+++ b/src/jit/graph.c
@@ -697,6 +697,7 @@ static MVMint32 jgb_consume_ins(MVMThreadContext *tc, JitGraphBuilder *jgb,
case MVM_OP_getlexstatic_o:
case MVM_OP_getlexperinvtype_o:
case MVM_OP_paramnamesused:
+ case MVM_OP_assertparamcheck:
jgb_append_primitive(tc, jgb, ins);
break;
/* branches */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment