1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

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
This commit is contained in:
Michael Gran 2023-06-20 18:08:52 -07:00
parent c214a15e47
commit 50371bc6ed
2 changed files with 5 additions and 14 deletions

View file

@ -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 *

View file

@ -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