1、前言
2、参考书目
3、Java及JVM简介
JVM拥有语言无关性,只关心“字节码”文件。统称为:jvm字节码
4、Java发展的重大事件
5、虚拟机与Java虚拟机
6、JVM的整体结构
7、Java代码执行流程
8、JVM的架构模型
字节码反编译操作
package com.szu.chen;
/**
* @author chen
* @create 2020-08-16 9:02
*/
// 字节码反编译操作:JVMDemo\out\production\chapter01\com\szu\chen>javap -v StackStruTest.class
public class StackStruTest {
public static void main(String[] args) {
int i = 2;
int j = 3;
int k = i+j;
}
}
Terminal:
G:\Java\IdeaProjects\JVMDemo\out\production\chapter01\com\szu\chen>javap -v StackStruTest.class
Classfile /G:/Java/IdeaProjects/JVMDemo/out/production/chapter01/com/szu/chen/StackStruTest.class
Last modified 2020-8-16; size 474 bytes
MD5 checksum 6252c2bd628018459de6a45cb55b564d
Compiled from "StackStruTest.java"
public class com.szu.chen.StackStruTest
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #3.#21 // java/lang/Object."<init>":()V
#2 = Class #22 // com/szu/chen/StackStruTest
#3 = Class #23 // java/lang/Object
#4 = Utf8 <init>
#5 = Utf8 ()V
#6 = Utf8 Code
#7 = Utf8 LineNumberTable
#8 = Utf8 LocalVariableTable
#9 = Utf8 this
#10 = Utf8 Lcom/szu/chen/StackStruTest;
#11 = Utf8 main
#12 = Utf8 ([Ljava/lang/String;)V
#13 = Utf8 args
#14 = Utf8 [Ljava/lang/String;
#15 = Utf8 i
#16 = Utf8 I
#17 = Utf8 j
#18 = Utf8 k
#19 = Utf8 SourceFile
#20 = Utf8 StackStruTest.java
#21 = NameAndType #4:#5 // "<init>":()V
#22 = Utf8 com/szu/chen/StackStruTest
#23 = Utf8 java/lang/Object
{
public com.szu.chen.StackStruTest();
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 8: 0
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this Lcom/szu/chen/StackStruTest;
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=4, args_size=1
0: iconst_2 (常量2)
1: istore_1 (保存到栈的索引1处)
2: iconst_3 (常量3)
3: istore_2 (保存到栈的索引2处)
4: iload_1 (加载1处的值)
5: iload_2 (加载2处的值)
6: iadd (执行加操作)
7: istore_3 (保存到栈的索引3处)
8: return
LineNumberTable:
line 10: 0
line 11: 2
line 12: 4
line 14: 8
LocalVariableTable:
Start Length Slot Name Signature
0 9 0 args [Ljava/lang/String;
2 7 1 i I
4 5 2 j I
8 1 3 k I
}
SourceFile: "StackStruTest.java"
9、JVM的生命周期
10、JVM的发展历程