jvm 指令

分析class的汇编代码很简单:

javap -c -l Slot.class

Slot.class  是我的java代码编译的class


Compiled from "Slot.java"
class Slot {
  public int i;

  Slot();
    Code:
       0: aload_0      //push this on to stack   //0表示局部变量区位置,0-3 //从局部变量数组中加载一个对象引用到操作数栈的栈顶
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V   //类名,方法,描述  //? this有出栈的操作,调用init()是用来初始化实例的
       4: aload_0           //push this on to stack 
       5: iconst_5      //常量5入栈
       6: putfield      #2                  // Field i:I    //对象赋值
       9: return
    LineNumberTable:
      line 1: 0
      line 2: 4
}

 

 

 JVM INSTRUCTION 

 

posted @ 2018-12-24 17:43  好哥TOP  阅读(195)  评论(0编辑  收藏  举报