Home » Java » The loading process of the virtual machine class

The loading process of the virtual machine class

Introduction:
you need to run the program you write, first need to compile the calss file, save the virtual machine can identify the binary byte code, is 1,0 ah. But you need to put your binary information into the virtual machine to the virtual machine, where he is a running program to put into memory where exactly is put into the virtual machine management of memory, so I have to review some action under the virtual machine load class file, the interview to ask ah ~

Seven stages of class loading:
loading, verification, preparation, analysis, initialization, use (use and uninstall uninstall. Do not say
)
The first five stages of summary:
1. is divided into three stages: loading

1) the fully qualified name of the class loading binary stream.

2) the static storage structure of the Class file in binary stream methods to run the data structure stored in.

3) is generated and stored a representation of the class object in the Class method, the external interface of the.
class as the data access method in the program
Note:
array does not need to load, but by JVM created

2. verification:

1) to verify the magic number, version number.
)
2) metadata validation to verify compliance with the Java standard semantic metadata, whether the parent class, whether inherited final which cannot be inherited class).

3) bytecode verification method for verification of instruction bytes each other, such as jump instructions not to jump to the.
method etc.)
4) symbol reference verification function (such as symbolic references can be found.
class)
3.:

1) class level variables allocated initial value set, 8 basic types in 0 or false, a reference type is null.

4.:

1) will be transformed into direct references to the.
symbol reference
5. initialization:

1) according to the class code in the real first according to Bob's subjective awareness of various variables on a class assignment do initialization (such as: class variables real initialization assignment).

6.:.

7.:.
uninstall

Latest