84 lines
4.2 KiB
HTML
84 lines
4.2 KiB
HTML
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Accessor Discriminating Functions - SBCL Internals</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="SBCL Internals">
|
||
|
<meta name="generator" content="makeinfo 4.11">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="up" href="Discriminating-Functions.html#Discriminating-Functions" title="Discriminating Functions">
|
||
|
<link rel="prev" href="Method_002dBased-Discriminating-Functions.html#Method_002dBased-Discriminating-Functions" title="Method-Based Discriminating Functions">
|
||
|
<link rel="next" href="Cacheing-and-Dispatch-Functions.html#Cacheing-and-Dispatch-Functions" title="Cacheing and Dispatch Functions">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
|
||
|
This manual is part of the SBCL software system. See the `README'
|
||
|
file for more information.
|
||
|
|
||
|
This manual is in the public domain and is provided with
|
||
|
absolutely no warranty. See the `COPYING' and `CREDITS' files for
|
||
|
more information.
|
||
|
-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family:serif; font-weight:normal; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<p>
|
||
|
<a name="Accessor-Discriminating-Functions"></a>
|
||
|
Next: <a rel="next" accesskey="n" href="Cacheing-and-Dispatch-Functions.html#Cacheing-and-Dispatch-Functions">Cacheing and Dispatch Functions</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="Method_002dBased-Discriminating-Functions.html#Method_002dBased-Discriminating-Functions">Method-Based Discriminating Functions</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="Discriminating-Functions.html#Discriminating-Functions">Discriminating Functions</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<!-- node-name, next, previous, up -->
|
||
|
<h3 class="section">3.3 Accessor Discriminating Functions</h3>
|
||
|
|
||
|
<p>Accessor Discriminating Functions are used when the effective method of
|
||
|
all calls is an access to a slot, either reading, writing or checking
|
||
|
boundness<a rel="footnote" href="Accessor-Discriminating-Functions.html#fn-1" name="fnd-1"><sup>1</sup></a>; for this path to apply, there must be no non-standard
|
||
|
methods on <code>SB-MOP:SLOT-VALUE-USING-CLASS</code> and its siblings. The
|
||
|
first state is <code>SB-PCL::ONE-CLASS</code>, entered when one class of
|
||
|
instance has been accessed; the discriminating function here closes over
|
||
|
the wrapper of the class and the slot index, and accesses the slot of
|
||
|
the instance directly.
|
||
|
|
||
|
<p>If a direct instance of another class is passed to the generic function
|
||
|
for slot access, then another accessor discriminating function is
|
||
|
created: if the index of the slot in the slots vector of each instance
|
||
|
is the same, then a <code>SB-PCL::TWO-CLASS</code> function is created,
|
||
|
closing over the two class wrappers and the index and performing the
|
||
|
simple dispatch. If the slot indexes are not the same, then we go to
|
||
|
the <code>SB-PCL::N-N</code> state.
|
||
|
|
||
|
<p>For slot accesses for more than two classes with the same index, we move
|
||
|
to the <code>SB-PCL::ONE-INDEX</code> state which maintains a cache of
|
||
|
wrappers for which the slot index is the same. If at any point the slot
|
||
|
index for an instance is not the same, the state moves to
|
||
|
<code>SB-PCL::N-N</code>, which maintains a cache of wrappers and their
|
||
|
associated indexes; if at any point an effective method which is not a
|
||
|
simple slot access is encountered, then the discriminating function
|
||
|
moves into the <code>SB-PCL::CHECKING</code>, <code>SB-PCL::CACHING</code> or
|
||
|
<code>SB-PCL::DISPATCH</code> states.
|
||
|
|
||
|
<div class="footnote">
|
||
|
<hr>
|
||
|
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="Accessor-Discriminating-Functions.html#fnd-1">1</a>]</small> Although there is ordinarily no way for a user to
|
||
|
define a boundp method, some automatically generated generic functions
|
||
|
have them.</p>
|
||
|
|
||
|
<hr></div>
|
||
|
|
||
|
</body></html>
|
||
|
|