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