This is the mail archive of the gcc@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: Switching to C++ by default in 4.8


On 4/10/12, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Apr 09, 2012 at 04:34:32PM -0700, Xinliang David Li wrote:
> > Class hierarchy is one such feature that is useful. Assuming we
> > have two hierarchies for gcc: one for values rooted at ValExp,
> > and one for gimple stmts rooted at GimpInst.
> >
> > 1) For IR browsing,
> > *) all the macro accessors can be eliminated -- a big plus
> > for debugging;
>
> Not that clear, if all the macros are replaced by tons of
> inline functions, the debugging experience can be actually
> significantly worse.  Already some the inline functions used
> like tree_operand_length used by TREE_OPERAND_LENGTH macro are
> extremely annoying from debugging POV.

We have options availble to supress those functions in the debugger.
Longer term, better debugger support for C++ is the right thing
to do.

> > *) gcc implementation has lots of hard coded
> > TREE_OPERAND (exp, nn)
> >
> > e.g.
> >   exp->as_component_ref().get_field() ..
> >   exp->as_mem_access().get_base() ...
> >   exp->as_mem_acesss().get_address()
> >   --> produces the address expression for memory access
> >   exp->as_mem_access().get_alias_handle ()
> >   gimple_inst->serialize (&fixup_list)
> >   --> a virtual function overriden by actual instruction types
> >   that knows its byte code format.
>
> That silently assumes we want to change basic GIMPLE/tree data
> structures to virtual classes, which is a significant change
> that has a significant cost as well.

I think he was explicit about virtual functions.  By virtual classes
did you mean virtual bases or classes with virtual functions?
I have not seen a need for virtual classes.  In any event, much
of this work could be done without virtual functions, though that
would not be my choice due to the added overhead and complexity.

> E.g. all such changed data structures grow by a virtual pointer
> field.  Those data structures are heavily optimized for memory
> footprint.  Not to mention it is very questionable if the above
> stuff is more readable than what we currently have.

A virtual pointer can reduce the size because the dynamic type
can encode quite a bit of information that is currently encoded
in bitfields.

In addition, while the current data structures are densely packed,
they are not necessarily information rich.  In the PPH branch,
we found that near half the pointers we were streaming were null,
which says that many of the fields are unused.  This information
could be shifted to auxilary tables.

-- 
Lawrence Crowl


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