During the class loading process in the JVM, during the parsing phase, the Java virtual Opportunity replaces the symbolic reference in class two-level data with a direct reference.
1. Symbol reference (symbolic References):
A symbol reference describes a target in a set of symbols, which can be any form of literal, as long as it can be used without ambiguity in the target. For example, in a Class file it appears as constants of type Constant_class_info, Constant_fieldref_info, Constant_methodref_info, and so on. The symbolic reference is independent of the memory layout of the virtual machine, and the referenced target does not necessarily load into memory. In Java, a Java class will be compiled into a class file. At compile time, the Java class does not know the actual address of the referenced class, so it can only be substituted with symbolic references. For example, the Org.simple.People class refers to the Org.simple.Language class, and at compile time the people class does not know the actual memory address of the Language class, so only the symbolic org.simple.Language is used (assuming this is, of course, actually by a C-like Onstant_class_info represented) to represent the address of the language class. The memory layouts implemented by various virtual machines may be different, but they can accept a consistent symbol reference because the literal form of the symbol reference is clearly defined in the Java Virtual Machine specification's class file format.
2. Direct reference: A direct reference can be (1) A pointer to a target directly (for example, to a "type" "Class object", a class variable, a direct reference to a class method may be a pointer to a method area) (2) A relative offset (for example, pointing to an instance variable, The direct reference to the instance method is offset) (3) a direct reference to a handle that can be indirectly anchored to the target is related to the layout of the virtual machine, and the same symbolic reference is generally not the same as the direct reference that is translated on the different virtual machine instances. If there is a direct reference, the referenced target must already be loaded into memory.
Java--the symbol reference and direct reference of the JVM