guile-user
[Top][All Lists]
Advanced

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

Re: Fix limitations on vector length


From: Dirk Herrmann
Subject: Re: Fix limitations on vector length
Date: Tue, 25 Jun 2002 21:50:56 +0200 (CEST)

On Tue, 25 Jun 2002, Roland Orre wrote:

> Some of our code using multidimensional arrays behaved buggy and that
> showed to be caused by the limitations of vector lengths to 24 bits,
> we need at least a few bits more at the moment.
> 
> Problems:
> 1) the allocation of the array did not cause an error message.
> 2) we need an urgent simple fix for utilizing big arrays.
> 
> What we inted to do is to change the SCM_LENGTH macro and the
> memory allocation for vectors and arrays so when the length
> need more than 24 bits the length is stored in the beginning
> of the array memory, that is we add an offset of four to the
> base pointer.
> 
> Any comments?

First a note:  Since you still use the SCM_LENGTH macro, you are probably
using guile 1.4.  This macro has been deprecated in 1.6 and replaced by a
bunch of macros like SCM_VECTOR_LENGTH and so on.  It could be worth
changing to the upcoming 1.6 from CVS since modifications to guile's built
in types are supposed to be less painfull.  I don't know about arrays, but
at least for vectors you get an error message if you try to allocate too
large a vector in 1.6.

Second, a suggestion:  The following solution might(!) cause less
problems:

* if you need more than 24 bits, allocate the vector object as a double
cell, set the 24 'standard' length bits to 0xFFFFFF, and store the real
length in the remaining two words of the double cell.
* make sure, you also update the garbage collector code for vectors.

Then, you don't have to do any trickery with the base pointer, only with
the length information.  I don't know about the array stuff, though...

Best regards
Dirk Herrmann




reply via email to

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