RFA: Add range checking to initialisation of special entries in ggc-page's size_lookup table

Nick Clifton nickc@redhat.com
Mon Jul 24 10:34:00 GMT 2006


Hi Richard,

> This looks reasonable, though I cannot approve it.  It may even be obvious
> if not the s/512/NUM_SIZE_LOOKUP/ was enlarging the patch so much ;)

:-)  The essential change was from this:

   for (order = HOST_BITS_PER_PTR; order < NUM_ORDERS; ++order)
     {
       int o;
       int i;

       o = size_lookup[OBJECT_SIZE (order)];
       for (i = OBJECT_SIZE (order); size_lookup [i] == o; --i)
	size_lookup[i] = order;
     }

to this (slightly simplified from the real version in the patch):

   for (order = HOST_BITS_PER_PTR; order < NUM_ORDERS; ++order)
     {
       int o;
       int i;

       i = OBJECT_SIZE (order);
       if (i >= NUM_SIZE_LOOKUP)
	break;
       o = size_lookup[i];
       for (; size_lookup [i] == o; --i)
	size_lookup[i] = order;
     }

> I note that you still initialize object_size_table for the
> extra_order_size_table order that is too large.  This is harmless, 
 > but further cleanup could compact the extra_order_size_table
> removing too large and duplicate entries, reducing NUM_ORDERS.

I thought about this, but I decided that it would make the definition 
and initialization of the extra_order_size_table[] rather messy. 
Simple is better IMHO.

Cheers
   Nick



More information about the Gcc-patches mailing list