From 8375acd89ba695e2fc838fffd5211a5ddf9c3b0d Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Wed, 14 Jul 2004 20:29:51 +0000 Subject: [PATCH 1/1] 0.8.12.34: Make more types known to the cross-compiler at birth ... mostly s/defstruct/def!struct/ and s/deftype/def!type/ on a few choice-chosen forms (revealed by sprof) ... maybe the compiler is slightly faster now --- src/compiler/assem.lisp | 42 +++++++++++++++++++-------------------- src/compiler/early-assem.lisp | 7 +++---- src/compiler/main.lisp | 12 +++++------ src/compiler/node.lisp | 44 ++++++++++++++++++++--------------------- src/compiler/sset.lisp | 2 +- src/compiler/vop.lisp | 12 +++++------ version.lisp-expr | 2 +- 7 files changed, 60 insertions(+), 61 deletions(-) diff --git a/src/compiler/assem.lisp b/src/compiler/assem.lisp index 3a9e453..4651bd2 100644 --- a/src/compiler/assem.lisp +++ b/src/compiler/assem.lisp @@ -185,7 +185,7 @@ ;; branch delay slot. variable-length) -(defstruct (instruction +(def!struct (instruction (:include sset-element) (:conc-name inst-) (:constructor make-instruction (number emitter attributes delay)) @@ -670,16 +670,16 @@ ;;;; structure used during output emission ;;; common supertype for all the different kinds of annotations -(defstruct (annotation (:constructor nil) - (:copier nil)) +(def!struct (annotation (:constructor nil) + (:copier nil)) ;; Where in the raw output stream was this annotation emitted? (index 0 :type index) ;; What position does that correspond to? (posn nil :type (or index null))) -(defstruct (label (:include annotation) - (:constructor gen-label ()) - (:copier nil)) +(def!struct (label (:include annotation) + (:constructor gen-label ()) + (:copier nil)) ;; (doesn't need any additional information beyond what is in the ;; annotation structure) ) @@ -690,11 +690,11 @@ (format stream "L~D" (sb!c:label-id label)))) ;;; a constraint on how the output stream must be aligned -(defstruct (alignment-note (:include annotation) - (:conc-name alignment-) - (:predicate alignment-p) - (:constructor make-alignment (bits size fill-byte)) - (:copier nil)) +(def!struct (alignment-note (:include annotation) + (:conc-name alignment-) + (:predicate alignment-p) + (:constructor make-alignment (bits size fill-byte)) + (:copier nil)) ;; the minimum number of low-order bits that must be zero (bits 0 :type alignment) ;; the amount of filler we are assuming this alignment op will take @@ -704,9 +704,9 @@ ;;; a reference to someplace that needs to be back-patched when ;;; we actually know what label positions, etc. are -(defstruct (back-patch (:include annotation) - (:constructor make-back-patch (size fun)) - (:copier nil)) +(def!struct (back-patch (:include annotation) + (:constructor make-back-patch (size fun)) + (:copier nil)) ;; the area affected by this back-patch (size 0 :type index :read-only t) ;; the function to use to generate the real data @@ -716,10 +716,10 @@ ;;; amount of stuff output depends on label positions, etc. ;;; BACK-PATCHes can't change their mind about how much stuff to emit, ;;; but CHOOSERs can. -(defstruct (chooser (:include annotation) - (:constructor make-chooser - (size alignment maybe-shrink worst-case-fun)) - (:copier nil)) +(def!struct (chooser (:include annotation) + (:constructor make-chooser + (size alignment maybe-shrink worst-case-fun)) + (:copier nil)) ;; the worst case size for this chooser. There is this much space ;; allocated in the output buffer. (size 0 :type index :read-only t) @@ -735,9 +735,9 @@ ;;; This is used internally when we figure out a chooser or alignment ;;; doesn't really need as much space as we initially gave it. -(defstruct (filler (:include annotation) - (:constructor make-filler (bytes)) - (:copier nil)) +(def!struct (filler (:include annotation) + (:constructor make-filler (bytes)) + (:copier nil)) ;; the number of bytes of filler here (bytes 0 :type index)) diff --git a/src/compiler/early-assem.lisp b/src/compiler/early-assem.lisp index 2450168..317b100 100644 --- a/src/compiler/early-assem.lisp +++ b/src/compiler/early-assem.lisp @@ -31,14 +31,14 @@ (def!constant assembly-unit-bits 8) (def!constant assembly-unit-mask (1- (ash 1 assembly-unit-bits))) -(deftype assembly-unit () +(def!type assembly-unit () `(unsigned-byte ,assembly-unit-bits)) ;;; Some functions which accept assembly units can meaningfully accept ;;; signed values with the same number of bits and silently munge them ;;; into appropriate unsigned values. (This is handy behavior e.g. ;;; when assembling branch instructions on the X86.) -(deftype possibly-signed-assembly-unit () +(def!type possibly-signed-assembly-unit () `(or assembly-unit (signed-byte ,assembly-unit-bits))) @@ -47,6 +47,5 @@ ;;; better then that ourselves. (def!constant max-alignment sb!vm:n-lowtag-bits) - -(deftype alignment () +(def!type alignment () `(integer 0 ,max-alignment)) diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index 74ab7bb..3a96c2b 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -661,7 +661,7 @@ ;;; A FILE-INFO structure holds all the source information for a ;;; given file. -(defstruct (file-info (:copier nil)) +(def!struct (file-info (:copier nil)) ;; If a file, the truename of the corresponding source file. If from ;; a Lisp form, :LISP. If from a stream, :STREAM. (name (missing-arg) :type (or pathname (member :lisp :stream))) @@ -684,11 +684,11 @@ ;;; The SOURCE-INFO structure provides a handle on all the source ;;; information for an entire compilation. -(defstruct (source-info - #-no-ansi-print-object - (:print-object (lambda (s stream) - (print-unreadable-object (s stream :type t)))) - (:copier nil)) +(def!struct (source-info + #-no-ansi-print-object + (:print-object (lambda (s stream) + (print-unreadable-object (s stream :type t)))) + (:copier nil)) ;; the UT that compilation started at (start-time (get-universal-time) :type unsigned-byte) ;; the FILE-INFO structure for this compilation diff --git a/src/compiler/node.lisp b/src/compiler/node.lisp index a07551f..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 @@ -421,7 +421,7 @@ ;;; 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 @@ -460,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 @@ -494,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. @@ -1095,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)) @@ -1109,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) @@ -1125,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-) @@ -1144,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 @@ -1171,7 +1171,7 @@ ;;; 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) @@ -1186,7 +1186,7 @@ ;;; 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) @@ -1195,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. @@ -1207,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) @@ -1229,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) @@ -1261,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) @@ -1277,7 +1277,7 @@ ;;; continuation, it is delivered to our VALUE lvar. The original exit ;;; lvar is the exit node's LVAR; physenv analysis also makes it the ;;; lvar of %NLX-ENTRY call. -(defstruct (exit (:include valued-node) +(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 @@ -1294,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) diff --git a/src/compiler/sset.lisp b/src/compiler/sset.lisp index cbf8f47..4f7f1eb 100644 --- a/src/compiler/sset.lisp +++ b/src/compiler/sset.lisp @@ -19,7 +19,7 @@ ;;; SSET-ELEMENT structure. We allow an initial value of NIL to mean ;;; that no ordering has been assigned yet (although an ordering must ;;; be assigned before doing set operations.) -(defstruct (sset-element (:constructor nil) +(def!struct (sset-element (:constructor nil) (:copier nil)) (number nil :type (or index null))) diff --git a/src/compiler/vop.lisp b/src/compiler/vop.lisp index 32ba37b..1d2c031 100644 --- a/src/compiler/vop.lisp +++ b/src/compiler/vop.lisp @@ -419,8 +419,8 @@ ;;; A VOP is a Virtual Operation. It represents an operation and the ;;; operands to the operation. -(defstruct (vop (:constructor make-vop (block node info args results)) - (:copier nil)) +(def!struct (vop (:constructor make-vop (block node info args results)) + (:copier nil)) ;; VOP-INFO structure containing static info about the operation (info nil :type (or vop-info null)) ;; the IR2-BLOCK this VOP is in @@ -459,8 +459,8 @@ ;;; A TN-REF object contains information about a particular reference ;;; to a TN. The information in TN-REFs largely determines how TNs are ;;; packed. -(defstruct (tn-ref (:constructor make-tn-ref (tn write-p)) - (:copier nil)) +(def!struct (tn-ref (:constructor make-tn-ref (tn write-p)) + (:copier nil)) ;; the TN referenced (tn (missing-arg) :type tn) ;; Is this is a write reference? (as opposed to a read reference) @@ -742,7 +742,7 @@ ;;; the SC structure holds the storage base that storage is allocated ;;; in and information used to select locations within the SB -(defstruct (sc (:copier nil)) +(def!struct (sc (:copier nil)) ;; name, for printing and reference (name nil :type symbol) ;; the number used to index SC cost vectors @@ -814,7 +814,7 @@ ;;;; TNs -(defstruct (tn (:include sset-element) +(def!struct (tn (:include sset-element) (:constructor make-random-tn) (:constructor make-tn (number kind primitive-type sc)) (:copier nil)) diff --git a/version.lisp-expr b/version.lisp-expr index 7638b99..8cbdfed 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.12.33" +"0.8.12.34" -- 1.7.10.4