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 * ---------------------------------------------------------------------------*/
26 * Spark pools: used to store pending sparks
27 * (THREADED_RTS & PARALLEL_HASKELL only)
28 * This is a circular buffer. Invariants:
31 * - if hd==tl, then the pool is empty.
32 * - if hd == tl+1, then the pool is full.
33 * Adding to the pool is done by assigning to *tl++ (wrapping round as
34 * necessary). When adding to a full pool, we have the option of
35 * throwing away either the oldest (hd++) or the most recent (tl--) entry.
37 typedef struct StgSparkPool_ {
44 #define ASSERT_SPARK_POOL_INVARIANTS(p) \
45 ASSERT((p)->base <= (p)->hd); \
46 ASSERT((p)->hd < (p)->lim); \
47 ASSERT((p)->base <= (p)->tl); \
48 ASSERT((p)->tl < (p)->lim);
51 StgFunPtr stgGCEnter1;
56 * Vanilla registers are given this union type, which is purely so
57 * that we can cast the vanilla reg to a variety of types with the
58 * minimum of syntax. eg. R1.w instead of (StgWord)R1.
69 StgStackOffset offset; /* unused? */
74 // Urgh.. we don't know the size of an MP_INT here because we haven't
75 // #included gmp.h. We should really autoconf this, but GMP may not
76 // be available at ./configure time if we're building it (GMP) locally.
77 #define MP_INT_WORDS 3
80 * This is the table that holds shadow-locations for all the STG
81 * registers. The shadow locations are used when:
83 * 1) the particular register isn't mapped to a real machine
84 * register, probably because there's a shortage of real registers.
85 * 2) caller-saves registers are saved across a CCall
87 typedef struct StgRegTable_ {
96 StgUnion rR9; /* used occasionally by heap/stack checks */
97 StgUnion rR10; /* used occasionally by heap/stack checks */
109 struct StgTSO_ *rCurrentTSO;
110 struct step_ *rNursery;
111 struct bdescr_ *rCurrentNursery; /* Hp/HpLim point into this block */
112 struct bdescr_ *rCurrentAlloc; /* for allocation using allocate() */
113 StgWord rHpAlloc; /* number of *bytes* being allocated in heap */
114 // rmp_tmp1..rmp_result2 are only used in THREADED_RTS builds to
115 // avoid per-thread temps in bss, but currently always incldue here
116 // so we just run mkDerivedConstants once
117 StgWord rmp_tmp_w[MP_INT_WORDS];
118 StgWord rmp_tmp1[MP_INT_WORDS];
119 StgWord rmp_tmp2[MP_INT_WORDS];
120 StgWord rmp_result1[MP_INT_WORDS];
121 StgWord rmp_result2[MP_INT_WORDS];
122 StgWord rRet; // holds the return code of the thread
123 StgSparkPool rSparks; /* per-task spark pool */
129 * Registers Hp and HpLim are global across the entire system, and are
130 * copied into the RegTable before executing a thread.
132 * Registers Sp and SpLim are saved in the TSO for the
133 * thread, but are copied into the RegTable before executing a thread.
135 * All other registers are "general purpose", and are used for passing
136 * arguments to functions, and returning values. The code generator
137 * knows how many of these are in real registers, and avoids
138 * generating code that uses non-real registers. General purpose
139 * registers are never saved when returning to the scheduler, instead
140 * we save whatever is live at the time on the stack, and restore it
141 * later. This should reduce the context switch time, amongst other
144 * For argument passing, the stack will be used in preference to
145 * pseudo-registers if the architecture has too few general purpose
148 * Some special RTS functions like newArray and the Integer primitives
149 * expect their arguments to be in registers R1-Rn, so we use these
150 * (pseudo-)registers in those cases.
154 * Locations for saving per-thread registers.
157 #define SAVE_Sp (CurrentTSO->sp)
158 #define SAVE_SpLim (CurrentTSO->splim)
160 #define SAVE_Hp (BaseReg->rHp)
161 #define SAVE_HpLim (BaseReg->rHpLim)
163 #define SAVE_CurrentTSO (BaseReg->rCurrentTSO)
164 #define SAVE_CurrentNursery (BaseReg->rCurrentNursery)
165 #define SAVE_HpAlloc (BaseReg->rHpAlloc)
166 #define SAVE_SparkHd (BaseReg->rSparks.hd)
167 #define SAVE_SparkTl (BaseReg->rSparks.tl)
168 #define SAVE_SparkBase (BaseReg->rSparks.base)
169 #define SAVE_SparkLim (BaseReg->rSparks.lim)
171 /* We sometimes need to save registers across a C-call, eg. if they
172 * are clobbered in the standard calling convention. We define the
173 * save locations for all registers in the register table.
176 #define SAVE_R1 (BaseReg->rR1)
177 #define SAVE_R2 (BaseReg->rR2)
178 #define SAVE_R3 (BaseReg->rR3)
179 #define SAVE_R4 (BaseReg->rR4)
180 #define SAVE_R5 (BaseReg->rR5)
181 #define SAVE_R6 (BaseReg->rR6)
182 #define SAVE_R7 (BaseReg->rR7)
183 #define SAVE_R8 (BaseReg->rR8)
185 #define SAVE_F1 (BaseReg->rF1)
186 #define SAVE_F2 (BaseReg->rF2)
187 #define SAVE_F3 (BaseReg->rF3)
188 #define SAVE_F4 (BaseReg->rF4)
190 #define SAVE_D1 (BaseReg->rD1)
191 #define SAVE_D2 (BaseReg->rD2)
193 #define SAVE_L1 (BaseReg->rL1)
195 /* -----------------------------------------------------------------------------
196 * Emit the GCC-specific register declarations for each machine
197 * register being used. If any STG register isn't mapped to a machine
198 * register, then map it to an offset from BaseReg.
200 * First, the general purpose registers. The idea is, if a particular
201 * general-purpose STG register can't be mapped to a real machine
202 * register, it won't be used at all. Instead, we'll use the stack.
204 * This is an improvement on the way things used to be done, when all
205 * registers were mapped to locations in the register table, and stuff
206 * was being shifted from the stack to the register table and back
207 * again for no good reason (on register-poor architectures).
210 /* define NO_REGS to omit register declarations - used in RTS C code
211 * that needs all the STG definitions but not the global register
214 #define GLOBAL_REG_DECL(type,name,reg) register type name REG(reg);
216 #if defined(REG_R1) && !defined(NO_GLOBAL_REG_DECLS)
217 GLOBAL_REG_DECL(StgUnion,R1,REG_R1)
219 # define R1 (BaseReg->rR1)
222 #if defined(REG_R2) && !defined(NO_GLOBAL_REG_DECLS)
223 GLOBAL_REG_DECL(StgUnion,R2,REG_R2)
225 # define R2 (BaseReg->rR2)
228 #if defined(REG_R3) && !defined(NO_GLOBAL_REG_DECLS)
229 GLOBAL_REG_DECL(StgUnion,R3,REG_R3)
231 # define R3 (BaseReg->rR3)
234 #if defined(REG_R4) && !defined(NO_GLOBAL_REG_DECLS)
235 GLOBAL_REG_DECL(StgUnion,R4,REG_R4)
237 # define R4 (BaseReg->rR4)
240 #if defined(REG_R5) && !defined(NO_GLOBAL_REG_DECLS)
241 GLOBAL_REG_DECL(StgUnion,R5,REG_R5)
243 # define R5 (BaseReg->rR5)
246 #if defined(REG_R6) && !defined(NO_GLOBAL_REG_DECLS)
247 GLOBAL_REG_DECL(StgUnion,R6,REG_R6)
249 # define R6 (BaseReg->rR6)
252 #if defined(REG_R7) && !defined(NO_GLOBAL_REG_DECLS)
253 GLOBAL_REG_DECL(StgUnion,R7,REG_R7)
255 # define R7 (BaseReg->rR7)
258 #if defined(REG_R8) && !defined(NO_GLOBAL_REG_DECLS)
259 GLOBAL_REG_DECL(StgUnion,R8,REG_R8)
261 # define R8 (BaseReg->rR8)
264 #if defined(REG_R9) && !defined(NO_GLOBAL_REG_DECLS)
265 GLOBAL_REG_DECL(StgUnion,R9,REG_R9)
267 # define R9 (BaseReg->rR9)
270 #if defined(REG_R10) && !defined(NO_GLOBAL_REG_DECLS)
271 GLOBAL_REG_DECL(StgUnion,R10,REG_R10)
273 # define R10 (BaseReg->rR10)
276 #if defined(REG_F1) && !defined(NO_GLOBAL_REG_DECLS)
277 GLOBAL_REG_DECL(StgFloat,F1,REG_F1)
279 #define F1 (BaseReg->rF1)
282 #if defined(REG_F2) && !defined(NO_GLOBAL_REG_DECLS)
283 GLOBAL_REG_DECL(StgFloat,F2,REG_F2)
285 #define F2 (BaseReg->rF2)
288 #if defined(REG_F3) && !defined(NO_GLOBAL_REG_DECLS)
289 GLOBAL_REG_DECL(StgFloat,F3,REG_F3)
291 #define F3 (BaseReg->rF3)
294 #if defined(REG_F4) && !defined(NO_GLOBAL_REG_DECLS)
295 GLOBAL_REG_DECL(StgFloat,F4,REG_F4)
297 #define F4 (BaseReg->rF4)
300 #if defined(REG_D1) && !defined(NO_GLOBAL_REG_DECLS)
301 GLOBAL_REG_DECL(StgDouble,D1,REG_D1)
303 #define D1 (BaseReg->rD1)
306 #if defined(REG_D2) && !defined(NO_GLOBAL_REG_DECLS)
307 GLOBAL_REG_DECL(StgDouble,D2,REG_D2)
309 #define D2 (BaseReg->rD2)
312 #if defined(REG_L1) && !defined(NO_GLOBAL_REG_DECLS)
313 GLOBAL_REG_DECL(StgWord64,L1,REG_L1)
315 #define L1 (BaseReg->rL1)
319 * If BaseReg isn't mapped to a machine register, just use the global
320 * address of the current register table (CurrentRegTable in
321 * concurrent Haskell, MainRegTable otherwise).
324 /* A capability is a combination of a FunTable and a RegTable. In STG
325 * code, BaseReg normally points to the RegTable portion of this
326 * structure, so that we can index both forwards and backwards to take
327 * advantage of shorter instruction forms on some archs (eg. x86).
328 * This is a cut-down version of the Capability structure; the full
329 * version is defined in Capability.h.
331 struct PartCapability_ {
336 /* No such thing as a MainCapability under THREADED_RTS - each thread must have
337 * its own Capability.
339 #if IN_STG_CODE && !(defined(THREADED_RTS) && !defined(NOSMP))
340 extern W_ MainCapability[];
344 * Assigning to BaseReg (the ASSIGN_BaseReg macro): this happens on
345 * return from a "safe" foreign call, when the thread might be running
346 * on a new Capability. Obviously if BaseReg is not a register, then
347 * we are restricted to a single Capability (this invariant is enforced
348 * in Capability.c:initCapabilities), and assigning to BaseReg can be omitted.
351 #if defined(REG_Base) && !defined(NO_GLOBAL_REG_DECLS)
352 GLOBAL_REG_DECL(StgRegTable *,BaseReg,REG_Base)
353 #define ASSIGN_BaseReg(e) (BaseReg = (e))
355 #if defined(THREADED_RTS) && !defined(NOSMP)
356 #error BaseReg must be in a register for THREADED_RTS
358 #define BaseReg (&((struct PartCapability_ *)MainCapability)->r)
359 #define ASSIGN_BaseReg(e) (e)
362 #if defined(REG_Sp) && !defined(NO_GLOBAL_REG_DECLS)
363 GLOBAL_REG_DECL(P_,Sp,REG_Sp)
365 #define Sp (BaseReg->rSp)
368 #if defined(REG_SpLim) && !defined(NO_GLOBAL_REG_DECLS)
369 GLOBAL_REG_DECL(P_,SpLim,REG_SpLim)
371 #define SpLim (BaseReg->rSpLim)
374 #if defined(REG_Hp) && !defined(NO_GLOBAL_REG_DECLS)
375 GLOBAL_REG_DECL(P_,Hp,REG_Hp)
377 #define Hp (BaseReg->rHp)
380 #if defined(REG_HpLim) && !defined(NO_GLOBAL_REG_DECLS)
381 GLOBAL_REG_DECL(P_,HpLim,REG_HpLim)
383 #define HpLim (BaseReg->rHpLim)
386 #if defined(REG_CurrentTSO) && !defined(NO_GLOBAL_REG_DECLS)
387 GLOBAL_REG_DECL(struct _StgTSO *,CurrentTSO,REG_CurrentTSO)
389 #define CurrentTSO (BaseReg->rCurrentTSO)
392 #if defined(REG_CurrentNursery) && !defined(NO_GLOBAL_REG_DECLS)
393 GLOBAL_REG_DECL(bdescr *,CurrentNursery,REG_CurrentNursery)
395 #define CurrentNursery (BaseReg->rCurrentNursery)
398 #if defined(REG_HpAlloc) && !defined(NO_GLOBAL_REG_DECLS)
399 GLOBAL_REG_DECL(bdescr *,HpAlloc,REG_HpAlloc)
401 #define HpAlloc (BaseReg->rHpAlloc)
404 #if defined(REG_SparkHd) && !defined(NO_GLOBAL_REG_DECLS)
405 GLOBAL_REG_DECL(bdescr *,SparkHd,REG_SparkHd)
407 #define SparkHd (BaseReg->rSparks.hd)
410 #if defined(REG_SparkTl) && !defined(NO_GLOBAL_REG_DECLS)
411 GLOBAL_REG_DECL(bdescr *,SparkTl,REG_SparkTl)
413 #define SparkTl (BaseReg->rSparks.tl)
416 #if defined(REG_SparkBase) && !defined(NO_GLOBAL_REG_DECLS)
417 GLOBAL_REG_DECL(bdescr *,SparkBase,REG_SparkBase)
419 #define SparkBase (BaseReg->rSparks.base)
422 #if defined(REG_SparkLim) && !defined(NO_GLOBAL_REG_DECLS)
423 GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim)
425 #define SparkLim (BaseReg->rSparks.lim)
428 /* -----------------------------------------------------------------------------
429 Get absolute function pointers from the register table, to save
438 as long as the offset is within the range of a signed byte
439 (-128..+127). So we pick some common absolute_addresses and put
440 them in the register table. As a bonus, linking time should also
443 Other possible candidates in order of importance:
446 stg_CAF_BLACKHOLE_info
449 anything else probably isn't worth the effort.
451 -------------------------------------------------------------------------- */
454 #define FunReg ((StgFunTable *)((void *)BaseReg - sizeof(StgFunTable)))
456 #define stg_gc_enter_1 (FunReg->stgGCEnter1)
457 #define stg_gc_fun (FunReg->stgGCFun)
459 /* -----------------------------------------------------------------------------
460 For any registers which are denoted "caller-saves" by the C calling
461 convention, we have to emit code to save and restore them across C
463 -------------------------------------------------------------------------- */
465 #ifdef CALLER_SAVES_R1
466 #define CALLER_SAVE_R1 SAVE_R1 = R1;
467 #define CALLER_RESTORE_R1 R1 = SAVE_R1;
469 #define CALLER_SAVE_R1 /* nothing */
470 #define CALLER_RESTORE_R1 /* nothing */
473 #ifdef CALLER_SAVES_R2
474 #define CALLER_SAVE_R2 SAVE_R2 = R2;
475 #define CALLER_RESTORE_R2 R2 = SAVE_R2;
477 #define CALLER_SAVE_R2 /* nothing */
478 #define CALLER_RESTORE_R2 /* nothing */
481 #ifdef CALLER_SAVES_R3
482 #define CALLER_SAVE_R3 SAVE_R3 = R3;
483 #define CALLER_RESTORE_R3 R3 = SAVE_R3;
485 #define CALLER_SAVE_R3 /* nothing */
486 #define CALLER_RESTORE_R3 /* nothing */
489 #ifdef CALLER_SAVES_R4
490 #define CALLER_SAVE_R4 SAVE_R4 = R4;
491 #define CALLER_RESTORE_R4 R4 = SAVE_R4;
493 #define CALLER_SAVE_R4 /* nothing */
494 #define CALLER_RESTORE_R4 /* nothing */
497 #ifdef CALLER_SAVES_R5
498 #define CALLER_SAVE_R5 SAVE_R5 = R5;
499 #define CALLER_RESTORE_R5 R5 = SAVE_R5;
501 #define CALLER_SAVE_R5 /* nothing */
502 #define CALLER_RESTORE_R5 /* nothing */
505 #ifdef CALLER_SAVES_R6
506 #define CALLER_SAVE_R6 SAVE_R6 = R6;
507 #define CALLER_RESTORE_R6 R6 = SAVE_R6;
509 #define CALLER_SAVE_R6 /* nothing */
510 #define CALLER_RESTORE_R6 /* nothing */
513 #ifdef CALLER_SAVES_R7
514 #define CALLER_SAVE_R7 SAVE_R7 = R7;
515 #define CALLER_RESTORE_R7 R7 = SAVE_R7;
517 #define CALLER_SAVE_R7 /* nothing */
518 #define CALLER_RESTORE_R7 /* nothing */
521 #ifdef CALLER_SAVES_R8
522 #define CALLER_SAVE_R8 SAVE_R8 = R8;
523 #define CALLER_RESTORE_R8 R8 = SAVE_R8;
525 #define CALLER_SAVE_R8 /* nothing */
526 #define CALLER_RESTORE_R8 /* nothing */
529 #ifdef CALLER_SAVES_R9
530 #define CALLER_SAVE_R9 SAVE_R9 = R9;
531 #define CALLER_RESTORE_R9 R9 = SAVE_R9;
533 #define CALLER_SAVE_R9 /* nothing */
534 #define CALLER_RESTORE_R9 /* nothing */
537 #ifdef CALLER_SAVES_R10
538 #define CALLER_SAVE_R10 SAVE_R10 = R10;
539 #define CALLER_RESTORE_R10 R10 = SAVE_R10;
541 #define CALLER_SAVE_R10 /* nothing */
542 #define CALLER_RESTORE_R10 /* nothing */
545 #ifdef CALLER_SAVES_F1
546 #define CALLER_SAVE_F1 SAVE_F1 = F1;
547 #define CALLER_RESTORE_F1 F1 = SAVE_F1;
549 #define CALLER_SAVE_F1 /* nothing */
550 #define CALLER_RESTORE_F1 /* nothing */
553 #ifdef CALLER_SAVES_F2
554 #define CALLER_SAVE_F2 SAVE_F2 = F2;
555 #define CALLER_RESTORE_F2 F2 = SAVE_F2;
557 #define CALLER_SAVE_F2 /* nothing */
558 #define CALLER_RESTORE_F2 /* nothing */
561 #ifdef CALLER_SAVES_F3
562 #define CALLER_SAVE_F3 SAVE_F3 = F3;
563 #define CALLER_RESTORE_F3 F3 = SAVE_F3;
565 #define CALLER_SAVE_F3 /* nothing */
566 #define CALLER_RESTORE_F3 /* nothing */
569 #ifdef CALLER_SAVES_F4
570 #define CALLER_SAVE_F4 SAVE_F4 = F4;
571 #define CALLER_RESTORE_F4 F4 = SAVE_F4;
573 #define CALLER_SAVE_F4 /* nothing */
574 #define CALLER_RESTORE_F4 /* nothing */
577 #ifdef CALLER_SAVES_D1
578 #define CALLER_SAVE_D1 SAVE_D1 = D1;
579 #define CALLER_RESTORE_D1 D1 = SAVE_D1;
581 #define CALLER_SAVE_D1 /* nothing */
582 #define CALLER_RESTORE_D1 /* nothing */
585 #ifdef CALLER_SAVES_D2
586 #define CALLER_SAVE_D2 SAVE_D2 = D2;
587 #define CALLER_RESTORE_D2 D2 = SAVE_D2;
589 #define CALLER_SAVE_D2 /* nothing */
590 #define CALLER_RESTORE_D2 /* nothing */
593 #ifdef CALLER_SAVES_L1
594 #define CALLER_SAVE_L1 SAVE_L1 = L1;
595 #define CALLER_RESTORE_L1 L1 = SAVE_L1;
597 #define CALLER_SAVE_L1 /* nothing */
598 #define CALLER_RESTORE_L1 /* nothing */
601 #ifdef CALLER_SAVES_Sp
602 #define CALLER_SAVE_Sp SAVE_Sp = Sp;
603 #define CALLER_RESTORE_Sp Sp = SAVE_Sp;
605 #define CALLER_SAVE_Sp /* nothing */
606 #define CALLER_RESTORE_Sp /* nothing */
609 #ifdef CALLER_SAVES_SpLim
610 #define CALLER_SAVE_SpLim SAVE_SpLim = SpLim;
611 #define CALLER_RESTORE_SpLim SpLim = SAVE_SpLim;
613 #define CALLER_SAVE_SpLim /* nothing */
614 #define CALLER_RESTORE_SpLim /* nothing */
617 #ifdef CALLER_SAVES_Hp
618 #define CALLER_SAVE_Hp SAVE_Hp = Hp;
619 #define CALLER_RESTORE_Hp Hp = SAVE_Hp;
621 #define CALLER_SAVE_Hp /* nothing */
622 #define CALLER_RESTORE_Hp /* nothing */
625 #ifdef CALLER_SAVES_HpLim
626 #define CALLER_SAVE_HpLim SAVE_HpLim = HpLim;
627 #define CALLER_RESTORE_HpLim HpLim = SAVE_HpLim;
629 #define CALLER_SAVE_HpLim /* nothing */
630 #define CALLER_RESTORE_HpLim /* nothing */
633 #ifdef CALLER_SAVES_Base
635 #error "Can't have caller-saved BaseReg with THREADED_RTS"
637 #define CALLER_SAVE_Base /* nothing */
638 #define CALLER_RESTORE_Base BaseReg = &MainRegTable;
640 #define CALLER_SAVE_Base /* nothing */
641 #define CALLER_RESTORE_Base /* nothing */
644 #ifdef CALLER_SAVES_CurrentTSO
645 #define CALLER_SAVE_CurrentTSO SAVE_CurrentTSO = CurrentTSO;
646 #define CALLER_RESTORE_CurrentTSO CurrentTSO = SAVE_CurrentTSO;
648 #define CALLER_SAVE_CurrentTSO /* nothing */
649 #define CALLER_RESTORE_CurrentTSO /* nothing */
652 #ifdef CALLER_SAVES_CurrentNursery
653 #define CALLER_SAVE_CurrentNursery SAVE_CurrentNursery = CurrentNursery;
654 #define CALLER_RESTORE_CurrentNursery CurrentNursery = SAVE_CurrentNursery;
656 #define CALLER_SAVE_CurrentNursery /* nothing */
657 #define CALLER_RESTORE_CurrentNursery /* nothing */
660 #ifdef CALLER_SAVES_HpAlloc
661 #define CALLER_SAVE_HpAlloc SAVE_HpAlloc = HpAlloc;
662 #define CALLER_RESTORE_HpAlloc HpAlloc = SAVE_HpAlloc;
664 #define CALLER_SAVE_HpAlloc /* nothing */
665 #define CALLER_RESTORE_HpAlloc /* nothing */
668 #ifdef CALLER_SAVES_SparkHd
669 #define CALLER_SAVE_SparkHd SAVE_SparkHd = SparkHd;
670 #define CALLER_RESTORE_SparkHd SparkHd = SAVE_SparkHd;
672 #define CALLER_SAVE_SparkHd /* nothing */
673 #define CALLER_RESTORE_SparkHd /* nothing */
676 #ifdef CALLER_SAVES_SparkTl
677 #define CALLER_SAVE_SparkTl SAVE_SparkTl = SparkTl;
678 #define CALLER_RESTORE_SparkTl SparkTl = SAVE_SparkTl;
680 #define CALLER_SAVE_SparkTl /* nothing */
681 #define CALLER_RESTORE_SparkTl /* nothing */
684 #ifdef CALLER_SAVES_SparkBase
685 #define CALLER_SAVE_SparkBase SAVE_SparkBase = SparkBase;
686 #define CALLER_RESTORE_SparkBase SparkBase = SAVE_SparkBase;
688 #define CALLER_SAVE_SparkBase /* nothing */
689 #define CALLER_RESTORE_SparkBase /* nothing */
692 #ifdef CALLER_SAVES_SparkLim
693 #define CALLER_SAVE_SparkLim SAVE_SparkLim = SparkLim;
694 #define CALLER_RESTORE_SparkLim SparkLim = SAVE_SparkLim;
696 #define CALLER_SAVE_SparkLim /* nothing */
697 #define CALLER_RESTORE_SparkLim /* nothing */
700 #endif /* IN_STG_CODE */
702 /* ----------------------------------------------------------------------------
703 Handy bunches of saves/restores
704 ------------------------------------------------------------------------ */
708 #define CALLER_SAVE_USER \
725 /* Save Base last, since the others may
726 be addressed relative to it */
727 #define CALLER_SAVE_SYSTEM \
732 CALLER_SAVE_CurrentTSO \
733 CALLER_SAVE_CurrentNursery \
734 CALLER_SAVE_SparkHd \
735 CALLER_SAVE_SparkTl \
736 CALLER_SAVE_SparkBase \
737 CALLER_SAVE_SparkLim \
740 #define CALLER_RESTORE_USER \
757 /* Restore Base first, since the others may
758 be addressed relative to it */
759 #define CALLER_RESTORE_SYSTEM \
760 CALLER_RESTORE_Base \
762 CALLER_RESTORE_SpLim \
764 CALLER_RESTORE_HpLim \
765 CALLER_RESTORE_CurrentTSO \
766 CALLER_RESTORE_CurrentNursery \
767 CALLER_RESTORE_SparkHd \
768 CALLER_RESTORE_SparkTl \
769 CALLER_RESTORE_SparkBase \
770 CALLER_RESTORE_SparkLim
772 #else /* not IN_STG_CODE */
774 #define CALLER_SAVE_USER /* nothing */
775 #define CALLER_SAVE_SYSTEM /* nothing */
776 #define CALLER_RESTORE_USER /* nothing */
777 #define CALLER_RESTORE_SYSTEM /* nothing */
779 #endif /* IN_STG_CODE */
780 #define CALLER_SAVE_ALL \
784 #define CALLER_RESTORE_ALL \
785 CALLER_RESTORE_SYSTEM \