0.pre7.86.flaky7.23:
[sbcl.git] / src / compiler / node.lisp
index ddde59e..dcb0a69 100644 (file)
@@ -84,7 +84,7 @@
   ;; cached type of this continuation's value. If NIL, then this must
   ;; be recomputed: see CONTINUATION-DERIVED-TYPE.
   (%derived-type nil :type (or ctype null))
-  ;; Node where this continuation is used, if unique. This is always
+  ;; the node where this continuation is used, if unique. This is always
   ;; null in :DELETED and :UNUSED continuations, and is never null in
   ;; :INSIDE-BLOCK continuations. In a :BLOCK-START continuation, the
   ;; Block's START-USES indicate whether NIL means no uses or more
 ;;; A COMPONENT structure provides a handle on a connected piece of
 ;;; the flow graph. Most of the passes in the compiler operate on
 ;;; COMPONENTs rather than on the entire flow graph.
+;;;
+;;; According to the CMU CL internals/front.tex, the reason for
+;;; separating compilation into COMPONENTs is
+;;;   to increase the efficiency of large block compilations. In
+;;;   addition to improving locality of reference and reducing the
+;;;   size of flow analysis problems, this allows back-end data
+;;;   structures to be reclaimed after the compilation of each
+;;;   component.
 (defstruct (component (:copier nil))
   ;; the kind of component
   ;;
   ;; deleted or LET lambdas.
   ;;
   ;; Note that logical associations between CLAMBDAs and COMPONENTs
-  ;; seem to exist for a while before this is initialized. In
-  ;; particular, I got burned by writing some code to use this value
-  ;; to decide which components need LOCAL-CALL-ANALYZE, when it turns
-  ;; out that LOCAL-CALL-ANALYZE had a role in initializing this value
+  ;; seem to exist for a while before this is initialized. See e.g.
+  ;; the NEW-FUNS slot. In particular, I got burned by writing some
+  ;; code to use this value to decide which components need
+  ;; LOCALL-ANALYZE-COMPONENT, when it turns out that
+  ;; LOCALL-ANALYZE-COMPONENT had a role in initializing this value
   ;; (and DFO stuff does too, maybe). Also, even after it's
   ;; initialized, it might change as CLAMBDAs are deleted or merged.
   ;; -- WHN 2001-09-30
   (lambdas () :type list)
-  ;; a list of FUNCTIONAL structures for functions that are newly
-  ;; converted, and haven't been local-call analyzed yet. Initially
-  ;; functions are not in the LAMBDAS list. LOCAL-CALL-ANALYZE moves
-  ;; them there (possibly as LETs, or implicitly as XEPs if an
-  ;; OPTIONAL-DISPATCH.) Between runs of LOCAL-CALL-ANALYZE there may
-  ;; be some debris of converted or even deleted functions in this
-  ;; list.
-  (new-functions () :type list)
+  ;; a list of FUNCTIONALs for functions that are newly converted, and
+  ;; haven't been local-call analyzed yet. Initially functions are not
+  ;; in the LAMBDAS list. Local call analysis moves them there
+  ;; (possibly as LETs, or implicitly as XEPs if an OPTIONAL-DISPATCH.)
+  ;; Between runs of local call analysis there may be some debris of
+  ;; converted or even deleted functions in this list.
+  (new-funs () :type list)
   ;; If this is true, then there is stuff in this component that could
   ;; benefit from further IR1 optimization.
   (reoptimize t :type boolean)
   ;; arguments for the note, or the FUN-TYPE that would have
   ;; enabled the transformation but failed to match.
   (failed-optimizations (make-hash-table :test 'eq) :type hash-table)
-  ;; This is similar to NEW-FUNCTIONS, but is used when a function has
+  ;; This is similar to NEW-FUNS, but is used when a function has
   ;; already been analyzed, but new references have been added by
-  ;; inline expansion. Unlike NEW-FUNCTIONS, this is not disjoint from
+  ;; inline expansion. Unlike NEW-FUNS, this is not disjoint from
   ;; COMPONENT-LAMBDAS.
-  (reanalyze-functions nil :type list))
+  (reanalyze-funs nil :type list))
 (defprinter (component :identity t)
   name
   (reanalyze :test reanalyze))
 ;;; TNs, or eventually stack slots and registers). -- WHN 2001-09-29
 (defstruct (physenv (:copier nil))
   ;; the function that allocates this physical environment
-  (function (missing-arg) :type clambda)
+  (lambda (missing-arg) :type clambda :read-only t)
   #| ; seems not to be used as of sbcl-0.pre7.51
   ;; a list of all the lambdas that allocate variables in this
   ;; physical environment
   ;; some kind of info used by the back end
   (info nil))
 (defprinter (physenv :identity t)
-  function
+  lambda
   (closure :test closure)
   (nlx-info :test nlx-info))
 
 ;;; end up tail-recursive causes TAIL-SET merging.
 (defstruct (tail-set)
   ;; a list of all the LAMBDAs in this tail set
-  (functions nil :type list)
+  (funs nil :type list)
   ;; our current best guess of the type returned by these functions.
   ;; This is the union across all the functions of the return node's
   ;; RESULT-TYPE, excluding local calls.
   ;; some info used by the back end
   (info nil))
 (defprinter (tail-set :identity t)
-  functions
+  funs
   type
   (info :test info))
 
   ;;
   ;;    :EXTERNAL
   ;;   an external entry point lambda. The function it is an entry
