X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FStgStartup.hc;h=660bf35f0f3e698e44bebedcac8490d277a4431b;hb=eb9bbe105300c5a13ee9edc8a4965a2eb52019bd;hp=c8e54651bf8b738c62f24f5c860dfb267d6f89af;hpb=c108d3f61b1a5fefa8e15aa6ada4ff547bcbb4e5;p=ghc-hetmet.git diff --git a/ghc/rts/StgStartup.hc b/ghc/rts/StgStartup.hc index c8e5465..660bf35 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.19 2002/07/16 14:56:09 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -7,6 +7,7 @@ * * ---------------------------------------------------------------------------*/ +#include "Stg.h" #include "Rts.h" #include "StgRun.h" /* StgReturn */ #include "StgStartup.h" @@ -44,8 +45,8 @@ EXTFUN(stg_stop_thread_entry); -#ifdef PROFILING -#define STOP_THREAD_BITMAP 1 +#if defined(PROFILING) +#define STOP_THREAD_BITMAP 3 #else #define STOP_THREAD_BITMAP 0 #endif @@ -76,12 +77,15 @@ STGFUN(stg_stop_thread_entry) * tidy up the registers and return to the scheduler. */ - /* Move Su just off the end of the stack, we're about to spam the - * STOP_FRAME with the return value. + /* Move Sp to the last word on the stack, and Su to just past the end + * of the stack. We then place the return value at the top of the stack. */ + Sp += sizeofW(StgStopFrame) - 1; Su = (StgUpdateFrame *)(Sp+1); Sp[0] = R1.w; + CurrentTSO->what_next = ThreadComplete; + SaveThreadState(); /* inline! */ /* R1 contains the return value of the thread */ @@ -129,14 +133,8 @@ STGFUN(stg_enterStackTop) /* ----------------------------------------------------------------------------- Special STG entry points for module registration. - - This stuff is problematic for Hugs, because it introduces a - dependency between the RTS and the program (ie. __init_PrelMain). So - we currently disable module initialisation for Hugs. -------------------------------------------------------------------------- */ -#ifndef INTERPRETER - extern F_ *init_stack; STGFUN(stg_init_ret) @@ -148,19 +146,12 @@ STGFUN(stg_init_ret) /* On entry to stg_init: * init_stack[0] = &stg_init_ret; - * init_stack[1] = __init_Something; + * init_stack[1] = __stginit_Something; */ STGFUN(stg_init) { FB_ - Sp = MainRegTable.rSp; + Sp = BaseReg->rSp; JMP_(POP_INIT_STACK()); FE_ } - -/* PrelGHC doesn't really exist... */ - -START_MOD_INIT(__init_PrelGHC); -END_MOD_INIT(); - -#endif /* !INTERPRETER */