1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 22:40:34 +02:00

Add gc_edge_address

This commit is contained in:
Andy Wingo 2024-10-04 13:49:27 +02:00
parent 1a79c3a451
commit 3c8c956f4c
3 changed files with 7 additions and 4 deletions

View file

@ -16,6 +16,9 @@ static inline struct gc_ref gc_edge_ref(struct gc_edge edge) {
static inline struct gc_ref* gc_edge_loc(struct gc_edge edge) {
return edge.dst;
}
static inline uintptr_t gc_edge_address(struct gc_edge edge) {
return (uintptr_t)gc_edge_loc(edge);
}
static inline void gc_edge_update(struct gc_edge edge, struct gc_ref ref) {
*edge.dst = ref;
}

View file

@ -152,7 +152,7 @@ static int large_object_space_remember_edge(struct large_object_space *space,
struct gc_ref obj,
struct gc_edge edge) {
int remembered = 0;
uintptr_t edge_addr = (uintptr_t)gc_edge_loc(edge);
uintptr_t edge_addr = gc_edge_address(edge);
pthread_mutex_lock(&space->lock);
if (large_object_space_is_survivor_with_lock(space, obj)
&& !address_set_contains(&space->remembered_edges, edge_addr)) {

View file

@ -925,7 +925,7 @@ nofl_space_contains(struct nofl_space *space, struct gc_ref ref) {
static inline int
nofl_space_contains_edge(struct nofl_space *space, struct gc_edge edge) {
return nofl_space_contains_address(space, (uintptr_t)gc_edge_loc(edge));
return nofl_space_contains_address(space, gc_edge_address(edge));
}
static inline int
@ -939,13 +939,13 @@ nofl_space_is_survivor(struct nofl_space *space, struct gc_ref ref) {
static uint8_t*
nofl_field_logged_byte(struct gc_edge edge) {
return nofl_metadata_byte_for_addr((uintptr_t)gc_edge_loc(edge));
return nofl_metadata_byte_for_addr(gc_edge_address(edge));
}
static uint8_t
nofl_field_logged_bit(struct gc_edge edge) {
GC_ASSERT_EQ(sizeof(uintptr_t) * 2, NOFL_GRANULE_SIZE);
size_t field = ((uintptr_t)gc_edge_loc(edge)) / sizeof(uintptr_t);
size_t field = gc_edge_address(edge) / sizeof(uintptr_t);
return NOFL_METADATA_BYTE_LOGGED_0 << (field % 2);
}