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

4114 commits

Author SHA1 Message Date
Ludovic Courtès
f8f8986e4a 'sort-labels-locally' uses a transient intset.
* module/language/cps/renumber.scm (sort-labels-locally): Use a
transient intset.
2020-03-23 22:49:47 +01:00
Andy Wingo
ef6f7ce70b Fix fixpoint computation in compute-significant-bits
* module/language/cps/specialize-numbers.scm (preserve-eq?): New
  helper.
  (sigbits-union): Use the new helper.  Fixes bugs.gnu.org/38486.
  Thanks to Zack Marvel for the bug report and Matt Wette for tracking
  it down.
2020-03-23 14:49:03 +01:00
Nguyễn Thái Ngọc Duy
cefbfac520 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>
2020-03-07 16:14:23 +01:00
Ludovic Courtès
d3a775ff10 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.
2020-03-07 15:50:22 +01:00
Ludovic Courtès
076276c4f5 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.
2020-03-06 23:04:12 +01:00
Ludovic Courtès
8a25546a94 Remove extra 'error' call in 'make-record-type'.
* module/ice-9/boot-9.scm (make-record-type)[computed-fields]: Remove
extra 'error' call.
2020-03-06 18:07:06 +01:00
Ludovic Courtès
d49453259b 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.
2020-03-06 18:06:51 +01:00
Ludovic Courtès
4cfe0c1014 psyntax: 'include' no longer rejects relative file names.
Fixes a regression introduced in commit
fd2ffc649c 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.
2020-03-05 23:04:05 +01:00
Andy Wingo
7dc90a17e0 Add type checkers for lsh/immediate and rsh/immediate
* module/language/cps/types.scm (lsh/immediate, rsh/immediate): New type
  checkers.
2020-02-12 15:57:12 +01:00
Andy Wingo
a706b7e465 Fold (logior 0 INT) to INT
* module/language/cps/type-fold.scm (logior): Integer-valued operands
  to (logior 0 EXPR) should fold to EXPR.
2020-02-12 15:40:14 +01:00
Ludovic Courtès
7e7d8b778c 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.
2020-02-08 11:28:59 +01:00
Ludovic Courtès
ff14b77ff5 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.
2020-01-29 15:19:37 +01:00
Ludovic Courtès
c4b2bd3781 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.
2020-01-29 15:19:37 +01:00
Ludovic Courtès
bf1f5422bd 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'.
2020-01-23 21:46:28 +01:00
Ludovic Courtès
1b8e9ca0e3 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'.
2020-01-21 17:56:13 +01:00
Ludovic Courtès
f329837fd1 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.
2020-01-20 11:43:28 +01:00
Ludovic Courtès
7b90947294 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.
2020-01-20 11:41:38 +01:00
Ludovic Courtès
5f1ed870ea 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.
2020-01-20 10:29:52 +01:00
Ludovic Courtès
d47061db23 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.
2020-01-18 23:33:01 +01:00
Andy Wingo
bea8660c44 Disable eta-expansion in letrectification
* module/language/tree-il/letrectify.scm: Disable eta-expansion, as we
  now do that after peval.
