On Sun, 22 Apr 2007 02:31:26 -0700
Mark Glines <[EMAIL PROTECTED]> wrote:

> On Sat, 21 Apr 2007 18:24:18 -0700
> chromatic <[EMAIL PROTECTED]> wrote:
> > Then it calculates a slot value:
> > 
> >     const int slot = (reg_alloc + 7) >> 3;
> >     reg_alloc = slot << 3;
> > 
> > This is where I start not to understand.  Why reg_alloc + 7?  Why
> > shift left and right by 3?
> 
> To me it looks like it's just rounding up to the next 8-byte boundary.

Oops, 8-slot boundary.  Whatever that means.  After that add and
shifting stuff, slot is guaranteed to be a multiple of 8. That idiom is
pretty common for cache alignment purposes and such, but I usually see
it being done to a pointer value, not an integer.  Well, perhaps they
want the pointer to be cache-aligned.

Anyway, "slot" is guaranteed to be a multiple of 8.  But that entry
might not exist in the array yet, so the next if() statement checks for
that, and if not, does a realloc() to ensure there are now slot+1
entries, and zeroes out the new pointers.

...after that point, it gets difficult for me to understand :)

Mark

Reply via email to