1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-10 03:10:25 +02:00
Commit graph

9814 commits

Author SHA1 Message Date
Andy Wingo
ddab1dce3f Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-07 16:39:55 +02:00
Andy Wingo
d97985c92c Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-06 10:21:28 +02:00
Andy Wingo
1ef26268ba Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-04 10:29:52 +02:00
Andy Wingo
dbfaf2046c Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-04 09:40:54 +02:00
Andy Wingo
718c914e7b Fix evacuation of bytevectors with inline storage
* libguile/bytevectors.c (make_bytevector): We were allocating these as
tagged pointerless, which means that the trace function wasn't being
called; whereas, it was necessary in the case of a relocation.  Instead,
allocate tagged if the collector supports object motion.
2025-07-04 09:24:05 +02:00
Andy Wingo
39afb3bc1d Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-03 21:56:43 +02:00
Andy Wingo
9d8213889b Fix stringbuf error when trying to narrow stringbuf
* libguile/strings.c (try_narrow_stringbuf): Fix range check
2025-07-03 15:50:44 +02:00
Andy Wingo
61f835bbad Reorder thread tracer to match member order
* libguile/trace.h (scm_trace_thread): Reorder.
2025-07-03 15:50:19 +02:00
Andy Wingo
2c57ed393a Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-03 15:50:04 +02:00
Andy Wingo
d9fde2df29 Remove check in scm_trace_edge_conservatively that dst is heap obj
* libguile/trace.h (scm_trace_edge_conservatively):
gc_resolve_conservative_ref will handle all the cases.
2025-07-03 13:00:45 +02:00
Andy Wingo
9dbc673778 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-03 10:22:30 +02:00
Andy Wingo
5ef7dd088f Small refactor to whippet embedder
* libguile/whippet-embedder.h (gc_atomic_forward_retry_busy): Use
scm_tc3_mask instead of 7.
2025-07-03 10:11:25 +02:00
Andy Wingo
8623e252bf Separate tagged and untagged pointerless allocations
Tagged allocations can move; untagged allocations cannot.

* libguile/gc-inline.h:
* libguile/gc-malloc.c:
* libguile/gc.h: Split scm_allocate_pointerless into tagged and untagged
variants.
* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/integers.c:
* libguile/intrinsics.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/numbers.c:
* libguile/programs.h:
* libguile/random.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/smob.c:
* libguile/strings.c:
* libguile/vm.c: Use the new functions.
2025-07-03 10:10:20 +02:00
Andy Wingo
e21aa9c513 Fix length when tracing stringbufs 2025-07-02 22:05:40 +02:00
Andy Wingo
75f1f20031 Refactor relationship between gc_mutator_roots and threads
* libguile/threads.c (guilify_self_1):
* libguile/whippet-embedder.h (gc_trace_mutator_pinned_roots): Make the
roots contain the thread.  This way sizeof(*thread) is the total
allocation size; if you pad the allocation with extra words, some of the
self-checks in nofl get borked.
2025-07-02 21:34:46 +02:00
Andy Wingo
e23adeafd3 Fix some scm_trace_object bugs
* libguile/trace.h (FOR_EACH_TC7_WITH_STRUCT_TYPE):
(scm_trace_object): Wire up smob tracing.  Only trace ephemerons and
finalizers if there is a trace function.
2025-07-02 21:32:21 +02:00
Andy Wingo
fd7de3ab35 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-02 17:23:48 +02:00
Andy Wingo
88471e451d Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-02 17:17:49 +02:00
Andy Wingo
e51cf4bf65 Precise tracing works with heap-conservative-mmc
* libguile/ports.c (scm_make_port_type): Pin the ptob.
* libguile/threads.c (scm_trace_thread_roots): No need to trace dynstack
roots; we will do so within scm_trace_thread.
* libguile/trace.h (scm_trace_struct): Fix arg order to logbit?.
(scm_trace_ephemeron_table): Indentation fix.
(scm_trace_pointer): Actually trace the protected objects.
(scm_trace_vm):
(scm_trace_active_dynamic_state):
(scm_trace_thread): Fix to trace missing references.
(scm_trace_port): Trace the ptob and write_buf_aux.
(scm_trace_random_state): Add comment about rng being static.
* libguile/whippet-embedder.h (gc_is_valid_conservative_ref_displacement):
Don't hide behind an ifdef.
2025-07-02 15:11:03 +02:00
Andy Wingo
24f5e43e61 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-02 11:39:58 +02:00
Andy Wingo
033d94335a Refactor sloppy smob allocation
* libguile/smob.c (scm_smob_descriptor_observe_sloppy_size):
(scm_new_smob, scm_new_double_smob): Refactor to avoid the global lock
when allocating managed smobs.
2025-07-02 09:45:51 +02:00
Andy Wingo
1b00300c72 Allow gc_extern_space_visit in precise mode
* libguile/whippet-embedder.h (gc_extern_space_visit): Just return 0.
2025-07-01 22:15:44 +02:00
Andy Wingo
4ebf7d3498 Remove dead code in threads.c
* libguile/threads.c (scm_trace_thread): Remove.
2025-07-01 16:17:52 +02:00
Andy Wingo
d07b6acd2c Fix -O0 compilation in async.c
* libguile/async.c: Yaargh, can't have static const case labels.
2025-07-01 16:17:17 +02:00
Andy Wingo
dffbf45559 Rework continuations to be relocatable
* libguile/continuations-internal.h:
* libguile/continuations.c (scm_i_make_continuation): Allow continuation
objects to be relocated.
2025-07-01 15:48:17 +02:00
Andy Wingo
18dac263a1 Pin bytevectors passed to bytevector->pointer
* libguile/foreign.c (scm_bytevector_to_pointer): Pin bv.
2025-07-01 15:38:33 +02:00
Andy Wingo
2e0c7c9696 Dynstack snapshot relocation
* libguile/dynstack.c (scm_trace_dynstack): Allow for snapshots to be
relocated.
2025-07-01 15:32:21 +02:00
Andy Wingo
c379fba9a9 Allow for contiguous bytevectors to be relocated
* libguile/trace.h (scm_trace_bytevector): Update contents pointer for
contiguous bytevectors.
* module/system/vm/assembler.scm (link-data): Make sure to set the
contiguous flag on serialized bytevectors.
2025-07-01 15:14:47 +02:00
Andy Wingo
77a6914c3a Include new Whippet header files
* libguile/gc-internal.h: Add includes that were split out of gc-api.h,
to allow trace functions to use functions in gc-api.h.
2025-07-01 13:20:38 +02:00
Andy Wingo
bb65e18d68 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-07-01 13:19:38 +02:00
Andy Wingo
9de24bd429 Implement scm_trace_object
* libguile/trace.h: Make a precise object tracer.
2025-07-01 11:07:39 +02:00
Andy Wingo
a7801c750f vm: BUILDING_LIBGUILE-guarded defs to internal headers
Also make "struct scm_vm" private, now that scm_thread is also private.

