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
Ekaitz Zarraga
741af987a3 riscv: fix load size for ldxi instructions 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
33eddc7b62 riscv: simplify load from pool 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
8c7990d4a1 riscv: fix literal pool guard jump address calc 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
fb527804f9 riscv: add get_callr_temp 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
c6008fd0ab riscv: fix the B and J type size check 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
93380fc377 riscv: clean patch jumps 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
f6f2a757c3 riscv: don't pack veneers, use padding 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
76549a674a riscv: Pack the veneer struct 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
775d11b21e riscv: Add fence 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
3edd48b046 Fix CI 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
797fe5067c Add RISCV to CI and makefile 2025-01-29 14:28:13 +01:00
Ekaitz Zarraga
cbd72e71a7 RISC-V Support 2025-01-29 14:01:52 +01:00
Ekaitz Zarraga
23c4e36dca Makefile: RISCV support and optional vars
Optional variables are needed because the structure of the makefile
is prepared to run on Guix but Guix doesn't support RISCV yet, so it's
better to set them as optional and let the user decide how do they want
to compile this thing.
2025-01-29 14:01:52 +01:00
Andy Wingo
41a2a60fa1 Merge branch 'reinterpret' into 'main'
Add movr_f_i, movr_i_f, movr_d_l, movr_l_d

See merge request wingo/lightening!27
2025-01-29 11:17:25 +00:00
Andy Wingo
11918685e1 Add movr_f_i, movr_i_f, movr_d_l, movr_l_d
These move values verbatim between FPRs and GPRs.
2025-01-29 12:14:59 +01:00
Andy Wingo
624d78625b Avoid accidentally-quadratic use of intmap-keys
* module/language/cps/utils.scm (compute-reachable-functions): Rework to
not call intmap-keys on a data structure that we are building up in a
loop.
2025-01-27 10:24:01 +01:00
Maxim Cournoyer
f109baebc0 doc/srfi-64: Fix typos and add examples.
* doc/ref/srfi-modules.texi (SRFI-64 Writing Basic Test Suites): Fix
  typo.  Add default test runner example.  Add test-approximate and
  test-error examples.  Document valid error types in Guile for test-error.

  (SRFI-64 Conditonal Test Suites and Other Advanced Features): Fix typo.

Fixes <https://bugs.gnu.org/75041>.

Suggested-by: Arne Babenhauserheide <arne_bab@web.de>
2025-01-24 10:54:01 +01:00
Rob Browning
48b1c4eff4 fport_print: handle ttyname ENODEV
In some situations, ttyname may return ENODEV even though isatty is
true.  From ttyname(3):

  A process that keeps a file descriptor that refers to a pts(4) device
  open when switching to another mount namespace that uses a different
  /dev/ptmx instance may still accidentally find that a device path of
  the same name for that file descriptor exists.  However, this device
  path refers to a different device and thus can't be used to access the
  device that the file descriptor refers to.  Calling ttyname() or
  ttyname_r() on the file descriptor in the new mount namespace will
  cause these functions to return NULL and set errno to ENODEV.

Observed in a Debian riscv64 porterbox schroot.

When ttyname fails with ENODEV, just include the file descriptor integer
value instead.  Call ttyname() directly to avoid having to catch the
ENODEV.

* libguile/fports.c (fport_print): fall back to the integer fd when
ttyname() fails with ENODEV.
2025-01-23 12:49:33 -06:00
Rob Browning
63756efbc5 Don't hold lock during scm_async_tick in readdir and ttyname
Only hold scm_i_misc_mutex while making the C calls.  This also avoids
the need for a dynamic-wind.  Add SCM_I_LOCKED_SYSCALL (similar to
SCM_SYSCALL) to handle the locking and EINTR loop.

libguile/filesys.c (scm_readdir): rely on SCM_I_LOCKED_SYSCALL to limit
locking.
libguile/filesys.c (scm_ttyname): rely on SCM_I_LOCKED_SYSCALL to limit
locking.
libguile/syscalls.h: add SCM_I_LOCKED_SYSCALL.
2025-01-22 19:24:07 -06:00
Andy Wingo
4a6347c371 Optimize ordering edges in fix-letrec
* module/language/tree-il/fix-letrec.scm (compute-sccs): Instead of
depending on all previous complex bindings, we can just depend on the
most recent one.  Decreases the graph size.
2025-01-22 16:51:28 +01:00
Andy Wingo
47dce42edb Use transient intset/intmap optimizations when computing SCCs
* module/language/cps/graphs.scm (compute-sorted-strongly-connected-components):
Use more transient data structures.
2025-01-22 16:50:52 +01:00
Andy Wingo
60c1e5cc42 Fix bad algorithmic growth in fix-letrec
We were using list sets, which when you end up with thousands of
bindings in an SCC reaches the point where we are off the quadratic end
of the curve.  Fix to use intsets and intmaps instead.

