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: [PATCH 1/2] Convert symtab, cgraph and varpool nodes into a real class hierarchy


On Aug 27, 2013, at 4:08 AM, Richard Biener <richard.guenther@gmail.com> wrote:
>> and converts:
>>  struct GTY(()) cgraph_node
>> to:
>>  struct GTY((user)) cgraph_node : public symtab_node_base

GTY didn't like single inheritance for me in in wide-int.h.  I extended GTY to support it better.   See the wide-int branch, if you need more beef here.  It isn't flawless, but, it did left me to things to make it work nice enough for my purposes.  In my case, all my data is in the base class, and the base class and the derived have the same address (single inheritance, no virtual bases), and I have no embedded pointers in my data.  I don't use user, seemed less ideal to me.

I also had to put:

  void gt_ggc_mx(max_wide_int*) { }
  void gt_pch_nx(max_wide_int*,void (*)(void*, void*), void*) { }
  void gt_pch_nx(max_wide_int*) { }

in wide-int.cc and:

  extern void gt_ggc_mx(max_wide_int*);
  extern void gt_pch_nx(max_wide_int*,void (*)(void*, void*), void*);
  extern void gt_pch_nx(max_wide_int*);

into wide-int.h to get it to go.  These I think are merely because I'm using a typedef for a template with template args.  In the wide-int branch, it'd be nice if a GTY god can figure out how to improves things so I don't need to do the above, and to review/approve/fix the GTY code to support single inheritance even better.

>> and:
>>  struct GTY(()) varpool_node
>> to:
>>  class GTY((user)) varpool_node : public symtab_node_base
>> 
>> dropping the symtab_node_def union.
>> 
>> Since gengtype is unable to cope with inheritance, we have to mark the
>> types with GTY((user)), and handcode the gty field-visiting functions.
>> Given the simple hierarchy, we don't need virtual functions for this.


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