Hi,
Does anyone know how to get rid of the "Compiling LAMBDA(#:G ....)"
message when a
method is defined and called for the first time. I don't understand why
I should see
this message and what comes after "Compiling Top-level Form:" as
suggested by the
ending colon.
My platform is CMUCL on Solaris.
Thanks,
Tunc
* (defmethod foo () t)
#<Standard-Method FOO () {70432CD}>
* (foo)
Compiling LAMBDA (#:G860 #:G862 #:G863):
Compiling Top-Level Form:
T
*
* Tunc Simsek wrote:
> Hi,
> Does anyone know how to get rid of the "Compiling LAMBDA(#:G ....)"
> message when a
> method is defined and called for the first time. I don't understand why
> I should see
> this message and what comes after "Compiling Top-level Form:" as
> suggested by the
> ending colon.
What you are seeing is almost certainly effective methods being
compiled on demand, and I think that in the general case with PCL you
can get a fair number of these messages.
There's a way of causing PCL to precompile stuff for you which I think
is something like:
run some code to make sure that all the effective methods get
computed.
call PCL::PRECOMPILE-RANDOM-CODE-SEGMENTS
But I forget how this interacts with compiling files and so on --
somehow it arranges to dump these things to the fasl file I think, but
I really forget.
Of course the other solution is to find whatever it is that makes
CMUCL's compiler not mutter to itself.
--tim
Tunc Simsek <······@robotics.eecs.berkeley.edu> writes:
> Hi,
>
> Does anyone know how to get rid of the "Compiling LAMBDA(#:G ....)"
> message when a
> method is defined and called for the first time. I don't understand why
> I should see
> this message and what comes after "Compiling Top-level Form:" as
> suggested by the
> ending colon.
PCL optimizes method lookup and invocation by creating and compiling
optimized discrimination functions (dfuns), etc. on the fly. You are
probably witnessing the compilation of one of these, or of the other
things PCL compiles on the fly. There are two things you can do about
this:
a) You want to compile as much as possible in advance: After having
compiled and loaded your application, prior to dumping/running,
compile and load a file that include just the line
(pcl::precompile-random-code-segments) (possibly also a system
argument, don't quite remember what that entailed). Based on the
current state of your system (GFs, methods, etc.), this will
pre-compile a number of things.
b) If you just want to get rid of the messages, then bind or set
*compiler-print* to nil. This is probably only useful in the final
system, and not while developing. If you just want to avoid the
messages in PCL compiled code, binding *compiler-print* to nil
around the calls to compile in compile-lambda (see pcl/low.lisp)
should give you that.
Regs, Pierre.
--
Pierre Mai <····@acm.org> PGP and GPG keys at your nearest Keyserver
"One smaller motivation which, in part, stems from altruism is Microsoft-
bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
Well, the first option didn't do it, so I'll try the second which seems
somewhat dangerous.
* (defmethod foo () 1)
#<Standard-Method FOO () {737E26D}>
* (pcl::precompile-random-code-segments)
Compiling LAMBDA (#:G2 #:G3 #:G4 #:G6 #:G7):
Compiling Top-Level Form:
Compiling LAMBDA (#:G19 #:G20 #:G23 #:G24):
Compiling Top-Level Form:
Compiling LAMBDA (#:G27 #:G28 #:G31 #:G32):
Compiling Top-Level Form:
Compiling LAMBDA (#:G35 #:G36 #:G39 #:G40):
Compiling Top-Level Form:
Compiling LAMBDA (#:G43 #:G44 #:G47 #:G48):
Compiling Top-Level Form:
Compiling LAMBDA (#:G51 #:G52 #:G55 #:G56):
Compiling Top-Level Form:
NIL
* (foo )
Compiling LAMBDA (#:G1022 #:G1024 #:G1025):
Compiling Top-Level Form:
1
*
Thanks,
Tunc
"Pierre R. Mai" wrote:
>
> Tunc Simsek <······@robotics.eecs.berkeley.edu> writes:
>
> > Hi,
> >
> > Does anyone know how to get rid of the "Compiling LAMBDA(#:G ....)"
> > message when a
> > method is defined and called for the first time. I don't understand why
> > I should see
> > this message and what comes after "Compiling Top-level Form:" as
> > suggested by the
> > ending colon.
>
> PCL optimizes method lookup and invocation by creating and compiling
> optimized discrimination functions (dfuns), etc. on the fly. You are
> probably witnessing the compilation of one of these, or of the other
> things PCL compiles on the fly. There are two things you can do about
> this:
>
> a) You want to compile as much as possible in advance: After having
> compiled and loaded your application, prior to dumping/running,
> compile and load a file that include just the line
> (pcl::precompile-random-code-segments) (possibly also a system
> argument, don't quite remember what that entailed). Based on the
> current state of your system (GFs, methods, etc.), this will
> pre-compile a number of things.
>
> b) If you just want to get rid of the messages, then bind or set
> *compiler-print* to nil. This is probably only useful in the final
> system, and not while developing. If you just want to avoid the
> messages in PCL compiled code, binding *compiler-print* to nil
> around the calls to compile in compile-lambda (see pcl/low.lisp)
> should give you that.
>
> Regs, Pierre.
>
> --
> Pierre Mai <····@acm.org> PGP and GPG keys at your nearest Keyserver
> "One smaller motivation which, in part, stems from altruism is Microsoft-
> bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
Tunc Simsek <······@robotics.eecs.berkeley.edu> writes:
> Well, the first option didn't do it, so I'll try the second which seems
> somewhat dangerous.
>
>
> * (defmethod foo () 1)
>
> #<Standard-Method FOO () {737E26D}>
> * (pcl::precompile-random-code-segments)
Note that you should compile a file which includes the form
(pcl::precompile-random-code-segments) and load that, since some of
the actions of pcl::precompile-random-code-segments are only performed
at compile time.
Note also that I neglected to mention that you should run your code
for a bit before doing this, as Tim pointed out...
Setting *compile-print* to nil shouldn't be dangerous. The only
messages you will loose (in all compilation) are:
- Information that compilation of a top-level component starts
"[Byte ]Compiling foo: "
- Information that IR1 conversion of a defmacro, define-compiler-macro
or defun form has been completed "Converted foo."
Below you'll find a quick patch (not tested) to PCL that introduces
a variable `*compile-lambda-silent-p*' that if true will cause
compile-lambda to rebind *compile-print* to nil during calls to the
compiler.
Regs, Pierre.
--- pcl/low.lisp Mon Sep 6 03:27:30 1999
+++ pcl/low.lisp.new Thu Mar 23 16:06:23 2000
@@ -265,23 +265,32 @@
(defvar *compile-lambda-break-p* nil)
+(defvar *compile-lambda-silent-p* t
+ "If true, then *compile-print* will be bound to nil during compilation
+via compile-lambda.")
+
(defun compile-lambda (lambda &optional (desirability :fast))
(when *compile-lambda-break-p* (break))
- (cond ((null *compiler-present-p*)
- (compile-lambda-uncompiled lambda))
- ((and (null *compiler-reentrant-p*)
- (in-the-compiler-p))
- (compile-lambda-deferred lambda))
- ((eq desirability :fast)
- (compile nil lambda))
- ((and (eq desirability :medium)
- (member *compiler-speed* '(:fast :medium)))
- (compile nil lambda))
- ((and (eq desirability :slow)
- (eq *compiler-speed* ':fast))
- (compile nil lambda))
- (t
- (compile-lambda-uncompiled lambda))))
+ (macrolet ((maybe-silent (&body body)
+ `(let ((*compile-print* (if *compile-lambda-silent-p*
+ nil
+ *compile-print*)))
+ ,@body)))
+ (cond ((null *compiler-present-p*)
+ (compile-lambda-uncompiled lambda))
+ ((and (null *compiler-reentrant-p*)
+ (in-the-compiler-p))
+ (compile-lambda-deferred lambda))
+ ((eq desirability :fast)
+ (maybe-silent (compile nil lambda)))
+ ((and (eq desirability :medium)
+ (member *compiler-speed* '(:fast :medium)))
+ (maybe-silent (compile nil lambda)))
+ ((and (eq desirability :slow)
+ (eq *compiler-speed* ':fast))
+ (maybe-silent (compile nil lambda)))
+ (t
+ (compile-lambda-uncompiled lambda)))))
(defun compile-lambda-uncompiled (uncompiled)
#'(lambda (&rest args) (apply (coerce uncompiled 'function) args)))
@@ -295,7 +304,12 @@
(apply compiled args)
(if (in-the-compiler-p)
(apply function args)
- (progn (setq compiled (compile nil uncompiled))
+ (progn (setq compiled
+ (let ((*compile-print*
+ (if *compile-lambda-silent-p*
+ nil
+ *compile-print*)))
+ (compile nil uncompiled)))
(apply compiled args)))))))
(defmacro precompile-random-code-segments (&optional system)
--
Pierre Mai <····@acm.org> PGP and GPG keys at your nearest Keyserver
"One smaller motivation which, in part, stems from altruism is Microsoft-
bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]