if we implement java interpreter in hardware then how we can achieve architecture neutrality of java bytecode... does java uses JIT(just in time interpreter) ? and how all this is related to Virtual Machine concept of operating system and java virtual machine(JVM)
views:
486answers:
4- Implementing the JVM in hardware ignores the advantage of running managed code. What different would it then be from any other native code. And yes, the platform neutrality is also hindered. Regardless, there are such implementations, check out the aJile series of processors and ARM's Jazelle. These are targeted at embedded platforms though.
- Sun's compiler, HotSpot uses JIT. I personally haven't used others but it should be a highly used technology.
- JVM can be thought of as a limited resource VM, targeted at only one specific platform (the Java bytecode).
Yes, you can. Although this looks like it is stuck in the specification stage (or was abandoned), picoJava allows for native execution of Java bytecode. picoJava has a port available on a FPGA. There is Jazelle, as well for ARM processors.
Given that hardware would directly execute bytecode, all optimizations would also have to be done in hardware. JIT would not be required, since the processor will execute bytecode directly. After all any hardware implementation would involve implement the JVM model as defined in the Java Virtual Machine Specification. Optimizations that can be performed, will be on the lines of hardware optimizations - instruction pipelining, use of caches etc.
Hardware neutrality is not lost, since the bytecode executing on a hardware implementation would continue to work on a software implementation as well. It is the bytecode standard that allows Java to be hardware neutral.
There has already been several hardware implementations of the Java system (i.e. a CPU that can execute bytecodes) but they have not become mainstream. This is most likely because that software implementations perform as well or even better as CPU's have become faster and faster.
As you will find when investigating more thouroughly, the details of the JVM implementations are not that important (and vary quite a bit) but they all execute the machine language of the JVM - java byte code. If you stay within the Java world and do not link in "native" stuff, you should be fine with whatever implementation you choose.
This company makes a living of providing server systems tuned for Java programs, they might interest you: http://www.azulsystems.com/
Yes, there are several hardware Java implementations. However, they don't always perform better than software running on more general-purpose silicon.
The java.net site is currently screwed up due to a new, extremely buggy content management system, but Mark Lam has written several interesting blogs entries on this subject. You might be able to email him and get the full text of his articles.