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

20710 commits

Author SHA1 Message Date
Ludovic Courtès
9c03e44dcf doc: Rephrase documentation of 'thunk?'.
Fixes <https://bugs.gnu.org/41353>.
Reported by Jan Synacek <jsynacek@redhat.com>.

* doc/ref/api-procedures.texi (Procedure Properties): Rephrase
documentation of 'thunk?'.
* libguile/procs.c (scm_thunk_p): Likewise.
2020-05-27 22:34:49 +02:00
Ludovic Courtès
e7ad7eb90b doc: Reword unclear sentence about programs.
Fixes <https://bugs.gnu.org/41352>.
Reported by Jan Synacek <jsynacek@redhat.com>.

* doc/ref/api-procedures.texi (Compiled Procedures): Clarify wording.
2020-05-27 22:31:18 +02:00
Mathieu Lirzin
02a31d6885 GUILE_PKG bails out when 'pkg-config' is missing
* meta/guile.m4 (GUILE_PKG): Ensure that 'pkg-config' is available. Use
AC_REQUIRE for PKG_PROG_PKG_CONFIG to avoid unnecessary invocations.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-27 22:25:28 +02:00
Alex Sassmannshausen
f55740f0cd doc: Add reference to Guile Hall in the manual.
* doc/ref/scheme-using.texi (Distributing Guile Code): New node.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2020-05-27 22:14:56 +02:00
Ludovic Courtès
db4af31e09 doc: '@' is not equivalent to autoloading.
* doc/ref/api-modules.texi (Creating Guile Modules): Remove paragraph
about '@' as an alternative to #:autoload.
2020-05-22 22:09:51 +02:00
Ludovic Courtès
723e483e7d doc: #:autoload does not pull in all the module bindings.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.
This is a followup to cb14fd2143.

* doc/ref/api-modules.texi (Creating Guile Modules): Remove bit that
says all the bindings of an autoloaded module become available.
2020-05-22 22:06:34 +02:00
Christopher Baines
ac5df66f1c http: Support CONNECT and PATCH HTTP methods.
PATCH is described by RFC 5789 and CONNECT is described by RFC 7231.

* module/web/http.scm (parse-http-method): Support CONNECT and PATCH.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-18 09:44:00 +02:00
Linus Björnstam
922c3bd55c doc: Fix documentation for srfi-171.
* doc/ref/srfi-modules.texi (SRFI-171): Fix broken documentation.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-18 09:44:00 +02:00
Andy Wingo
087bb683c8 Update match's no-matching-pattern code to use "throw"
* module/ice-9/match.upstream.scm (match-next): Use throw, so that CPS
  can see that there's no fallthrough.
* module/ice-9/match.scm: Add a note about what to do in 3.1 to remove
  the old "error" definition.
2020-05-17 22:26:17 +02:00
Ludovic Courtès
f32ba444dd 'peval' test uses (language tree-il peval).
Fixes an unbound variable error introduced in
2c07a32ad8.

