Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created May 10, 2014 22:54
Show Gist options
  • Save jnthn/9ea815130e5d361c5e62 to your computer and use it in GitHub Desktop.
Save jnthn/9ea815130e5d361c5e62 to your computer and use it in GitHub Desktop.
--- a/src/spesh/candidate.c
+++ b/src/spesh/candidate.c
@@ -13,10 +13,13 @@ MVMSpeshCandidate * MVM_spesh_candidate_setup(MVMThreadContext *tc,
MVMint32 num_spesh_slots, num_log_slots, num_guards, *deopts, num_deopts;
MVMCollectable **spesh_slots, **log_slots;
char *before, *after;
+ MVMSpeshGraph *sg;
+
+ MVM_gc_allocate_gen2_default_set(tc);
/* Do initial generation of the specialization, working out the argument
* guards and adding logging. */
- MVMSpeshGraph *sg = MVM_spesh_graph_create(tc, static_frame);
+ sg = MVM_spesh_graph_create(tc, static_frame);
if (tc->instance->spesh_log_fh)
before = MVM_spesh_dump(tc, sg);
MVM_spesh_args(tc, sg, callsite, args);
@@ -98,6 +101,8 @@ MVMSpeshCandidate * MVM_spesh_candidate_setup(MVMThreadContext *tc,
}
uv_mutex_unlock(&tc->instance->mutex_spesh_install);
+ MVM_gc_allocate_gen2_default_clear(tc);
+
free(sc);
return result;
}
@@ -109,9 +114,12 @@ MVMSpeshCandidate * MVM_spesh_candidate_setup(MVMThreadContext *tc,
void MVM_spesh_candidate_specialize(MVMThreadContext *tc, MVMStaticFrame *static_frame,
MVMSpeshCandidate *candidate) {
MVMSpeshCode *sc;
+ MVMSpeshGraph *sg;
+ MVM_gc_allocate_gen2_default_set(tc);
+
/* Obtain the graph, add facts, and do optimization work. */
- MVMSpeshGraph *sg = candidate->sg;
+ sg = candidate->sg;
MVM_spesh_facts_discover(tc, sg);
MVM_spesh_optimize(tc, sg);
@@ -155,4 +163,6 @@ void MVM_spesh_candidate_specialize(MVMThreadContext *tc, MVMStaticFrame *static
MVM_spesh_graph_destroy(tc, sg);
MVM_barrier();
candidate->sg = NULL;
+
+ MVM_gc_allocate_gen2_default_clear(tc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment