comparison src/share/vm/runtime/deoptimization.hpp @ 21559:be896a1983c0

recast all Graal native code as JVMCI code (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Thu, 28 May 2015 15:36:48 +0200
parents 7848fc12602b
children
comparison
equal deleted inserted replaced
21558:d563baeca9df 21559:be896a1983c0
40 // What condition caused the deoptimization? 40 // What condition caused the deoptimization?
41 enum DeoptReason { 41 enum DeoptReason {
42 Reason_many = -1, // indicates presence of several reasons 42 Reason_many = -1, // indicates presence of several reasons
43 Reason_none = 0, // indicates absence of a relevant deopt. 43 Reason_none = 0, // indicates absence of a relevant deopt.
44 // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits. 44 // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits.
45 // This is more complicated for Graal as Graal may deoptimize to *some* bytecode before the 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, Graal may even deoptimize to a 46 // bytecode that actually caused the deopt (with inlining, JVMCI may even deoptimize to a
47 // bytecode in another method): 47 // bytecode in another method):
48 // - bytecode y in method b() causes deopt 48 // - bytecode y in method b() causes deopt
49 // - Graal deoptimizes to bytecode x in method a() 49 // - JVMCI deoptimizes to bytecode x in method a()
50 // -> the deopt reason will be recorded for method a() at bytecode x 50 // -> the deopt reason will be recorded for method a() at bytecode x
51 Reason_null_check, // saw unexpected null or zero divisor (@bci) 51 Reason_null_check, // saw unexpected null or zero divisor (@bci)
52 Reason_null_assert, // saw unexpected non-null or non-zero (@bci) 52 Reason_null_assert, // saw unexpected non-null or non-zero (@bci)
53 Reason_range_check, // saw unexpected array index (@bci) 53 Reason_range_check, // saw unexpected array index (@bci)
54 Reason_class_check, // saw unexpected object class (@bci) 54 Reason_class_check, // saw unexpected object class (@bci)
55 Reason_array_check, // saw unexpected array class (aastore @bci) 55 Reason_array_check, // saw unexpected array class (aastore @bci)
56 Reason_intrinsic, // saw unexpected operand to intrinsic (@bci) 56 Reason_intrinsic, // saw unexpected operand to intrinsic (@bci)
57 Reason_bimorphic, // saw unexpected object class in bimorphic inlining (@bci) 57 Reason_bimorphic, // saw unexpected object class in bimorphic inlining (@bci)
58 58
59 #ifdef GRAAL 59 #ifdef JVMCI
60 Reason_unreached0 = Reason_null_assert, 60 Reason_unreached0 = Reason_null_assert,
61 Reason_type_checked_inlining = Reason_intrinsic, 61 Reason_type_checked_inlining = Reason_intrinsic,
62 Reason_optimized_type_check = Reason_bimorphic, 62 Reason_optimized_type_check = Reason_bimorphic,
63 #endif 63 #endif
64 64
73 Reason_predicate, // compiler generated predicate failed 73 Reason_predicate, // compiler generated predicate failed
74 Reason_loop_limit_check, // compiler generated loop limits check failed 74 Reason_loop_limit_check, // compiler generated loop limits check failed
75 Reason_speculate_class_check, // saw unexpected object class from type speculation 75 Reason_speculate_class_check, // saw unexpected object class from type speculation
76 Reason_rtm_state_change, // rtm state change detected 76 Reason_rtm_state_change, // rtm state change detected
77 Reason_unstable_if, // a branch predicted always false was taken 77 Reason_unstable_if, // a branch predicted always false was taken
78 #ifdef GRAAL 78 #ifdef JVMCI
79 Reason_aliasing, // optimistic assumption about aliasing failed 79 Reason_aliasing, // optimistic assumption about aliasing failed
80 Reason_transfer_to_interpreter, // explicit transferToInterpreter() 80 Reason_transfer_to_interpreter, // explicit transferToInterpreter()
81 Reason_not_compiled_exception_handler, 81 Reason_not_compiled_exception_handler,
82 Reason_unresolved, 82 Reason_unresolved,
83 Reason_jsr_mismatch, 83 Reason_jsr_mismatch,
136 static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map); 136 static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map);
137 // Helper function to revoke biases of all monitors in frames 137 // Helper function to revoke biases of all monitors in frames
138 // executing in a particular CodeBlob if UseBiasedLocking is enabled 138 // executing in a particular CodeBlob if UseBiasedLocking is enabled
139 static void revoke_biases_of_monitors(CodeBlob* cb); 139 static void revoke_biases_of_monitors(CodeBlob* cb);
140 140
141 #if defined(COMPILER2) || defined(GRAAL) 141 #if defined(COMPILER2) || defined(JVMCI)
142 GRAAL_ONLY(public:) 142 JVMCI_ONLY(public:)
143 143
144 // Support for restoring non-escaping objects 144 // Support for restoring non-escaping objects
145 static bool realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS); 145 static bool realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS);
146 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type); 146 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
147 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj); 147 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
148 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures); 148 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures);
149 static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures); 149 static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
150 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array); 150 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
151 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);) 151 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
152 #endif // COMPILER2 || GRAAL 152 #endif // COMPILER2 || JVMCI
153 153
154 public: 154 public:
155 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures); 155 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
156 156
157 // Interface used for unpacking deoptimized frames 157 // Interface used for unpacking deoptimized frames
310 else 310 else
311 return trap_request; 311 return trap_request;
312 } 312 }
313 static int make_trap_request(DeoptReason reason, DeoptAction action, 313 static int make_trap_request(DeoptReason reason, DeoptAction action,
314 int index = -1) { 314 int index = -1) {
315 #if defined(COMPILERGRAAL) && !defined(COMPILER1) && !defined(COMPILER2) 315 #if defined(COMPILERJVMCI) && !defined(COMPILER1) && !defined(COMPILER2)
316 assert(index == -1, "Graal does not use index"); 316 assert(index == -1, "JVMCI does not use index");
317 #endif 317 #endif
318 318
319 assert((1 << _reason_bits) >= Reason_LIMIT, "enough bits"); 319 assert((1 << _reason_bits) >= Reason_LIMIT, "enough bits");
320 assert((1 << _action_bits) >= Action_LIMIT, "enough bits"); 320 assert((1 << _action_bits) >= Action_LIMIT, "enough bits");
321 int trap_request; 321 int trap_request;
393 // Update the mdo's count and per-BCI reason bits, returning previous state: 393 // Update the mdo's count and per-BCI reason bits, returning previous state:
394 static ProfileData* query_update_method_data(MethodData* trap_mdo, 394 static ProfileData* query_update_method_data(MethodData* trap_mdo,
395 int trap_bci, 395 int trap_bci,
396 DeoptReason reason, 396 DeoptReason reason,
397 bool update_total_trap_count, 397 bool update_total_trap_count,
398 #ifdef GRAAL 398 #ifdef JVMCI
399 bool is_osr, 399 bool is_osr,
400 #endif 400 #endif
401 Method* compiled_method, 401 Method* compiled_method,
402 //outputs: 402 //outputs:
403 uint& ret_this_trap_count, 403 uint& ret_this_trap_count,