Details
Description
The second set of checks in the code below are not needed. They are covered by the first set of checks:
if (fr.fp() == NULL || fr.cb() != NULL ||
fr.sender_pc() == NULL || os::is_first_C_frame(&fr)) break;
if (fr.sender_pc() && !os::is_first_C_frame(&fr)) {
fr = os::get_sender_for_C_frame(&fr);
} else {
break;
}
Is the same as:
if (fr.fp() == NULL || fr.cb() != NULL ||
fr.sender_pc() == NULL || os::is_first_C_frame(&fr)) break;
fr = os::get_sender_for_C_frame(&fr);
Also, the code should really not be calling sender_pc(), and there is no need to. It will become fp.pc() after the next frame is fetched, and will check at the top of the while loop on the next iteration. The following would be safer:
if (fr.fp() == NULL || // not walkable
fr.cb() != NULL || // not 'native'
os::is_first_C_frame(&fr)) {
break;
}
fr = os::get_sender_for_C_frame(&fr);
if (fr.fp() == NULL || fr.cb() != NULL ||
fr.sender_pc() == NULL || os::is_first_C_frame(&fr)) break;
if (fr.sender_pc() && !os::is_first_C_frame(&fr)) {
fr = os::get_sender_for_C_frame(&fr);
} else {
break;
}
Is the same as:
if (fr.fp() == NULL || fr.cb() != NULL ||
fr.sender_pc() == NULL || os::is_first_C_frame(&fr)) break;
fr = os::get_sender_for_C_frame(&fr);
Also, the code should really not be calling sender_pc(), and there is no need to. It will become fp.pc() after the next frame is fetched, and will check at the top of the while loop on the next iteration. The following would be safer:
if (fr.fp() == NULL || // not walkable
fr.cb() != NULL || // not 'native'
os::is_first_C_frame(&fr)) {
break;
}
fr = os::get_sender_for_C_frame(&fr);