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

21920 commits

Author SHA1 Message Date
Andy Wingo
1e41f0e093 mmc: Tail-call an out-of-memory handler if allocation fails 2025-04-23 11:31:15 +02:00
Andy Wingo
a0148d4b38 pcc: Tail-call an out-of-memory handler if allocation fails 2025-04-23 10:47:32 +02:00
Andy Wingo
6032adede9 semi: Tail-call an out-of-memory handler if allocation fails 2025-04-23 10:47:13 +02:00
Andy Wingo
31b373b8f2 copy space: Palliate a failure mode due to fragmentation 2025-04-23 10:46:23 +02:00
Andy Wingo
3c4fdfde0e Fix embarassing bug in which lack of MAP_FIXED meant unaligned slabs
This would manifest itself in odd failures when accessing
block/object metadata on slabs.
2025-04-23 10:43:14 +02:00
Andy Wingo
0532602cd3 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.
2025-04-22 13:44:44 +02:00
Andy Wingo
7696344634 Bump version to 3.9.x
Headed towards a 4.0.  The binary format will change slightly but
incompatibly (e.g. renumbering of intrinsics).  Having a new GC is
enough of a change to warrant a minor version bump, and it's been 5
years so why not go major.

* GUILE-VERSION (GUILE_EFFECTIVE_VERSION): Bump to 4.0.
(GUILE_MICRO_VERSION, GUILE_MINOR_VERSION): Bump to 3.9.0.
(LIBGUILE_INTERFACE_CURRENT, LIBGUILE_INTERFACE_AGE): Reset.

* meta/guile-4.0.pc.in:
* meta/guile-4.0-uninstalled.pc.in: Rename from guile-3.0.
* .gitignore: Ignore pkg-config files with 4.0 effective version.

* README: Update slightly.

* doc/ref/api-evaluation.texi (Load Paths):
* doc/ref/api-options.texi (Build Config):
* doc/ref/guile-invoke.texi (Environment Variables):
* doc/ref/history.texi (A Timeline of Selected Guile Releases):
* doc/ref/libguile-parallel.texi (Parallel Installations):
* doc/ref/srfi-modules.texi (SRFI-0): Update references to stable
version in paths.

* module/system/vm/assembler.scm (*bytecode-minor-version*):
* libguile/loader.h (SCM_OBJCODE_MAJOR_VERSION):
(SCM_OBJCODE_MINIMUM_MINOR_VERSION):
(SCM_OBJCODE_MINOR_VERSION): Use the same major objcode version for now
but bump the minor to 99.

* meta/guile.m4 (GUILE_PKG, GUILE_PROGS): Check for Guile 4.0.
* module/ice-9/boot-9.scm (%cond-expand-features): Add new cond-expand
features.
2025-04-22 13:23:00 +02:00
Andy Wingo
27f0490801 Use Whippet API to boot threads
* libguile/scm.h (scm_tc7_thread): Give threads their own tc7.
* libguile/threads.h (struct scm_thread): Add a tag, so that struct
thread can be a SCM directly.  Add a struct gc_mutator* member.
(scm_thread_handle): New inline function.
(SCM_I_IS_THREAD, SCM_I_THREAD_DATA, SCM_VALIDATE_THREAD): Update to use
tc7 instead of SMOB tags.

* libguile/continuations.c (scm_i_with_continuation_barrier)
* libguile/finalizers.c (queue_finalizer_async)
* libguile/jit.c (compile_current_thread)
* libguile/threads.c (block_self, guilify_self_2)
(lock_mutex, unlock_mutex, timed_wait scm_current_thread)
(scm_all_threads)
* libguile/vm-engine.c (current-thread): Use scm_thread_handle instead
of thread->handle.

* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (class_thread, scm_class_of, scm_sys_goops_early_init)
* libguile/print.c (iprin1)
* module/language/cps/compile-bytecode.scm (compile-function)
* module/oop/goops.scm (<thread>)
* module/system/base/types.scm (cell->object)
* module/system/base/types/internal.scm (heap-tags)
* module/system/vm/assembler.scm: (emit-thread?): Adapt to
scm_tc7_thread.

