JVM flow control in bytecode:修订间差异
小 Riguz移动页面JVM:Control至Flow control in bytecode,不留重定向 |
小 Riguz移动页面Flow control in bytecode至JVM flow control in bytecode,不留重定向 |
||
(没有差异)
|
2023年12月19日 (二) 07:00的最新版本
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 */
}
Loop
public void repeat(int count) {
int sum = 0;
for(int i = 0; i < count; i++) {
sum += 1;
}
}
public void repeat(int);
descriptor: (I)V
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=4, args_size=2
0: iconst_0
1: istore_2
2: iconst_0
3: istore_3
4: iload_3
5: iload_1
6: if_icmpge 18
9: iinc 2, 1
12: iinc 3, 1
15: goto 4
18: return
LineNumberTable:
line 17: 0
line 18: 2
line 19: 9
line 18: 12
line 21: 18
StackMapTable: number_of_entries = 2
frame_type = 253 /* append */
offset_delta = 4
locals = [ int, int ]
frame_type = 250 /* chop */
offset_delta = 13