mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8278871: [JVMCI] assert((uint)reason < 2* _trap_hist_limit) failed: oob
Reviewed-by: kvn, never, dlong
This commit is contained in:
parent
3c10b5db38
commit
6f0e8da6d3
5 changed files with 17 additions and 12 deletions
|
@ -558,8 +558,8 @@
|
||||||
declare_constant(Deoptimization::Reason_not_compiled_exception_handler) \
|
declare_constant(Deoptimization::Reason_not_compiled_exception_handler) \
|
||||||
declare_constant(Deoptimization::Reason_unresolved) \
|
declare_constant(Deoptimization::Reason_unresolved) \
|
||||||
declare_constant(Deoptimization::Reason_jsr_mismatch) \
|
declare_constant(Deoptimization::Reason_jsr_mismatch) \
|
||||||
declare_constant(Deoptimization::Reason_LIMIT) \
|
declare_constant(Deoptimization::Reason_TRAP_HISTORY_LENGTH) \
|
||||||
declare_constant(Deoptimization::_support_large_access_byte_array_virtualization) \
|
declare_constant(Deoptimization::_support_large_access_byte_array_virtualization) \
|
||||||
\
|
\
|
||||||
declare_constant(FieldInfo::access_flags_offset) \
|
declare_constant(FieldInfo::access_flags_offset) \
|
||||||
declare_constant(FieldInfo::name_index_offset) \
|
declare_constant(FieldInfo::name_index_offset) \
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "oops/method.hpp"
|
#include "oops/method.hpp"
|
||||||
#include "oops/oop.hpp"
|
#include "oops/oop.hpp"
|
||||||
#include "runtime/atomic.hpp"
|
#include "runtime/atomic.hpp"
|
||||||
|
#include "runtime/deoptimization.hpp"
|
||||||
#include "runtime/mutex.hpp"
|
#include "runtime/mutex.hpp"
|
||||||
#include "utilities/align.hpp"
|
#include "utilities/align.hpp"
|
||||||
#include "utilities/copy.hpp"
|
#include "utilities/copy.hpp"
|
||||||
|
@ -1965,7 +1966,7 @@ public:
|
||||||
|
|
||||||
// Whole-method sticky bits and flags
|
// Whole-method sticky bits and flags
|
||||||
enum {
|
enum {
|
||||||
_trap_hist_limit = 25 JVMCI_ONLY(+5), // decoupled from Deoptimization::Reason_LIMIT
|
_trap_hist_limit = Deoptimization::Reason_TRAP_HISTORY_LENGTH,
|
||||||
_trap_hist_mask = max_jubyte,
|
_trap_hist_mask = max_jubyte,
|
||||||
_extra_data_count = 4 // extra DataLayout headers, for trap history
|
_extra_data_count = 4 // extra DataLayout headers, for trap history
|
||||||
}; // Public flag values
|
}; // Public flag values
|
||||||
|
@ -1980,6 +1981,7 @@ public:
|
||||||
uint _nof_overflow_traps; // trap count, excluding _trap_hist
|
uint _nof_overflow_traps; // trap count, excluding _trap_hist
|
||||||
union {
|
union {
|
||||||
intptr_t _align;
|
intptr_t _align;
|
||||||
|
// JVMCI separates trap history for OSR compilations from normal compilations
|
||||||
u1 _array[JVMCI_ONLY(2 *) MethodData::_trap_hist_limit];
|
u1 _array[JVMCI_ONLY(2 *) MethodData::_trap_hist_limit];
|
||||||
} _trap_hist;
|
} _trap_hist;
|
||||||
|
|
||||||
|
@ -1996,14 +1998,14 @@ public:
|
||||||
|
|
||||||
// Return (uint)-1 for overflow.
|
// Return (uint)-1 for overflow.
|
||||||
uint trap_count(int reason) const {
|
uint trap_count(int reason) const {
|
||||||
assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob");
|
assert((uint)reason < ARRAY_SIZE(_trap_hist._array), "oob");
|
||||||
return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1;
|
return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint inc_trap_count(int reason) {
|
uint inc_trap_count(int reason) {
|
||||||
// Count another trap, anywhere in this method.
|
// Count another trap, anywhere in this method.
|
||||||
assert(reason >= 0, "must be single trap");
|
assert(reason >= 0, "must be single trap");
|
||||||
assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob");
|
assert((uint)reason < ARRAY_SIZE(_trap_hist._array), "oob");
|
||||||
uint cnt1 = 1 + _trap_hist._array[reason];
|
uint cnt1 = 1 + _trap_hist._array[reason];
|
||||||
if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow...
|
if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow...
|
||||||
_trap_hist._array[reason] = cnt1;
|
_trap_hist._array[reason] = cnt1;
|
||||||
|
|
|
@ -2279,7 +2279,8 @@ Deoptimization::query_update_method_data(MethodData* trap_mdo,
|
||||||
uint idx = reason;
|
uint idx = reason;
|
||||||
#if INCLUDE_JVMCI
|
#if INCLUDE_JVMCI
|
||||||
if (is_osr) {
|
if (is_osr) {
|
||||||
idx += Reason_LIMIT;
|
// Upper half of history array used for traps in OSR compilations
|
||||||
|
idx += Reason_TRAP_HISTORY_LENGTH;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
uint prior_trap_count = trap_mdo->trap_count(idx);
|
uint prior_trap_count = trap_mdo->trap_count(idx);
|
||||||
|
|
|
@ -46,6 +46,7 @@ class Deoptimization : AllStatic {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// What condition caused the deoptimization?
|
// What condition caused the deoptimization?
|
||||||
|
// Note: Keep this enum in sync. with Deoptimization::_trap_reason_name.
|
||||||
enum DeoptReason {
|
enum DeoptReason {
|
||||||
Reason_many = -1, // indicates presence of several reasons
|
Reason_many = -1, // indicates presence of several reasons
|
||||||
Reason_none = 0, // indicates absence of a relevant deopt.
|
Reason_none = 0, // indicates absence of a relevant deopt.
|
||||||
|
@ -98,20 +99,22 @@ class Deoptimization : AllStatic {
|
||||||
Reason_jsr_mismatch,
|
Reason_jsr_mismatch,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Used to define MethodData::_trap_hist_limit where Reason_tenured isn't included
|
||||||
|
Reason_TRAP_HISTORY_LENGTH,
|
||||||
|
|
||||||
// Reason_tenured is counted separately, add normal counted Reasons above.
|
// Reason_tenured is counted separately, add normal counted Reasons above.
|
||||||
// Related to MethodData::_trap_hist_limit where Reason_tenured isn't included
|
Reason_tenured = Reason_TRAP_HISTORY_LENGTH, // age of the code has reached the limit
|
||||||
Reason_tenured, // age of the code has reached the limit
|
|
||||||
Reason_LIMIT,
|
Reason_LIMIT,
|
||||||
|
|
||||||
// Note: Keep this enum in sync. with _trap_reason_name.
|
|
||||||
Reason_RECORDED_LIMIT = Reason_profile_predicate // some are not recorded per bc
|
|
||||||
// Note: Reason_RECORDED_LIMIT should fit into 31 bits of
|
// Note: Reason_RECORDED_LIMIT should fit into 31 bits of
|
||||||
// DataLayout::trap_bits. This dependency is enforced indirectly
|
// DataLayout::trap_bits. This dependency is enforced indirectly
|
||||||
// via asserts, to avoid excessive direct header-to-header dependencies.
|
// via asserts, to avoid excessive direct header-to-header dependencies.
|
||||||
// See Deoptimization::trap_state_reason and class DataLayout.
|
// See Deoptimization::trap_state_reason and class DataLayout.
|
||||||
|
Reason_RECORDED_LIMIT = Reason_profile_predicate, // some are not recorded per bc
|
||||||
};
|
};
|
||||||
|
|
||||||
// What action must be taken by the runtime?
|
// What action must be taken by the runtime?
|
||||||
|
// Note: Keep this enum in sync. with Deoptimization::_trap_action_name.
|
||||||
enum DeoptAction {
|
enum DeoptAction {
|
||||||
Action_none, // just interpret, do not invalidate nmethod
|
Action_none, // just interpret, do not invalidate nmethod
|
||||||
Action_maybe_recompile, // recompile the nmethod; need not invalidate
|
Action_maybe_recompile, // recompile the nmethod; need not invalidate
|
||||||
|
@ -119,7 +122,6 @@ class Deoptimization : AllStatic {
|
||||||
Action_make_not_entrant, // invalidate the nmethod, recompile (probably)
|
Action_make_not_entrant, // invalidate the nmethod, recompile (probably)
|
||||||
Action_make_not_compilable, // invalidate the nmethod and do not compile
|
Action_make_not_compilable, // invalidate the nmethod and do not compile
|
||||||
Action_LIMIT
|
Action_LIMIT
|
||||||
// Note: Keep this enum in sync. with _trap_action_name.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -336,7 +336,7 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||||
final int deoptReasonLoopLimitCheck = getConstant("Deoptimization::Reason_loop_limit_check", Integer.class);
|
final int deoptReasonLoopLimitCheck = getConstant("Deoptimization::Reason_loop_limit_check", Integer.class);
|
||||||
final int deoptReasonAliasing = getConstant("Deoptimization::Reason_aliasing", Integer.class);
|
final int deoptReasonAliasing = getConstant("Deoptimization::Reason_aliasing", Integer.class);
|
||||||
final int deoptReasonTransferToInterpreter = getConstant("Deoptimization::Reason_transfer_to_interpreter", Integer.class);
|
final int deoptReasonTransferToInterpreter = getConstant("Deoptimization::Reason_transfer_to_interpreter", Integer.class);
|
||||||
final int deoptReasonOSROffset = getConstant("Deoptimization::Reason_LIMIT", Integer.class);
|
final int deoptReasonOSROffset = getConstant("Deoptimization::Reason_TRAP_HISTORY_LENGTH", Integer.class);
|
||||||
|
|
||||||
final int deoptActionNone = getConstant("Deoptimization::Action_none", Integer.class);
|
final int deoptActionNone = getConstant("Deoptimization::Action_none", Integer.class);
|
||||||
final int deoptActionMaybeRecompile = getConstant("Deoptimization::Action_maybe_recompile", Integer.class);
|
final int deoptActionMaybeRecompile = getConstant("Deoptimization::Action_maybe_recompile", Integer.class);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue