开发者

Java bytecode difference between "FRAME FULL" and "FRAME APPEND"

What's a diff开发者_如何学Pythonerence between "FRAME FULL" and "FRAME APPEND"? I check 2 ways to use iterators:

int size = 0;
Iterator<String> it = l.iterator();
while (it.hasNext()) {
    String s = it.next();
    int length = s.length();
    size += length;
}

int size = 0;
for (String s : l) {
        int length = s.length();
        size += length;
}

they both use iterators, but bytecode is a bit different.


The frame type append_frame is used when the operand stack is empty and the current locals are the same as the locals in the previous frame, except that k additional locals are defined. Frame type full_frame is used when all other types are not applicably, it is also less compact one.


The first version has an explicit iterator name, i.e. one more local variable. The frames show the start and end of groups of local variables. I assume full means it is describing all local variables, append means it is adding additional local variables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