[Aldor-l] Bytecode

Ralf Hemmecke ralf at hemmecke.de
Tue Dec 9 16:38:08 EST 2008


> Another part of the compiler is the big integer arithmetic class. I
> would very much like to move this to GMP. I didn't find any
> optimisations that are done based on intimate knowledge of the bigint
> representation, but maybe Stephen can comment on that.

I really would like GMP underneath, but I guess there is some issue with
foam and with the interface of BigInt.

First of all, there must be a reason, why BigInt is deeply planted into
the language. If I recall correctly then BigInt is also part of FOAM. So
it is a very abstract thing. Of course, the language then must define
what functionality such a BigInt should have. Unfortunately, the current
interface is not rich enough. For example, suppose x and y are BigInt's and
   z = BigInt_gcd(x,y)
   a = x/z
   b = y/z
In case one knows (as in this case) that z divides x then the division 
can be done in half of the time. That algorithm is implemented in GMP, 
but even if GMP where the underlying machinery of Aldor, there would be 
no way to call 'exact_division' since it is not part of the 
specification of BigInt.

So there is more than just moving to GMP. In fact, I think, one should 
make the BigInteger machinery pluggable. From what I see from the aldor 
sources, there were already attempts to use GMP.

Ralf




More information about the Aldor-l mailing list