[project @ 2001-03-02 14:25:04 by simonmar]
[ghc-hetmet.git] / ghc / rts / RtsStartup.c
index f992f1b..840ebf2 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.43 2000/10/06 15:35:47 simonmar Exp $
+ * $Id: RtsStartup.c,v 1.49 2001/02/11 17:51:08 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
 #include "StgRun.h"
 #include "StgStartup.h"
 #include "Prelude.h"           /* fixupRTStoPreludeRefs */
-
-#ifdef GHCI
 #include "HsFFI.h"
 #include "Linker.h"
+
+#if defined(RTS_GTK_FRONTPANEL)
+#include "FrontPanel.h"
 #endif
 
 #if defined(PROFILING) || defined(DEBUG)
@@ -55,7 +56,7 @@ static ullong startTime = 0;
 #endif
 
 EXTFUN(__init_Prelude);
-static void initModules ( void * );
+static void initModules ( void (*)(void) );
 
 void
 setProgArgv(int argc, char *argv[])
@@ -78,7 +79,7 @@ getProgArgv(int *argc, char **argv[])
 
 
 void
-startupHaskell(int argc, char *argv[], void *init_root)
+startupHaskell(int argc, char *argv[], void (*init_root)(void))
 {
     /* To avoid repeated initialisations of the RTS */
    if (rts_has_started_up)
@@ -89,7 +90,7 @@ startupHaskell(int argc, char *argv[], void *init_root)
     /* The very first thing we do is grab the start time...just in case we're
      * collecting timing statistics.
      */
-    start_time();
+    stat_startInit();
 
 #ifdef PAR
 /*
@@ -148,11 +149,6 @@ startupHaskell(int argc, char *argv[], void *init_root)
     /* initialize the storage manager */
     initStorage();
 
-    /* initialise the object linker, if necessary */
-#ifdef GHCI
-    initLinker();
-#endif
-
     /* initialise the stable pointer table */
     initStablePtrTable();
 
@@ -161,9 +157,7 @@ startupHaskell(int argc, char *argv[], void *init_root)
 #endif
 
     /* run the per-module initialisation code */
-#if !defined(INTERPRETER)
     initModules(init_root);
-#endif
 
 #if defined(PROFILING) || defined(DEBUG)
     initProfiling2();
@@ -188,16 +182,14 @@ startupHaskell(int argc, char *argv[], void *init_root)
     init_default_handlers();
 #endif
  
-#if !defined(INTERPRETER)
-    /* Initialise pointers from the RTS to the prelude.  
-       Only for compiled code -- the interpreter
-       will call this itself later, so don't do so now.
-    */
-    fixupRTStoPreludeRefs(NULL);
+#ifdef RTS_GTK_FRONTPANEL
+    if (RtsFlags.GcFlags.frontpanel) {
+       initFrontPanel();
+    }
 #endif
 
     /* Record initialization times */
-    end_init();
+    stat_endInit();
 }
 
 /* -----------------------------------------------------------------------------
@@ -232,9 +224,8 @@ startupHaskell(int argc, char *argv[], void *init_root)
 F_ *init_stack = NULL;
 nat init_sp = 0;
 
-#ifndef INTERPRETER
 static void
-initModules ( void *init_root )
+initModules ( void (*init_root)(void) )
 {
 #ifdef SMP
     Capability cap;
@@ -253,7 +244,6 @@ initModules ( void *init_root )
     cap.rSp = (P_)(init_stack + init_sp);
     StgRun((StgFunPtr)stg_init, &cap);
 }
-#endif /* !INTERPRETER */
 
 /* -----------------------------------------------------------------------------
  * Shutting down the RTS - two ways of doing this, one which
@@ -313,6 +303,12 @@ shutdownHaskell(void)
    */
   exitStorage();
 
+#ifdef RTS_GTK_FRONTPANEL
+    if (RtsFlags.GcFlags.frontpanel) {
+       stopFrontPanel();
+    }
+#endif
+
 #if defined(PROFILING) || defined(DEBUG)
   endProfiling();
 #endif