~ chicken-core (chicken-5) 0cca92ea9ca8dfef2b2edafa95948e1afd511beb
commit 0cca92ea9ca8dfef2b2edafa95948e1afd511beb Author: felix <felix@call-with-current-continuation.org> AuthorDate: Mon Oct 1 19:47:54 2012 +0200 Commit: Peter Bex <peter.bex@xs4all.nl> CommitDate: Mon Oct 1 19:14:37 2012 +0100 Copy-propagation of global that refers to intrinsic If a variable is known to be bound to a global variable which itself refers to an intrinsic function (one of the "standard-" or "extended" bindings, that get specifically treated in call position by the compiler), than references to the former variable will be replaced with the latter. Signed-off-by: Peter Bex <peter.bex@xs4all.nl> diff --git a/compiler.scm b/compiler.scm index 5f93164c..f6467331 100644 --- a/compiler.scm +++ b/compiler.scm @@ -2149,7 +2149,8 @@ (if (eq? '##core#variable (node-class value)) (let ((varname (first (node-parameters value)))) (or (not (get db varname 'global)) - (variable-mark varname '##core#always-bound))) + (variable-mark varname '##core#always-bound) + (intrinsic? varname))) (not (expression-has-side-effects? value db)) )) undefined) ) (quick-put! plist 'removable #t) )Trap