< prev index next >

src/hotspot/share/runtime/deoptimization.hpp

Print this page




  24 
  25 #ifndef SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP
  26 #define SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/frame.hpp"
  30 
  31 class ProfileData;
  32 class vframeArray;
  33 class MonitorValue;
  34 class ObjectValue;
  35 
  36 class Deoptimization : AllStatic {
  37   friend class VMStructs;
  38 
  39  public:
  40   // What condition caused the deoptimization?
  41   enum DeoptReason {
  42     Reason_many = -1,             // indicates presence of several reasons
  43     Reason_none = 0,              // indicates absence of a relevant deopt.
  44     // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits.
  45     // This is more complicated for JVMCI as JVMCI may deoptimize to *some* bytecode before the
  46     // bytecode that actually caused the deopt (with inlining, JVMCI may even deoptimize to a
  47     // bytecode in another method):
  48     //  - bytecode y in method b() causes deopt
  49     //  - JVMCI deoptimizes to bytecode x in method a()
  50     // -> the deopt reason will be recorded for method a() at bytecode x
  51     Reason_null_check,            // saw unexpected null or zero divisor (@bci)
  52     Reason_null_assert,           // saw unexpected non-null or non-zero (@bci)
  53     Reason_range_check,           // saw unexpected array index (@bci)
  54     Reason_class_check,           // saw unexpected object class (@bci)
  55     Reason_array_check,           // saw unexpected array class (aastore @bci)
  56     Reason_intrinsic,             // saw unexpected operand to intrinsic (@bci)
  57     Reason_bimorphic,             // saw unexpected object class in bimorphic inlining (@bci)
  58 
  59 #if INCLUDE_JVMCI
  60     Reason_unreached0             = Reason_null_assert,
  61     Reason_type_checked_inlining  = Reason_intrinsic,
  62     Reason_optimized_type_check   = Reason_bimorphic,
  63 #endif
  64 


  65     // recorded per method
  66     Reason_unloaded,              // unloaded class or constant pool entry
  67     Reason_uninitialized,         // bad class state (uninitialized)
  68     Reason_unreached,             // code is not reached, compiler
  69     Reason_unhandled,             // arbitrary compiler limitation
  70     Reason_constraint,            // arbitrary runtime constraint violated
  71     Reason_div0_check,            // a null_check due to division by zero
  72     Reason_age,                   // nmethod too old; tier threshold reached
  73     Reason_predicate,             // compiler generated predicate failed
  74     Reason_loop_limit_check,      // compiler generated loop limits check failed
  75     Reason_speculate_class_check, // saw unexpected object class from type speculation
  76     Reason_speculate_null_check,  // saw unexpected null from type speculation
  77     Reason_speculate_null_assert, // saw unexpected null from type speculation
  78     Reason_rtm_state_change,      // rtm state change detected
  79     Reason_unstable_if,           // a branch predicted always false was taken
  80     Reason_unstable_fused_if,     // fused two ifs that had each one untaken branch. One is now taken.
  81 #if INCLUDE_JVMCI
  82     Reason_aliasing,              // optimistic assumption about aliasing failed
  83     Reason_transfer_to_interpreter, // explicit transferToInterpreter()
  84     Reason_not_compiled_exception_handler,
  85     Reason_unresolved,
  86     Reason_jsr_mismatch,
  87 #endif
  88 
  89     // Reason_tenured is counted separately, add normal counted Reasons above.
  90     // Related to MethodData::_trap_hist_limit where Reason_tenured isn't included
  91     Reason_tenured,               // age of the code has reached the limit
  92     Reason_LIMIT,
  93 
  94     // Note:  Keep this enum in sync. with _trap_reason_name.
  95     Reason_RECORDED_LIMIT = Reason_bimorphic  // some are not recorded per bc
  96     // Note:  Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of
  97     // DataLayout::trap_bits.  This dependency is enforced indirectly
  98     // via asserts, to avoid excessive direct header-to-header dependencies.
  99     // See Deoptimization::trap_state_reason and class DataLayout.
 100   };
 101 
 102   // What action must be taken by the runtime?
 103   enum DeoptAction {
 104     Action_none,                  // just interpret, do not invalidate nmethod
 105     Action_maybe_recompile,       // recompile the nmethod; need not invalidate
 106     Action_reinterpret,           // invalidate the nmethod, reset IC, maybe recompile
 107     Action_make_not_entrant,      // invalidate the nmethod, recompile (probably)
 108     Action_make_not_compilable,   // invalidate the nmethod and do not compile
 109     Action_LIMIT
 110     // Note:  Keep this enum in sync. with _trap_action_name.
 111   };
 112 
 113   enum {
 114     _action_bits = 3,
 115     _reason_bits = 5,
 116     _debug_id_bits = 23,




  24 
  25 #ifndef SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP
  26 #define SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/frame.hpp"
  30 
  31 class ProfileData;
  32 class vframeArray;
  33 class MonitorValue;
  34 class ObjectValue;
  35 
  36 class Deoptimization : AllStatic {
  37   friend class VMStructs;
  38 
  39  public:
  40   // What condition caused the deoptimization?
  41   enum DeoptReason {
  42     Reason_many = -1,             // indicates presence of several reasons
  43     Reason_none = 0,              // indicates absence of a relevant deopt.
  44     // Next 8 reasons are recorded per bytecode in DataLayout::trap_bits.
  45     // This is more complicated for JVMCI as JVMCI may deoptimize to *some* bytecode before the
  46     // bytecode that actually caused the deopt (with inlining, JVMCI may even deoptimize to a
  47     // bytecode in another method):
  48     //  - bytecode y in method b() causes deopt
  49     //  - JVMCI deoptimizes to bytecode x in method a()
  50     // -> the deopt reason will be recorded for method a() at bytecode x
  51     Reason_null_check,            // saw unexpected null or zero divisor (@bci)
  52     Reason_null_assert,           // saw unexpected non-null or non-zero (@bci)
  53     Reason_range_check,           // saw unexpected array index (@bci)
  54     Reason_class_check,           // saw unexpected object class (@bci)
  55     Reason_array_check,           // saw unexpected array class (aastore @bci)
  56     Reason_intrinsic,             // saw unexpected operand to intrinsic (@bci)
  57     Reason_bimorphic,             // saw unexpected object class in bimorphic inlining (@bci)
  58 
  59 #if INCLUDE_JVMCI
  60     Reason_unreached0             = Reason_null_assert,
  61     Reason_type_checked_inlining  = Reason_intrinsic,
  62     Reason_optimized_type_check   = Reason_bimorphic,
  63 #endif
  64 
  65     Reason_profile_predicate,     // compiler generated predicate moved from frequent branch in a loop failed
  66 
  67     // recorded per method
  68     Reason_unloaded,              // unloaded class or constant pool entry
  69     Reason_uninitialized,         // bad class state (uninitialized)
  70     Reason_unreached,             // code is not reached, compiler
  71     Reason_unhandled,             // arbitrary compiler limitation
  72     Reason_constraint,            // arbitrary runtime constraint violated
  73     Reason_div0_check,            // a null_check due to division by zero
  74     Reason_age,                   // nmethod too old; tier threshold reached
  75     Reason_predicate,             // compiler generated predicate failed
  76     Reason_loop_limit_check,      // compiler generated loop limits check failed
  77     Reason_speculate_class_check, // saw unexpected object class from type speculation
  78     Reason_speculate_null_check,  // saw unexpected null from type speculation
  79     Reason_speculate_null_assert, // saw unexpected null from type speculation
  80     Reason_rtm_state_change,      // rtm state change detected
  81     Reason_unstable_if,           // a branch predicted always false was taken
  82     Reason_unstable_fused_if,     // fused two ifs that had each one untaken branch. One is now taken.
  83 #if INCLUDE_JVMCI
  84     Reason_aliasing,              // optimistic assumption about aliasing failed
  85     Reason_transfer_to_interpreter, // explicit transferToInterpreter()
  86     Reason_not_compiled_exception_handler,
  87     Reason_unresolved,
  88     Reason_jsr_mismatch,
  89 #endif
  90 
  91     // Reason_tenured is counted separately, add normal counted Reasons above.
  92     // Related to MethodData::_trap_hist_limit where Reason_tenured isn't included
  93     Reason_tenured,               // age of the code has reached the limit
  94     Reason_LIMIT,
  95 
  96     // Note:  Keep this enum in sync. with _trap_reason_name.
  97     Reason_RECORDED_LIMIT = Reason_profile_predicate  // some are not recorded per bc
  98     // Note:  Reason_RECORDED_LIMIT should fit into 31 bits of
  99     // DataLayout::trap_bits.  This dependency is enforced indirectly
 100     // via asserts, to avoid excessive direct header-to-header dependencies.
 101     // See Deoptimization::trap_state_reason and class DataLayout.
 102   };
 103 
 104   // What action must be taken by the runtime?
 105   enum DeoptAction {
 106     Action_none,                  // just interpret, do not invalidate nmethod
 107     Action_maybe_recompile,       // recompile the nmethod; need not invalidate
 108     Action_reinterpret,           // invalidate the nmethod, reset IC, maybe recompile
 109     Action_make_not_entrant,      // invalidate the nmethod, recompile (probably)
 110     Action_make_not_compilable,   // invalidate the nmethod and do not compile
 111     Action_LIMIT
 112     // Note:  Keep this enum in sync. with _trap_action_name.
 113   };
 114 
 115   enum {
 116     _action_bits = 3,
 117     _reason_bits = 5,
 118     _debug_id_bits = 23,


< prev index next >