JVM virtual machine

JVM is mainly composed of three subsystems

There are many java virtual machine, not only Hotspot (sun), there J9, JRockit
3 4 5

1,类加载子系统
2.运行时数据区(内存结果)
3.执行引擎

5 runtime database is divided into five parts

堆   方法区               
虚拟机栈栈   本地方法栈   程序计数器     

程序计数器:指向地址(指向当前线程正在执行的字节码指令的地址)
虚拟机栈:  存储数据(存储当前线程运行方法时所需要的数据,指令,返回地址 (栈是一种数据结构,用来存储数据)

         

A virtual machine stack for a stack frame, the stack frame is divided into four parts (FILO: first in last out)

局部变量表
操作数栈
动态链接
方法出口/返回地址

Here Insert Picture Description

Resolve

cmd command

javac demo1.java  //将java文件编译为class文件
java demo1        //执行class文件
javap -c demo1.class > demo1.txt   //反编译class文件 转到demo1.txt文件中
Decompile file content (instruction set) the JVM instruction set reference

const: Data stored java method operand stack
store: the data stored in the operand stack local variable table
load: copy the data to the local variable table operand stack

iconst_1   //将方法中的第一个int型存入栈中(操作数栈)
istore_1  //将操作数栈中的第一个Int推入局部变量表
iload_1   //将局部变量表的第一个Int数据复制到操作数栈
iadd
bipush
Published 172 original articles · won praise 0 · Views 5714

Guess you like

Origin blog.csdn.net/weixin_44635157/article/details/104413177