This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Fix memory problems with large jumpy functions[patch]


On 11 Sep 2002 08:06:38 -0400, Diego Novillo <dnovillo@redhat.com> wrote:

> On Wed, 2002-09-11 at 07:19, Michael Matz wrote:
>> Hi,
>> 
>> On Tue, 10 Sep 2002, Diego Novillo wrote:
>> 
>> > - The basic tree_ref structure had several field that are not
>> >   always used by every type of reference.  This patch separates
>> >   them into different structures.  I think that we should move
>> >   away from having a generic tree_ref union, lest we fall in the
>> >   same trap we fell with trees.
>> >
>> >   However, we do need generic containers for references.  I guess
>> >   we could use void * containers, but that's a bit on the gross
>> >   side.  Any other ideas on how we could deal with this?
>> 
>> As you anyway would need to cast that void* every time, you can as well do
>> everything type- and alias-safe, like e.g.:
>> 
> Hmmm, this is *exactly* what we have today (see tree-flow.h).  The
> problem is (a) the aggregated union is rather large (52 bytes on
> x86-32)

But you never create an object of that union, do you?

In any case, as I mentioned the other day, the other alternative is to have

struct A_common {
  int type;
  /* ... other common fields ... */
};

struct A1 {
  struct A_common base;

  int whatever_a1;
  /* More A1 specific fields ... */
};

and hand around A_common*.  This is more C++-like.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]