Skip to content

Commit

Permalink
Merge pull request #161 from MPLLang/silly-init-bug
Browse files Browse the repository at this point in the history
Silly init bug
  • Loading branch information
shwestrick authored Jun 24, 2022
2 parents 88bc244 + e0c3efb commit 61cbcd3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions basis-library/schedulers/shh/Scheduler.sml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ struct
if HH.getDepth originalThread = 0 then ()
else die (fn _ => "scheduler bug: root depth <> 0")
val _ = HH.setDepth (originalThread, 1)
val _ = HH.forceLeftHeap (myWorkerId (), originalThread)

(* implicitly attaches worker child heaps *)
val _ = MLton.Parallel.initializeProcessors ()
Expand Down
9 changes: 9 additions & 0 deletions runtime/gc/cc-work-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ void CC_workList_init(
w->currentChunk = HM_allocateChunk(c, sizeof(struct CC_workList_elem));
}

void CC_workList_free(
__attribute__((unused)) GC_state s,
CC_workList w)
{

HM_chunkList c = &(w->storage);
HM_freeChunksInListWithInfo(s, c, NULL);
w->currentChunk = NULL;
}

bool CC_workList_isEmpty(
__attribute__((unused)) GC_state s,
Expand Down
1 change: 1 addition & 0 deletions runtime/gc/cc-work-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef struct CC_workList_range * CC_workList_range;

bool CC_workList_isEmpty(GC_state s, CC_workList w);
void CC_workList_init(GC_state s, CC_workList w);
void CC_workList_free(GC_state s, CC_workList w);
void CC_workList_push(GC_state s, CC_workList w, objptr op);

/** Returns a single field of an object that still needs to be traced.
Expand Down
1 change: 1 addition & 0 deletions runtime/gc/concurrent-collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ size_t CC_collectWithRoots(
HM_freeChunksInList(s, removedFromCCBag);

assert(CC_workList_isEmpty(s, &(lists.worklist)));
CC_workList_free(s, &(lists.worklist));

#if ASSERT2 // just contains code that is sometimes useful for debugging.
HM_assertChunkListInvariants(origList);
Expand Down

0 comments on commit 61cbcd3

Please sign in to comment.