2 % (c) The OBFUSCATION-THROUGH-GRATUITOUS-PREPROCESSOR-ABUSE Project,
3 % Glasgow University, 1990-1994
5 %************************************************************************
7 \section[info-table-macros]{Info-table macros}
9 %************************************************************************
11 We define {\em info tables} here. First, all the different pieces of
12 an info table (entry code, evac code, etc.); then all the different
13 kinds of info tables (SPEC, DYN, etc). NB: some of the parallel-only
14 kinds are defined in \tr{Parallel.lh}, not here.
16 An info-table contains several fields. The first field is
17 the label of the closure's {\em standard-entry code}. This is used by
18 the reducer to ``evaluate'' the closure. The remaining fields are used
19 by the garbage collector and other parts of the runtime
20 system. Info-tables are declared using the C macros defined below.
21 The details of the contents are determined by the storage manager and
22 are not of interest outside it.
24 Info tables may either be {\em reversed} or not. Reversed is normal
25 and preferred, but it requires ``assembler mangling'' of the C
26 compiler output. (The native-code generator does reversed info-tables
27 automagically.) With reversed info tables, (a)~the words are reversed
28 [obviously], (b)~the info-table's C label addresses the word {\em just
29 after} the info table (where its associated entry code ``happens to be''),
30 and (c)~the entry-code word in the info table is omitted (it's
33 Info-table reversal is hidden behind the @IREL@ macro.
35 The following fields are used when defining particular info-tables.
36 Some sorts of info-table (e.g. @FETCHME_ITBL@) don't need all these
37 fields to be specified.
41 The name used to create labels for the info-table, profiling
44 \item[\tr{entry_code}:]
45 The function which is called when entering the closure.
47 \item[\tr{update_code}:]
48 The function which is called when updating the closure (constructors only).
51 (So much for the Spineless {\em Tagless} G-Machine...) Used for
55 Similar-but-different info to the \tr{tag} stuff; the
56 parallel world needs more elaborate info.
59 The size of the closure (see \tr{SMClosures.lh} for a precise
60 definition of ``size''). Used by the garbage-collector, not the
64 The number of pointers in the closure. Used by the garbage-collector,
65 not the Haskell reducer.
68 Whether the info-table is local to this module or not.
69 The field is set to @static@ if the info-table is
70 local, and is empty otherwise.
72 \item[@entry_localness@]
73 Whether the @entry_code@ routine is local to this module or not.
74 This field can have the following values:
77 The entry code is global.
79 The entry code is local.
83 This identifies the general sort of the closure for profiling purposes.
84 It can have the following values (defined in CostCentre.lh):
92 A partial application.
94 A thunk, or suspension.
100 A Foreign object (non-Haskell heap resident).
102 The Stable Pointer table. (There should only be one of these but it
103 represents a form of weak space leak since it can't shrink to meet
104 non-demand so it may be worth watching separately? ADR)
105 \item[@INTERNAL_KIND@]
106 Something internal to the runtime system.
110 This is a string used to identify the closure for profiling purposes.
115 SPEC_N_ITBL(RBH_Save_0_info,RBH_Save_0_entry,UpdErr,0,INFO_OTHER_TAG,2,0,,IF_,INTERNAL_KIND,"RBH-SAVE","RBH_Save_0");
118 %************************************************************************
120 \subsection[info-table-common-up]{The commoned-up info-table world}
122 %************************************************************************
124 Since lots of info-tables share the same information (which doesn't
125 change at run time) needlessly, we gather this common information
126 together into a rep-table.
128 Conditionally present data (concerning the parallel world, and also
129 information for the collectors) are gathered into unique rep-tables,
130 which are pointed to from info-tables. This saves several words for
131 each closure we build, at the cost of making garbage collection and
132 fetching of data from info-tables a little more hairy.
134 Size and pointers fields go away altogether, save for @GEN@ closures
135 where they are tacked on to the end of info-tables.
137 %************************************************************************
139 \subsection[info-table-common]{Bits common to all info-tables}
141 %************************************************************************
143 The entry code for a closure, its type, its ``size'', and the number
144 of pointer-words it contains are the same in every info table. For
145 the parallel system, two flush code-entries are also standard.
147 Multi-slurp protection:
149 #ifndef SMInfoTables_H
150 #define SMInfoTables_H
154 #ifdef __STG_REV_TBLS__
156 # define IREL(offset) (-(offset))
158 /* NB: the ENT_ macro (StgMacros.lh) must also be changed */
160 # define ENTRY_CODE(infoptr) ((F_)(infoptr))
162 #else /* boring non-reversed info tables */
164 # define IREL(offset) (offset)
166 # define ENTRY_CODE(infoptr) (((FP_)(infoptr))[IREL(0)])
168 #endif /* non-fixed size info tables */
172 #define INFO_TAG(infoptr) ((I_) ((P_)(infoptr))[IREL(1)])
173 #define EVAL_TAG(infoptr) (INFO_TAG(infoptr) >= 0)
178 #define INFO_INTERNAL (~0L) /* Should never see this */
180 #define INFO_UNUSED (~0L)
181 /* We'd like to see this go away in code pointer fields, with specialized code
182 to print out an appropriate error message instead.
183 WDP 94/11: At least make it an Obviously Weird Value?
189 %************************************************************************
191 \subsection[info-table-rtbl]{Rep tables in an info table}
193 %************************************************************************
195 Common information is pointed to by the rep table pointer. We want to
196 use extern declarations almost everywhere except for the single module
197 (\tr{Rep.lc}) in which the rep tables are declared locally.
200 #if defined(COMPILING_REP_LC) || defined(COMPILING_GHC)
201 # define MAYBE_DECLARE_RTBL(l,s,p)
203 # define MAYBE_DECLARE_RTBL(l,s,p) EXTDATA_RO(MK_REP_REF(l,s,p));
206 #define INFO_RTBL(infoptr) (((PP_)(infoptr))[IREL(2)])
209 %************************************************************************
211 \subsection{Maybe-there-maybe-not fields in an info table}
213 %************************************************************************
215 That's about it for the fixed stuff...entry code, a tag and an RTBL pointer.
218 #define FIXED_INFO_WORDS 3
221 %************************************************************************
223 \subsubsection{Profiling-only fields in an info table}
225 %************************************************************************
227 These macros result in the profiling kind and description string being
228 included only if required.
230 #define PROFILING_INFO_OFFSET (FIXED_INFO_WORDS)
232 #if !defined(PROFILING)
233 # define PROFILING_INFO_WORDS 0
234 # define INCLUDE_PROFILING_INFO(base_name)
235 # define INREGS_PROFILING_INFO
238 # define PROFILING_INFO_WORDS 1
240 # define INCLUDE_PROFILING_INFO(base_name) , (W_)REF_CAT_IDENT(base_name)
241 # define INREGS_PROFILING_INFO ,INFO_UNUSED
243 # define INFO_CAT(infoptr) (((ClCategory *)(infoptr))[IREL(PROFILING_INFO_OFFSET)])
248 %************************************************************************
250 \subsubsection{Non-standard fields in an info table: where they'll be}
252 %************************************************************************
254 The @UPDATE_CODE@ field is a pointer to the update code for a constructor.
255 I believe that constructors are always of the following types:
266 Info tables for these types have non-standard update code fields. In addition,
267 because @GEN@ closures have further non-standard fields (size, ptrs), the
268 info tables for @GEN_U@ closures also have a non-standard update code field
269 (which is filled in with @StdErrorCode@).
271 When we're in the parallel world, we also have to know which registers are
272 live when we're returning a constructor in registers, so we have a second
273 word for that as well.
277 #define UPDATE_INFO_OFFSET (PROFILING_INFO_OFFSET+PROFILING_INFO_WORDS)
280 # define UPDATE_INFO_WORDS 1
281 # define INCLUDE_UPDATE_INFO(upd,live) ,(W_)upd
283 # define UPDATE_INFO_WORDS 2
284 # define INCLUDE_UPDATE_INFO(upd,live) ,(W_)upd,(W_)live
287 #define UPDATE_CODE(infoptr) (((FP_)(infoptr))[IREL(UPDATE_INFO_OFFSET)])
288 #define INFO_LIVENESS(infoptr) (((P_)(infoptr))[IREL(UPDATE_INFO_OFFSET+1)])
291 @GEN@ closures have the size and number of pointers in the info table
292 rather than the rep table. These non-standard fields follow the update
293 code field (which is only required for @GEN_N@ closures, but which we
294 include in @GEN_U@ closures just to keep this other stuff at a consistent
298 #define GEN_INFO_OFFSET (UPDATE_INFO_OFFSET+UPDATE_INFO_WORDS)
299 #define GEN_INFO_WORDS 2
300 #define INCLUDE_GEN_INFO(size,ptrs) ,(W_)size,(W_)ptrs
302 #define GEN_INFO_SIZE(infoptr) ((I_)((P_)(infoptr))[IREL(GEN_INFO_OFFSET)])
303 #define GEN_INFO_NoPTRS(infoptr) ((I_)((P_)(infoptr))[IREL(GEN_INFO_OFFSET+1)])
306 @CONST@ closures have a pointer to a static version of the closure in their
307 info tables. This non-standard field follows their update code field.
310 #define CONST_INFO_OFFSET (UPDATE_INFO_OFFSET+UPDATE_INFO_WORDS)
311 #define CONST_INFO_WORDS 1
312 #define INCLUDE_CONST_INFO(closure) ,(W_)closure
314 #define CONST_STATIC_CLOSURE(infoptr) (((PP_)(infoptr))[IREL(CONST_INFO_OFFSET)])
317 @STATIC@ closures are like @GEN@ closures in that they also have the
318 size and number of pointers in the info table rather than the rep
319 table. Again, these non-standard fields follow the update code field
320 (which I believe is not actually needed for STATIC closures).
323 #define STATIC_INFO_OFFSET (UPDATE_INFO_OFFSET+UPDATE_INFO_WORDS)
324 #define STATIC_INFO_WORDS 2
325 #define INCLUDE_STATIC_INFO(size,ptrs) ,(W_)size,(W_)ptrs
327 #define STATIC_INFO_SIZE(infoptr) ((I_)((P_)(infoptr))[IREL(STATIC_INFO_OFFSET)])
328 #define STATIC_INFO_NoPTRS(infoptr) ((I_)((P_)(infoptr))[IREL(STATIC_INFO_OFFSET+1)])
331 In the parallel system, all updatable closures have corresponding
332 revertible black holes. When we are assembly-mangling, we guarantee that
333 the revertible black hole code precedes the normal entry code, so that
334 the RBH info table resides at a fixed offset from the normal info table.
335 Otherwise, we add the RBH info table pointer to the end of the normal
336 info table and vice versa.
339 #if defined(PAR) || defined(GRAN)
340 # define RBH_INFO_OFFSET (GEN_INFO_OFFSET+GEN_INFO_WORDS)
342 # define INCLUDE_SPEC_PADDING \
343 INCLUDE_UPDATE_INFO(INFO_UNUSED,INFO_UNUSED) \
344 INCLUDE_GEN_INFO(INFO_UNUSED,INFO_UNUSED)
346 # ifdef RBH_MAGIC_OFFSET
348 # define RBH_INFO_WORDS 0
349 # define INCLUDE_RBH_INFO(infoptr)
351 # define RBH_INFOPTR(infoptr) (((P_)infoptr) - RBH_MAGIC_OFFSET)
352 # define REVERT_INFOPTR(infoptr) (((P_)infoptr) + RBH_MAGIC_OFFSET)
356 # define RBH_INFO_WORDS 1
357 # define INCLUDE_RBH_INFO(infoptr) ,(W_)infoptr
359 # define RBH_INFOPTR(infoptr) (((PP_)(infoptr))[IREL(RBH_INFO_OFFSET)])
360 # define REVERT_INFOPTR(infoptr) (((PP_)(infoptr))[IREL(RBH_INFO_OFFSET)])
365 P_ convertToRBH PROTO((P_ closure));
367 void convertFromRBH PROTO((P_ closure));
369 void convertToFetchMe PROTO((P_ closure, globalAddr *ga));
375 %************************************************************************
377 \subsection{Maybe-there-maybe-not fields in a rep table}
379 %************************************************************************
381 %************************************************************************
383 \subsubsection{Type field in a rep table}
385 %************************************************************************
387 The @INFO_TYPE@ field in the rep table tells what sort of animal
391 #define TYPE_INFO_OFFSET 0
392 #define TYPE_INFO_WORDS 1
393 #define INCLUDE_TYPE_INFO(kind) (W_)CAT3(INFO_,kind,_TYPE)
395 #define INFO_TYPE(infoptr) (((P_)(INFO_RTBL(infoptr)))[TYPE_INFO_OFFSET])
398 The least significant 9 bits of the info-type are used as follows:
400 \begin{tabular}{||l|l||} \hline
401 Bit & Interpretation \\ \hline
402 0 & 1 $\Rightarrow$ Head normal form \\
403 1 & 1 $\Rightarrow$ Don't spark me (Any HNF will have this set to 1) \\
404 2 & 1 $\Rightarrow$ This is a static closure \\
405 3 & 1 $\Rightarrow$ Has mutable pointer fields \\
406 4 & 1 $\Rightarrow$ May be updated (inconsistent with being a HNF) \\
407 5 & 1 $\Rightarrow$ Is a "primitive" array (a BIG structure) \\
408 6 & 1 $\Rightarrow$ Is a black hole \\
409 7 & 1 $\Rightarrow$ Is an indirection \\
410 8 & 1 $\Rightarrow$ Is a thunk \\
414 Updatable structures (@_UP@) are thunks that may be shared. Primitive
415 arrays (@_BM@ -- Big Mothers) are structures that are always held
416 in-memory (basically extensions of a closure). Because there may be
417 offsets into these arrays, a primitive array cannot be handled as a
418 FetchMe in the parallel system, but must be shipped in its entirety if
419 its parent closure is shipped.
422 #define IP_TAG_BITS 9
424 #define _NF 0x0001 /* Normal form */
425 #define _NS 0x0002 /* Don't spark */
426 #define _ST 0x0004 /* Is static */
427 #define _MU 0x0008 /* Is mutable */
428 #define _UP 0x0010 /* Is updatable (but not mutable) */
429 #define _BM 0x0020 /* Is a "primitive" array */
430 #define _BH 0x0040 /* Is a black hole */
431 #define _IN 0x0080 /* Is an indirection */
432 #define _TH 0x0100 /* Is a thunk */
434 #define IS_NF(infoptr) ((INFO_TYPE(infoptr)&_NF) != 0)
435 #define IS_MUTABLE(infoptr) ((INFO_TYPE(infoptr)&_MU) != 0)
436 #define IS_STATIC(infoptr) ((INFO_TYPE(infoptr)&_ST) != 0)
437 #define IS_UPDATABLE(infoptr) ((INFO_TYPE(infoptr)&_UP) != 0)
438 #define IS_BIG_MOTHER(infoptr) ((INFO_TYPE(infoptr)&_BM) != 0)
439 #define IS_BLACK_HOLE(infoptr) ((INFO_TYPE(infoptr)&_BH) != 0)
440 #define IS_INDIRECTION(infoptr) ((INFO_TYPE(infoptr)&_IN) != 0)
441 #define IS_THUNK(infoptr) ((INFO_TYPE(infoptr)&_TH) != 0)
443 #define SHOULD_SPARK(closure) ((INFO_TYPE(INFO_PTR(closure))&_NS) == 0)
446 The other bits in the info-type field simply give a unique bit-pattern
447 to identify the closure type.
450 #define IP_TAG_BIT_MASK ((1L<<IP_TAG_BITS)-1)
452 #define BASE_INFO_TYPE(infoptr) (INFO_TYPE(infoptr) & (~IP_TAG_BIT_MASK)) /* Strips out the tag bits */
454 #define MAKE_BASE_INFO_TYPE(x) ((x) << IP_TAG_BITS)
456 #define INFO_SPEC_TYPE (MAKE_BASE_INFO_TYPE(1L))
457 #define INFO_GEN_TYPE (MAKE_BASE_INFO_TYPE(2L))
458 #define INFO_DYN_TYPE (MAKE_BASE_INFO_TYPE(3L) | _NF | _NS)
459 #define INFO_TUPLE_TYPE (MAKE_BASE_INFO_TYPE(4L) | _NF | _NS | _BM)
460 #define INFO_DATA_TYPE (MAKE_BASE_INFO_TYPE(5L) | _NF | _NS | _BM)
461 #define INFO_MUTUPLE_TYPE (MAKE_BASE_INFO_TYPE(6L) | _NF | _NS | _MU | _BM)
462 #define INFO_IMMUTUPLE_TYPE (MAKE_BASE_INFO_TYPE(7L) | _NF | _NS | _BM)
463 #define INFO_STATIC_TYPE (MAKE_BASE_INFO_TYPE(8L) | _NS | _ST)
464 #define INFO_CONST_TYPE (MAKE_BASE_INFO_TYPE(9L) | _NF | _NS)
465 #define INFO_CHARLIKE_TYPE (MAKE_BASE_INFO_TYPE(10L) | _NF | _NS)
466 #define INFO_INTLIKE_TYPE (MAKE_BASE_INFO_TYPE(11L) | _NF | _NS)
467 #define INFO_BH_TYPE (MAKE_BASE_INFO_TYPE(12L) | _NS | _BH)
468 #define INFO_BQ_TYPE (MAKE_BASE_INFO_TYPE(13L) | _NS | _MU | _BH)
469 #define INFO_IND_TYPE (MAKE_BASE_INFO_TYPE(14L) | _NS | _IN)
470 #define INFO_CAF_TYPE (MAKE_BASE_INFO_TYPE(15L) | _NF | _NS | _ST | _IN)
471 #define INFO_FM_TYPE (MAKE_BASE_INFO_TYPE(16L))
472 #define INFO_TSO_TYPE (MAKE_BASE_INFO_TYPE(17L) | _MU)
473 #define INFO_STKO_TYPE (MAKE_BASE_INFO_TYPE(18L))
474 #define INFO_SPEC_RBH_TYPE (MAKE_BASE_INFO_TYPE(19L) | _NS | _MU | _BH)
475 #define INFO_GEN_RBH_TYPE (MAKE_BASE_INFO_TYPE(20L) | _NS | _MU | _BH)
476 #define INFO_BF_TYPE (MAKE_BASE_INFO_TYPE(21L) | _NS | _MU | _BH)
477 #define INFO_INTERNAL_TYPE (MAKE_BASE_INFO_TYPE(22L))
479 #define INFO_SPEC_N_TYPE (INFO_SPEC_TYPE | _NF | _NS)
480 #define INFO_SPEC_S_TYPE (INFO_SPEC_TYPE | _TH)
481 #define INFO_SPEC_U_TYPE (INFO_SPEC_TYPE | _UP | _TH)
483 #define INFO_GEN_N_TYPE (INFO_GEN_TYPE | _NF | _NS)
484 #define INFO_GEN_S_TYPE (INFO_GEN_TYPE | _TH)
485 #define INFO_GEN_U_TYPE (INFO_GEN_TYPE | _UP | _TH)
487 #define INFO_BH_N_TYPE (INFO_BH_TYPE)
488 #define INFO_BH_U_TYPE (INFO_BH_TYPE | _UP)
490 #define INFO_STKO_DYNAMIC_TYPE (INFO_STKO_TYPE | _MU)
491 #define INFO_STKO_STATIC_TYPE (INFO_STKO_TYPE | _ST)
493 #define INFO_FETCHME_TYPE (INFO_FM_TYPE | _MU)
494 #define INFO_FMBQ_TYPE (INFO_FM_TYPE | _MU | _BH)
496 #define MIN_INFO_TYPE 0
497 #define MAX_INFO_TYPE INFO_INTERNAL_TYPE
503 An indirection either points to HNF (post update); or is result of
504 overwriting a FetchMe, in which case the thing fetched is either
505 under evaluation (BH), or by now an HNF. Thus, indirections get @_NS@.
507 %************************************************************************
509 \subsubsection{Size/no-of-pointers fields in a rep table}
511 %************************************************************************
514 #define SIZE_INFO_OFFSET (TYPE_INFO_OFFSET+TYPE_INFO_WORDS)
515 #define SIZE_INFO_WORDS 2
516 #define INCLUDE_SIZE_INFO(size,ptrs) ,(W_)size, (W_)ptrs
518 #define INFO_SIZE(infoptr) ((I_)((FP_)(INFO_RTBL(infoptr)))[SIZE_INFO_OFFSET])
519 #define INFO_NoPTRS(infoptr) ((I_)((FP_)(INFO_RTBL(infoptr)))[SIZE_INFO_OFFSET+1])
522 %************************************************************************
524 \subsubsection{Parallel-only fields in a rep table}
526 %************************************************************************
528 There is now nothing that is specific to the parallel world (GUM), but
529 this could change so don't go deleting this little lot! KH
532 # define PAR_INFO_OFFSET (SIZE_INFO_OFFSET+SIZE_INFO_WORDS)
534 /* now the bits that are either on or off: */
536 # define PAR_INFO_WORDS 0
537 # define INCLUDE_PAR_INFO
540 %************************************************************************
542 \subsubsection{Copying-only fields in a rep table}
544 %************************************************************************
546 These macros result in the copying garbage collection code being
547 included only if required.
549 #if defined(_INFO_COPYING)
550 # include "SMcopying.h" /* Copying Code Labels */
551 # define COPY_INFO_OFFSET (PAR_INFO_OFFSET+PAR_INFO_WORDS)
552 # define COPY_INFO_WORDS 2
553 # define INCLUDE_COPYING_INFO(evac, scav) ,(W_)evac,(W_)scav
556 * use these if you have an unquenchable urge to dig around in
557 * info tables (e.g., runtime/.../StgDebug.lc)
560 # define INFO_EVAC_2S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COPY_INFO_OFFSET])
561 # define INFO_SCAV_2S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COPY_INFO_OFFSET + 1])
563 #else /* ! _INFO_COPYING */
565 # define COPY_INFO_WORDS 0
566 # define INCLUDE_COPYING_INFO(evac, scav)
568 #endif /* ! _INFO_COPYING */
571 %************************************************************************
573 \subsubsection{Compacting-only fields in a rep table}
575 %************************************************************************
577 These macros result in the compacting garbage collection code being
578 included only if required. This includes the variable length
579 specialised marking code.
582 #if !defined(_INFO_COMPACTING)
584 # define INCLUDE_COMPACTING_INFO(scanlink,prmark,scanmove,marking)
585 # define SPEC_COMPACTING_INFO(scanlink,prmark,scanmove,marking)
587 #else /* defined(_INFO_COMPACTING) */
589 # include "SMcompact.h" /* Single Space Compacting Code */
590 # include "SMmark.h" /* Pointer Reversal Marking Code Labels */
592 /* For SPEC closures compacting info is variable length -> must come last */
594 # define COMPACTING_INFO_OFFSET (COPY_INFO_OFFSET+COPY_INFO_WORDS)
596 # define INCLUDE_COMPACTING_INFO(scanlink,prmark,scanmove,marking) \
597 ,(W_)scanlink,(W_)prmark \
598 ,(W_)scanmove,(W_)marking
600 # define SPEC_COMPACTING_INFO(scanlink,prmark,scanmove,prreturn) \
601 ,(W_)scanlink,(W_)prmark \
606 # define INFO_SCAN_LINK_1S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COMPACTING_INFO_OFFSET])
607 # define INFO_MARK_1S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COMPACTING_INFO_OFFSET+1])
608 # define INFO_SCAN_MOVE_1S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COMPACTING_INFO_OFFSET+2])
609 # define INFO_MARKED_1S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COMPACTING_INFO_OFFSET+3])
610 # define INFO_MARKING_1S(infoptr) (((FP_)(INFO_RTBL(infoptr)))[COMPACTING_INFO_OFFSET+4])
612 #ifndef COMPILING_GHC
613 extern F_ _Dummy_Static_entry(STG_NO_ARGS);
614 extern F_ _Dummy_Ind_entry(STG_NO_ARGS);
615 extern F_ _Dummy_Caf_entry(STG_NO_ARGS);
616 extern F_ _Dummy_Const_entry(STG_NO_ARGS);
617 extern F_ _Dummy_CharLike_entry(STG_NO_ARGS);
620 #endif /* _INFO_COMPACTING */
623 %************************************************************************
625 \subsection[SPEC_ITBL]{@SPEC_x_ITBL@: @SPEC@ info-tables}
627 %************************************************************************
629 Normal-form and updatable (non-normal-form) variants.
633 #define SPEC_N_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
634 CAT_DECLARE(infolbl,kind,descr,type) \
635 entry_localness(entry_code); \
636 localness W_ infolbl[] = { \
639 ,(W_) MK_REP_REF(Spec_N,size,ptrs) \
640 INCLUDE_PROFILING_INFO(infolbl) \
641 INCLUDE_UPDATE_INFO(upd_code,liveness) \
644 MAYBE_DECLARE_RTBL(Spec_N,1,0)
645 MAYBE_DECLARE_RTBL(Spec_N,1,1)
646 MAYBE_DECLARE_RTBL(Spec_N,2,0)
647 MAYBE_DECLARE_RTBL(Spec_N,2,1)
648 MAYBE_DECLARE_RTBL(Spec_N,2,2)
649 MAYBE_DECLARE_RTBL(Spec_N,3,0)
650 MAYBE_DECLARE_RTBL(Spec_N,3,1)
651 MAYBE_DECLARE_RTBL(Spec_N,3,2)
652 MAYBE_DECLARE_RTBL(Spec_N,3,3)
653 MAYBE_DECLARE_RTBL(Spec_N,4,0)
654 MAYBE_DECLARE_RTBL(Spec_N,4,4)
655 MAYBE_DECLARE_RTBL(Spec_N,5,0)
656 MAYBE_DECLARE_RTBL(Spec_N,5,5)
657 MAYBE_DECLARE_RTBL(Spec_N,6,6)
658 MAYBE_DECLARE_RTBL(Spec_N,7,7)
659 MAYBE_DECLARE_RTBL(Spec_N,8,8)
660 MAYBE_DECLARE_RTBL(Spec_N,9,9)
661 MAYBE_DECLARE_RTBL(Spec_N,10,10)
662 MAYBE_DECLARE_RTBL(Spec_N,11,11)
663 MAYBE_DECLARE_RTBL(Spec_N,12,12)
665 #define SPEC_N_RTBL(size,ptrs) \
666 const W_ MK_REP_LBL(Spec_N,size,ptrs)[] = { \
667 INCLUDE_TYPE_INFO(SPEC_N) \
668 INCLUDE_SIZE_INFO(size,ptrs) \
670 INCLUDE_COPYING_INFO(CAT2(_Evacuate_,size),CAT4(_Scavenge_,size,_,ptrs)) \
671 SPEC_COMPACTING_INFO(CAT4(_ScanLink_,size,_,ptrs), \
672 CAT2(_PRStart_,ptrs), \
673 CAT2(_ScanMove_,size),CAT2(_PRIn_,ptrs)) \
676 #define SPEC_S_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
677 CAT_DECLARE(infolbl,kind,descr,type) \
678 entry_localness(entry_code); \
679 localness W_ infolbl[] = { \
682 ,(W_) MK_REP_REF(Spec_S,size,ptrs) \
683 INCLUDE_PROFILING_INFO(infolbl) \
684 INCLUDE_UPDATE_INFO(upd_code,liveness) \
687 MAYBE_DECLARE_RTBL(Spec_S,1,0)
688 MAYBE_DECLARE_RTBL(Spec_S,1,1)
689 MAYBE_DECLARE_RTBL(Spec_S,2,0)
690 MAYBE_DECLARE_RTBL(Spec_S,2,1)
691 MAYBE_DECLARE_RTBL(Spec_S,2,2)
692 MAYBE_DECLARE_RTBL(Spec_S,3,0)
693 MAYBE_DECLARE_RTBL(Spec_S,3,1)
694 MAYBE_DECLARE_RTBL(Spec_S,3,2)
695 MAYBE_DECLARE_RTBL(Spec_S,3,3)
696 MAYBE_DECLARE_RTBL(Spec_S,4,0)
697 MAYBE_DECLARE_RTBL(Spec_S,4,4)
698 MAYBE_DECLARE_RTBL(Spec_S,5,0)
699 MAYBE_DECLARE_RTBL(Spec_S,5,5)
700 MAYBE_DECLARE_RTBL(Spec_S,6,6)
701 MAYBE_DECLARE_RTBL(Spec_S,7,7)
702 MAYBE_DECLARE_RTBL(Spec_S,8,8)
703 MAYBE_DECLARE_RTBL(Spec_S,9,9)
704 MAYBE_DECLARE_RTBL(Spec_S,10,10)
705 MAYBE_DECLARE_RTBL(Spec_S,11,11)
706 MAYBE_DECLARE_RTBL(Spec_S,12,12)
708 #define SPEC_S_RTBL(size,ptrs) \
709 const W_ MK_REP_LBL(Spec_S,size,ptrs)[] = { \
710 INCLUDE_TYPE_INFO(SPEC_S) \
711 INCLUDE_SIZE_INFO(size,ptrs) \
713 INCLUDE_COPYING_INFO(CAT2(_Evacuate_,size),CAT4(_Scavenge_,size,_,ptrs)) \
714 SPEC_COMPACTING_INFO(CAT4(_ScanLink_,size,_,ptrs), \
715 CAT2(_PRStart_,ptrs), \
716 CAT2(_ScanMove_,size),CAT2(_PRIn_,ptrs)) \
719 #if defined(PAR) || defined(GRAN)
720 # define SPEC_U_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
721 entry_localness(CAT2(RBH_,entry_code)); \
722 localness W_ infolbl[]; \
723 localness W_ CAT2(RBH_,infolbl)[] = { \
724 (W_) CAT2(RBH_,entry_code) \
725 ,(W_) INFO_OTHER_TAG \
726 ,(W_) MK_REP_REF(Spec_RBH,size,ptrs) \
727 INCLUDE_PROFILING_INFO(RBH) \
728 INCLUDE_SPEC_PADDING \
729 INCLUDE_RBH_INFO(infolbl) \
731 STGFUN(CAT2(RBH_,entry_code)) { JMP_(RBH_entry); }\
732 CAT_DECLARE(infolbl,kind,descr,type) \
733 entry_localness(entry_code); \
734 localness W_ infolbl[] = { \
737 ,(W_) MK_REP_REF(Spec_U,size,ptrs) \
738 INCLUDE_PROFILING_INFO(infolbl) \
739 INCLUDE_SPEC_PADDING \
740 INCLUDE_RBH_INFO(CAT2(RBH_,infolbl)) \
743 MAYBE_DECLARE_RTBL(Spec_RBH,1,0)
744 MAYBE_DECLARE_RTBL(Spec_RBH,1,1)
745 MAYBE_DECLARE_RTBL(Spec_RBH,2,0)
746 MAYBE_DECLARE_RTBL(Spec_RBH,2,1)
747 MAYBE_DECLARE_RTBL(Spec_RBH,2,2)
748 MAYBE_DECLARE_RTBL(Spec_RBH,3,0)
749 MAYBE_DECLARE_RTBL(Spec_RBH,3,1)
750 MAYBE_DECLARE_RTBL(Spec_RBH,3,2)
751 MAYBE_DECLARE_RTBL(Spec_RBH,3,3)
752 MAYBE_DECLARE_RTBL(Spec_RBH,4,0)
753 MAYBE_DECLARE_RTBL(Spec_RBH,4,4)
754 MAYBE_DECLARE_RTBL(Spec_RBH,5,0)
755 MAYBE_DECLARE_RTBL(Spec_RBH,5,5)
756 MAYBE_DECLARE_RTBL(Spec_RBH,6,6)
757 MAYBE_DECLARE_RTBL(Spec_RBH,7,7)
758 MAYBE_DECLARE_RTBL(Spec_RBH,8,8)
759 MAYBE_DECLARE_RTBL(Spec_RBH,9,9)
760 MAYBE_DECLARE_RTBL(Spec_RBH,10,10)
761 MAYBE_DECLARE_RTBL(Spec_RBH,11,11)
762 MAYBE_DECLARE_RTBL(Spec_RBH,12,12)
764 #define SPEC_RBH_RTBL(size,ptrs) \
765 const W_ MK_REP_LBL(Spec_RBH,size,ptrs)[] = { \
766 INCLUDE_TYPE_INFO(SPEC_RBH) \
767 INCLUDE_SIZE_INFO(size,ptrs) \
769 INCLUDE_COPYING_INFO(CAT2(_Evacuate_RBH_,size),CAT4(_Scavenge_RBH_,size,_,ptrs)) \
770 SPEC_COMPACTING_INFO(CAT4(_ScanLink_RBH_,size,_,ptrs), \
771 CAT2(_PRStart_RBH_,ptrs), \
772 CAT2(_ScanMove_RBH_,size),CAT2(_PRIn_RBH_,ptrs)) \
775 #define _Scavenge_RBH_2_0 _Scavenge_RBH_2_1
776 #define _Scavenge_RBH_2_2 _Scavenge_RBH_2_1
778 #define _Scavenge_RBH_3_0 _Scavenge_RBH_3_1
779 #define _Scavenge_RBH_3_2 _Scavenge_RBH_3_1
781 #define _Scavenge_RBH_4_0 _Scavenge_RBH_4_1
782 #define _Scavenge_RBH_5_0 _Scavenge_RBH_5_1
783 #define _Scavenge_RBH_6_0 _Scavenge_RBH_6_1
784 #define _Scavenge_RBH_7_0 _Scavenge_RBH_7_1
785 #define _Scavenge_RBH_8_0 _Scavenge_RBH_8_1
786 #define _Scavenge_RBH_9_0 _Scavenge_RBH_9_1
787 #define _Scavenge_RBH_10_0 _Scavenge_RBH_10_1
788 #define _Scavenge_RBH_11_0 _Scavenge_RBH_11_1
789 #define _Scavenge_RBH_12_0 _Scavenge_RBH_12_1
791 #define _ScanLink_RBH_2_0 _ScanLink_RBH_2_1
792 #define _ScanLink_RBH_2_2 _ScanLink_RBH_2_1
794 #define _ScanLink_RBH_3_0 _ScanLink_RBH_3_1
795 #define _ScanLink_RBH_3_2 _ScanLink_RBH_3_1
797 #define _ScanLink_RBH_4_0 _ScanLink_RBH_4_1
798 #define _ScanLink_RBH_5_0 _ScanLink_RBH_5_1
799 #define _ScanLink_RBH_6_0 _ScanLink_RBH_6_1
800 #define _ScanLink_RBH_7_0 _ScanLink_RBH_7_1
801 #define _ScanLink_RBH_8_0 _ScanLink_RBH_8_1
802 #define _ScanLink_RBH_9_0 _ScanLink_RBH_9_1
803 #define _ScanLink_RBH_10_0 _ScanLink_RBH_10_1
804 #define _ScanLink_RBH_11_0 _ScanLink_RBH_11_1
805 #define _ScanLink_RBH_12_0 _ScanLink_RBH_12_1
807 #define _PRStart_RBH_0 _PRStart_RBH_2
808 #define _PRStart_RBH_1 _PRStart_RBH_2
810 #define _PRIn_RBH_0 _PRIn_RBH_2
811 #define _PRIn_RBH_1 _PRIn_RBH_2
815 # define SPEC_U_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
816 CAT_DECLARE(infolbl,kind,descr,type) \
817 entry_localness(entry_code); \
818 localness W_ infolbl[] = { \
821 ,(W_) MK_REP_REF(Spec_U,size,ptrs) \
822 INCLUDE_PROFILING_INFO(infolbl) \
826 MAYBE_DECLARE_RTBL(Spec_U,1,0)
827 MAYBE_DECLARE_RTBL(Spec_U,1,1)
828 MAYBE_DECLARE_RTBL(Spec_U,2,0)
829 MAYBE_DECLARE_RTBL(Spec_U,2,1)
830 MAYBE_DECLARE_RTBL(Spec_U,2,2)
831 MAYBE_DECLARE_RTBL(Spec_U,3,0)
832 MAYBE_DECLARE_RTBL(Spec_U,3,1)
833 MAYBE_DECLARE_RTBL(Spec_U,3,2)
834 MAYBE_DECLARE_RTBL(Spec_U,3,3)
835 MAYBE_DECLARE_RTBL(Spec_U,4,0)
836 MAYBE_DECLARE_RTBL(Spec_U,4,4)
837 MAYBE_DECLARE_RTBL(Spec_U,5,0)
838 MAYBE_DECLARE_RTBL(Spec_U,5,5)
839 MAYBE_DECLARE_RTBL(Spec_U,6,6)
840 MAYBE_DECLARE_RTBL(Spec_U,7,7)
841 MAYBE_DECLARE_RTBL(Spec_U,8,8)
842 MAYBE_DECLARE_RTBL(Spec_U,9,9)
843 MAYBE_DECLARE_RTBL(Spec_U,10,10)
844 MAYBE_DECLARE_RTBL(Spec_U,11,11)
845 MAYBE_DECLARE_RTBL(Spec_U,12,12)
847 #define SPEC_U_RTBL(size,ptrs) \
848 const W_ MK_REP_LBL(Spec_U,size,ptrs)[] = { \
849 INCLUDE_TYPE_INFO(SPEC_U) \
850 INCLUDE_SIZE_INFO(size,ptrs) \
852 INCLUDE_COPYING_INFO(CAT2(_Evacuate_,size),CAT4(_Scavenge_,size,_,ptrs)) \
853 SPEC_COMPACTING_INFO(CAT4(_ScanLink_,size,_,ptrs), \
854 CAT2(_PRStart_,ptrs), \
855 CAT2(_ScanMove_,size),CAT2(_PRIn_,ptrs)) \
860 %************************************************************************
862 \subsection[SELECT_ITBL]{@SELECT_ITBL@: Special @SPEC_U@ info-table for selectors}
864 %************************************************************************
866 These are different only in having slightly-magic GC code. The idea
867 is: it is a @MIN_UPD_SIZE@ (==2) thunk with one pointer, which, when
868 entered, will select word $i$ from its pointee.
870 When garbage-collecting such a closure, we ``peek'' at the pointee's
871 tag (in its info table). If it is evaluated, then we go ahead and do
872 the selection---which is {\em just like an indirection}. If it is not
873 evaluated, we carry on {\em exactly as if it is a size-2/1-ptr thunk}.
875 Copying: only the evacuate routine needs to be special.
877 Compacting: only the PRStart (marking) routine needs to be special.
881 #if defined(PAR) || defined(GRAN)
882 # define SELECT_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,select_word_i,kind,descr,type) \
883 entry_localness(CAT2(RBH_,entry_code)); \
884 localness W_ infolbl[]; \
885 localness W_ CAT2(RBH_,infolbl)[] = { \
886 (W_) CAT2(RBH_,entry_code) \
887 ,(W_) INFO_OTHER_TAG \
888 ,(W_) MK_REP_REF(Spec_RBH,size,ptrs) \
889 INCLUDE_PROFILING_INFO(RBH) \
890 INCLUDE_SPEC_PADDING \
891 INCLUDE_RBH_INFO(infolbl) \
893 STGFUN(CAT2(RBH_,entry_code)) { JMP_(RBH_entry); }\
894 CAT_DECLARE(infolbl,kind,descr,type) \
895 entry_localness(entry_code); \
896 localness W_ infolbl[] = { \
899 ,(W_) MK_REP_REF(Select,,select_word_i) \
900 INCLUDE_PROFILING_INFO(infolbl) \
901 INCLUDE_SPEC_PADDING \
902 INCLUDE_RBH_INFO(CAT2(RBH_,infolbl)) \
907 # define SELECT_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,select_word_i,kind,descr,type) \
908 CAT_DECLARE(infolbl,kind,descr,type) \
909 entry_localness(entry_code); \
910 localness W_ infolbl[] = { \
913 ,(W_) MK_REP_REF(Select,,select_word_i) \
914 INCLUDE_PROFILING_INFO(infolbl) \
919 MAYBE_DECLARE_RTBL(Select,,0)
920 MAYBE_DECLARE_RTBL(Select,,1)
921 MAYBE_DECLARE_RTBL(Select,,2)
922 MAYBE_DECLARE_RTBL(Select,,3)
923 MAYBE_DECLARE_RTBL(Select,,4)
924 MAYBE_DECLARE_RTBL(Select,,5)
925 MAYBE_DECLARE_RTBL(Select,,6)
926 MAYBE_DECLARE_RTBL(Select,,7)
927 MAYBE_DECLARE_RTBL(Select,,8)
928 MAYBE_DECLARE_RTBL(Select,,9)
929 MAYBE_DECLARE_RTBL(Select,,10)
930 MAYBE_DECLARE_RTBL(Select,,11)
931 MAYBE_DECLARE_RTBL(Select,,12)
933 #define SELECT_RTBL(size,ptrs,select_word_i) \
934 const W_ MK_REP_LBL(Select,,select_word_i)[] = { \
935 INCLUDE_TYPE_INFO(SPEC_U) \
936 INCLUDE_SIZE_INFO(size,ptrs) \
938 INCLUDE_COPYING_INFO(CAT2(_EvacuateSelector_,select_word_i), \
939 CAT4(_Scavenge_,size,_,ptrs)) \
940 SPEC_COMPACTING_INFO(CAT4(_ScanLink_,size,_,ptrs), \
941 CAT2(_PRStartSelector_,select_word_i), \
942 CAT2(_ScanMove_,size), \
948 %************************************************************************
950 \subsection[GEN_ITBL]{@GEN_x_ITBL@: Generic/general? info-tables}
952 %************************************************************************
954 @GEN@ info-table for non-updatable nodes (normal and non-normal forms).
956 Size/no-of-ptrs are known at compile time, but we don't have GC
957 routines wired in for those specific sizes. Hence the size/no-of-ptrs
958 is stored in the info-table.
962 #define GEN_N_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
963 CAT_DECLARE(infolbl,kind,descr,type) \
964 entry_localness(entry_code); \
965 localness W_ infolbl[] = { \
968 ,(W_) MK_REP_REF(Gen_N,,) \
969 INCLUDE_PROFILING_INFO(infolbl) \
970 INCLUDE_UPDATE_INFO(upd_code,liveness) \
971 INCLUDE_GEN_INFO(size,ptrs) \
974 MAYBE_DECLARE_RTBL(Gen_N,,)
976 #define GEN_N_RTBL() \
977 const W_ MK_REP_LBL(Gen_N,,)[] = { \
978 INCLUDE_TYPE_INFO(GEN_N) \
979 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in info table */ \
981 INCLUDE_COPYING_INFO(_Evacuate_S,_Scavenge_S_N) \
982 INCLUDE_COMPACTING_INFO(_ScanLink_S_N,_PRStart_N,_ScanMove_S,_PRIn_I) \
985 #define GEN_S_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
986 CAT_DECLARE(infolbl,kind,descr,type) \
987 entry_localness(entry_code); \
988 localness W_ infolbl[] = { \
991 ,(W_) MK_REP_REF(Gen_S,,) \
992 INCLUDE_PROFILING_INFO(infolbl) \
993 INCLUDE_UPDATE_INFO(upd_code,liveness) \
994 INCLUDE_GEN_INFO(size,ptrs) \
997 MAYBE_DECLARE_RTBL(Gen_S,,)
999 #define GEN_S_RTBL() \
1000 const W_ MK_REP_LBL(Gen_S,,)[] = { \
1001 INCLUDE_TYPE_INFO(GEN_S) \
1002 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in info table */ \
1004 INCLUDE_COPYING_INFO(_Evacuate_S,_Scavenge_S_N) \
1005 INCLUDE_COMPACTING_INFO(_ScanLink_S_N,_PRStart_N,_ScanMove_S,_PRIn_I) \
1008 #if defined(PAR) || defined(GRAN)
1009 # define GEN_U_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
1010 entry_localness(CAT2(RBH_,entry_code)); \
1011 localness W_ infolbl[]; \
1012 localness W_ CAT2(RBH_,infolbl)[] = { \
1013 (W_) CAT2(RBH_,entry_code) \
1014 ,(W_) INFO_OTHER_TAG \
1015 ,(W_) MK_REP_REF(Gen_RBH,,) \
1016 INCLUDE_PROFILING_INFO(RBH) \
1017 INCLUDE_UPDATE_INFO(INFO_UNUSED,INFO_UNUSED) \
1018 INCLUDE_GEN_INFO(size,ptrs) \
1019 INCLUDE_RBH_INFO(infolbl) \
1021 STGFUN(CAT2(RBH_,entry_code)) { JMP_(RBH_entry); }\
1022 CAT_DECLARE(infolbl,kind,descr,type) \
1023 entry_localness(entry_code); \
1024 localness W_ infolbl[] = { \
1027 ,(W_) MK_REP_REF(Gen_U,,) \
1028 INCLUDE_PROFILING_INFO(infolbl) \
1029 INCLUDE_UPDATE_INFO(INFO_UNUSED,INFO_UNUSED) \
1030 INCLUDE_GEN_INFO(size,ptrs) \
1031 INCLUDE_RBH_INFO(CAT2(RBH_,infolbl)) \
1034 MAYBE_DECLARE_RTBL(Gen_RBH,,)
1036 # define GEN_RBH_RTBL() \
1037 const W_ MK_REP_LBL(Gen_RBH,,)[] = { \
1038 INCLUDE_TYPE_INFO(GEN_RBH) \
1039 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: no size/no-ptrs! */ \
1041 INCLUDE_COPYING_INFO(_Evacuate_RBH_S,_Scavenge_RBH_N) \
1042 INCLUDE_COMPACTING_INFO(_ScanLink_RBH_N,_PRStart_RBH_N,_ScanMove_RBH_S,_PRIn_RBH_I) \
1047 # define GEN_U_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
1048 CAT_DECLARE(infolbl,kind,descr,type) \
1049 entry_localness(entry_code); \
1050 localness W_ infolbl[] = { \
1053 ,(W_) MK_REP_REF(Gen_U,,) \
1054 INCLUDE_PROFILING_INFO(infolbl) \
1055 INCLUDE_UPDATE_INFO(INFO_UNUSED,INFO_UNUSED) \
1056 INCLUDE_GEN_INFO(size,ptrs) \
1060 MAYBE_DECLARE_RTBL(Gen_U,,)
1062 #define GEN_U_RTBL() \
1063 const W_ MK_REP_LBL(Gen_U,,)[] = { \
1064 INCLUDE_TYPE_INFO(GEN_U) \
1065 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: no size/no-ptrs! */ \
1067 INCLUDE_COPYING_INFO(_Evacuate_S,_Scavenge_S_N) \
1068 INCLUDE_COMPACTING_INFO(_ScanLink_S_N,_PRStart_N,_ScanMove_S,_PRIn_I) \
1073 %************************************************************************
1075 \subsection[DYN_ITBL]{Dynamic-object info tables}
1077 %************************************************************************
1079 For these, the size/no-of-pointers is not known until runtime. E.g.,
1080 arrays. Those fields are, therefore, in the closure itself, and not
1083 All @DYN@ closures are @PAP@s, so they are not updatable.
1087 #define DYN_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1088 CAT_DECLARE(infolbl,kind,descr,type) \
1089 entry_localness(entry_code); \
1090 localness W_ infolbl[] = { \
1093 ,(W_) MK_REP_LBL(Dyn,,) \
1094 INCLUDE_PROFILING_INFO(infolbl) \
1097 MAYBE_DECLARE_RTBL(Dyn,,)
1099 #define DYN_RTBL() \
1100 const W_ MK_REP_LBL(Dyn,,)[] = { \
1101 INCLUDE_TYPE_INFO(DYN) \
1102 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* in closure! */ \
1104 INCLUDE_COPYING_INFO(_Evacuate_Dyn,_Scavenge_Dyn) \
1105 INCLUDE_COMPACTING_INFO(_ScanLink_Dyn,_PRStart_Dyn,_ScanMove_Dyn,_PRIn_I_Dyn) \
1110 %************************************************************************
1112 \subsection[TUPLE_ITBL]{``Tuple'' and ``Data'' info-tables}
1114 %************************************************************************
1116 ``Tuples'' are essentially DYNs with all pointers (no non-pointers).
1117 ``Data things'' are DYNs with all non-pointers.
1121 #define TUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1122 CAT_DECLARE(infolbl,kind,descr,type) \
1123 entry_localness(entry_code); \
1124 localness W_ infolbl[] = { \
1127 ,(W_) MK_REP_REF(Tuple,,) \
1128 INCLUDE_PROFILING_INFO(infolbl) \
1131 MAYBE_DECLARE_RTBL(Tuple,,)
1133 #define TUPLE_RTBL() \
1134 const W_ MK_REP_LBL(Tuple,,)[] = { \
1135 INCLUDE_TYPE_INFO(TUPLE) \
1136 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in closure */ \
1138 INCLUDE_COPYING_INFO(_Evacuate_Tuple,_Scavenge_Tuple) \
1139 INCLUDE_COMPACTING_INFO(_ScanLink_Tuple,_PRStart_Tuple,_ScanMove_Tuple,_PRIn_I_Tuple) \
1142 #define DATA_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1143 CAT_DECLARE(infolbl,kind,descr,type) \
1144 entry_localness(entry_code); \
1145 localness W_ infolbl[] = { \
1148 ,(W_) MK_REP_REF(Data,,) \
1149 INCLUDE_PROFILING_INFO(infolbl) \
1152 MAYBE_DECLARE_RTBL(Data,,)
1154 #define DATA_RTBL() \
1155 const W_ MK_REP_LBL(Data,,)[] = { \
1156 INCLUDE_TYPE_INFO(DATA) \
1157 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in closure */ \
1159 INCLUDE_COPYING_INFO(_Evacuate_Data,_Scavenge_Data) \
1160 INCLUDE_COMPACTING_INFO(_ScanLink_Data,_PRStart_Data,_ScanMove_Data,_PRIn_Error) \
1163 /* Here is the decl for the only DATA info table used! */
1164 #ifndef COMPILING_GHC
1165 EXTDATA_RO(ArrayOfData_info);
1169 %************************************************************************
1171 \subsection[MUTUPLE_ITBL]{Info-table for (im)mutable [array-ish] objects}
1173 %************************************************************************
1175 ToDo: Integrate with PAR stuff (Kevin) !!
1176 If someone bothers to document this I'll see what I can do! KH
1180 #if defined(GC_MUT_REQUIRED)
1182 # define MUTUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1183 CAT_DECLARE(infolbl,kind,descr,type) \
1184 entry_localness(entry_code); \
1185 localness W_ infolbl[] = { \
1188 ,(W_) MK_REP_REF(MuTuple,,) \
1189 INCLUDE_PROFILING_INFO(infolbl) \
1192 MAYBE_DECLARE_RTBL(MuTuple,,)
1194 # define MUTUPLE_RTBL() \
1195 const W_ MK_REP_LBL(MuTuple,,)[] = { \
1196 INCLUDE_TYPE_INFO(MUTUPLE) \
1197 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in closure! */ \
1199 INCLUDE_COPYING_INFO(_Evacuate_MuTuple,_Scavenge_MuTuple) \
1200 INCLUDE_COMPACTING_INFO(_ScanLink_MuTuple,_PRStart_MuTuple,_ScanMove_MuTuple,_PRIn_I_MuTuple) \
1203 # define IMMUTUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1204 CAT_DECLARE(infolbl,kind,descr,type) \
1205 entry_localness(entry_code); \
1206 localness W_ infolbl[] = { \
1209 ,(W_) MK_REP_REF(ImmuTuple,,) \
1210 INCLUDE_PROFILING_INFO(infolbl) \
1213 MAYBE_DECLARE_RTBL(ImmuTuple,,)
1215 # define IMMUTUPLE_RTBL() \
1216 const W_ MK_REP_LBL(ImmuTuple,,)[] = { \
1217 INCLUDE_TYPE_INFO(IMMUTUPLE) \
1218 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in closure! */ \
1220 INCLUDE_COPYING_INFO(_Evacuate_MuTuple,_Scavenge_MuTuple) \
1221 INCLUDE_COMPACTING_INFO(_ScanLink_MuTuple,_PRStart_MuTuple,_ScanMove_ImmuTuple,_PRIn_I_MuTuple) \
1224 #else /* ! GC_MUT_REQUIRED --- define as TUPLE closure */
1226 # define MUTUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
1227 TUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type)
1228 # define IMMUTUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
1229 TUPLE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type)
1231 # define MUTUPLE_RTBL()
1232 # define IMMUTUPLE_RTBL()
1235 /* Here are the decls for the only MUTUPLE info tables used. */
1236 #ifndef COMPILING_GHC
1237 EXTDATA_RO(ArrayOfPtrs_info);
1238 EXTDATA_RO(ImMutArrayOfPtrs_info);
1239 EXTDATA_RO(EmptySVar_info);
1240 EXTDATA_RO(FullSVar_info);
1244 %************************************************************************
1246 \subsection[STATIC_ITBL]{Info tables for static objects (outside the heap)}
1248 %************************************************************************
1250 Size and ptrs fields are used by interpretive code, such as @ghci@,
1251 the parallel Pack code (@Pack.lc@) and possibly to-be-written debug
1255 #define STATIC_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) \
1256 CAT_DECLARE(infolbl,kind,descr,type) \
1257 entry_localness(entry_code); \
1258 localness W_ infolbl[] = { \
1261 ,(W_) MK_REP_REF(Static,,) \
1262 INCLUDE_PROFILING_INFO(infolbl) \
1263 INCLUDE_UPDATE_INFO(upd_code,liveness) \
1264 INCLUDE_STATIC_INFO(size,ptrs) \
1267 MAYBE_DECLARE_RTBL(Static,,)
1269 #define STATIC_RTBL() \
1270 const W_ MK_REP_LBL(Static,,)[] = { \
1271 INCLUDE_TYPE_INFO(STATIC) \
1272 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) /* NB: in info table! */ \
1274 INCLUDE_COPYING_INFO(_Evacuate_Static,_Dummy_Static_entry) \
1275 INCLUDE_COMPACTING_INFO(_Dummy_Static_entry,_PRStart_Static, \
1276 _Dummy_Static_entry,_Dummy_Static_entry) \
1280 %************************************************************************
1282 \subsection[ForeignObj_ITBL]{@ForeignObj_TBL@: @ForeignObj@ info-table}
1284 %************************************************************************
1286 The following table is a bit like that for @SPEC@ with 0 pointers and
1287 a small number of non-ptrs. However, the garbage collection routines
1290 I'm assuming @SPEC_N@, so that we don't need to pad out the info table. (JSM)
1295 # define ForeignObj_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1296 CAT_DECLARE(infolbl,kind,descr,type) \
1297 entry_localness(entry_code); \
1298 localness W_ infolbl[] = { \
1301 ,(W_) MK_REP_REF(ForeignObj,,) \
1302 INCLUDE_PROFILING_INFO(infolbl) \
1305 MAYBE_DECLARE_RTBL(ForeignObj,,)
1307 # define ForeignObj_RTBL() \
1308 const W_ MK_REP_LBL(ForeignObj,,)[] = { \
1309 INCLUDE_TYPE_INFO(INTERNAL) \
1310 INCLUDE_SIZE_INFO(ForeignObj_SIZE, 0L) \
1312 INCLUDE_COPYING_INFO(_Evacuate_ForeignObj,_Scavenge_ForeignObj) \
1313 SPEC_COMPACTING_INFO(_ScanLink_ForeignObj,_PRStart_ForeignObj,_ScanMove_ForeignObj,_PRIn_0) \
1319 %************************************************************************
1321 \subsection[BH_ITBL]{Info tables for ``black holes''}
1323 %************************************************************************
1325 Special info-table for black holes. It is possible to describe these
1326 using @SPEC@ closures but this requires explicit use of the value of
1327 @MIN_UPD_SIZE@. For now we have a special macro and code.
1331 #define BH_ITBL(infolbl,bh_code,kind,localness,entry_localness) \
1332 entry_localness(bh_code); \
1333 localness W_ infolbl[] = { \
1335 ,(W_) INFO_OTHER_TAG \
1336 ,(W_) MK_REP_REF(BH,kind,) \
1337 INCLUDE_PROFILING_INFO(BH) \
1340 MAYBE_DECLARE_RTBL(BH,U,)
1341 MAYBE_DECLARE_RTBL(BH,N,)
1343 #define BH_RTBL(kind) \
1344 const W_ MK_REP_LBL(BH,kind,)[] = { \
1345 INCLUDE_TYPE_INFO(BH) \
1346 INCLUDE_SIZE_INFO(CAT3(BH_,kind,_SIZE),0L) \
1348 INCLUDE_COPYING_INFO(CAT2(_Evacuate_BH_,kind),CAT2(_Scavenge_BH_,kind)) \
1349 INCLUDE_COMPACTING_INFO(CAT2(_ScanLink_BH_,kind),_PRStart_BH, \
1350 CAT2(_ScanMove_BH_,kind),_PRIn_Error) \
1355 %************************************************************************
1357 \subsection[IND_ITBL]{Info table for indirections}
1359 %************************************************************************
1361 An indirection simply extracts the pointer from the
1362 @IND_CLOSURE_PTR(closure)@ field. The garbage collection routines will
1363 short out the indirection (normally).
1366 #define IND_ITBL(infolbl,ind_code,localness,entry_localness) \
1367 CAT_DECLARE(infolbl,INTERNAL_KIND,"IND","IND") \
1368 entry_localness(ind_code); \
1369 localness W_ infolbl[] = { \
1371 ,(W_) INFO_IND_TAG \
1372 ,(W_) MK_REP_REF(Ind,,) \
1373 INCLUDE_PROFILING_INFO(infolbl) \
1376 MAYBE_DECLARE_RTBL(Ind,,)
1378 #define IND_RTBL() \
1379 const W_ MK_REP_LBL(Ind,,)[] = { \
1380 INCLUDE_TYPE_INFO(IND) \
1381 INCLUDE_SIZE_INFO(MIN_UPD_SIZE,INFO_UNUSED) /* #ptrs not here! */ \
1383 INCLUDE_COPYING_INFO(_Evacuate_Ind,_Scavenge_Ind) \
1384 INCLUDE_COMPACTING_INFO(_Dummy_Ind_entry,_PRStart_Ind, \
1385 _Dummy_Ind_entry,_Dummy_Ind_entry) \
1390 Lexical-scoped profiling (now more-or-less the default... 94/06)
1391 requires a special permanent indirection for PAP closures. These
1392 look exactly like regular indirections, but they are not short-circuited
1393 on garbage collection.
1396 #if defined(PROFILING) || defined(TICKY_TICKY)
1398 # define PERM_IND_ITBL(infolbl,ind_code,localness,entry_localness) \
1399 entry_localness(ind_code); \
1400 CAT_DECLARE(infolbl,INTERNAL_KIND,"IND","IND") \
1401 localness W_ infolbl[] = { \
1403 ,(W_) INFO_IND_TAG \
1404 ,(W_) MK_REP_REF(Perm_Ind,,) \
1405 INCLUDE_PROFILING_INFO(infolbl) \
1408 MAYBE_DECLARE_RTBL(Perm_Ind,,)
1410 # define PERM_IND_RTBL() \
1411 const W_ MK_REP_LBL(Perm_Ind,,)[] = { \
1412 INCLUDE_TYPE_INFO(IND) \
1413 INCLUDE_SIZE_INFO(MIN_UPD_SIZE,INFO_UNUSED) /* #ptrs not here! */ \
1415 INCLUDE_COPYING_INFO(_Evacuate_PI,_Scavenge_PI) \
1416 SPEC_COMPACTING_INFO(_ScanLink_PI,_PRStart_PI, \
1417 _ScanMove_PI,_PRIn_PI) \
1421 # define PERM_IND_RTBL()
1425 %************************************************************************
1427 \subsection[CAF_ITBL]{Info table for updated @CAF@s}
1429 %************************************************************************
1431 Garbage collection of @CAF@s is tricky. We have to cope with explicit
1432 collection from the @CAFlist@ as well as potential references from the
1433 stack and heap which will cause the @CAF@ evacuation code to be
1434 called. They are treated like indirections which are shorted out.
1435 However they must also be updated to point to the new location of the
1436 new closure as the @CAF@ may still be used by references which
1439 \subsubsection{Copying Collection}
1441 A first scheme might use evacuation code which evacuates the reference
1442 and updates the indirection. This is no good as subsequent evacuations
1443 will result in an already evacuated closure being evacuated. This will
1444 leave a forward reference in to-space!
1446 An alternative scheme evacuates the @CAFlist@ first. The closures
1447 referenced are evacuated and the @CAF@ indirection updated to point to
1448 the evacuated closure. The @CAF@ evacuation code simply returns the
1449 updated indirection pointer --- the pointer to the evacuated closure.
1450 Unfortunately the closure the @CAF@ references may be a static
1451 closure, in fact, it may be another @CAF@. This will cause the second
1452 @CAF@'s evacuation code to be called before the @CAF@ has been
1453 evacuated, returning an unevacuated pointer.
1455 Another scheme leaves updating the @CAF@ indirections to the end of
1456 the garbage collection. All the references are evacuated and
1457 scavenged as usual (including the @CAFlist@). Once collection is
1458 complete the @CAFlist@ is traversed updating the @CAF@ references with
1459 the result of evacuating the referenced closure again. This will
1460 immediately return as it must be a forward reference, a static
1461 closure, or a @CAF@ which will indirect by evacuating its reference.
1463 The crux of the problem is that the @CAF@ evacuation code needs to
1464 know if its reference has already been evacuated and updated. If not,
1465 then the reference can be evacuated, updated and returned safely
1466 (possibly evacuating another @CAF@). If it has, then the updated
1467 reference can be returned. This can be done using two @CAF@
1468 info-tables. At the start of a collection the @CAFlist@ is traversed
1469 and set to an internal {\em evacuate and update} info-table. During
1470 collection, evacution of such a @CAF@ also results in the info-table
1471 being reset back to the standard @CAF@ info-table. Thus subsequent
1472 evacuations will simply return the updated reference. On completion of
1473 the collection all @CAF@s will have {\em return reference} info-tables
1476 This is the scheme we adopt. A @CAF@ indirection has evacuation code
1477 which returns the evacuated and updated reference. During garbage
1478 collection, all the @CAF@s are overwritten with an internal @CAF@ info
1479 table which has evacuation code which performs this evacuate and
1480 update and restores the original @CAF@ code. At some point during the
1481 collection we must ensure that all the @CAF@s are indeed evacuated.
1483 The only potential problem with this scheme is a cyclic list of @CAF@s
1484 all directly referencing (possibly via indirections) another @CAF@!
1485 Evacuation of the first @CAF@ will fail in an infinite loop of @CAF@
1486 evacuations. This is solved by ensuring that the @CAF@ info-table is
1487 updated to a {\em return reference} info-table before performing the
1488 evacuate and update. If this {\em return reference} evacuation code is
1489 called before the actual evacuation is complete it must be because
1490 such a cycle of references exists. Returning the still unevacuated
1491 reference is OK --- all the @CAF@s will now reference the same
1492 @CAF@ which will reference itself! Construction of such a structure
1493 indicates the program must be in an infinite loop.
1495 \subsubsection{Compacting Collector}
1497 When shorting out a @CAF@, its reference must be marked. A first
1498 attempt might explicitly mark the @CAF@s, updating the reference with
1499 the marked reference (possibly short circuting indirections). The
1500 actual @CAF@ marking code can indicate that they have already been
1501 marked (though this might not have actually been done yet) and return
1502 the indirection pointer so it is shorted out. Unfortunately the @CAF@
1503 reference might point to an indirection which will be subsequently
1504 shorted out. Rather than returning the @CAF@ reference we treat the
1505 @CAF@ as an indirection, calling the mark code of the reference, which
1506 will return the appropriately shorted reference.
1508 Problem: Cyclic list of @CAF@s all directly referencing (possibly via
1509 indirections) another @CAF@!
1511 Before compacting, the locations of the @CAF@ references are
1512 explicitly linked to the closures they reference (if they reference
1513 heap allocated closures) so that the compacting process will update
1514 them to the closure's new location. Unfortunately these locations'
1515 @CAF@ indirections are static. This causes premature termination
1516 since the test to find the info pointer at the end of the location
1517 list will match more than one value. This can be solved by using an
1518 auxiliary dynamic array (on the top of the A stack). One location for
1519 each @CAF@ indirection is linked to the closure that the @CAF@
1520 references. Once collection is complete this array is traversed and
1521 the corresponding @CAF@ is then updated with the updated pointer from
1522 the auxiliary array.
1526 #define CAF_ITBL(infolbl,ind_code,localness,entry_localness) \
1527 CAT_DECLARE(infolbl,INTERNAL_KIND,"CAF","CAF") \
1528 entry_localness(ind_code); \
1529 localness W_ infolbl[] = { \
1531 ,(W_) INFO_IND_TAG \
1532 ,(W_) MK_REP_REF(Caf,,) \
1533 INCLUDE_PROFILING_INFO(infolbl) \
1536 MAYBE_DECLARE_RTBL(Caf,,)
1538 #define CAF_RTBL() \
1539 const W_ MK_REP_LBL(Caf,,)[] = { \
1540 INCLUDE_TYPE_INFO(CAF) \
1541 INCLUDE_SIZE_INFO(MIN_UPD_SIZE,INFO_UNUSED) /* #ptrs not here! */ \
1543 INCLUDE_COPYING_INFO(_Evacuate_Caf,_Scavenge_Caf) \
1544 INCLUDE_COMPACTING_INFO(_Dummy_Caf_entry,_PRStart_Caf, \
1545 _Dummy_Caf_entry,_Dummy_Caf_entry) \
1550 It is possible to use an alternative marking scheme, using a similar
1551 idea to the copying solution. This scheme avoids the need to update
1552 the @CAF@ references explicitly. We introduce an auxillary {\em mark
1553 and update} @CAF@ info-table which is used to update all @CAF@s at the
1554 start of a collection. The new code marks the @CAF@ reference,
1555 updating it with the returned reference. The returned reference is
1556 itself returned so the @CAF@ is shorted out. The code also modifies the
1557 @CAF@ info-table to be a {\em return reference}. Subsequent attempts to
1558 mark the @CAF@ simply return the updated reference.
1560 A cyclic @CAF@ reference will result in an attempt to mark the @CAF@
1561 before the marking has been completed and the reference updated. We
1562 cannot start marking the @CAF@ as it is already being marked. Nor can
1563 we return the reference as it has not yet been updated. Neither can we
1564 treat the CAF as an indirection since the @CAF@ reference has been
1565 obscured by the pointer reversal stack. All we can do is return the
1566 @CAF@ itself. This will result in some @CAF@ references not being
1569 This scheme has not been adopted but has been implemented. The code is
1570 commented out with @#if 0@.
1572 %************************************************************************
1574 \subsection[CONST_ITBL]{@CONST_ITBL@}
1576 %************************************************************************
1578 This declares an info table for @CONST@ closures (size 0). It is the
1579 info table for a dynamicaly-allocated closure which will redirect
1580 references to the corresponding static closure @<infolbl>_closure@
1581 during garbage collection. A pointer to the static closure is kept in
1582 the info table. (It is assumed that this closure is declared
1585 Why do such @CONST@ objects ever exist? Why don't we just use the
1586 static object in the first place? @CONST@ objects are used only for
1587 updating existing objects. We could use an indirection, but that
1588 risks costing extra run-time indirections until the next GC shorts it
1589 out. So we update with a @CONST@, and the next GC gets rid of it.
1592 #define CONST_ITBL(infolbl,closurelbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*size,ptrs unused*/ \
1593 CAT_DECLARE(infolbl,kind,descr,type) \
1594 entry_localness(entry_code); \
1595 EXTDATA(closurelbl); \
1596 localness W_ infolbl[] = { \
1599 ,(W_) MK_REP_REF(Const,,) \
1600 INCLUDE_PROFILING_INFO(infolbl) \
1601 INCLUDE_UPDATE_INFO(upd_code,liveness) \
1602 INCLUDE_CONST_INFO(closurelbl) \
1605 MAYBE_DECLARE_RTBL(Const,,)
1608 /* we need real routines if we may not be commoning up */
1609 #define CONST_Scav _Scavenge_0_0
1610 #define CONST_Link _ScanLink_0_0
1611 #define CONST_Move _ScanMove_0
1613 #define CONST_Scav _Dummy_Const_entry
1614 #define CONST_Link _Dummy_Const_entry
1615 #define CONST_Move _Dummy_Const_entry
1618 #define CONST_RTBL() \
1619 const W_ MK_REP_LBL(Const,,)[] = { \
1620 INCLUDE_TYPE_INFO(CONST) \
1621 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) \
1623 INCLUDE_COPYING_INFO(_Evacuate_Const,CONST_Scav) \
1624 INCLUDE_COMPACTING_INFO(CONST_Link,_PRStart_Const, \
1625 CONST_Move,_Dummy_Const_entry) \
1629 This builds an info-table which will have pointers to the closure
1630 replaced with @closure_lbl@ during garbage collection. @closure_lbl@
1631 must be the label of a static closure, whose entry code has identical
1632 behaviour to that in the corresponding @CONST_ITBL@. Usually
1633 the info pointer of this closure will be the very one defined by this
1636 These closures always consist only of an info pointer; that is, its
1639 A copying collection implements this with evacuation code which
1640 returns @closure_lbl@, without actually evacuating the object at all.
1641 A compacting collector uses marking code which returns
1642 @closure_lbl@, without marking the closure.
1644 %************************************************************************
1646 \subsection[FOOLIKE_ITBL]{``Char-like'' and ``Int-like'' info-tables}
1648 %************************************************************************
1650 Char-like: This builds an info-table which, when GC happens, will have
1651 pointers to the closure replaced with the appropriate element of the
1652 @CHARLIKE_closures@ array.
1655 #define CHARLIKE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*tag,size,ptrs unused*/ \
1656 CAT_DECLARE(infolbl,kind,descr,type) \
1657 entry_localness(entry_code); \
1658 localness W_ infolbl[] = { \
1660 ,(W_) INFO_FIRST_TAG \
1661 ,(W_) MK_REP_REF(CharLike,,) \
1662 INCLUDE_PROFILING_INFO(infolbl) \
1663 INCLUDE_UPDATE_INFO(upd_code,liveness) \
1666 MAYBE_DECLARE_RTBL(CharLike,,)
1669 /* we need real routines if we may not be commoning up */
1670 #define CHARLIKE_Scav _Scavenge_1_0
1671 #define CHARLIKE_Link _ScanLink_1_0
1672 #define CHARLIKE_Move _ScanMove_1
1674 #define CHARLIKE_Scav _Dummy_CharLike_entry
1675 #define CHARLIKE_Link _Dummy_CharLike_entry
1676 #define CHARLIKE_Move _Dummy_CharLike_entry
1679 #define CHARLIKE_RTBL() \
1680 const W_ MK_REP_LBL(CharLike,,)[] = { \
1681 INCLUDE_TYPE_INFO(CHARLIKE) \
1682 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) \
1684 INCLUDE_COPYING_INFO(_Evacuate_CharLike,CHARLIKE_Scav) \
1685 INCLUDE_COMPACTING_INFO(CHARLIKE_Link,_PRStart_CharLike, \
1686 CHARLIKE_Move,_PRIn_Error) \
1690 Int-like: this builds the info-table required for intlike closures.
1691 The normal heap-allocated info-table for fixed-size integers (size
1692 @1@); it is used for updates too. At GC, this is redirected to a
1693 static intlike closure if one is available.
1696 #define INTLIKE_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*tag,size,ptrs unused*/ \
1697 CAT_DECLARE(infolbl,kind,descr,type) \
1698 entry_localness(entry_code); \
1699 localness W_ infolbl[] = { \
1701 ,(W_) INFO_FIRST_TAG \
1702 ,(W_) MK_REP_REF(IntLike,,) \
1703 INCLUDE_PROFILING_INFO(infolbl) \
1704 INCLUDE_UPDATE_INFO(upd_code,liveness) \
1707 MAYBE_DECLARE_RTBL(IntLike,,)
1709 #define INTLIKE_RTBL() \
1710 const W_ MK_REP_LBL(IntLike,,)[] = { \
1711 INCLUDE_TYPE_INFO(INTLIKE) \
1712 INCLUDE_SIZE_INFO(INFO_UNUSED,INFO_UNUSED) \
1714 INCLUDE_COPYING_INFO(_Evacuate_IntLike,_Scavenge_1_0) \
1715 INCLUDE_COMPACTING_INFO(_ScanLink_1_0,_PRStart_IntLike, \
1716 _ScanMove_1,_PRIn_Error) \
1720 %************************************************************************
1722 \subsection[INREGS_ITBL]{@INREGS_ITBL@s}
1724 %************************************************************************
1726 The emaciated info table for a phantom closure that lives only in regs.
1727 We don't need any GC information, because these closures never make it into
1728 the heap (not with this info table, anyway). Similarly, we don't need an
1729 entry address, because these closures are never entered...they only exist
1734 #define INREGS_ITBL(infolbl,entry_code,upd_code,liveness,tag,size,ptrs,localness,entry_localness,kind,descr,type) /*mostly unused*/ \
1735 localness W_ infolbl[] = { \
1739 INREGS_PROFILING_INFO \
1740 INCLUDE_UPDATE_INFO(upd_code,liveness) \
1743 /* Declare the phantom info table vectors (just Bool at the moment) */
1744 #ifndef COMPILING_GHC
1745 EXTDATA_RO(Prelude_Bool_itblvtbl);
1750 End multi-slurp protection:
1752 #endif /* SMInfoTables_H */