* libguile/vm-internal.h: New file.
* libguile/Makefile.am: Add new file.
* libguile/continuations.c:
* libguile/debug.c:
* libguile/frames.c:
* libguile/init.c:
* libguile/print.c:
* libguile/programs.c:
* libguile/script.c:
* libguile/stacks.c:
* libguile/threads-internal.h:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c:
* libguile/vm.c: Include new file.
* libguile/vm.h: Remove private defs.
2025-07-01 11:04:57 +02:00
Andy Wingo
6a32628e18 frames, values: BUILDING_LIBGUILE-guarded defs to internal headers
I was writing the trace function, which is included by Whippet, which
doesn't have the BUILDING_LIBGUILE define.  It is just as fine to put
these in private headers; better, even.

* libguile/frames-internal.h:
* libguile/values-internal.h: New files.
* libguile/Makefile.am (noinst_HEADERS): Add new files.
* libguile/backtrace.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/eval.c:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gsubr.c:
* libguile/init.c:
* libguile/intrinsics.c:
* libguile/numbers.c:
* libguile/print.c:
* libguile/smob.c:
* libguile/smob.h:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/values.c:
* libguile/values.h:
* libguile/vm.c: Include new files.
2025-07-01 10:43:14 +02:00
Andy Wingo
65a265adea Add filesys-internal.h
* libguile/Makefile.am: Add new file.
* libguile/filesys-internal.h: New file.
* libguile/filesys.c:
* libguile/filesys.h:
* libguile/fports.c:
* libguile/finalizers.c:
* libguile/init.c:
* libguile/print.c: Adapt.
2025-06-30 16:05:38 +02:00
Andy Wingo
823df42d0c Move scm_cond, scm_mutex definitions to internal header
* libguile/threads.c
* libguile/threads-internal.h: As it says on the tin!
2025-06-30 16:03:25 +02:00
Andy Wingo
7c13e983b3 Add srfi-14-internal.h
* libguile/srfi-14-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add file.
* libguile/srfi-14.h: Remove internal definitions.
* libguile/init.c:
* libguile/srfi-14.c:
* libguile/eq.c:
* libguile/print.c: Use internal file.
2025-06-30 15:46:14 +02:00
Andy Wingo
c66668a87a Move struct scm_regexp definition to internal header
* libguile/regex-posix.c:
* libguile/regex-posix.h (scm_is_regexp):
(scm_to_regexp):
(scm_from_regexp):
(SCM_REGEXP_P):
(SCM_VALIDATE_REGEXP): Move definitions to header.
2025-06-30 15:45:37 +02:00
Andy Wingo
cce7a04e55 Add macros-internal.h
* libguile/macros-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add file.
* libguile/macros.h: Remove internal definitions.
* libguile/init.c:
* libguile/macros.c:
* libguile/print.c: Use internal file.
2025-06-30 15:35:30 +02:00
Andy Wingo
db13048459 Add i18n-internal.h
* libguile/i18n-internal.h: New file.
* libguile/Makefile.am: Add file.
* libguile/i18n.c:
* libguile/finalizers.c:
* libguile/init.c: Use new file.
2025-06-30 15:30:43 +02:00
Andy Wingo
30ad63113a Add bitvectors-internal.h
* libguile/bitvectors-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add new file.
* libguile/bitvectors.c: Adapt to add scm_ prefix to the is_bytevector,
bytevector_bits, etc helpers.
* libguile/bitvectors.h (scm_is_bitvector): Define inline.  Remove
internal defines from the header.
* libguile/eq.c:
* libguile/init.c:
* libguile/print.c:
* libguile/array-handle.c: Adapt.
2025-06-30 15:26:14 +02:00
Andy Wingo
62b23a8dc4 Add smob-internal.h
* libguile/smob-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add new file.
* libguile/smob.c (scm_new_smob, scm_new_double_smob): Adapt.
2025-06-30 14:58:44 +02:00
Andy Wingo
8e6a06ca29 Name the field for string backing store
* libguile/strings.h (chars): Name the field.
* libguile/strings.c (string_stringbuf, string_aliased_string)
(make_string, scm_i_string_ensure_mutable_x, scm_i_substring_shared)
(scm_i_try_narrow_string, scm_i_string_set_x): Adapt.
2025-06-30 14:53:58 +02:00
Andy Wingo
38c22e77a0 Add new typed struct helpers to get size and unboxed fields
* libguile/struct.h (scm_i_vtable_size):
(scm_i_vtable_unboxed_fields): New helpers.
2025-06-30 14:49:35 +02:00
Andy Wingo
4f25a845cb Dispatch gc_trace_object to scm_trace_object
* libguile/whippet-embedder.h (gc_trace_object): Call scm_trace_object.
* libguile/trace.h (scm_trace_object): Stub implementation.
2025-06-30 14:47:10 +02:00
Andy Wingo
974550e335 Move "struct scm_syntax" definition to internal header
* libguile/syntax.c:
* libguile/syntax.h (scm_is_syntax, scm_to_syntax, scm_from_syntax):
Move here.
2025-06-30 14:36:53 +02:00
Andy Wingo
c18e93ef04 Add scm_integer_size_z to internal integers.h
* libguile/integers.c (scm_integer_size_z):
* libguile/integers.h: Voilà.
2025-06-30 14:35:41 +02:00
Andy Wingo
1eedd208fb Move "struct scm_ephemeron_table" to internal header
* libguile/ephemerons.c:
* libguile/ephemerons.h: Put definition here.
2025-06-30 14:35:06 +02:00
Andy Wingo
2b3b843f82 Dynstack uses inline functions instead of macros
* libguile/control.c:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/vm.c: Move SCM_DYNSTACK_TAG etc to be inline functions.
Adapt all callers.
2025-06-30 14:28:52 +02:00
Andy Wingo
985c1d16f2 Make dynstack interface completely internal
* libguile/Makefile.am (noinst_HEADERS, modinclude_HEADERS): Don't
install dynstack.h.
* libguile/dynwind.c (translate_frame_flags, scm_dynwind_begin)
(translate_winder_flags, scm_dynwind_unwind_handler):
* libguile/dynwind.h (scm_t_dynwind_flags, scm_t_wind_flags): Instead of
punning the dynwind.h flags to dynstack.h values, translate them.
* libguile/threads-internal.h:
* libguile/threads.h: Include dynstack.h in the private header.
2025-06-30 14:07:05 +02:00
Andy Wingo
8726b8789b Replace alloca hack in vm.c:invoke_hook with alignas
* libguile/vm.c (invoke_hook): Stack-allocate the "struct scm_vm_frame"
by specifying an alignment on the type.
2025-06-30 09:57:53 +02:00