1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from software originally released by Xerox
5 ;;;; Corporation. Copyright and release statements follow. Later modifications
6 ;;;; to the software are in the public domain and are provided with
7 ;;;; absolutely no warranty. See the COPYING and CREDITS files for more
10 ;;;; copyright information from original PCL sources:
12 ;;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990 Xerox Corporation.
13 ;;;; All rights reserved.
15 ;;;; Use and copying of this software and preparation of derivative works based
16 ;;;; upon this software are permitted. Any distribution of this software or
17 ;;;; derivative works must comply with all applicable United States export
20 ;;;; This software is made available AS IS, and Xerox Corporation makes no
21 ;;;; warranty about the software, its performance or its conformity to any
26 (!fix-early-generic-functions)
27 (!fix-ensure-accessor-specializers)
28 (compute-standard-slot-locations)
29 (dolist (s '(condition function structure-object))
30 (dohash ((k v) (classoid-subclasses (find-classoid s)))
31 (find-class (classoid-name k))))
32 (setq **boot-state** 'complete)
34 (defun print-std-instance (instance stream depth)
35 (declare (ignore depth))
36 (print-object instance stream))
38 (setf (compiler-macro-function 'slot-value) nil)
39 (setf (compiler-macro-function 'set-slot-value) nil)
43 (defknown slot-value (t symbol) t (any))
44 (defknown (slot-boundp slot-exists-p) (t symbol) boolean)
45 (defknown sb-pcl::set-slot-value (t symbol t) t (any))
47 (defknown find-class (symbol &optional t lexenv-designator)
49 (defknown class-of (t) class (flushable))
50 (defknown class-name (class) symbol (flushable))
52 (deftransform slot-value ((object slot-name) (t (constant-arg symbol)) *
54 (let ((c-slot-name (lvar-value slot-name)))
55 (if (sb-pcl::interned-symbol-p c-slot-name)
56 (let* ((type (lvar-type object))
57 (dd (when (structure-classoid-p type)
58 (find-defstruct-description
59 (sb-kernel::structure-classoid-name type))))
61 (find c-slot-name (dd-slots dd) :key #'dsd-name))))
63 `(,(dsd-accessor-name dsd) object))
65 (delay-ir1-transform node :constraint)
66 `(sb-pcl::accessor-slot-value object ',c-slot-name))))
67 (give-up-ir1-transform "slot name is not an interned symbol"))))
69 (deftransform sb-pcl::set-slot-value ((object slot-name new-value)
70 (t (constant-arg symbol) t)
72 (let ((c-slot-name (lvar-value slot-name)))
73 (if (sb-pcl::interned-symbol-p c-slot-name)
74 (let* ((type (lvar-type object))
75 (dd (when (structure-classoid-p type)
76 (find-defstruct-description
77 (sb-kernel::structure-classoid-name type))))
79 (find c-slot-name (dd-slots dd) :key #'dsd-name))))
81 `(setf (,(dsd-accessor-name dsd) object) new-value))
82 ((policy node (= safety 3))
83 ;; Safe code wants to check the type, and the global
84 ;; accessor won't do that. Also see the comment in the
86 (give-up-ir1-transform "cannot use optimized accessor in safe code"))
88 (delay-ir1-transform node :constraint)
89 `(sb-pcl::accessor-set-slot-value object ',c-slot-name new-value))))
90 (give-up-ir1-transform "slot name is not an interned symbol"))))