From 50371bc6ed038a6c005dcac405a07e01f2c7c56b Mon Sep 17 00:00:00 2001 From: Michael Gran Date: Tue, 20 Jun 2023 18:08:52 -0700 Subject: [PATCH] Replace SCM_INLINE_GC_KIND_* enums with libgc's GC_I_* defines Guile has an enum scm_inline_gc_kind used to replace GC constants that were private. Those defines were made public in 2015, so it is should be safe to use them now. Replace SCM_INLINE_GC_KIND_POINTERLESS with GC_I_PTRFREE. Replace SCM_INLINE_GC_KIND_NORMAL with GC_I_NORMAL. * libguile/gc-inline.h (scm_inline_gc_kind): remove type (scm_inline_gc_alloc): kind argument is now int (scm_inline_gc_malloc_pointerless): use GC_I_PTRFREE (scm_inline_gc_malloc): use GC_I_NORMAL * libguile/intrinsics.c (allocate_words_with_freelist): use GC_I_NORMAL (allocate_pointerless_words): use GC_I_PTRFREE --- libguile/gc-inline.h | 15 +++------------ libguile/intrinsics.c | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/libguile/gc-inline.h b/libguile/gc-inline.h index cb55aa86a..38915dbff 100644 --- a/libguile/gc-inline.h +++ b/libguile/gc-inline.h @@ -59,17 +59,8 @@ scm_inline_gc_freelist_object_size (size_t idx) return (idx + 1U) * SCM_INLINE_GC_GRANULE_BYTES; } -/* The values of these must match the internal POINTERLESS and NORMAL - definitions in libgc, for which unfortunately there are no external - definitions. Alack. */ -typedef enum scm_inline_gc_kind - { - SCM_INLINE_GC_KIND_POINTERLESS, - SCM_INLINE_GC_KIND_NORMAL - } scm_inline_gc_kind; - static inline void * -scm_inline_gc_alloc (void **freelist, size_t idx, scm_inline_gc_kind kind) +scm_inline_gc_alloc (void **freelist, size_t idx, int kind) { void *head = *freelist; @@ -96,7 +87,7 @@ scm_inline_gc_malloc_pointerless (scm_thread *thread, size_t bytes) return GC_malloc_atomic (bytes); return scm_inline_gc_alloc - (&thread->pointerless_freelists[idx], idx, SCM_INLINE_GC_KIND_POINTERLESS); + (&thread->pointerless_freelists[idx], idx, GC_I_PTRFREE); } static inline void * @@ -108,7 +99,7 @@ scm_inline_gc_malloc (scm_thread *thread, size_t bytes) return GC_malloc (bytes); return scm_inline_gc_alloc - (&thread->freelists[idx], idx, SCM_INLINE_GC_KIND_NORMAL); + (&thread->freelists[idx], idx, GC_I_NORMAL); } static inline void * diff --git a/libguile/intrinsics.c b/libguile/intrinsics.c index 99c044cbd..ad937420d 100644 --- a/libguile/intrinsics.c +++ b/libguile/intrinsics.c @@ -472,7 +472,7 @@ allocate_words_with_freelist (scm_thread *thread, size_t freelist_idx) return SCM_PACK_POINTER (scm_inline_gc_alloc (&thread->freelists[freelist_idx], freelist_idx, - SCM_INLINE_GC_KIND_NORMAL)); + GC_I_NORMAL)); } static SCM @@ -487,7 +487,7 @@ allocate_pointerless_words_with_freelist (scm_thread *thread, size_t freelist_id return SCM_PACK_POINTER (scm_inline_gc_alloc (&thread->pointerless_freelists[freelist_idx], freelist_idx, - SCM_INLINE_GC_KIND_POINTERLESS)); + GC_I_PTRFREE)); } static SCM