Each JVM instruction consist of
a) one byte opcode : 3 reserved opcodes, 200 standard opcodes, 25 quick variations of some opcodes for dynamic binding
b) zero or more operands
opcode tells JVM what to do.
Example :
a7 goto(opcode)
fff9 operand which defined offset to jump
Menemonic for above instruction is goto and bytecode is a7 hex.
JVM architecture :
-------------------
Runtime Data Areas Shared Across Threads
In JVM Memory Locations are 32 bit long so there can be 2power32 memory locations.
Each memory location is of 1 byte. So maximum data stored is of 1byte*2power32=4294.96MB.
So each memory address will take 32 bits if need to store in some register.
Primitive Types : byte - 8bits,short (16 bits), int(32 bits), long (64 bits), float (32 bits), double (64 bits), and char (16 bits) and Object handle(32bits) pointer for address of object on heap.JVM has stack oriented design so have very few registers.
Suppose a Thread is executing a method then
- a new Stack Frame is created each time a method is invoked. A stack frame holds statefor current executing method (local variables, the parameters with which it was invoked, its return value (if any), and intermediate calculations).
- Program Counter or PC register : If the thread is executing a Java method (not a native method), the value of the pc register indicates the next instruction to execute.
- optop ,frame register ,vars register : point to various parts of the stack frame of the currently executing method
Basically a stack frame contains the state of one Java method invocation.
No comments:
Post a Comment