blob: d94397adf8a7969ded8fca6a81ab49e6da99d480 (
plain)
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
|
#ifndef SIMPLE_ROOTS_API_H
#define SIMPLE_ROOTS_API_H
#include "gc-config.h"
#include "simple-roots-types.h"
#define HANDLE_TO(T) union { T* v; struct handle handle; }
#define HANDLE_LOC(h) &(h).v
#define HANDLE_REF(h) (h).v
#define HANDLE_SET(h,val) do { (h).v = val; } while (0)
#define PUSH_HANDLE(cx, h) push_handle(&(cx)->roots.roots, &h.handle)
#define POP_HANDLE(cx) pop_handle(&(cx)->roots.roots)
static inline void push_handle(struct handle **roots, struct handle *handle) {
if (GC_PRECISE_ROOTS) {
handle->next = *roots;
*roots = handle;
}
}
static inline void pop_handle(struct handle **roots) {
if (GC_PRECISE_ROOTS)
*roots = (*roots)->next;
}
#endif // SIMPLE_ROOTS_API_H
|