From b5bafea8126d85bdf7017664644e2d8135c3ba1e Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 3 Apr 2000 16:28:08 +0000 Subject: [PATCH] [project @ 2000-04-03 16:28:08 by simonmar] Don't use MainRegTable to communicate Sp to stg_init, use a dynamically-allocated Capability instead (works with SMP). --- ghc/rts/RtsStartup.c | 24 +++++++++++++----------- ghc/rts/StgStartup.hc | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ghc/rts/RtsStartup.c b/ghc/rts/RtsStartup.c index caca89f..75102f4 100644 --- a/ghc/rts/RtsStartup.c +++ b/ghc/rts/RtsStartup.c @@ -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 */ diff --git a/ghc/rts/StgStartup.hc b/ghc/rts/StgStartup.hc index c8e5465..c927de9 100644 --- a/ghc/rts/StgStartup.hc +++ b/ghc/rts/StgStartup.hc @@ -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_ } -- 1.7.10.4