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

Switch to use Whippet allocation fast paths

* libguile/Makefile.am (noinst_HEADERS, modinclude_HEADERS): Move
gc-inline.h to be a private header.
* libguile/gc-inline.h (scm_inline_gc_malloc_pointerless):
(scm_inline_gc_malloc): Use gc_allocate.
* libguile/intrinsics.c (allocate_words_with_freelist):
(allocate_pointerless_words_with_freelist): Remove these intrinsics.
Renumbers the intrinsics.
(scm_bootstrap_intrinsics):
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Adapt to intrinsics
change.
* libguile/jit.c (emit_update_alloc_table):
(emit_allocate_bytes_fast_freelist):
(emit_allocate_words_slow): New helpers.
(compile_allocate_words):
(compile_allocate_words_immediate):
(compile_allocate_words_immediate_slow):
(compile_allocate_pointerless_words):
(compile_allocate_pointerless_words_immediate):
(compile_allocate_pointerless_words_immediate_slow): Use new helpers.
* libguile/threads.c (scm_trace_thread_mutator_roots):
(on_thread_exit):
* libguile/threads.h: Remove Guile-managed thread-local freelists.
This commit is contained in:
Andy Wingo 2025-04-22 13:44:44 +02:00
parent 7696344634
commit 0532602cd3
7 changed files with 93 additions and 185 deletions

View file

@ -1,4 +1,4 @@
/* Copyright 2018-2021, 2023
/* Copyright 2018-2021, 2023, 2025
Free Software Foundation, Inc.
This file is part of Guile.
@ -466,30 +466,12 @@ allocate_words (scm_thread *thread, size_t n)
return SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, n));
}
static SCM
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));
}
static SCM
allocate_pointerless_words (scm_thread *thread, size_t n)
{
return SCM_PACK_POINTER (scm_inline_gc_malloc_pointerless_words (thread, n));
}
static SCM
allocate_pointerless_words_with_freelist (scm_thread *thread, size_t freelist_idx)
{
return SCM_PACK_POINTER
(scm_inline_gc_alloc (&thread->pointerless_freelists[freelist_idx],
freelist_idx,
SCM_INLINE_GC_KIND_POINTERLESS));
}
static SCM
current_module (scm_thread *thread)
{
@ -641,7 +623,6 @@ scm_bootstrap_intrinsics (void)
scm_vm_intrinsics.allocate_words = allocate_words;
scm_vm_intrinsics.current_module = current_module;
scm_vm_intrinsics.push_prompt = push_prompt;
scm_vm_intrinsics.allocate_words_with_freelist = allocate_words_with_freelist;
scm_vm_intrinsics.abs = scm_abs;
scm_vm_intrinsics.sqrt = scm_sqrt;
scm_vm_intrinsics.fabs = fabs;
@ -665,8 +646,6 @@ scm_bootstrap_intrinsics (void)
scm_vm_intrinsics.fatan = atan;
scm_vm_intrinsics.fatan2 = atan2;
scm_vm_intrinsics.allocate_pointerless_words = allocate_pointerless_words;
scm_vm_intrinsics.allocate_pointerless_words_with_freelist =
allocate_pointerless_words_with_freelist;
scm_vm_intrinsics.inexact = scm_exact_to_inexact;
scm_vm_intrinsics.string_to_utf8 = scm_string_to_utf8;
scm_vm_intrinsics.string_utf8_length = INT64_INTRINSIC (string_utf8_length);