// Conservatively decode the trap_state of a ciProfileData. int ciMethodData::has_trap_at(ciProfileData* data, int reason) { if (trap_count(reason) == 0) { // Impossible for this trap to have occurred, regardless of trap_state. // Note: This happens if the MDO is empty. return 0; } else if (data == NULL) { // No profile here, not even an extra_data record allocated on the fly. // If there are empty extra_data records, and there had been a trap, // there would have been a non-null data pointer. If there are no // free extra_data records, we must return a conservative -1. return (_saw_free_extra_data? 0: -1); } else { return Deoptimization::trap_state_has_reason(data->trap_state(), reason); } }
// Conservatively decode the trap_state of a ciProfileData. int ciMethodData::has_trap_at(ciProfileData* data, int reason) { typedef Deoptimization::DeoptReason DR_t; int per_bc_reason = Deoptimization::reason_recorded_per_bytecode_if_any((DR_t) reason); if (trap_count(reason) == 0) { // Impossible for this trap to have occurred, regardless of trap_state. // Note: This happens if the MDO is empty. return 0; } else if (per_bc_reason == Deoptimization::Reason_none) { // We cannot conclude anything; a trap happened somewhere, maybe here. return -1; } else if (data == NULL) { // No profile here, not even an extra_data record allocated on the fly. // If there are empty extra_data records, and there had been a trap, // there would have been a non-null data pointer. If there are no // free extra_data records, we must return a conservative -1. if (_saw_free_extra_data) return 0; // Q.E.D. else return -1; // bail with a conservative answer } else { return Deoptimization::trap_state_has_reason(data->trap_state(), per_bc_reason); } }