1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-13 09:10:26 +02:00

Refactor handling of precise and conservative roots

This commit is contained in:
Andy Wingo 2022-03-04 15:27:22 +01:00
parent 2a619ba67d
commit 283721b39a
5 changed files with 31 additions and 37 deletions

19
precise-roots.h Normal file
View file

@ -0,0 +1,19 @@
struct handle {
void *v;
struct handle *next;
};
#define HANDLE_TO(T) union { T* v; struct handle handle; }
#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, &h.handle)
#define POP_HANDLE(cx, h) pop_handle(&cx->roots, &h.handle)
static inline void push_handle(struct handle **roots, struct handle *handle) {
handle->next = *roots;
*roots = handle;
}
static inline void pop_handle(struct handle **roots, struct handle *handle) {
*roots = handle->next;
}