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

20579 commits

Author SHA1 Message Date
Daniel Llorens
118ee0c50b Fix else in init_bouncing_parens() 2021-06-02 10:48:53 +02:00
Daniel Llorens
c1fd55d174 Fix null dereference in readline initialization
* guile-readline/readline.c (init_bouncing_parens): Check that the keymap is
  valid before using it.
2021-05-27 12:00:18 +02:00
Andy Wingo
17aab66e75 Fix bug in eq-constant? propagation in CSE if kf == kt
* module/language/cps/cse.scm (compute-out-edges): Only propagate
constant to successor if successor not kf.
* test-suite/tests/compiler.test ("cse auxiliary definitions"):
("closure conversion"): Refactor.
("constant propagation"): New test.

Fixes #48368.
2021-05-24 11:09:24 +02:00
Daniel Llorens
f499754bc8 Fix bug in nftw function
Fixes bug #44182. Thanks to Matija Obid for the report and RhodiumToad in
2021-05-21 14:19:49 +02:00
Luis Felipe
d1c6ae19f4 Fix typo in lambda documentation.
In the part about lambda formals, change "arguments will converted into"
to "arguments will BE converted into".

* doc/ref/api-procedures.texi (Lambda: Basic Procedure Creation):
  Fix typo.
2021-05-21 14:03:46 +02:00
jakub-w
f3a23edf9e Fixed style for 02439a124
* guile-readline/readline.c (scm_filename_completion_function)
2021-05-19 17:33:14 +02:00
Robin Green
f9f55b9ce7 Fix trace-calls-to-procedure
Fixes #43102 and duplicate #48412.
2021-05-19 16:41:30 +02:00
Jakub Wojciech
02439a1240 Fixed filename-completion-function for readline completion
* guile-readline/readline.c (scm_filename_completion_function):
  A completion function should return #f when there's no more
  candidates.  Since the result of readline's
  rl_filename_completion_function was never checked it was impossible
  for it to work as intended and instead of #f it threw an error from
  trying to convert NULL to an scm string.
2021-05-19 15:45:05 +02:00
Maxime Devos
221203b0df Add ‘expt’ to the list of effect-free primitives.
I find myself writing code like (- (expt 2 32) 1)
lately. Let's allow constant-folding that.

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*, *effect-free-primitives*):
  Add 'expt'.
2021-05-18 13:42:34 +02:00
Andy Wingo
fd5cb457fb Implement cross-module inlining
* module/language/tree-il/optimize.scm (make-optimizer): Pass
cross-module-inlining? to peval.
* module/language/tree-il/peval.scm (peval): Add cross-module-inlining?
kwarg.  Try to inline public module-ref.
2021-05-11 21:39:07 +02:00
Andy Wingo
cbfad75fa6 Add support for recording inlinable module exports
* module/language/tree-il/inlinable-exports.scm: New module.
* am/bootstrap.am:
* module/Makefile.am:
* module/language/tree-il/optimize.scm (make-optimizer):
* module/system/base/optimize.scm (available-optimizations): Wire up new
module.
* module/ice-9/boot-9.scm (module): Add inlinable-exports field.
(define-module*): Add #:inlinable-exports kwarg.
2021-05-11 21:39:07 +02:00
Andy Wingo
a892791b43 Add pass to resolve free toplevel references in declarative modules
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES):
* module/language/tree-il/optimize.scm (make-optimizer): Wire up the new
pass.
* module/language/tree-il/resolve-free-vars.scm: New pass.
* module/system/base/optimize.scm (available-optimizations): Enable new
pass at -O1.
2021-05-11 21:39:07 +02:00
Andy Wingo
809b165128 Letrectify links module defs with uses
* module/language/tree-il/letrectify.scm (letrectify): Inline "let"
bindings inside residualized "letrec*" forms, to allow the dominator
relationship to be reflected in the scope tree.  Also, detect
"define-module*" invocations, and add these to the mod-vars set, so that
residualized "module-ensure-local-variable!" primcalls can clearly
denote their module without having to use "current-module".
2021-05-11 21:39:07 +02:00
Andy Wingo
afd268ac1d Bump objcode version
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION):
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump, as
we're going to start adding inlinable exports.
2021-05-11 21:39:07 +02:00
Andy Wingo
53e5cf654d Bump version to 3.0.7
* GUILE-VERSION (GUILE_MICRO_VERSION): Bump.  Don't update libtool
version, as the C library hasn't changed.  (Has that ever happened
before??)
2021-05-10 10:28:42 +02:00
Andy Wingo
f7fdc3edc9 Update NEWS
* NEWS: Update.
2021-05-10 10:26:12 +02:00
Andy Wingo
0991bd6af3 Update NEWS
* NEWS: Update
2021-05-10 10:24:44 +02:00
Leo Prikler
5c6a944173 bug#45131: [PATCH] Compile directly to target language if no joint is found.
This enables the compilation from "manually" written Tree-IL to
bytecode.  See also <https://bugs.gnu.org/45131>.

