1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2004
5 * Registers in the STG machine.
7 * The STG machine has a collection of "registers", each one of which
8 * may or may not correspond to an actual machine register when
11 * The register set is backed by a table in memory (struct
12 * StgRegTable). If a particular STG register is not mapped to a
13 * machine register, then the apprpriate slot in this table is used
16 * This table is itself pointed to by another register, BaseReg. If
17 * BaseReg is not in a machine register, then the register table is
18 * used from an absolute location (MainCapability).
20 * ---------------------------------------------------------------------------*/
25 #if defined(HAVE_FRAMEWORK_GMP)
27 #elif defined(HAVE_LIB_GMP)
30 #include "gmp.h" // Needs MP_INT definition
34 * Spark pools: used to store pending sparks
35 * (THREADED_RTS & PARALLEL_HASKELL only)
36 * This is a circular buffer. Invariants:
39 * - if hd==tl, then the pool is empty.
40 * - if hd == tl+1, then the pool is full.
41 * Adding to the pool is done by assigning to *tl++ (wrapping round as
42 * necessary). When adding to a full pool, we have the option of
43 * throwing away either the oldest (hd++) or the most recent (tl--) entry.
45 typedef struct StgSparkPool_ {
52 #define ASSERT_SPARK_POOL_INVARIANTS(p) \
53 ASSERT((p)->base <= (p)->hd); \
54 ASSERT((p)->hd < (p)->lim); \
55 ASSERT((p)->base <= (p)->tl); \
56 ASSERT((p)->tl < (p)->lim);
59 StgFunPtr stgGCEnter1;
64 * Vanilla registers are given this union type, which is purely so
65 * that we can cast the vanilla reg to a variety of types with the
66 * minimum of syntax. eg. R1.w instead of (StgWord)R1.
77 StgStackOffset offset; /* unused? */
83 * This is the table that holds shadow-locations for all the STG
84 * registers. The shadow locations are used when:
86 * 1) the particular register isn't mapped to a real machine
87 * register, probably because there's a shortage of real registers.
88 * 2) caller-saves registers are saved across a CCall
90 typedef struct StgRegTable_ {
99 StgUnion rR9; /* used occasionally by heap/stack checks */
100 StgUnion rR10; /* used occasionally by heap/stack checks */
112 struct StgTSO_ *rCurrentTSO;
113 struct step_ *rNursery;
114 struct bdescr_ *rCurrentNursery; /* Hp/HpLim point into this block */
115 struct bdescr_ *rCurrentAlloc; /* for allocation using allocate() */
116 StgWord rHpAlloc; /* number of *bytes* being allocated in heap */
117 // rmp_tmp1..rmp_result2 are only used in THREADED_RTS builds to
118 // avoid per-thread temps in bss, but currently always incldue here
119 // so we just run mkDerivedConstants once
125 StgWord rRet; // holds the return code of the thread
126 StgSparkPool rSparks; /* per-task spark pool */
132 * Registers Hp and HpLim are global across the entire system, and are
133 * copied into the RegTable before executing a thread.
135 * Registers Sp and SpLim are saved in the TSO for the
136 * thread, but are copied into the RegTable before executing a thread.
138 * All other registers are "general purpose", and are used for passing
139 * arguments to functions, and returning values. The code generator
140 * knows how many of these are in real registers, and avoids
141 * generating code that uses non-real registers. General purpose
142 * registers are never saved when returning to the scheduler, instead
143 * we save whatever is live at the time on the stack, and restore it
144 * later. This should reduce the context switch time, amongst other
147 * For argument passing, the stack will be used in preference to
148 * pseudo-registers if the architecture has too few general purpose
151 * Some special RTS functions like newArray and the Integer primitives
152 * expect their arguments to be in registers R1-Rn, so we use these
153 * (pseudo-)registers in those cases.
157 * Locations for saving per-thread registers.
160 #define SAVE_Sp (CurrentTSO->sp)
161 #define SAVE_SpLim (CurrentTSO->splim)
163 #define SAVE_Hp (BaseReg->rHp)
164 #define SAVE_HpLim (BaseReg->rHpLim)
166 #define SAVE_CurrentTSO (BaseReg->rCurrentTSO)
167 #define SAVE_CurrentNursery (BaseReg->rCurrentNursery)
168 #define SAVE_HpAlloc (BaseReg->rHpAlloc)
169 #define SAVE_SparkHd (BaseReg->rSparks.hd)
170 #define SAVE_SparkTl (BaseReg->rSparks.tl)
171 #define SAVE_SparkBase (BaseReg->rSparks.base)
172 #define SAVE_SparkLim (BaseReg->rSparks.lim)
174 /* We sometimes need to save registers across a C-call, eg. if they
175 * are clobbered in the standard calling convention. We define the
176 * save locations for all registers in the register table.
179 #define SAVE_R1 (BaseReg->rR1)
180 #define SAVE_R2 (BaseReg->rR2)
181 #define SAVE_R3 (BaseReg->rR3)
182 #define SAVE_R4 (BaseReg->rR4)
183 #define SAVE_R5 (BaseReg->rR5)
184 #define SAVE_R6 (BaseReg->rR6)
185 #define SAVE_R7 (BaseReg->rR7)
186 #define SAVE_R8 (BaseReg->rR8)
188 #define SAVE_F1 (BaseReg->rF1)
189 #define SAVE_F2 (BaseReg->rF2)
190 #define SAVE_F3 (BaseReg->rF3)
191 #define SAVE_F4 (BaseReg->rF4)
193 #define SAVE_D1 (BaseReg->rD1)
194 #define SAVE_D2 (BaseReg->rD2)
196 #define SAVE_L1 (BaseReg->rL1)
198 /* -----------------------------------------------------------------------------
199 * Emit the GCC-specific register declarations for each machine
200 * register being used. If any STG register isn't mapped to a machine
201 * register, then map it to an offset from BaseReg.
203 * First, the general purpose registers. The idea is, if a particular
204 * general-purpose STG register can't be mapped to a real machine
205 * register, it won't be used at all. Instead, we'll use the stack.
207 * This is an improvement on the way things used to be done, when all
208 * registers were mapped to locations in the register table, and stuff
209 * was being shifted from the stack to the register table and back
210 * again for no good reason (on register-poor architectures).
213 /* define NO_REGS to omit register declarations - used in RTS C code
214 * that needs all the STG definitions but not the global register
217 #define GLOBAL_REG_DECL(type,name,reg) register type name REG(reg);
219 #if defined(REG_R1) && !defined(NO_GLOBAL_REG_DECLS)
220 GLOBAL_REG_DECL(StgUnion,R1,REG_R1)
222 # define R1 (BaseReg->rR1)
225 #if defined(REG_R2) && !defined(NO_GLOBAL_REG_DECLS)
226 GLOBAL_REG_DECL(StgUnion,R2,REG_R2)
228 # define R2 (BaseReg->rR2)
231 #if defined(REG_R3) && !defined(NO_GLOBAL_REG_DECLS)
232 GLOBAL_REG_DECL(StgUnion,R3,REG_R3)
234 # define R3 (BaseReg->rR3)
237 #if defined(REG_R4) && !defined(NO_GLOBAL_REG_DECLS)
238 GLOBAL_REG_DECL(StgUnion,R4,REG_R4)
240 # define R4 (BaseReg->rR4)
243 #if defined(REG_R5) && !defined(NO_GLOBAL_REG_DECLS)
244 GLOBAL_REG_DECL(StgUnion,R5,REG_R5)
246 # define R5 (BaseReg->rR5)
249 #if defined(REG_R6) && !defined(NO_GLOBAL_REG_DECLS)
250 GLOBAL_REG_DECL(StgUnion,R6,REG_R6)
252 # define R6 (BaseReg->rR6)
255 #if defined(REG_R7) && !defined(NO_GLOBAL_REG_DECLS)
256 GLOBAL_REG_DECL(StgUnion,R7,REG_R7)
258 # define R7 (BaseReg->rR7)
261 #if defined(REG_R8) && !defined(NO_GLOBAL_REG_DECLS)
262 GLOBAL_REG_DECL(StgUnion,R8,REG_R8)
264 # define R8 (BaseReg->rR8)
267 #if defined(REG_R9) && !defined(NO_GLOBAL_REG_DECLS)
268 GLOBAL_REG_DECL(StgUnion,R9,REG_R9)
270 # define R9 (BaseReg->rR9)
273 #if defined(REG_R10) && !defined(NO_GLOBAL_REG_DECLS)
274 GLOBAL_REG_DECL(StgUnion,R10,REG_R10)
276 # define R10 (BaseReg->rR10)
279 #if defined(REG_F1) && !defined(NO_GLOBAL_REG_DECLS)
280 GLOBAL_REG_DECL(StgFloat,F1,REG_F1)
282 #define F1 (BaseReg->rF1)
285 #if defined(REG_F2) && !defined(NO_GLOBAL_REG_DECLS)
286 GLOBAL_REG_DECL(StgFloat,F2,REG_F2)
288 #define F2 (BaseReg->rF2)
291 #if defined(REG_F3) && !defined(NO_GLOBAL_REG_DECLS)
292 GLOBAL_REG_DECL(StgFloat,F3,REG_F3)
294 #define F3 (BaseReg->rF3)
297 #if defined(REG_F4) && !defined(NO_GLOBAL_REG_DECLS)
298 GLOBAL_REG_DECL(StgFloat,F4,REG_F4)
300 #define F4 (BaseReg->rF4)
303 #if defined(REG_D1) && !defined(NO_GLOBAL_REG_DECLS)
304 GLOBAL_REG_DECL(StgDouble,D1,REG_D1)
306 #define D1 (BaseReg->rD1)
309 #if defined(REG_D2) && !defined(NO_GLOBAL_REG_DECLS)
310 GLOBAL_REG_DECL(StgDouble,D2,REG_D2)
312 #define D2 (BaseReg->rD2)
315 #if defined(REG_L1) && !defined(NO_GLOBAL_REG_DECLS)
316 GLOBAL_REG_DECL(StgWord64,L1,REG_L1)
318 #define L1 (BaseReg->rL1)
322 * If BaseReg isn't mapped to a machine register, just use the global
323 * address of the current register table (CurrentRegTable in
324 * concurrent Haskell, MainRegTable otherwise).
327 /* A capability is a combination of a FunTable and a RegTable. In STG
328 * code, BaseReg normally points to the RegTable portion of this
329 * structure, so that we can index both forwards and backwards to take
330 * advantage of shorter instruction forms on some archs (eg. x86).
331 * This is a cut-down version of the Capability structure; the full
332 * version is defined in Capability.h.
334 struct PartCapability_ {
339 /* No such thing as a MainCapability under THREADED_RTS - each thread must have
340 * its own Capability.
342 #if IN_STG_CODE && !(defined(THREADED_RTS) && !defined(NOSMP))
343 extern W_ MainCapability[];
347 * Assigning to BaseReg (the ASSIGN_BaseReg macro): this happens on
348 * return from a "safe" foreign call, when the thread might be running
349 * on a new Capability. Obviously if BaseReg is not a register, then
350 * we are restricted to a single Capability (this invariant is enforced
351 * in Capability.c:initCapabilities), and assigning to BaseReg can be omitted.
354 #if defined(REG_Base) && !defined(NO_GLOBAL_REG_DECLS)
355 GLOBAL_REG_DECL(StgRegTable *,BaseReg,REG_Base)
356 #define ASSIGN_BaseReg(e) (BaseReg = (e))
358 #if defined(THREADED_RTS) && !defined(NOSMP)
359 #error BaseReg must be in a register for THREADED_RTS
361 #define BaseReg (&((struct PartCapability_ *)MainCapability)->r)
362 #define ASSIGN_BaseReg(e) (e)
365 #if defined(REG_Sp) && !defined(NO_GLOBAL_REG_DECLS)
366 GLOBAL_REG_DECL(P_,Sp,REG_Sp)
368 #define Sp (BaseReg->rSp)
371 #if defined(REG_SpLim) && !defined(NO_GLOBAL_REG_DECLS)
372 GLOBAL_REG_DECL(P_,SpLim,REG_SpLim)
374 #define SpLim (BaseReg->rSpLim)
377 #if defined(REG_Hp) && !defined(NO_GLOBAL_REG_DECLS)
378 GLOBAL_REG_DECL(P_,Hp,REG_Hp)
380 #define Hp (BaseReg->rHp)
383 #if defined(REG_HpLim) && !defined(NO_GLOBAL_REG_DECLS)
384 GLOBAL_REG_DECL(P_,HpLim,REG_HpLim)
386 #define HpLim (BaseReg->rHpLim)
389 #if defined(REG_CurrentTSO) && !defined(NO_GLOBAL_REG_DECLS)
390 GLOBAL_REG_DECL(struct _StgTSO *,CurrentTSO,REG_CurrentTSO)
392 #define CurrentTSO (BaseReg->rCurrentTSO)
395 #if defined(REG_CurrentNursery) && !defined(NO_GLOBAL_REG_DECLS)
396 GLOBAL_REG_DECL(bdescr *,CurrentNursery,REG_CurrentNursery)
398 #define CurrentNursery (BaseReg->rCurrentNursery)
401 #if defined(REG_HpAlloc) && !defined(NO_GLOBAL_REG_DECLS)
402 GLOBAL_REG_DECL(bdescr *,HpAlloc,REG_HpAlloc)
404 #define HpAlloc (BaseReg->rHpAlloc)
407 #if defined(REG_SparkHd) && !defined(NO_GLOBAL_REG_DECLS)
408 GLOBAL_REG_DECL(bdescr *,SparkHd,REG_SparkHd)
410 #define SparkHd (BaseReg->rSparks.hd)
413 #if defined(REG_SparkTl) && !defined(NO_GLOBAL_REG_DECLS)
414 GLOBAL_REG_DECL(bdescr *,SparkTl,REG_SparkTl)
416 #define SparkTl (BaseReg->rSparks.tl)
419 #if defined(REG_SparkBase) && !defined(NO_GLOBAL_REG_DECLS)
420 GLOBAL_REG_DECL(bdescr *,SparkBase,REG_SparkBase)
422 #define SparkBase (BaseReg->rSparks.base)
425 #if defined(REG_SparkLim) && !defined(NO_GLOBAL_REG_DECLS)
426 GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim)
428 #define SparkLim (BaseReg->rSparks.lim)
431 /* -----------------------------------------------------------------------------
432 Get absolute function pointers from the register table, to save
441 as long as the offset is within the range of a signed byte
442 (-128..+127). So we pick some common absolute_addresses and put
443 them in the register table. As a bonus, linking time should also
446 Other possible candidates in order of importance:
449 stg_CAF_BLACKHOLE_info
452 anything else probably isn't worth the effort.
454 -------------------------------------------------------------------------- */
457 #define FunReg ((StgFunTable *)((void *)BaseReg - sizeof(StgFunTable)))
459 #define stg_gc_enter_1 (FunReg->stgGCEnter1)
460 #define stg_gc_fun (FunReg->stgGCFun)
462 /* -----------------------------------------------------------------------------
463 For any registers which are denoted "caller-saves" by the C calling
464 convention, we have to emit code to save and restore them across C
466 -------------------------------------------------------------------------- */
468 #ifdef CALLER_SAVES_R1
469 #define CALLER_SAVE_R1 SAVE_R1 = R1;
470 #define CALLER_RESTORE_R1 R1 = SAVE_R1;
472 #define CALLER_SAVE_R1 /* nothing */
473 #define CALLER_RESTORE_R1 /* nothing */
476 #ifdef CALLER_SAVES_R2
477 #define CALLER_SAVE_R2 SAVE_R2 = R2;
478 #define CALLER_RESTORE_R2 R2 = SAVE_R2;
480 #define CALLER_SAVE_R2 /* nothing */
481 #define CALLER_RESTORE_R2 /* nothing */
484 #ifdef CALLER_SAVES_R3
485 #define CALLER_SAVE_R3 SAVE_R3 = R3;
486 #define CALLER_RESTORE_R3 R3 = SAVE_R3;
488 #define CALLER_SAVE_R3 /* nothing */
489 #define CALLER_RESTORE_R3 /* nothing */
492 #ifdef CALLER_SAVES_R4
493 #define CALLER_SAVE_R4 SAVE_R4 = R4;
494 #define CALLER_RESTORE_R4 R4 = SAVE_R4;
496 #define CALLER_SAVE_R4 /* nothing */
497 #define CALLER_RESTORE_R4 /* nothing */
500 #ifdef CALLER_SAVES_R5
501 #define CALLER_SAVE_R5 SAVE_R5 = R5;
502 #define CALLER_RESTORE_R5 R5 = SAVE_R5;
504 #define CALLER_SAVE_R5 /* nothing */
505 #define CALLER_RESTORE_R5 /* nothing */
508 #ifdef CALLER_SAVES_R6
509 #define CALLER_SAVE_R6 SAVE_R6 = R6;
510 #define CALLER_RESTORE_R6 R6 = SAVE_R6;
512 #define CALLER_SAVE_R6 /* nothing */
513 #define CALLER_RESTORE_R6 /* nothing */
516 #ifdef CALLER_SAVES_R7
517 #define CALLER_SAVE_R7 SAVE_R7 = R7;
518 #define CALLER_RESTORE_R7 R7 = SAVE_R7;
520 #define CALLER_SAVE_R7 /* nothing */
521 #define CALLER_RESTORE_R7 /* nothing */
524 #ifdef CALLER_SAVES_R8
525 #define CALLER_SAVE_R8 SAVE_R8 = R8;
526 #define CALLER_RESTORE_R8 R8 = SAVE_R8;
528 #define CALLER_SAVE_R8 /* nothing */
529 #define CALLER_RESTORE_R8 /* nothing */
532 #ifdef CALLER_SAVES_R9
533 #define CALLER_SAVE_R9 SAVE_R9 = R9;
534 #define CALLER_RESTORE_R9 R9 = SAVE_R9;
536 #define CALLER_SAVE_R9 /* nothing */
537 #define CALLER_RESTORE_R9 /* nothing */
540 #ifdef CALLER_SAVES_R10
541 #define CALLER_SAVE_R10 SAVE_R10 = R10;
542 #define CALLER_RESTORE_R10 R10 = SAVE_R10;
544 #define CALLER_SAVE_R10 /* nothing */
545 #define CALLER_RESTORE_R10 /* nothing */
548 #ifdef CALLER_SAVES_F1
549 #define CALLER_SAVE_F1 SAVE_F1 = F1;
550 #define CALLER_RESTORE_F1 F1 = SAVE_F1;
552 #define CALLER_SAVE_F1 /* nothing */
553 #define CALLER_RESTORE_F1 /* nothing */
556 #ifdef CALLER_SAVES_F2
557 #define CALLER_SAVE_F2 SAVE_F2 = F2;
558 #define CALLER_RESTORE_F2 F2 = SAVE_F2;
560 #define CALLER_SAVE_F2 /* nothing */
561 #define CALLER_RESTORE_F2 /* nothing */
564 #ifdef CALLER_SAVES_F3
565 #define CALLER_SAVE_F3 SAVE_F3 = F3;
566 #define CALLER_RESTORE_F3 F3 = SAVE_F3;
568 #define CALLER_SAVE_F3 /* nothing */
569 #define CALLER_RESTORE_F3 /* nothing */
572 #ifdef CALLER_SAVES_F4
573 #define CALLER_SAVE_F4 SAVE_F4 = F4;
574 #define CALLER_RESTORE_F4 F4 = SAVE_F4;
576 #define CALLER_SAVE_F4 /* nothing */
577 #define CALLER_RESTORE_F4 /* nothing */
580 #ifdef CALLER_SAVES_D1
581 #define CALLER_SAVE_D1 SAVE_D1 = D1;
582 #define CALLER_RESTORE_D1 D1 = SAVE_D1;
584 #define CALLER_SAVE_D1 /* nothing */
585 #define CALLER_RESTORE_D1 /* nothing */
588 #ifdef CALLER_SAVES_D2
589 #define CALLER_SAVE_D2 SAVE_D2 = D2;
590 #define CALLER_RESTORE_D2 D2 = SAVE_D2;
592 #define CALLER_SAVE_D2 /* nothing */
593 #define CALLER_RESTORE_D2 /* nothing */
596 #ifdef CALLER_SAVES_L1
597 #define CALLER_SAVE_L1 SAVE_L1 = L1;
598 #define CALLER_RESTORE_L1 L1 = SAVE_L1;
600 #define CALLER_SAVE_L1 /* nothing */
601 #define CALLER_RESTORE_L1 /* nothing */
604 #ifdef CALLER_SAVES_Sp
605 #define CALLER_SAVE_Sp SAVE_Sp = Sp;
606 #define CALLER_RESTORE_Sp Sp = SAVE_Sp;
608 #define CALLER_SAVE_Sp /* nothing */
609 #define CALLER_RESTORE_Sp /* nothing */
612 #ifdef CALLER_SAVES_SpLim
613 #define CALLER_SAVE_SpLim SAVE_SpLim = SpLim;
614 #define CALLER_RESTORE_SpLim SpLim = SAVE_SpLim;
616 #define CALLER_SAVE_SpLim /* nothing */
617 #define CALLER_RESTORE_SpLim /* nothing */
620 #ifdef CALLER_SAVES_Hp
621 #define CALLER_SAVE_Hp SAVE_Hp = Hp;
622 #define CALLER_RESTORE_Hp Hp = SAVE_Hp;
624 #define CALLER_SAVE_Hp /* nothing */
625 #define CALLER_RESTORE_Hp /* nothing */
628 #ifdef CALLER_SAVES_HpLim
629 #define CALLER_SAVE_HpLim SAVE_HpLim = HpLim;
630 #define CALLER_RESTORE_HpLim HpLim = SAVE_HpLim;
632 #define CALLER_SAVE_HpLim /* nothing */
633 #define CALLER_RESTORE_HpLim /* nothing */
636 #ifdef CALLER_SAVES_Base
638 #error "Can't have caller-saved BaseReg with THREADED_RTS"
640 #define CALLER_SAVE_Base /* nothing */
641 #define CALLER_RESTORE_Base BaseReg = &MainRegTable;
643 #define CALLER_SAVE_Base /* nothing */
644 #define CALLER_RESTORE_Base /* nothing */
647 #ifdef CALLER_SAVES_CurrentTSO
648 #define CALLER_SAVE_CurrentTSO SAVE_CurrentTSO = CurrentTSO;
649 #define CALLER_RESTORE_CurrentTSO CurrentTSO = SAVE_CurrentTSO;
651 #define CALLER_SAVE_CurrentTSO /* nothing */
652 #define CALLER_RESTORE_CurrentTSO /* nothing */
655 #ifdef CALLER_SAVES_CurrentNursery
656 #define CALLER_SAVE_CurrentNursery SAVE_CurrentNursery = CurrentNursery;
657 #define CALLER_RESTORE_CurrentNursery CurrentNursery = SAVE_CurrentNursery;
659 #define CALLER_SAVE_CurrentNursery /* nothing */
660 #define CALLER_RESTORE_CurrentNursery /* nothing */
663 #ifdef CALLER_SAVES_HpAlloc
664 #define CALLER_SAVE_HpAlloc SAVE_HpAlloc = HpAlloc;
665 #define CALLER_RESTORE_HpAlloc HpAlloc = SAVE_HpAlloc;
667 #define CALLER_SAVE_HpAlloc /* nothing */
668 #define CALLER_RESTORE_HpAlloc /* nothing */
671 #ifdef CALLER_SAVES_SparkHd
672 #define CALLER_SAVE_SparkHd SAVE_SparkHd = SparkHd;
673 #define CALLER_RESTORE_SparkHd SparkHd = SAVE_SparkHd;
675 #define CALLER_SAVE_SparkHd /* nothing */
676 #define CALLER_RESTORE_SparkHd /* nothing */
679 #ifdef CALLER_SAVES_SparkTl
680 #define CALLER_SAVE_SparkTl SAVE_SparkTl = SparkTl;
681 #define CALLER_RESTORE_SparkTl SparkTl = SAVE_SparkTl;
683 #define CALLER_SAVE_SparkTl /* nothing */
684 #define CALLER_RESTORE_SparkTl /* nothing */
687 #ifdef CALLER_SAVES_SparkBase
688 #define CALLER_SAVE_SparkBase SAVE_SparkBase = SparkBase;
689 #define CALLER_RESTORE_SparkBase SparkBase = SAVE_SparkBase;
691 #define CALLER_SAVE_SparkBase /* nothing */
692 #define CALLER_RESTORE_SparkBase /* nothing */
695 #ifdef CALLER_SAVES_SparkLim
696 #define CALLER_SAVE_SparkLim SAVE_SparkLim = SparkLim;
697 #define CALLER_RESTORE_SparkLim SparkLim = SAVE_SparkLim;
699 #define CALLER_SAVE_SparkLim /* nothing */
700 #define CALLER_RESTORE_SparkLim /* nothing */
703 #endif /* IN_STG_CODE */
705 /* ----------------------------------------------------------------------------
706 Handy bunches of saves/restores
707 ------------------------------------------------------------------------ */
711 #define CALLER_SAVE_USER \
728 /* Save Base last, since the others may
729 be addressed relative to it */
730 #define CALLER_SAVE_SYSTEM \
735 CALLER_SAVE_CurrentTSO \
736 CALLER_SAVE_CurrentNursery \
737 CALLER_SAVE_SparkHd \
738 CALLER_SAVE_SparkTl \
739 CALLER_SAVE_SparkBase \
740 CALLER_SAVE_SparkLim \
743 #define CALLER_RESTORE_USER \
760 /* Restore Base first, since the others may
761 be addressed relative to it */
762 #define CALLER_RESTORE_SYSTEM \
763 CALLER_RESTORE_Base \
765 CALLER_RESTORE_SpLim \
767 CALLER_RESTORE_HpLim \
768 CALLER_RESTORE_CurrentTSO \
769 CALLER_RESTORE_CurrentNursery \
770 CALLER_RESTORE_SparkHd \
771 CALLER_RESTORE_SparkTl \
772 CALLER_RESTORE_SparkBase \
773 CALLER_RESTORE_SparkLim
775 #else /* not IN_STG_CODE */
777 #define CALLER_SAVE_USER /* nothing */
778 #define CALLER_SAVE_SYSTEM /* nothing */
779 #define CALLER_RESTORE_USER /* nothing */
780 #define CALLER_RESTORE_SYSTEM /* nothing */
782 #endif /* IN_STG_CODE */
783 #define CALLER_SAVE_ALL \
787 #define CALLER_RESTORE_ALL \
788 CALLER_RESTORE_SYSTEM \