[cfe-dev] Adding access to array size expressions in ConstantArrayType.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Jun 15 13:55:06 PDT 2009


Eli Friedman wrote:
> On Mon, Jun 15, 2009 at 5:42 AM, Enea Zaffanella<zaffanella at cs.unipr.it> wrote:

[...]

> The point of the type cache isn't really to get hits for non-canonical
> types (although it's nice when we do); the point is to make the
> canonical types unique, which allows turning type equivalence into a
> pointer comparison.
> 
> Again, the best thing here would be measurements of, for example,
> building Python (or something simiilar): how many array types do we
> create normally, how many get created with your scheme, and how many
> get created keeping the expression for all array types?

We opted for a "grep-like" pass on Python ... this means we will just 
provide a rough idea ... but quite informative, given that we are 
talking about ~16MB of code.

Overall, there are 1072 array type declarations. Of these, 588 have a 
decimal unsuffixed integer literal as size expression; some other 72 
have a single macro name as size expression, which might be expanded to 
such a "canonical" integer constant.

All considered, you are basically right in saying that the optimization 
is not worth the effort. So, if you say it is OK, we will proceed as you 
suggested and add the original size expression pointer unconditionally.

Abramo and Enea.




More information about the cfe-dev mailing list