public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype}
@ 2015-01-25 19:56 Doug Evans
  2015-02-01  5:48 ` Doug Evans
  2015-02-02  3:52 ` Joel Brobecker
  0 siblings, 2 replies; 3+ messages in thread
From: Doug Evans @ 2015-01-25 19:56 UTC (permalink / raw)
  To: gdb-patches, gaius

Hi.

Anytime you can reduce the size of struct main_type that's A Good Thing.
Alas in this case my motivation, besides more general cleanup (will it
never end?), is that I may wish to add something to struct main_type.
Now I can, if I need to.

There are two fields in struct main_type that really shouldn't be there:
vptr_fieldno, and vptr_basetype.  Every type has to pay the price
in memory usage for their presence.  The proper place for them is
in the type_specific field (in this case cplus_stuff) which exists
for this purpose.

Things are a bit complicated because vptr_basetype is overloaded
to record the type of "this" for TYPE_CODE_{METHODPTR,MEMBERPTR,METHOD},
and is accessed through the macro TYPE_DOMAIN_TYPE.

There is also the wrinkle, discussed earlier, that m2-typeprint.c
uses TYPE_DOMAIN_TYPE.  I've replaced that with TYPE_TARGET_TYPE
and left a FIXME there (pre-discussed with Gaius).  This is done in 4/5.

The series has been tested on amd64-linux with dwarf and stabs.
It needs more testing, eg., on other file formats (e.g., xcoff).
And it could use another set of eyes.

One thing I did was rename TYPE_DOMAIN_TYPE to TYPE_SELF_TYPE.
My mind is far too used to associating the word "domain" with
VAR_DOMAIN, STRUCT_DOMAIN, etc.  A better name would be nice.
I went with "self" because TYPE_THIS_TYPE was a bit confusing.
Another alternative is TYPE_TYPE_OF_THIS, but TYPE_SELF_TYPE
"works for me".  Internally, some of the debug info readers
still use "domain", which is fine by me, and I've left those alone.

1/5 - Finish TYPE_SPECIFIC_FIELD handling in copy_type_recursive
2/5 - Tighten up handling of types passed in gnu-v3-abi.c
      ["info vtbl my_int" will currently call INIT_CPLUS_SPECIFIC on that int!]
3/5 - Rename TYPE_DOMAIN_TYPE to TYPE_SELF_TYPE
4/5 - Create TYPE_SPECIFIC_SELF_TYPE and have TYPE_CODE_{METHODPTR,
      MEMBERPTR,METHOD} use it.
5/5 - Finally, move vptr_fieldno,vptr_basetype into cplus_struct_type.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype}
  2015-01-25 19:56 [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype} Doug Evans
@ 2015-02-01  5:48 ` Doug Evans
  2015-02-02  3:52 ` Joel Brobecker
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Evans @ 2015-02-01  5:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: gaius

Doug Evans <xdje42@gmail.com> writes:
> Hi.
>
> Anytime you can reduce the size of struct main_type that's A Good Thing.
> Alas in this case my motivation, besides more general cleanup (will it
> never end?), is that I may wish to add something to struct main_type.
> Now I can, if I need to.
>
> There are two fields in struct main_type that really shouldn't be there:
> vptr_fieldno, and vptr_basetype.  Every type has to pay the price
> in memory usage for their presence.  The proper place for them is
> in the type_specific field (in this case cplus_stuff) which exists
> for this purpose.
>
> Things are a bit complicated because vptr_basetype is overloaded
> to record the type of "this" for TYPE_CODE_{METHODPTR,MEMBERPTR,METHOD},
> and is accessed through the macro TYPE_DOMAIN_TYPE.
>
> There is also the wrinkle, discussed earlier, that m2-typeprint.c
> uses TYPE_DOMAIN_TYPE.  I've replaced that with TYPE_TARGET_TYPE
> and left a FIXME there (pre-discussed with Gaius).  This is done in 4/5.
>
> The series has been tested on amd64-linux with dwarf and stabs.
> It needs more testing, eg., on other file formats (e.g., xcoff).
> And it could use another set of eyes.
>
> One thing I did was rename TYPE_DOMAIN_TYPE to TYPE_SELF_TYPE.
> My mind is far too used to associating the word "domain" with
> VAR_DOMAIN, STRUCT_DOMAIN, etc.  A better name would be nice.
> I went with "self" because TYPE_THIS_TYPE was a bit confusing.
> Another alternative is TYPE_TYPE_OF_THIS, but TYPE_SELF_TYPE
> "works for me".  Internally, some of the debug info readers
> still use "domain", which is fine by me, and I've left those alone.
>
> 1/5 - Finish TYPE_SPECIFIC_FIELD handling in copy_type_recursive
> 2/5 - Tighten up handling of types passed in gnu-v3-abi.c
>       ["info vtbl my_int" will currently call INIT_CPLUS_SPECIFIC on that int!]
> 3/5 - Rename TYPE_DOMAIN_TYPE to TYPE_SELF_TYPE
> 4/5 - Create TYPE_SPECIFIC_SELF_TYPE and have TYPE_CODE_{METHODPTR,
>       MEMBERPTR,METHOD} use it.
> 5/5 - Finally, move vptr_fieldno,vptr_basetype into cplus_struct_type.

Hi.

I've done additional regression testing on aix and mingw.
Committed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype}
  2015-01-25 19:56 [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype} Doug Evans
  2015-02-01  5:48 ` Doug Evans
@ 2015-02-02  3:52 ` Joel Brobecker
  1 sibling, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2015-02-02  3:52 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

> Anytime you can reduce the size of struct main_type that's A Good Thing.
> Alas in this case my motivation, besides more general cleanup (will it
> never end?), is that I may wish to add something to struct main_type.
> Now I can, if I need to.
> 
> There are two fields in struct main_type that really shouldn't be there:
> vptr_fieldno, and vptr_basetype.  Every type has to pay the price
> in memory usage for their presence.  The proper place for them is
> in the type_specific field (in this case cplus_stuff) which exists
> for this purpose.

Thanks for doing that, Doug.

-- 
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-02  3:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25 19:56 [PATCH 0/5] Remove struct main_type.vptr_{fieldno,basetype} Doug Evans
2015-02-01  5:48 ` Doug Evans
2015-02-02  3:52 ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).