* system/base/compile.scm (read-and-compile)[(joint #f)]<? eof-object?>:
Join exps using the default joiner for to.
<exp>: Compute compiler for to.
* test-suite/test/compiler.test ("read-and-compile tree-il"): New test.
2021-05-10 10:16:10 +02:00
Andy Wingo
1432088f27 Minor tweak to truncate-bits
* module/system/base/types/internal.scm (truncate-bits): Use bits-case
in all cases.
2021-05-10 10:07:12 +02:00
Ludovic Courtès
93a242c0ec Update NEWS.
* NEWS: Update.
2021-05-08 22:48:25 +02:00
Ludovic Courtès
381291f5ff 'primitive-fork' closes and recreates the current thread's 'sleep_pipe'.
Partly fixes <https://bugs.gnu.org/41948>.

Previously, the child process could end up using the same 'sleep_pipe'
as its parent, leading to a race condition handling signals.

* libguile/posix.c (do_fork): New function.
(scm_fork): Call 'do_fork' via 'scm_without_guile'.
* test-suite/standalone/test-signal-fork: New test.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
2021-05-08 21:39:15 +02:00
Andrew Whatson
5a281e35f4 Close the finalization pipe before forking.
Partly fixes <https://bugs.gnu.org/41948>.
Reported by Mathieu Othacehe <othacehe@gnu.org>.

Previously, after 'fork', the child process could end up sharing the
finalization thread with its parent.

* libguile/finalizers.c (finalization_pipe): Initialize.
(reset_finalization_pipe): Factored out.
(start_finalization_thread): Create the pipe immediately before
launching the thread.  Ensure the pipe is cleaned up if thread creation
fails.  Update the finalizer callback if thread creation succeeds.
(stop_finalization_thread): Clean up the pipe after stopping the thread.
(spawn_finalizer_thread): Remove finalizer callback logic.
(scm_set_automatic_finalization_enabled): Remove pipe management.
(scm_init_finalizer_thread): Remove pipe management.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-05-08 21:31:37 +02:00
Ludovic Courtès
bef971105d Update NEWS.
* NEWS: Mention O_* constants.
2021-05-08 12:04:22 +02:00
Maxime Devos
553c82cee9 Define `O_NOFOLLOW' and various other flags when supported.
* libguile/filesys.c (scm_init_filesys): Define ‘O_IGNORE_CTTY’,
  ‘O_NOLINK’, ‘O_NOFOLLOW’, ‘O_PATH’, ‘O_TMPFILE’, ‘O_SHLOCK’,
  ‘O_EXLOCK’, ‘O_ASYNC’, ‘O_NOATIME’, ‘O_DIRECTORY’, ‘O_CLOEXEC’
  and ‘O_DIRECT’ when available.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-05-07 17:22:52 +02:00
Ludovic Courtès
a242d2d2b2 NEWS: Fix typos.
* NEWS: Fix typos in Guile 3.0.0 bit about #:verify-certificate?.
2021-05-07 17:14:14 +02:00
Andy Wingo
05614f792b Optimize truncate-bits
* module/system/base/types/internal.scm (truncate-bits): Inline cases
for 16, 32, and 64, to avoid allocating bignums for the boundary
conditions.
2021-05-06 21:51:37 +02:00
jakub-w
f10bc1a864 [srfi-64] Fix a bug with test-end removing globally installed test-runner
* testing.scm (%test-begin, %test-end): When (test-runner-current) is
not set, create a new one like before but also add a finalizer that
will remove it after the test is finished. Previously the test runner
was getting unset unconditionally.

See https://srfi-email.schemers.org/srfi-64/msg/16468240/
2021-05-05 12:29:47 +02:00
Ludovic Courtès
5969490f55 analyze: 'unbound-variable' warning handles re-exported bindings.
Fixes <https://bugs.gnu.org/47031>.

* module/language/tree-il/analyze.scm (make-use-before-definition-analysis)
[resolve]: Add case for when NAME is re-exported by MOD.
* test-suite/tests/tree-il.test ("warnings")["re-exported binding"]: New test.
2021-05-02 01:20:19 +02:00
Andy Wingo
81094013be Include config.h in mini-gmp.c, if present
* libguile/mini-gmp.c: Add config.h include.  Handles the case in which
gnulib provides some part of the standard library of mini-gmp, as is
apparently the case on FreeBSD for example.  Thanks to RhodiumToad for
the report and fix.
2021-05-01 22:39:30 +02:00
Andy Wingo
d4b7cbc68c Fix R7RS include-library-declarations and cond-expand in define-library
* module/ice-9/r7rs-libraries.scm (define-library): Fix bug handling
include-library-declarations and cond-expand subforms.  Thanks to Adam
Nelson for the fix!  Fixes #40252.
2021-05-01 22:23:06 +02:00
Andy Wingo
d643913ac2 Fix bug if call-with-prompt tag not a lexical
* module/language/tree-il/peval.scm (peval): peval could throw if the
call-with-prompt operand wasn't a lexical.  Terrible!
2021-05-01 22:16:40 +02:00
Andy Wingo
44a6a21dcc Fix tree-il effects analysis for prompts
* module/language/tree-il/effects.scm (make-effects-analyzer): The body
of a prompt is an expression only for escape-only prompts, and the
handler is always a lambda.  Fix bug where a prompt could be incorrectly
marked effect-free.
* test-suite/tests/tree-il.test ("optimize"): Add test for bug 48098.

Fixes bug 48098.
2021-05-01 22:16:20 +02:00
Andy Wingo
3383a2cb10 Fix bug for read-syntax on ( . args)
* module/ice-9/boot-9.scm: Capture syntax?.
* module/ice-9/read.scm (read-syntax): Avoid re-annotating objects.
* test-suite/tests/reader.test ("read-syntax"): Add test.
2021-05-01 20:43:07 +02:00
Andy Wingo
3bce507407 Fix syntax test
* test-suite/tests/syntax.test ("expressions"): The source location
alist is unordered.
2021-04-29 22:04:10 +02:00
Andy Wingo
ee7d18ec41 Fix syntax-violation, which was passing vectors instead of alists
* module/ice-9/psyntax.scm (syntax-violation): Pass source as an alist.
A sourcev would be better but it's incompatible.
* module/ice-9/psyntax-pp.scm: Regenerate.
2021-04-29 22:00:18 +02:00
Andy Wingo
c72a0237e3 Fix compile-psyntax.scm -- canonicalize pass not needed
* module/ice-9/compile-psyntax.scm: Remove use of canonicalization pass,
as it's not needed.  Whoopdy!
2021-04-29 21:52:27 +02:00
Ludovic Courtès
8847aaec41 bug#48096: [3.0.6] ‘syntax-error’ exceptions include vectors instead of source location properties
Hi!

In 3.0.6, a slight incompatibility crept in: ‘syntax-error’ exceptions
include vectors like #("example.scm" 1 2) instead of good’ol source
property alists.

Here is a test case that reproduces the problem:
2021-04-29 21:50:12 +02:00
Andy Wingo
7da831af18 Fix line and column for read errors
* module/ice-9/read.scm (%read): Add 1 to both line and column: the
former to make 1-based user lines instead of 0-based Guile lines, and
the latter because apparently that's how we always did it :)  Fixes
2021-04-29 21:46:31 +02:00
Ludovic Courtès
8c1a26f4d4 bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’
Ludovic Courtès <ludo@gnu.org> skribis:

> Guile 3.0.6 returns zero-indexed (instead of one-indexed) source code
> locations for ‘read-error’.  Here’s a 3.0.6/3.0.5 comparison:
>
> $ /gnu/store/r2nr74rwhpqg16y1lyi6l0jn3lwx4yyz-guile-3.0.6/bin/guile  <(echo '(')
> ice-9/read.scm:126:4: In procedure lp:
> /dev/fd/63:1:0: unexpected end of input while searching for: )
> $ guile  <(echo '(')
> ERROR: In procedure primitive-load:
> In procedure scm_i_lreadparen: /dev/fd/63:2:1: end of file

Here’s a test case waiting to succeed!  :-)
2021-04-29 21:36:21 +02:00
Andy Wingo
19f38a38fd Fix duplicates handlers for interfaces that use interfaces
* module/ice-9/boot-9.scm (duplicate-handlers): Use module-variable
instead of module-local-variable in the warn-override-core, first, and
last handlers.  Fixes #47084 mostly, though relative to pre-3.0 there is
still a difference in that a module needs to explicitly declare which
bindings are intended as replacements -- a binding being a replacement
is a property of the module in 3.0, rather than the variable as was the
case before 3.0.
2021-04-28 22:04:37 +02:00
Andy Wingo
d0eed15b28 Bump GUILE-VERSION
* GUILE-VERSION (GUILE_EFFECTIVE_VERSION): Bump
2021-04-27 22:16:48 +02:00
Andy Wingo
e49794a3bb Add ice-9/read.scm to extra_dist
* module/Makefile.am (NOCOMP_SOURCES): Add ice-9/read.scm.
2021-04-27 22:16:48 +02:00
Andy Wingo
102f0da664 Update NEWS
* NEWS: Update.
2021-04-27 21:39:55 +02:00
Andy Wingo
75babf8df9 Add GUILE_INSTALL_GMP_MEMORY_FUNCTIONS to NEWS; use at build-time
* NEWS (GUILE_INSTALL_GMP_MEMORY_FUNCTIONS): Update
* libguile/numbers.c: Add needed include.
* meta/build-env.in (GUILE_INSTALL_GMP_MEMORY_FUNCTIONS): Set when
building Guile.
2021-04-27 21:23:08 +02:00
Daniel Llorens
7f18b659b9 Remove build-aux/config.rpath
This is generated by autogen.sh.
2021-04-27 15:06:51 +02:00
Andy Wingo
12fa7d115d Fix closure-conversion bug for SCC with all free vars pruned
* module/language/cps/closure-conversion.scm (convert-one): Fix bug when
getting value of SCC whose free variables have been elided.  Thanks to
abcdw for the report!
* test-suite/tests/compiler.test ("cse auxiliary definitions"): Remove
spurious newline.
("closure conversion"): New test.
2021-04-27 14:51:38 +02:00
Andy Wingo
534dd35a3c Allow users to force gmp to use libgc
* doc/ref/guile-invoke.texi (Environment Variables): Document
GUILE_INSTALL_GMP_MEMORY_FUNCTIONS.
* libguile/numbers.c (scm_init_numbers): Use environment variable.
2021-04-26 22:27:22 +02:00
Andy Wingo
04e9245918 Bump minor objcode version for new intrinsics
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.
2021-04-26 17:05:34 +02:00
Andy Wingo
b7822d9e4a Allow contification for $callk
* module/language/cps/contification.scm (compute-first-class-functions):
(compute-functions-called-by-label):
(compute-functions):
(compute-arities):
(compute-contification-candidates):
(compute-call-graph):
(compute-contification):
(apply-contification):
(contify): Given that the frontend will produce $callk now, allow it to
be contified if such callees are all called with the same continuation.
2021-04-26 16:05:21 +02:00
Andy Wingo
c52dc02bbe CPS conversion calls module variables through trampolines
* module/language/tree-il/compile-cps.scm (module-call-stubs):
(module-call-label, convert, cps-convert/thunk): Arrange to call module
variables through out-of-line trampolines with unchecked arity.  This
should speed up compile time in large files and reduce code size on hot
paths.
2021-04-26 16:05:21 +02:00