gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] 2.6.5pre


From: Camm Maguire
Subject: [Gcl-devel] 2.6.5pre
Date: 12 Aug 2004 13:41:33 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  Just created the new branch and updated head with the gmp
wrappers too.

The solution in brief is this:  the wrapper sets a setjmp in front of
each gmp call, which alloc.c detects and uses for a longjmp if it
needs to run the garbage collector.  The return from setjmp then runs
the collector outside of gmp, and retries the call.  If alloc.c still
does not have the space, it does not longjmp a second time, but rather
proceeds with adding more pages, as the conventional alloc calls do
when gc does not free up enough space.

This frees us from the old alternative, which is to keep up with gmp
changes by patching all temporary allocations to use alloca.  This
does not entirely solve the problem in any case, as gmp states that it
can store pointers into allocated blocks, which our current gc does
not check for.  It should also allow us to bring more of the gmp
functions forward, e.g. factorials and gcd.

The only assumption this solution makes AFAICT is that gmp will not
start writing into the destination on an 'in-place' call (one in which
the output is the same as one of the inputs), find out it doesn't have
enough memory, realloc, and then write some more.  Rather it will find
out how much space it needs and realloc before writing, and write in
one step.  I am in the process of verifying that this assumption is
true.  We're ok for now even if it isn't as we never make in-place
calls, but might want to in the future for the sake of efficiency.

One thing we'd like to do for 2.7.x is to export these wrappers to
compiled lisp code and work on compiled bignum optimization a bit.
We're not too strong in this area at present, though all our code
passes all the bignum tests I've been able to find (e.g. in clisp)
both compiled and interpreted.  Have also verified that this fixes the
originally reported problem with axiom and sqrt(2) out to 121278
digits. 

Please test and give feedback.

2.6.5pre passes all the conventional tests for me.

Take care,
-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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