platform/upstream/guile.git
5 years agoGNU Guile 3.0.1. v3.0.1
Ludovic Courtès [Sun, 8 Mar 2020 14:57:36 +0000 (15:57 +0100)]
GNU Guile 3.0.1.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_CURRENT): Increment.
(LIBGUILE_INTERFACE_REVISION): Reset.
(LIBGUILE_INTERFACE_AGE): Increment.  This accounts for commit
228ae549ca651d9e9e7a7b02d282d0408bd6c9e6, which adds new symbols to the ABI.

5 years agoUpdate NEWS.
Ludovic Courtès [Sun, 8 Mar 2020 14:49:44 +0000 (15:49 +0100)]
Update NEWS.

* NEWS: Update.

5 years agoUpdate NEWS.
Ludovic Courtès [Sat, 7 Mar 2020 15:56:34 +0000 (16:56 +0100)]
Update NEWS.

* NEWS: Update.

5 years agoREADME mentions development dependencies.
Ludovic Courtès [Sat, 7 Mar 2020 15:53:28 +0000 (16:53 +0100)]
README mentions development dependencies.

Reported by Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org>.

* README: Mention packages needed when building from Git.

5 years agoREADME no longer says it's a prerelease.
Ludovic Courtès [Sat, 7 Mar 2020 15:49:14 +0000 (16:49 +0100)]
README no longer says it's a prerelease.

Reported by Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org>.

* README: Remove mention of a prerelease.

5 years agoAccept .sld as scheme extensions in r7rs
Nguyễn Thái Ngọc Duy [Fri, 14 Feb 2020 23:46:07 +0000 (06:46 +0700)]
Accept .sld as scheme extensions in r7rs

This is similar to 0bb980f12 (New function: install-r6rs!, 2019-09-25)
which accepts .sls extension for r6rs. In r7rs, most portable libraries
use .sld.

* module/ice-9/boot-9.scm (install-r7rs!): Update %load-extensions.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
5 years agoUpdate NEWS.
Ludovic Courtès [Sat, 7 Mar 2020 14:52:54 +0000 (15:52 +0100)]
Update NEWS.

* NEWS: Update.

5 years agoActually run '00-repl-server.test'.
Ludovic Courtès [Sat, 7 Mar 2020 14:59:48 +0000 (15:59 +0100)]
Actually run '00-repl-server.test'.

This is a followup to ddcab06f20525d975503d8d9611e02021fb0dff1.  Until
now the tests would always be marked as unresolved because TMPDIR was
removed before the client and server had been started.

* test-suite/tests/00-repl-server.test (call-with-repl-server): Remove
initial call to 'rmdir'.  Add calls to 'delete-file' and 'rmdir' in the
unwind handler.

5 years agopsyntax: Preserve source location information for top-level references.
Ludovic Courtès [Sat, 7 Mar 2020 14:50:13 +0000 (15:50 +0100)]
psyntax: Preserve source location information for top-level references.

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

* module/ice-9/psyntax.scm (expand-expr): In 'build-global-reference'
call, pass S when (source-annotation (car e)) returns #f.
* module/ice-9/psyntax-pp.scm: Regenerate.

5 years agoweb: Client treats TLS "premature termination" error as EOF.
Ludovic Courtès [Fri, 6 Mar 2020 22:04:12 +0000 (23:04 +0100)]
web: Client treats TLS "premature termination" error as EOF.

Fixes <https://bugs.gnu.org/39800>.
Reported by <franco.rcr@gmail.com>.

* module/web/client.scm (tls-wrap)[read!]: Catch 'gnutls-error around
'get-bytevector-some' call.

5 years agoRemove extra 'error' call in 'make-record-type'.
Ludovic Courtès [Fri, 6 Mar 2020 16:59:51 +0000 (17:59 +0100)]
Remove extra 'error' call in 'make-record-type'.

* module/ice-9/boot-9.scm (make-record-type)[computed-fields]: Remove
extra 'error' call.

5 years agoFix expansion of 'error' primitive with a non-constant argument.
Ludovic Courtès [Fri, 6 Mar 2020 16:57:20 +0000 (17:57 +0100)]
Fix expansion of 'error' primitive with a non-constant argument.

Fixes <https://bugs.gnu.org/39509>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.

* module/language/tree-il/primitives.scm (error): Remove extra "?"
argument when the first argument is not a constant.
* test-suite/tests/tree-il.test ("primitives")["error"]: New test
prefix.

5 years agoAdd 'hash' test for keywords.
Ludovic Courtès [Fri, 6 Mar 2020 16:17:41 +0000 (17:17 +0100)]
Add 'hash' test for keywords.

This is a followup to 8b3cad618314f02ad3921fa104f17ca0f721dfcb.

* test-suite/tests/hash.test ("hash")["keyword"]: New test prefix.

5 years ago'hash' behaves like 'hashq' for tc7s without an 'equal?' implementation.
Ludovic Courtès [Fri, 6 Mar 2020 16:15:45 +0000 (17:15 +0100)]
'hash' behaves like 'hashq' for tc7s without an 'equal?' implementation.

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

* libguile/hash.c (scm_raw_ihash): Add cases for scm_tc7 values that
were not explicitly listed.

5 years agopsyntax: 'include' no longer rejects relative file names.
Ludovic Courtès [Thu, 5 Mar 2020 21:59:05 +0000 (22:59 +0100)]
psyntax: 'include' no longer rejects relative file names.

