1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 19:20:23 +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

20
semi.h
View file

@ -4,10 +4,7 @@
#include <sys/mman.h>
#include <unistd.h>
struct handle {
void *v;
struct handle *next;
};
#include "precise-roots.h"
struct context {
uintptr_t hp;
@ -143,21 +140,6 @@ static inline void* allocate(struct context *cx, enum alloc_kind kind,
}
}
#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, &h.handle)
#define POP_HANDLE(cx, h) pop_handle(cx, &h.handle)
static inline void push_handle(struct context *cx, struct handle *handle) {
handle->next = cx->roots;
cx->roots = handle;
}
static inline void pop_handle(struct context *cx, struct handle *handle) {
cx->roots = handle->next;
}
static inline void init_field(void **addr, void *val) {
*addr = val;
}