* module/language/tree-il/fix-letrec.scm (compute-ids): New function.
(compute-referenced-and-assigned): Rename from analyze-lexicals, and
compute intsets.
(make-compute-free-variables): Rename from free-variables, return a
procedure instead of a hash table, and use intsets.  Use a global cache
to avoid quadratic behavior with regard to binding depth.
(compute-complex): Compute a global set of "complex" variables, as an
intset.
(compute-sccs): Use intsets and intmaps to compute the free-variable and
ordering edges.
(fix-scc, fix-term): Refactorings.
(reorder-bindings): Avoid a linear search.
(fix-letrec): Refactor.
2025-01-22 14:56:32 +01:00
Andy Wingo
787e49f137 Fix a check in the Tree-IL verifier
* module/language/tree-il/debug.scm (verify-tree-il): Fix
pattern-matching.
2025-01-22 12:14:30 +01:00
Yuval Langer
0b501477f9 Fix faulty SRFI-31 example. 2025-01-20 10:52:49 +01:00
Daniel Llorens
bf3c632b82 Fix bug in srfi-111 box printer
* module/srfi/srfi-111.scm: Add missing port.
* test-suite/tests/srfi-111.test: Test.
2025-01-16 15:47:03 +01:00
Mikael Djurfeldt
8ac25f3fae README: Add dependency on autopoint 2025-01-13 22:51:35 +01:00
Tomas Volf
f6359a4715
doc: srfi-19: Use day' instead of date' for `make-date'.
Looking at the SRFI-19 specification, the argument is called `day', not
`date'.  Even the accessor is called `date-day'.  So adjust the
documentation to match.

Also adjust the (web http) module, which was using `date' as well.

* doc/ref/srfi-modules.texi (SRFI-19 Date): Use `day' instead of `date'.
* module/web/http.scm (parse-rfc-822-date, parse-rfc-850-date)
(parse-asctime-date): Same.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:46:11 +01:00
Maxim Cournoyer
98ffeacf2c
doc: Document SRFI-64.
This is an import of the 'Abstract', 'Rationale', and 'Specification'
sections from the upstream specification text, with some manual
adjustment.

* doc/ref/srfi-modules.texi (SRFI 64): New subsection.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:46:11 +01:00
Ekaitz Zarraga
c9d0a0c48c
doc: Add explanation on how to avoid escaping in SXML
* doc/ref/sxml.texi (Reading and Writing XML): Add explanation on using
  a procedure to avoid escaping.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:46:11 +01:00
