Steve Fink wrote:
>
> Why use 2-byte alignment on constant strings? Wouldn't it speed up
> memory copies to make them always be 4-byte aligned? (Or
> machine-register-size aligned?)

Changed to 4-byte alignment for now. If there is a specific sizeof(X) you
would prefer, just change it.

> 1. Can you reformat to the coding conventions? They say that a

Okay, I've finally gotten round to downloading the modules needed for
run_indent.pl. I hand-synchronized with your previous patch; obviously I
missed a few things.

> 2. I think this line will break on some compilers. Casts are not
> guaranteed to be lvalues:
>
> >  +            (char *)b += pool->unit_size;

Changed to  b = (Buffer *)((char *)b + pool->unit_size);

> 3. Does this function need to be declared near the top in order for it
> to have a chance to be inlined?

You're right, of course. Moved to before the first call.

> 4. This is just a question that I'm too lazy to read the code and
> figure out for myself. Why are functions like compact_string_pool
> needed? What does it do differently from the generic version for
> Buffers?

a) There is (as yet?) no linkage between memory pools and buffer header
pools, so the compact function needs to know what headers to process
b) COW may well be implemented for strings only (at least initially), this
will require changes to the compact function
There is code, e.g. the freeing of the old memory blocks, that is pure
duplication; this can be moved to a separate common function.

--
Peter Gibbs
EmKel Systems


Attachment: phase2.patch
Description: Binary data

Reply via email to