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

21330 commits

Author SHA1 Message Date
Tomas Volf
21e3e1c420
tests: Skip hole-related port tests on Darwin.
Hole are itself a file-system specific feature and they are not
mandated.  While APFS does support sparse files, they do not behave like
on Linux.  I did not discover exact rules, but the file needs to be
large (100s of kB at least) and the holes are not aligned as the test
code expects.  So just disable them.

* test-suite/tests/ports.test (skip-on-darwin): New procedure.
("size of sparse file", "SEEK_DATA while on data")
("SEEK_DATA while in hole", "SEEK_HOLE while in hole"): Skip on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Tomas Volf
478f139d77
tests: Skip tests of abstract Unix sockets on Darwin.
Darwin does not support abstract Unix sockets, so mark the tests as
skipped.

* test-suite/tests/00-socket.test (skip-on-darwin): New procedure.
("bind abstract", "listen abstract", "connect abstract")
("accept abstract"): Skip on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Tomas Volf
a8ce7f1f92
tests: Check TCP_NODELAY for non-zero instead of 1.
POSIX does not explicitly say that stored value using setsockopt will be
returned by getsockopt.  At least for TCP_NODELAY on Darwin they do
differ.  Darwin returns internal define TF_NODELAY (4) instead of 1 the
test expected.  Since for boolean flags "non-zero is true", rewrite the
test to check just that.

* test-suite/tests/00-socket.test ("setsockopt AF_INET")
["IPPROTO_TCP TCP_NODELAY"]: Check for non-zero value from getsockopt.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Andrew McNulty
b7bd440f22
Fix typo in dynamic wind documentation.
* doc/ref/api-control.texi: Fix typo in dynamic wind
documentation.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Brennan Vincent
0ace611196
Fix gbt command in gdbinit
In 2009 when this was written, SCM_UNDEFINED was 0x704. Now it's 0x904.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Tomas Volf
ad90f45a8c
Replace SRFI-64 with a new implementation.
The bundled (reference) implementation was of somewhat mixed quality and
it failed to follow standard in multiple places.  This commit replaces
it with a new one, written from scratch to follow the standard as close
as possible.

* module/srfi/srfi-64/testing.scm: Delete file.
* module/srfi/srfi-64.scm: Replace with new implementation.
* am/bootstrap.am (srfi/srfi-64.go): Remove extra dependencies.
(NOCOMP_SOURCES): Remove srfi/srfi-64/testing.scm.
* test-suite/tests/srfi-64-test.scm
("8.6.1. Simple (form 1) test-apply")
("8.6.2. Simple (form 2) test-apply"): Adjust tests to follow the
specification.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 19:11:42 +02:00
Michael Käppler
08e26836f1
Fix setjmp/longjmp-related crashes on Windows
* libguile/Makefile.am: add new header file setjump-win.h
* libguile/continuations.h, libguile/dynstack.c, libguile/dynstack.h,
  libguile/intrinsics.h, libguile/vm.h:
  supply custom `setjmp` macro on Windows

Mingw implements `setjmp (env)` as a macro that expands to

 _setjmp (env, faddr)

where `faddr` is set to the current frame address.

This address is then stored as first element in the jump buffer `env`.
When `longjmp` is called, it tries to unwind the stack up
to the saved address by calling `RtlUnwindEx` from MSVCRT,
which will fail, if the stack frames are interwoven with
JIT-generated code, that violate the Windows x64 calling conventions.

Thus implement the macro ourselves as

_setjmp (env, NULL)

