Skip to content

Commit

Permalink
Log more info about OSR when it doesn't work out
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Sep 22, 2021
1 parent e743b1b commit 366cd22
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/spesh/osr.c
Expand Up @@ -125,16 +125,31 @@ void MVM_spesh_osr_poll_for_result(MVMThreadContext *tc) {
MVMint32 seq_nr = tc->cur_frame->sequence_nr;
if (seq_nr != tc->osr_hunt_frame_nr || num_cands != tc->osr_hunt_num_spesh_candidates) {
/* Provided OSR is enabled... */
if (tc->instance->spesh_osr_enabled
/* and no snapshots were taken, otherwise we'd invalidate the positions */
&& (!tc->cur_frame->extra || !tc->cur_frame->extra->caller_info_needed)
) {
/* Check if there's a candidate available and install it if so. */
MVMint32 ag_result = MVM_spesh_arg_guard_run(tc,
spesh->body.spesh_arg_guard,
tc->cur_frame->params.arg_info, NULL);
if (ag_result >= 0)
perform_osr(tc, spesh->body.spesh_candidates[ag_result]);
if (tc->instance->spesh_osr_enabled) {
/* ...and no snapshots were taken, otherwise we'd invalidate the positions */
if (!tc->cur_frame->extra || !tc->cur_frame->extra->caller_info_needed) {
/* Check if there's a candidate available and install it if so. */
MVMint32 ag_result = MVM_spesh_arg_guard_run(tc,
spesh->body.spesh_arg_guard,
tc->cur_frame->params.arg_info, NULL);
if (ag_result >= 0) {
perform_osr(tc, spesh->body.spesh_candidates[ag_result]);
}
else {
#if MVM_LOG_OSR
fprintf(stderr, "Considered OSR but arg guard failed in '%s' (cuid: %s)\n",
MVM_string_utf8_encode_C_string(tc, tc->cur_frame->static_info->body.name),
MVM_string_utf8_encode_C_string(tc, tc->cur_frame->static_info->body.cuuid));
#endif
}
}
else {
#if MVM_LOG_OSR
fprintf(stderr, "Unable to perform OSR due to caller info '%s' (cuid: %s)\n",
MVM_string_utf8_encode_C_string(tc, tc->cur_frame->static_info->body.name),
MVM_string_utf8_encode_C_string(tc, tc->cur_frame->static_info->body.cuuid));
#endif
}
}

/* Update state for avoiding checks in the common case. */
Expand Down

0 comments on commit 366cd22

Please sign in to comment.