Subject: inlining in clisp

From: Sam Steingold <[email-masked]>
Date: 04 Mar 1998 11:51:53 -0500

I have an impression that clisp doesn't quite respect inlining. ZZ is
inlined, YY is not, nevertheless, when called, they compile into the same
thing.

Of course, any CL is free to ignore any inline declarations.

But, with CLISP, should I expect a large funcall overhead?

> (declaim (inline zz))
nil
> (defun zz (x) (1+ x))
zz
> (compile 'zz)
zz
> (defun xx (x) (1- (zz x)))
xx
> (compile 'xx)
xx
> (disassemble 'xx)

Disassembly of function xx
(CONST 0) = zz
1 required arguments
0 optional arguments
No rest parameter
No keyword parameters
0     (load&push 1)
1     (call1&push 0)                      ; zz
3     (calls2 154)                        ; 1-
5     (skip&ret 2)
#<compiled-closure xx>
> (defun xx (x) (1- (1+ x)))
xx
> (compile 'xx)
xx
> (disassemble 'xx)

Disassembly of function xx
1 required arguments
0 optional arguments
No rest parameter
No keyword parameters
0     (load&inc&push 1)
2     (calls2 154)                        ; 1-
4     (skip&ret 2)
#<compiled-closure xx>
> (defun yy (x) (1- x))
yy
> (compile 'yy)
yy
> (defun xx (x) (1- (yy x)))
xx
> (compile 'xx)
xx
> (disassemble 'xx)

Disassembly of function xx
(CONST 0) = yy
1 required arguments
0 optional arguments
No rest parameter
No keyword parameters
0     (load&push 1)
1     (call1&push 0)                      ; yy
3     (calls2 154)                        ; 1-
5     (skip&ret 2)
#<compiled-closure xx>
-- 
Sam Steingold, running RedHat5 GNU/Linux (http://www.linux.org)
Micros**t is not the answer. Micros**t is a question, and the answer is Linux,
the choice of the GNU (http://www.gnu.org) generation.
A man paints with his brains and not with his hands.

---

From: Bruno Haible <[email-masked]>
Date: Wed, 11 Mar 1998 00:04:00 +0100 (MET)

> Of course, any CL is free to ignore any inline declarations.

CLISP inlines only during COMPILE-FILE, not during COMPILE, and only
functions defined in the same file or in REQUIREd files.

Thus you cannot test inlining by calling COMPILE.

Bruno