From 86baf260cca95bf71ccf6e9dcd317b50124e229f Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 1 Jul 2025 13:09:46 +0200 Subject: [PATCH] Move inline function decls to their impl headers --- api/gc-allocate.h | 23 ++++++++++++++++++++ api/gc-api.h | 53 ---------------------------------------------- api/gc-barrier.h | 19 +++++++++++++++++ api/gc-inline.h | 2 +- api/gc-safepoint.h | 11 ++++++++++ 5 files changed, 54 insertions(+), 54 deletions(-) diff --git a/api/gc-allocate.h b/api/gc-allocate.h index ba04b74d4..f6c76ebc5 100644 --- a/api/gc-allocate.h +++ b/api/gc-allocate.h @@ -6,6 +6,29 @@ struct gc_heap; struct gc_mutator; +static inline void gc_update_alloc_table(struct gc_ref obj, size_t size, + enum gc_allocation_kind kind) GC_ALWAYS_INLINE; + +GC_API_ void* gc_allocate_slow(struct gc_mutator *mut, size_t bytes, + enum gc_allocation_kind kind) GC_NEVER_INLINE; + +static inline void* +gc_allocate_small_fast_bump_pointer(struct gc_mutator *mut, size_t size, + enum gc_allocation_kind kind) GC_ALWAYS_INLINE; + +static inline void* gc_allocate_small_fast_freelist(struct gc_mutator *mut, + size_t size, + enum gc_allocation_kind kind) GC_ALWAYS_INLINE; + +static inline void* gc_allocate_small_fast(struct gc_mutator *mut, size_t size, + enum gc_allocation_kind kind) GC_ALWAYS_INLINE; + +static inline void* gc_allocate_fast(struct gc_mutator *mut, size_t size, + enum gc_allocation_kind kind) GC_ALWAYS_INLINE; + +static inline void* gc_allocate(struct gc_mutator *mut, size_t size, + enum gc_allocation_kind kind) GC_ALWAYS_INLINE; + static inline void gc_update_alloc_table(struct gc_ref obj, size_t size, enum gc_allocation_kind kind) { size_t alignment = gc_allocator_alloc_table_alignment(); diff --git a/api/gc-api.h b/api/gc-api.h index 809a01751..484cab89b 100644 --- a/api/gc-api.h +++ b/api/gc-api.h @@ -68,62 +68,9 @@ GC_API_ void gc_collect(struct gc_mutator *mut, GC_API_ int gc_heap_contains(struct gc_heap *heap, struct gc_ref ref); -static inline void gc_update_alloc_table(struct gc_ref obj, size_t size, - enum gc_allocation_kind kind) GC_ALWAYS_INLINE; - -GC_API_ void* gc_allocate_slow(struct gc_mutator *mut, size_t bytes, - enum gc_allocation_kind kind) GC_NEVER_INLINE; - -static inline void* -gc_allocate_small_fast_bump_pointer(struct gc_mutator *mut, size_t size, - enum gc_allocation_kind kind) GC_ALWAYS_INLINE; - -static inline void* gc_allocate_small_fast_freelist(struct gc_mutator *mut, - size_t size, - enum gc_allocation_kind kind) GC_ALWAYS_INLINE; - -static inline void* gc_allocate_small_fast(struct gc_mutator *mut, size_t size, - enum gc_allocation_kind kind) GC_ALWAYS_INLINE; - -static inline void* gc_allocate_fast(struct gc_mutator *mut, size_t size, - enum gc_allocation_kind kind) GC_ALWAYS_INLINE; - -static inline void* gc_allocate(struct gc_mutator *mut, size_t size, - enum gc_allocation_kind kind) GC_ALWAYS_INLINE; - -GC_API_ int gc_object_is_old_generation_slow(struct gc_mutator *mut, - struct gc_ref obj) GC_NEVER_INLINE; - -static inline int gc_object_is_old_generation(struct gc_mutator *mut, - struct gc_ref obj, - size_t obj_size) GC_ALWAYS_INLINE; - -GC_API_ void gc_write_barrier_slow(struct gc_mutator *mut, struct gc_ref obj, - size_t obj_size, struct gc_edge edge, - struct gc_ref new_val) GC_NEVER_INLINE; - -static inline int gc_write_barrier_fast(struct gc_mutator *mut, struct gc_ref obj, - size_t obj_size, struct gc_edge edge, - struct gc_ref new_val) GC_ALWAYS_INLINE; - -static inline void gc_write_barrier(struct gc_mutator *mut, struct gc_ref obj, - size_t obj_size, struct gc_edge edge, - struct gc_ref new_val) GC_ALWAYS_INLINE; - GC_API_ struct gc_ref gc_resolve_conservative_ref(struct gc_heap *heap, struct gc_conservative_ref ref, int possibly_interior); GC_API_ void gc_pin_object(struct gc_mutator *mut, struct gc_ref obj); -GC_API_ void gc_safepoint_slow(struct gc_mutator *mut) GC_NEVER_INLINE; -GC_API_ int* gc_safepoint_flag_loc(struct gc_mutator *mut); -static inline void gc_safepoint(struct gc_mutator *mut) GC_ALWAYS_INLINE; - -GC_API_ int gc_safepoint_signal_number(void); -GC_API_ void gc_safepoint_signal_inhibit(struct gc_mutator *mut); -GC_API_ void gc_safepoint_signal_reallow(struct gc_mutator *mut); - -static inline void gc_inhibit_preemption(struct gc_mutator *mut) GC_ALWAYS_INLINE; -static inline void gc_reallow_preemption(struct gc_mutator *mut) GC_ALWAYS_INLINE; - #endif // GC_API_H_ diff --git a/api/gc-barrier.h b/api/gc-barrier.h index a1ff2c196..9995793ed 100644 --- a/api/gc-barrier.h +++ b/api/gc-barrier.h @@ -3,6 +3,25 @@ #include "gc-api.h" +GC_API_ int gc_object_is_old_generation_slow(struct gc_mutator *mut, + struct gc_ref obj) GC_NEVER_INLINE; + +static inline int gc_object_is_old_generation(struct gc_mutator *mut, + struct gc_ref obj, + size_t obj_size) GC_ALWAYS_INLINE; + +GC_API_ void gc_write_barrier_slow(struct gc_mutator *mut, struct gc_ref obj, + size_t obj_size, struct gc_edge edge, + struct gc_ref new_val) GC_NEVER_INLINE; + +static inline int gc_write_barrier_fast(struct gc_mutator *mut, struct gc_ref obj, + size_t obj_size, struct gc_edge edge, + struct gc_ref new_val) GC_ALWAYS_INLINE; + +static inline void gc_write_barrier(struct gc_mutator *mut, struct gc_ref obj, + size_t obj_size, struct gc_edge edge, + struct gc_ref new_val) GC_ALWAYS_INLINE; + static inline int gc_object_is_old_generation(struct gc_mutator *mut, struct gc_ref obj, size_t obj_size) { diff --git a/api/gc-inline.h b/api/gc-inline.h index eba8c66c7..30eac54f3 100644 --- a/api/gc-inline.h +++ b/api/gc-inline.h @@ -1,7 +1,7 @@ #ifndef GC_INLINE_H_ #define GC_INLINE_H_ -#define GC_ALWAYS_INLINE __attribute__((always_inline)) __attribute__((unused)) +#define GC_ALWAYS_INLINE __attribute__((always_inline)) #define GC_NEVER_INLINE __attribute__((noinline)) #endif // GC_INLINE_H_ diff --git a/api/gc-safepoint.h b/api/gc-safepoint.h index 41b666375..c0e24b285 100644 --- a/api/gc-safepoint.h +++ b/api/gc-safepoint.h @@ -3,6 +3,17 @@ #include "gc-api.h" +GC_API_ void gc_safepoint_slow(struct gc_mutator *mut) GC_NEVER_INLINE; +GC_API_ int* gc_safepoint_flag_loc(struct gc_mutator *mut); +static inline void gc_safepoint(struct gc_mutator *mut) GC_ALWAYS_INLINE; + +GC_API_ int gc_safepoint_signal_number(void); +GC_API_ void gc_safepoint_signal_inhibit(struct gc_mutator *mut); +GC_API_ void gc_safepoint_signal_reallow(struct gc_mutator *mut); + +static inline void gc_inhibit_preemption(struct gc_mutator *mut) GC_ALWAYS_INLINE; +static inline void gc_reallow_preemption(struct gc_mutator *mut) GC_ALWAYS_INLINE; + static inline int gc_should_stop_for_safepoint(struct gc_mutator *mut) { switch (gc_cooperative_safepoint_kind()) { case GC_COOPERATIVE_SAFEPOINT_NONE: