Yes, I see that now, but that doesn't answer the questions.

Why did you choose reg_alloc/8 as an index into free_list?

Why does the code need to increase the size of free_list so
dramatically in the branching into the first if()?

I was also going to ask again how free_list is meant to be used, but
then I found this in the comments at the top of register.c:

"Context/register memory is malloced. C<ctx_mem.free> is used as a
free list of reusable items."

On Apr 22, 2007, at 11:36 AM, Leopold Toetsch wrote:

Am Sonntag, 22. April 2007 14:40 schrieb Patrick Rutkowski:
Ok, so I see now that reg_alloc is rounded up to a multiple of 8 by
the following two lines:

   /*code*/ const int slot = (reg_alloc + 7) >> 3;
   /*code*/ reg_alloc = slot << 3;

However, this still begs the question of what the slot variable is
for. Clearly it's being used as an index into
interp->ctx_mem.free_list; but its value, which is always set to
reg_alloc/8, seems to me to be rather arbitrary (either that or it has
some meaning but I just don't know any better).

Alloc size     slot
  0, 4           0
  8, 12          1
 16, 20          2
 ...

(As this is for registers, the sizes are not more fine grained).

That's all.
leo

Reply via email to