diff options
author | Andy Wingo <wingo@pobox.com> | 2012-04-23 17:56:28 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-04-23 21:52:25 +0200 |
commit | 985702f7131e11c7c13aa75db19d10525c34fecd (patch) | |
tree | d98a87f5b2355cf5be7eb1541c2a60a9836339aa /test-suite/tests/peval.test | |
parent | f6a554a6aa0832432cec9c9c18b99fad56008997 (diff) | |
download | guile-985702f7131e11c7c13aa75db19d10525c34fecd.tar.gz |
avoid emitting degenerate aliases in peval
* module/language/tree-il/peval.scm (<operand>, make-operand)
(make-bound-operands, peval): Avoid emitting needless aliases in
degenerate cases of let.
(visit-operand): If we visit an operand with a fresh counter and have
to abort, record that fact.
* test-suite/tests/peval.test ("partial evaluation"): Add a test.
Diffstat (limited to 'test-suite/tests/peval.test')
-rw-r--r-- | test-suite/tests/peval.test | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test-suite/tests/peval.test b/test-suite/tests/peval.test index 5305dea72..987b06cca 100644 --- a/test-suite/tests/peval.test +++ b/test-suite/tests/peval.test @@ -985,4 +985,18 @@ (pass-if-peval resolve-primitives (car '(1 2)) - (const 1))) + (const 1)) + + ;; If we bail out when inlining an identifier because it's too big, + ;; but the identifier simply aliases some other identifier, then avoid + ;; residualizing a reference to the leaf identifier. The bailout is + ;; driven by the recursive-effort-limit, which is currently 100. We + ;; make sure to trip it with this recursive sum thing. + (pass-if-peval resolve-primitives + (let ((x (let sum ((n 0) (out 0)) + (if (< n 10000) + (sum (1+ n) (+ out n)) + out)))) + ((lambda (y) (list y)) x)) + (let (x) (_) (_) + (apply (primitive list) (lexical x _))))) |