+++ /dev/null
-\section[SMstacks.lc]{Stack allocation (sequential)}
-
-Routine that allocates the A and B stack (sequential only).
-
-\begin{code}
-#ifndef PAR
-# define NULL_REG_MAP
-# include "SMinternal.h"
-
-#if 1 /* ndef CONCURRENT */ /* HWL */
-stackData stackInfo;
-#endif
-
-P_ stks_space = 0;
-
-#ifdef CONCURRENT
-EXTDATA_RO(StkO_static_info);
-P_ MainStkO;
-#endif
-
-rtsBool
-initStacks(smInfo *sm)
-{
- /*
- * Allocate them if they don't exist. One space does for both stacks, since they
- * grow towards each other
- */
- if (stks_space == 0) {
-#ifndef CONCURRENT
- stks_space = (P_) stgMallocWords(RTSflags.GcFlags.stksSize, "initStacks");
-#else
- MainStkO = (P_) stgMallocWords(STKO_HS + RTSflags.GcFlags.stksSize, "initStacks");
- stks_space = MainStkO + STKO_HS;
- SET_STKO_HDR(MainStkO, StkO_static_info, CC_SUBSUMED);
- STKO_SIZE(MainStkO) = RTSflags.GcFlags.stksSize + STKO_VHS;
- STKO_SpB(MainStkO) = STKO_SuB(MainStkO) = STKO_BSTK_BOT(MainStkO) + BREL(1);
- STKO_SpA(MainStkO) = STKO_SuA(MainStkO) = STKO_ASTK_BOT(MainStkO) + AREL(1);
- STKO_LINK(MainStkO) = PrelBase_Z91Z93_closure;
- STKO_RETURN(MainStkO) = NULL;
-
- ASSERT(sanityChk_StkO(MainStkO));
-
- if (RTSflags.GcFlags.trace)
- fprintf(stderr, "STACK init: botA, spa: 0x%lx, 0x%lx\n botB, spb: 0x%lx, 0x%lx\n",
- (W_) STKO_ASTK_BOT(MainStkO), (W_) STKO_SpA(MainStkO), (W_) STKO_BSTK_BOT(MainStkO), (W_) STKO_SpB(MainStkO));
-#endif
- }
-
-# if STACK_CHECK_BY_PAGE_FAULT
- unmapMiddleStackPage((char *) stks_space, RTSflags.GcFlags.stksSize * sizeof(W_));
-# endif
-
- /* Initialise Stack Info and pointers */
-#if 1 /* ndef CONCURRENT */ /* HWL */
- stackInfo.botA = STK_A_FRAME_BASE(stks_space, RTSflags.GcFlags.stksSize);
- stackInfo.botB = STK_B_FRAME_BASE(stks_space, RTSflags.GcFlags.stksSize);
-
- MAIN_SuA = MAIN_SpA = stackInfo.botA + AREL(1);
- MAIN_SuB = MAIN_SpB = stackInfo.botB + BREL(1);
-
- if (RTSflags.GcFlags.trace)
- fprintf(stderr, "STACK init: botA, spa: 0x%lx, 0x%lx\n botB, spb: 0x%lx, 0x%lx\n",
- (W_) stackInfo.botA, (W_) MAIN_SpA, (W_) stackInfo.botB, (W_) MAIN_SpB);
-#endif /* !CONCURRENT */
-
- return rtsTrue;
-}
-
-#endif /* not parallel */
-\end{code}