1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-01 09:50:19 +02:00
Commit graph

21911 commits

Author SHA1 Message Date
Andy Wingo
aa73d31ded Inline "struct scm_frame" into tagged frame objects
This avoids an indirection and will make the tracer's job easier.

* libguile/frames.h (struct scm_vm_frame): New data type.
(scm_is_vm_frame):
(scm_vm_frame):
(scm_vm_frame_kind):
(scm_vm_frame_fp):
(scm_vm_frame_sp):
(scm_vm_frame_ip):
(scm_frame_init_from_vm_frame): New helpers.

* libguile/frames.c:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/vm.c: Update all users of SCM_VM_FRAME_* macros to use new
helpers.
2025-05-29 21:53:36 +02:00
Andy Wingo
75842cf215 Simplify struct scm_bignum
* libguile/integers.c (struct scm_bignum): Now that SCM_I_BIG_MPZ is
gone with other deprecated code, we can simplify the bignum
representation.  Adapt all users.
2025-05-28 11:22:29 +02:00
Andy Wingo
0a0ecc518b Arrange to pin objects captured by a delimited continuation
* libguile/vm.h (struct scm_vm_cont): Include the tag word, and put
flags there.  Rename stack bottom to stack slice and make a flexible
array.
(scm_is_vm_cont):
(scm_to_vm_cont):
(scm_from_vm_cont):
(scm_vm_cont_is_partial):
(scm_vm_cont_is_rewindable): New build-time helpers.

* libguile/continuations.c (scm_i_make_continuation):
(scm_i_continuation_to_frame):
(copy_stack_and_call):
* libguile/continuations.h (scm_t_contregs):
* libguile/frames.c (frame_stack_top):
* libguile/stacks.c (scm_make_stack): Adapt to take struct scm_vm_cont*
instead of SCM for continuations.

