public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Per Bothner <per@bothner.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>,
	Java Patch List <java-patches@gcc.gnu.org>,
	Alexandre Petit-Bianco <apbianco@cygnus.com>
Subject: Re: Patch: don't generate dead bytecode
Date: Thu, 11 Oct 2001 20:16:00 -0000	[thread overview]
Message-ID: <87u1x5lejy.fsf@creche.redhat.com> (raw)
In-Reply-To: <3BC62CED.1080903@bothner.com>

>>>>> "Per" == Per Bothner <per@bothner.com> writes:

Per> 2001-10-11  Per Bothner  <per@bothner.com>
Per>     * parse.y (patch_if_else_statement):  If the condition is constant,
Per>     optimize away the test.

This patch almost fixes all the problems.  One remains:

/x1/egcs/build/gcc/gcj -B/x1/egcs/build/i686-pc-linux-gnu/libjava/ -B/x1/egcs/build/gcc/ --encoding=UTF-8 --syntax-only ./java/io/ObjectInputStream.class
java/io/ObjectInputStream.java: In class `java.io.ObjectInputStream':
java/io/ObjectInputStream.java: In method `java.io.ObjectInputStream.dumpElement(java.lang.String)':
java/io/ObjectInputStream.java:1538: warning: Unreachable bytecode from 3 to before 16.
java/io/ObjectInputStream.java: In method `java.io.ObjectInputStream.dumpElementln(java.lang.String)':
java/io/ObjectInputStream.java:1544: warning: Unreachable bytecode from 3 to before 16.


Some of the code in question looks like this:

  private void dumpElement (String msg)
  {
    if (Configuration.DEBUG && dump)  
      System.out.print(msg);
  }

Here's the corresponding bytecode:

  0: goto 16
  3: getstatic #922=<Field java.io.ObjectInputStream.dump boolean>
  6: ifeq 16
  9: getstatic #926=<Field java.lang.System.out java.io.PrintStream>
 12: aload_1
 13: invokevirtual #931=<Method java.io.PrintStream.print (java.lang.String)void>
 16: return


It looks like `&&' isn't being short-circuited properly.

Tom

  reply	other threads:[~2001-10-11 20:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-09  8:16 Tom Tromey
2001-10-09 12:24 ` Per Bothner
2001-10-09 17:08 ` Per Bothner
2001-10-09 17:40   ` Per Bothner
2001-10-11 16:35     ` Per Bothner
2001-10-11 20:16       ` Tom Tromey [this message]
2001-10-12 17:09         ` Per Bothner
2001-11-13 15:03           ` Tom Tromey
2001-11-13 15:03             ` Per Bothner
2001-11-13 15:03               ` Tom Tromey
2001-11-13 15:03                 ` Per Bothner
2001-11-13 15:03               ` Bryce McKinlay

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=87u1x5lejy.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=apbianco@cygnus.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    --cc=per@bothner.com \
    /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).