JVM 常量池条目
JVM Constant Pool Entries
查看 运行 javap
在某些 类 上的输出,我遇到了以下奇怪的事情:
某些 类 的常量池包含
等条目
#33 = Utf8 Code
#34 = Utf8 LocalVariableTable
#35 = Utf8 StackMapTable
#36 = Utf8 MethodParameters
为什么这些常量会出现在常量池中?
以下常量
#33 = Utf8 Code
#34 = Utf8 LocalVariableTable
#35 = Utf8 StackMapTable
#36 = Utf8 MethodParameters
是attributes的名字。
For all attributes, the attribute_name_index must be a valid unsigned 16-bit index into the constant pool of the class. The constant_pool entry at attribute_name_index must be a CONSTANT_Utf8_info structure (§4.4.7) representing the name of the attribute.
您提到的属性具有以下功能:
Code
属性包含Java虚拟机指令和方法的辅助信息,包括实例初始化方法或class或接口初始化方法。
- 调试器可以使用
LocalVariableTable
属性 [...] 来确定方法执行期间给定局部变量的值。
- 在通过类型检查进行验证的过程中使用了一个
StackMapTable
属性
MethodParameters
属性记录有关方法形式参数的信息,例如它们的名称。
查看 运行 javap
在某些 类 上的输出,我遇到了以下奇怪的事情:
某些 类 的常量池包含
等条目#33 = Utf8 Code
#34 = Utf8 LocalVariableTable
#35 = Utf8 StackMapTable
#36 = Utf8 MethodParameters
为什么这些常量会出现在常量池中?
以下常量
#33 = Utf8 Code
#34 = Utf8 LocalVariableTable
#35 = Utf8 StackMapTable
#36 = Utf8 MethodParameters
是attributes的名字。
For all attributes, the attribute_name_index must be a valid unsigned 16-bit index into the constant pool of the class. The constant_pool entry at attribute_name_index must be a CONSTANT_Utf8_info structure (§4.4.7) representing the name of the attribute.
您提到的属性具有以下功能:
Code
属性包含Java虚拟机指令和方法的辅助信息,包括实例初始化方法或class或接口初始化方法。- 调试器可以使用
LocalVariableTable
属性 [...] 来确定方法执行期间给定局部变量的值。 - 在通过类型检查进行验证的过程中使用了一个
StackMapTable
属性 MethodParameters
属性记录有关方法形式参数的信息,例如它们的名称。