Re: Optimizations performed by javac

FX <>
15 May 1998 22:34:17 -0400

          From comp.compilers

Related articles
Optimizations performed by javac (Elliot Waingold) (1998-05-12)
Re: Optimizations performed by javac (FX) (1998-05-15)
| List of all articles for this month |

From: FX <>
Newsgroups: comp.compilers
Date: 15 May 1998 22:34:17 -0400
Organization: IRISA, Campus de Beaulieu, 35042 Rennes Cedex, FRANCE
References: 98-05-081
Keywords: Java, optimize

Elliot Waingold wrote:
> Can anyone give me a list of optimizations that Sun's Java compiler
> performs (when passed -O)? Also, a pointer to such information would
> be very useful.


from :


javac -O
                            Directs the compiler to try to generate faster code by
inlining static, final and private methods. This option may slow down
compilation, make larger class files, and/or make it difficult to debug.
-O implicitly turns on -depend and turns off -g.
                            This option informs the compiler that all generated class
files are guaranteed to be delivered and upgraded as a unit, enabling
optimizations that may otherwise break binary compatibility. Use this
option with discretion.
                            The Java Language Specification section 13.4.21 describes
situations in which it is legal to use a java compiler to inline
methods. The compiler will only optimize code for which source is
available during the compilation, so the only .java files discoverable
by the compiler should be for classes intended to be delivered or
upgraded as a unit. In particular, ensure that no sources for other
classes are accessible on CLASSPATH, keeping in mind that the present
working directory, `.', is appended to CLASSPATH.
                            To ensure that a product is able to run on 1.1 as well as
future binary-compatible java virtual machines, one must ensure that any
sources for JDK 1.1 classes are never available along CLASSPATH while
using -O.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.