Add functions referenced by children to their parent.

This commit is contained in:
Juan Jose Garcia Ripoll 2012-11-11 01:49:20 +01:00
parent 26aeb1c1c2
commit f316c42396
2 changed files with 10 additions and 3 deletions

View file

@ -89,8 +89,7 @@
body-c1form)))
(defun child-function-p (presumed-parent fun)
(declare (si::c-local)
(optimize speed))
(declare (optimize speed))
(loop for real-parent = (fun-parent fun)
while real-parent
do (if (eq real-parent presumed-parent)

View file

@ -131,7 +131,15 @@ The function thus belongs to the type of functions that ecl_make_cfun accepts."
(reduce #'add-referred-variables-to-function
(mapcar #'fun-referenced-vars (fun-referenced-funs fun))
:initial-value fun)
(update-fun-closure-type-many (fun-child-funs fun))
;; Add all non-global functions which are referenced by children
;; excluding those created inside this function.
(loop with children = (fun-child-funs fun)
for child in children
do (loop for f in (fun-referenced-funs child)
unless (or (fun-global f)
(child-function-p fun f))
do (pushnew f (fun-referenced-funs fun)))
finally (update-fun-closure-type-many children))
(update-fun-closure-type fun)
(when global
(if (fun-closure fun)