Why is the TREE_PURPOSE of a CONSTRUCTOR_ELT list for ARRAY_TYPE NULL?

Mark Mitchell mark@codesourcery.com
Wed Sep 8 20:49:00 GMT 2004


Richard Henderson wrote:

>On Mon, Sep 06, 2004 at 03:55:49PM -0400, Daniel Berlin wrote:
>  
>
>>Does that mean that the corresponding index is the last index + 1?
>>    
>>
>
>Yes.
>
>  
>
>>In any case, is this a documentation bug, or a C++ FE bug (IE should i
>>expect tree_purpose to always be there, and it's just not getting set in
>>the case of the C vtables, or do the docs need updating)?
>>    
>>
>
>We should probably change the vtable builder to fill in the values.
>  
>
For an ten-million element array, this will result in ten million 
integer constants.

In fact, I've been thinking that we should design a new datastructure 
for CONTRUCTORs like so:

  struct initializer_chunk {
     tree base;
     tree count;
     struct initializer_chunk *next;
     tree *elems[1];
  };

with the idea of making these initializers vastly more compact.

Yes, this is only a constant-factor improvement, but on test cases with 
large arrays (of which there are plenty) this could very well result in 
the difference between fitting in RAM and not fitting in RAM.

-- 
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com



More information about the Gcc mailing list