“JVM flow control in bytecode”与“文件:Tcp-3way.gif”:页面之间的差异

来自WHY42
(页面间差异)
 
(Riguz 上傳了新版本的 檔案:Tcp-3way.gif
 
第1行: 第1行:


= Branch =
<syntaxhighlight lang="java">
public int abs(int i) {
    if(i < 0)
        return -i;
    return i;
}
</syntaxhighlight>
<syntaxhighlight lang="lisp">
  public int abs(int);
    descriptor: (I)I
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=2, args_size=2
        0: iload_1
        1: ifge          7
        4: iload_1
        5: ineg
        6: ireturn
        7: iload_1
        8: ireturn
      LineNumberTable:
        line 3: 0
        line 4: 4
        line 5: 7
      StackMapTable: number_of_entries = 1
        frame_type = 7 /* same
</syntaxhighlight>
<syntaxhighlight lang="java">
public int compareWith2(int i) {
    if(i < 2)
        return -1;
    else if(i == 2)
        return 0;
    else
        return 1;
}
</syntaxhighlight>
<syntaxhighlight lang="lisp">
  public int compareWith2(int);
    descriptor: (I)I
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=2, locals=2, args_size=2
        0: iload_1
        1: iconst_2
        2: if_icmpge    7
        5: iconst_m1
        6: ireturn
        7: iload_1
        8: iconst_2
        9: if_icmpne    14
        12: iconst_0
        13: ireturn
        14: iconst_1
        15: ireturn
      LineNumberTable:
        line 8: 0
        line 9: 5
        line 10: 7
        line 11: 12
        line 13: 14
      StackMapTable: number_of_entries = 2
        frame_type = 7 /* same */
        frame_type = 6 /* same */
}
</syntaxhighlight>
[[Category:JVM]]

2021年4月30日 (五) 08:04的版本