Content deleted Content added
TittoAssini (talk | contribs) mNo edit summary |
No edit summary |
||
Line 5:
Programs written in Java are compiled into a standardized portable binary format, which typically comes in the form of files with the [[class (file format)|.class]] extension. A program may consist of many classes, in which case, every class will be in a different file. The first 4 bytes in hexadecimal of each class must be CA FE BA BE. Class files may be packaged together in a [[jar (file format)|.jar]] file, with the exact same format as a [[zip (file format)|.zip]] file, optionally with a few extra special files added.
This binary is then
The JVM has a [[Stack (computing)|stack]] based architecture
Each [[Thread (computer programming)|thread]] has its own program counter.
Code verification is applied to bytecode class files by the runtime at program load time. This means that only a limited amount of bytecode sequences form valid programs, e.g. a JUMP (branch) instruction can only target an instruction within the same function. Because of this, the fact that JVM is a stack architecture does not imply a speed penalty for emulation on register based architectures when using a JIT compiler: In face of the codeverified JVM architecture, it makes no difference to a JIT compiler whether it gets named imaginary registers or imaginary stack positions that need to be allocated to the target architectures registers. In fact, code verification makes JVM different to a classic stack architecture whose efficient emulation with a JIT compiler is more complicated and typically carried out by a more slow interpreter.
Code verification also ensures that arbitrary bitpatterns cannot get used as an address. [[Memory protection]] is achieved without the need for an [[MMU]]. Thus, JVM is an efficient way of getting memory protection on simple silicon that got no MMU.
▲The JVM has a [[Stack (computing)|stack]] based architecture. Each [[Thread (computer programming)|thread]] has its own program counter.
The JVM has instructions for the following groups of tasks
Line 26:
The aim is binary compatiblity. Each particular host [[operating system]] needs
More complicated than just the emulation of bytecode is compatible and efficient implementation of the java core [[API]] which got to be mapped to each host operating system.
The specification for the JVM is published in book form and [[HTML]] and anybody is allowed to write an implementation of it. The preface states:
|