1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-28 05:50:30 +02:00

Simplify GC attributes for the inline allocator

Don't require pulling in all of gc-api.h.
This commit is contained in:
Andy Wingo 2022-08-16 15:57:27 +02:00
parent 8a111256c6
commit 112f27b77b
7 changed files with 16 additions and 47 deletions

View file

@ -1,7 +1,7 @@
#ifndef BDW_INLINE_H #ifndef BDW_ATTRS_H
#define BDW_INLINE_H #define BDW_ATTRS_H
#include "gc-api.h" #include "gc-attrs.h"
static inline enum gc_allocator_kind gc_allocator_kind(void) { static inline enum gc_allocator_kind gc_allocator_kind(void) {
return GC_ALLOCATOR_INLINE_FREELIST; return GC_ALLOCATOR_INLINE_FREELIST;
@ -49,4 +49,4 @@ static inline size_t gc_small_write_barrier_card_size(void) {
abort(); abort();
} }
#endif // BDW_INLINE_H #endif // BDW_ATTRS_H

2
bdw.h
View file

@ -1,7 +1,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "bdw-inline.h" #include "bdw-attrs.h"
#include "conservative-roots.h" #include "conservative-roots.h"
// When pthreads are used, let `libgc' know about it and redirect // When pthreads are used, let `libgc' know about it and redirect

View file

@ -3,6 +3,7 @@
#include "gc-config.h" #include "gc-config.h"
#include "gc-assert.h" #include "gc-assert.h"
#include "gc-attrs.h"
#include "gc-inline.h" #include "gc-inline.h"
#include "gc-ref.h" #include "gc-ref.h"
#include "gc-edge.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; void *data) GC_NEVER_INLINE;
GC_API_ void gc_print_stats(struct heap *heap); 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, static inline void gc_clear_fresh_allocation(struct gc_ref obj,
size_t size) GC_ALWAYS_INLINE; size_t size) GC_ALWAYS_INLINE;
static inline void gc_clear_fresh_allocation(struct gc_ref obj, 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 // FIXME: remove :P
static inline void* gc_allocate_pointerless(struct mutator *mut, size_t bytes); 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, static inline void gc_small_write_barrier(struct gc_ref obj, struct gc_edge edge,
struct gc_ref new_val) GC_ALWAYS_INLINE; struct gc_ref new_val) GC_ALWAYS_INLINE;
static inline void gc_small_write_barrier(struct gc_ref obj, struct gc_edge edge, static inline void gc_small_write_barrier(struct gc_ref obj, struct gc_edge edge,

View file

@ -1,7 +1,7 @@
#ifndef SEMI_INLINE_H #ifndef SEMI_ATTRS_H
#define SEMI_INLINE_H #define SEMI_ATTRS_H
#include "gc-api.h" #include "gc-attrs.h"
static const uintptr_t GC_ALIGNMENT = 8; static const uintptr_t GC_ALIGNMENT = 8;
static const size_t GC_LARGE_OBJECT_THRESHOLD = 8192; 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(); abort();
} }
#endif // SEMI_INLINE_H #endif // SEMI_ATTRS_H

2
semi.h
View file

@ -5,7 +5,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#include "semi-inline.h" #include "semi-attrs.h"
#include "large-object-space.h" #include "large-object-space.h"
#include "precise-roots.h" #include "precise-roots.h"

View file

@ -1,8 +1,8 @@
#ifndef WHIPPET_INLINE_H #ifndef WHIPPET_ATTRS_H
#define WHIPPET_INLINE_H #define WHIPPET_ATTRS_H
#include "gc-config.h" #include "gc-config.h"
#include "gc-api.h" #include "gc-attrs.h"
static inline enum gc_allocator_kind gc_allocator_kind(void) { static inline enum gc_allocator_kind gc_allocator_kind(void) {
return GC_ALLOCATOR_INLINE_BUMP_POINTER; return GC_ALLOCATOR_INLINE_BUMP_POINTER;
@ -53,4 +53,4 @@ static inline size_t gc_small_write_barrier_card_size(void) {
return 256; return 256;
} }
#endif // WHIPPET_INLINE_H #endif // WHIPPET_ATTRS_H

View file

@ -25,7 +25,7 @@
#include "serial-tracer.h" #include "serial-tracer.h"
#endif #endif
#include "spin.h" #include "spin.h"
#include "whippet-inline.h" #include "whippet-attrs.h"
#define GRANULE_SIZE 16 #define GRANULE_SIZE 16
#define GRANULE_SIZE_LOG_2 4 #define GRANULE_SIZE_LOG_2 4