X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsStartup.c;h=6abeb404a073bb128c861ff4564a844f77758f77;hb=a26e1e3310f4c92196fe6b4d407f72f3c6824132;hp=fd84000bba48b3d3b402ce713286164296a1edbd;hpb=4e1f1196f1349286c1480c19bd3a000346a120f4;p=ghc-hetmet.git diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index fd84000..6abeb40 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -225,11 +225,19 @@ hs_init(int *argc, char **argv[]) /* initialise the stable pointer table */ initStablePtrTable(); - /* Add some GC roots (using stable pointers): these are needed by - * all foreign export stubs, so they have to be treated as + /* Add some GC roots for things in the base package that the RTS + * knows about. We don't know whether these turn out to be CAFs + * or refer to CAFs, but we have to assume that they might. */ getStablePtr((StgPtr)base_GHCziTopHandler_runIO_closure); getStablePtr((StgPtr)base_GHCziTopHandler_runNonIO_closure); + getStablePtr((StgPtr)stackOverflow_closure); + getStablePtr((StgPtr)heapOverflow_closure); + getStablePtr((StgPtr)runFinalizerBatch_closure); + getStablePtr((StgPtr)unpackCString_closure); + getStablePtr((StgPtr)blockedOnDeadMVar_closure); + getStablePtr((StgPtr)nonTermination_closure); + getStablePtr((StgPtr)blockedIndefinitely_closure); /* initialise the shared Typeable store */ initTypeableStore(); @@ -406,6 +414,9 @@ hs_exit_(rtsBool wait_foreign) /* stop all running tasks */ exitScheduler(wait_foreign); + + /* run C finalizers for all active weak pointers */ + runAllCFinalizers(weak_ptr_list); #if defined(GRAN) /* end_gr_simulation prints global stats if requested -- HWL */