X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpcl%2Flow.lisp;h=e9539ec4183ef0409967a5bf70ebd19feb455f7f;hb=d147d512602d761a2dcdfded506dd1a8f9a140dc;hp=1de526653f44ad9d3dee597aee46c5d64c406de8;hpb=475c832b081651e66ad9446d4852c62086f5e740;p=sbcl.git diff --git a/src/pcl/low.lisp b/src/pcl/low.lisp index 1de5266..e9539ec 100644 --- a/src/pcl/low.lisp +++ b/src/pcl/low.lisp @@ -46,15 +46,18 @@ (declare (fixnum ,var)) ,@body)) - -(defmacro instance-ref (slots index) - `(svref ,slots ,index)) +(declaim (ftype (function (simple-vector index) t) clos-slots-ref)) +(defun clos-slots-ref (slots index) + (svref slots index)) +(declaim (ftype (function (t simple-vector index) t) (setf clos-slots-ref))) +(defun (setf clos-slots-ref) (new-value slots index) + (setf (svref slots index) new-value)) ;;; Note on implementation under CMU CL >=17 and SBCL: STD-INSTANCE-P ;;; is only used to discriminate between functions (including FINs) ;;; and normal instances, so we can return true on structures also. A -;;; few uses of (or std-instance-p fsc-instance-p) are changed to -;;; pcl-instance-p. +;;; few uses of (OR STD-INSTANCE-P FSC-INSTANCE-P) are changed to +;;; PCL-INSTANCE-P. (defmacro std-instance-p (x) `(sb-kernel:%instancep ,x)) @@ -93,8 +96,6 @@ `(wrapper-class* (std-instance-wrapper ,instance))) -;;; SET-FUNCTION-NAME -;;; ;;; When given a function should give this function the name . ;;; Note that is sometimes a list. Some lisps get the upset ;;; in the tummy when they start thinking about functions which have @@ -158,7 +159,7 @@ (intern (let ((*package* *pcl-package*) (*print-case* :upcase) (*print-pretty* nil) - (*print-gensym* 't)) + (*print-gensym* t)) (format nil "~S" name)) *pcl-package*)))) @@ -184,9 +185,9 @@ (defun pcl-instance-p (x) (typep (sb-kernel:layout-of x) 'wrapper)) -;;; We define this as STANDARD-INSTANCE, since we're going to clobber the -;;; layout with some standard-instance layout as soon as we make it, and we -;;; want the accessor to still be type-correct. +;;; We define this as STANDARD-INSTANCE, since we're going to clobber +;;; the layout with some standard-instance layout as soon as we make +;;; it, and we want the accessor to still be type-correct. (defstruct (standard-instance (:predicate nil) (:constructor %%allocate-instance--class ()) @@ -203,21 +204,21 @@ (defmacro built-in-or-structure-wrapper (x) `(sb-kernel:layout-of ,x)) (defmacro get-wrapper (inst) - (sb-int:once-only ((wrapper `(wrapper-of ,inst))) + (once-only ((wrapper `(wrapper-of ,inst))) `(progn - (assert (typep ,wrapper 'wrapper) () "What kind of instance is this?") + (aver (typep ,wrapper 'wrapper)) ,wrapper))) ;;; FIXME: could be an inline function (like many other things around ;;; here) (defmacro get-instance-wrapper-or-nil (inst) - (sb-int:once-only ((wrapper `(wrapper-of ,inst))) + (once-only ((wrapper `(wrapper-of ,inst))) `(if (typep ,wrapper 'wrapper) ,wrapper nil))) (defmacro get-slots-or-nil (inst) - (sb-int:once-only ((n-inst inst)) + (once-only ((n-inst inst)) `(when (pcl-instance-p ,n-inst) (if (std-instance-p ,n-inst) (std-instance-slots ,n-inst)