From 43d6006058d4561d0cdc00099fb7d77aabce7a38 Mon Sep 17 00:00:00 2001 From: Jatin Arora Date: Mon, 20 Jun 2022 13:54:29 -0400 Subject: [PATCH 1/2] fix --- runtime/gc/cc-work-list.c | 9 +++++++++ runtime/gc/cc-work-list.h | 1 + runtime/gc/concurrent-collection.c | 1 + 3 files changed, 11 insertions(+) diff --git a/runtime/gc/cc-work-list.c b/runtime/gc/cc-work-list.c index 40eb40937..1724fa8b9 100644 --- a/runtime/gc/cc-work-list.c +++ b/runtime/gc/cc-work-list.c @@ -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, diff --git a/runtime/gc/cc-work-list.h b/runtime/gc/cc-work-list.h index d66b23c68..c30eff34a 100644 --- a/runtime/gc/cc-work-list.h +++ b/runtime/gc/cc-work-list.h @@ -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. diff --git a/runtime/gc/concurrent-collection.c b/runtime/gc/concurrent-collection.c index fa100ce28..47c9d97e2 100644 --- a/runtime/gc/concurrent-collection.c +++ b/runtime/gc/concurrent-collection.c @@ -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); From e0c3efb71736da1ab88a28c1bf2fa3de4aca1e7d Mon Sep 17 00:00:00 2001 From: Jatin Arora Date: Thu, 23 Jun 2022 19:09:43 -0400 Subject: [PATCH 2/2] fix init bug --- basis-library/schedulers/shh/Scheduler.sml | 1 + 1 file changed, 1 insertion(+) diff --git a/basis-library/schedulers/shh/Scheduler.sml b/basis-library/schedulers/shh/Scheduler.sml index a97c85312..001ae240c 100644 --- a/basis-library/schedulers/shh/Scheduler.sml +++ b/basis-library/schedulers/shh/Scheduler.sml @@ -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 ()