X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdefstruct.lisp;h=6b6cd19346513dd3804072cc9e852dc749a803e9;hb=a160917364f85b38dc0826a5e3dcef87e3c4c62c;hp=9743b657ae6f35b8280d0b1198a797a6e79b34ed;hpb=8fe977ca5d0d068f2641dd06d3743a4c218d5cc1;p=sbcl.git diff --git a/src/code/defstruct.lisp b/src/code/defstruct.lisp index 9743b65..6b6cd19 100644 --- a/src/code/defstruct.lisp +++ b/src/code/defstruct.lisp @@ -272,9 +272,6 @@ (alignment 1 :type (integer 1 2) :read-only t)) (defvar *raw-slot-data-list* - #!+hppa - nil - #!-hppa (let ((double-float-alignment ;; white list of architectures that can load unaligned doubles: #!+(or x86 x86-64 ppc) 1 @@ -992,6 +989,46 @@ ,(funcall (nth-value 1 (slot-accessor-transforms dd dsd)) '(dummy new-value instance))))) +;;; Blow away all the compiler info for the structure CLASS. Iterate +;;; over this type, clearing the compiler structure type info, and +;;; undefining all the associated functions. If SUBCLASSES-P, also do +;;; the same for subclasses. FIXME: maybe rename UNDEFINE-FUN-NAME to +;;; UNDECLARE-FUNCTION-NAME? +(defun undeclare-structure (classoid subclasses-p) + (let ((info (layout-info (classoid-layout classoid)))) + (when (defstruct-description-p info) + (let ((type (dd-name info))) + (remhash type *typecheckfuns*) + (setf (info :type :compiler-layout type) nil) + (undefine-fun-name (dd-copier-name info)) + (undefine-fun-name (dd-predicate-name info)) + (dolist (slot (dd-slots info)) + (let ((fun (dsd-accessor-name slot))) + (unless (accessor-inherited-data fun info) + (undefine-fun-name fun) + (unless (dsd-read-only slot) + (undefine-fun-name `(setf ,fun))))))) + ;; Clear out the SPECIFIER-TYPE cache so that subsequent + ;; references are unknown types. + (values-specifier-type-cache-clear))) + (when subclasses-p + (let ((subclasses (classoid-subclasses classoid))) + (when subclasses + (collect ((subs)) + (dohash ((classoid layout) + subclasses + :locked t) + (declare (ignore layout)) + (undeclare-structure classoid nil) + (subs (classoid-proper-name classoid))) + ;; Is it really necessary to warn about + ;; undeclaring functions for subclasses? + (when (subs) + (warn "undeclaring functions for old subclasses ~ + of ~S:~% ~S" + (classoid-name classoid) + (subs)))))))) + ;;; core compile-time setup of any class with a LAYOUT, used even by ;;; !DEFSTRUCT-WITH-ALTERNATE-METACLASS weirdosities (defun %compiler-set-up-layout (dd @@ -1019,53 +1056,15 @@ "the most recently loaded" :compiler-layout clayout)) (cond (old-layout - (labels - ;; Blow away all the compiler info for the structure - ;; CLASS. Iterate over this type, clearing the compiler - ;; structure type info, and undefining all the - ;; associated functions. FIXME: maybe rename - ;; UNDEFINE-FUN-NAME to UNDECLARE-FUNCTION-NAME? - ((undeclare-structure (classoid subclasses-p) - (let ((info (layout-info (classoid-layout classoid)))) - (when (defstruct-description-p info) - (let ((type (dd-name info))) - (remhash type *typecheckfuns*) - (setf (info :type :compiler-layout type) nil) - (undefine-fun-name (dd-copier-name info)) - (undefine-fun-name (dd-predicate-name info)) - (dolist (slot (dd-slots info)) - (let ((fun (dsd-accessor-name slot))) - (unless (accessor-inherited-data fun info) - (undefine-fun-name fun) - (unless (dsd-read-only slot) - (undefine-fun-name `(setf ,fun))))))) - ;; Clear out the SPECIFIER-TYPE cache so that subsequent - ;; references are unknown types. - (values-specifier-type-cache-clear))) - (when subclasses-p - (collect ((subs)) - (dohash ((classoid layout) - (classoid-subclasses classoid) - :locked t) - (declare (ignore layout)) - (undeclare-structure classoid nil) - (subs (classoid-proper-name classoid))) - ;; Is it really necessary to warn about - ;; undeclaring functions for subclasses? - (when (subs) - (warn "undeclaring functions for old subclasses ~ - of ~S:~% ~S" - (classoid-name classoid) - (subs))))))) - (undeclare-structure (layout-classoid old-layout) - (and (classoid-subclasses classoid) - (not (eq layout old-layout)))) - (setf (layout-invalid layout) nil) - ;; FIXME: it might be polite to hold onto old-layout and - ;; restore it at the end of the file. -- RMK 2008-09-19 - ;; (International Talk Like a Pirate Day). - (warn "~@" - classoid))) + (undeclare-structure (layout-classoid old-layout) + (and (classoid-subclasses classoid) + (not (eq layout old-layout)))) + (setf (layout-invalid layout) nil) + ;; FIXME: it might be polite to hold onto old-layout and + ;; restore it at the end of the file. -- RMK 2008-09-19 + ;; (International Talk Like a Pirate Day). + (warn "~@" + classoid)) (t (unless (eq (classoid-layout classoid) layout) (register-layout layout :invalidate nil)) @@ -1244,7 +1243,7 @@ ;; included in that length to guarantee proper alignment of raw double float ;; slots, necessary for (at least) the SPARC backend. (let ((layout-length (dd-layout-length dd))) - (declare (index layout-length)) + (declare (type index layout-length)) (+ layout-length (mod (1+ layout-length) 2)))) ;;; This is called when we are about to define a structure class. It