Skip to content

Commit

Permalink
Log return type in return from JIT to unspesh'd
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Aug 9, 2018
1 parent 5119780 commit 286b560
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/jit/core_templates.expr
Expand Up @@ -80,6 +80,10 @@

(template: return_o
(dov
(callv (^func &MVM_spesh_log_return_type_from_jit)
(arglist
(carg (tc) ptr)
(carg $0 ptr)))
(callv (^func &MVM_args_set_result_obj)
(arglist
(carg (tc) ptr)
Expand Down
2 changes: 2 additions & 0 deletions src/jit/graph.c
Expand Up @@ -3240,6 +3240,8 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
if (op == MVM_OP_return_n) {
args[1].type = MVM_JIT_REG_VAL_F;
}
if (op == MVM_OP_return_o)
jg_append_call_c(tc, jg, &MVM_spesh_log_return_type_from_jit, 2, args, MVM_JIT_RV_VOID, -1);
jg_append_call_c(tc, jg, op_to_func(tc, op), 3, args, MVM_JIT_RV_VOID, -1);
/* reuse args for tc arg */
jg_append_call_c(tc, jg, &MVM_frame_try_return, 1, args, MVM_JIT_RV_VOID, -1);
Expand Down
7 changes: 7 additions & 0 deletions src/spesh/log.c
Expand Up @@ -212,6 +212,13 @@ void MVM_spesh_log_return_type(MVMThreadContext *tc, MVMObject *value) {
commit_entry(tc, sl);
}

/* Inserted by the JIT on return_o so that it can do the appropriate thing.
* There may be ways to optimize this. */
void MVM_spesh_log_return_type_from_jit(MVMThreadContext *tc, MVMObject *value) {
if (MVM_spesh_log_is_caller_logging(tc))
MVM_spesh_log_return_type(tc, value);
}

/* Log the result of a spesh plugin resolution. */
void MVM_spesh_log_plugin_resolution(MVMThreadContext *tc, MVMuint32 bytecode_offset,
MVMuint16 guard_index) {
Expand Down
1 change: 1 addition & 0 deletions src/spesh/log.h
Expand Up @@ -47,5 +47,6 @@ void MVM_spesh_log_decont(MVMThreadContext *tc, MVMuint8 *prev_op, MVMObject *va
void MVM_spesh_log_invoke_target(MVMThreadContext *tc, MVMObject *invoke_target,
MVMuint16 was_multi);
void MVM_spesh_log_return_type(MVMThreadContext *tc, MVMObject *value);
void MVM_spesh_log_return_type_from_jit(MVMThreadContext *tc, MVMObject *value);
void MVM_spesh_log_plugin_resolution(MVMThreadContext *tc, MVMuint32 bytecode_offset,
MVMuint16 guard_index);

0 comments on commit 286b560

Please sign in to comment.