1 /* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
9 #if (defined (MLTON_GC_INTERNAL_FUNCS))
11 typedef void (*GC_foreachObjptrFun
) (GC_state s
, objptr
*opp
);
13 static inline void callIfIsObjptr (GC_state s
, GC_foreachObjptrFun f
, objptr
*opp
);
14 /* foreachGlobalObjptr (s, f)
16 * Apply f to each global object pointer into the heap.
18 static inline void foreachGlobalObjptr (GC_state s
, GC_foreachObjptrFun f
);
19 /* foreachObjptrInObject (s, p, skipWeaks, f)
21 * Applies f to each object pointer in the object pointed to by p.
22 * Returns pointer to the end of object, i.e. just past object.
24 * If skipWeaks, then the object pointer in weak objects is skipped.
26 static inline pointer
foreachObjptrInObject (GC_state s
, pointer p
,
27 GC_foreachObjptrFun f
, bool skipWeaks
);
28 /* foreachObjptrInRange (s, front, back, f, skipWeaks)
30 * Apply f to each pointer between front and *back, which should be a
31 * contiguous sequence of objects, where front points at the beginning
32 * of the first object and *back points just past the end of the last
33 * object. f may increase *back (for example, this is done by
34 * forward). foreachObjptrInRange returns a pointer to the end of
35 * the last object it visits.
37 * If skipWeaks, then the object pointer in weak objects is skipped.
39 static inline pointer
foreachObjptrInRange (GC_state s
, pointer front
, pointer
*back
,
40 GC_foreachObjptrFun f
, bool skipWeaks
);
43 typedef void (*GC_foreachStackFrameFun
) (GC_state s
, GC_frameIndex i
);
45 /* foreachStackFrame (s, f);
47 * Apply f to the frame index of each frame in the current stack.
49 static inline void foreachStackFrame (GC_state s
, GC_foreachStackFrameFun f
);
51 #endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */