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]


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.:

struct A_common {
  int type;
  /* If you want a double linked list inside the members :
   struct A_common *prev, *next; */
  /* ... other common fields ... */
};

struct A1 {
  int type;
  /*  struct A_common *prev, *next;  */
  /* ... other common fields ... */

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

/* more Ax  */

union Any_A {
  struct A_common common;
  struct A1 a1;
  struct A2 a2;
  ...
};

struct A_list {
  A_list *next, *prev;
  Any_A a;
};

Or

struct A_list {
  A_list *next, *prev;
  Any_A *data;
};


Ciao,
Michael.


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