ecl_process_env
— Per-thread environmentThe OPTIMIZE
declaration includes three concepts:
DEBUG
, SPEED
,
SAFETY
and SPACE
. Each of these
declarations can take one of the integer values 0, 1, 2 and 3. According to
these values, the implementation may decide how to compie or interpret a
given lisp form.
ECL currently does not use all these declarations, but some of them
definitely affect the speed and behavior of compiled functions. For
instance, the DEBUG
declaration, as shown in Table 2.1, if the value of debugging is zero, the
function will not appear in the debugger and, if redefined, some functions
might not see the redefinition.
Table 2.1. Behavior for different levels of DEBUG
Behavior | 0 | 1 | 2 | 3 |
---|---|---|---|---|
Compiled functions in the same source file are called directly | Y | Y | N | N |
Compiled function appears in debugger backtrace | N | N | Y | Y |
All functions get a global entry, that is, SI:C-LOCAL is ignored. | N | N | Y | Y |
A bit more critical is the value of SAFETY
because as shown in Table Table 2.2, it may
affect the safety checks generated by the compiler. In particular, in some
circumstances the compiler may assume that the arguments to a function are
properly typed. For instance, if you compile with a low value of
SAFETY
, and invoke RPLACA
, the
consequences are unspecified.
Table 2.2. Behavior for different levels of SAFETY
Behavior | 0 | 1 | 2 | 3 |
---|---|---|---|---|
The compiler generates type checks for the arguments of a lambda form, thus enforcing any type declaration written by the user. | N | Y | Y | Y |
The value of an expression or a variable declared by the user is assumed to be right. | Y | Y | N | N |
We believe type declarations and type inference and, if the type of a form is inferred to be right for a function, slot accessor, etc, this may be inlined. Affects functions like CAR, CDR, etc | Y | Y | N | N |
We believe types defined before compiling a file not change before the compiled code is loaded. | Y | Y | N | N |
Arguments in a lisp form are assumed to have the appropriate types so that the form will not fail. | Y | N | N | N |
The slots or fields in a lisp object are accessed directly without type checks even if the type of the object could not be inferred (see line above). Affects functions like PATHNAME-TYPE, CAR, REST, etc. | Y | N | N | N |