|
From: Konstantin S. <kon...@gm...> - 2008-01-21 12:40:43
|
>> Unfortunately I don't think this really fixes it.
Ouch!
Yep, it does not. It just hides the problem and makes it extremely rare.
>> I think the only fix is to change all the unboxed comparison stuff in
WordFM to use unsigned Words.
Yea... And we probably need to export one more FM method:
+ while (HG_(nextIterFM)( map_locks, (Word*)&gla, (Word*)&lk )
+ && compareFM(map_locks, gla,lastA) <= 0) { // use the comparison
function from map_locks
--kcc
On Jan 21, 2008 3:27 PM, Julian Seward <js...@ac...> wrote:
> On Monday 21 January 2008 11:08, Konstantin Serebryany wrote:
> > Hi Julian,
> >
> > I found out that this fix has an issue (which appears only in 32-bit
> mode).
> >
> > + while (HG_(nextIterFM)( map_locks, (Word*)&gla, (Word*)&lk )
> > + && gla <= lastA) {
> >
> > This should look like
> > + while (HG_(nextIterFM)( map_locks, (Word*)&gla, (Word*)&lk )
> > + && (Word)gla <= (Word)lastA) {
>
> Good observation. Unfortunately I don't think this really fixes it.
>
> Consider on a 32-bit platform, we want to iterate over locks in the
> range
>
> Addr firstA = 0x70000000
> Addr lastA = 0x90000000 - 1
>
> (UWord)firstA = 1879048192
> (UWord)lastA = 2415919104
>
> (Word)firstA = 1879048192
> (Word)lastA = -1879048192
>
> Since the trees will be ordered by Word, this means we are asking to
> iterate over the range 1879048192 .. -1879048192, which is empty, and
> so the iteration loop will terminate immediately.
>
> I think the only fix is to change all the unboxed comparison stuff
> in WordFM to use unsigned Words. Maybe it would be better to change
> WordFM to used unsigned Words throughout.
>
> This also shows there is a specification problem in HG_(initIterAt).
> Using only HG_(initIter) and HG_(nextIter), we could iterate over
> all elements of the tree, in some order - it did not matter what.
> But HG_(initIterAt)(x) guarantees not to present any value < x;
> unfortunately we did not say how "<" is defined in the unboxed case.
>
> J
>
|