Debian Codegraph @

src/doc/old-manual/ansi_evaluation.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book [
3 <!ENTITY % eclent SYSTEM "ecl.ent">
4 %eclent;
5 ]>
6 <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
7 <chapter xml:id="ansi.evaluation-and-compilation">
8 <title>Evaluation and compilation</title>
9
10 <section xml:id="ansi.declarations">
11 <title>Declarations</title>
12
13 <section xml:id="ansi.declarations.optimize">
14 <title><function>OPTIMIZE</function></title>
15
16 <para>The <function>OPTIMIZE</function> declaration includes three concepts:
17 <function>DEBUG</function>, <function>SPEED</function>,
18 <function>SAFETY</function> and <function>SPACE</function>. Each of these
19 declarations can take one of the integer values 0, 1, 2 and 3. According to
20 these values, the implementation may decide how to compie or interpret a
21 given lisp form.</para>
22
23 <para>&ECL; currently does not use all these declarations, but some of them
24 definitely affect the speed and behavior of compiled functions. For
25 instance, the <function>DEBUG</function> declaration, as shown in <xref
26 linkend="table.optimize.debug"/>, if the value of debugging is zero, the
27 function will not appear in the debugger and, if redefined, some functions
28 might not see the redefinition.</para>
29
30 <table xml:id="table.optimize.debug">
31 <title>Behavior for different levels of DEBUG</title>
32 <tgroup cols="5">
33 <thead>
34 <row>
35 <entry>Behavior</entry>
36 <entry>0</entry>
37 <entry>1</entry>
38 <entry>2</entry>
39 <entry>3</entry>
40 </row>
41 </thead>
42 <tbody>
43 <row>
44 <entry>Compiled functions in the same source file are called
45 directly</entry>
46 <entry>Y</entry>
47 <entry>Y</entry>
48 <entry>N</entry>
49 <entry>N</entry>
50 </row>
51 <row>
52 <entry>Compiled function appears in debugger backtrace</entry>
53 <entry>N</entry>
54 <entry>N</entry>
55 <entry>Y</entry>
56 <entry>Y</entry>
57 </row>
58 <row>
59 <entry>All functions get a global entry, that is, SI:C-LOCAL is
60 ignored.</entry>
61 <entry>N</entry>
62 <entry>N</entry>
63 <entry>Y</entry>
64 <entry>Y</entry>
65 </row>
66 </tbody>
67 </tgroup>
68 </table>
69
70 <para>A bit more critical is the value of <function>SAFETY</function>
71 because as shown in Table <xref linkend="table.optimize.safety"/>, it may
72 affect the safety checks generated by the compiler. In particular, in some
73 circumstances the compiler may assume that the arguments to a function are
74 properly typed. For instance, if you compile with a low value of
75 <function>SAFETY</function>, and invoke <function>RPLACA</function>, the
76 consequences are unspecified.</para>
77
78 <table xml:id="table.optimize.safety">
79 <title>Behavior for different levels of SAFETY</title>
80 <tgroup cols="5">
81 <thead>
82 <row>
83 <entry>Behavior</entry>
84 <entry>0</entry>
85 <entry>1</entry>
86 <entry>2</entry>
87 <entry>3</entry>
88 </row>
89 </thead>
90 <tbody>
91 <row>
92 <entry>The compiler generates type checks for the arguments of a lambda
93 form, thus enforcing any type declaration written by the user.</entry>
94 <entry>N</entry>
95 <entry>Y</entry>
96 <entry>Y</entry>
97 <entry>Y</entry>
98 </row>
99 <row>
100 <entry>The value of an expression or a variable declared by the user is
101 assumed to be right.</entry>
102 <entry>Y</entry>
103 <entry>Y</entry>
104 <entry>N</entry>
105 <entry>N</entry>
106 </row>
107 <row>
108 <entry>We believe type declarations and type inference and, if the type
109 of a form is inferred to be right for a function, slot accessor, etc,
110 this may be inlined. Affects functions like CAR, CDR, etc</entry>
111 <entry>Y</entry>
112 <entry>Y</entry>
113 <entry>N</entry>
114 <entry>N</entry>
115 </row>
116 <row>
117 <entry>We believe types defined before compiling a file not change
118 before the compiled code is loaded.</entry>
119 <entry>Y</entry>
120 <entry>Y</entry>
121 <entry>N</entry>
122 <entry>N</entry>
123 </row>
124 <row>
125 <entry>Arguments in a lisp form are assumed to have the appropriate types
126 so that the form will not fail.</entry>
127 <entry>Y</entry>
128 <entry>N</entry>
129 <entry>N</entry>
130 <entry>N</entry>
131 </row>
132 <row>
133 <entry>The slots or fields in a lisp object are accessed directly
134 without type checks even if the type of the object could not be inferred
135 (see line above). Affects functions like PATHNAME-TYPE, CAR, REST,
136 etc.</entry>
137 <entry>Y</entry>
138 <entry>N</entry>
139 <entry>N</entry>
140 <entry>N</entry>
141 </row>
142 </tbody>
143 </tgroup>
144 </table>
145
146 </section>
147 </section>
148
149 <xi:include href="ref_c_evaluation.xml" xpointer="ansi.evaluation.c-dict" xmlns:xi="http://www.w3.org/2001/XInclude"/>
150
151 </chapter>
152 </book>