Wolfgang Hoschek <[EMAIL PROTECTED]> writes:
> That's the reason the PentiumIII introduces new helper
> instructions for prefetching memory and hiding memory latency. 

I doubt that many C compilers take advantage of these instructions
yet. However, a large number of JIT compilers do in fact perform
architecture-specific optimizations - however, perhaps not as esoteric
as the ones you are describing.

> Seems to indicate that VM vendors are still struggling to
> get functionality and stability right, and have not yet found time to
> work on important levels of optimization.

Not true. I know that the IBM and Sun JIT compilers both do fairly
advanced optimizations. The IBM compiler is really impressive; having
worked on several JIT compilers myself I can say that they have done
considerable work to have it generate extremely efficient code. Also keep in
mind that IBM is supporting not only Linux/x86 but about a dozen other 
platforms as well. It's pretty impressive.

You have to remember that optimizations such as inlining and loop unrolling
become more complicated in an OO environment, especially with Java. Java
raises a number of very interesting optimization challenges, many of which
are quite different from their variants in C++ and Smalltalk (not to mention
Self, or even C). A lot of the difficulty arises in preserving the exact
semantics of the Java programming language, many of the rules you'd really
like to bend to get better performance. Sun has occasionally had to revise
the JVM spec in order to get it to mesh well with their compilers; for 
example, the semantics of locks (JVM spec sec 8.13) were changed slightly 
in the second edition of the JVM spec to accommodate some specific 
optimizations in HotSpot. 

The speed of Java code is not entirely based on the efficiency of the code 
generated by the JIT; it's also a function of thread synchronization,
garbage collection and other memory system overhead, traversals to and from
native code, and other aspects of the runtime -- most of which are outside
of the domain of the JIT. If you are interested in some of these issues, a
good source of information are the various white papers by the EVM (Exact VM)
team at Sun Labs, as well as earlier work on Self (some of which was done 
by the same people). Unfortunately there's not much in print about the IBM
JIT, although some other interesting problems are dealt with by the IBM
Ninja (not to be confused with Berkeley Ninja) and Jalapeno projects, which
you can find from the IBM Research web pages. 

It's unlikely that such a low-level optimization as memory prefetching on
the Pentium III can be attributed to much of the performance imbalance between
Java and, say, C. There are a lot of other more critical performance problems
to solve first.

Matt Welsh, [EMAIL PROTECTED]
UC Berkeley


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to