summaryrefslogtreecommitdiff
path: root/module
AgeCommit message (Collapse)AuthorFilesLines
2020-06-19popen: Correct 'pipeline' docstring.Ludovic Courtès1-3/+3
* module/ice-9/popen.scm (pipeline): Change docstring for correct Texinfo syntax and to use commas instead of em dashes, as in the manual.
2020-06-19popen: 'open-process' returns unbuffered ports.Ludovic Courtès1-5/+20
* module/ice-9/popen.scm (open-process)[unbuffered, fdes-pair]: New procedures. Use them. Return unbuffered ports. * test-suite/tests/popen.test ("open-pipe*"): New test prefix.
2020-06-19Tree-IL-to-CPS compiler delays calls to 'target-most-positive-fixnum'.Ludovic Courtès1-35/+28
Fixes a bug whereby, for example, "guild compile --target=i686-linux-gnu" running on x86_64 would generate invalid code for 'bytevector-u32-native-set!' because 'target-most-positive-fixnum' was called from the top-level when (language tree-il compile-cps) was loaded. Consequently, the .go files under prebuilt/ would be invalid, leading to build failures on 32-bit platforms. This issue became apparent with cb8cabe85f535542ac4fcb165d89722500e42653. * module/language/tree-il/compile-cps.scm (bytevector-ref-converter)[tag]: Turn into a lambda so that 'target-most-positive-fixnum' is called in the right context. (bytevector-set-converter)[integer-unboxer]: Likewise.
2020-06-18web: Accept URI host names consisting only of hex digits.Ludovic Courtès1-2/+2
Fixes <https://bugs.gnu.org/40582>. Reported by Julien Lepiller <julien@lepiller.eu>. Previously, a host part consisting of hex digits would be mistaken as an IPv6 address and rejected by 'valid-host?'. * module/web/uri.scm (ipv6-regexp): Add colon. * test-suite/tests/web-uri.test ("string->uri")["xyz://abc/x/y/z"]: New test. * NEWS: Update.
2020-06-18texinfo: Add basic support for @w{...}.Ludovic Courtès2-3/+5
* module/texinfo.scm (texi-command-specs): Add 'w'. (space-significant?): Add it. * module/texinfo/html.scm (tag-replacements): Add 'w'. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add test.
2020-06-17srfi-1: Rewrite 'assoc' in Scheme.Ludovic Courtès1-0/+17
* libguile/srfi-1.c (scm_srfi1_assoc): Remove. * libguile/srfi-1.h (scm_srfi1_assoc): Likewise. * module/srfi/srfi-1.scm (assoc): New procedure.
2020-06-17srfi-1: Rewrite 'find-tail' in Scheme.Ludovic Courtès1-0/+11
* libguile/srfi-1.c (scm_srfi1_find_tail): Remove. * libguile/srfi-1.h (scm_srfi1_find_tail): Likewise. * module/srfi/srfi-1.scm (find-tail): New procedure.
2020-06-17srfi-1: Rewrite 'find' in Scheme.Ludovic Courtès1-1/+12
This halves the wall-clock time of: guile -c '(use-modules (srfi srfi-1)) (define lst (make-list 100000000 1)) (find zero? lst)' and yields an 18% speedup on: guile -c '(use-modules (srfi srfi-1)) (define lst (make-list 100000000 1)) (find (lambda (x) (= 2 x)) lst)' * libguile/srfi-1.c (scm_srfi1_find): Remove. * libguile/srfi-1.h (scm_srfi1_find): Likewise. * module/srfi/srfi-1.scm (find): New procedure. * doc/ref/srfi-modules.texi (SRFI-1 Searching): Adjust docstring.
2020-06-12Make CSE more robustAndy Wingo1-2/+6
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun): I think it's possible to get an orphan loop, with predecessors after successors in the original RPO. Handle that here.
2020-06-04Statprof reports primitive namesAndy Wingo1-9/+1
* module/statprof.scm (program-debug-info-printable): Remove unused function. (addr->printable): If the addr is a primitive, extract its name.
2020-06-01Change -O1 compiler to use baseline and also resolve primitivesAndy Wingo2-11/+3
* bootstrap/Makefile.am (GUILE_OPTIMIZATIONS): Change to just -O1. * module/language/tree-il/spec.scm (choose-compiler): Use CPS for -O2 and higher. * module/system/base/optimize.scm (available-optimizations): CPS for -O2 and higher, but -Oresolve-primitives now at -O1 also.
2020-05-31Fix bug where private bindings would never be sealedAndy Wingo1-1/+1
* module/language/tree-il/optimize.scm (make-optimizer): Fix plumbing of -Oseal-private-bindings / -O3.
2020-05-29Fix typo causing performance problems!!!Andy Wingo1-1/+1
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun): Amazingly this typo causes Guile to be 10% slower or so. Fixed!
2020-05-29CSE forward-propagates changes to CFGAndy Wingo1-1/+23
* module/language/cps/cse.scm (propagate-analysis): New helper. (eliminate-common-subexpressions-in-fun): Recompute avail and bool set in response to simplifications in predecessor CFG. Allows much better compilation of pattern-matching idioms!
2020-05-29CSE forwards branch predecessors where the branch foldsAndy Wingo1-57/+148
* module/language/cps/cse.scm (forward-cont, forward-branch) (compute-avail-and-bool-edge): New helpers. (add-equivalent-expression!): Allow idempotent adds; can happen now when revisiting a cont after changes to its predecessors. (fold-branch): New helper. (eliminate-common-subexpressions-in-fun): Allow for reductions to branch predecessors. In that case, revisit the branch, as the CFG will have changed.
2020-05-29CSE refactorAndy Wingo1-48/+68
* module/language/cps/cse.scm (eliminate-common-subexpressions-in-fun): Separate the paths for handling expressions and branches.
2020-05-29Use intmaps in CSE equivalent expression tableAndy Wingo1-33/+43
* module/language/cps/cse.scm (make-equivalent-expression-table) (intmap-select, add-equivalent-expression!) (lookup-equivalent-expressions): New helpers. (eliminate-common-subexpressions-in-fun): Adapt.
2020-05-29Eager graph pruning in CSEAndy Wingo1-90/+197
* module/language/cps/cse.scm (elide-predecessor, prune-branch) (prune-successors, term-successors): New helpers. (eliminate-common-subexpressions-in-fun): When we modify the CFG, update the analysis. Also, thread the substs map through CSE so that closures in high-level CPS can take advantage of eliminated variables. (fold-renumbered-functions): Take multiple seeds. (eliminate-common-subexpressions): Thread var substs map through CSE.
2020-05-29Macro fix to CPS build-termAndy Wingo1-1/+1
* module/language/cps.scm (build-term): Match on $branch and $throw as literals.
2020-05-29Thread flow analysis through CSE passAndy Wingo1-194/+209
* module/language/cps/cse.scm (<analysis>): New data type, grouping available expression analysis, predecessor map, etc. (eliminate-common-subexpressions-in-fun): Instead of having a static analysis, thread it through the CSE pass so that we can update the CFG as we go.
2020-05-29CSE eliminates expressions at continuationsAndy Wingo1-88/+72
* module/language/cps/cse.scm (compute-available-expressions): Take a clobber map instead of an effects map. (compute-singly-referenced): Remove unused function. (eliminate-common-subexpressions-in-fun): Keep a preds map. Use it add entries to the equiv-set and var-substs at expression continuations instead of at the expression terms themselves.
2020-05-29Refactor CSE to analyze and transform in a single passAndy Wingo1-188/+135
* module/language/cps/cse.scm (compute-truthy-expressions): Operate on a single function. (eliminate-common-subexpressions-in-fun): Instead of computing a set of labels to eliminate, go ahead and do the elimination as we go. (fold-renumbered-functions): Can just use a single seed now. (eliminate-common-subexpressions): Simplify to just fold over functions, building up renamed output as we go.
2020-05-29Refactor CSE to take advantage of RPO numberingAndy Wingo1-167/+186
* module/language/cps/cse.scm (fold-renumbered-functions): New helper. (compute-equivalent-expressions): Use new helper. (compute-equivalent-expressions-in-fun): Lift to top-level. (eliminate-common-subexpressions): Adapt.
2020-05-29Renumber before CSEAndy Wingo1-12/+14
* module/language/cps/cse.scm (compute-equivalent-subexpressions): Assume renumbered program. (eliminate-common-subexpressions): Renumber. Will allow optimizations later.
2020-05-28Slight optimization to invert-bijectionoAndy Wingo1-2/+3
* module/language/cps/graphs.scm (invert-bijection): Use a transient intmap.
2020-05-28Fix truthy expression analysis in CSEAndy Wingo1-2/+2
* module/language/cps/cse.scm (compute-truthy-expressions): The "meet" function here is union, not intersection.
2020-05-27web: 'http-get' & co. now honor #:verify-certificate?.Ludovic Courtès1-2/+4
Previously they would always assume #:verify-certificate? #t, unless #:port was given. Fixes <https://bugs.gnu.org/40486>. Reported by Jan Synacek <jsynacek@redhat.com>. * module/web/client.scm (define-http-verb): Pass #:verify-certificate? to 'open-socket-for-uri'.
2020-05-18http: Support CONNECT and PATCH HTTP methods.Christopher Baines1-0/+2
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-17Update match's no-matching-pattern code to use "throw"Andy Wingo2-5/+9
* 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-16popen: Add 'pipeline' procedure.Rutger van Beusekom1-1/+45
* 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-14Tree-IL lowerer only loads needed optimizationsAndy Wingo1-37/+39
* 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-14Fix ,optimize to be independent of tree-ilAndy Wingo1-10/+34
* 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-13More robust reduction of equal? and eqv?Andy Wingo2-56/+66
* 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-13Add with-lexicals helper; fix bug in (equal? #t (foo) #t)Andy Wingo4-73/+49
* 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-13Another minor module compile order tweakAndy Wingo1-15/+15
* module/Makefile.am (SOURCES): Put Tree-IL compiler early too, so that subsequent compilations can benefit from CPS speedups.
2020-05-13Bump objcode minor versionAndy Wingo1-1/+1
* 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-13Minor module/Makefile order tweakAndy Wingo1-36/+37
* module/Makefile.am (ice-9/psyntax-pp.go): Add GUILE_OPTIMIZATIONS argument. (SOURCES): Reorder a bit for speed when bootstrapping.
2020-05-13Fix optimizers after language lowerer refactorAndy Wingo2-41/+39
* 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-13Slight optimization to baseline compilerAndy Wingo1-34/+34
* 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-12Whoops, fix bug in tree-il choose-compilerAndy Wingo1-1/+1
* module/language/tree-il/spec.scm (choose-compiler): Fix spelling of "compile-cps" :)
2020-05-12Delay loading CPS unless CPS compiler usedAndy Wingo3-28/+25
* 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-11Baseline FIXME's are done :)Andy Wingo1-10/+0
* module/language/tree-il/compile-bytecode.scm: Remove FIXME comments.
2020-05-11Baseline compiler emits source locationsAndy Wingo1-6/+42
* module/language/tree-il/compile-bytecode.scm (compile-closure): Emit source annotations where we have them.
2020-05-11Baseline O(1) access to frame-base envAndy Wingo1-15/+10
* module/language/tree-il/compile-bytecode.scm (compile-closure): No need to search for frame-base.
2020-05-11Emit handle-interrupts in baseline compilerAndy Wingo1-2/+6
* module/language/tree-il/compile-bytecode.scm (compile-closure): Handle interrupts before calls, returns, and tail calls.
2020-05-11Avoid having "guild compile" load optimizersAndy Wingo3-36/+43
* 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-11Fix shuffling assembler for new primcallsAndy Wingo1-1/+10
* module/system/vm/assembler.scm (encode-X8_S8_C8_S8-C32!/shuffle): New shuffling assembler.
2020-05-11Improve tail recursion in compilerAndy Wingo1-12/+6
* 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-11Fix module capture for closures in <fix>Andy Wingo1-0/+2
* module/language/tree-il/compile-bytecode.scm (compile-closure): Capture closures for <fix> if needed.
2020-05-11Fix "cons" compilation in baseline compiler in some casesAndy Wingo1-1/+1
* module/language/tree-il/compile-bytecode.scm (emit-cons): Fix for case where car is dst but cdr isn't.