-  ;;   for is in the ENTRY-FUNCTION slot.
+  ;;   for is in the ENTRY-FUN slot.
   ;;
   ;;    :TOPLEVEL
   ;;   a top level lambda, holding a compiled top level form.
   ;;   Compiled very much like NIL, but provides an indication of
   ;;   top level context. A :TOPLEVEL lambda should have *no*
-  ;;   references. Its ENTRY-FUNCTION is a self-pointer.
+  ;;   references. Its ENTRY-FUN is a self-pointer.
   ;;
   ;;    :TOPLEVEL-XEP
   ;;   After a component is compiled, we clobber any top level code
   ;; :TOPLEVEL lambda (which is its own XEP) this is a self-pointer.
   ;;
   ;; With all other kinds, this is null.
-  (entry-function nil :type (or functional null))
+  (entry-fun nil :type (or functional null))
   ;; the value of any inline/notinline declaration for a local function
   (inlinep nil :type inlinep)
   ;; If we have a lambda that can be used as in inline expansion for
   ;; (or one of its LETs) using a non-LET local call. This may include
   ;; deleted functions because nobody bothers to clear them out.
   (calls () :type list)
+  ;; a list of all the LAMBDA-VARs directly referred to from this
+  ;; function (or one of its LETs). This may include deleted variables
+  ;; because nobody bothers to clean them out.
+  ;;
+  ;; FIXME: This is completely analogous to the CALLS slot, except the
+  ;; elements here are LAMBDA-VARs instead of FUNCTIONALs. Maybe the
+  ;; two lists should be merged into a single list.
+  (refers-to-vars () :type list)
   ;; the TAIL-SET that this LAMBDA is in. This is null during creation.
   ;;
   ;; In CMU CL, and old SBCL, this was also NILed out when LET
 ;;; LAMBDA-VARs with no REFs are considered to be deleted; physical
 ;;; environment analysis isn't done on these variables, so the back
 ;;; end must check for and ignore unreferenced variables. Note that a
-;;; deleted lambda-var may have sets; in this case the back end is
-;;; still responsible for propagating the Set-Value to the set's Cont.
+;;; deleted LAMBDA-VAR may have sets; in this case the back end is
+;;; still responsible for propagating the SET-VALUE to the set's CONT.
 (def!struct (lambda-var (:include basic-var))
   ;; true if this variable has been declared IGNORE
   (ignorep nil :type boolean)