X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsStartup.c;h=f10de578c74c5308271e66a18350d1784b1bf91c;hb=a11662957fa688997e6c4befff44e7efe94c2db8;hp=fbebdb9c41d2513a12a3163a0a627cc74b0885d0;hpb=cb73be0180baa84ee4bfe2294d110cb440b367fa;p=ghc-hetmet.git diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index fbebdb9..f10de57 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -34,6 +34,7 @@ #include "Stable.h" #include "Hpc.h" #include "FileLock.h" +#include "EventLog.h" #if defined(RTS_GTK_FRONTPANEL) #include "FrontPanel.h" @@ -195,7 +196,9 @@ hs_init(int *argc, char **argv[]) #endif /* initTracing must be after setupRtsFlags() */ +#ifdef DEBUG initTracing(); +#endif #if defined(PAR) /* NB: this really must be done after processing the RTS flags */ @@ -254,6 +257,12 @@ hs_init(int *argc, char **argv[]) initProfiling1(); +#ifdef EVENTLOG + if (RtsFlags.EventLogFlags.doEventLogging) { + initEventLogging(); + } +#endif + /* start the virtual timer 'subsystem'. */ initTimer(); startTimer(); @@ -402,19 +411,22 @@ hs_exit_(rtsBool wait_foreign) OnExitHook(); -#if defined(RTS_USER_SIGNALS) - if (RtsFlags.MiscFlags.install_signal_handlers) { - freeSignalHandlers(); - } -#endif - #if defined(THREADED_RTS) ioManagerDie(); #endif /* stop all running tasks */ exitScheduler(wait_foreign); + + /* run C finalizers for all active weak pointers */ + runAllCFinalizers(weak_ptr_list); +#if defined(RTS_USER_SIGNALS) + if (RtsFlags.MiscFlags.install_signal_handlers) { + freeSignalHandlers(); + } +#endif + #if defined(GRAN) /* end_gr_simulation prints global stats if requested -- HWL */ if (!RtsFlags.GranFlags.GranSimStats.Suppressed) @@ -511,6 +523,13 @@ hs_exit_(rtsBool wait_foreign) if (prof_file != NULL) fclose(prof_file); #endif +#ifdef EVENTLOG + if (RtsFlags.EventLogFlags.doEventLogging) { + endEventLogging(); + freeEventLogging(); + } +#endif + #if defined(TICKY_TICKY) if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo(); #endif