/* -----------------------------------------------------------------------------
- * $Id: StgMiscClosures.hc,v 1.73 2002/02/12 15:17:22 simonmar Exp $
+ * $Id: StgMiscClosures.hc,v 1.80 2002/09/17 12:34:31 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
# include "StgRun.h" /* for StgReturn and register saving */
#endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
#endif
/* ToDo: make the printing of panics more win32-friendly, i.e.,
Template for the entry code of non-enterable closures.
*/
-#define NON_ENTERABLE_ENTRY_CODE(type) \
-STGFUN(stg_##type##_entry) \
-{ \
- FB_ \
- DUMP_ERRMSG(#type " object entered!\n"); \
- STGCALL1(shutdownHaskellAndExit, EXIT_FAILURE); \
- return NULL; \
- FE_ \
+#define NON_ENTERABLE_ENTRY_CODE(type) \
+STGFUN(stg_##type##_entry) \
+{ \
+ FB_ \
+ STGCALL1(barf, #type " object entered!\n"); \
+ FE_ \
}
STGFUN(stg_IND_entry)
{
FB_
- TICK_ENT_IND(Node); /* tick */
+ TICK_ENT_DYN_IND(Node); /* tick */
R1.p = (P_) ((StgInd*)R1.p)->indirectee;
TICK_ENT_VIA_NODE();
JMP_(GET_ENTRY(R1.cl));
STGFUN(stg_IND_STATIC_entry)
{
FB_
- TICK_ENT_IND(Node); /* tick */
+ TICK_ENT_STATIC_IND(Node); /* tick */
R1.p = (P_) ((StgIndStatic*)R1.p)->indirectee;
TICK_ENT_VIA_NODE();
JMP_(GET_ENTRY(R1.cl));
{
FB_
/* Don't add INDs to granularity cost */
- /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profiling */
+ /* Dont: TICK_ENT_STATIC_IND(Node); for ticky-ticky; this ind is here only to help profiling */
#if defined(TICKY_TICKY) && !defined(PROFILING)
/* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than being extra */
STGFUN(stg_IND_OLDGEN_entry)
{
FB_
- TICK_ENT_IND(Node); /* tick */
+ TICK_ENT_STATIC_IND(Node); /* tick */
R1.p = (P_) ((StgInd*)R1.p)->indirectee;
TICK_ENT_VIA_NODE();
JMP_(GET_ENTRY(R1.cl));
STGFUN(stg_IND_OLDGEN_PERM_entry)
{
FB_
- /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profiling */
+ /* Dont: TICK_ENT_STATIC_IND(Node); for ticky-ticky; this ind is here only to help profiling */
#if defined(TICKY_TICKY) && !defined(PROFILING)
/* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than being extra */
FE_
}
-INFO_TABLE(SE_CAF_BLACKHOLE_info, SE_CAF_BLACKHOLE_entry,0,2,SE_CAF_BLACKHOLE,,EF_,"CAF_BLACKHOLE","CAF_BLACKHOLE");
+INFO_TABLE(stg_SE_CAF_BLACKHOLE_info, SE_CAF_BLACKHOLE_entry,0,2,SE_CAF_BLACKHOLE,,EF_,"CAF_BLACKHOLE","CAF_BLACKHOLE");
STGFUN(stg_SE_CAF_BLACKHOLE_entry)
{
FB_
INFO_TABLE(stg_WEAK_info,stg_WEAK_entry,0,4,WEAK,,EF_,"WEAK","WEAK");
NON_ENTERABLE_ENTRY_CODE(WEAK);
-// XXX! The garbage collector replaces a WEAK with a DEAD_WEAK
-// in-place, which causes problems if the heap is scanned linearly
-// after GC (certain kinds of profiling do this). So when profiling,
-// we set the size of a DEAD_WEAK to 4 non-pointers, rather than its
-// usual 1.
-
-#ifdef PROFILING
-#define DEAD_WEAK_PAYLOAD_WORDS 4
-#else
-#define DEAD_WEAK_PAYLOAD_WORDS 1
-#endif
+// It's important when turning an existing WEAK into a DEAD_WEAK
+// (which is what finalizeWeak# does) that we don't lose the link
+// field and break the linked list of weak pointers. Hence, we give
+// DEAD_WEAK 4 non-pointer fields, the same as WEAK.
-INFO_TABLE_CONSTR(stg_DEAD_WEAK_info,stg_DEAD_WEAK_entry,0,DEAD_WEAK_PAYLOAD_WORDS,0,CONSTR,,EF_,"DEAD_WEAK","DEAD_WEAK");
+INFO_TABLE_CONSTR(stg_DEAD_WEAK_info,stg_DEAD_WEAK_entry,0,4,0,CONSTR,,EF_,"DEAD_WEAK","DEAD_WEAK");
NON_ENTERABLE_ENTRY_CODE(DEAD_WEAK);
/* -----------------------------------------------------------------------------