JVM flow control in bytecode:修订间差异
建立內容為「 = Branch = <syntaxhighlight lang="java"> public int abs(int i) { if(i < 0) return -i; return i; } </syntaxhighlight> <syntaxhighlight lang="lis…」的新頁面 |
|||
第31行: | 第31行: | ||
</syntaxhighlight> | </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]] | [[Category:JVM]] |
2021年4月15日 (四) 05:21的版本
Branch
public int abs(int i) {
if(i < 0)
return -i;
return i;
}
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
public int compareWith2(int i) {
if(i < 2)
return -1;
else if(i == 2)
return 0;
else
return 1;
}
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 */
}