* 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.
* api/mmc-attrs.h (gc_allocator_alloc_table_begin_pattern): Unify the
strategies between conservative and precise configurations. Notably
this mens that TAGGED allocations are traced precisely in
heap-conservative configurations. Don't pin untagged pointerless
allocations; that is the mutator's responsibility.
* src/mmc.c (compute_trace_kind): Trace tagged objects precisely in all
cases.
(gc_init): Update expectations for alloc table bytes.
* 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.
* test-suite/tests/bytevectors.test ("uniform-array->bytevector"): The
unit of bitvectors is now the word.
* test-suite/tests/bitvectors.test: Add missing (ice-9 arrays) import.
* 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.
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.
* libguile/bytevectors.c (make_bytevector_from_buffer): If there is a
parent GC-managed object for the buffer, pin that object so that the
buffer remains valid.
* libguile/gc.h:
* libguile/gc.c (scm_gc_pin_object): New function.
(scm_gc_object_address): New function, to be used instead of SCM_UNPACK
when an object's address is exposed, for example via hashq.
* libguile/atomic.c:
* libguile/cache-internal.h:
* libguile/continuations.c:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/ephemerons.c:
* libguile/exceptions.c:
* libguile/finalizers.c:
* libguile/fluids-internal.h:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/intrinsics.c:
* libguile/memoize.c:
* libguile/print.c:
* libguile/programs.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/struct.h:
* libguile/variable.c:
* libguile/vm.c: Use the new functions everywhere that is needed.
Because they take a thread, sometimes we have to do some extra plumbing.
This way we don't allocate an untagged wake data, and we don't need a
type tag. On the other hand we have to roll a more complicated seqlock,
but that's fine.
Also switch to require C11 atomics.
* libguile/atomics-internal.h: Remove fallback for when we don't have
C11 atomics.
(scm_atomic_ref_uint32, scm_atomic_swap_uint32, scm_atomic_set_uint32):
New helpers.
* libguile/threads-internal.h:
* libguile/async.h:
* libguile/async.c: Inline the thread wake data. Happily, waking a
remote thread is still wait-free from both sides.
Avoids sloppy allocations.
* libguile/ports-internal.h (scm_is_port_type):
(scm_to_port_type, scm_from_port_type): New helpers.
* libguile/goops.c (scm_make_port_classes):
(create_port_classes): Use a list and be thread-safe.
* libguile/scm.h (scm_tc7_port_type):
* libguile/ports-internal.h (struct scm_t_port_type):
* libguile/ports.c (scm_make_port_type): These objects have been
allocated pointerless since 2011, but since 2016 at least they have had
SCM members. Oops!
Before, it was untagged, which is a problem for precise tracing.
* libguile/threads.c (make_launch_data, protect_launch_data)
(unprotect_launch_data, really_launch, launch_thread)
(scm_sys_call_with_new_thread): Use a vector for launch data.