Fixes a regression introduced in commit
fd2ffc649c2d08639c2ac41c25e4ebdbeb4b151d whereby including a relative
file name would result in:

  ice-9/psyntax.scm:3254:24: attempt to include relative file name but could not determine base dir

* module/ice-9/psyntax.scm (call-with-include-port)[syntax-dirname]:
Lookup 'filename (symbol), not filename (identifier).
* module/ice-9/psyntax-pp.scm: Regenerate.

5 years agoGUILE_PKG finds guile-3.0
Andy Wingo [Tue, 3 Mar 2020 20:09:53 +0000 (21:09 +0100)]
GUILE_PKG finds guile-3.0

* meta/guile.m4 (GUILE_PKG): Drop 1.8 from default versions to look for,
  and add 3.0.

5 years agoAdd support for perf map creation
Andy Wingo [Wed, 26 Feb 2020 15:41:21 +0000 (16:41 +0100)]
Add support for perf map creation

* libguile/jit.c (create_perf_map_once, create_perf_map, perf_map): New
  locals.
  (compute_mcode): Add an entry to perf_map for emitted JIT code.

5 years agoImplement hashing for keywords, i.e. (hash #:x ...)
Rob Browning [Sun, 16 Feb 2020 18:12:08 +0000 (12:12 -0600)]
Implement hashing for keywords, i.e. (hash #:x ...)

Add keyword handling to (hash ...).  Previously it would just return the
same value for all keywords.

* libguile/hash.c (scm_raw_ihash): Add scm_tc7_keyword case.

* libguile/keywords.h (SCM_I_KEYWORD_HASH): New macro.

5 years agoFix bug restoring a JIT continuation from the interpreter
Andy Wingo [Wed, 19 Feb 2020 15:53:44 +0000 (16:53 +0100)]
Fix bug restoring a JIT continuation from the interpreter

* libguile/vm.c (push_interrupt_frame, compose_continuation): In places
  where we push on synthetic frames before possibly going back to mcode,
  make sure that the return mcode will trampoline back to the
  interpreter.  Fixes compose-continuation from the interpreter to
  partial continuations with mcode.

5 years agoBetter debugging in jit.c
Andy Wingo [Wed, 19 Feb 2020 15:50:32 +0000 (16:50 +0100)]
Better debugging in jit.c

* libguile/jit.c (emit_direct_tail_call): Assert self-tail call has
  mcode.
  (opcodes_seen, bitvector_ref, bitvector_set, compile1): Make the
  opcodes_seen set more compact, and log all instruction emissions at
  level 3.
  (compute_mcode): Don't overwrite mcode if compilation fails.

5 years agoMerge remote-tracking branch 'lightening/master'
Andy Wingo [Mon, 17 Feb 2020 21:04:07 +0000 (22:04 +0100)]
Merge remote-tracking branch 'lightening/master'

5 years agoEnsure 32 bytes of stack are reserved on 64-bit Windows targets
Andy Wingo [Mon, 17 Feb 2020 21:01:14 +0000 (22:01 +0100)]
Ensure 32 bytes of stack are reserved on 64-bit Windows targets

* lightening/x86.c (reset_abi_arg_iterator): Reserve 32 stack bytes on
  64-bit Windows systems, in accordance with ABI.  Thanks a million to
  Charles Stanhope for the patch and to Mike Gran for testing!

5 years agoAdd type checkers for lsh/immediate and rsh/immediate
Andy Wingo [Wed, 12 Feb 2020 14:57:12 +0000 (15:57 +0100)]
Add type checkers for lsh/immediate and rsh/immediate

* module/language/cps/types.scm (lsh/immediate, rsh/immediate): New type
  checkers.

5 years agoFold (logior 0 INT) to INT
Andy Wingo [Wed, 12 Feb 2020 14:40:14 +0000 (15:40 +0100)]
Fold (logior 0 INT) to INT

* module/language/cps/type-fold.scm (logior): Integer-valued operands
  to (logior 0 EXPR) should fold to EXPR.

5 years agoReintroduce 'SCM_MEMORY_ERROR' in terms of 'scm_report_out_of_memory'.
Ludovic Courtès [Tue, 11 Feb 2020 13:47:16 +0000 (14:47 +0100)]
Reintroduce 'SCM_MEMORY_ERROR' in terms of 'scm_report_out_of_memory'.

Suggested by Dale P. Smith <dsmich@roadrunner.com>.

* libguile/deprecated.h (SCM_MEMORY_ERROR): New macro.
* doc/ref/api-control.texi (Dynamic Wind): Use 'scm_report_out_of_memory'.

5 years agoRemove traces of 'scm_memory_error'.
Ludovic Courtès [Sun, 9 Feb 2020 23:10:10 +0000 (00:10 +0100)]
Remove traces of 'scm_memory_error'.

'scm_memory_error' was deprecated in 2014 in commit
c2247b782a9234bb9aedee5204c30daf1d01a510 and removed in 2017 in commit
c248ea10beb2afa4c113dbc6dc707bed5dbfc92e.  This is a followup.

* libguile/error.h (SCM_MEMORY_ERROR): Remove.
* doc/guile-api.alist: Remove 'scm_memory_error'.
* doc/ref/api-control.texi (Handling Errors): Likewise.
(Dynamic Wind): Use 'scm_misc_error' instead of 'scm_memory_error'.

5 years agoFix build on ia64.
John Paul Adrian Glaubitz [Tue, 4 Feb 2020 13:14:43 +0000 (14:14 +0100)]
Fix build on ia64.

* libguile/continuations.c (capture_auxiliary_stack): Fix
  logic in preprocessor code when checking for ia64 host;
  fix dereferencing of ctx variable.
* libguile/threads.h (struct scm_thread): Add missing member
  SCM_STACKITEM *auxiliary_stack_base.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
5 years agoFix build on platforms where the stack grows upwards.
John Paul Adrian Glaubitz [Tue, 4 Feb 2020 12:11:53 +0000 (13:11 +0100)]
Fix build on platforms where the stack grows upwards.

 * libguile/continuations.c (scm_dynthrow): Fix missing mra
   parameter to grow_stack for SCM_STACK_GROWS_UP.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
5 years agoHandle GMP allocations through libgc and remove bignum finalizers.
Ludovic Courtès [Sat, 8 Feb 2020 10:32:22 +0000 (11:32 +0100)]
Handle GMP allocations through libgc and remove bignum finalizers.

This significantly speeds up loads that create lots of bignums, like
(language cps slot-allocation) for files with many top-level
definitions.  Compiling such a file is typically 2.5 times faster.

See <https://lists.gnu.org/archive/html/guile-devel/2020-02/msg00023.html>.

* libguile/numbers.c (custom_gmp_malloc): Use
'scm_gc_malloc_pointerless' instead of 'scm_malloc'.
(custom_gmp_realloc): Use 'scm_gc_realloc'.
(custom_gmp_free): Remove call to 'free'.
(make_bignum): Use 'scm_gc_malloc' instead of 'scm_gc_malloc_pointerless'.
Call 'scm_i_set_finalizer' only when SCM_INSTALL_GMP_MEMORY_FUNCTIONS is
false.

5 years agoRemove duplicate procedure in slot-allocation.scm.
Ludovic Courtès [Sat, 8 Feb 2020 10:28:59 +0000 (11:28 +0100)]
Remove duplicate procedure in slot-allocation.scm.

* module/language/cps/slot-allocation.scm (add-live-slot)
(kill-dead-slot, compute-slot): Move higher up in the file.
(compute-shuffles): Remove duplicate 'add-live-slot' procedure.

5 years agotexinfo: Properly render @acronym in plain text.
Ludovic Courtès [Wed, 29 Jan 2020 14:16:38 +0000 (15:16 +0100)]
texinfo: Properly render @acronym in plain text.

Fixes <https://bugs.gnu.org/37846>.
Reported by Christopher Baines <mail@cbaines.net>.

* module/texinfo/plain-text.scm (acronym): New procedure.
(tag-handlers): Change 'acro' handle to ACRONYM, and add 'acronym'
handler.
* test-suite/tests/texinfo.plain-text.test ("stexi->plain-text")
["acronym", "recursive acronym"]: New tests.

5 years agotexinfo: Add '*line-width*' fluid to control line wrapping.
Ludovic Courtès [Wed, 29 Jan 2020 13:56:17 +0000 (14:56 +0100)]
texinfo: Add '*line-width*' fluid to control line wrapping.

* module/texinfo/plain-text.scm (*line-width*): New variable.
(wrap*): Honor it.
* doc/ref/texinfo.texi (texinfo plain-text): Document it.
* test-suite/tests/texinfo.plain-text.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.

5 years agoFix check for rl_get_keymap
Daniel Llorens [Mon, 27 Jan 2020 21:43:56 +0000 (22:43 +0100)]
Fix check for rl_get_keymap

This lets Guile build on OS X (tested on 10.14) with the system-provided
libreadline.

* acinclude.m4 (GUILE_READLINE): Check for rl_get_keymap_name instead of
  rl_get_keymap. The system provided libreadline is an alias to libedit,
  which has _keymap but not _keymap_name, and Guile uses both.
* guile-readline/readline.c: Adjust the include guard.

5 years agoAdd missing include for strncmp()
Daniel Llorens [Mon, 27 Jan 2020 13:39:23 +0000 (14:39 +0100)]
Add missing include for strncmp()

5 years agoClarify open-input-pipe example in doc
Daniel Llorens [Fri, 24 Jan 2020 11:28:29 +0000 (12:28 +0100)]
Clarify open-input-pipe example in doc

5 years ago00-repl-server.test: don't use fixed path for socket
Rob Browning [Thu, 23 Jan 2020 03:23:16 +0000 (21:23 -0600)]
00-repl-server.test: don't use fixed path for socket

* test-suite/tests/00-repl-server.test (make-tempdir): Add.
(call-with-repl-server): Store socket in a make-tempdir dir.

5 years agostatprof: Ensure 'call-thunk' is not inlined.
Ludovic Courtès [Thu, 23 Jan 2020 20:46:28 +0000 (21:46 +0100)]
statprof: Ensure 'call-thunk' is not inlined.

Previously, 'make-stack' calls with the inner and outer cuts arguments
would always return #f because 'call-thunk' wouldn't appear on the
stack.

* module/statprof.scm <top level>: Add self-assignment to 'call-thunk'.

5 years agornrs: Export '&assertion' from (rnrs conditions).
Ludovic Courtès [Tue, 21 Jan 2020 16:56:13 +0000 (17:56 +0100)]
rnrs: Export '&assertion' from (rnrs conditions).

Fixes <https://bugs.gnu.org/39210>
Reported by Ricardo Wurmus <rekado@elephly.net>.

* module/rnrs/conditions.scm (rnrs): Import '&assertion-failure' as
'&assertion', not '&assertion-violation'.

5 years agobuild: Actually install libguile-3.0-gdb.scm.
Ludovic Courtès [Tue, 21 Jan 2020 16:51:37 +0000 (17:51 +0100)]
build: Actually install libguile-3.0-gdb.scm.

Reported by brandelune on #guile.

* libguile/libguile-2.2-gdb.scm: Rename to...
* libguile/libguile-3.0-gdb.scm: ... this.
* libguile/Makefile.am (install-data-hook): Replace hard-coded "2.2"
with @GUILE_EFFECTIVE_VERSION@.

5 years agouse2dot: Fix incorrect #:autoload binding set leading to unbound variables.
Ludovic Courtès [Mon, 20 Jan 2020 10:43:28 +0000 (11:43 +0100)]
use2dot: Fix incorrect #:autoload binding set leading to unbound variables.

* module/scripts/use2dot.scm: Load (ice-9 getopt-long) with #:use-module
rather than #:autoload.  With the previous #:autoload spec, 'option-ref'
would be unbound due to the new autoload semantics.

5 years agofrisk: Fix incorrect #:autoload binding set leading to unbound variables.
Ludovic Courtès [Mon, 20 Jan 2020 10:41:38 +0000 (11:41 +0100)]
frisk: Fix incorrect #:autoload binding set leading to unbound variables.

* module/scripts/frisk.scm: Load (ice-9 getopt-long) with #:use-module
rather than #:autoload.  With the previous #:autoload spec, 'option-ref'
would be unbound due to the new autoload semantics.

5 years agorepl: Add missing bindings in #:autoload spec.
Ludovic Courtès [Mon, 20 Jan 2020 09:29:52 +0000 (10:29 +0100)]
repl: Add missing bindings in #:autoload spec.

Fixes <https://bugs.gnu.org/39196>.
Reported by Matt Wette <matt.wette@gmail.com>.

* module/system/repl/command.scm: Augment #:autoload set of bindings.

5 years agodoc: Use gender-neutral language in Preface
shack@muto.ca [Wed, 8 Jan 2020 23:48:45 +0000 (00:48 +0100)]
doc: Use gender-neutral language in Preface

* doc/ref/preface.texi: Avoid gendered pronoun.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
5 years agoMake 'scm_sym_lambda', 'scm_sym_quote', etc. public again.
Ludovic Courtès [Mon, 20 Jan 2020 09:21:40 +0000 (10:21 +0100)]
Make 'scm_sym_lambda', 'scm_sym_quote', etc. public again.

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

These symbols had been inadvertently removed from libguile, even though
they were intended to be public (as they were in 2.2).

* libguile/expand.c: Include "memoize.h".

5 years agoexceptions: Export constructor and predicate for '&quit-exception'.
Ludovic Courtès [Sat, 18 Jan 2020 22:33:01 +0000 (23:33 +0100)]
exceptions: Export constructor and predicate for '&quit-exception'.

* module/ice-9/exceptions.scm: Re-export '&quit-exception' and export
'make-quit-exception' and 'quit-exception?'.
(quit-exception?): New procedure.

5 years agoFix version computation for v3.0 v3.0.0
Andy Wingo [Wed, 15 Jan 2020 20:34:21 +0000 (21:34 +0100)]
Fix version computation for v3.0

* configure.ac: Fix git-version-gen invocation.

5 years agoPrepare 3.0 versioning
Andy Wingo [Wed, 15 Jan 2020 20:16:00 +0000 (21:16 +0100)]
Prepare 3.0 versioning

* GUILE-VERSION (GUILE_MAJOR_VERSION, GUILE_MINOR_VERSION)
  (GUILE_MICRO_VERSION): Bump for 3.0.
  (LIBGUILE_INTERFACE_CURRENT, LIBGUILE_INTERFACE_REVISION): Bump for
  new stable series.

5 years agoUpdate release.org
Andy Wingo [Wed, 15 Jan 2020 20:15:47 +0000 (21:15 +0100)]
Update release.org

* doc/release.org: Update for 3.0

5 years agoDisable eta-expansion in letrectification
Andy Wingo [Wed, 15 Jan 2020 15:11:20 +0000 (16:11 +0100)]
Disable eta-expansion in letrectification

* module/language/tree-il/letrectify.scm: Disable eta-expansion, as we
  now do that after peval.

5 years agoAdd eta-expansion pass after peval
Andy Wingo [Wed, 15 Jan 2020 14:35:55 +0000 (15:35 +0100)]
Add eta-expansion pass after peval

* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add eta-expand.scm.
* module/language/tree-il/eta-expand.scm: New file.
* module/language/tree-il/optimize.scm (optimize)
  (tree-il-optimizations): Add eta-expansion at level 2.

5 years agoDeclarative variables optimization limits eta-expansion
Andy Wingo [Tue, 14 Jan 2020 08:39:28 +0000 (09:39 +0100)]
Declarative variables optimization limits eta-expansion

* module/language/tree-il/letrectify.scm (compute-procedures-without-identity):
  (letrectify): Only eta-expand lambda references that appear outside
  the operator position more than once.  This should restore peoples'
  expectations that (eqv? f f) without penalizing optimization.

5 years agoUpdate REPL copyright year to 2020
Andy Wingo [Mon, 13 Jan 2020 13:38:50 +0000 (14:38 +0100)]
Update REPL copyright year to 2020

* module/system/repl/common.scm (*version*): Update.

5 years agoWording tweak to history.texi
Andy Wingo [Mon, 13 Jan 2020 20:35:15 +0000 (21:35 +0100)]
Wording tweak to history.texi

* doc/ref/history.texi (A Scheme of Many Maintainers): Fix wording.

5 years agoMention Mark Weaver in Guile history section
Andy Wingo [Mon, 13 Jan 2020 20:33:29 +0000 (21:33 +0100)]
Mention Mark Weaver in Guile history section

* doc/ref/history.texi (A Scheme of Many Maintainers): Credit to Mark
  for co-maintaining Guile for more than 5 years.  Thanks!!

5 years agoUpdate NEWS
Andy Wingo [Mon, 13 Jan 2020 19:30:00 +0000 (20:30 +0100)]
Update NEWS

* NEWS: Fold incremental alpha entries into a cumulative 3.0.0 entry.

5 years agoUpdate NEWS.
Ludovic Courtès [Mon, 13 Jan 2020 10:21:09 +0000 (11:21 +0100)]
Update NEWS.

* NEWS (Changes in alpha 2.9.x): Add (web client) news.

5 years agoweb: Update comment regarding the 'tls-wrap' port wrapper.
Ludovic Courtès [Fri, 3 Jan 2020 14:44:54 +0000 (15:44 +0100)]
web: Update comment regarding the 'tls-wrap' port wrapper.

* module/web/client.scm (tls-wrap): Update comment.

5 years agoweb: 'open-socket-for-uri' can verify the server's X.509 certificate.
Ludovic Courtès [Fri, 10 Jan 2020 14:13:40 +0000 (15:13 +0100)]
web: 'open-socket-for-uri' can verify the server's X.509 certificate.

This is largely based on Guix commit
bc3c41ce36349ed4ec758c70b48a7059e363043a and subsequent changes to that
code.

* module/web/client.scm (x509-certificate-directory): New variable.
(set-certificate-credentials-x509-trust-file!*)
(make-credendials-with-ca-trust-files, peer-certificate)
(assert-valid-server-certificate, print-tls-certificate-error): New
procedures.
<top level>: Add call to 'set-exception-printer!'.
(tls-wrap): Add #:verify-certificate? parameter.  When it is true, call
'make-credendials-with-ca-trust-files', pass it to
'set-session-credentials!', and call 'assert-valid-server-certificate'.
(open-socket-for-uri): Add #:verify-certificate? parameter and pass it
to 'tls-wrap'.
(http-request): Add #:verify-certificate? parameter and pass it to
'open-socket-for-uri'.
(define-http-verb): Add #:verify-certificate? parameter and pass it to
'http-request'.
* doc/ref/web.texi (Web Client): Update documentation of
'open-socket-for-uri' and 'http-request'.  Document
'x509-certificate-directory'.

5 years agoweb: Continue handshake upon TLS warning alerts.
Ludovic Courtès [Fri, 10 Jan 2020 11:11:45 +0000 (12:11 +0100)]
web: Continue handshake upon TLS warning alerts.

This is a backport of Guix commit 7b9ac883ea62a816afbfa747c1377dc273c15c20.

* module/web/client.scm (tls-wrap): Catch 'gnutls-error' around
'handshake'.  Upon ERROR/WARNING-ALERT-RECEIVED, print a message and
call 'handshake'.

5 years agoweb: Add 'current-https-proxy' and honor $https_proxy.
Ludovic Courtès [Fri, 10 Jan 2020 11:01:39 +0000 (12:01 +0100)]
web: Add 'current-https-proxy' and honor $https_proxy.

* module/web/client.scm (current-https-proxy): New variable.
(setup-http-tunnel): New procedure.
(open-socket-for-uri): Move 'http-proxy', 'uri', and 'addresses' inside
'open-socket'.  Remove 'with-https-proxy' macro.  Add call to
'setup-http-tunnel'.  Honor 'current-https-proxy' in 'open-socket'.
* doc/ref/web.texi (Web Client): Document 'current-https-proxy'.
* doc/ref/guile.texi: Update copyright years.

Based on Guix commit 9bc8175cfa6b23c31f6c43531377d266456e430e.

Co-authored-by: Sou Bunnbu (宋文武) <iyzsong@gmail.com>
5 years agoweb: Adjust (gnutls) loading to new module autoload semantics.
Ludovic Courtès [Fri, 10 Jan 2020 09:40:02 +0000 (10:40 +0100)]
web: Adjust (gnutls) loading to new module autoload semantics.

Prior to commit cb14fd214365e50b6b1655616ae74d0228933bbd (Guile 2.9.7),
autoloading a module would give you access to all its bindings.  In
future versions, autoloading a module gives access only to the listed
bindings, as per #:select (see <https://bugs.gnu.org/38895>).

This commit adjusts autoloads to the new semantics, fixing a regression
introduced in cb14fd214365e50b6b1655616ae74d0228933bbd.

* module/web/client.scm <top level>: Remove 'module-autoload!' call.
(gnutls-module, ensure-gnutls): Remove.
(load-gnutls): New procedure.
(tls-wrap): Call it instead of 'ensure-gnutls'.  Replace reference to
GNUTLS-MODULE by a call to 'resolve-interface'.

5 years agoBump manual year, and fix NEWS typo
Andy Wingo [Mon, 13 Jan 2020 08:52:01 +0000 (09:52 +0100)]
Bump manual year, and fix NEWS typo

* NEWS: Fix a typo.
* doc/ref/guile.texi: Bump copyright year.

5 years agoGNU Guile 2.9.9 (beta). v2.9.9
Andy Wingo [Mon, 13 Jan 2020 08:11:20 +0000 (09:11 +0100)]
GNU Guile 2.9.9 (beta).

* GUILE-VERSION (GUILE_MICRO_VERSION): Bump to 2.9.9.

5 years agoBump user-visible copyright years to 2020
Andy Wingo [Mon, 13 Jan 2020 07:36:23 +0000 (08:36 +0100)]
Bump user-visible copyright years to 2020

* module/ice-9/command-line.scm (version-etc):
* module/scripts/compile.scm (show-version): Bump to 2020.

5 years agoBump objcode minor version in preparation for new stable series
Andy Wingo [Mon, 13 Jan 2020 07:01:40 +0000 (08:01 +0100)]
Bump objcode minor version in preparation for new stable series

* libguile/loader.h (SCM_OBJCODE_MINIMUM_MINOR_VERSION):
  (SCM_OBJCODE_MINOR_VERSION):
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.

5 years agosrfi-11: Do not expose variables to later clauses
Tim Gesthuizen [Tue, 3 Dec 2019 17:50:37 +0000 (18:50 +0100)]
srfi-11: Do not expose variables to later clauses

The current implementation of srfi-11s let-values allows later clauses
to access and modify variables bound in earlier clauses when the clause
is not a proper list.

* module/srfi/srfi-11.scm (let-values): Fix switched variable names.
* test-suite/tests/srfi-11.test (let-values): Add test checking that the
  variable cannot be changed in later clauses.

5 years agoUpdate NEWS
Andy Wingo [Sun, 12 Jan 2020 21:08:49 +0000 (22:08 +0100)]
Update NEWS

* NEWS: Update.

5 years agoRespect thread local fluid defaults
Rob Browning [Sun, 8 Dec 2019 17:35:37 +0000 (11:35 -0600)]
Respect thread local fluid defaults

Previously (fluid-ref (make-thread-local-fluid #t)) would return #f via
scm_fluid_ref because the internal scm_hashq_ref would return #f when
the fluid had not been set, and that was interpreted as an actual value
for the fluid.

Instead, just pass the fluid default as the default for the hash table
lookups so that we don't need a second step to determine if the fluid
was set.

Thanks to Andrew Gierth for tracking down the problem.

5 years agoFix typos in previous commit.
Andy Wingo [Sun, 12 Jan 2020 21:01:54 +0000 (22:01 +0100)]
Fix typos in previous commit.

* module/ice-9/boot-9.scm (record-modifier):
* module/rnrs/records/procedural.scm (make-record-type-descriptor): Fix
  typos.

5 years agoOptionally allow duplicate field names in core records
Andy Wingo [Sun, 12 Jan 2020 20:50:08 +0000 (21:50 +0100)]
Optionally allow duplicate field names in core records

* NEWS: Update.
* doc/ref/api-data.texi (Records): Update docs.
* module/ice-9/boot-9.scm (make-record-type): Add
  #:allow-duplicate-field-names? keyword argument.
  (record-accessor, record-modifier): Allow passing indexes to identify
  fields.
* module/rnrs/records/procedural.scm (make-record-type-descriptor):
  Allow duplicate field names.  Fixes #38611.

5 years agoFix peval bug that ignored excess args
Andy Wingo [Sun, 12 Jan 2020 20:11:09 +0000 (21:11 +0100)]
Fix peval bug that ignored excess args

* module/language/tree-il/peval.scm (peval): Fix arity check for type
  confusion (empty value of "rest" in this context was (), not #f).  The
  effect was that we'd silently allow extra arguments to inlined calls.
  Thanks to Christopher Lam for the report!  Fixes #38617.
* test-suite/tests/peval.test ("partial evaluation"): Add a test.

5 years agoSupport R7RS define-library
Andy Wingo [Sun, 12 Jan 2020 19:14:30 +0000 (20:14 +0100)]
Support R7RS define-library

* module/Makefile.am (ice-9/boot-9.go, NOCOMP_SOURCES): Add
  r7rs-libraries.
* module/ice-9/boot-9.scm ("ice-9/r7rs-libraries"): Include file.
* module/ice-9/psyntax.scm (call-with-include-port): New definition.
  (include): Use call-with-include-port.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/r7rs-libraries.scm: New file.
* module/scheme/base.scm (r7:include, r7:include-ci): Fix mistaken use
  of core "include".  Use include-ci from core.
  (features): Remove features that are already part of core.
* NEWS: Update.

5 years agoAdd NEWS entries
Andy Wingo [Sat, 11 Jan 2020 10:51:38 +0000 (11:51 +0100)]
Add NEWS entries

* NEWS: Add a couple entries.

5 years agoFix bug in closure conversion
Andy Wingo [Sat, 11 Jan 2020 10:48:36 +0000 (11:48 +0100)]
Fix bug in closure conversion

* module/language/cps/closure-conversion.scm (convert-one):
  Strongly-connected components of letrec bindings that do not share a
  closure may include member functions that have a single free variable,
  or even no free variables as a result of free variable pruning.
  Handle this case instead of erroring out.  Thanks to Stefan Israelsson
  Tampe for the report.

5 years agoFix build on 32-bit systems with JIT support
Andy Wingo [Sat, 11 Jan 2020 09:28:36 +0000 (10:28 +0100)]
Fix build on 32-bit systems with JIT support

* libguile/intrinsics.h: Add s64->f64 intrinsic, for 32-bit targets.
* libguile/jit.c (compile_s64_to_f64): Call the intrinsic for 32-bit
  targets.

5 years agoUpdate NEWS with details on guard and autoloads.
Andy Wingo [Fri, 10 Jan 2020 21:09:17 +0000 (22:09 +0100)]
Update NEWS with details on guard and autoloads.

* NEWS: Update.

5 years agoRe-implement `guard'
Andy Wingo [Fri, 10 Jan 2020 20:42:26 +0000 (21:42 +0100)]
Re-implement `guard'

* module/ice-9/exceptions.scm (guard): Add guard definition that
  re-propagates from original continuation, runs consequents in tail
  position in guard continuation, and doesn't rewind the stack.
* module/srfi/srfi-34.scm:
* module/rnrs/exceptions.scm (guard): Re-export from (ice-9
  exceptions).

5 years agoMerge remote-tracking branch 'lightening/master'
Andy Wingo [Mon, 6 Jan 2020 21:00:53 +0000 (22:00 +0100)]
Merge remote-tracking branch 'lightening/master'

5 years agoFix mips32r6 bug
Andy Wingo [Mon, 6 Jan 2020 20:58:04 +0000 (21:58 +0100)]
Fix mips32r6 bug

See also:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925129
http://hades.mech.northwestern.edu/images/1/16/MIPS32_Architecture_Volume_II-A_Instruction_Set.pdf
https://lists.gnu.org/archive/html/lightning/2019-08/msg00010.html
https://lists.gnu.org/archive/html/guile-devel/2019-08/msg00030.html

* lightening/mips-cpu.c: Fix encoding of LR.  Thanks to Bruno Haible.

5 years agoMention WebAssembly in status section
Andy Wingo [Mon, 6 Jan 2020 20:51:02 +0000 (21:51 +0100)]
Mention WebAssembly in status section

* doc/ref/history.texi (Status): Add mention of WebAssembly.

5 years agoUpdate compiler.texi and history.texi
Andy Wingo [Mon, 6 Jan 2020 20:44:39 +0000 (21:44 +0100)]
Update compiler.texi and history.texi

* doc/ref/compiler.texi (Extending the Compiler):
* doc/ref/history.texi (A Timeline of Selected Guile Releases):
  (Status): Update.  Thanks to Mikael Djurfeldt for the bug report.

5 years agoNew function string-replace-substring in (ice-9 string-fun)
Daniel Llorens [Mon, 6 Jan 2020 08:44:01 +0000 (09:44 +0100)]
New function string-replace-substring in (ice-9 string-fun)

By A. Wingo in
https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00058.html.

* module/ice-9/string-fun.scm (string-replace-substring): As stated.
* doc/ref/api-data.texi: Document the new function.
* test-suite/tests/strings.test: Test.

5 years agoExtend core vector-fill! to handle a range
Daniel Llorens [Wed, 18 Dec 2019 13:31:39 +0000 (14:31 +0100)]
Extend core vector-fill! to handle a range

With this patch, these two lines

  (vector-fill! vec fill)
  (vector-fill! vec fill 0 end)

run at the same speed; before, the second one was much slower.

This patch also makes it an error to call vector-fill! with a non-vector
array. The previous implementation did not work correctly in this case.

* libguile/vectors.c (SCM_VALIDATE_MUTABLE_VECTOR): Better error message.
  (vector-fill!): Handle optional arguments start, end. Do not attempt
    to handle non-vector arrays. Rename the C binding to
    scm_vector_fill_partial_x.
  (scm_vector_fill_x): Reuse scm_vector_fill_partial_x.
* module/srfi/srfi-43.scm (vector-fill!): Remove & re-export the core
  version instead.

5 years agoProvide SCM_DEFINE_STATIC
Daniel Llorens [Fri, 3 Jan 2020 10:59:03 +0000 (11:59 +0100)]
Provide SCM_DEFINE_STATIC

From guile-gnome:plain/glib/gnome/gobject/private.h.

* libguile/gsubr.h (SCM_DEFINE_STATIC): As stated.

5 years agoGNU Guile 2.9.8 (beta). v2.9.8
Andy Wingo [Thu, 2 Jan 2020 12:55:22 +0000 (13:55 +0100)]
GNU Guile 2.9.8 (beta).

* GUILE-VERSION (GUILE_MICRO_VERSION): Bump.

5 years agoUpdate NEWS
Andy Wingo [Thu, 2 Jan 2020 12:55:00 +0000 (13:55 +0100)]
Update NEWS

* NEWS: Update for 2.9.8.

5 years agoFix abort_to_prompt bug if dynwind leave thunk expands the stack
Andy Wingo [Thu, 2 Jan 2020 12:27:23 +0000 (13:27 +0100)]
Fix abort_to_prompt bug if dynwind leave thunk expands the stack

* libguile/vm.c (scm_i_vm_emergency_abort, abort_to_prompt): Unwinding
  the dynwind stack can run dynwind leave thunks, which may expand the
  stack, which may invalidate previously calculated SP / FP values.
  (Re)calculate SP/FP after unwinding, to avoid writing to unmapped
  memory.  Fixes compile errors seen on Ubuntu and some other ports.

5 years agosrfi-35: Generate a unique binding for the constructor.
Ludovic Courtès [Sat, 14 Dec 2019 22:56:12 +0000 (23:56 +0100)]
srfi-35: Generate a unique binding for the constructor.

Previously we'd get warnings like:

  t.scm:11:0: warning: shadows previous definition of `unused-constructor-51900bdce47d50c' at /tmp/t.scm:6:0

whenever 'define-condition-type' appeared more than once in a source
file.

* module/srfi/srfi-35.scm (define-condition-type): Rewrite as
'syntax-case' and generate UNUSED-CONSTRUCTOR as a function of TYPE.

5 years agosrfi-35: Replace '&error'.
Ludovic Courtès [Sat, 14 Dec 2019 17:37:43 +0000 (18:37 +0100)]
srfi-35: Replace '&error'.

* module/srfi/srfi-35.scm: Move '&error' to new #:re-export-and-replace
clause.

5 years agoGNU Guile 2.9.7. v2.9.7
Andy Wingo [Fri, 13 Dec 2019 12:57:04 +0000 (13:57 +0100)]
GNU Guile 2.9.7.

* GUILE-VERSION (GUILE_MICRO_VERSION): Bump.
* NEWS: Update.

5 years agoAvoid throwing exceptions during early boot if stdin is closed
Andy Wingo [Fri, 13 Dec 2019 12:52:58 +0000 (13:52 +0100)]
Avoid throwing exceptions during early boot if stdin is closed

* libguile/fports.c (scm_i_fdes_is_valid): New internal helper.
  (scm_i_fdes_to_port): Use new helper.
* libguile/fports.h: Declare new helper.
* libguile/init.c (scm_standard_stream_to_port): Refactor to use
  scm_i_fdes_is_valid.

5 years agoUpdate NEWS
Andy Wingo [Wed, 11 Dec 2019 21:01:57 +0000 (22:01 +0100)]
Update NEWS

* NEWS: Fold 2.9.6 NEWS into 3.0 NEWS.  Add NEWS for 2.9.7.

5 years agoDocument JIT environment variables
Andy Wingo [Wed, 11 Dec 2019 20:55:49 +0000 (21:55 +0100)]
Document JIT environment variables

* doc/ref/guile-invoke.texi (Environment Variables): Remove
  GUILE_STACK_SIZE which is no longer needed, and document some JIT
  debugging environment variables.
* doc/ref/vm.texi (Why a VM?, Just-In-Time Native Code): Update and link
  to environment variables documentation.

5 years agoMerge remote-tracking branch 'origin/stable-2.2'
Andy Wingo [Wed, 11 Dec 2019 20:26:54 +0000 (21:26 +0100)]
Merge remote-tracking branch 'origin/stable-2.2'

5 years agoMove less? slow path out of line
Andy Wingo [Tue, 10 Dec 2019 22:03:19 +0000 (23:03 +0100)]
Move less? slow path out of line

* libguile/jit.c (compile_less, compile_less_slow): Move slow path out
  of line.

5 years agoAdd fixnum fast-path for =
Andy Wingo [Tue, 10 Dec 2019 21:54:17 +0000 (22:54 +0100)]
Add fixnum fast-path for =

* libguile/jit.c (compile_numerically_equal): Add fixnum fast-path.
  (compile_numerically_equal_slow): New slow path.

5 years agoMove allocate-pointerless-words/immediate slow path out of line
Andy Wingo [Tue, 10 Dec 2019 21:38:45 +0000 (22:38 +0100)]
Move allocate-pointerless-words/immediate slow path out of line

* libguile/jit.c (compile_allocate_pointerless_words_immediate)
  (compile_allocate_pointerless_words_immediate_slow): Move slow path
  out of line.

5 years agoMove allocate-words/immediate slow path out of line
Andy Wingo [Tue, 10 Dec 2019 21:33:47 +0000 (22:33 +0100)]
Move allocate-words/immediate slow path out of line

* libguile/jit.c (compile_allocate_words_immediate)
  (compile_allocate_words_immediate_slow): Move slow path out of line.

5 years agoMove assert-nargs-le slow path out of line
Andy Wingo [Tue, 10 Dec 2019 21:10:06 +0000 (22:10 +0100)]
Move assert-nargs-le slow path out of line

* libguile/jit.c (compile_assert_nargs_le)
  (compile_assert_nargs_le_slow): Move slow path out of line.

5 years agoAdd out-of-line slow path for abort
Andy Wingo [Tue, 10 Dec 2019 21:07:26 +0000 (22:07 +0100)]
Add out-of-line slow path for abort

* libguile/jit.c (compile_abort, compile_abort_slow): Move interpreter
  fallback to slow path.