1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-26 05:00:28 +02:00
guile/test-suite/tests
Andy Wingo 751708726b peval: visit operands on-demand, to inline mutually recursive bindings
This commit changes to use <operand> structures to hold the context
needed to visit lexical bindings lazily, in context, instead of eagerly
visiting them for value.  This laziness enables inlining of mutually
recursive bindings.

* module/language/tree-il/peval.scm (<var>): Remove comment about copy
  propagation having to run build-var-table; things don't work like that
  any more.
  (build-var-table): Build <var> entries for all variables, even
  unreferenced variables.
  (alpha-rename): Remove.  We will rename bindings on-demand now.

  (peval lookup-var): New helper, to fetch the <var> of a gensym.

  (peval fresh-gensyms): Fold here, under peval, and in it, handle
  updating the store to record a mapping between new names and <var>
  entries from the source program.

  (peval record-source-expression): Don't call build-var-table on the
  new expression, as alpha-renaming happens on-demand now.

  (peval prune-bindings): Rewrite to work with mutually-recursive
  bindings, while optionally preserving binding order.

  (peval extend-env): New helper.

  (peval loop): OK, here goes... Remove the `operand' context, as now we
  visit operands lazily.  Add a `call' context, which does not
  copy-propagate lambda expressions, used to residualize a call after
  aborting an inlining attempt.  Change the `env' to be a mapping of
  gensym to <operand>.  Instead of looking up the operand's binding then
  alpha-renaming it, just rely on the fact that visiting the operand
  will rename it if necessary.

  If we residualize a lexical, do so with the fresh name from the
  environment.  If we visit an operand and it doesn't turn out to be
  constant, we will never be able to copy it, and so cache that fact in
  the operand.  If we residualize a binding and we know what the value
  should be, record that binding so that prune-bindings won't have to
  visit it again.  If the operand folds to a constant, cache that too,
  to save effort when unrolling loops.

  For let, letrec, fix, and lambda-case, instead of visiting the
  bindings eagerly for value, simply record the source expressions and
  environments in an <operand> and rely on copy-propagation to visit
  them later in the right context.  In the case of letrec and fix, this
  allows mutually-recursive bindings to be inlined.

  Refactor folding of "constructors" (which still need renaming) to
  avoid visiting operands twice in some contexts.

  For applications, if we have to abort, process the procedure in call
  context, which allows some folding but avoids copying lambdas.  If we
  find a recursive procedure, mark intervening counters as recursive
  too, to allow for mutual recursion at the top level.

  For lambdas, if we are processing for value, record the source
  expression so we can detect recursion.  This was previously done in
  the lexical-ref copy propagator.

* test-suite/tests/tree-il.test ("partial evaluation"): Remove unused
  recursive lexicals in a couple of cases.  Add a couple test cases for
  pruning.  Add a few recursive binding cases.
2011-10-10 13:23:32 +02:00
..
00-initial-env.test Add optimized tagged integer addition/subtractions for x86_64. 2010-11-19 13:34:43 +01:00
alist.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
and-let-star.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
arbiters.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
arrays.test add docs and tests for array->list 2010-04-07 21:04:37 +02:00
asm-to-bytecode.test speed up compile-bytecode 2011-05-05 11:43:12 +02:00
bit-operations.test fix bug in ash opcode 2010-03-31 22:29:29 +02:00
bitvectors.test bitvector work 2010-08-29 20:48:32 -07:00
brainfuck.test fix brainfuck for new tree-il, and add tests 2009-10-23 15:10:25 +02:00
bytevectors.test Move with-test-prefix/c&e' to (test-suite lib)'. 2010-11-19 13:34:43 +01:00
c-api.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
chars.test Re-introduce pretty-printing of combining characters. 2010-09-15 01:02:54 +02:00
coding.test fix problems detecting coding: in block comments 2011-03-31 14:46:21 +02:00
common-list.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
compiler.test fix self tail recursion to different case-lambda clauses 2011-06-17 17:08:06 +02:00
continuations.test with-continuation-barrier calls exit(3) _after_ unwinding 2011-03-30 12:43:50 +02:00
control.test add reset and shift 2011-04-28 15:48:28 +02:00
coverage.test Fix coverage analysis of procedures called from C. 2010-09-24 15:39:47 +02:00
curried-definitions.test fix curried definitions for value defines 2010-04-08 21:01:52 +02:00
ecmascript.test Add ECMAScript parser tests. 2011-01-26 23:47:31 +01:00
elisp-compiler.test lexical function binding for elisp 2010-12-07 13:21:03 +01:00
elisp-reader.test use correct names for quasiquotation operators 2010-12-07 13:21:02 +01:00
elisp.test elisp.test cleanups 2010-04-09 22:33:46 +02:00
encoding-escapes.test Change `scm_encoding_error' to pass the port and faulty character. 2011-02-02 18:06:29 +01:00
encoding-iso88591.test Re-introduce pretty-printing of combining characters. 2010-09-15 01:02:54 +02:00
encoding-iso88597.test Use encoding-error' instead of misc-error' for string encoding errors. 2010-01-07 11:10:35 +01:00
encoding-utf8.test Re-introduce pretty-printing of combining characters. 2010-09-15 01:02:54 +02:00
eval-string.test add ice-9 eval-string 2011-03-05 23:16:11 +01:00
eval.test map and for-each in scheme 2011-05-05 23:07:37 +02:00
exceptions.test deprecate lazy-catch 2010-02-26 11:56:02 +01:00
filesys.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
fluids.test fix unbound fluid tests 2010-12-17 13:53:29 +01:00
foreign.test Fix `foreign.test' for big endian machines. 2011-05-06 17:43:37 +02:00
format.test Make `(format #f ...)' always Unicode-capable. 2011-02-08 23:14:00 +01:00
fractions.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
ftw.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
future.test futures: Support multiple-value returns. 2010-12-16 23:45:24 +01:00
gc.test Arrange so that stack-cleaning loops in GC tests are not optimized out. 2011-09-18 21:41:25 +02:00
getopt-long.test Implement #:stop-at-first-non-option option for getopt-long 2011-05-26 17:58:18 +01:00
goops.test fix scm_setter 2011-03-08 20:53:17 +01:00
guardians.test Merge branch 'master' into boehm-demers-weiser-gc 2009-08-18 00:06:45 +02:00
hash.test fix `hash' for inf and nan 2011-05-08 16:07:10 +02:00
hooks.test Enclose hooks tests in their own module. 2010-01-07 11:10:36 +01:00
i18n.test Fix `i18n.test' when the German or Greek locales aren't available. 2011-03-18 11:24:51 +01:00
import.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
interp.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
keywords.test Fix "coding:" cookies in the test suite. 2010-03-02 23:36:29 +01:00
list.test Add tests for memq' and memv'. 2011-02-07 22:12:10 +01:00
load.test change remaining %nil -> #nil 2010-04-09 21:06:29 +02:00
match.test paper around `match' bug 2011-09-24 17:16:31 +02:00
match.test.upstream Update (ice-9 match) from Chibi-Scheme. 2011-09-03 22:18:02 +02:00
modules.test fix invocation of duplicate handlers for merge-generics 2011-07-07 13:02:45 +02:00
multilingual.nottest Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
net-db.test Change getaddrinfo' test to handle the GNU-specific EAI_NODATA'. 2011-01-05 22:17:26 +01:00
numbers.test Fix the R6RS exact-integer-sqrt and import into core guile 2011-04-09 16:11:49 -04:00
optargs.test fix self-tail-calls for lexical procs with optional, rest, or kwargs 2010-12-10 16:07:58 +01:00
options.test fix up options.test 2010-09-25 12:12:45 +02:00
pairs.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
poe.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
popen-child.scm Fix hanging of popen.test 2010-07-01 22:16:54 +01:00
popen.test Portability fixes for popen.test (for when /bin/sh is not bash) 2011-03-02 14:12:53 -05:00
ports.test Fix `get_utf8_codepoint' to not consume valid starting bytes. 2011-05-07 22:47:49 +02:00
posix.test Move {total,current}-processor-count' outside of posix.c'. 2011-04-25 22:41:58 +02:00
print.test Improve handling of read macros in `pretty-print'. 2010-11-05 01:39:26 +01:00
procprop.test use procedure-minimum-arity in tests 2010-04-19 12:05:27 +02:00
procs.test Add compose', negate', and `const'. 2010-12-16 23:45:23 +01:00
q.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
r4rs.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
r5rs_pitfall.test Remove deprecation warnings from the build 2009-09-17 01:18:14 +01:00
r6rs-arithmetic-bitwise.test Implementation and test cases for the R6RS (rnrs arithmetic bitwise) 2010-05-20 21:18:02 -04:00
r6rs-arithmetic-fixnums.test Add two new sets of fast quotient and remainder operators 2011-01-30 23:00:38 +01:00
r6rs-arithmetic-flonums.test Add two new sets of fast quotient and remainder operators 2011-01-30 23:00:38 +01:00
r6rs-base.test fix assert to return true value. 2011-04-11 18:00:36 +02:00
r6rs-conditions.test Some tweaks to the R6RS support 2010-11-25 23:04:12 +01:00
r6rs-control.test Implementation and test cases for the R6RS (rnrs control) library. 2010-05-20 21:18:02 -04:00
r6rs-enums.test Enumeration set universe comparisons should be done with `equal?' 2010-11-21 15:35:44 -05:00
r6rs-eval.test Fix typo in license comment. 2010-05-20 21:18:04 -04:00
r6rs-exceptions.test Add `guard' form and test cases to R6RS (rnrs exceptions) library. 2010-05-20 21:18:03 -04:00
r6rs-files.test Implementation and test cases for R6RS (rnrs files) library. 2010-05-20 21:18:03 -04:00
r6rs-hashtables.test Fix argument passing for external hash functions in `(rnrs hashtables)'. 2010-07-14 01:16:19 -04:00
r6rs-lists.test Explicit definitions for memp' and assp' in `(rnrs list)'; the predicate 2010-08-08 20:23:14 -04:00
r6rs-ports.test rnrs io ports: fix port encoding when opening file ports 2011-05-27 15:32:01 +02:00
r6rs-records-inspection.test Implementation for the R6RS (rnrs hashtables) library; 2010-05-20 21:18:02 -04:00
r6rs-records-procedural.test Fix test suite title in comment 2010-05-20 21:18:03 -04:00
r6rs-records-syntactic.test Fix hygiene issues with `define-record-type' 2011-06-19 21:41:39 +02:00
r6rs-unicode.test Implementation and test cases for the R6RS (rnrs unicode) library. 2010-05-20 21:18:03 -04:00
ramap.test implement transcendental sin, cos etc in c; deprecate $sin, $cos, etc 2009-12-03 15:27:35 +01:00
rdelim.test Make sure binary ports pass `binary-port?' regardless of the locale. 2011-04-22 23:58:00 +02:00
reader.test fix reading of #||||# 2011-10-05 20:41:15 +02:00
receive.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
records.test make-record-type slight refactor 2010-04-19 19:33:57 +02:00
regexp.test Fix `regexp.test' when the "en_US.utf8" locale isn't available. 2010-11-24 23:38:01 +01:00
rnrs-libraries.test r6rs `import' accepts multiple clauses 2010-06-09 08:55:02 +02:00
rnrs-test-a.scm add rnrs libraries test suite 2010-05-03 22:11:15 +02:00
session.test Fix for `submodules' in (ice-9 session) (closes #30062) 2010-09-02 21:47:04 -07:00
signals.test Add define-module to signals.test 2009-10-01 21:56:49 +01:00
socket.test Add a test for send' and recv!'. 2011-01-29 21:36:59 +01:00
sort.test Fix likely crash in `stable-sort!' 2011-06-09 22:11:02 +02:00
srcprop.test no special treatment for memoized code in srcprop.c 2009-12-01 21:00:26 +01:00
srfi-1.test fix take-right and drop-right for improper lists 2011-08-12 23:26:15 +02:00
srfi-4.test Add type and range checks to the complex generalized vector accessors. 2011-07-01 19:09:29 +02:00
srfi-6.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-9.test Fix `define-inlinable' in SRFI-9 so that arguments are evaluated only once. 2011-03-11 21:02:30 +01:00
srfi-10.test add quasisyntax 2009-11-14 17:25:12 +01:00
srfi-11.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-13.test fix srfi-13 test argument orders 2011-02-02 21:55:13 +01:00
srfi-14.test copyright dates 2010-04-03 06:46:23 -07:00
srfi-17.test adapt tests to new syntax-error form 2010-11-18 11:04:15 +01:00
srfi-18.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-19.test Have srfi-19.test' use the non-deprecated format' style. 2011-01-29 21:46:44 +01:00
srfi-26.test * tests/srfi-26.test: New. 2004-01-21 00:45:48 +00:00
srfi-27.test Add implementation of SRFI 27 2010-09-27 22:15:51 +02:00
srfi-31.test fix srfi-31 check after macroexpand rename 2010-03-19 17:05:46 +01:00
srfi-34.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-35.test Fix "coding:" cookies in the test suite. 2010-03-02 23:36:29 +01:00
srfi-37.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-38.test Add implementation of SRFI 38 2010-11-03 00:19:54 +01:00
srfi-39.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-42.test Add implementation of SRFI 42 2010-10-03 12:09:50 +02:00
srfi-45.test Add implementation of SRFI 45 2010-10-03 21:54:22 +02:00
srfi-60.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-67.test Add implementation of SRFI-67 2010-10-03 12:14:21 +02:00
srfi-69.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
srfi-88.test Fix "coding:" cookies in the test suite. 2010-03-02 23:36:29 +01:00
srfi-98.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
statprof.test Unoptimize the busy loop of `statprof.test'. 2011-09-09 09:06:30 +02:00
streams.test Change Guile license to LGPLv3+ 2009-06-17 00:22:09 +01:00
strings.test Make VM string literals immutable. 2011-03-20 23:34:42 +01:00
structs.test Optimize struct initialization and accessors for the common case. 2010-01-23 16:21:13 +01:00
sxml-match-tests.ss sxml-match: Handle multiple-value returns. 2010-05-26 23:41:23 +02:00
sxml.fold.test Remove `fold' from (sxml fold). 2010-04-09 00:32:14 +02:00
sxml.match.test Add (sxml match). 2010-05-25 23:31:36 +02:00
sxml.simple.test Have sxml->xml' handle *TOP*' nodes (bug #29260). 2010-05-11 23:46:05 +02:00
sxml.ssax.test update licenses on tests imported from guile-lib 2010-04-07 21:37:50 +02:00
sxml.transform.test update licenses on tests imported from guile-lib 2010-04-07 21:37:50 +02:00
sxml.xpath.test update licenses on tests imported from guile-lib 2010-04-07 21:37:50 +02:00
symbols.test symbols with odd characters print better in #{}# 2011-04-11 13:48:11 +02:00
syncase.test allow definitions in with-syntax body 2011-03-31 13:23:27 +02:00
syntax.test allow while as an expression 2011-04-28 15:48:35 +02:00
texinfo.docbook.test update licenses on tests imported from guile-lib 2010-04-07 21:37:50 +02:00
texinfo.serialize.test update licenses on tests imported from guile-lib 2010-04-07 21:37:50 +02:00
texinfo.string-utils.test update licenses on tests imported from guile-lib 2010-04-07 21:37:50 +02:00
texinfo.test texinfo: alias url' to uref'. 2011-08-23 12:47:51 +02:00
threads.test Arrange so that stack-cleaning loops in GC tests are not optimized out. 2011-09-18 21:41:25 +02:00
time.test Modify socket and time functions for wide strings 2009-08-23 09:29:45 -07:00
tree-il.test peval: visit operands on-demand, to inline mutually recursive bindings 2011-10-10 13:23:32 +02:00
vectors.test add vector-move test cases 2011-02-14 20:21:04 +01:00
version.test Relax the `(version)' test. 2010-05-30 22:39:23 +02:00
vlist.test Add `vhash-fold-right'. 2011-05-08 18:20:42 +02:00
weaks.test fix hash-set! on weak tables 2011-06-16 12:09:13 +02:00
web-http.test RFC 822 allows single digit days of the month 2011-09-10 11:12:04 -07:00
web-request.test fix web-request.test 2011-07-18 10:37:46 +02:00
web-response.test (web response) and (web request): bodies are bytevectors 2011-01-10 22:44:36 -08:00
web-uri.test rename string->uri and uri->string. 2011-01-07 09:18:36 -08:00