JVM architecture
JVM architecture can be described in terms of the runtime data structure in the memory and in terms of the two subsystems that use the runtime data – the classloader and execution engine.
Runtime data areas
Each of the runtime data areas of JVM memory belong to one of two categories:
- Shared areas, which include the following:
- Method area: Class metadata, static fields, methods bytecodes
- Heap area: Objects (state)
- Not shared areas, dedicated to each application thread, which include the following:
- Java stack: Current and caller frames, each frame keeping the state of Java (not native) method invocation:
- Values of local variables
- Method parameters values
- Values of operands for intermediate calculations (operand stack)
- Method return value (if any)
- Program Counter (PC) register: Next instruction to execute
- Native method stack: The state of native method invocations
- Java stack: Current and caller frames, each frame keeping the state of Java (not native) method invocation:
We have already discussed that a programmer has to be careful while using reference types to not modify the object itself...