/* -----------------------------------------------------------------------------
- * $Id: StgStartup.hc,v 1.10 2000/03/30 12:03:30 simonmar Exp $
+ * $Id: StgStartup.hc,v 1.15 2001/03/23 16:36:21 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* ---------------------------------------------------------------------------*/
+#include "Stg.h"
#include "Rts.h"
#include "StgRun.h" /* StgReturn */
#include "StgStartup.h"
* 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 */
we currently disable module initialisation for Hugs.
-------------------------------------------------------------------------- */
-#ifndef INTERPRETER
-
extern F_ *init_stack;
STGFUN(stg_init_ret)
STGFUN(stg_init)
{
FB_
- Sp = MainRegTable.rSp;
+ Sp = BaseReg->rSp;
JMP_(POP_INIT_STACK());
FE_
}
START_MOD_INIT(__init_PrelGHC);
END_MOD_INIT();
-
-#endif /* !INTERPRETER */