Recent articles:
Popular archives:
Java: A platform for platforms
Sun's reorg may seem promising to shareholders but it's also a scramble for position. The question now is whether Sun can,
or wants to, maintain its hold on Java technology. Especially with enterprise leaders like SpringSource and RedHat investing
heavily in Java's future as a platform for platforms
Also see:
Discuss: Tim Bray on 'What Sun Should Do'
Java achieves architectural independence by compiling its source code into its own intermediate representation, not the typical machine-specific op-codes of a particular hardware platform. The intermediate representation is called byte code. The byte code produced is designed to run in a stack-based architecture. Unlike the assembly-language representation of most modern machines that are register based, a stack-based machine has no registers. The JVM is an abstract computer architecture based on a dynamic stack that provides operations to push, pop, and manipulate data. The JVM's main function is to load classfiles and execute the resulting byte codes.
Programmers can tune four main execution workloads in the JVM in order to improve performance. Typically, the execution workload of the JVM is segmented into byte code execution, garbage collection, thread management, and dynamic operations (e.g., dynamic class loading, type checking, and so on).
The Java HotSpot performance engine is Sun's next-generation compilation technology that compiles only performance-critical code. The latest version of HotSpot provides both client- and server-side solutions.
A JIT compiler simply compiles byte code as it executes. JIT refers to the fact that it compiles byte code only when it's ready to be executed -- just in time, in other words. JIT compilers are very powerful because only code that actually executes is compiled; methods that are executed frequently can be retrieved from the native method cache at execution time and executed on the fly. There is one big issue with JIT compilers: once a method has been compiled, it loses the power of portability, because it has been compiled to the native code of the hardware and consequently isn't portable any longer.