mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 07:12:26 -08:00
No need to compute the closure type when it is already a full closure.
This commit is contained in:
parent
9c8b0a1521
commit
26aeb1c1c2
1 changed files with 5 additions and 8 deletions
|
|
@ -133,23 +133,20 @@
|
|||
|
||||
(defun update-fun-closure-type (fun)
|
||||
(let ((old-type (fun-closure fun)))
|
||||
(when (eq old-type 'closure)
|
||||
(return-from update-fun-closure-type nil))
|
||||
;; This recursive algorithm is guaranteed to stop when functions
|
||||
;; do not change.
|
||||
(let ((new-type (compute-closure-type fun)))
|
||||
;; Same type
|
||||
(when (eq new-type old-type)
|
||||
(return-from update-fun-closure-type nil))
|
||||
;; {lexical,closure} -> no closure!
|
||||
;; closure -> {lexical, no closure}
|
||||
(when (or (and (not new-type) old-type)
|
||||
(eq old-type 'CLOSURE))
|
||||
(baboon))
|
||||
(when (fun-global fun)
|
||||
(cmpnote "Function ~A is global but is closed over some variables.~%~{~A ~}"
|
||||
(fun-name fun) (mapcar #'var-name (fun-referenced-vars fun))))
|
||||
(setf (fun-closure fun) new-type)
|
||||
;; All external, non-global variables become of type closure
|
||||
(when (eq new-type 'CLOSURE)
|
||||
(when (fun-global fun)
|
||||
(cmpnote "Function ~A is global but is closed over some variables.~%~{~A ~}"
|
||||
(fun-name fun) (mapcar #'var-name (fun-referenced-vars fun))))
|
||||
(dolist (var (fun-referenced-vars fun))
|
||||
(unless (global-var-p var)
|
||||
(setf (var-ref-clb var) nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue