Skip to content

Commit

Permalink
free STables in the global destruction...
Browse files Browse the repository at this point in the history
  • Loading branch information
diakopter committed Sep 5, 2013
1 parent 0c8cf07 commit d39e357
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
12 changes: 12 additions & 0 deletions src/gc/collect.c
Expand Up @@ -551,6 +551,18 @@ void MVM_gc_collect_cleanup_gen2roots(MVMThreadContext *tc) {
tc->num_gen2roots = ins_pos;
}

/* Free STables (in any thread/generation!) queued to be freed. */
void MVM_gc_collect_free_stables(MVMThreadContext *tc) {
MVMSTable *st = tc->instance->stables_to_free;
while (st) {
MVMSTable *st_to_free = st;
st = (MVMSTable *)st_to_free->header.forwarder;
st_to_free->header.forwarder = NULL;
MVM_6model_stable_gc_free(tc, st_to_free);
}
tc->instance->stables_to_free = NULL;
}

/* Goes through the unmarked objects in the second generation heap and builds
* free lists out of them. Also does any required finalization. */
void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *tc) {
Expand Down
1 change: 1 addition & 0 deletions src/gc/collect.h
Expand Up @@ -52,3 +52,4 @@ void MVM_gc_collect_free_nursery_uncopied(MVMThreadContext *tc, void *limit);
void MVM_gc_collect_cleanup_gen2roots(MVMThreadContext *tc);
void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *tc);
void MVM_gc_mark_collectable(MVMThreadContext *tc, MVMGCWorklist *worklist, MVMCollectable *item);
void MVM_gc_collect_free_stables(MVMThreadContext *tc);
10 changes: 2 additions & 8 deletions src/gc/orchestrate.c
Expand Up @@ -213,14 +213,7 @@ static void finish_gc(MVMThreadContext *tc, MVMuint8 gen) {
* deletion. It's okay for us to muck around in
* another thread's fromspace while it's mutating
* tospace, really. */
MVMSTable *st = tc->instance->stables_to_free;
while (st) {
MVMSTable *st_to_free = st;
st = (MVMSTable *)st_to_free->header.forwarder;
st_to_free->header.forwarder = NULL;
MVM_6model_stable_gc_free(tc, st_to_free);
}
tc->instance->stables_to_free = NULL;
MVM_gc_collect_free_stables(tc);

/* Set it to zero (we're guaranteed the only ones
* trying to write to it here). */
Expand Down Expand Up @@ -441,4 +434,5 @@ void MVM_gc_global_destruction(MVMThreadContext *tc) {
MVM_gc_collect_free_nursery_uncopied(tc, tc->nursery_alloc);
MVM_gc_collect_cleanup_gen2roots(tc);
MVM_gc_collect_free_gen2_unmarked(tc);
MVM_gc_collect_free_stables(tc);
}

0 comments on commit d39e357

Please sign in to comment.