39 enum DeoptReason {
40 Reason_many = -1, // indicates presence of several reasons
41 Reason_none = 0, // indicates absence of a relevant deopt.
42 // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits
43 Reason_null_check, // saw unexpected null or zero divisor (@bci)
44 Reason_null_assert, // saw unexpected non-null or non-zero (@bci)
45 Reason_range_check, // saw unexpected array index (@bci)
46 Reason_class_check, // saw unexpected object class (@bci)
47 Reason_array_check, // saw unexpected array class (aastore @bci)
48 Reason_intrinsic, // saw unexpected operand to intrinsic (@bci)
49 Reason_bimorphic, // saw unexpected object class in bimorphic inlining (@bci)
50
51 Reason_unloaded, // unloaded class or constant pool entry
52 Reason_uninitialized, // bad class state (uninitialized)
53 Reason_unreached, // code is not reached, compiler
54 Reason_unhandled, // arbitrary compiler limitation
55 Reason_constraint, // arbitrary runtime constraint violated
56 Reason_div0_check, // a null_check due to division by zero
57 Reason_age, // nmethod too old; tier threshold reached
58 Reason_predicate, // compiler generated predicate failed
59 Reason_LIMIT,
60 // Note: Keep this enum in sync. with _trap_reason_name.
61 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc
62 // Note: Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of
63 // DataLayout::trap_bits. This dependency is enforced indirectly
64 // via asserts, to avoid excessive direct header-to-header dependencies.
65 // See Deoptimization::trap_state_reason and class DataLayout.
66 };
67
68 // What action must be taken by the runtime?
69 enum DeoptAction {
70 Action_none, // just interpret, do not invalidate nmethod
71 Action_maybe_recompile, // recompile the nmethod; need not invalidate
72 Action_reinterpret, // invalidate the nmethod, reset IC, maybe recompile
73 Action_make_not_entrant, // invalidate the nmethod, recompile (probably)
74 Action_make_not_compilable, // invalidate the nmethod and do not compile
75 Action_LIMIT
76 // Note: Keep this enum in sync. with _trap_action_name.
77 };
78
79 enum {
80 _action_bits = 3,
81 _reason_bits = 4,
82 _action_shift = 0,
83 _reason_shift = _action_shift+_action_bits,
84 BC_CASE_LIMIT = PRODUCT_ONLY(1) NOT_PRODUCT(4) // for _deoptimization_hist
85 };
86
87 enum UnpackType {
88 Unpack_deopt = 0, // normal deoptimization, use pc computed in unpack_vframe_on_stack
89 Unpack_exception = 1, // exception is pending
90 Unpack_uncommon_trap = 2, // redo last byte code (C2 only)
91 Unpack_reexecute = 3 // reexecute bytecode (C1 only)
92 };
93
94 // Checks all compiled methods. Invalid methods are deleted and
95 // corresponding activations are deoptimized.
96 static int deoptimize_dependents();
97
98 // Deoptimizes a frame lazily. nmethod gets patched deopt happens on return to the frame
99 static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map);
100
101 private:
|
39 enum DeoptReason {
40 Reason_many = -1, // indicates presence of several reasons
41 Reason_none = 0, // indicates absence of a relevant deopt.
42 // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits
43 Reason_null_check, // saw unexpected null or zero divisor (@bci)
44 Reason_null_assert, // saw unexpected non-null or non-zero (@bci)
45 Reason_range_check, // saw unexpected array index (@bci)
46 Reason_class_check, // saw unexpected object class (@bci)
47 Reason_array_check, // saw unexpected array class (aastore @bci)
48 Reason_intrinsic, // saw unexpected operand to intrinsic (@bci)
49 Reason_bimorphic, // saw unexpected object class in bimorphic inlining (@bci)
50
51 Reason_unloaded, // unloaded class or constant pool entry
52 Reason_uninitialized, // bad class state (uninitialized)
53 Reason_unreached, // code is not reached, compiler
54 Reason_unhandled, // arbitrary compiler limitation
55 Reason_constraint, // arbitrary runtime constraint violated
56 Reason_div0_check, // a null_check due to division by zero
57 Reason_age, // nmethod too old; tier threshold reached
58 Reason_predicate, // compiler generated predicate failed
59 Reason_loop_limit_check, // compiler generated loop limits check failed
60 Reason_LIMIT,
61 // Note: Keep this enum in sync. with _trap_reason_name.
62 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc
63 // Note: Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of
64 // DataLayout::trap_bits. This dependency is enforced indirectly
65 // via asserts, to avoid excessive direct header-to-header dependencies.
66 // See Deoptimization::trap_state_reason and class DataLayout.
67 };
68
69 // What action must be taken by the runtime?
70 enum DeoptAction {
71 Action_none, // just interpret, do not invalidate nmethod
72 Action_maybe_recompile, // recompile the nmethod; need not invalidate
73 Action_reinterpret, // invalidate the nmethod, reset IC, maybe recompile
74 Action_make_not_entrant, // invalidate the nmethod, recompile (probably)
75 Action_make_not_compilable, // invalidate the nmethod and do not compile
76 Action_LIMIT
77 // Note: Keep this enum in sync. with _trap_action_name.
78 };
79
80 enum {
81 _action_bits = 3,
82 _reason_bits = 5,
83 _action_shift = 0,
84 _reason_shift = _action_shift+_action_bits,
85 BC_CASE_LIMIT = PRODUCT_ONLY(1) NOT_PRODUCT(4) // for _deoptimization_hist
86 };
87
88 enum UnpackType {
89 Unpack_deopt = 0, // normal deoptimization, use pc computed in unpack_vframe_on_stack
90 Unpack_exception = 1, // exception is pending
91 Unpack_uncommon_trap = 2, // redo last byte code (C2 only)
92 Unpack_reexecute = 3 // reexecute bytecode (C1 only)
93 };
94
95 // Checks all compiled methods. Invalid methods are deleted and
96 // corresponding activations are deoptimized.
97 static int deoptimize_dependents();
98
99 // Deoptimizes a frame lazily. nmethod gets patched deopt happens on return to the frame
100 static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map);
101
102 private:
|