Skip to content

Commit

Permalink
JIT compile getsignals
Browse files Browse the repository at this point in the history
Although this probably isn't likely to be part of any hot code path,
adding JIT support for the getsignals op.
  • Loading branch information
jstuder-gh committed Jun 3, 2018
1 parent 213f323 commit 943980b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/jit/core_templates.expr
Expand Up @@ -818,6 +818,11 @@
(carg $3 ptr)
(carg $5 int_sz)) ptr_sz))

(template: getsignals
(call (^func &MVM_io_get_signals)
(arglist
(carg (tc) ptr)) ptr_sz))

(template: slice!
(let: (
($dest (call (^getf (^repr $1) MVMREPROps allocate)
Expand Down
7 changes: 7 additions & 0 deletions src/jit/graph.c
Expand Up @@ -324,6 +324,7 @@ static void * op_to_func(MVMThreadContext *tc, MVMint16 opcode) {
case MVM_OP_decont_s: return MVM_6model_container_decont_s;
case MVM_OP_getrusage: return MVM_proc_getrusage;
case MVM_OP_cpucores: return MVM_platform_cpu_count;
case MVM_OP_getsignals: return MVM_io_get_signals;
case MVM_OP_sleep: return MVM_platform_sleep;
case MVM_OP_getlexref_i32: case MVM_OP_getlexref_i16: case MVM_OP_getlexref_i8: case MVM_OP_getlexref_i: return MVM_nativeref_lex_i;
case MVM_OP_getlexref_n32: case MVM_OP_getlexref_n: return MVM_nativeref_lex_n;
Expand Down Expand Up @@ -3104,6 +3105,12 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
jg_append_call_c(tc, jg, op_to_func(tc, op), 0, NULL, MVM_JIT_RV_INT, dst);
break;
}
case MVM_OP_getsignals: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMJitCallArg args[] = { { MVM_JIT_INTERP_VAR, { MVM_JIT_INTERP_TC } } };
jg_append_call_c(tc, jg, op_to_func(tc, op), 1, args, MVM_JIT_RV_PTR, dst);
break;
}
case MVM_OP_sleep: {
MVMint16 time = ins->operands[0].reg.orig;
MVMJitCallArg block_args[] = { { MVM_JIT_INTERP_VAR, { MVM_JIT_INTERP_TC } } };
Expand Down

0 comments on commit 943980b

Please sign in to comment.