Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this questionJava is a beautifully crafted OO language but the first thing I noticed is how slow it is (compared to C++). This is probably because it has to go through another layer of translation (the VM) instead of running directly in the CPU's native microcode.
My question: Do you know of any attempts to create Java-specific CPU's that run Java natively without requiring the software-implemented VM?
Sun designed the picoJava processor about 10 years ago, but it never went anywhere - there was no market for it at the time, and modern VMs render the concept pretty pointless.
Then there's the fledgling ARM Jazelle architecture.
The only reference I found so far to this conundrum is the following article:
http://www.theserverside.com/discussions/thread.tss?thread_id=59958
While I was initially interested in first knowing whether there are Java-CPU's and what they are, this thread sheds some light on why I haven't heard of any (until I read the learned replies here). The last comment, by Alex Besogonov, seems to be the best explanation:
Java bytecode is NOT suited to be run on real hardware. It's stack-based, so pipelining goes out of the window. In theory, one can do on-the-fly translation from stack-based to register-based machine, but it'll require A LOT of transistors.
So in reality, it's ALWAYS more effective to JIT-compile Java bytecode and then run it on a common CPU. There is one exception JVMs for low-power devices where the speed of hardware JVM is not a problem (remember Forth CPUs).
Of course, hardware can still provide few features to speed up JVMs. Like hardware-assisted forwarding pointers which allow to create fast real-time compacting pauseless GC (I assume Azul hardware has this support).
This is very interesting. Thank you all for your answers.
Azul Systems designs systems from the ground up with (massive services running on) Java in mind, including hardware-assisted garbage collection.
There's also GCJ for compiling Java to native code, though it is not a complete implementation of Java.
You might want to try JOP
It's open source and you can try it on your own hardware.
精彩评论