#include "ThreadLabels.h"
#include "BlockAlloc.h"
#include "Trace.h"
-#include "RtsTypeable.h"
+#include "RtsGlobals.h"
#include "Stable.h"
#include "Hpc.h"
#include "FileLock.h"
+#include "EventLog.h"
#if defined(RTS_GTK_FRONTPANEL)
#include "FrontPanel.h"
#endif
/* initTracing must be after setupRtsFlags() */
+#ifdef DEBUG
initTracing();
+#endif
#if defined(PAR)
/* NB: this really must be done after processing the RTS flags */
getStablePtr((StgPtr)blockedIndefinitely_closure);
/* initialise the shared Typeable store */
- initTypeableStore();
+ initGlobalStore();
/* initialise file locking, if necessary */
#if !defined(mingw32_HOST_OS)
initProfiling1();
+#ifdef EVENTLOG
+ if (RtsFlags.EventLogFlags.doEventLogging) {
+ initEventLogging();
+ }
+#endif
+
/* start the virtual timer 'subsystem'. */
initTimer();
startTimer();
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)
freeScheduler();
/* free shared Typeable store */
- exitTypeableStore();
+ exitGlobalStore();
/* free file locking tables, if necessary */
#if !defined(mingw32_HOST_OS)
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