5
* GC macros, shared between ggc.c and hipe_${ARCH}_stack.c.
10
/* See erl_debug.h for information about verbose levels */
11
/* GC_HEAP_TRACE is deprecated! Use different verbose levels instead */
12
/* GC_SWITCH_TRACE is deprecated! It was unused... */
13
/* OLD_HEAP_CREATION_TRACE is deprecated! Use different verbose levels instead */
16
#define MY_IS_MOVED(x) (!is_header((x)))
18
#define MOVE_CONS(PTR,CAR,HTOP,ORIG) \
22
HTOP[0] = CAR; /* copy car */ \
23
HTOP[1] = PTR[1]; /* copy cdr */ \
24
gval = make_list(HTOP); /* new location */ \
25
*ORIG = gval; /* redirect original reference */ \
26
PTR[0] = THE_NON_VALUE; /* store forwarding indicator */ \
27
PTR[1] = gval; /* store forwarding address */ \
28
HTOP += 2; /* update tospace htop */ \
31
#define MOVE_BOXED(PTR,HDR,HTOP,ORIG) \
36
ASSERT(is_header(HDR)); \
37
gval = make_boxed(HTOP); \
41
nelts = header_arity(HDR); \
42
switch ((HDR) & _HEADER_SUBTAG_MASK) { \
43
case SUB_BINARY_SUBTAG: nelts++; break; \
44
case FUN_SUBTAG: nelts+=((ErlFunThing*)(PTR-1))->num_free+1; break; \
50
#define ptr_within(ptr, low, high) ((ptr) < (high) && (ptr) >= (low))
52
/* efficient range check */
53
#define in_area(ptr,start,nbytes) ((unsigned long)((char*)(ptr) - (char*)(start)) < (nbytes))
56
extern int within(Eterm*, Process*);
58
# define within(x,y) 1
59
#endif /* HARDDEBUG */
62
* This structure describes the rootset for the GC.
65
Eterm* v[11]; /* Pointers to vectors with terms to GC
68
Uint sz[11]; /* Size of each vector. */
69
Eterm* v_msg; /* Pointer to messages to GC. */
70
Eterm def_msg[32]; /* Default storage for messages (to avoid malloc). */
74
Process *p; /* For scanning the nstack. */
81
extern char ma_gc_flags;
83
/* Tell the GC to look at all processes. This flag i s set in the
84
* beginning of a major collection, and cleared at the end of minor
85
* collections. This makes the GC look at all processes in the major
86
* collection and the following minor, which is needed since there is
87
* no old generation after a major collection.
89
#define GC_INCLUDE_ALL 0x01
91
/* To let functions shared by local and global GC know this is a global GC */
92
#define GC_GLOBAL 0x02
94
/* In IncNMGC, to indicate that a GC-cycle is in progress */
97
/* In IncNMGC, to indicate that the next GC cycle will be a major one */
98
#define GC_NEED_MAJOR 0x08
100
/* In IncNMGC, to indicate that the current GC cycle is a major one */
101
#define GC_MAJOR 0x10
103
/* In IncNMGC, to indicate that the last call to the collector
104
* initiated a new collection cycle.
106
* This flag is only for communication with copy_stuct_lazy. copy_stuct_lazy
107
* will clear this flag after a copy is done.
109
#define GC_CYCLE_START 0x20
113
/* These functions are used by nmgc too. */
114
int setup_rootset(Process *p, Eterm *objv, int nobj, Rootset *rootset);
115
Uint collect_roots(Process* current, Eterm *objv, int nobj, Rootset rootset[]);
116
void restore_rootset(Process *p, Rootset *rootset);
118
void restore_one_rootset(Process *p, Rootset *rootset);
121
#endif /* __GGC_H__ */