[project @ 2001-03-02 14:25:04 by simonmar]
[ghc-hetmet.git] / ghc / rts / RtsStartup.c
index 7ec1216..840ebf2 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.45 2000/12/04 12:31:21 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"
-#endif
 
 #if defined(RTS_GTK_FRONTPANEL)
 #include "FrontPanel.h"
@@ -59,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[])
@@ -82,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)
@@ -93,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
 /*
@@ -152,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();
 
@@ -165,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();
@@ -192,14 +182,6 @@ 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);
-#endif
-
 #ifdef RTS_GTK_FRONTPANEL
     if (RtsFlags.GcFlags.frontpanel) {
        initFrontPanel();
@@ -207,7 +189,7 @@ startupHaskell(int argc, char *argv[], void *init_root)
 #endif
 
     /* Record initialization times */
-    end_init();
+    stat_endInit();
 }
 
 /* -----------------------------------------------------------------------------
@@ -242,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;
@@ -263,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