This file is indexed.

/usr/share/doc/sbcl/sbcl-internals/Callbacks.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
<!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>Callbacks (SBCL Internals)</title>

<meta name="description" content="Callbacks (SBCL Internals)">
<meta name="keywords" content="Callbacks (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="Foreign-Linkage.html#Foreign-Linkage" rel="up" title="Foreign Linkage">
<link href="Funcallable-Instances.html#Funcallable-Instances" rel="next" title="Funcallable Instances">
<link href="Lazy-Alien-Resolution.html#Lazy-Alien-Resolution" rel="prev" title="Lazy Alien Resolution">
<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="Callbacks"></a>
<div class="header">
<p>
Previous: <a href="Lazy-Alien-Resolution.html#Lazy-Alien-Resolution" accesskey="p" rel="prev">Lazy Alien Resolution</a>, Up: <a href="Foreign-Linkage.html#Foreign-Linkage" accesskey="u" rel="up">Foreign Linkage</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="Callbacks-1"></a>
<h3 class="section">4.3 Callbacks</h3>

<p>SBCL is capable of providing C with linkage to Lisp &ndash; the upshot of which is that
C-functions can call Lisp functions thru what look like function pointers to C.
</p>
<p>These &ldquo;function pointers&rdquo; are called Alien Callbacks. An alien
callback sequence has 4 parts / stages / bounces:
</p>
<ul>
<li> Assembler Wrapper

<p>saves the arguments from the C-call according to the alien-fun-type of
the callback, and calls #&rsquo;ENTER-ALIEN-CALLBACK with the index
identifying the callback, a pointer to the arguments copied on the
stack and a pointer to return value storage. When control returns to
the wrapper it returns the value to C. There is one assembler wrapper
per callback.[1] The SAP to the wrapper code vector is what is passed
to foreign code as a callback.
</p>
<p>The Assembler Wrapper is generated by
<code>ALIEN-CALLBACK-ASSEMBLER-WRAPPER</code>.
</p>
</li><li> #&rsquo;ENTER-ALIEN-CALLBACK

<p>pulls the Lisp Trampoline for the given index, and calls it with the
argument and result pointers.
</p>
</li><li> Lisp Trampoline

<p>calls the Lisp Wrapper with the argument and result pointers, and the
function designator for the callback. There is one lisp trampoline per
callback.
</p>
</li><li> Lisp Wrapper

<p>parses the arguments from stack, calls the actual callback with the
arguments, and saves the return value at the result pointer. The lisp
wrapper is shared between all the callbacks having the same same
alien-fun-type.
</p>
</li></ul>

<p>[1] As assembler wrappers need to be allocated in static addresses and
are (in the current scheme of things) never released it might be worth
it to split it into two parts: per-callback trampoline that pushes the
index of the lisp trampoline on the stack, and jumps to the
appropriate assembler wrapper. The assembler wrapper could then be
shared between all the callbacks with the same alien-fun-type. This
would amortize most of the static allocation costs between multiple
callbacks.
</p><hr>
<div class="header">
<p>
Previous: <a href="Lazy-Alien-Resolution.html#Lazy-Alien-Resolution" accesskey="p" rel="prev">Lazy Alien Resolution</a>, Up: <a href="Foreign-Linkage.html#Foreign-Linkage" accesskey="u" rel="up">Foreign Linkage</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>



</body>
</html>