comparison src/share/vm/runtime/deoptimization.hpp @ 14500:fdad2932c73f

8031752: Failed speculative optimizations should be reattempted when root of compilation is different Summary: support for speculative traps that keep track of the root of the compilation in which a trap occurs. Reviewed-by: kvn, twisti
author roland
date Tue, 25 Feb 2014 18:16:24 +0100
parents 63a4eb8bcd23
children d8041d695d19
comparison
equal deleted inserted replaced
14498:04e7587c97dc 14500:fdad2932c73f
57 Reason_constraint, // arbitrary runtime constraint violated 57 Reason_constraint, // arbitrary runtime constraint violated
58 Reason_div0_check, // a null_check due to division by zero 58 Reason_div0_check, // a null_check due to division by zero
59 Reason_age, // nmethod too old; tier threshold reached 59 Reason_age, // nmethod too old; tier threshold reached
60 Reason_predicate, // compiler generated predicate failed 60 Reason_predicate, // compiler generated predicate failed
61 Reason_loop_limit_check, // compiler generated loop limits check failed 61 Reason_loop_limit_check, // compiler generated loop limits check failed
62 Reason_speculate_class_check, // saw unexpected object class from type speculation
62 Reason_LIMIT, 63 Reason_LIMIT,
63 // Note: Keep this enum in sync. with _trap_reason_name. 64 // Note: Keep this enum in sync. with _trap_reason_name.
64 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc 65 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc
65 // Note: Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of 66 // Note: Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of
66 // DataLayout::trap_bits. This dependency is enforced indirectly 67 // DataLayout::trap_bits. This dependency is enforced indirectly
309 static DeoptReason reason_recorded_per_bytecode_if_any(DeoptReason reason) { 310 static DeoptReason reason_recorded_per_bytecode_if_any(DeoptReason reason) {
310 if (reason_is_recorded_per_bytecode(reason)) 311 if (reason_is_recorded_per_bytecode(reason))
311 return reason; 312 return reason;
312 else if (reason == Reason_div0_check) // null check due to divide-by-zero? 313 else if (reason == Reason_div0_check) // null check due to divide-by-zero?
313 return Reason_null_check; // recorded per BCI as a null check 314 return Reason_null_check; // recorded per BCI as a null check
315 else if (reason == Reason_speculate_class_check)
316 return Reason_class_check;
314 else 317 else
315 return Reason_none; 318 return Reason_none;
319 }
320
321 static bool reason_is_speculate(int reason) {
322 if (reason == Reason_speculate_class_check) {
323 return true;
324 }
325 return false;
326 }
327
328 static uint per_method_trap_limit(int reason) {
329 return reason_is_speculate(reason) ? (uint)PerMethodSpecTrapLimit : (uint)PerMethodTrapLimit;
316 } 330 }
317 331
318 static const char* trap_reason_name(int reason); 332 static const char* trap_reason_name(int reason);
319 static const char* trap_action_name(int action); 333 static const char* trap_action_name(int action);
320 // Format like reason='foo' action='bar' index='123'. 334 // Format like reason='foo' action='bar' index='123'.
335 static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing); 349 static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing);
336 // Update the mdo's count and per-BCI reason bits, returning previous state: 350 // Update the mdo's count and per-BCI reason bits, returning previous state:
337 static ProfileData* query_update_method_data(MethodData* trap_mdo, 351 static ProfileData* query_update_method_data(MethodData* trap_mdo,
338 int trap_bci, 352 int trap_bci,
339 DeoptReason reason, 353 DeoptReason reason,
354 Method* compiled_method,
340 //outputs: 355 //outputs:
341 uint& ret_this_trap_count, 356 uint& ret_this_trap_count,
342 bool& ret_maybe_prior_trap, 357 bool& ret_maybe_prior_trap,
343 bool& ret_maybe_prior_recompile); 358 bool& ret_maybe_prior_recompile);
344 // class loading support for uncommon trap 359 // class loading support for uncommon trap