X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fnode.lisp;h=24243aab30e97450098d911277c8d6d58d68d9c8;hb=75b52379bdc2269961af6a1308eca63610f38ac3;hp=5988f8623410313f6a5035397cf26863443f346a;hpb=5af8c2ae56df139842270bd9c9605c5d4b2d5148;p=sbcl.git diff --git a/src/compiler/node.lisp b/src/compiler/node.lisp index 5988f86..24243aa 100644 --- a/src/compiler/node.lisp +++ b/src/compiler/node.lisp @@ -83,7 +83,7 @@ (print-unreadable-object (x stream :type t :identity t) (format stream " #~D" (cont-num x)))) -(defstruct (node (:constructor nil) +(def!struct (node (:constructor nil) (:copier nil)) ;; unique ID for debugging #!+sb-show (id (new-object-id) :read-only t) @@ -134,7 +134,7 @@ ;; can null out this slot. (tail-p nil :type boolean)) -(defstruct (valued-node (:conc-name node-) +(def!struct (valued-node (:conc-name node-) (:include node) (:constructor nil) (:copier nil)) @@ -189,7 +189,7 @@ ;;; order. This latter numbering also forms the basis of the block ;;; numbering in the debug-info (though that is relative to the start ;;; of the function.) -(defstruct (cblock (:include sset-element) +(def!struct (cblock (:include sset-element) (:constructor make-block (start)) (:constructor make-block-key) (:conc-name block-) @@ -250,7 +250,7 @@ ;;; The BLOCK-ANNOTATION class is inherited (via :INCLUDE) by ;;; different BLOCK-INFO annotation structures so that code ;;; (specifically control analysis) can be shared. -(defstruct (block-annotation (:constructor nil) +(def!struct (block-annotation (:constructor nil) (:copier nil)) ;; The IR1 block that this block is in the INFO for. (block (missing-arg) :type cblock) @@ -272,9 +272,9 @@ ;;; size of flow analysis problems, this allows back-end data ;;; structures to be reclaimed after the compilation of each ;;; component. -(defstruct (component (:copier nil) - (:constructor - make-component (head tail &aux (last-block tail)))) +(def!struct (component (:copier nil) + (:constructor + make-component (head tail &aux (last-block tail)))) ;; unique ID for debugging #!+sb-show (id (new-object-id) :read-only t) ;; the kind of component @@ -372,7 +372,9 @@ ;; has already been analyzed, but new references have been added by ;; inline expansion. Unlike NEW-FUNCTIONALS, this is not disjoint ;; from COMPONENT-LAMBDAS. - (reanalyze-functionals nil :type list)) + (reanalyze-functionals nil :type list) + (delete-blocks nil :type list) + (nlx-info-generated-p nil :type boolean)) (defprinter (component :identity t) name #!+sb-show id @@ -419,10 +421,11 @@ ;;; boundaries by requiring that the exit ctrans initially head their ;;; blocks, and then by not merging blocks when there is a cleanup ;;; change. -(defstruct (cleanup (:copier nil)) +(def!struct (cleanup (:copier nil)) ;; the kind of thing that has to be cleaned up (kind (missing-arg) - :type (member :special-bind :catch :unwind-protect :block :tagbody)) + :type (member :special-bind :catch :unwind-protect + :block :tagbody :dynamic-extent)) ;; the node that messes things up. This is the last node in the ;; non-messed-up environment. Null only temporarily. This could be ;; deleted due to unreachability. @@ -457,7 +460,7 @@ ;;; structure is attached to INFO and used to keep track of ;;; associations between these names and less-abstract things (like ;;; TNs, or eventually stack slots and registers). -- WHN 2001-09-29 -(defstruct (physenv (:copier nil)) +(def!struct (physenv (:copier nil)) ;; the function that allocates this physical environment (lambda (missing-arg) :type clambda :read-only t) ;; This ultimately converges to a list of all the LAMBDA-VARs and @@ -491,7 +494,7 @@ ;;; The tail set is somewhat approximate, because it is too early to ;;; be sure which calls will be tail-recursive. Any call that *might* ;;; end up tail-recursive causes TAIL-SET merging. -(defstruct (tail-set) +(def!struct (tail-set) ;; a list of all the LAMBDAs in this tail set (funs nil :type list) ;; our current best guess of the type returned by these functions. @@ -592,6 +595,8 @@ ;; true if there was ever a REF or SET node for this leaf. This may ;; be true when REFS and SETS are null, since code can be deleted. (ever-used nil :type boolean) + ;; is it declared dynamic-extent? + (dynamic-extent nil :type boolean) ;; some kind of info used by the back end (info nil)) @@ -784,9 +789,12 @@ ;; :DELETED ;; This function has been found to be uncallable, and has been ;; marked for deletion. + ;; + ;; :ZOMBIE + ;; Effectless [MV-]LET; has no BIND node. (kind nil :type (member nil :optional :deleted :external :toplevel :escape :cleanup :let :mv-let :assignment - :toplevel-xep)) + :zombie :toplevel-xep)) ;; Is this a function that some external entity (e.g. the fasl dumper) ;; refers to, so that even when it appears to have no references, it ;; shouldn't be deleted? In the old days (before @@ -1087,7 +1095,7 @@ ;;; A REF represents a reference to a LEAF. REF-REOPTIMIZE is ;;; initially (and forever) NIL, since REFs don't receive any values ;;; and don't have any IR1 optimizer. -(defstruct (ref (:include valued-node (reoptimize nil)) +(def!struct (ref (:include valued-node (reoptimize nil)) (:constructor make-ref (leaf &aux (leaf-type (leaf-type leaf)) @@ -1101,7 +1109,7 @@ leaf) ;;; Naturally, the IF node always appears at the end of a block. -(defstruct (cif (:include node) +(def!struct (cif (:include node) (:conc-name if-) (:predicate if-p) (:constructor make-if) @@ -1117,7 +1125,7 @@ consequent alternative) -(defstruct (cset (:include valued-node +(def!struct (cset (:include valued-node (derived-type (make-single-value-type *universal-type*))) (:conc-name set-) @@ -1136,7 +1144,7 @@ ;;; and multiple value combinations. In a let-like function call, this ;;; node appears at the end of its block and the body of the called ;;; function appears as the successor; the NODE-LVAR is null. -(defstruct (basic-combination (:include valued-node) +(def!struct (basic-combination (:include valued-node) (:constructor nil) (:copier nil)) ;; LVAR for the function @@ -1147,20 +1155,23 @@ (args nil :type list) ;; the kind of function call being made. :LOCAL means that this is a ;; local call to a function in the same component, and that argument - ;; syntax checking has been done, etc. Calls to known global - ;; functions are represented by storing the FUN-INFO for the - ;; function in this slot. :FULL is a call to an (as yet) unknown - ;; function. :ERROR is like :FULL, but means that we have discovered - ;; that the call contains an error, and should not be reconsidered - ;; for optimization. - (kind :full :type (or (member :local :full :error) fun-info)) + ;; syntax checking has been done, etc. Calls to known global + ;; functions are represented by storing :KNOWN in this slot and the + ;; FUN-INFO for that function in the FUN-INFO slot. :FULL is a call + ;; to an (as yet) unknown function, or to a known function declared + ;; NOTINLINE. :ERROR is like :FULL, but means that we have + ;; discovered that the call contains an error, and should not be + ;; reconsidered for optimization. + (kind :full :type (member :local :full :error :known)) + ;; if a call to a known global function, contains the FUN-INFO. + (fun-info nil :type (or fun-info null)) ;; some kind of information attached to this node by the back end (info nil)) ;;; The COMBINATION node represents all normal function calls, ;;; including FUNCALL. This is distinct from BASIC-COMBINATION so that ;;; an MV-COMBINATION isn't COMBINATION-P. -(defstruct (combination (:include basic-combination) +(def!struct (combination (:include basic-combination) (:constructor make-combination (fun)) (:copier nil))) (defprinter (combination :identity t) @@ -1172,18 +1183,10 @@ "")) args))) -(defun call-full-like-p (call) - (declare (type combination call)) - (let ((kind (basic-combination-kind call))) - (or (eq kind :full) - (and (fun-info-p kind) - (null (fun-info-templates kind)) - (not (fun-info-ir2-convert kind)))))) - ;;; An MV-COMBINATION is to MULTIPLE-VALUE-CALL as a COMBINATION is to ;;; FUNCALL. This is used to implement all the multiple-value ;;; receiving forms. -(defstruct (mv-combination (:include basic-combination) +(def!struct (mv-combination (:include basic-combination) (:constructor make-mv-combination (fun)) (:copier nil))) (defprinter (mv-combination) @@ -1192,7 +1195,7 @@ ;;; The BIND node marks the beginning of a lambda body and represents ;;; the creation and initialization of the variables. -(defstruct (bind (:include node) +(def!struct (bind (:include node) (:copier nil)) ;; the lambda we are binding variables for. Null when we are ;; creating the LAMBDA during IR1 translation. @@ -1204,7 +1207,7 @@ ;;; return values and represents the control transfer on return. This ;;; is also where we stick information used for TAIL-SET type ;;; inference. -(defstruct (creturn (:include node) +(def!struct (creturn (:include node) (:conc-name return-) (:predicate return-p) (:constructor make-return) @@ -1226,7 +1229,7 @@ ;;; The CAST node represents type assertions. The check for ;;; TYPE-TO-CHECK is performed and then the VALUE is declared to be of ;;; type ASSERTED-TYPE. -(defstruct (cast (:include valued-node) +(def!struct (cast (:include valued-node) (:constructor %make-cast)) (asserted-type (missing-arg) :type ctype) (type-to-check (missing-arg) :type ctype) @@ -1236,9 +1239,12 @@ ;; NIL ;; No type check is necessary (VALUE type is a subtype of the TYPE-TO-CHECK.) ;; + ;; :EXTERNAL + ;; Type check will be performed by NODE-DEST. + ;; ;; T ;; A type check is needed. - (%type-check t :type (member t nil)) + (%type-check t :type (member t :external nil)) ;; the lvar which is checked (value (missing-arg) :type lvar)) (defprinter (cast :identity t) @@ -1255,7 +1261,7 @@ ;;; The ENTRY node serves to mark the start of the dynamic extent of a ;;; lexical exit. It is the mess-up node for the corresponding :ENTRY ;;; cleanup. -(defstruct (entry (:include node) +(def!struct (entry (:include node) (:copier nil)) ;; All of the EXIT nodes for potential non-local exits to this point. (exits nil :type list) @@ -1269,8 +1275,9 @@ ;;; continuation and the exit continuation's DEST. Instead of using ;;; the returned value being delivered directly to the exit ;;; continuation, it is delivered to our VALUE lvar. The original exit -;;; lvar is the exit node's LVAR. -(defstruct (exit (:include valued-node) +;;; lvar is the exit node's LVAR; physenv analysis also makes it the +;;; lvar of %NLX-ENTRY call. +(def!struct (exit (:include valued-node) (:copier nil)) ;; the ENTRY node that this is an exit for. If null, this is a ;; degenerate exit. A degenerate exit is used to "fill" an empty @@ -1287,7 +1294,7 @@ ;;;; miscellaneous IR1 structures -(defstruct (undefined-warning +(def!struct (undefined-warning #-no-ansi-print-object (:print-object (lambda (x s) (print-unreadable-object (x s :type t)