2020-01-15 16:11:20 +01:00
Andy Wingo
2993c2d873 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.
2020-01-15 16:11:15 +01:00
Andy Wingo
b6dfc84fd4 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.
2020-01-14 09:39:28 +01:00
Andy Wingo
b47bf2434c Update REPL copyright year to 2020
* module/system/repl/common.scm (*version*): Update.
2020-01-14 09:37:45 +01:00
Ludovic Courtès
c3daf58b89 web: Update comment regarding the 'tls-wrap' port wrapper.
* module/web/client.scm (tls-wrap): Update comment.
2020-01-13 11:07:05 +01:00
Ludovic Courtès
38f14ce65d 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'.
2020-01-13 11:06:01 +01:00
Ludovic Courtès
bcba213284 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'.
2020-01-13 11:06:01 +01:00
Ludovic Courtès
80bbebef4d 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>
2020-01-13 11:06:01 +01:00
Ludovic Courtès
c9b83a27c7 web: Adjust (gnutls) loading to new module autoload semantics.
Prior to commit cb14fd2143 (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 cb14fd2143.

* 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'.
2020-01-13 11:06:01 +01:00
Andy Wingo
ad88afdc5e Bump user-visible copyright years to 2020
* module/ice-9/command-line.scm (version-etc):
* module/scripts/compile.scm (show-version): Bump to 2020.
2020-01-13 08:36:23 +01:00
Andy Wingo
53a3602b20 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.
2020-01-13 08:01:40 +01:00
Tim Gesthuizen
1733efe236 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.
2020-01-12 22:18:41 +01:00
Andy Wingo
4dd4d286cc Fix typos in previous commit.
* module/ice-9/boot-9.scm (record-modifier):
* module/rnrs/records/procedural.scm (make-record-type-descriptor): Fix
  typos.
2020-01-12 22:01:54 +01:00
Andy Wingo
86a9f9a271 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.
2020-01-12 21:51:22 +01:00
Andy Wingo
cf53854d42 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.
2020-01-12 21:11:09 +01:00
Andy Wingo
fd2ffc649c 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.
2020-01-12 20:31:47 +01:00
Andy Wingo
8fcfcabec8 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.
2020-01-11 11:50:44 +01:00
Andy Wingo
8068994ba8 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).
2020-01-10 21:42:26 +01:00
Daniel Llorens
6cfee36543 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.
2020-01-06 09:44:01 +01:00
Daniel Llorens
ddad8ae05a 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.
2020-01-03 13:01:04 +01:00
Ludovic Courtès
76e436c892 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.
2019-12-14 23:56:12 +01:00
Ludovic Courtès
0b2ae37094 srfi-35: Replace '&error'.
* module/srfi/srfi-35.scm: Move '&error' to new #:re-export-and-replace
clause.
2019-12-14 18:37:43 +01:00
Andy Wingo
70ad8a2e72 Reduce quo, rem, mod for power-of-two divisors
* module/language/cps/type-fold.scm (power-of-two?): New helper.
  (quo, rem, mod): New reducers for when the denominator is a power of
  two.
2019-12-09 21:48:20 +01:00
Andy Wingo
2178de4d38 Allow for inexact integers in quo, rem, and so on
* module/language/cps/types.scm (&integer): New helper definition.
  (quo, rem, mod): Fix to allow inexact integer results :(
  (even?): Allow inexact integer arguments.
2019-12-09 21:08:43 +01:00
Andy Wingo
d14e8fabb3 Fix resolve-r6rs-interface to propagate replacement flags
* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): Fix to
  propagate module-replacements correctly for custom interfaces.
2019-12-06 15:38:08 +01:00
Daniel Llorens
2b6083865a Single definition of (iota)
* module/ice-9/boot-9.scm (iota): Fix to be SRFI-1 compatible.
* module/srfi/srfi-1.scm: Re-export iota.
2019-12-06 14:14:30 +01:00
Andy Wingo
6c6867d570 Effects analysis treats the fixed parts of objects specially
* module/language/cps/effects-analysis.scm (&header): New memory kind,
  for the fixed parts of objects.  Distinguishing init-only memory
  allows us to determine that vector-set! doesn't stomple
  vector-length.
  (annotation->memory-kind*): New helper, mapping references to fixed
  offsets to &header.  Use for scm-ref/immediate et al.
2019-12-06 10:23:53 +01:00
Andy Wingo
e63e266105 Allocations and raw mutating operations restrict to mutable types
* module/language/cps/types.scm (annotation->mutable-type): New helper.
  (allocate-words, allocate-words/immediate): Define objects of mutable
  type.
  (scm-set!/tag, scm-set!, scm-set!/immediate, word-set!)
  (word-set!/immediate): Restrict to mutable types.
2019-12-05 17:04:43 +01:00
Andy Wingo
cb14fd2143 Propagate replacement flag for autoload interfaces
* module/ice-9/boot-9.scm (make-autoload-interface): Propagate replaced
  binding flags to autoload interface.
2019-12-05 14:05:51 +01:00
Andy Wingo
0f61d8d797 Add --r6rs and --r7rs options to "guild compile"
* module/scripts/compile.scm (%options, compile): Add --r6rs and --r7rs
  options.
* doc/ref/api-evaluation.texi (Compilation): Add docs.
2019-12-02 17:32:34 +01:00
Andy Wingo
82127b3ad9 Add guile-3, r6rs, r7rs cond-expand features
* module/ice-9/boot-9.scm (%cond-expand-features): Add new features.
* doc/ref/srfi-modules.texi (SRFI-0): Document new features.
2019-12-02 14:34:52 +01:00