This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: assert facility
- From: shudo at computer dot org
- To: tromey at redhat dot com
- Cc: java at gcc dot gnu dot org
- Date: Wed, 12 Jun 2002 15:10:33 +0900 (JST)
- Subject: Re: assert facility
- References: <87660pk91t.fsf@creche.redhat.com>
From: Tom Tromey <tromey@redhat.com>
> FYI, I'm checking in the 1.4 assert facility. I still haven't written
> the new command-line arguments that actually enable assertions. I'll
> submit a PR for this.
Can we avoid performance penalty in case some assertions are compiled
into a binary and they are disabled by the command-line option?
If compilation is performed at runtime, conditional branches for
assertions can be eliminated by (runtime-)constant propagation.
But, I'm not sure whether it could be possible for GCJ.
> It also might make sense to add a gcj flag indicating that assertions
> will never be enabled. This could be useful for compiling production
> code.
Note that Sun does not provide means to eliminate assertions from
bytecode intentionally (*). And Sun recommends "conditional
compilation idiom" described in JLS 14.20, which means using `static
final boolean' flag for elimination.
(*) Programming With Assertions
http://java.sun.com/j2se/1.4/docs/guide/lang/assert.html
"1. Why not provide a compiler flag to completely eliminate assertions
from object files?"
Should we provide a gcj flag to eliminate all assertions?
I'm not sure.
Kazuyuki Shudo shudo@computer.org http://www.shudo.net/