classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A java DEBUG flag


From: Bryce McKinlay
Subject: Re: A java DEBUG flag
Date: Fri, 24 Nov 2000 23:21:12 +1300

Mark Wielaard wrote:

> > > If we used something like
> > > System.getProperty("gnu.java.io.serialisation.debugging") to set these
> > > constants (you can even do that in an interface)
> >
> > I don't think so ;-)
>
> What don't you think so?
> What I meant was something like the following:
>
> interface I {
>     boolean SERIALISATION_DEBUG =
>         Boolean.getBoolean("gnu.java.io.serialisation.debugging");
> }

But this is not a constant! It can only be evaluated at runtime. A bytecode
compiler or native compiler like gcj cannot determine the value of the flag, and
must emit a branch. Granted, a smart JIT will be able to take advantage of it
being a final field and eliminate the debug code from what it generates. 
However,
if it is used extensively in the runtime then it is probable that the flag would
be evaluated before the system property is set, making it useless.

regards

  [ bryce ]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]