-
-
Save death/cec04d179e607657f409364442bf2a04 to your computer and use it in GitHub Desktop.
series: fix fragment wrappers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b58e86e2adb3f8922a04a727e1d387861eaf78ca Mon Sep 17 00:00:00 2001 | |
From: death <death@adeht.org> | |
Date: Wed, 6 May 2020 19:31:54 +0300 | |
Subject: [PATCH] fix fragment wrappers | |
The code is likely suboptimal... | |
--- | |
s-code.lisp | 20 ++++++++++++++++++++ | |
1 file changed, 20 insertions(+) | |
diff --git a/s-code.lisp b/s-code.lisp | |
index 65a2a6c..224ea2f 100644 | |
--- a/s-code.lisp | |
+++ b/s-code.lisp | |
@@ -6012,6 +6012,26 @@ value, the old value is not clobbered." | |
(push (cons (car e) (cadr (cdr e))) input-info))) | |
(doaux (v (aux frag)) | |
(propagate-types (cdr v) (aux frag) input-info)) | |
+ ;; -------------------------------------------------------------------------- | |
+ ;; The following fixes the wrappers so that they use the correct | |
+ ;; argument names, as they have been renamed by SERIES. | |
+ ;; -------------------------------------------------------------------------- | |
+ ;; Test case: | |
+ ;; | |
+ ;; (defun scan-lines (file) | |
+ ;; (declare (optimizable-series-function)) | |
+ ;; (scan-file file #'read-line)) | |
+ ;; | |
+ ;; (collect (scan-lines "foo")) | |
+ ;; | |
+ (cl:let* ((args (args frag)) | |
+ (old (mapcar (lambda (sym) (code (fr sym))) args)) | |
+ (new (mapcar #'var args)) | |
+ (alist (mapcar #'cons old new))) | |
+ (setf (wrappers frag) | |
+ (mapcar (lambda (wrapper) (sublis alist wrapper)) | |
+ (wrappers frag)))) | |
+ ;; -------------------------------------------------------------------------- | |
frag)) | |
(cl:defun compute-optimizable-series-fn (definer name lambda-list expr-list) | |
-- | |
2.26.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment