\begin{code}
-#define FIXED_HS (INFO_FIXED_HDR + PAR_FIXED_HDR + PROF_FIXED_HDR + AGE_FIXED_HDR)
+#define FIXED_HS (INFO_FIXED_HDR + PAR_FIXED_HDR + PROF_FIXED_HDR + TICKY_FIXED_HDR)
/* NB: this *defines* the intended order for the pieces of
the fixed header. Care should be taken to ensure that this
SET_GRAN_HDR(closure,ThisPE); \
SET_PAR_HDR(closure,LOCAL_GA); \
SET_PROF_HDR(closure,costcentre); \
- SET_AGE_HDR(closure)
+ SET_TICKY_HDR(closure,0)
#define UPD_FIXED_HDR(closure,infolbl,costcentre) \
SET_INFO_PTR(closure,infolbl); \
- SET_PROF_HDR(closure,costcentre)
+ SET_PROF_HDR(closure,costcentre); \
+ SET_TICKY_HDR(closure,1)
/* fiddling SET_PAR_HDR would be a bug (says Patrick) */
- /* no SET_AGE_HDR for inplace updates */
+ /* We set ticky-hdr to 1 because the only place we
+ use this macro is when we have just done an update
+ (WDP 96/01)
+ */
/* These items are comma-separated */
SET_STATIC_PROCS(closure) \
SET_STATIC_PAR_HDR(closure) \
SET_STATIC_PROF_HDR(cc_ident) \
- SET_STATIC_AGE_HDR()
+ SET_STATIC_TICKY_HDR()
\end{code}
they will hear about it soon enough (WDP 95/05).
\begin{code}
-#define SPEC_HS (FIXED_HS)
+#define SPEC_HS (FIXED_HS)
+
+#define SPEC_SIZE(fields) (FIXED_HS + (fields))
+ /*notational convenience; in SMscan.lc + elsewhere */
#define SPEC_CLOSURE_PTR(closure, no) (((P_)(closure))[SPEC_HS + (no) - 1])
#define SPEC_CLOSURE_SIZE(closure) ((W_)INFO_SIZE(INFO_PTR(closure)))
%************************************************************************
%* *
-\subsubsection[MallocPtr-closures]{@MallocPtr@ closure macros}
+\subsubsection[ForeignObj-closures]{@ForeignObj@ closure macros}
%* *
%************************************************************************
-Here's what a MallocPtr looks like:
+Here's what a ForeignObj looks like:
\begin{verbatim}
<Var Hdr>
-+----------+----------+------+------+
-| Info Ptr | Forward | Data | List |
-+----------+----------+------+------+
++----------+----------+------+-------------+------+
+| Info Ptr | Forward | Data | FreeRoutine | List |
++----------+----------+------+-------------+------+
\end{verbatim}
-The list is a pointer to the next MallocPtr in the list of all
-MallocPtrs. Note that it is essential that the garbage collector {\em
+@List@ is a pointer to the next ForeignObj in the list of all
+ForeignObjs. Note that it is essential that the garbage collector {\em
not\/} follow this link but that the link must get updated with the
new address.
The optional @Forward@ field is used by copying collectors to insert
the forwarding pointer into. (If we overwrite the @Data@ part, we
-don't know which MallocPtr has just died; if we overwrite the @List@ part,
-we can't traverse the list of all MallocPtrs.)
+don't know which ForeignObj has just died; if we overwrite the @List@ part,
+we can't traverse the list of all ForeignObjs.)
+
+The @FreeRoutine@ is a reference to the finalisation routine to call
+when the @ForeignObj@ becomes garbage -- SOF 4/96
\begin{code}
#if !defined(PAR)
# if defined(_INFO_COPYING)
-# define MallocPtr_VHS 1
+# define ForeignObj_VHS 1
# else
-# define MallocPtr_VHS 0
+# define ForeignObj_VHS 0
# endif
-# define MallocPtr_HS (FIXED_HS + MallocPtr_VHS)
-# define MallocPtr_SIZE (MallocPtr_VHS + 2)
+# define ForeignObj_HS (FIXED_HS + ForeignObj_VHS)
+# define ForeignObj_SIZE (ForeignObj_VHS + 3)
-# define MallocPtr_CLOSURE_NoPTRS(closure) 0
-# define MallocPtr_CLOSURE_DATA(closure) (((StgMallocPtr *)(closure))[MallocPtr_HS + 0])
-# define MallocPtr_CLOSURE_LINK(closure) (((StgPtrPtr) (closure))[MallocPtr_HS + 1])
+# define ForeignObj_CLOSURE_NoPTRS(closure) 0
+# define ForeignObj_CLOSURE_DATA(closure) (((StgForeignObj *)(closure))[ForeignObj_HS + 0])
+# define ForeignObj_CLOSURE_FINALISER(closure) (((StgForeignObj *)(closure))[ForeignObj_HS + 1])
+# define ForeignObj_CLOSURE_LINK(closure) (((StgPtrPtr) (closure))[ForeignObj_HS + 2])
-# define SET_MallocPtr_HDR(closure,infolbl,cc,size,ptrs) \
+# define SET_ForeignObj_HDR(closure,infolbl,cc,size,ptrs) \
SET_FIXED_HDR(closure,infolbl,cc)
\end{code}
-And to check that a Malloc ptr closure is valid
+And to check that a Foreign ptr closure is valid
\begin{code}
-EXTDATA_RO(MallocPtr_info);
+EXTDATA_RO(ForeignObj_info);
# if defined(DEBUG)
-# define CHECK_MallocPtr_CLOSURE( closure ) \
+# define CHECK_ForeignObj_CLOSURE( closure ) \
do { \
- CHECK_MallocPtr_InfoTable( closure ); \
+ CHECK_ForeignObj_InfoTable( closure ); \
} while (0)
-# define CHECK_MallocPtr_InfoTable( closure ) \
- ASSERT( (*((PP_)(closure))) == MallocPtr_info )
+# define CHECK_ForeignObj_InfoTable( closure ) \
+ ASSERT( (*((PP_)(closure))) == ForeignObj_info )
-extern void Validate_MallocPtrList( P_ MPlist );
-# define VALIDATE_MallocPtrList( mplist ) Validate_MallocPtrList( mplist )
+extern void Validate_ForeignObjList( P_ MPlist );
+# define VALIDATE_ForeignObjList( mplist ) Validate_ForeignObjList( mplist )
# else /* !DEBUG */
-# define CHECK_MallocPtr_CLOSURE( closure ) /* nothing */
-# define VALIDATE_MallocPtrList( mplist ) /* nothing */
+# define CHECK_ForeignObj_CLOSURE( closure ) /* nothing */
+# define VALIDATE_ForeignObjList( mplist ) /* nothing */
# endif /* !DEBUG */
#endif /* !PAR */
} while (0)
EXTDATA_RO(StablePointerTable_info);
-EXTDATA_RO(EmptyStablePointerTable_static_info);
+EXTDATA_RO(EmptyStablePointerTable_info);
EXTDATA(EmptySPTable_closure);
-extern int ValidateSPTable PROTO(( P_ SPTable ));
+int ValidateSPTable PROTO(( P_ SPTable ));
# define CHECK_SPT_InfoTable( closure ) \
- ASSERT( (*((PP_) (closure)) == EmptyStablePointerTable_static_info && (closure == EmptySPTable_closure) ) || \
+ ASSERT( (*((PP_) (closure)) == EmptyStablePointerTable_info && (closure == EmptySPTable_closure) ) || \
(*((PP_) (closure)) == StablePointerTable_info) )
# define CHECK_SPT_Size( closure ) \
#define DATA_CLOSURE_NoPTRS(closure) ((I_)0)
#define DATA_CLOSURE_NoNONPTRS(closure) (DATA_CLOSURE_SIZE(closure) - DATA_VHS)
-#define SET_DATA_HDR(closure,infolbl,cc,size,ptrs/*==0*/) \
- { SET_FIXED_HDR(closure,infolbl,cc); \
+#define SET_DATA_HDR(closure,infolbl,cc,size,ptrs) \
+ { SET_FIXED_HDR(closure,infolbl,cc); \
DATA_CLOSURE_SIZE(closure) = (W_)(size); }
\end{code}
#define IND_CLOSURE_SIZE(closure) (MIN_UPD_SIZE)
#define IND_CLOSURE_NoPTRS(closure) 1
-#define IND_CLOSURE_NoNONPTRS(closure) (IND_CLOSURE_SIZE(closure)-IND_CLOSURE_NoPTRS(closure)-IND_VHS)
+#define IND_CLOSURE_NoNONPTRS(closure) \
+ (IND_CLOSURE_SIZE(closure)-IND_CLOSURE_NoPTRS(closure)-IND_VHS)
\end{code}
Indirections must store a pointer to the closure which is the target
of the indirection:
\begin{code}
-#define IND_CLOSURE_PTR(closure) (((P_)(closure))[IND_HS])
-\end{code}
-
-\begin{code}
-#define IND_CLOSURE_LINK(closure) (((P_)(closure))[FIXED_HS])
+#define IND_CLOSURE_PTR(closure) (((P_)(closure))[IND_HS])
+#define IND_CLOSURE_LINK(closure) (((P_)(closure))[FIXED_HS])
\end{code}
-When we are profiling, we occasionally use ``permanent indirections'' to
-store cost centres associated in some way with PAPs. Don't ask me why.
-For now, a permanent indirection must have the same shape as a regular
-indirection. The only difference is that it is, well, permanent. That is
-to say, it is never short-circuited. (What is the point, anyway?)
+When we are profiling, we occasionally use ``permanent indirections''
+to store cost centres associated in some way with PAPs. Don't ask me
+why. For now, a permanent indirection must have the same shape as a
+regular indirection. The only difference is that it is, well,
+permanent. That is to say, it is never short-circuited. (What is the
+point, anyway?)
-Presumably, such objects could shrink as they moved into the old generation,
-but then their header size would change as well (the word that they get to
-lose is the VHS word of a standard indirection), and I just don't feel up
-to it today. --JSM.
+Presumably, such objects could shrink as they moved into the old
+generation, but then their header size would change as well (the word
+that they get to lose is the VHS word of a standard indirection), and
+I just don't feel up to it today. --JSM.
\begin{code}
-#ifdef USE_COST_CENTRES
-
-#define PERM_IND_CLOSURE_PTR(closure,dummy) IND_CLOSURE_PTR(closure)
+#if defined(PROFILING) || defined(TICKY_TICKY)
+#define PERM_IND_CLOSURE_PTR(closure,dummy) IND_CLOSURE_PTR(closure)
+ /* really *must* be the same as IND_CLOSURE_PTR; it is
+ merely a "two-argument" variant, to fit in with the
+ bizarre goings-on in SMmark.lhc and friends. WDP 95/12
+ */
#endif
\end{code}
@CAF@.
\begin{code}
-#define BH_HS (FIXED_HS)
-#define BH_VHS 0L
+#define BH_HS (FIXED_HS)
+#define BH_VHS 0L
+
+#define BH_U_SIZE MIN_UPD_SIZE
+#define BH_N_SIZE MIN_NONUPD_SIZE
#define BH_CLOSURE_SIZE(closure) ((W_)INFO_SIZE(INFO_PTR(closure)))
#define BH_CLOSURE_NoPTRS(closure) 0L
%************************************************************************
%* *
-\subsubsection[RBH-closures]{@RBH@ (revertable black hole) closure macros}
+\subsubsection[RBH-closures]{@RBH@ (revertible black hole) closure macros}
%* *
%************************************************************************
-There are two kinds of revertable black holes, produced from GEN or
+There are two kinds of revertible black holes, produced from GEN or
SPEC closures, respectively. There's no @SET_RBH_HDR@ macro -- use
-@TurnIntoRBH@ instead!!
+@convertToRBH@ instead!!
Note that the NoPTRS and NoNONPTRS macros refer to the *original* closure.
#define SPEC_RBH_CLOSURE_PTR(closure, no) (((P_)(closure))[SPEC_RBH_HS + (no) - 1])
#define SPEC_RBH_CLOSURE_SIZE(closure) ((W_)INFO_SIZE(REVERT_INFOPTR(INFO_PTR(closure))))
#define SPEC_RBH_CLOSURE_NoPTRS(closure) ((W_)INFO_NoPTRS(REVERT_INFOPTR(INFO_PTR(closure))))
-#define SPEC_RBH_CLOSURE_NoNONPTRS(closure) (SPEC_RBH_CLOSURE_SIZE(closure)-SPEC_RBH_CLOSURE_NoPTRS(closure)/*-SPEC_VHS*/)
+#define SPEC_RBH_CLOSURE_NoNONPTRS(closure) (SPEC_RBH_CLOSURE_SIZE(closure)-SPEC_RBH_CLOSURE_NoPTRS(closure))
#define SPEC_RBH_BQ_LOCN (SPEC_RBH_HS)
#define SPEC_RBH_BQ(closure) (((P_)(closure))[SPEC_RBH_BQ_LOCN])