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: stabilize .gcc_except_table with or without -g


Alexandre Oliva wrote:

> I haven't completed bootstrap-testing of this patch yet, but it has
> shaved off more than half of the remaining compare-debug differences
> between libjava compiled with -fvar-tracking-assignments enabled or
> disabled on x86_64-linux-gnu.
> 
> Ok to install if it passes bootstrap?  Should new the compare function
> be moved into libiberty proper?  Does the assertion check seem safe in
> the context of this use, that when pointers differ then the strings
> they point to must differ as well?  It's not necessary, but I thought
> it would be nice to make sure we weren't goofing with identical symbol
> names at different locations before.  I could be easily convinced to
> take it out, though.

Thanks for working on this issue.

+/* Compare C strings used as keys in a splay tree, optimizing the case
+   in which the pointers are identical.  We need to use string rather
+   than pointer comparison in order to make Java exception action
+   records stable in the presence of different debug info options.  */

I think a lot of this comment is unhelpful.  I would say:

  /* Comparison function for a splay tree in which the keys are strings.
     K1 and K2 have the dynamic type "const char *".  Returns <0, 0,
     or >0 to indicate whether K1 is less than, equal to, or greater
     than K2, respectively.  */

The optimization isn't important to a reader trying to understand the
function is for.  The Java comment is confusing, in that it might lead
you to think that without Java we don't need to do this -- but, quite
probably, we do.  In the body of the function, you could write:

  /* We use strcmp, rather than just comparing pointers, so that the
     sort order will not depend on the host system.  */

If you leave the assertion in, you definitely should comment:

  /* The strings are always those from IDENTIFIER_NODEs, and, therefore,
     we should never have two copies of the same string.  */

The patch is OK with those changes.  If DJ prefers to put this function
in libiberty, that's fine; if you check it into GCC first, consider a
patch to adjust GCC to call into libiberty pre-approved.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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