Ekaitz Zarraga
d987e7e7cb
doc: Fix typo in SXML section.
* doc/ref/sxml.texi (Reading and Writing XML): Remove "."

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:45:59 +01:00
Ekaitz Zarraga
6750f6cc80
PEG: string-peg: Add HTML5 grammar test.
* test-suite/tests/peg.test (comment-grammar): Z can be anything.
("simple comment with forbidden char"): Remove.
(html-grammar, html-example): New variables.
("parsing with complex grammars"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:17:39 +01:00
Ekaitz Zarraga
38ad264979
PEG: string-peg: Better support for escaping.
* module/ice-9/peg/string-peg.scm (peg-as-peg): Augment with rules for
hexadecimal digits, “\uXXX” for characters, “\t” for tabs, etc.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:14:12 +01:00
Ekaitz Zarraga
c86a48a92f
PEG: string-peg: Fix [^...] interpretation.
* module/ice-9/peg/string-peg.scm (NotInClass->defn): Adjust.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:14:04 +01:00
Adam Faiz
c2829e4a86 New line or field iteration procedures in (ice-9 rdelim)
* NEWS: Update
* module/ice-9/rdelim (for-rdelim-from-port, for-delimited-from-port,
  for-line-in-file): New procedures.
* doc/ref/api-io.texi: Documentation of `for-rdelim-for-port`-related
  procedures.
* test-suite/tests/rdelim.test: Tests for `for-rdelim-for-port`-related
  procedures.

Signed-off-by: Mikael Djurfeldt <mikael@djurfeldt.com>
2024-12-19 22:36:38 +01:00
Mikael Djurfeldt
a9c079b13b goops.test: Add tests for define-method* 2024-12-11 22:43:17 +01:00
Rob Browning
35f13806af scm_i_utf8_string_hash: don't overrun when len is zero
When the length is zero, the previous code would include the byte after
the end of the string in the hash.  Fix that (the wide and narrow
hashers also guard against it via "case 0"), and don't bother mutating
length for the trailing bytes.

Since we already compute the char length, use that to detect all ASCII
strings and follow the same narrow string path that we do for latin-1.

libguile/hash.c (scm_i_utf8_string_hash): avoid overrun when len == 0.
2024-12-11 11:46:40 -06:00
Rob Browning
c45e1f57ec scm_i_utf8_string_hash: switch to u8_mbtouc
libguile/hash.c (scm_i_utf8_string_hash): Switch from u8_mbtouc_unsafe
to u8_mbtouc since the unsafe variant is now the same (see the info
pages).
2024-12-11 11:21:47 -06:00
Mikael Djurfeldt
98c8a014b2 Add clarification about the less predicate passed to merge and sort 2024-12-09 23:46:20 +01:00
Ekaitz Zarraga
25504ba216
PEG: Add support for not-in-range and [^...]
Modern PEG supports inversed class like `[^a-z]` that would get any
character not in the `a-z` range. This commit adds support for that and
also for a new `not-in-range` PEG pattern for scheme.

* module/ice-9/peg/codegen.scm (cg-not-in-range): New function.
* module/ice-9/peg/string-peg.scm: Add support for `[^...]`
* test-suite/tests/peg.test: Test it.
* doc/ref/api-peg.texi: Document accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-09 18:15:01 +01:00
Ekaitz Zarraga
ff11753df1
PEG: Add full support for PEG + some extensions
This commit adds support for PEG as described in:

    <https://bford.info/pub/lang/peg.pdf>

It adds support for the missing features (comments, underscores in
identifiers and escaping) while keeping the extensions (dashes in
identifiers, < and <--).

The naming system tries to be as close as possible to the one proposed
in the paper.

* module/ice-9/peg/string-peg.scm: Rewrite PEG parser.
* test-suite/tests/peg.test: Fix import

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-09 18:13:08 +01:00
Mikael Djurfeldt
47807c9b11 Temporarily revert commit 7379049d3 (to make Guile bootstrap) 2024-12-06 10:26:29 +01:00
Rob Browning
76afb429ee Eight byte align statically allocated stringbufs
Previously they were unaligned, unlike their parent strings, and so
could end up with the wrong pointer tag.  Observed on i686-linux-gnu,
where they ended up tagged as immediates (SCM_IMP()), causing failures
in TYP7 related checks.

* libguile/strings.h (SCM_IMMUTABLE_STRINGBUF): align resulting buffer
  via SCM_ALIGNED(8).
2024-11-29 12:24:57 -06:00
Mikael Djurfeldt
c78abcb765 Updated GOOPS sections of reference
* doc/ref/goops.texi: Insert reference to the "definition" of
next-method the first time next-method is mentioned. Place the
definition of next-method in index. Don't use capital methods in generic
function names (corrected only in one node). In section about
next-method, say that you can provide custom arguments (which we can now
due to the optimizing compiler). New node "Inheritance and accessors"
explaining how new accessor methods are created for subclasses.
2024-11-28 21:54:30 +01:00
Mikael Djurfeldt
20405089de test-suite: Canonicalize path in test directory
* test-suite/tests/filesys.test: Canonicalize path in the chdir tests to
avoid false differences due to following links.
2024-11-27 14:59:04 +01:00
Mikael Djurfeldt
382d890026 Bugfix: Recursively use method*, not method, in method*
* module/oop/goops.scm (method*): Do not use method.
2024-11-27 13:27:46 +01:00
Mikael Djurfeldt
d2756503f1 Spell Tomas Volf's name correctly in NEWS 2024-11-27 00:00:03 +01:00
Mikael Djurfeldt
c569f98d81 Add comment about (oop goops keyword-formals) 2024-11-26 19:49:50 +01:00
Mikael Djurfeldt
fe05646f7c New module (oop goops keyword-formals)
This module replaces the method and define-method bindings with their
method* and define-method* counterparts, for use by users who prefer not
to use both kinds of syntactic forms.

* module/oop/goops/keyword-formals.scm: New module.
* am/bootstrap.am: Added
* doc/ref/goops.texi: Document this change.
2024-11-26 19:02:07 +01:00
Mikael Djurfeldt
a3c77cb8da Update NEWS 2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
5307329d1a Document method* and define-method* 2024-11-25 21:47:53 +01:00