public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: gcc-patches@gcc.gnu.org,  dj@redhat.com
Subject: Re: stabilize .gcc_except_table with or without -g
Date: Mon, 05 Nov 2007 19:20:00 -0000	[thread overview]
Message-ID: <472F6CD4.3010408@codesourcery.com> (raw)
In-Reply-To: <or3avl2m8a.fsf@oliva.athome.lsd.ic.unicamp.br>

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

  reply	other threads:[~2007-11-05 19:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05  7:19 Alexandre Oliva
2007-11-05 19:20 ` Mark Mitchell [this message]
2007-11-26  9:33   ` Alexandre Oliva
2007-11-05 20:41 ` DJ Delorie
2007-11-07  6:34   ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=472F6CD4.3010408@codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=aoliva@redhat.com \
    --cc=dj@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).