which will toggle a code path in `longjmp` that does no unwinding.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 12:14:21 +02:00
Arne Babenhauserheide
c0bfa3219c fix typo in comment
module/ice-9/command-line.scm (compile-shell-switches): fix typo
2024-10-12 14:07:02 +02:00
Matthew Wette
8d21dd7eb8 Create procedure to enable silencing the Guile welcome message. * module/system/repl/repl.scm: add parameter %inhibit-welcome-message' * module/system/repl/repl.scm(run-repl*): add condition for calling procedure repl-welcome: if (%inhibit-welcome-message) is #t', don't 2024-10-12 13:16:35 +02:00
Matthew Wette
78e9e51065 Redirect diagnostice output messages (e.g., auto-compiling code) to a newly defined current-info-port, and add a command line argument -I' to set the current-info-port to a void-port. * libguile/ports.c: add cur_infoport_fluid, scm_current_info_port, scm_set_current_info_port; define default current-info-port to stderr * libguile/load.c(compiled_is_fresh,load_thunk_from_path, do_try_auto_compile,scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): direct output messages to current_info_port; was current_warning_port * libguile/init.c(scm_init_standard_ports): set default current_info_port * module/ice-9/ports.scm: define current-info-port and set-current-info-port * module/ice-9/command-line.scm(*usage*,compile-shell-switches): add argument -I' to silence diagnostics (or current-info-port to void-port) * doc/ref/guile-invoke.texi: add description for `-I' command argument 2024-10-12 13:16:25 +02:00
Matthew Wette
3d2fd7a262 Fix typo in naming function set-current-output-port * libguile/ports.c(scm_set_current_output_port): scheme name is set-current-output-port 2024-10-12 13:16:12 +02:00
Rob Browning
9b1effb585 Compile with -fexcess-precision=standard for i[3456]86 when we can
* configure.ac: when -fexcess-precision=standard is available and we're
building for i[3456]86, use it.  This fixes floating point precision
problems caused by x87 (80-bit) floating point, and detected by
numbers.test.

Closes: 43262
2024-10-05 19:19:57 -05:00
Rob Browning
1c96e4ab6d Ensure tests have guile-procedures.txt
The tests depend on libguile/guile-procedures.txt, for example via
documented? in bit-operations.test.  Previously "make check -j..." in a
clean tree would fail because libguile/guile-procedures.txt is built by
./Makefile.am (rather than libguile/Makefile.am) so that it will have a
built module/ available, but when "." is not listed in SUBDIRS, it
builds last, and so the test-suite runs before guile-procedures.txt is
built.

To fix the problem add "." to SUBDIRS before the test-suite so that the
tests will be able depend on everything else, and move the existing
guile-procedures.txt target into libguile/ next to its
guile-procedures.texi dependency.  That gives a better overview and
simplifies the recipe a bit.  It also allows us to drop the explict
"all-local:" dependency, and to let the existing libguile/ code handle
the cleanup.

* Makefile.am (SUBDIRS): add . just before the test-suite.
(libguile/guile-procedures.txt): rely on libguile/Makefile.am.
(CLEANFILES): Drop libguile/procedures.txt.
* libguile/Makefile.am: (all-local): drop.
(libguile/guile-procedures.txt): move Makefile.am recipe here.
2024-09-27 19:51:00 -05:00
Ludovic Courtès
e134a1a6b1
Update NEWS. 2024-09-27 22:50:52 +02:00
Andy Wingo
aff9ac9688 Run sigbits fixpoint based on use/def graph, not cfg
* module/language/cps/specialize-numbers.scm (sigbits-ref): New helper.
(invert-graph*): New helper.
(compute-significant-bits): When visiting a term changes computed
needed-bits for one of its definitions, we need to revisit the variables
that contributed to its result (the uses), because they might need more
bits as well.  Previously we were doing this by enqueueing predecessors
to the term, which worked if the uses were defined in predecessors, or
if all defining terms were already in the worklist, which is the case
without loops.  But with loops, when revisiting a term, you could see
that it causes sigbits to change, enqueue its predecessors, but then the
predecessors don't change anything and the fixpoint stops before
reaching the definitions of the variables we need.  So instead we
compute the use-def graph and enqueue defs directly.
2024-09-26 11:14:52 +02:00
Andy Wingo
30c3849092 Tighten up range inference for scm->u64/truncate
* module/language/cps/types.scm (scm->u64/truncate): Better range
analysis.
2024-09-25 17:27:17 +02:00
Andy Wingo
e45b70dcde Fix boxing of non-fixnum negative u64 values
* module/language/cps/specialize-numbers.scm (u64->fixnum/truncate): New
helper.
(specialize-operations): Fix specialized boxing of u64 values to
truncate possibly-negative values, to avoid confusing CSE.  Fixes
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71891.
2024-09-25 17:24:51 +02:00
Andy Wingo
0dab58fc2a Fix fixpoint needed-bits computation in specialize-numbers
* module/language/cps/specialize-numbers.scm (next-power-of-two): Use
integer-length.  No change.
(compute-significant-bits): Fix the fixpoint computation, which was
failing to complete in some cases with loops.
2024-09-25 17:23:06 +02:00
Andy Wingo
b04071cc57 Partially revert d579848cb5
* module/language/cps/specialize-numbers.scm (specialize-operations):
Accept any operand to logand/immediate, provided the result is a u64 in
the right range.
2024-09-24 09:24:15 +02:00
Andy Wingo
5e6288c930 Narrow parameter of logand/immediate if no bits used
* module/language/cps/specialize-numbers.scm (specialize-operations):
Narrow ulogand/immediate param according to used bits.
2024-09-23 16:00:54 +02:00
Andy Wingo
d6af34c0e0 Remove needless constraints in type/range analysis
* module/language/cps/types.scm
(ulogand, ulogand/immediate, ulogsub, ulogior, ulogxor): Where we have
u64 inputs, there's no need to `restrict!`; the range will come from the
definition.
2024-09-23 15:32:45 +02:00
Andy Wingo
90e1205018 Add a workaround for pre-3.0.10 incorrect inlinable exports
* module/language/tree-il/peval.scm (peval)
(inlinable-kwargs-bug-fixup): Before 3.0.10, the inlinable exports pass
was incorrectly serializing functions with keyword arguments.  This was
fixed in 2c645571b3, but that meant that
3.0.10 compiling against 3.0.9 binaries could raise an exception at
compile-time; whoops.  Add a workaround so that 3.0.9 binaries still
work.

Fixes https://issues.guix.gnu.org/72936.
2024-09-23 14:07:53 +02:00
Andy Wingo
a970ed5bd5 Update psyntax copyright notice
* module/ice-9/psyntax.scm: Use the newer LGPLv3 header.  Add FSF
copyright lines for each year the file was modified.  Remove inline
changelogs.  Remove some comments describing psyntax in other Scheme
implementations.
2024-08-26 09:51:53 +02:00
Andy Wingo
d0790d766b Fix intset-fold-right on transient intsets
* module/language/cps/intset.scm (make-intset-folder): intset-fold-right
on a transient intset would dispatch to left fold after making the
persistent set.  Sadness!
2024-08-15 12:18:02 +02:00
Andy Wingo
7aa4cfa9de More thorough lowering of lognot to CPS
* module/language/tree-il/compile-cps.scm (canonicalize): Lower to a
logxor with -1.
2024-08-13 13:40:45 +02:00
Andy Wingo
c2e7d834c2 Fix compilation with C23
* libguile/jit.c (is_unreachable): Rename from "unreachable", which is
apparently a new reserved word in C23.
2024-08-13 13:40:45 +02:00
Daniel Llorens
83d6d6afd9 Better error messages in array functions
* doc/ref/api-data.texi (Arrays as arrays of arrays): Clarify
  ambiguities, fix examples.
* libguile/arrays.c (make-shared-array): Make error messages specific to
  each error case, report relevant arguments.
  (array_from_pos): Return NULL on error instead of reporting error
  ourselves.
  (array_from_get_o): Handle the trivial case.
  (scm_array_slice, scm_array_cell_ref, scm_array_cell_set_x): Don't
  build error arguments before error happens. Let array_from_get_o
  handle the trivial case.
2024-08-12 14:24:58 +02:00
Rob Browning
c03115c39d basename: check suffix against basename, not full argument
* libguile/filesys: check suffix against basename, not full argument.

Closes: 69437
2024-08-03 14:39:26 -05:00
Rob Browning
9a57c237d2 basename: drop last_component null check
Prepare for fixes to the suffix pruning.  Since last_component doesn't
document a possible null result in lib/basename-lgpl.h, and the current
code also doesn't appear capable of producing one, drop the check.

libguile/filesys.c (basename): drop check for last_component null result.
2024-08-03 14:29:47 -05:00
Yuval Langer
2047b532fa api-data.texi: fix typo in "Real and Rational Numbers" section
* doc/ref/api-data.texi: fix typo in "Real and Rational Numbers" section

[rlb@defaultvalue.org: adjust commit message]

Closes: 59572
2024-08-03 14:25:10 -05:00
Rob Browning
b6125a0def NEWS: add some missing 3.0.11 entries 2024-08-03 14:25:10 -05:00
Rob Browning
bce91cebed Merge conversion of srfi-1.c to srfi-1.scm
Rewrite the srfi-1 C functions in Scheme and remove srfi-1.c as
planned (see the comments at the top of srfi-1.c).

The previous C code mutated intermediate results in some cases, even for
non-! functions (e.g. set-cdr! to build the result without stack growth
or a reverse!); some of the conversions preserve that approach for now.

Simple testing via https://github.com/ecraven/r7rs-benchmarks/ didn't
reveal any substantial performance regressions.

Thanks to David Thompson for reviewing the changes and suggesting
improvements.
2024-07-30 19:40:48 -05:00
Rob Browning
6338459159 Drop libguile srfi-1
...now that all of the C code has been migrated to Scheme.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
remove srfi-1.c.
(DOC_X_FILES): Remove srfi-1.x.
(DOT_DOC_FILES): Remove srfi-1.doc.
(modinclude_HEADERS): Remove srfi-1.h.
* libguile/init.c (scm_i_init_guile): Don't call scm_register_srfi_1.
* libguile/srfi-1.c: Remove.
* libguile/srfi-1.h: Remove.
* module/srfi/srfi-1.scm: Don't load srfi-1 from libguile.
2024-07-30 19:39:32 -05:00
Rob Browning
51b7021de1 srfi-1 delete-duplicates: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_delete-duplicates): delete.
* libguile/srfi-1.h (scm_srfi1_delete-duplicates): delete.
* module/srfi/srfi-1.scm: add delete-duplicates.
2024-07-30 19:28:37 -05:00
Rob Browning
a94b4406b7 srfi-1 delete-duplicates!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_delete-duplicates_x): delete.
* libguile/srfi-1.h (scm_srfi1_delete-duplicates_x): delete.
* module/srfi/srfi-1.scm: add delete-duplicates!.
2024-07-30 19:28:37 -05:00
Rob Browning
51e15d448f srfi-1 lset-difference: use remove
* module/srfi/srfi-1.scm (lset-difference): rely on remove like
lset-difference!; in addition to being simpler, this allows sharing a
common tail.
2024-07-30 19:28:37 -05:00
Rob Browning
945c97b14d srfi-1 lset-difference!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_lset-difference_x): delete.
* libguile/srfi-1.h (scm_srfi1_lset-difference_x): delete.
* module/srfi/srfi-1.scm: add lset-difference!.
* test-suite/tests/srfi-1.test: extend lset-difference! tests to cover
lset-difference.
2024-07-30 19:28:37 -05:00
Rob Browning
3eb6afe738 srfi-1 partition!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_partition_x): delete.
* libguile/srfi-1.h (scm_srfi1_partition_x): delete.
* module/srfi/srfi-1.scm: add partition!.
2024-07-30 19:28:37 -05:00
Rob Browning
925faf1f01 srfi-1 partition: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_partition): delete.
* libguile/srfi-1.h (scm_srfi1_partition): delete.
* module/srfi/srfi-1.scm: add partition.
2024-07-30 19:28:37 -05:00
Rob Browning
58246aee24 srfi-1 count: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_count): delete.
* libguile/srfi-1.h (scm_srfi1_count): delete.
* module/srfi/srfi-1.scm: add count.
2024-07-30 19:28:37 -05:00
Rob Browning
372a52e6aa srfi-1 length+: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_length_plus): delete.
* libguile/srfi-1.h (scm_srfi1_length_plus): delete.
* module/srfi/srfi-1.scm: add length+.
2024-07-30 19:28:37 -05:00
Rob Browning
3cb6309f62 srfi-1 append-reverse!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_append_reverse_x): delete.
* libguile/srfi-1.h (scm_srfi1_append_reverse_x): delete.
* module/srfi/srfi-1.scm: add append-reverse!.
2024-07-30 19:28:37 -05:00
Rob Browning
17281519df srfi-1 append-reverse: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_append_reverse): delete.
* libguile/srfi-1.h (scm_srfi1_append_reverse): delete.
* module/srfi/srfi-1.scm: add append-reverse.
2024-07-30 19:11:34 -05:00
Rob Browning
c62d2962d4 srfi-1 concatenate concatenate!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* libguile/srfi-1.h (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* module/srfi/srfi-1.scm: add concatenate and concatenate!.
2024-07-30 18:54:45 -05:00
Rob Browning
a816b2484b srfi-1 delete delete!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_delete, scm_srfi1_delete_x): delete.
* libguile/srfi-1.h (scm_srfi1_delete, scm_srfi1_delete_x): delete.
* module/srfi/srfi-1.scm: add delete and delete!.
2024-07-30 18:54:45 -05:00
Rob Browning
c5f26d4c27 srfi-1 remove!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_remove_x): delete.
* libguile/srfi-1.h (scm_srfi1_remove_x): delete.
* module/srfi/srfi-1.scm: add remove!.
2024-07-30 18:54:45 -05:00
Rob Browning
03d4a3b5df srfi-1 remove: move from C to Scheme
The Scheme implementation is an adapted version of the approach used by
delete-duplicates, which allows sharing any common tail.

* libguile/srfi-1.c (scm_srfi1_remove): delete.
* libguile/srfi-1.h (scm_srfi1_remove): delete.
* module/srfi/srfi-1.scm: add remove.
2024-07-30 18:54:45 -05:00
Rob Browning
aa44035ee8 srfi-1 list-copy: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_list_copy): delete.
* libguile/srfi-1.h (scm_srfi1_list_copy): delete.
* module/srfi/srfi-1.scm: add list-copy.
* test-suite/tests/srfi-1.test: ensure copied spine is independent.
2024-07-30 18:54:45 -05:00
Rob Browning
6bd70136d9 Ensure GUILE-VERSION changes propagate to .version and Makefiles
Have .version depend on the Makefile, and move our
CONFIG_STATUS_DEPENDENCIES setting to an AC_SUBST, as recommended by the
automake info pages "Rebuilding Makefiles" section, so that changes to
GUILE-VERSION will update the VERSION, etc. in the generated Makefiles.

* Makefile.am (CONFIG_STATUS_DEPENDENCIES): drop.
($(top_srcdir/.version)): depend on Makefile.
* configure: add GUILE-VERSION to CONFIG_STATUS_DEPENDENCIES via
AC_SUBST.
2024-07-26 16:37:41 -05:00
Richard Sent
8535682dda doc: Mention how to remove namespaces in xml->sxml.
* doc/ref/sxml.texi (Reading and Writing XML): Document behavior of #f
namespace prefix.

This documents behavior discussed in
https://lists.gnu.org/archive/html/guile-user/2024-07/msg00013.html.
2024-07-23 08:23:43 +02:00