wingo pushed a commit to branch wip-whippet
in repository guile.

commit 112f27b77b4f0c05c086b63e9b9f5e4868c708bb
Author: Andy Wingo <wi...@igalia.com>
AuthorDate: Tue Aug 16 15:57:27 2022 +0200

    Simplify GC attributes for the inline allocator
    
    Don't require pulling in all of gc-api.h.
---
 bdw-inline.h => bdw-attrs.h         |  8 ++++----
 bdw.h                               |  2 +-
 gc-api.h                            | 33 +--------------------------------
 semi-inline.h => semi-attrs.h       |  8 ++++----
 semi.h                              |  2 +-
 whippet-inline.h => whippet-attrs.h |  8 ++++----
 whippet.h                           |  2 +-
 7 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/bdw-inline.h b/bdw-attrs.h
similarity index 93%
rename from bdw-inline.h
rename to bdw-attrs.h
index 511c86d5f..5743cd3a2 100644
--- a/bdw-inline.h
+++ b/bdw-attrs.h
@@ -1,7 +1,7 @@
-#ifndef BDW_INLINE_H
-#define BDW_INLINE_H
+#ifndef BDW_ATTRS_H
+#define BDW_ATTRS_H
 
-#include "gc-api.h"
+#include "gc-attrs.h"
 
 static inline enum gc_allocator_kind gc_allocator_kind(void) {
   return GC_ALLOCATOR_INLINE_FREELIST;
@@ -49,4 +49,4 @@ static inline size_t gc_small_write_barrier_card_size(void) {
   abort();
 }
 
-#endif // BDW_INLINE_H
+#endif // BDW_ATTRS_H
diff --git a/bdw.h b/bdw.h
index 7731034ab..0af332090 100644
--- a/bdw.h
+++ b/bdw.h
@@ -1,7 +1,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "bdw-inline.h"
+#include "bdw-attrs.h"
 #include "conservative-roots.h"
 
 // When pthreads are used, let `libgc' know about it and redirect
diff --git a/gc-api.h b/gc-api.h
index da513f415..c7d332176 100644
--- a/gc-api.h
+++ b/gc-api.h
@@ -3,6 +3,7 @@
 
 #include "gc-config.h"
 #include "gc-assert.h"
+#include "gc-attrs.h"
 #include "gc-inline.h"
 #include "gc-ref.h"
 #include "gc-edge.h"
@@ -51,29 +52,6 @@ GC_API_ void* gc_call_without_gc(struct mutator *mut, void* 
(*f)(void*),
                                  void *data) GC_NEVER_INLINE;
 GC_API_ void gc_print_stats(struct heap *heap);
 
-enum gc_allocator_kind {
-  GC_ALLOCATOR_INLINE_BUMP_POINTER,
-  GC_ALLOCATOR_INLINE_FREELIST,
-  GC_ALLOCATOR_INLINE_NONE
-};
-
-static inline enum gc_allocator_kind gc_allocator_kind(void) GC_ALWAYS_INLINE;
-
-static inline size_t gc_allocator_large_threshold(void) GC_ALWAYS_INLINE;
-
-static inline size_t gc_allocator_small_granule_size(void) GC_ALWAYS_INLINE;
-
-static inline size_t gc_allocator_allocation_pointer_offset(void) 
GC_ALWAYS_INLINE;
-static inline size_t gc_allocator_allocation_limit_offset(void) 
GC_ALWAYS_INLINE;
-
-static inline size_t gc_allocator_freelist_offset(size_t size) 
GC_ALWAYS_INLINE;
-
-static inline size_t gc_allocator_alloc_table_alignment(void) GC_ALWAYS_INLINE;
-static inline uint8_t gc_allocator_alloc_table_begin_pattern(void) 
GC_ALWAYS_INLINE;
-static inline uint8_t gc_allocator_alloc_table_end_pattern(void) 
GC_ALWAYS_INLINE;
-
-static inline int gc_allocator_needs_clear(void) GC_ALWAYS_INLINE;
-
 static inline void gc_clear_fresh_allocation(struct gc_ref obj,
                                              size_t size) GC_ALWAYS_INLINE;
 static inline void gc_clear_fresh_allocation(struct gc_ref obj,
@@ -188,15 +166,6 @@ static inline void* gc_allocate(struct mutator *mut, 
size_t size) {
 // FIXME: remove :P
 static inline void* gc_allocate_pointerless(struct mutator *mut, size_t bytes);
 
-enum gc_write_barrier_kind {
-  GC_WRITE_BARRIER_NONE,
-  GC_WRITE_BARRIER_CARD
-};
-
-static inline enum gc_write_barrier_kind gc_small_write_barrier_kind(void);
-static inline size_t gc_small_write_barrier_card_table_alignment(void);
-static inline size_t gc_small_write_barrier_card_size(void);
-
 static inline void gc_small_write_barrier(struct gc_ref obj, struct gc_edge 
edge,
                                           struct gc_ref new_val) 
GC_ALWAYS_INLINE;
 static inline void gc_small_write_barrier(struct gc_ref obj, struct gc_edge 
edge,
diff --git a/semi-inline.h b/semi-attrs.h
similarity index 93%
rename from semi-inline.h
rename to semi-attrs.h
index 9a8342fd4..55691f047 100644
--- a/semi-inline.h
+++ b/semi-attrs.h
@@ -1,7 +1,7 @@
-#ifndef SEMI_INLINE_H
-#define SEMI_INLINE_H
+#ifndef SEMI_ATTRS_H
+#define SEMI_ATTRS_H
 
-#include "gc-api.h"
+#include "gc-attrs.h"
 
 static const uintptr_t GC_ALIGNMENT = 8;
 static const size_t GC_LARGE_OBJECT_THRESHOLD = 8192;
@@ -51,4 +51,4 @@ static inline size_t gc_small_write_barrier_card_size(void) {
   abort();
 }
 
-#endif // SEMI_INLINE_H
+#endif // SEMI_ATTRS_H
diff --git a/semi.h b/semi.h
index def7a607f..bc32eecb2 100644
--- a/semi.h
+++ b/semi.h
@@ -5,7 +5,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-#include "semi-inline.h"
+#include "semi-attrs.h"
 #include "large-object-space.h"
 #include "precise-roots.h"
 
diff --git a/whippet-inline.h b/whippet-attrs.h
similarity index 93%
rename from whippet-inline.h
rename to whippet-attrs.h
index b61724cfa..72915b1a1 100644
--- a/whippet-inline.h
+++ b/whippet-attrs.h
@@ -1,8 +1,8 @@
-#ifndef WHIPPET_INLINE_H
-#define WHIPPET_INLINE_H
+#ifndef WHIPPET_ATTRS_H
+#define WHIPPET_ATTRS_H
 
 #include "gc-config.h"
-#include "gc-api.h"
+#include "gc-attrs.h"
 
 static inline enum gc_allocator_kind gc_allocator_kind(void) {
   return GC_ALLOCATOR_INLINE_BUMP_POINTER;
@@ -53,4 +53,4 @@ static inline size_t gc_small_write_barrier_card_size(void) {
   return 256;
 }
 
-#endif // WHIPPET_INLINE_H
+#endif // WHIPPET_ATTRS_H
diff --git a/whippet.h b/whippet.h
index 4851c874d..654897b5c 100644
--- a/whippet.h
+++ b/whippet.h
@@ -25,7 +25,7 @@
 #include "serial-tracer.h"
 #endif
 #include "spin.h"
-#include "whippet-inline.h"
+#include "whippet-attrs.h"
 
 #define GRANULE_SIZE 16
 #define GRANULE_SIZE_LOG_2 4

Reply via email to