Compiler support for specialised implicit value cells
[sbcl.git] / src / compiler / alpha / vm.lisp
index 43e8987..d16e08a 100644 (file)
                `(eval-when (:compile-toplevel :load-toplevel :execute)
                   (def!constant ,offset-sym ,offset)
                   (setf (svref *register-names* ,offset-sym)
-                       ,(symbol-name name)))))
+                        ,(symbol-name name)))))
            (defregset (name &rest regs)
              `(eval-when  (:compile-toplevel :load-toplevel :execute)
                 (defparameter ,name
                   (list ,@(mapcar (lambda (name)
-                                   (symbolicate name "-OFFSET"))
+                                    (symbolicate name "-OFFSET"))
                                   regs))))))
   ;; c.f. src/runtime/alpha-lispregs.h
-  
+
   ;; Ra
   (defreg lip 0)
   ;; Caller saved 0-7
   (defreg nsp 30)
   ;; Wired zero
   (defreg zero 31)
-  
+
   (defregset non-descriptor-regs
     nl0 nl1 nl2 nl3 nl4 nl5 nfp cfunc)
-  
+
   (defregset descriptor-regs
     fdefn lexenv nargs ocfp lra a0 a1 a2 a3 a4 a5 l0 l1 l2)
-  
+
   (defregset *register-arg-offsets*
     a0 a1 a2 a3 a4 a5)
   (defparameter register-arg-names '(a0 a1 a2 a3 a4 a5)))
 
 (defmacro !define-storage-classes (&rest classes)
   (do ((forms (list 'progn)
-             (let* ((class (car classes))
-                    (sc-name (car class))
-                    (constant-name (intern (concatenate 'simple-string
-                                                        (string sc-name)
-                                                        "-SC-NUMBER"))))
-               (list* `(define-storage-class ,sc-name ,index
-                         ,@(cdr class))
-                      `(def!constant ,constant-name ,index)
-                      ;; (The CMU CL version of this macro did
-                      ;;   `(EXPORT ',CONSTANT-NAME)
-                      ;; here, but in SBCL we try to have package
-                      ;; structure described statically in one
-                      ;; master source file, instead of building it
-                      ;; dynamically by letting all the system code
-                      ;; modify it as the system boots.)
-                      forms)))
+              (let* ((class (car classes))
+                     (sc-name (car class))
+                     (constant-name (intern (concatenate 'simple-string
+                                                         (string sc-name)
+                                                         "-SC-NUMBER"))))
+                (list* `(define-storage-class ,sc-name ,index
+                          ,@(cdr class))
+                       `(def!constant ,constant-name ,index)
+                       ;; (The CMU CL version of this macro did
+                       ;;   `(EXPORT ',CONSTANT-NAME)
+                       ;; here, but in SBCL we try to have package
+                       ;; structure described statically in one
+                       ;; master source file, instead of building it
+                       ;; dynamically by letting all the system code
+                       ;; modify it as the system boots.)
+                       forms)))
        (index 0 (1+ index))
        (classes classes (cdr classes)))
       ((null classes)
        (nreverse forms))))
 
-(def!constant kludge-nondeterministic-catch-block-size 7)
+(def!constant kludge-nondeterministic-catch-block-size 6)
 
 (!define-storage-classes
 
   ;; The control stack.  (Scanned by GC)
   (control-stack control-stack)
 
-  ;; The non-descriptor stacks.
-  (signed-stack non-descriptor-stack
-               :element-size 2 :alignment 2) ; (signed-byte 64)
-  (unsigned-stack non-descriptor-stack
-                 :element-size 2 :alignment 2) ; (unsigned-byte 64)
-  (character-stack non-descriptor-stack) ; non-descriptor characters.
-  (sap-stack non-descriptor-stack
-            :element-size 2 :alignment 2) ; System area pointers.
-  (single-stack non-descriptor-stack) ; single-floats
-  (double-stack non-descriptor-stack
-               :element-size 2 :alignment 2) ; double floats.
-  (complex-single-stack non-descriptor-stack :element-size 2)
-  (complex-double-stack non-descriptor-stack :element-size 4 :alignment 2)
-
-
-  ;; **** Things that can go in the integer registers.
+  ;; We put ANY-REG and DESCRIPTOR-REG early so that their SC-NUMBER
+  ;; is small and therefore the error trap information is smaller.
+  ;; Moving them up here from their previous place down below saves
+  ;; ~250K in core file size.  --njf, 2006-01-27
 
   ;; Immediate descriptor objects.  Don't have to be seen by GC, but nothing
   ;; bad will happen if they are.  (fixnums, characters, header values, etc).
   (any-reg
    registers
    :locations #.(append non-descriptor-regs descriptor-regs)
-;   :locations #.non-descriptor-regs
    :constant-scs (zero immediate)
    :save-p t
    :alternate-scs (control-stack))
 
   ;; Pointer descriptor objects.  Must be seen by GC.
   (descriptor-reg registers
-                  :locations #.descriptor-regs
-                  :constant-scs (constant null immediate)
-                  :save-p t
-                  :alternate-scs (control-stack))
+   :locations #.descriptor-regs
+   :constant-scs (constant null immediate)
+   :save-p t
+   :alternate-scs (control-stack))
+
+  ;; The non-descriptor stacks.
+  (signed-stack non-descriptor-stack
+                :element-size 2 :alignment 2) ; (signed-byte 64)
+  (unsigned-stack non-descriptor-stack
+                  :element-size 2 :alignment 2) ; (unsigned-byte 64)
+  (character-stack non-descriptor-stack) ; non-descriptor characters.
+  (sap-stack non-descriptor-stack
+             :element-size 2 :alignment 2) ; System area pointers.
+  (single-stack non-descriptor-stack) ; single-floats
+  (double-stack non-descriptor-stack
+                :element-size 2 :alignment 2) ; double floats.
+  (complex-single-stack non-descriptor-stack :element-size 2)
+  (complex-double-stack non-descriptor-stack :element-size 4 :alignment 2)
+
+
+  ;; **** Things that can go in the integer registers.
 
   ;; Non-Descriptor characters
   (character-reg registers
                    (tn-sym (symbolicate name "-TN")))
                `(defparameter ,tn-sym
                   (make-random-tn :kind :normal
-                      :sc (sc-or-lose ',sc)
-                      :offset ,offset-sym)))))
+                       :sc (sc-or-lose ',sc)
+                       :offset ,offset-sym)))))
 
   ;; These, we access by foo-TN only
 
 ;; and some floating point values..
 (defparameter fp-single-zero-tn
   (make-random-tn :kind :normal
-                 :sc (sc-or-lose 'single-reg)
-                 :offset 31))
+                  :sc (sc-or-lose 'single-reg)
+                  :offset 31))
 (defparameter fp-double-zero-tn
   (make-random-tn :kind :normal
-                 :sc (sc-or-lose 'double-reg)
-                 :offset 31))
+                  :sc (sc-or-lose 'double-reg)
+                  :offset 31))
 \f
 ;;; If value can be represented as an immediate constant, then return
 ;;; the appropriate SC number, otherwise return NIL.
      (sc-number-or-lose 'zero))
     (null
      (sc-number-or-lose 'null ))
-    ((or (integer sb!xc:most-negative-fixnum sb!xc:most-positive-fixnum)
-        system-area-pointer character)
+    ((or (integer #.sb!xc:most-negative-fixnum #.sb!xc:most-positive-fixnum)
+         character)
      (sc-number-or-lose 'immediate ))
     (symbol
      (if (static-symbol-p value)
-        (sc-number-or-lose 'immediate )
-        nil))
+         (sc-number-or-lose 'immediate )
+         nil))
     (single-float
      (if (eql value 0f0)
-        (sc-number-or-lose 'fp-single-zero )
-        nil))
+         (sc-number-or-lose 'fp-single-zero )
+         nil))
     (double-float
      (if (eql value 0d0)
-        (sc-number-or-lose 'fp-double-zero )
-        nil))))
+         (sc-number-or-lose 'fp-double-zero )
+         nil))))
 \f
 ;;;; function call parameters
 
 ;;; a list of TN's describing the register arguments
 (defparameter *register-arg-tns*
   (mapcar (lambda (n)
-           (make-random-tn :kind :normal
-                           :sc (sc-or-lose 'descriptor-reg)
-                           :offset n))
-         *register-arg-offsets*))
+            (make-random-tn :kind :normal
+                            :sc (sc-or-lose 'descriptor-reg)
+                            :offset n))
+          *register-arg-offsets*))
 
 ;;; This is used by the debugger.
 (def!constant single-value-return-byte-offset 4)
 (!def-vm-support-routine location-print-name (tn)
 ;  (declare (type tn tn))
   (let ((sb (sb-name (sc-sb (tn-sc tn))))
-       (offset (tn-offset tn)))
+        (offset (tn-offset tn)))
     (ecase sb
       (registers (or (svref *register-names* offset)
-                    (format nil "R~D" offset)))
+                     (format nil "R~D" offset)))
       (float-registers (format nil "F~D" offset))
       (control-stack (format nil "CS~D" offset))
       (non-descriptor-stack (format nil "NS~D" offset))
       (constant (format nil "Const~D" offset))
       (immediate-constant "Immed"))))
-\f
-;;; The loader uses this to convert alien names to the form they
-;;; occure in the symbol table (for example, prepending an
-;;; underscore). 
-(defun extern-alien-name (name)
-  (declare (type string name))
-  ;; ELF ports currently don't need any prefix
-  (typecase name
-    (simple-base-string name)
-    (base-string (coerce name 'simple-base-string))
-    (t (handler-case (coerce name 'simple-base-string)
-        (type-error () (error "invalid external alien name: ~S" name))))))
+
+(!def-vm-support-routine combination-implementation-style (node)
+  (declare (type sb!c::combination node) (ignore node))
+  (values :default nil))
+
+(defun primitive-type-indirect-cell-type (ptype)
+  (declare (ignore ptype))
+  nil)