From 13b3bb5b246b0a2325777deec9bee5ddc69251ac Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 31 Jul 2022 21:30:59 +0200 Subject: [PATCH] Update barrier functions to also have the object being written Also remove read barriers, as they were unused, and we have no plans to use them. --- bdw.h | 7 ++----- mt-gcbench.c | 8 ++++---- quads.c | 2 +- semi.h | 7 ++----- whippet.h | 7 ++----- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/bdw.h b/bdw.h index 0034b0561..69a147b56 100644 --- a/bdw.h +++ b/bdw.h @@ -103,15 +103,12 @@ static inline void collect(struct mutator *mut) { GC_gcollect(); } -static inline void init_field(void **addr, void *val) { +static inline void init_field(void *obj, void **addr, void *val) { *addr = val; } -static inline void set_field(void **addr, void *val) { +static inline void set_field(void *obj, void **addr, void *val) { *addr = val; } -static inline void* get_field(void **addr) { - return *addr; -} static inline struct mutator *add_mutator(struct heap *heap) { struct mutator *ret = GC_malloc(sizeof(struct mutator)); diff --git a/mt-gcbench.c b/mt-gcbench.c index 2af4c04c8..1819655fb 100644 --- a/mt-gcbench.c +++ b/mt-gcbench.c @@ -202,8 +202,8 @@ static void populate(struct thread *t, int depth, Node *node) { NodeHandle r = { allocate_node(mut) }; PUSH_HANDLE(mut, r); - set_field((void**)&HANDLE_REF(self)->left, HANDLE_REF(l)); - set_field((void**)&HANDLE_REF(self)->right, HANDLE_REF(r)); + set_field(HANDLE_REF(self), (void**)&HANDLE_REF(self)->left, HANDLE_REF(l)); + set_field(HANDLE_REF(self), (void**)&HANDLE_REF(self)->right, HANDLE_REF(r)); // i is 0 because the memory is zeroed. HANDLE_REF(self)->j = depth; @@ -228,8 +228,8 @@ static Node* make_tree(struct thread *t, int depth) { allocate_garbage(t); Node *result = allocate_node(mut); - init_field((void**)&result->left, HANDLE_REF(left)); - init_field((void**)&result->right, HANDLE_REF(right)); + init_field(result, (void**)&result->left, HANDLE_REF(left)); + init_field(result, (void**)&result->right, HANDLE_REF(right)); // i is 0 because the memory is zeroed. result->j = depth; diff --git a/quads.c b/quads.c index 0ba9ea3f4..9743b88a8 100644 --- a/quads.c +++ b/quads.c @@ -49,7 +49,7 @@ static Quad* make_tree(struct mutator *mut, int depth) { Quad *result = allocate_quad(mut); for (size_t i = 0; i < 4; i++) - init_field((void**)&result->kids[i], HANDLE_REF(kids[i])); + init_field(result, (void**)&result->kids[i], HANDLE_REF(kids[i])); for (size_t i = 0; i < 4; i++) POP_HANDLE(mut); diff --git a/semi.h b/semi.h index 6ed67de8b..ce3d938f1 100644 --- a/semi.h +++ b/semi.h @@ -255,15 +255,12 @@ static inline void* allocate_pointerless(struct mutator *mut, return allocate(mut, kind, size); } -static inline void init_field(void **addr, void *val) { +static inline void init_field(void *obj, void **addr, void *val) { *addr = val; } -static inline void set_field(void **addr, void *val) { +static inline void set_field(void *obj, void **addr, void *val) { *addr = val; } -static inline void* get_field(void **addr) { - return *addr; -} static int initialize_semi_space(struct semi_space *space, size_t size) { // Allocate even numbers of pages. diff --git a/whippet.h b/whippet.h index f2fd90985..146321e8c 100644 --- a/whippet.h +++ b/whippet.h @@ -1652,15 +1652,12 @@ static inline void* allocate_pointerless(struct mutator *mut, return allocate(mut, kind, size); } -static inline void init_field(void **addr, void *val) { +static inline void init_field(void *obj, void **addr, void *val) { *addr = val; } -static inline void set_field(void **addr, void *val) { +static inline void set_field(void *obj, void **addr, void *val) { *addr = val; } -static inline void* get_field(void **addr) { - return *addr; -} static struct slab* allocate_slabs(size_t nslabs) { size_t size = nslabs * SLAB_SIZE;