* test-suite/tests/peval.test: Use (language tree-il peval).
(peval): Remove.
2020-05-17 17:55:30 +02:00
Ludovic Courtès
0e912cee24 doc: Tweak 'pipeline' documentation.
* doc/ref/posix.texi (Pipes): Adjust markup.  Simplify example.
2020-05-16 22:36:19 +02:00
Ludovic Courtès
9971861851 Use 'pass-if-equal' for 'pipeline' tests.
* test-suite/tests/popen.test ("open-process", "piped-process")
("piped-process: with output", "pipeline"): Use 'pass-if-equal'.
2020-05-16 22:36:19 +02:00
Rutger van Beusekom
786fbcd327 popen: Add 'pipeline' procedure.
* libguile/posix.c (scm_open_process): Remove.
(scm_piped_process): Add to replace open_process.
* module/ice-9/popen.scm (pipe->fdes): Add to convert pipe pair to fdes pair.
(open-process): Add open-process for backwards compatibility.
(pipeline): Add to implement a pipeline using piped-process.
* doc/ref/posix.texi (Pipes): Document it.
* test-suite/tests/popen.test ("open-process")
("piped-process", "piped-process: with output")
("pipeline"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-16 22:36:19 +02:00
Andy Wingo
2c07a32ad8 Tree-IL lowerer only loads needed optimizations
* module/language/tree-il/optimize.scm (make-optimizer): New procedure,
  to compute an optimizer given options, lazily loading optimization
  modules.
  (optimize): Use make-optimizer.
  (make-lowerer): Use make-optimizer, so as to only load needed
  optimizations.  Speeds up bootstrap times.
2020-05-14 10:24:08 +02:00
Andy Wingo
033a67d575 Fix ,optimize to be independent of tree-il
* module/system/repl/common.scm (repl-default-options): Add
  optimization-level and warning-level REPL options.
  (repl-optimization-level, repl-warning-level): New accessors,
  defaulting to the default level parameters.
  (repl-expand): Take target language as keyword argument rather than
  hard-coding tree-il.
  (repl-optimize): Take target language as keyword argument.  Use REPL
  optimization and warning levels.  Use generic lowering interface.
2020-05-14 09:17:14 +02:00
Andy Wingo
7df3f3414b More robust reduction of equal? and eqv?
* module/language/tree-il/primitives.scm (expand-eq): Just expand out to
  binary comparisons.  Also expand eq?, which was missing.  Leave
  strength reduction to peval.
  (character-comparison-expander): Move down, as it depends on <, <=,
  and so on.
* module/language/tree-il/peval.scm (peval): Robustly reduce equal? and
  eqv?.
* test-suite/tests/peval.test ("partial evaluation"): Expect fixnum
  comparison to reduce to eq?.
  ("eqv?", "equal?"): A new battery of tests.
* test-suite/tests/tree-il.test ("primitives"): Remove reduction tests.
2020-05-13 15:51:58 +02:00
Andy Wingo
498428fbef Add with-lexicals helper; fix bug in (equal? #t (foo) #t)
* module/language/tree-il.scm (with-lexicals): New public helper.
* .dir-locals.el (with-lexicals): Add indentation rule.
* module/language/tree-il/compile-bytecode.scm (canonicalize): Use
  with-lexicals.
* module/language/tree-il/compile-cps.scm (canonicalize): Use
  with-lexicals from tree-il.
* module/language/tree-il/primitives.scm (chained-comparison-expander):
  Remove duplicate expander definitions for <, <=, and so on.
* module/language/tree-il/primitives.scm (maybe-simplify-to-eq): Avoid
  inadvertent code duplication by using with-lexicals.
  (expand-chained-comparisons): Likewise.
  (call-with-prompt): Simplify to use with-lexicals.
2020-05-13 14:51:56 +02:00
Andy Wingo
31bb0eea8c Another minor module compile order tweak
* module/Makefile.am (SOURCES): Put Tree-IL compiler early too, so that
  subsequent compilations can benefit from CPS speedups.
2020-05-13 09:39:41 +02:00
Andy Wingo
c6636ff312 Bump objcode minor version
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION):
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump, so
  that compiled files from Guile 3.0.3 will error when loaded on 3.0.2.
2020-05-13 09:37:54 +02:00
Andy Wingo
a165c49b29 Minor module/Makefile order tweak
* module/Makefile.am (ice-9/psyntax-pp.go): Add GUILE_OPTIMIZATIONS
  argument.
  (SOURCES): Reorder a bit for speed when bootstrapping.
2020-05-13 09:16:11 +02:00
Andy Wingo
c5da9d65a7 Fix optimizers after language lowerer refactor
* module/language/cps/optimize.scm (define-optimizer):
  (optimize-higher-order-cps, optimize-first-order-cps):
  (make-cps-lowerer):
* module/language/tree-il/optimize.scm (optimize, make-lowerer): In an
  embarrassing bug, after parsing optimization arguments, we were
  aconsing them instead of the expected cons*.  This meant the bootstrap
  was running all Tree-IL optimizations!  Change to have optimizers not
  have defaults and use alists after parsing.
2020-05-13 09:04:16 +02:00
Andy Wingo
132292fcb3 Punt more CPS compiler until later in bootstrap
* am/bootstrap.am (SOURCES): Punt CPS compiler until later.
2020-05-13 09:04:16 +02:00
Andy Wingo
32eef3dd14 Slight optimization to baseline compiler
* module/language/tree-il/compile-bytecode.scm (compile-closure):
  for-value-at and for-values-at take indexes instead of environments to
  denote destination.
2020-05-13 09:04:16 +02:00
Ludovic Courtès
b1bdd791ce Zero the initial file port revealed count.
Fixes <https://bugs.gnu.org/41204>.
Reported by Caleb Ristvedt <caleb.ristvedt@cune.org>.

Until now, Guile would leak the file descriptors of all the file ports
not explicitly closed.

* libguile/fports.c (scm_i_fdes_to_port): Initialize fp->revealed.
* test-suite/tests/ports.test ("initial revealed count")
("non-revealed port is closed"): New tests.
("close-port & revealed port"): Check (port-revealed port).
("revealed port fdes not closed"): Likewise.
2020-05-12 14:58:30 +02:00
Ludovic Courtès
2ba61b8aea tests: Don't use a guardian when testing for GC'd ports.
This is a followup to 1008ea3154.

* test-suite/tests/ports.test ("non-revealed port is closed"): Don't use
a guardian.
2020-05-12 14:44:53 +02:00
Andy Wingo
3385f6e08c Update NEWS for baseline compiler
* NEWS: Update.
2020-05-12 11:10:03 +02:00
Andy Wingo
6083020199 Update documentation on <language>
* doc/ref/compiler.texi (Compiler Tower): Update.
2020-05-12 10:43:10 +02:00
Andy Wingo
00a163add4 Clean up NEWS for bitvectors.
* NEWS: Cleanups.
2020-05-12 10:18:02 +02:00
Andy Wingo
9c4c6322f5 Whoops, fix bug in tree-il choose-compiler
* module/language/tree-il/spec.scm (choose-compiler): Fix spelling of
  "compile-cps" :)
