[project @ 2000-04-03 16:28:08 by simonmar]
authorsimonmar <unknown>
Mon, 3 Apr 2000 16:28:08 +0000 (16:28 +0000)
committersimonmar <unknown>
Mon, 3 Apr 2000 16:28:08 +0000 (16:28 +0000)
Don't use MainRegTable to communicate Sp to stg_init, use a
dynamically-allocated Capability instead (works with SMP).

ghc/rts/RtsStartup.c
ghc/rts/StgStartup.hc

index caca89f..75102f4 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.38 2000/04/03 15:54:50 simonmar Exp $
+ * $Id: RtsStartup.c,v 1.39 2000/04/03 16:28:08 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -207,16 +207,18 @@ nat init_sp = 0;
 static void
 initModules ( void *init_root )
 {
-  init_sp = 0;
-  init_stack = (F_ *)allocate(INIT_STACK_SIZE / sizeof(W_));
-  init_stack[init_sp++] = (F_)stg_init_ret;
-  init_stack[init_sp++] = (F_)__init_Prelude;
-  if (init_root != NULL) {
-    init_stack[init_sp++] = (F_)init_root;
-  }
-
-  MainRegTable.rSp = (P_)(init_stack + init_sp);
-  StgRun((StgFunPtr)stg_init, NULL/* no reg table */);
+    Capability cap;
+
+    init_sp = 0;
+    init_stack = (F_ *)allocate(INIT_STACK_SIZE / sizeof(W_));
+    init_stack[init_sp++] = (F_)stg_init_ret;
+    init_stack[init_sp++] = (F_)__init_Prelude;
+    if (init_root != NULL) {
+       init_stack[init_sp++] = (F_)init_root;
+    }
+    
+    cap.rSp = (P_)(init_stack + init_sp);
+    StgRun((StgFunPtr)stg_init, &cap);
 }
 
 #endif /* !INTERPRETER */
index c8e5465..c927de9 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgStartup.hc,v 1.10 2000/03/30 12:03:30 simonmar Exp $
+ * $Id: StgStartup.hc,v 1.11 2000/04/03 16:28:08 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -153,7 +153,7 @@ STGFUN(stg_init_ret)
 STGFUN(stg_init)
 {
   FB_
-  Sp = MainRegTable.rSp;
+  Sp = BaseReg->rSp;
   JMP_(POP_INIT_STACK());
   FE_
 }