[project @ 2004-02-12 02:04:59 by mthomas]
[ghc-hetmet.git] / ghc / rts / StgMiscClosures.hc
1 /* -----------------------------------------------------------------------------
2  * $Id: StgMiscClosures.hc,v 1.85 2003/05/14 09:14:00 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-2002
5  *
6  * Entry code for various built-in closure types.
7  *
8  * ---------------------------------------------------------------------------*/
9
10 #include "Stg.h"
11 #include "Rts.h"
12 #include "RtsUtils.h"
13 #include "RtsFlags.h"
14 #include "StgMiscClosures.h"
15 #include "Storage.h"
16 #include "StoragePriv.h"
17 #include "Profiling.h"
18 #include "Prelude.h"
19 #include "Schedule.h"
20 #include "SMP.h"
21 #if defined(GRAN) || defined(PAR)
22 # include "GranSimRts.h"      /* for DumpRawGranEvent */
23 # include "StgRun.h"    /* for StgReturn and register saving */
24 #endif
25
26 #ifdef HAVE_STDLIB_H
27 #include <stdlib.h>
28 #endif
29
30 /* ToDo: make the printing of panics more win32-friendly, i.e.,
31  *       pop up some lovely message boxes (as well).
32  */
33 #define DUMP_ERRMSG(msg) STGCALL2(fprintf,stderr,msg)
34
35 /*
36   Template for the entry code of non-enterable closures.
37 */
38
39 #define NON_ENTERABLE_ENTRY_CODE(type)          \
40 IF_(stg_##type##_entry)                 \
41 {                                               \
42   FB_                                           \
43     STGCALL1(barf, #type " object entered!");   \
44   FE_                                           \
45 }
46
47
48 /* -----------------------------------------------------------------------------
49    Support for the bytecode interpreter.
50    -------------------------------------------------------------------------- */
51
52 /* 9 bits of return code for constructors created by the interpreter. */
53 FN_(stg_interp_constr_entry) 
54
55   /* R1 points at the constructor */
56   FB_ 
57     /* STGCALL2(fprintf,stderr,"stg_interp_constr_entry (direct return)!\n"); */
58     /* Pointless, since SET_TAG doesn't do anything */
59     SET_TAG( GET_TAG(GET_INFO(R1.cl))); 
60     JMP_(ENTRY_CODE((P_)(*Sp))); 
61   FE_ 
62 }
63
64 FN_(stg_interp_constr1_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),0)); FE_ }
65 FN_(stg_interp_constr2_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),1)); FE_ }
66 FN_(stg_interp_constr3_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),2)); FE_ }
67 FN_(stg_interp_constr4_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),3)); FE_ }
68 FN_(stg_interp_constr5_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),4)); FE_ }
69 FN_(stg_interp_constr6_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),5)); FE_ }
70 FN_(stg_interp_constr7_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),6)); FE_ }
71 FN_(stg_interp_constr8_entry) { FB_ JMP_(RET_VEC((P_)(*Sp),7)); FE_ }
72  
73 /* Some info tables to be used when compiled code returns a value to
74    the interpreter, i.e. the interpreter pushes one of these onto the
75    stack before entering a value.  What the code does is to
76    impedance-match the compiled return convention (in R1p/R1n/F1/D1 etc) to
77    the interpreter's convention (returned value is on top of stack),
78    and then cause the scheduler to enter the interpreter.
79
80    On entry, the stack (growing down) looks like this:
81
82       ptr to BCO holding return continuation
83       ptr to one of these info tables.
84  
85    The info table code, both direct and vectored, must:
86       * push R1/F1/D1 on the stack, and its tag if necessary
87       * push the BCO (so it's now on the stack twice)
88       * Yield, ie, go to the scheduler.
89
90    Scheduler examines the t.o.s, discovers it is a BCO, and proceeds
91    directly to the bytecode interpreter.  That pops the top element
92    (the BCO, containing the return continuation), and interprets it.
93    Net result: return continuation gets interpreted, with the
94    following stack:
95
96       ptr to this BCO
97       ptr to the info table just jumped thru
98       return value
99
100    which is just what we want -- the "standard" return layout for the
101    interpreter.  Hurrah!
102
103    Don't ask me how unboxed tuple returns are supposed to work.  We
104    haven't got a good story about that yet.
105 */
106
107 // When the returned value is a pointer in R1...
108 #define STG_CtoI_RET_R1p_Template(label)        \
109    IF_(label)                                   \
110    {                                            \
111       FB_                                       \
112       Sp -= 2;                                  \
113       Sp[1] = R1.w;                             \
114       Sp[0] = (W_)&stg_enter_info;              \
115       JMP_(stg_yield_to_interpreter);           \
116       FE_                                       \
117    }
118
119 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_ret);
120 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_0_ret);
121 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_1_ret);
122 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_2_ret);
123 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_3_ret);
124 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_4_ret);
125 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_5_ret);
126 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_6_ret);
127 STG_CtoI_RET_R1p_Template(stg_ctoi_ret_R1p_7_ret);
128
129 VEC_POLY_INFO_TABLE( stg_ctoi_ret_R1p, 0/* special layout */,
130                      0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, 
131                      RET_BCO,, EF_);
132
133 // When the returned value is a pointer, but unlifted, in R1 ...
134 INFO_TABLE_RET( stg_ctoi_ret_R1unpt_info, stg_ctoi_ret_R1unpt_entry,
135                 0/* special layout */,
136                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
137 IF_(stg_ctoi_ret_R1unpt_entry)
138 {
139    FB_
140    Sp -= 2;
141    Sp[1] = R1.w;
142    Sp[0] = (W_)&stg_gc_unpt_r1_info;
143    JMP_(stg_yield_to_interpreter);
144    FE_
145 }
146
147 // When the returned value is a non-pointer in R1 ...
148 INFO_TABLE_RET( stg_ctoi_ret_R1n_info, stg_ctoi_ret_R1n_entry,
149                 0/* special layout */,
150                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
151 IF_(stg_ctoi_ret_R1n_entry)
152 {
153    FB_
154    Sp -= 2;
155    Sp[1] = R1.w;
156    Sp[0] = (W_)&stg_gc_unbx_r1_info;
157    JMP_(stg_yield_to_interpreter);
158    FE_
159 }
160
161
162 // When the returned value is in F1 ...
163 INFO_TABLE_RET( stg_ctoi_ret_F1_info, stg_ctoi_ret_F1_entry, 
164                 0/* special layout */,
165                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
166 IF_(stg_ctoi_ret_F1_entry)
167 {
168    FB_
169    Sp -= 2;
170    ASSIGN_FLT(Sp+1, F1);
171    Sp[0] = (W_)&stg_gc_f1_info;
172    JMP_(stg_yield_to_interpreter);
173    FE_
174 }
175
176 // When the returned value is in D1 ...
177 INFO_TABLE_RET( stg_ctoi_ret_D1_info, stg_ctoi_ret_D1_entry,
178                 0/* special layout */,
179                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
180 IF_(stg_ctoi_ret_D1_entry)
181 {
182    FB_
183    Sp -= 1 + sizeofW(StgDouble);
184    ASSIGN_DBL(Sp+1, D1);
185    Sp[0] = (W_)&stg_gc_d1_info;
186    JMP_(stg_yield_to_interpreter);
187    FE_
188 }
189
190 // When the returned value is in L1 ...
191 INFO_TABLE_RET( stg_ctoi_ret_L1_info, stg_ctoi_ret_L1_entry,
192                 0/* special layout */,
193                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
194 IF_(stg_ctoi_ret_L1_entry)
195 {
196    FB_
197    Sp -= 1 + sizeofW(StgInt64);
198    ASSIGN_Word64(Sp+1, L1);
199    Sp[0] = (W_)&stg_gc_l1_info;
200    JMP_(stg_yield_to_interpreter);
201    FE_
202 }
203
204 // When the returned value a VoidRep ...
205 INFO_TABLE_RET( stg_ctoi_ret_V_info, stg_ctoi_ret_V_entry,
206                 0/* special layout */,
207                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
208 IF_(stg_ctoi_ret_V_entry)
209 {
210    FB_
211    Sp--;
212    Sp[0] = (W_)&stg_gc_void_info;
213    JMP_(stg_yield_to_interpreter);
214    FE_
215 }
216
217 // Dummy info table pushed on the top of the stack when the interpreter
218 // should apply the BCO on the stack to its arguments, also on the stack.
219 INFO_TABLE_RET( stg_apply_interp_info, stg_apply_interp_entry,
220                 0/* special layout */,
221                 0/*srt*/, 0/*srt_off*/, 0/*srt_bitmap*/, RET_BCO,, IF_, 0, 0);
222 IF_(stg_apply_interp_entry)
223 {
224     FB_
225     // Just in case we end up in here... (we shouldn't)
226     JMP_(stg_yield_to_interpreter);
227     FE_
228 }
229
230 /* -----------------------------------------------------------------------------
231    Entry code for a BCO
232    -------------------------------------------------------------------------- */
233
234 INFO_TABLE_FUN_GEN(stg_BCO_info,stg_BCO_entry,4,0,
235               0,0,0,  /* no SRT */
236               ARG_BCO, 0/*dummy arity*/, 0/*dummy bitmap*/, NULL/*slow_apply*/,
237               BCO,,EF_,"BCO","BCO");
238 FN_(stg_BCO_entry) {
239   FB_
240   // entering a BCO means "apply it", same as a function
241   Sp -= 2;
242   Sp[1] = R1.w;
243   Sp[0] = (W_)&stg_apply_interp_info;
244   JMP_(stg_yield_to_interpreter);
245   FE_
246 }
247
248 /* -----------------------------------------------------------------------------
249    Info tables for indirections.
250
251    SPECIALISED INDIRECTIONS: we have a specialised indirection for each
252    kind of return (direct, vectored 0-7), so that we can avoid entering
253    the object when we know what kind of return it will do.  The update
254    code (Updates.hc) updates objects with the appropriate kind of
255    indirection.  We only do this for young-gen indirections.
256    -------------------------------------------------------------------------- */
257
258 INFO_TABLE(stg_IND_info,stg_IND_entry,1,0,IND,,IF_,"IND","IND");
259 IF_(stg_IND_entry)
260 {
261     FB_
262     TICK_ENT_DYN_IND(Node);     /* tick */
263     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
264     TICK_ENT_VIA_NODE();
265     JMP_(GET_ENTRY(R1.cl));
266     FE_
267 }
268
269 #define IND_SPEC(n,ret) \
270 INFO_TABLE(stg_IND_##n##_info,stg_IND_##n##_entry,1,0,IND,,IF_,"IND","IND"); \
271 IF_(stg_IND_##n##_entry)                        \
272 {                                               \
273     FB_                                         \
274     TICK_ENT_DYN_IND(Node);     /* tick */      \
275     R1.p = (P_) ((StgInd*)R1.p)->indirectee;    \
276     TICK_ENT_VIA_NODE();                        \
277     JMP_(ret);                                  \
278     FE_                                         \
279 }
280
281 IND_SPEC(direct, ENTRY_CODE(Sp[0]))
282 IND_SPEC(0, RET_VEC(Sp[0],0))
283 IND_SPEC(1, RET_VEC(Sp[0],1))
284 IND_SPEC(2, RET_VEC(Sp[0],2))
285 IND_SPEC(3, RET_VEC(Sp[0],3))
286 IND_SPEC(4, RET_VEC(Sp[0],4))
287 IND_SPEC(5, RET_VEC(Sp[0],5))
288 IND_SPEC(6, RET_VEC(Sp[0],6))
289 IND_SPEC(7, RET_VEC(Sp[0],7))
290
291 INFO_TABLE(stg_IND_STATIC_info,stg_IND_STATIC_entry,1,0,IND_STATIC,,IF_,"IND_STATIC","IND_STATIC");
292 IF_(stg_IND_STATIC_entry)
293 {
294     FB_
295     TICK_ENT_STATIC_IND(Node);  /* tick */
296     R1.p = (P_) ((StgIndStatic*)R1.p)->indirectee;
297     TICK_ENT_VIA_NODE();
298     JMP_(GET_ENTRY(R1.cl));
299     FE_
300 }
301
302 INFO_TABLE(stg_IND_PERM_info,stg_IND_PERM_entry,1,1,IND_PERM,,IF_,"IND_PERM","IND_PERM");
303 IF_(stg_IND_PERM_entry)
304 {
305     FB_
306     /* Don't add INDs to granularity cost */
307     /* Dont: TICK_ENT_STATIC_IND(Node); for ticky-ticky; this ind is here only to help profiling */
308
309 #if defined(TICKY_TICKY) && !defined(PROFILING)
310     /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than being extra  */
311     TICK_ENT_PERM_IND(R1.p); /* tick */
312 #endif
313
314     LDV_ENTER((StgInd *)R1.p);
315
316     /* Enter PAP cost centre -- lexical scoping only */
317     ENTER_CCS_PAP_CL(R1.cl);
318
319     /* For ticky-ticky, change the perm_ind to a normal ind on first
320      * entry, so the number of ent_perm_inds is the number of *thunks*
321      * entered again, not the number of subsequent entries.
322      *
323      * Since this screws up cost centres, we die if profiling and
324      * ticky_ticky are on at the same time.  KSW 1999-01.
325      */
326
327 #ifdef TICKY_TICKY
328 #  ifdef PROFILING
329 #    error Profiling and ticky-ticky do not mix at present!
330 #  endif  /* PROFILING */
331     SET_INFO((StgInd*)R1.p,&stg_IND_info);
332 #endif /* TICKY_TICKY */
333
334     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
335
336     /* Dont: TICK_ENT_VIA_NODE(); for ticky-ticky; as above */
337
338 #if defined(TICKY_TICKY) && !defined(PROFILING)
339     TICK_ENT_VIA_NODE();
340 #endif
341
342     JMP_(GET_ENTRY(R1.cl));
343     FE_
344 }  
345
346 INFO_TABLE(stg_IND_OLDGEN_info,stg_IND_OLDGEN_entry,1,1,IND_OLDGEN,,IF_,"IND_OLDGEN","IND_OLDGEN");
347 IF_(stg_IND_OLDGEN_entry)
348 {
349     FB_
350     TICK_ENT_STATIC_IND(Node);  /* tick */
351     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
352     TICK_ENT_VIA_NODE();
353     JMP_(GET_ENTRY(R1.cl));
354     FE_
355 }
356
357 INFO_TABLE(stg_IND_OLDGEN_PERM_info,stg_IND_OLDGEN_PERM_entry,1,1,IND_OLDGEN_PERM,,IF_,"IND_OLDGEN_PERM","IND_OLDGEN_PERM");
358 IF_(stg_IND_OLDGEN_PERM_entry)
359 {
360     FB_
361     /* Dont: TICK_ENT_STATIC_IND(Node); for ticky-ticky; this ind is here only to help profiling */
362
363 #if defined(TICKY_TICKY) && !defined(PROFILING)
364     /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than being extra  */
365     TICK_ENT_PERM_IND(R1.p); /* tick */
366 #endif
367
368     LDV_ENTER((StgInd *)R1.p);
369
370     /* Enter PAP cost centre -- lexical scoping only */
371     ENTER_CCS_PAP_CL(R1.cl);
372
373     /* see comment in IND_PERM */
374 #ifdef TICKY_TICKY
375 #  ifdef PROFILING
376 #    error Profiling and ticky-ticky do not mix at present!
377 #  endif  /* PROFILING */
378     SET_INFO((StgInd*)R1.p,&stg_IND_OLDGEN_info);
379 #endif /* TICKY_TICKY */
380
381     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
382     TICK_ENT_VIA_NODE();
383     JMP_(GET_ENTRY(R1.cl));
384     FE_
385 }
386
387 /* -----------------------------------------------------------------------------
388    Entry code for a black hole.
389
390    Entering a black hole normally causes a cyclic data dependency, but
391    in the concurrent world, black holes are synchronization points,
392    and they are turned into blocking queues when there are threads
393    waiting for the evaluation of the closure to finish.
394    -------------------------------------------------------------------------- */
395
396 /* Note: a BLACKHOLE and BLACKHOLE_BQ must be big enough to be
397  * overwritten with an indirection/evacuee/catch.  Thus we claim it
398  * has 1 non-pointer word of payload (in addition to the pointer word
399  * for the blocking queue in a BQ), which should be big enough for an
400  * old-generation indirection. 
401  */
402
403 INFO_TABLE(stg_BLACKHOLE_info, stg_BLACKHOLE_entry,0,2,BLACKHOLE,,IF_,"BLACKHOLE","BLACKHOLE");
404 IF_(stg_BLACKHOLE_entry)
405 {
406   FB_
407 #if defined(GRAN)
408     /* Before overwriting TSO_LINK */
409     STGCALL3(GranSimBlock,CurrentTSO,CurrentProc,(StgClosure *)R1.p /*Node*/);
410 #endif
411
412 #ifdef SMP
413     {
414       bdescr *bd = Bdescr(R1.p);
415       if (bd->u.back != (bdescr *)BaseReg) {
416         if (bd->gen_no >= 1 || bd->step->no >= 1) {
417           CMPXCHG(R1.cl->header.info, &stg_BLACKHOLE_info, &stg_WHITEHOLE_info);
418         } else {
419           EXTFUN_RTS(stg_gc_enter_1_hponly);
420           JMP_(stg_gc_enter_1_hponly);
421         }
422       }
423     }
424 #endif
425     TICK_ENT_BH();
426
427     // Actually this is not necessary because R1.p is about to be destroyed.
428     LDV_ENTER((StgClosure *)R1.p);
429
430     /* Put ourselves on the blocking queue for this black hole */
431 #if defined(GRAN) || defined(PAR)
432     // in fact, only difference is the type of the end-of-queue marker!
433     CurrentTSO->link = END_BQ_QUEUE;
434     ((StgBlockingQueue *)R1.p)->blocking_queue = (StgBlockingQueueElement *)CurrentTSO;
435 #else
436     CurrentTSO->link = END_TSO_QUEUE;
437     ((StgBlockingQueue *)R1.p)->blocking_queue = CurrentTSO;
438 #endif
439     // jot down why and on what closure we are blocked
440     CurrentTSO->why_blocked = BlockedOnBlackHole;
441     CurrentTSO->block_info.closure = R1.cl;
442
443     /* Change the BLACKHOLE into a BLACKHOLE_BQ */
444 #ifdef PROFILING
445
446     // The size remains the same, so we call LDV_recordDead() - no need to fill slop.
447     LDV_recordDead((StgClosure *)R1.p, BLACKHOLE_sizeW());
448 #endif
449     // 
450     // Todo: maybe use SET_HDR() and remove LDV_recordCreate()?
451     // 
452     ((StgBlockingQueue *)R1.p)->header.info = &stg_BLACKHOLE_BQ_info;
453 #ifdef PROFILING
454     LDV_recordCreate((StgClosure *)R1.p);
455 #endif
456
457     // closure is mutable since something has just been added to its BQ
458     recordMutable((StgMutClosure *)R1.cl);
459
460     // PAR: dumping of event now done in blockThread -- HWL
461
462     // stg_gen_block is too heavyweight, use a specialised one
463     BLOCK_NP(1);
464   FE_
465 }
466
467 INFO_TABLE(stg_BLACKHOLE_BQ_info, stg_BLACKHOLE_BQ_entry,1,1,BLACKHOLE_BQ,,IF_,"BLACKHOLE","BLACKHOLE");
468 IF_(stg_BLACKHOLE_BQ_entry)
469 {
470   FB_
471 #if defined(GRAN)
472     /* Before overwriting TSO_LINK */
473     STGCALL3(GranSimBlock,CurrentTSO,CurrentProc,(StgClosure *)R1.p /*Node*/);
474 #endif
475
476 #ifdef SMP
477     {
478       bdescr *bd = Bdescr(R1.p);
479       if (bd->u.back != (bdescr *)BaseReg) {
480         if (bd->gen_no >= 1 || bd->step->no >= 1) {
481           CMPXCHG(R1.cl->header.info, &stg_BLACKHOLE_info, &stg_WHITEHOLE_info);
482         } else {
483           EXTFUN_RTS(stg_gc_enter_1_hponly);
484           JMP_(stg_gc_enter_1_hponly);
485         }
486       }
487     }
488 #endif
489
490     TICK_ENT_BH();
491     LDV_ENTER((StgClosure *)R1.p);
492
493     /* Put ourselves on the blocking queue for this black hole */
494     CurrentTSO->link = ((StgBlockingQueue *)R1.p)->blocking_queue;
495     ((StgBlockingQueue *)R1.p)->blocking_queue = CurrentTSO;
496     /* jot down why and on what closure we are blocked */
497     CurrentTSO->why_blocked = BlockedOnBlackHole;
498     CurrentTSO->block_info.closure = R1.cl;
499 #ifdef SMP
500     ((StgBlockingQueue *)R1.p)->header.info = &stg_BLACKHOLE_BQ_info;
501 #endif
502
503     /* PAR: dumping of event now done in blockThread -- HWL */
504
505     /* stg_gen_block is too heavyweight, use a specialised one */
506     BLOCK_NP(1);
507   FE_
508 }
509
510 /*
511    Revertible black holes are needed in the parallel world, to handle
512    negative acknowledgements of messages containing updatable closures.
513    The idea is that when the original message is transmitted, the closure
514    is turned into a revertible black hole...an object which acts like a
515    black hole when local threads try to enter it, but which can be reverted
516    back to the original closure if necessary.
517
518    It's actually a lot like a blocking queue (BQ) entry, because revertible
519    black holes are initially set up with an empty blocking queue.
520 */
521
522 #if defined(PAR) || defined(GRAN)
523
524 INFO_TABLE(stg_RBH_info, stg_RBH_entry,1,1,RBH,,IF_,"RBH","RBH");
525 IF_(stg_RBH_entry)
526 {
527   FB_
528 # if defined(GRAN)
529     /* mainly statistics gathering for GranSim simulation */
530     STGCALL3(GranSimBlock,CurrentTSO,CurrentProc,(StgClosure *)R1.p /*Node*/);
531 # endif
532
533     /* exactly the same as a BLACKHOLE_BQ_entry -- HWL */
534     /* Put ourselves on the blocking queue for this black hole */
535     CurrentTSO->link = ((StgBlockingQueue *)R1.p)->blocking_queue;
536     ((StgBlockingQueue *)R1.p)->blocking_queue = CurrentTSO;
537     /* jot down why and on what closure we are blocked */
538     CurrentTSO->why_blocked = BlockedOnBlackHole;
539     CurrentTSO->block_info.closure = R1.cl;
540
541     /* PAR: dumping of event now done in blockThread -- HWL */
542
543     /* stg_gen_block is too heavyweight, use a specialised one */
544     BLOCK_NP(1); 
545   FE_
546 }
547
548 INFO_TABLE(stg_RBH_Save_0_info, stg_RBH_Save_0_entry,0,2,CONSTR,,IF_,"RBH_Save_0","RBH_Save_0");
549 NON_ENTERABLE_ENTRY_CODE(RBH_Save_0);
550
551 INFO_TABLE(stg_RBH_Save_1_info, stg_RBH_Save_1_entry,1,1,CONSTR,,IF_,"RBH_Save_1","RBH_Save_1");
552 NON_ENTERABLE_ENTRY_CODE(RBH_Save_1);
553
554 INFO_TABLE(stg_RBH_Save_2_info, stg_RBH_Save_2_entry,2,0,CONSTR,,IF_,"RBH_Save_2","RBH_Save_2");
555 NON_ENTERABLE_ENTRY_CODE(RBH_Save_2);
556 #endif /* defined(PAR) || defined(GRAN) */
557
558 /* identical to BLACKHOLEs except for the infotag */
559 INFO_TABLE(stg_CAF_BLACKHOLE_info, stg_CAF_BLACKHOLE_entry,0,2,CAF_BLACKHOLE,,IF_,"CAF_BLACKHOLE","CAF_BLACKHOLE");
560 IF_(stg_CAF_BLACKHOLE_entry)
561 {
562   FB_
563 #if defined(GRAN)
564     /* mainly statistics gathering for GranSim simulation */
565     STGCALL3(GranSimBlock,CurrentTSO,CurrentProc,(StgClosure *)R1.p /*Node*/);
566 #endif
567
568 #ifdef SMP
569     {
570       bdescr *bd = Bdescr(R1.p);
571       if (bd->u.back != (bdescr *)BaseReg) {
572         if (bd->gen_no >= 1 || bd->step->no >= 1) {
573           CMPXCHG(R1.cl->header.info, &stg_CAF_BLACKHOLE_info, &stg_WHITEHOLE_info);
574         } else {
575           EXTFUN_RTS(stg_gc_enter_1_hponly);
576           JMP_(stg_gc_enter_1_hponly);
577         }
578       }
579     }
580 #endif
581
582     TICK_ENT_BH();
583     LDV_ENTER((StgClosure *)R1.p);
584
585     // Put ourselves on the blocking queue for this black hole
586 #if defined(GRAN) || defined(PAR)
587     // in fact, only difference is the type of the end-of-queue marker!
588     CurrentTSO->link = END_BQ_QUEUE;
589     ((StgBlockingQueue *)R1.p)->blocking_queue = (StgBlockingQueueElement *)CurrentTSO;
590 #else
591     CurrentTSO->link = END_TSO_QUEUE;
592     ((StgBlockingQueue *)R1.p)->blocking_queue = CurrentTSO;
593 #endif
594     // jot down why and on what closure we are blocked
595     CurrentTSO->why_blocked = BlockedOnBlackHole;
596     CurrentTSO->block_info.closure = R1.cl;
597
598     // Change the CAF_BLACKHOLE into a BLACKHOLE_BQ_STATIC
599     ((StgBlockingQueue *)R1.p)->header.info = &stg_BLACKHOLE_BQ_info;
600
601     // closure is mutable since something has just been added to its BQ
602     recordMutable((StgMutClosure *)R1.cl);
603
604     // PAR: dumping of event now done in blockThread -- HWL
605
606     // stg_gen_block is too heavyweight, use a specialised one
607     BLOCK_NP(1);
608   FE_
609 }
610
611 #ifdef EAGER_BLACKHOLING
612 INFO_TABLE(stg_SE_BLACKHOLE_info, stg_SE_BLACKHOLE_entry,0,2,SE_BLACKHOLE,,IF_,"SE_BLACKHOLE","SE_BLACKHOLE");
613 IF_(stg_SE_BLACKHOLE_entry)
614 {
615   FB_
616     STGCALL3(fprintf,stderr,"SE_BLACKHOLE at %p entered!\n",R1.p);
617     STGCALL1(shutdownHaskellAndExit,EXIT_FAILURE);
618   FE_
619 }
620
621 INFO_TABLE(stg_SE_CAF_BLACKHOLE_info, SE_CAF_BLACKHOLE_entry,0,2,SE_CAF_BLACKHOLE,,IF_,"CAF_BLACKHOLE","CAF_BLACKHOLE");
622 IF_(stg_SE_CAF_BLACKHOLE_entry)
623 {
624   FB_
625     STGCALL3(fprintf,stderr,"SE_CAF_BLACKHOLE at %p entered!\n",R1.p);
626     STGCALL1(shutdownHaskellAndExit,EXIT_FAILURE);
627   FE_
628 }
629 #endif
630
631 #ifdef SMP
632 INFO_TABLE(stg_WHITEHOLE_info, stg_WHITEHOLE_entry,0,2,CONSTR_NOCAF_STATIC,,IF_,"WHITEHOLE","WHITEHOLE");
633 IF_(stg_WHITEHOLE_entry)
634 {
635   FB_
636     JMP_(GET_ENTRY(R1.cl));
637   FE_
638 }
639 #endif
640
641 /* -----------------------------------------------------------------------------
642    Some static info tables for things that don't get entered, and
643    therefore don't need entry code (i.e. boxed but unpointed objects)
644    NON_ENTERABLE_ENTRY_CODE now defined at the beginning of the file
645    -------------------------------------------------------------------------- */
646
647 INFO_TABLE(stg_TSO_info, stg_TSO_entry, 0,0,TSO,,IF_,"TSO","TSO");
648 NON_ENTERABLE_ENTRY_CODE(TSO);
649
650 /* -----------------------------------------------------------------------------
651    Evacuees are left behind by the garbage collector.  Any attempt to enter
652    one is a real bug.
653    -------------------------------------------------------------------------- */
654
655 INFO_TABLE(stg_EVACUATED_info,stg_EVACUATED_entry,1,0,EVACUATED,,IF_,"EVACUATED","EVACUATED");
656 NON_ENTERABLE_ENTRY_CODE(EVACUATED);
657
658 /* -----------------------------------------------------------------------------
659    Weak pointers
660
661    Live weak pointers have a special closure type.  Dead ones are just
662    nullary constructors (although they live on the heap - we overwrite
663    live weak pointers with dead ones).
664    -------------------------------------------------------------------------- */
665
666 INFO_TABLE(stg_WEAK_info,stg_WEAK_entry,0,4,WEAK,,IF_,"WEAK","WEAK");
667 NON_ENTERABLE_ENTRY_CODE(WEAK);
668
669 // It's important when turning an existing WEAK into a DEAD_WEAK
670 // (which is what finalizeWeak# does) that we don't lose the link
671 // field and break the linked list of weak pointers.  Hence, we give
672 // DEAD_WEAK 4 non-pointer fields, the same as WEAK.
673
674 INFO_TABLE_CONSTR(stg_DEAD_WEAK_info,stg_DEAD_WEAK_entry,0,4,0,CONSTR,,IF_,"DEAD_WEAK","DEAD_WEAK");
675 NON_ENTERABLE_ENTRY_CODE(DEAD_WEAK);
676
677 /* -----------------------------------------------------------------------------
678    NO_FINALIZER
679
680    This is a static nullary constructor (like []) that we use to mark an empty
681    finalizer in a weak pointer object.
682    -------------------------------------------------------------------------- */
683
684 INFO_TABLE_CONSTR(stg_NO_FINALIZER_info,stg_NO_FINALIZER_entry,0,0,0,CONSTR_NOCAF_STATIC,,IF_,"NO_FINALIZER","NO_FINALIZER");
685 NON_ENTERABLE_ENTRY_CODE(NO_FINALIZER);
686
687 SET_STATIC_HDR(stg_NO_FINALIZER_closure,stg_NO_FINALIZER_info,0/*CC*/,,extern const StgInfoTable)
688 , /*payload*/{} };
689
690 /* -----------------------------------------------------------------------------
691    Foreign Objects are unlifted and therefore never entered.
692    -------------------------------------------------------------------------- */
693
694 INFO_TABLE(stg_FOREIGN_info,stg_FOREIGN_entry,0,1,FOREIGN,,IF_,"FOREIGN","FOREIGN");
695 NON_ENTERABLE_ENTRY_CODE(FOREIGN);
696
697 /* -----------------------------------------------------------------------------
698    Stable Names are unlifted too.
699    -------------------------------------------------------------------------- */
700
701 INFO_TABLE(stg_STABLE_NAME_info,stg_STABLE_NAME_entry,0,1,STABLE_NAME,,IF_,"STABLE_NAME","STABLE_NAME");
702 NON_ENTERABLE_ENTRY_CODE(STABLE_NAME);
703
704 /* -----------------------------------------------------------------------------
705    MVars
706
707    There are two kinds of these: full and empty.  We need an info table
708    and entry code for each type.
709    -------------------------------------------------------------------------- */
710
711 INFO_TABLE(stg_FULL_MVAR_info,stg_FULL_MVAR_entry,4,0,MVAR,,IF_,"MVAR","MVAR");
712 NON_ENTERABLE_ENTRY_CODE(FULL_MVAR);
713
714 INFO_TABLE(stg_EMPTY_MVAR_info,stg_EMPTY_MVAR_entry,4,0,MVAR,,IF_,"MVAR","MVAR");
715 NON_ENTERABLE_ENTRY_CODE(EMPTY_MVAR);
716
717 /* -----------------------------------------------------------------------------
718    END_TSO_QUEUE
719
720    This is a static nullary constructor (like []) that we use to mark the
721    end of a linked TSO queue.
722    -------------------------------------------------------------------------- */
723
724 INFO_TABLE_CONSTR(stg_END_TSO_QUEUE_info,stg_END_TSO_QUEUE_entry,0,0,0,CONSTR_NOCAF_STATIC,,IF_,"END_TSO_QUEUE","END_TSO_QUEUE");
725 NON_ENTERABLE_ENTRY_CODE(END_TSO_QUEUE);
726
727 SET_STATIC_HDR(stg_END_TSO_QUEUE_closure,stg_END_TSO_QUEUE_info,0/*CC*/,,extern const StgInfoTable)
728 , /*payload*/{} };
729
730 /* -----------------------------------------------------------------------------
731    Mutable lists
732
733    Mutable lists (used by the garbage collector) consist of a chain of
734    StgMutClosures connected through their mut_link fields, ending in
735    an END_MUT_LIST closure.
736    -------------------------------------------------------------------------- */
737
738 INFO_TABLE_CONSTR(stg_END_MUT_LIST_info,stg_END_MUT_LIST_entry,0,0,0,CONSTR_NOCAF_STATIC,,IF_,"END_MUT_LIST","END_MUT_LIST");
739 NON_ENTERABLE_ENTRY_CODE(END_MUT_LIST);
740
741 SET_STATIC_HDR(stg_END_MUT_LIST_closure,stg_END_MUT_LIST_info,0/*CC*/,,extern const StgInfoTable)
742 , /*payload*/{} };
743
744 INFO_TABLE(stg_MUT_CONS_info, stg_MUT_CONS_entry, 1, 1, MUT_CONS, , IF_, "MUT_CONS", "MUT_CONS");
745 NON_ENTERABLE_ENTRY_CODE(MUT_CONS);
746
747 /* -----------------------------------------------------------------------------
748    Exception lists
749    -------------------------------------------------------------------------- */
750
751 INFO_TABLE_CONSTR(stg_END_EXCEPTION_LIST_info,stg_END_EXCEPTION_LIST_entry,0,0,0,CONSTR_NOCAF_STATIC,,IF_,"END_EXCEPTION_LIST","END_EXCEPTION_LIST");
752 NON_ENTERABLE_ENTRY_CODE(END_EXCEPTION_LIST);
753
754 SET_STATIC_HDR(stg_END_EXCEPTION_LIST_closure,stg_END_EXCEPTION_LIST_info,0/*CC*/,,extern const StgInfoTable)
755 , /*payload*/{} };
756
757 INFO_TABLE(stg_EXCEPTION_CONS_info, stg_EXCEPTION_CONS_entry, 1, 1, CONSTR, , IF_, "EXCEPTION_CONS", "EXCEPTION_CONS");
758 NON_ENTERABLE_ENTRY_CODE(EXCEPTION_CONS);
759
760 /* -----------------------------------------------------------------------------
761    Arrays
762
763    These come in two basic flavours: arrays of data (StgArrWords) and arrays of
764    pointers (StgArrPtrs).  They all have a similar layout:
765
766         ___________________________
767         | Info | No. of | data....
768         |  Ptr | Words  |
769         ---------------------------
770
771    These are *unpointed* objects: i.e. they cannot be entered.
772
773    -------------------------------------------------------------------------- */
774
775 #define ArrayInfo(type)                                 \
776 INFO_TABLE(stg_##type##_info, stg_##type##_entry, 0, 0, type, , IF_,"" # type "","" # type "");
777
778 ArrayInfo(ARR_WORDS);
779 NON_ENTERABLE_ENTRY_CODE(ARR_WORDS);
780 ArrayInfo(MUT_ARR_PTRS);
781 NON_ENTERABLE_ENTRY_CODE(MUT_ARR_PTRS);
782 ArrayInfo(MUT_ARR_PTRS_FROZEN);
783 NON_ENTERABLE_ENTRY_CODE(MUT_ARR_PTRS_FROZEN);
784
785 #undef ArrayInfo
786
787 /* -----------------------------------------------------------------------------
788    Mutable Variables
789    -------------------------------------------------------------------------- */
790
791 INFO_TABLE(stg_MUT_VAR_info, stg_MUT_VAR_entry, 1, 1, MUT_VAR, , IF_, "MUT_VAR", "MUT_VAR");
792 NON_ENTERABLE_ENTRY_CODE(MUT_VAR);
793
794 /* -----------------------------------------------------------------------------
795    Dummy return closure
796  
797    Entering this closure will just return to the address on the top of the
798    stack.  Useful for getting a thread in a canonical form where we can
799    just enter the top stack word to start the thread.  (see deleteThread)
800  * -------------------------------------------------------------------------- */
801
802 INFO_TABLE( stg_dummy_ret_info, stg_dummy_ret_entry, 
803             0, 0, CONSTR_NOCAF_STATIC, , EF_, "DUMMY_RET", "DUMMY_RET");
804
805 STGFUN(stg_dummy_ret_entry)
806 {
807   FB_
808   JMP_(ENTRY_CODE(Sp[0]));
809   FE_
810 }
811 SET_STATIC_HDR(stg_dummy_ret_closure,stg_dummy_ret_info,CCS_DONT_CARE,,extern const StgInfoTable)
812 , /*payload*/{} };
813
814 /* -----------------------------------------------------------------------------
815    CHARLIKE and INTLIKE closures.  
816
817    These are static representations of Chars and small Ints, so that
818    we can remove dynamic Chars and Ints during garbage collection and
819    replace them with references to the static objects.
820    -------------------------------------------------------------------------- */
821
822 #if defined(INTERPRETER) || defined(ENABLE_WIN32_DLL_SUPPORT)
823 /*
824  * When sticking the RTS in a DLL, we delay populating the
825  * Charlike and Intlike tables until load-time, which is only
826  * when we've got the real addresses to the C# and I# closures.
827  *
828  */
829 static INFO_TBL_CONST StgInfoTable czh_static_info;
830 static INFO_TBL_CONST StgInfoTable izh_static_info;
831 #define Char_hash_static_info czh_static_info
832 #define Int_hash_static_info izh_static_info
833 #else
834 #define Char_hash_static_info GHCziBase_Czh_static_info
835 #define Int_hash_static_info GHCziBase_Izh_static_info
836 #endif
837
838 #define CHARLIKE_HDR(n)                                         \
839         {                                                       \
840           STATIC_HDR(Char_hash_static_info, /* C# */            \
841                          CCS_DONT_CARE),                        \
842           data : n                                              \
843         }
844                                              
845 #define INTLIKE_HDR(n)                                          \
846         {                                                       \
847           STATIC_HDR(Int_hash_static_info,  /* I# */            \
848                          CCS_DONT_CARE),                        \
849           data : n                                              \
850         }
851
852 /* put these in the *data* section, since the garbage collector relies
853  * on the fact that static closures live in the data section.
854  */
855
856 /* end the name with _closure, to convince the mangler this is a closure */
857
858 StgIntCharlikeClosure stg_CHARLIKE_closure[] = {
859     CHARLIKE_HDR(0),
860     CHARLIKE_HDR(1),
861     CHARLIKE_HDR(2),
862     CHARLIKE_HDR(3),
863     CHARLIKE_HDR(4),
864     CHARLIKE_HDR(5),
865     CHARLIKE_HDR(6),
866     CHARLIKE_HDR(7),
867     CHARLIKE_HDR(8),
868     CHARLIKE_HDR(9),
869     CHARLIKE_HDR(10),
870     CHARLIKE_HDR(11),
871     CHARLIKE_HDR(12),
872     CHARLIKE_HDR(13),
873     CHARLIKE_HDR(14),
874     CHARLIKE_HDR(15),
875     CHARLIKE_HDR(16),
876     CHARLIKE_HDR(17),
877     CHARLIKE_HDR(18),
878     CHARLIKE_HDR(19),
879     CHARLIKE_HDR(20),
880     CHARLIKE_HDR(21),
881     CHARLIKE_HDR(22),
882     CHARLIKE_HDR(23),
883     CHARLIKE_HDR(24),
884     CHARLIKE_HDR(25),
885     CHARLIKE_HDR(26),
886     CHARLIKE_HDR(27),
887     CHARLIKE_HDR(28),
888     CHARLIKE_HDR(29),
889     CHARLIKE_HDR(30),
890     CHARLIKE_HDR(31),
891     CHARLIKE_HDR(32),
892     CHARLIKE_HDR(33),
893     CHARLIKE_HDR(34),
894     CHARLIKE_HDR(35),
895     CHARLIKE_HDR(36),
896     CHARLIKE_HDR(37),
897     CHARLIKE_HDR(38),
898     CHARLIKE_HDR(39),
899     CHARLIKE_HDR(40),
900     CHARLIKE_HDR(41),
901     CHARLIKE_HDR(42),
902     CHARLIKE_HDR(43),
903     CHARLIKE_HDR(44),
904     CHARLIKE_HDR(45),
905     CHARLIKE_HDR(46),
906     CHARLIKE_HDR(47),
907     CHARLIKE_HDR(48),
908     CHARLIKE_HDR(49),
909     CHARLIKE_HDR(50),
910     CHARLIKE_HDR(51),
911     CHARLIKE_HDR(52),
912     CHARLIKE_HDR(53),
913     CHARLIKE_HDR(54),
914     CHARLIKE_HDR(55),
915     CHARLIKE_HDR(56),
916     CHARLIKE_HDR(57),
917     CHARLIKE_HDR(58),
918     CHARLIKE_HDR(59),
919     CHARLIKE_HDR(60),
920     CHARLIKE_HDR(61),
921     CHARLIKE_HDR(62),
922     CHARLIKE_HDR(63),
923     CHARLIKE_HDR(64),
924     CHARLIKE_HDR(65),
925     CHARLIKE_HDR(66),
926     CHARLIKE_HDR(67),
927     CHARLIKE_HDR(68),
928     CHARLIKE_HDR(69),
929     CHARLIKE_HDR(70),
930     CHARLIKE_HDR(71),
931     CHARLIKE_HDR(72),
932     CHARLIKE_HDR(73),
933     CHARLIKE_HDR(74),
934     CHARLIKE_HDR(75),
935     CHARLIKE_HDR(76),
936     CHARLIKE_HDR(77),
937     CHARLIKE_HDR(78),
938     CHARLIKE_HDR(79),
939     CHARLIKE_HDR(80),
940     CHARLIKE_HDR(81),
941     CHARLIKE_HDR(82),
942     CHARLIKE_HDR(83),
943     CHARLIKE_HDR(84),
944     CHARLIKE_HDR(85),
945     CHARLIKE_HDR(86),
946     CHARLIKE_HDR(87),
947     CHARLIKE_HDR(88),
948     CHARLIKE_HDR(89),
949     CHARLIKE_HDR(90),
950     CHARLIKE_HDR(91),
951     CHARLIKE_HDR(92),
952     CHARLIKE_HDR(93),
953     CHARLIKE_HDR(94),
954     CHARLIKE_HDR(95),
955     CHARLIKE_HDR(96),
956     CHARLIKE_HDR(97),
957     CHARLIKE_HDR(98),
958     CHARLIKE_HDR(99),
959     CHARLIKE_HDR(100),
960     CHARLIKE_HDR(101),
961     CHARLIKE_HDR(102),
962     CHARLIKE_HDR(103),
963     CHARLIKE_HDR(104),
964     CHARLIKE_HDR(105),
965     CHARLIKE_HDR(106),
966     CHARLIKE_HDR(107),
967     CHARLIKE_HDR(108),
968     CHARLIKE_HDR(109),
969     CHARLIKE_HDR(110),
970     CHARLIKE_HDR(111),
971     CHARLIKE_HDR(112),
972     CHARLIKE_HDR(113),
973     CHARLIKE_HDR(114),
974     CHARLIKE_HDR(115),
975     CHARLIKE_HDR(116),
976     CHARLIKE_HDR(117),
977     CHARLIKE_HDR(118),
978     CHARLIKE_HDR(119),
979     CHARLIKE_HDR(120),
980     CHARLIKE_HDR(121),
981     CHARLIKE_HDR(122),
982     CHARLIKE_HDR(123),
983     CHARLIKE_HDR(124),
984     CHARLIKE_HDR(125),
985     CHARLIKE_HDR(126),
986     CHARLIKE_HDR(127),
987     CHARLIKE_HDR(128),
988     CHARLIKE_HDR(129),
989     CHARLIKE_HDR(130),
990     CHARLIKE_HDR(131),
991     CHARLIKE_HDR(132),
992     CHARLIKE_HDR(133),
993     CHARLIKE_HDR(134),
994     CHARLIKE_HDR(135),
995     CHARLIKE_HDR(136),
996     CHARLIKE_HDR(137),
997     CHARLIKE_HDR(138),
998     CHARLIKE_HDR(139),
999     CHARLIKE_HDR(140),
1000     CHARLIKE_HDR(141),
1001     CHARLIKE_HDR(142),
1002     CHARLIKE_HDR(143),
1003     CHARLIKE_HDR(144),
1004     CHARLIKE_HDR(145),
1005     CHARLIKE_HDR(146),
1006     CHARLIKE_HDR(147),
1007     CHARLIKE_HDR(148),
1008     CHARLIKE_HDR(149),
1009     CHARLIKE_HDR(150),
1010     CHARLIKE_HDR(151),
1011     CHARLIKE_HDR(152),
1012     CHARLIKE_HDR(153),
1013     CHARLIKE_HDR(154),
1014     CHARLIKE_HDR(155),
1015     CHARLIKE_HDR(156),
1016     CHARLIKE_HDR(157),
1017     CHARLIKE_HDR(158),
1018     CHARLIKE_HDR(159),
1019     CHARLIKE_HDR(160),
1020     CHARLIKE_HDR(161),
1021     CHARLIKE_HDR(162),
1022     CHARLIKE_HDR(163),
1023     CHARLIKE_HDR(164),
1024     CHARLIKE_HDR(165),
1025     CHARLIKE_HDR(166),
1026     CHARLIKE_HDR(167),
1027     CHARLIKE_HDR(168),
1028     CHARLIKE_HDR(169),
1029     CHARLIKE_HDR(170),
1030     CHARLIKE_HDR(171),
1031     CHARLIKE_HDR(172),
1032     CHARLIKE_HDR(173),
1033     CHARLIKE_HDR(174),
1034     CHARLIKE_HDR(175),
1035     CHARLIKE_HDR(176),
1036     CHARLIKE_HDR(177),
1037     CHARLIKE_HDR(178),
1038     CHARLIKE_HDR(179),
1039     CHARLIKE_HDR(180),
1040     CHARLIKE_HDR(181),
1041     CHARLIKE_HDR(182),
1042     CHARLIKE_HDR(183),
1043     CHARLIKE_HDR(184),
1044     CHARLIKE_HDR(185),
1045     CHARLIKE_HDR(186),
1046     CHARLIKE_HDR(187),
1047     CHARLIKE_HDR(188),
1048     CHARLIKE_HDR(189),
1049     CHARLIKE_HDR(190),
1050     CHARLIKE_HDR(191),
1051     CHARLIKE_HDR(192),
1052     CHARLIKE_HDR(193),
1053     CHARLIKE_HDR(194),
1054     CHARLIKE_HDR(195),
1055     CHARLIKE_HDR(196),
1056     CHARLIKE_HDR(197),
1057     CHARLIKE_HDR(198),
1058     CHARLIKE_HDR(199),
1059     CHARLIKE_HDR(200),
1060     CHARLIKE_HDR(201),
1061     CHARLIKE_HDR(202),
1062     CHARLIKE_HDR(203),
1063     CHARLIKE_HDR(204),
1064     CHARLIKE_HDR(205),
1065     CHARLIKE_HDR(206),
1066     CHARLIKE_HDR(207),
1067     CHARLIKE_HDR(208),
1068     CHARLIKE_HDR(209),
1069     CHARLIKE_HDR(210),
1070     CHARLIKE_HDR(211),
1071     CHARLIKE_HDR(212),
1072     CHARLIKE_HDR(213),
1073     CHARLIKE_HDR(214),
1074     CHARLIKE_HDR(215),
1075     CHARLIKE_HDR(216),
1076     CHARLIKE_HDR(217),
1077     CHARLIKE_HDR(218),
1078     CHARLIKE_HDR(219),
1079     CHARLIKE_HDR(220),
1080     CHARLIKE_HDR(221),
1081     CHARLIKE_HDR(222),
1082     CHARLIKE_HDR(223),
1083     CHARLIKE_HDR(224),
1084     CHARLIKE_HDR(225),
1085     CHARLIKE_HDR(226),
1086     CHARLIKE_HDR(227),
1087     CHARLIKE_HDR(228),
1088     CHARLIKE_HDR(229),
1089     CHARLIKE_HDR(230),
1090     CHARLIKE_HDR(231),
1091     CHARLIKE_HDR(232),
1092     CHARLIKE_HDR(233),
1093     CHARLIKE_HDR(234),
1094     CHARLIKE_HDR(235),
1095     CHARLIKE_HDR(236),
1096     CHARLIKE_HDR(237),
1097     CHARLIKE_HDR(238),
1098     CHARLIKE_HDR(239),
1099     CHARLIKE_HDR(240),
1100     CHARLIKE_HDR(241),
1101     CHARLIKE_HDR(242),
1102     CHARLIKE_HDR(243),
1103     CHARLIKE_HDR(244),
1104     CHARLIKE_HDR(245),
1105     CHARLIKE_HDR(246),
1106     CHARLIKE_HDR(247),
1107     CHARLIKE_HDR(248),
1108     CHARLIKE_HDR(249),
1109     CHARLIKE_HDR(250),
1110     CHARLIKE_HDR(251),
1111     CHARLIKE_HDR(252),
1112     CHARLIKE_HDR(253),
1113     CHARLIKE_HDR(254),
1114     CHARLIKE_HDR(255)
1115 };
1116
1117 StgIntCharlikeClosure stg_INTLIKE_closure[] = {
1118     INTLIKE_HDR(-16),   /* MIN_INTLIKE == -16 */
1119     INTLIKE_HDR(-15),
1120     INTLIKE_HDR(-14),
1121     INTLIKE_HDR(-13),
1122     INTLIKE_HDR(-12),
1123     INTLIKE_HDR(-11),
1124     INTLIKE_HDR(-10),
1125     INTLIKE_HDR(-9),
1126     INTLIKE_HDR(-8),
1127     INTLIKE_HDR(-7),
1128     INTLIKE_HDR(-6),
1129     INTLIKE_HDR(-5),
1130     INTLIKE_HDR(-4),
1131     INTLIKE_HDR(-3),
1132     INTLIKE_HDR(-2),
1133     INTLIKE_HDR(-1),
1134     INTLIKE_HDR(0),
1135     INTLIKE_HDR(1),
1136     INTLIKE_HDR(2),
1137     INTLIKE_HDR(3),
1138     INTLIKE_HDR(4),
1139     INTLIKE_HDR(5),
1140     INTLIKE_HDR(6),
1141     INTLIKE_HDR(7),
1142     INTLIKE_HDR(8),
1143     INTLIKE_HDR(9),
1144     INTLIKE_HDR(10),
1145     INTLIKE_HDR(11),
1146     INTLIKE_HDR(12),
1147     INTLIKE_HDR(13),
1148     INTLIKE_HDR(14),
1149     INTLIKE_HDR(15),
1150     INTLIKE_HDR(16)     /* MAX_INTLIKE == 16 */
1151 };