* libguile/vm.c (capture_stack): Adapt to scm_vm_cont change.  Use new
gc_resolve_conservative_ref API to pin conservative refs from the
captured stack.
(scm_i_vm_cont_to_frame):
(scm_i_capture_current_stack):
(reinstate_continuation_x):
(capture_continuation):
(compose_continuation):
(capture_delimited_continuation):
(abort_to_prompt): Adapt to type changes.
2025-05-27 16:02:01 +02:00
Andy Wingo
177643d416 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-27 15:50:57 +02:00
Andy Wingo
c49a372da7 Add gc_resolve_conservative_ref API 2025-05-27 15:50:28 +02:00
Andy Wingo
1abd5a310e Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-26 12:22:22 +02:00
Andy Wingo
d0337bf4fe Further fix inlining
I want to get the "possibly_interior" case to fold at compile-time.
2025-05-26 12:18:31 +02:00
Andy Wingo
a4c0f1e231 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-26 11:58:48 +02:00
Andy Wingo
f5e10eb7c9 mmc: Speed up conservative ref resolution 2025-05-26 11:58:29 +02:00
Andy Wingo
94f6c8ce6a mmc: Fix inlining of trace_conservative_edges for pinned roots 2025-05-26 11:56:34 +02:00
Andy Wingo
e84dccb710 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-26 10:34:54 +02:00
Andy Wingo
cc9eb16e92 Add heuristic to grow mmc heap if no progress in last mutator cycle 2025-05-26 10:34:03 +02:00
Andy Wingo
b3d874c804 Add JIT support for bump-pointer allocation fast paths
* libguile/jit.c (emit_update_alloc_table):
(emit_allocate_bytes_fast_bump_pointer): Add implementation.
(compile_allocate_words_immediate_with_kind):
(compile_allocate_words_immediate_slow_with_kind): New helpers.
(compile_allocate_words_immediate):
(compile_allocate_words_immediate_slow):
(compile_allocate_pointerless_words_immediate):
(compile_allocate_pointerless_words_immediate_slow): Use new helpers.
2025-05-24 21:45:25 +02:00
Andy Wingo
3147d313f9 Add Guile's CFLAGS to WHIPPET_IMPL_CFLAGS
* libguile/Makefile.am (WHIPPET_IMPL_CFLAGS): Add GCC_CFLAGS, to ensure
the same compilation options (notably -fwrapv), to prevent mismatches at
LTO-time.
2025-05-23 09:44:50 +02:00
Andy Wingo
5d94b78095 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-23 09:44:31 +02:00
Andy Wingo
285ca65472 Fix missing static annotation on root_worklist_alloc 2025-05-23 09:44:20 +02:00
Andy Wingo
8c4866cd5c Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-23 09:39:59 +02:00
Andy Wingo
f12399ef7d mmc: Only add headroom to unfragmentable heaps if no progress 2025-05-23 09:38:36 +02:00
Andy Wingo
140a412ecd Fix crash in gc_visit_ephemeron_key on objects in extern space 2025-05-23 09:38:02 +02:00
Andy Wingo
6841c9509a Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-22 16:24:47 +02:00
Andy Wingo
0a6767b3b9 Fix a bug in after-gc Scheme hook
* libguile/gc.c (scm_gc_event_listener_restarting_mutators): Avoid
running hook before Guile is booted.
2025-05-22 16:24:16 +02:00
Andy Wingo
2db9cfa918 nofl: Limit sweeping if there are empty blocks 2025-05-22 16:23:04 +02:00
Andy Wingo
6d5e7c9b60 Fix bof returning blocks from the evacuation target list to empties 2025-05-22 16:15:31 +02:00
Andy Wingo
1d157a133d mmc: Add "headroom" for growable heaps that cannot defragment 2025-05-22 14:57:34 +02:00
Andy Wingo
eab463bd6c nofl: Include pending large object allocations in the live data size 2025-05-22 14:57:02 +02:00
Andy Wingo
47ddd3dd5a nofl: No evacuation reserve if evacuation is impossible 2025-05-22 14:56:43 +02:00
Andy Wingo
7b4f4427f8 Update for Whippet changes, VM stacks scanned partly-conservatively
* libguile/trace.h (scm_from_ref, scm_to_ref): Helpers moved here;
update all callers.
* libguile/loader.c (scm_trace_loader_roots):
* libguile/threads.c (scm_trace_thread_roots):
* libguile/vm.c (scm_trace_vm_roots): Update for new
pinned-roots prototype.
* libguile/whippet-embedder.h (gc_extern_space_visit): Update for
Whippet API changes.
2025-05-21 14:31:23 +02:00
Andy Wingo
fb5a99c752 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-21 14:28:34 +02:00
Andy Wingo
41de2dfd91 Update conservative roots embedder interface 2025-05-21 14:27:17 +02:00
Andy Wingo
f12990bb64 Fix alignment for platform conservative roots visitor 2025-05-21 14:26:39 +02:00
Andy Wingo
eb5f9ff878 nofl: Add asserts when getting metadata for an object
The metadata byte should have a mark.
2025-05-21 14:20:53 +02:00
Andy Wingo
0277953efc gc_extern_space_visit doesn't take an edge
The whole extern space interface is a bit wonky but for now let's assume
that external objects can't move and therefore we don't need the edge.
2025-05-21 14:04:24 +02:00
Andy Wingo
8b9fe196a1 No need to clear allocation table during allocation
The mmc clears holes eagerly; there is no need to memset during
allocation.
2025-05-21 14:01:42 +02:00
Andy Wingo
72fbb05ee8 Fix Guile's whippet embedding for conservative roots tracing
* libguile/whippet-embedder.h (gc_extern_space_visit): Don't crash if
conservative tracing is enabled: these are already part of the root set.
2025-05-16 22:38:45 +02:00
Andy Wingo
0ffa6688aa Adapt to whippet change 2025-05-16 22:27:20 +02:00
Andy Wingo
a344c225c4 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-16 22:22:56 +02:00
Andy Wingo
b794e46635 mmc: Grow the heap if collection fails to find space for large alloc
For a pending large allocation, we will try to page out blocks from the
nofl space.  However sometimes we are not able to do so, especially if
evacuation is unavailable, as in a heap-conservative configuration.  In
that case, if the heap is growable, grow the heap after GC if there are
still bytes pending to page out.
2025-05-16 22:01:55 +02:00
Andy Wingo
fbcdffdc62 Fix bogus assert in mmc.c:deactivate_mutator 2025-05-16 22:01:15 +02:00
Andy Wingo
2018a77f36 Fix bogus static debug check in mmc init 2025-05-16 22:00:48 +02:00
Andy Wingo
e59fde2edf Fix build issue with mmc in Guile
For some reason we need to include gc-api with GC_IMPL already defined,
otherwise the attrs don't get picked up.
2025-05-16 22:00:02 +02:00
Andy Wingo
7010b4fce0 Fix --with-gc-debug in whippet.m4 2025-05-16 21:59:40 +02:00
Andy Wingo
9512c8b806 Simplify mmc-attrs.h 2025-05-16 21:59:27 +02:00
Andy Wingo
8a157bc616 Add allocation counter to prepare_gc event
Adapt all users
2025-05-16 21:59:07 +02:00
Andy Wingo
b96a22d3ea primitive-load after boot uses read-syntax
* module/ice-9/boot-9.scm (primitive-load): Define a version in Scheme
that uses read-syntax.  This allows the expander to be able to access
source locations.
2025-05-15 22:36:41 +02:00
Andy Wingo
ddef73d03f Remove the last direct uses of BDW API
* configure.ac: Remove code to detect BDW, that is taken care of by the
whippet macros.  Remove support for ia64, for the moment at least,
perhaps for good.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
Remove BDW cflags.
(modinclude_HEADERS): Remove bdw-gc.h.
* libguile/bdw-gc.h: Remove.
* libguile/fluids.c:
* libguile/hashtab.c:
* libguile/numbers.c:
* libguile/smob.c:
* libguile/srfi-4.c:
* libguile/struct.c:
* libguile/vectors.c:
* libguile/vm.c: Remove bdw-gc.h includes.
* meta/guile-4.0-uninstalled.pc.in (Libs):
* meta/guile-4.0.pc.in (Libs): Remove direct dependency on BDW-GC, as it
is all encapsulated through Whippet, which is not publically exposed.
2025-05-15 16:13:18 +02:00
Andy Wingo
c9df342c9a Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-15 15:56:48 +02:00
Andy Wingo
f5edbc278b Add warn proc to bdw 2025-05-15 15:56:40 +02:00
Andy Wingo
f71775f396 Remove BDW usage from gc.c
* libguile/atomics-internal.h (scm_atomic_subtract_size): New helper.
* libguile/gc.c (scm_gc_register_allocation): Rework to use atomics.
(scm_gc_event_listener_restarting_mutators): Reset the
off_heap_allocation_countdown to the heap size after GC.
(scm_gc_disable, scm_gc_enable): Remove these.  Unclear what they mean
exactly!  Perhaps if there is a meaning we can look at it later.
(scm_i_gc):
(scm_storage_prehistory):
(scm_init_gc): Update.
2025-05-15 15:56:03 +02:00
Andy Wingo
d560676572 Wire loader DT_GUILE_GC_ROOT sections to Whippet API
* libguile/loader.c (add_roots):
(scm_trace_loader_conservative_roots):
(process_dynamic_segment): Use Whippet API to register roots.
* libguile/trace.h (struct gc_heap_roots): Define here.
* libguile/whippet-embedder.h (gc_trace_mutator_conservative_roots):
(gc_trace_heap_conservative_roots): Add definitions.
2025-05-15 15:15:28 +02:00
Andy Wingo
b97b12a19b Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-05-15 14:47:07 +02:00