[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Maxima 5.9 CVS with new GCL successfull buld

From: Vadim V. Zhytnikov
Subject: [Gcl-devel] Maxima 5.9 CVS with new GCL successfull buld
Date: Tue, 18 Jun 2002 00:18:52 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.0.0) Gecko/20020526


Finally I've got Maxima running with all tests on GCL
with new packages layout.  The required patch to Maxima
is attached.  Originally I didn't expect any troubles
here.  The point is that Maxima 5.9 knows nothing
about new GCL's packages and uses old USER,
LISP, SLOOP, SERROR packages.  Since all these packages
are not touched by new GCL build procedure I expected
that everything will be just fine.  But it is turned out
that new CONDITIONS package broke SERROR.  Maxima uses
SERROR only in one place (kclmac.lisp) to define
ERRSET macro. This macro evaluates expression. If no error
is signaled it returns result of the evaluation enclosed
in extra brackets (result).  But if error is signaled
and value of global variable errset is NIL then it
returns NIL.  The purpose of the macro is to inhibit
lisp errors. Maxima uses the following definition
for errset under GCL (kclmac.lisp):

(defvar errset nil)

(defmacro errset (form &optional flag) flag
   `(serror:cond-any-error (er)
               (list ,form)
               ((null errset) nil)))

This definition relies on non ANSI macro cond-any-error
which is defined in SERROR.  For other ANSI compliant
lisps other definition is used (generr.lisp):

(defvar errset nil)

(defmacro erst (&rest l)
    `(cl:handler-case (list ,(car l))
      (cl:error (e) (when errset (error e)))))

The trouble is that as soon as we load new package CONDITIONS
the former definition for errset stop working as expected.  This is
sad since some old functionality is broken.  But latter definition
works fine.  So naturally I've patched Maxima to use second
definition.  I was surprised to see that second definition of erset
doesn't work properly under Maxima.  The trouble is that
(when errset (error e)) always signals error even if errset is set to
nil.  I don't know yet why (while errset (error e)) works differently
under GCL and Maxima but I was able to find a workaround.
I just replaced when by if:

(defvar errset nil)

(defmacro erst (&rest l)
    `(cl:handler-case (list ,(car l))
      (cl:error (e) (if errset (error e)))))

With such modification Maxima 5.9 builds and passes all tests
under new GCL.

Finally some comments on GCL performance.  I've noticed that with new
GCL Maxima tests run 30% slower. So I decided to make some tests.
I discovered that if some memory some memory is preallocated then
difference practically disappears. If I preallocate a lot of RAM
(about 150MB) then I've got the following numbers on Athlon XP 1700+:

ratsimp((x+y+z)^100)$ -> 0.11
ratsimp((x+y+z)^200)$ -> 0.43
ratsimp((x+y+z)^300)$ -> 1.32

Timings are exactly the same for both new and old GCL.
An for comparison CMUCL 18d on the same machine:

ratsimp((x+y+z)^100)$ -> 0.13
ratsimp((x+y+z)^200)$ -> 0.72
ratsimp((x+y+z)^300)$ -> 1.85

Best wishes,


PS: I've commidet the patch to Maxima CVS.

diff -uNr maxima-orig/src/kclmac.lisp maxima/src/kclmac.lisp
--- maxima-orig/src/kclmac.lisp Mon May  8 10:09:41 2000
+++ maxima/src/kclmac.lisp      Mon Jun 17 10:22:33 2002
@@ -1,11 +1,17 @@
 (in-package "MAXIMA")
+#-(and gcl ansi-cl)
 (use-package "SERROR")
 (defvar errset nil)
+#-(and gcl ansi-cl)
 (defmacro errset (form &optional flag) flag
   `(cond-any-error (er)
               (list ,form)
               ((null errset) nil)))
+#+(and gcl ansi-cl)
+(defmacro errset (&rest l)
+   `(cl:handler-case (list ,(car l))
+     (cl:error (e) (if errset (error e)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]