File: foreach.h

package info (click to toggle)
mlton 20130715-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 60,900 kB
  • ctags: 69,386
  • sloc: xml: 34,418; ansic: 17,399; lisp: 2,879; makefile: 1,605; sh: 1,254; pascal: 256; python: 143; asm: 97
file content (51 lines) | stat: -rw-r--r-- 2,001 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
 *    Jagannathan, and Stephen Weeks.
 * Copyright (C) 1997-2000 NEC Research Institute.
 *
 * MLton is released under a BSD-style license.
 * See the file MLton-LICENSE for details.
 */

#if (defined (MLTON_GC_INTERNAL_FUNCS))

typedef void (*GC_foreachObjptrFun) (GC_state s, objptr *opp);

static inline void callIfIsObjptr (GC_state s, GC_foreachObjptrFun f, objptr *opp);
/* foreachGlobalObjptr (s, f)
 * 
 * Apply f to each global object pointer into the heap. 
 */
static inline void foreachGlobalObjptr (GC_state s, GC_foreachObjptrFun f);
/* foreachObjptrInObject (s, p, skipWeaks, f) 
 * 
 * Applies f to each object pointer in the object pointed to by p.
 * Returns pointer to the end of object, i.e. just past object.
 *
 * If skipWeaks, then the object pointer in weak objects is skipped.
 */
static inline pointer foreachObjptrInObject (GC_state s, pointer p,
                                             GC_foreachObjptrFun f, bool skipWeaks);
/* foreachObjptrInRange (s, front, back, f, skipWeaks)
 *
 * Apply f to each pointer between front and *back, which should be a
 * contiguous sequence of objects, where front points at the beginning
 * of the first object and *back points just past the end of the last
 * object.  f may increase *back (for example, this is done by
 * forward).  foreachObjptrInRange returns a pointer to the end of
 * the last object it visits.
 *
 * If skipWeaks, then the object pointer in weak objects is skipped.
 */
static inline pointer foreachObjptrInRange (GC_state s, pointer front, pointer *back,
                                            GC_foreachObjptrFun f, bool skipWeaks);


typedef void (*GC_foreachStackFrameFun) (GC_state s, GC_frameIndex i);

/* foreachStackFrame (s, f);
 *
 * Apply f to the frame index of each frame in the current stack.
 */
static inline void foreachStackFrame (GC_state s, GC_foreachStackFrameFun f);

#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */