Understanding how java byte code converts to machine code
Answers
Answered by
1
firstly java source code is converted into Bytecode file by the translator named “Compiler”. The byte code file gets name with .class extension and javac (java compiler) is the tool to compile the .java file.
Then,
java is a tool use to invoke Java Interpreter “JVM”. Now, the work of JVM starts. When JVM invoke,
1. a subprogram in JVM called Class loader (or system class loader) starts and load the bytecode into OS memory( or RAM).
2. another subprogram Bytecode Verifier verify and ensure that the code do not violate the security rules. That’s why the java program is much secured and virus free.
3. Then last subprogram Execution Engine finally converts bytecodes into machine code. The name of that engine are in use today is JIT Just In Compiler.
before JIT, Silicon and adaptive execution engine were used but there performance was very degraded and slow.
This is how actually the java program is compiled and interpreted. Hope you will understand it. Good luck !
Similar questions