Re: Java compiler optimizations?

Kees van Reeuwijk <>
9 Jan 2001 23:20:34 -0500

          From comp.compilers

Related articles
Java compiler optimizations? (suganya) (2001-01-04)
Re: Java compiler optimizations? (2001-01-05)
Re: Java compiler optimizations? (Zhiyong Wang) (2001-01-09)
Re: Java compiler optimizations? (Kees van Reeuwijk) (2001-01-09)
Re: Java compiler optimizations? (Eliot Miranda) (2001-01-09)
Re: Java compiler optimizations? (2001-01-11)
Re: Java compiler optimizations? (Eliot Miranda) (2001-01-18)
| List of all articles for this month |

From: Kees van Reeuwijk <>
Newsgroups: comp.compilers
Date: 9 Jan 2001 23:20:34 -0500
Organization: Delft University of Technology
References: 01-01-012 01-01-018
Keywords: Java, optimize
Posted-Date: 09 Jan 2001 23:20:34 EST

On 5 Jan 2001 14:07:01 -0500, (Ian L. Kaplan) wrote:

>In article suganya <> wrote:
>>What are the differences between the java compiler optimizations & other
>>compiler optimizations? And also give related sites and materials
>>available if so.
> For a given class of compiler, I suspect that there is no difference
> between Java optimization and C++ optimization, for example.
> Because of the doctrinaire approach that Sun takes to Java, "Java
> compiler" usually means a compiler that generates JVM code.
> The optimizations that are done for JVM code would be different, in
> some cases, from native code optimizations (e.g., some optimizations
> would be tarted at the stack nature of the code). But a Java
> compiler that generated native code would optimize code in a similar
> way to a native C++ compiler.

Speaking as the implementor of a Java (plus extensions) static
compiler, I can only partly agree. There obviously is significant
overlap with C++ optimizations, but there are some peculiarities of
Java that influence the optimizations that can be done and that must
be done.

On the negative side, Java has null pointer exceptions, array bound
exceptions, some oddments about static class initialization, and
garbage collection. All of these features require optimization, or
they would dominate execution times in a significant set of programs.

Then there is the strictly defined evaluation order, and the fact that
the language has threads; both hamper optimization in some cases.

On the positive side, Java has no pointer arithmetics, and restricted
pointer casting, which allows analyzers to be quite a bit less

And I think that Java programs tend to be coded in a different style
from C++, which also has some impact.

Post a followup to this message

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