标签:method odi des 准备 clr 加载 nta oam file
线程独占: 每个线程都会有它独立的空间,随线程的生命周而创建和销毁
线程共享: 所有线程都能访问这块内存数据,随虚拟机或GC而创建和销毁
使用Demo.Java进行测试, 运行javac Demo.java
编译成class文件, 然后运行javap -v Demo.class > Demo.txt
查看class文件内容
Demo.Java
public class Demo{
public static void main(String[] args){
int x = 500;
int y = 100;
int a = x / y;
int b = 50;
System.out.println(a + b);
}
}
Demo.txt
Classfile /E:/*/Demo.class
Last modified 2019-6-30; size 412 bytes
MD5 checksum efd785af33e58aa9fc9834110b74b87b
Compiled from "Demo.java"
public class Demo
minor version: 0 //次版本号
major version: 52 //主版本号 版本号规则: JDK5,6,7,8分别对应49,50,51,52
flags: ACC_PUBLIC, ACC_SUPER //访问标志
Constant pool: // 常量池 类信息包含的静态常量, 编译之后就能确认
#1 = Methodref #5.#14 // java/lang/Object."<init>":()V
#2 = Fieldref #15.#16 // java/lang/System.out:Ljava/io/PrintStream;
#3 = Methodref #17.#18 // java/io/PrintStream.println:(I)V
#4 = Class #19 // Demo
#5 = Class #20 // java/lang/Object
#6 = Utf8 <init>
#7 = Utf8 ()V
#8 = Utf8 Code
#9 = Utf8 LineNumberTable
#10 = Utf8 main
#11 = Utf8 ([Ljava/lang/String;)V
#12 = Utf8 SourceFile
#13 = Utf8 Demo.java
#14 = NameAndType #6:#7 // "<init>":()V
#15 = Class #21 // java/lang/System
#16 = NameAndType #22:#23 // out:Ljava/io/PrintStream;
#17 = Class #24 // java/io/PrintStream
#18 = NameAndType #25:#26 // println:(I)V
#19 = Utf8 Demo
#20 = Utf8 java/lang/Object
#21 = Utf8 java/lang/System
#22 = Utf8 out
#23 = Utf8 Ljava/io/PrintStream;
#24 = Utf8 java/io/PrintStream
#25 = Utf8 println
#26 = Utf8 (I)V
{
public Demo(); // 默认隐式无参的构造函数
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 1: 0
public static void main(java.lang.String[]); //程序的入口main方法
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC //访问控制
Code:
stack=3, locals=5, args_size=1 //方法栈栈帧中操作数栈的深度,本地变量数量,参数数量
0: sipush 500 //Jvm执行引擎执行这些源码编译过后的指令码, javap翻译出来的
3: istore_1 //是操作符, class 文件内存储的是指令码, 前面的数据是偏移量,
4: bipush 100 //Jvm根据这个去区分不同的指令. 详情参照‘JVM指令码表‘
6: istore_2
7: iload_1
8: iload_2
9: idiv
10: istore_3
11: bipush 50
13: istore 4
15: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
18: iload_3
19: iload 4
21: iadd
22: invokevirtual #3 // Method java/io/PrintStream.println:(I)V
25: return
LineNumberTable:
line 3: 0
line 4: 4
line 5: 7
line 6: 11
line 7: 15
line 8: 25
}
SourceFile: "Demo.java"
标签:method odi des 准备 clr 加载 nta oam file
原文地址:https://www.cnblogs.com/coding-diary/p/11153765.html