This is the first of a "deep Understanding JVM" series blog that aims to control the whole process first, and then step through it. Most of this blog content comes from http://www.cnblogs.com/dqrcsc/p/4671879. Htmljava some places to rearrange, based on their own understanding of the content-tml Overview
1At this point, the assignment of 5 is not performed, but it is initialized to 0.
Parsing phase
5 because it has been loaded into memory, the original bytecode file in some of the methods, fields, and other symbolic references can be resolved to its direct reference in memory, and not necessarily wait until the actual runtime to parse.
Initialization phase
6 because it has been loaded into memory, the original bytecode file in some of the methods, fields, and other symbolic references can be resolved to its direct reference in memory, and not necessarily wait until the actual runtime to parse.
There is only one static field in the Student.java:
The parent class and its implementation interface to which a class loads before loading
1 2 3 4 5 6 7 8 9 10 11
Mximum stack depth Specifies that the current method, the main () method, corresponds to the maximum depth of the operand stack in the stack frame with the current value of 5
Maximum Local variables Specifies the size of the locals table in the main () method, currently 2, and has two slot for the method's parameters and local variables.
1 2 3 4 5 6 7Although only 3 parameters are explicitly defined in the definition, and a reference to the current object is implicitly passed as the first argument, the four arguments are this,age,name,sid in turn.
The 4 instructions above just put the values of the four parameters into the stack, pass the parameters, and then call the Student.<init> () method, which creates the stack frame of the method and merges it into the stack. The No. 0 to 4th slot of the local variable table in the stack frame holds the four parameter values in the stack respectively.
Create a stack frame for the studet.<init> () method:
Byte code directive in the Student.<init> () method:
ALOAD_0: Place the reference value of the local variable table slot0 into the stack
Aload_1: Place the int value of the local variable table slot1 into the stack
Aload_2: Place the reference value of the local variable table Slot2 into the stack