2020-05-12 10:12:21 +02:00
Andy Wingo
bebf647abb Punt CPS compiler to end of bootstrap
* am/bootstrap.am (SOURCES): Compile the CPS compiler last.
2020-05-12 10:08:16 +02:00
Andy Wingo
cb8cabe85f Delay loading CPS unless CPS compiler used
* module/language/tree-il/spec.scm: Remove #:compilers declaration;
  instead rely on choose-compiler.
  (choose-compiler): Load compilers on demand.
* module/system/base/compile.scm (find-language-joint): Use next-pass
  instead of lookup-compilation-order, to avoid loading unused
  compilers.
  (read-and-compile): Adapt to find-language-joint change.
  (compute-compiler): Export.
* module/scripts/compile.scm (compile): Use compute-compiler to load
  compiler modules.
2020-05-12 09:54:19 +02:00
Andy Wingo
44ad8fbde5 Baseline FIXME's are done :)
* module/language/tree-il/compile-bytecode.scm: Remove FIXME comments.
2020-05-11 22:03:08 +02:00
Andy Wingo
b02a889659 Baseline compiler emits source locations
* module/language/tree-il/compile-bytecode.scm (compile-closure): Emit
  source annotations where we have them.
2020-05-11 16:53:23 +02:00
Andy Wingo
f66111a203 Baseline O(1) access to frame-base env
* module/language/tree-il/compile-bytecode.scm (compile-closure): No
  need to search for frame-base.
2020-05-11 16:43:08 +02:00
Andy Wingo
aed324bcd4 Slight tweaks to bootstrap order
* am/bootstrap.am (SOURCES): Compile boot-9 and compile-bytecode
  earlier.  Put intmap, intset, graphs, and vlist until later.
2020-05-11 16:28:12 +02:00
Andy Wingo
b35fd53664 Emit handle-interrupts in baseline compiler
* module/language/tree-il/compile-bytecode.scm (compile-closure): Handle
  interrupts before calls, returns, and tail calls.
