On Fri, May 03, 2002 at 04:57:37PM +0200, Peter Gibbs wrote:
> Attached is the second set of patches for the tracked resource memory
> management system.
> 
> Features:
> Separate memory pools for buffers, normal strings, constant strings; the
> latter is never compacted
> Each pool has its own alignment; these are currently set to 16, 4 and 2
> respectively; suggestions welcome

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?)

A couple of comments on the patch:

1. Can you reformat to the coding conventions? They say that a
function should have a curly bracket at the beginning of the next
line. There are a some other patch chunks that revert formatting, too.
(Josh, what indent flags do you use to check formatting?)

>  /* Put any free buffers that aren't on the free list on the free list */
>   static void
>  -free_unused_buffers(struct Parrot_Interp *interpreter)
>  +free_unused_buffers(struct Parrot_Interp *interpreter,
>  +                    struct Resource_Pool *pool)
>   {

>       /* Icky special case. Grab system memory if there's no interpreter
>  -     * yet */
>  +       yet */

2. I think this line will break on some compilers. Casts are not
guaranteed to be lvalues:

>  +            (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?

> -void
> +INLINE void
>  buffer_lives(Buffer *buffer)
>  {

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?

Reply via email to