* libguile/gc-internal.h: Move init functions that take "struct
gc_stack_addr" here, so that internal Whippet uses don't cause Whippet
to be added to public headers.
* libguile/gc.c (scm_storage_prehistory): Take struct gc_stack_addr as
arg, and pass to gc_init.  Return a mutator pointer.
* libguile/init.c (scm_i_init_guile): Pass mutator and stack base to GC
and thread init routines.
* libguile/threads.c (scm_trace_dynstack, scm_trace_thread)
(scm_trace_thread_mutator_roots): New infra for marking threads in terms
of Whippet API.
* libguile/threads.c (guilify_self_1): Since we don't use a separate GC
kind for threads any more, and thread marking is keyed off
gc_mutator_set_roots, we can avoid some of the gnarly synchronization.
(on_thread_exit): Arrange to gc_finish_for_thread.
(scm_i_init_thread_for_guile): Use gc_init_for_thread.
(init_main_thread, with_guile, scm_i_with_guile): Use Whippet API.
(scm_threads_prehistory): Take main-thread mutator and the stack base as
arguments.
* libguile/vm.c (scm_trace_vm): Rework in terms of Whippet API.
* libguile/whippet-embedder.h (gc_trace_mutator_roots): Arrange to trace
the current mutator's SCM thread object.
* libguile/trace.h: New file, to declare implementations of trace
routines.
* libguile/Makefile.am (noinst_HEADERS): Add trace.h.
2025-04-22 10:36:30 +02:00
Andy Wingo
55e9d0672b Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-04-22 10:01:34 +02:00
Andy Wingo
1818d7fa0b Add -fno-strict-aliasing to libwhippet CFLAGS 2025-04-22 10:01:21 +02:00
Andy Wingo
68d495f081 Adapt to Whippet changes
* libguile/gc.c (scm_storage_prehistory): Adapt to new gc_init
prototype.
2025-04-18 15:15:06 +02:00
Andy Wingo
b6236fdcdc Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-04-18 15:11:40 +02:00
Andy Wingo
2dab407ec1 Expose definition of gc_stack_addr, rework API 2025-04-18 15:08:01 +02:00
Andy Wingo
9b7f7f7554 Switch statistics collection, GC hooks to use Whippet API
* libguile/gc.c: Define an event listener that collects basic
statistics, runs C hooks, and arranges to run the Scheme hook if it is
nonempty.
(scm_gc_stats): Fetch statistics from the gathered event data.
(scm_gc_dump): Use scm_basic_stats_print.
(scm_storage_prehistory): Fix indentation.
(scm_init_gc_protect_object): Remove dead code.
(queue_after_gc_hook): Not really needed, as we have an after-GC C event
to run the C hooks.  Scheme hook activation is inlined into the event
listener.
(start_gc_timer, accumulate_gc_timer): No need any more.
(scm_init_gc): Simplify hook registration.
2025-04-17 14:37:39 +02:00
Andy Wingo
7f23dea7de Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-04-17 12:29:51 +02:00
Andy Wingo
d3df1a632a Record last live data size in basic stats. 2025-04-17 12:29:30 +02:00
Andy Wingo
57e8686cea Initialize BDW-GC using Whippet API
* libguile/gc.c (scm_storage_prehistory): Use Whippet API instead of
BDW-GC API.
2025-04-17 09:32:53 +02:00
Andy Wingo
2d5d9f6ba9 Update for changes to Whippet build
* libguile/Makefile.am (WHIPPET_EMBEDDER_H): Define this variable
instead of using -include; otherwise we don't get the chance to set
_LARGEFILE64_SOURCE before including Whippet files.
(AM_CPPFLAGS): Simplify.
(libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES): Explicitly add
libwhippet.la as a dependency.
(noinst_HEADERS): Add gc-internal.h
* libguile/gc-internal.h: New file.
* libguile/gc.c: Include gc-internal.h.
2025-04-16 13:48:36 +02:00
Andy Wingo
fd7b5d2d0c Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-04-16 13:42:18 +02:00
Andy Wingo
e4f9b1d8f8 Use abspath in GNU make snippet 2025-04-16 13:39:16 +02:00
Andy Wingo
022052b207 Fix embed.mk 2025-04-16 13:15:13 +02:00
Andy Wingo
185804dc41 Fix embed.am to not have libwhippet-common.la 2025-04-16 12:44:30 +02:00
Andy Wingo
a9ba085ad0 Add missing file 2025-04-16 12:43:15 +02:00
Andy Wingo
55d3fb7dc7 More build system reworking 2025-04-16 12:41:42 +02:00
Andy Wingo
75700ec3ed More build system reworking 2025-04-16 12:40:44 +02:00
Andy Wingo
6e36c039e9 Rework extension points between embedder and GC 2025-04-16 12:06:02 +02:00
Andy Wingo
7126bd19b0 Link Whippet into Guile
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD):
Add libwhippet.la.
2025-04-16 10:04:33 +02:00
Andy Wingo
a80e401540 Add Whippet to libguile/Makefile.am
* configure.ac: Add subdir-objects Makefile.am option, to prevent
accidental collision between object file names.
* libguile/Makefile.am: Include whippet/embed.am, and add the
appropriate hooks to the Makefile.
* libguile/whippet-embedder.h: New file.
2025-04-16 10:00:51 +02:00
Andy Wingo
a463e0d376 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-04-16 09:25:11 +02:00
Andy Wingo
f4d118ebaa Reserve a tc3 cell type for forwarded objects
* libguile/scm.h (scm_tc3_forwarded): Reserve.
2025-04-16 09:24:16 +02:00
Andy Wingo
424a0cefd9 autotools: refactor to avoid defining noinst_HEADERS 2025-04-15 13:03:11 +02:00
Andy Wingo
ab7288de0e Wire up Whippet to configure.ac
* configure.ac: Add WHIPPET_PKG invocation.  Choose BDW-GC as the
collector, for now.
2025-04-15 11:17:29 +02:00
Andy Wingo
556a3ae671 Merge remote-tracking branch 'whippet/main' into wip-whippet 2025-04-15 11:05:53 +02:00
Andy Wingo
27d66fa349 m4: Fix WHIPPET_PKG_BDW quoting error 2025-04-15 11:04:30 +02:00
Andy Wingo
e060c5fc99 Add --with-bdw-gc 2025-04-15 10:25:51 +02:00
Andy Wingo
db181e67ff Merged Whippet into libguile/whippet 2025-04-11 14:10:41 +02:00
Andy Wingo
f909438596 Fix distcheck, better docs 2025-04-10 14:07:52 +02:00
Andy Wingo
96c8bb8ce9 Fix unused variable in mt-gcbench.c 2025-04-10 14:03:29 +02:00
Andy Wingo
1664913ebd Update autotools and docs 2025-04-10 13:54:14 +02:00
Andy Wingo
63f52b635b Add some text about autotools 2025-04-10 13:39:29 +02:00
Andy Wingo
0c35069f58 Add autotools embedding files 2025-04-10 12:13:48 +02:00
Andy Wingo
d1aa0d894f bdw: Fix embarrassing failure to mark atomic freelists 2025-03-27 12:00:28 +01:00
Michael Gran
af96820e07 Windows 11: for fport input from the console, ignore terminal returns
There is an apparent bug in Windows 11 (not Windows 10) where,
when reading from an fd backed by the Console, a single
return character will always be available.

