Skip to content

Commit

Permalink
Don't install "hidden" OSRs in new arg guards.
Browse files Browse the repository at this point in the history
These are technically dupes today. This issue will be revisited when
OSR gets a larger overhauling during the move to doing it on the spesh
worker thread.
  • Loading branch information
jnthn committed Jul 6, 2017
1 parent 4120f7f commit 2a99ecd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/spesh/candidate.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ MVMSpeshCandidate * MVM_spesh_candidate_setup(MVMThreadContext *tc,
uv_mutex_lock(&tc->instance->mutex_spesh_install);
if (static_frame->body.num_spesh_candidates < MVM_SPESH_LIMIT) {
MVMint32 num_spesh = static_frame->body.num_spesh_candidates;
MVMint32 existing_match = 0;
MVMint32 i;
for (i = 0; i < num_spesh; i++) {
MVMSpeshCandidate *compare = &static_frame->body.spesh_candidates[i];
if (compare->cs == callsite && compare->num_guards == num_guards &&
memcmp(compare->guards, guards, num_guards * sizeof(MVMSpeshGuard)) == 0) {
/* Beaten! */
result = osr ? NULL : &static_frame->body.spesh_candidates[i];
existing_match = 1;
break;
}
}
Expand Down Expand Up @@ -160,8 +162,9 @@ MVMSpeshCandidate * MVM_spesh_candidate_setup(MVMThreadContext *tc,
if (osr)
result->osr_logging = 1;
MVM_barrier();
_tmp_add_new_guard(tc, static_frame, result,
static_frame->body.num_spesh_candidates++);
if (!existing_match)
_tmp_add_new_guard(tc, static_frame, result,
static_frame->body.num_spesh_candidates++);
if (static_frame->common.header.flags & MVM_CF_SECOND_GEN)
MVM_gc_write_barrier_hit(tc, (MVMCollectable *)static_frame);
if (tc->instance->spesh_log_fh) {
Expand Down

0 comments on commit 2a99ecd

Please sign in to comment.