This file is indexed.

/usr/share/doc/sbcl/sbcl-internals/Basic-Implementation.html is in sbcl-doc 2:1.4.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 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. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Basic Implementation (SBCL Internals)</title>

<meta name="description" content="Basic Implementation (SBCL Internals)">
<meta name="keywords" content="Basic Implementation (SBCL Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Slot_002dValue.html#Slot_002dValue" rel="up" title="Slot-Value">
<link href="Compiler-Transformations.html#Compiler-Transformations" rel="next" title="Compiler Transformations">
<link href="Slot_002dValue.html#Slot_002dValue" rel="prev" title="Slot-Value">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="Basic-Implementation"></a>
<div class="header">
<p>
Next: <a href="Compiler-Transformations.html#Compiler-Transformations" accesskey="n" rel="next">Compiler Transformations</a>, Up: <a href="Slot_002dValue.html#Slot_002dValue" accesskey="u" rel="up">Slot-Value</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="Basic-Implementation-1"></a>
<h3 class="section">8.1 Basic Implementation</h3>

<p>All of the following, while described in terms of <code>slot-value</code>,
also applies to <code>(setf slot-value)</code> and to <code>slot-boundp</code>, and
could in principle be extended to <code>slot-makunbound</code>.
</p>
<p>The basic implementation of <code>slot-value</code>, following the suggestion
in the standards document, is shown in <a href="#ex_003aslot_002dvalue">Example 8.1</a>; the
implementation of the other slot operators is similar.  The work to be
done simply to arrive at the generic function call is already
substantial: we need to look up the object&rsquo;s class and iterate over the
class&rsquo; slots to find a slot of the right name, only then are we in a
position to call the generic function which implements the slot access
directly.
</p>
<div class="float"><a name="ex_003aslot_002dvalue"></a>
<div class="example">
<pre class="example">(defun slot-value (object slot-name)
  (let* ((class (class-of object))
         (slot-definition (find-slot-definition class slot-name)))
    (if (null slot-definition)
        (values (slot-missing class object slot-name 'slot-value))
        (slot-value-using-class class object slot-definition))))
</pre></div>
<div class="float-caption"><p><strong>Example 8.1
</strong></p></div></div>
<p>The basic implementation of <code>slot-value-using-class</code> specialized on
the standard metaobject classes is shown in
<a href="#ex_003aslot_002dvalue_002dusing_002dclass">Example 8.2</a>.  First, we check for an obsolete
instance (that is, one whose class has been redefined since the object
was last accessed; if it has, the object must be updated by
<code>update-instance-for-redefined-class</code>); then, we acquire the slot&rsquo;s
storage location from the slot definition, the value from the instance&rsquo;s
slot vector, and then after checking the value against the internal unbound
marker, we return it.
</p>
<div class="float"><a name="ex_003aslot_002dvalue_002dusing_002dclass"></a>
<div class="example">
<pre class="example">(defmethod slot-value-using-class
    ((class std-class)
     (object standard-object)
     (slotd standard-effective-slot-definition))
  (check-obsolete-instance object)
  (let* ((location (slot-definition-location slotd))
         (value
          (etypecase location
            (fixnum (clos-slots-ref (instance-slots object) location))
            (cons (cdr location)))))
    (if (eq value +slot-unbound+)
        (values (slot-unbound class object (slot-definition-name slotd)))
        value)))
</pre></div>
<div class="float-caption"><p><strong>Example 8.2
</strong></p></div></div>
<p>Clearly, all of this activity will cause the performance of clos slot
access to compare poorly with structure slot access; while there will be
of necessity a slowdown between the slot accesses because the structure
class need not be redefineable (while redefinition of standard-object
classes is extremely common), the overhead presented in the above
implementation is excessive.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Compiler-Transformations.html#Compiler-Transformations" accesskey="n" rel="next">Compiler Transformations</a>, Up: <a href="Slot_002dValue.html#Slot_002dValue" accesskey="u" rel="up">Slot-Value</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>



</body>
</html>