* libguile/posix-w32.c (console_has_return_keyevent_w32): new procedure
* libguile/posix-w32.h: declare console_has_return_keyevent_w32
* libguile/fports.c [__MINGW32__](fport_input_waiting): ignore return keyevent
2025-03-23 10:26:40 -07:00
Michael Gran
adbf2156ab Remove posix-w32 subsitutes that require access to process handles
Now that Guile uses the posix_spawn gnulib module, several of Guile's
custom w32 functions substitutes no longer work. Some functions
relied on populating and maintaining an internal PID-to-Handle database,
which is no longer possible.

kill, getpriority, setpriority, getaffinity and setaffinity
are removed. waitpid is simplified and does not handle ENOHANG.

* NEWS: updated
* libguile/posix-w32.c (struct proc_record, find_proc, proc_handle): removed
  (record_proc, delete_proc, prepare_child_handle, compenv): removed
  (prepare_envblk, lookup_cmd, prepare_cmdline, start_child): removed
  (kill, getpriority, setpriority, sched_getaffinity): removed
  (sched_setaffinity): removed
  (waitpid): modified to just use _cwait. ENOHANG emlation removed.
* libguile/posix-w32.h (CPU_ZERO, CPU_ISSET, CPU_SET, CPU_SETSIZE): removed
  (cpu_set_t, PRIO_PROCESS, PRIO_PGRP, PRIO_USER): removed
  (HAVE_START_CHILD, HAVE_KILL, HAVE_GETPRIORITY): removed
  (HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, HAVE_SCHED_SETAFFINITY): removed
  declarations for waitpid, start_child, kill, getpriority: removed
  declarations for setpriority, sched_getaffinity, sched_set_affinity: Removed
2025-03-22 21:57:59 -07:00
Michael Gran
2e51d3fa26 In piped_process, replace dprintf with more portable functions
dprint is missing on many non-glic platforms

* libguile/posix.c (piped_process): replace dprintf with sprintf+write
2025-03-22 21:33:33 -07:00
Michael Gran
9c86c5936e Allow piped-process and system* to exist when fork is undefined
piped-process only uses fork to match legacy behavior, but on systems
that never had fork, there is no need to match that behavior.
piped-process and system* can be provided without fork.

* libguile/posix.c (piped_process): allow function definition without HAVE_FORK,
    but stub out internal dummy process with HAVE_FORK
  (restore_sigaction, scm_dynwind_sigaction, scm_system_star): don't
    require HAVE_FORK
  (scm_init_popen): don't require HAVE_FORK
  (scm_init_posix): don't require HAVE_FORK to add posix feature or
    register popen extension
2025-03-22 21:32:45 -07:00
Michael Gran
87402c849e MinGW32: cast arguments to execvp
MinGW32's MSVCRT library requires strict casting for exec family functions

* libguile/posix.c (scm_execl, scm_execlp, scm_execle) [__MINGW32__]: cast
  arguments
2025-03-22 21:02:42 -07:00
Michael Gran
0f2125e66f Add missing #include in syscalls.h
SCM_SYSCALL uses scm_async_tick.

* libguile/syscalls.h: include async.h
2025-03-22 14:17:41 -07:00
Michael Gran
0e20c0c8c6 Add replacement for missing getpagesize() on MINGW
* libguile/posix-w32.c (getpagesize_w32): new procedure
* libguile/posix-w32.h: declaration of getpagesize_w32
* libguile/loader.c [__MINGW32__](scm_bootstrap_loader): use new procedure
* libguile/vm.c [__MINGW32__](scm_i_vm_prepare_stack): use new procedure
2025-03-22 14:17:30 -07:00
Michael Gran
0b9f58c339 Fix NEWS for load-foreign-library
NEWS update was in wrong location. This fixes news entry
from 7b41294049

* NEWS: update
2025-03-22 11:31:24 -07:00