gcl-devel
[Top][All Lists]

[Gcl-devel] Re: load speed and recompilation

 From: Camm Maguire Subject: [Gcl-devel] Re: load speed and recompilation Date: 20 Nov 2006 18:05:49 -0500 User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

```Greetings!

1) Doing an extra pass1 to get the function signatures in the file
used by the file will foil code like this, which I guess is OK:

(defun foo (x)
(when (eq x (prelim-or-final x)) x))

(defun prelim-or-final (x) nil) ;;overwrite this later with the real
;;def.

The compiler will see the constant null signature and hard-code it
in.

I've checked in a preliminary stab at what you want.  Any feedback
most appreciated.

Right now it might be a bit more sluggish than required -- I repeat
the file open and read steps as well as the pass1 steps.  This was for
simplicity, as the top level forms must be evaled after read in
compile-file one at a time (e.g. (in-package 'foo)), making the read
not easily separable from t1expr.

> > I have something experimental you might want to try
> > soon.
>
> Super.
>
> > 1) compiling closures, i.e. (let (x) (defun foo nil x))
>
> I'm not sure what the exact issue is here, but you may find this ANSI
> passage relevant:
>
>    \issue{COMPILE-ARGUMENT-PROBLEMS-AGAIN:FIX}
>    The consequences are undefined if the lexical environment surrounding
>    the function to be compiled contains any bindings other than those for
>    macros, symbol macros, or declarations.
>

I take it then we are free not to compile such closures -- great!  I
thought I saw some ansi test failures stemming from this, but I could
have been mistaken.  This said, quite a few functions in maxima, for
example, are written this way, and we lose performance wise by
interpreting them.

One person once suggested something like

(defun foo nil

(let ((x ..)) ; top level lexicals wrappend in defun foo above
(setf (symbol-function 'bar) (lambda (...) ...))
;;original defun bar transformed here))

(foo)

Take care,

> I don't know what that sort of thing really means, but there it is for
> what it's worth.
>
> Bob
>
>

--