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 (defun emit-reader/writer-function (reader/writer 1-or-2-class class-slot-p)
29 (:reader (ecase 1-or-2-class
31 (emit-reader/writer-macro :reader 1 t)
32 (emit-reader/writer-macro :reader 1 nil)))
34 (emit-reader/writer-macro :reader 2 t)
35 (emit-reader/writer-macro :reader 2 nil)))))
36 (:writer (ecase 1-or-2-class
38 (emit-reader/writer-macro :writer 1 t)
39 (emit-reader/writer-macro :writer 1 nil)))
41 (emit-reader/writer-macro :writer 2 t)
42 (emit-reader/writer-macro :writer 2 nil))))))
45 (defun emit-one-or-n-index-reader/writer-function
46 (reader/writer cached-index-p class-slot-p)
49 (:reader (if cached-index-p
51 (emit-one-or-n-index-reader/writer-macro :reader t t)
52 (emit-one-or-n-index-reader/writer-macro :reader t nil))
54 (emit-one-or-n-index-reader/writer-macro :reader nil t)
55 (emit-one-or-n-index-reader/writer-macro :reader nil nil))))
56 (:writer (if cached-index-p
58 (emit-one-or-n-index-reader/writer-macro :writer t t)
59 (emit-one-or-n-index-reader/writer-macro :writer t nil))
61 (emit-one-or-n-index-reader/writer-macro :writer nil t)
62 (emit-one-or-n-index-reader/writer-macro :writer nil nil)))))
65 ;;; Note this list is setup in dlisp3.lisp when all the necessary
66 ;;; macros have been loaded.
67 (defvar *checking-or-caching-function-list* nil)
69 (defmacro emit-checking-or-caching-function-precompiled ()
70 `(cdr (assoc (list cached-emf-p return-value-p metatypes applyp)
71 *checking-or-caching-function-list*
74 (defun emit-checking-or-caching-function (cached-emf-p return-value-p metatypes applyp)
75 (let ((fn (emit-checking-or-caching-function-precompiled)))
78 (values (emit-checking-or-caching-function-preliminary
79 cached-emf-p return-value-p metatypes applyp)
82 (defvar *not-in-cache* (make-symbol "not in cache"))
84 (defun emit-checking-or-caching-function-preliminary
85 (cached-emf-p return-value-p metatypes applyp)
86 (declare (ignore applyp))
88 #'(lambda (cache miss-fn)
89 (declare (type function miss-fn))
90 #'(sb-kernel:instance-lambda (&rest args)
91 (declare #.*optimize-speed*)
92 (with-dfun-wrappers (args metatypes)
93 (dfun-wrappers invalid-wrapper-p)
97 (let ((emf (probe-cache cache dfun-wrappers *not-in-cache*)))
98 (if (eq emf *not-in-cache*)
102 (invoke-emf emf args))))))))
103 #'(lambda (cache emf miss-fn)
104 (declare (type function miss-fn))
105 #'(sb-kernel:instance-lambda (&rest args)
106 (declare #.*optimize-speed*)
107 (with-dfun-wrappers (args metatypes)
108 (dfun-wrappers invalid-wrapper-p)
110 (if invalid-wrapper-p
112 (let ((found-p (not (eq *not-in-cache*
113 (probe-cache cache dfun-wrappers
116 (invoke-emf emf args)
119 (apply miss-fn args))))))))))
121 (defun emit-default-only-function (metatypes applyp)
122 (declare (ignore metatypes applyp))
123 (values #'(lambda (emf)
124 #'(lambda (&rest args)
125 (invoke-emf emf args)))