2020-05-11 16:15:24 +02:00
Andy Wingo
b5108ccb2a Avoid having "guild compile" load optimizers
* module/language/cps/optimize.scm (cps-optimizations):
* module/language/tree-il/optimize.scm (tree-il-optimizations):
* module/system/base/optimize.scm (available-optimizations): Invert the
  dependency tree to hold the names and default optimization levels in a
  central place instead of in the optimizers.  It moves definitions
  farther from uses, but it avoids us having to load the CPS optimizer
  if we don't need it, which improves bootstrap times.
2020-05-11 15:42:20 +02:00
Andy Wingo
a68c80c747 Switch to baseline compiler for bootstrap/
* bootstrap/Makefile.am (GUILE_OPTIMIZATIONS): Add -Ono-cps so that we
  use the baseline compiler when bootstrapping.
2020-05-11 15:22:29 +02:00
Andy Wingo
2ba3eb4cf2 Fix shuffling assembler for new primcalls
* module/system/vm/assembler.scm (encode-X8_S8_C8_S8-C32!/shuffle): New
  shuffling assembler.
2020-05-11 15:03:19 +02:00
Andy Wingo
7f4bbc3dba Improve tail recursion in compiler
* module/language/tree-il/compile-bytecode.scm (compile-closure): Make
  it so that for-tail is actually tail-recursive.  Likewise improve tail
  recursion for the other helpers.
2020-05-11 14:48:45 +02:00
Andy Wingo
35160ade03 Reload FP if needed in bind-rest also
* libguile/jit.c (compile_bind_rest): Reload FP if needed
2020-05-11 14:41:44 +02:00
Andy Wingo
73a23027f5 Fix module capture for closures in <fix>
* module/language/tree-il/compile-bytecode.scm (compile-closure):
  Capture closures for <fix> if needed.
2020-05-11 14:36:00 +02:00
Andy Wingo
1563f5e042 Fix JIT asserts with different code generated by baseline
* libguile/jit.c (UNREACHABLE): New register state.
  (unreachable): New predicate.
  (ASSERT_HAS_REGISTER_STATE): Succeed when unreachable.
  (compile_throw, compile_throw_value, compile_throw_value_and_data):
  Set unreachable flag.
  (compile_receive_values): Reload FP if needed.
2020-05-11 14:34:35 +02:00
Andy Wingo
4c3c35c536 Fix "cons" compilation in baseline compiler in some cases
* module/language/tree-il/compile-bytecode.scm (emit-cons): Fix for case
  where car is dst but cdr isn't.
2020-05-11 13:32:39 +02:00
Andy Wingo
3b6023d66d Baseline compiler: add pop-fluid primitive.
* module/language/tree-il/compile-bytecode.scm (pop-fluid): New
  primitive.
2020-05-11 13:32:19 +02:00
Andy Wingo
527262fef0 Fix baseline compilation error for make-struct/simple
* module/language/tree-il/compile-bytecode.scm (compile-closure):
  $allocate-struct takes an SCM.
2020-05-11 13:31:40 +02:00
Andy Wingo
c0a27de50d Fix baseline miscompilation of <
* module/language/tree-il/compile-bytecode.scm: Fix < miscompilation.
2020-05-11 13:18:50 +02:00
Andy Wingo
f168a66871 guilec can be parameterized by GUILE_OPTIMIZATIONS, defaults to -O2
* am/guilec (GUILE_OPTIMIZATIONS): New var.
2020-05-11 11:39:57 +02:00
Andy Wingo
73ac53af73 Fix free var computation in baseline compiler for lexical set!
* module/language/tree-il/compile-bytecode.scm (split-closures): Adjoin
  lexical being set to free vars.
2020-05-11 11:39:53 +02:00
Andy Wingo
ffb210567d Declare #:cps? as an available optimization
* module/language/tree-il/optimize.scm (tree-il-optimizations): Add
  #:cps?, on by default from -O1.  This enables "guild compile -O2
  -Ono-cps foo.scm".
2020-05-11 11:23:24 +02:00