JVM consists of a class loader subsystem and a java interpreter and jit that executes the architecture neutral bytecode.
the class loader loads the compiled .class file from both the java program and the java api for execution by the java interpreter or jit.
After a class is loaded the verifier checks that the .class file is valid java bytecode and does not overflow or underflow the stack if also ensures that the bytecode does not perform pointer arithmetic,which could provide illegal memory access. if the classes pass verification it is going to allocated memory required by the program.
memory allocated by the class loader subsystem is divided into 5 parts called run time data areas.
- Method Area
- This is the place where class code and methods code is stored.
- Heap
- Objects are created by the JVM are stored into the heap memory.
- Java Stack
- These are the areas where java methods are executed. java stack are divided into frames on each fram a saparated method is executed. methods run in java stacks.
- PC Registers
- It stores the memory address of the next instruction to be executed by the microprocessor.
- Native Method Stack
- These are the area's where native methods are executed(c,c++ functions).
c,c++ header files are declared in native method libraries. native method libraries are copied into jvm by a program native method interface.
next passes to execution engine.
Execution engine contains interpreter and JIT compiler which convert byte code into machine code.
java interpreter can execute java bytecode directly on any machine to which the interpreter has been ported.
JIT compiler is used to enhanse the speed of the execution just in time when the multiple times execution methods are executed.
No comments:
Post a Comment