Decoder

分析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 
       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 

猜你喜欢

转载自www.cnblogs.com/iamgoodman/p/10169995.html
今日推荐