常量池

Constant pool tags

Constant Type Value
CONSTANT_Class 7
CONSTANT_Fieldref 9
CONSTANT_Methodref 10
CONSTANT_InterfaceMethodref 11
CONSTANT_String 8
CONSTANT_Integer 3
CONSTANT_Float 4
CONSTANT_Long 5
CONSTANT_Double 6
CONSTANT_NameAndType 12
CONSTANT_Utf8 1
CONSTANT_MethodHandle 15
CONSTANT_MethodType 16
CONSTANT_InvokeDynamic 18

 

CONSTANT_Class_info 

The tag item has the value CONSTANT_Class (7)

CONSTANT_Class_info {
    u1 tag;
    u2 name_index;
}

 

The CONSTANT_Fieldref_infoCONSTANT_Methodref_info, and CONSTANT_InterfaceMethodref_info Structures

tag

The tag item of a CONSTANT_Fieldref_info structure has the value CONSTANT_Fieldref (9).

The tag item of a CONSTANT_Methodref_info structure has the value CONSTANT_Methodref (10).

The tag item of a CONSTANT_InterfaceMethodref_info structure has the value CONSTANT_InterfaceMethodref (11).

CONSTANT_Fieldref_info {
    u1 tag;
    u2 class_index;
    u2 name_and_type_index;
}

CONSTANT_Methodref_info {
    u1 tag;
    u2 class_index;
    u2 name_and_type_index;
}

CONSTANT_InterfaceMethodref_info {
    u1 tag;
    u2 class_index;
    u2 name_and_type_index;
}

 

The CONSTANT_String_info Structure

The tag item of the CONSTANT_String_info structure has the value CONSTANT_String (8).

CONSTANT_String_info {
    u1 tag;
    u2 string_index;
}

The CONSTANT_Integer_info and CONSTANT_Float_info Structures

The tag item of the CONSTANT_Integer_info structure has the value CONSTANT_Integer (3).

The tag item of the CONSTANT_Float_info structure has the value CONSTANT_Float (4).

CONSTANT_Integer_info {
    u1 tag;
    u4 bytes;
}

CONSTANT_Float_info {
    u1 tag;
    u4 bytes;
}

The CONSTANT_Long_info and CONSTANT_Double_info Structures

The tag item of the CONSTANT_Long_info structure has the value CONSTANT_Long (5).

The tag item of the CONSTANT_Double_info structure has the value CONSTANT_Double (6).

CONSTANT_Long_info {
    u1 tag;
    u4 high_bytes;
    u4 low_bytes;
}

CONSTANT_Double_info {
    u1 tag;
    u4 high_bytes;
    u4 low_bytes;
}

The CONSTANT_NameAndType_info Structure

The tag item of the CONSTANT_NameAndType_info structure has the value CONSTANT_NameAndType (12).

CONSTANT_NameAndType_info {
    u1 tag;
    u2 name_index;
    u2 descriptor_index;
}

The CONSTANT_Utf8_info Structure

The tag item of the CONSTANT_Utf8_info structure has the value CONSTANT_Utf8 (1).

CONSTANT_Utf8_info {
    u1 tag;
    u2 length;
    u1 bytes[length];
}

 The CONSTANT_MethodHandle_info Structure

The tag item of the CONSTANT_MethodHandle_info structure has the value CONSTANT_MethodHandle (15).

CONSTANT_MethodHandle_info {
    u1 tag;
    u1 reference_kind;
    u2 reference_index;
}

 

The CONSTANT_MethodType_info Structure

The tag item of the CONSTANT_MethodType_info structure has the value CONSTANT_MethodType (16).

CONSTANT_MethodType_info {
    u1 tag;
    u2 descriptor_index;
}

The CONSTANT_InvokeDynamic_info Structure

The tag item of the CONSTANT_InvokeDynamic_info structure has the value CONSTANT_InvokeDynamic (18).

CONSTANT_InvokeDynamic_info {
    u1 tag;
    u2 bootstrap_method_attr_index;
    u2 name_and_type_index;
}

 

来源

https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4

 

 

上一篇:MP4转mp3


下一篇:4.2Java参数传值机制