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_rtm_state_change, // rtm state change detected
78 Reason_unstable_if, // a branch predicted always false was taken
79 Reason_unstable_fused_if, // fused two ifs that had each one untaken branch. One is now taken.
80 #if INCLUDE_JVMCI
81 Reason_aliasing, // optimistic assumption about aliasing failed
82 Reason_transfer_to_interpreter, // explicit transferToInterpreter()
83 Reason_not_compiled_exception_handler,
84 Reason_unresolved,
85 Reason_jsr_mismatch,
86 #endif
87
88 // Reason_tenured is counted separately, add normal counted Reasons above.
89 // Related to MethodData::_trap_hist_limit where Reason_tenured isn't included
90 Reason_tenured, // age of the code has reached the limit
91 Reason_LIMIT,
92
93 // Note: Keep this enum in sync. with _trap_reason_name.
94 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc
95 // Note: Reason_RECORDED_LIMIT should be < 8 to fit into 3 bits of
96 // DataLayout::trap_bits. This dependency is enforced indirectly
348 static int trap_state_has_reason(int trap_state, int reason);
349 static int trap_state_add_reason(int trap_state, int reason);
350 static bool trap_state_is_recompiled(int trap_state);
351 static int trap_state_set_recompiled(int trap_state, bool z);
352 static const char* format_trap_state(char* buf, size_t buflen,
353 int trap_state);
354
355 static bool reason_is_recorded_per_bytecode(DeoptReason reason) {
356 return reason > Reason_none && reason <= Reason_RECORDED_LIMIT;
357 }
358
359 static DeoptReason reason_recorded_per_bytecode_if_any(DeoptReason reason) {
360 if (reason_is_recorded_per_bytecode(reason))
361 return reason;
362 else if (reason == Reason_div0_check) // null check due to divide-by-zero?
363 return Reason_null_check; // recorded per BCI as a null check
364 else if (reason == Reason_speculate_class_check)
365 return Reason_class_check;
366 else if (reason == Reason_speculate_null_check)
367 return Reason_null_check;
368 else if (reason == Reason_unstable_if)
369 return Reason_intrinsic;
370 else if (reason == Reason_unstable_fused_if)
371 return Reason_range_check;
372 else
373 return Reason_none;
374 }
375
376 static bool reason_is_speculate(int reason) {
377 if (reason == Reason_speculate_class_check || reason == Reason_speculate_null_check) {
378 return true;
379 }
380 return false;
381 }
382
383 static DeoptReason reason_null_check(bool speculative) {
384 return speculative ? Deoptimization::Reason_speculate_null_check : Deoptimization::Reason_null_check;
385 }
386
387 static DeoptReason reason_class_check(bool speculative) {
388 return speculative ? Deoptimization::Reason_speculate_class_check : Deoptimization::Reason_class_check;
389 }
390
391 static uint per_method_trap_limit(int reason) {
392 return reason_is_speculate(reason) ? (uint)PerMethodSpecTrapLimit : (uint)PerMethodTrapLimit;
393 }
394
395 static const char* trap_reason_name(int reason);
396 static const char* trap_action_name(int action);
397 // Format like reason='foo' action='bar' index='123'.
398 // This is suitable both for XML and for tty output.
399 static const char* format_trap_request(char* buf, size_t buflen,
400 int trap_request);
401
402 static jint total_deoptimization_count();
403 static jint deoptimization_count(DeoptReason reason);
404
405 // JVMTI PopFrame support
406
407 // Preserves incoming arguments to the popped frame when it is
408 // returning to a deoptimized caller
|
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
349 static int trap_state_has_reason(int trap_state, int reason);
350 static int trap_state_add_reason(int trap_state, int reason);
351 static bool trap_state_is_recompiled(int trap_state);
352 static int trap_state_set_recompiled(int trap_state, bool z);
353 static const char* format_trap_state(char* buf, size_t buflen,
354 int trap_state);
355
356 static bool reason_is_recorded_per_bytecode(DeoptReason reason) {
357 return reason > Reason_none && reason <= Reason_RECORDED_LIMIT;
358 }
359
360 static DeoptReason reason_recorded_per_bytecode_if_any(DeoptReason reason) {
361 if (reason_is_recorded_per_bytecode(reason))
362 return reason;
363 else if (reason == Reason_div0_check) // null check due to divide-by-zero?
364 return Reason_null_check; // recorded per BCI as a null check
365 else if (reason == Reason_speculate_class_check)
366 return Reason_class_check;
367 else if (reason == Reason_speculate_null_check)
368 return Reason_null_check;
369 else if (reason == Reason_speculate_null_assert)
370 return Reason_null_assert;
371 else if (reason == Reason_unstable_if)
372 return Reason_intrinsic;
373 else if (reason == Reason_unstable_fused_if)
374 return Reason_range_check;
375 else
376 return Reason_none;
377 }
378
379 static bool reason_is_speculate(int reason) {
380 if (reason == Reason_speculate_class_check ||
381 reason == Reason_speculate_null_check ||
382 reason == Reason_speculate_null_assert) {
383 return true;
384 }
385 return false;
386 }
387
388 static DeoptReason reason_null_check(bool speculative) {
389 return speculative ? Deoptimization::Reason_speculate_null_check : Deoptimization::Reason_null_check;
390 }
391
392 static DeoptReason reason_class_check(bool speculative) {
393 return speculative ? Deoptimization::Reason_speculate_class_check : Deoptimization::Reason_class_check;
394 }
395
396 static DeoptReason reason_null_assert(bool speculative) {
397 return speculative ? Deoptimization::Reason_speculate_null_assert : Deoptimization::Reason_null_assert;
398 }
399
400 static uint per_method_trap_limit(int reason) {
401 return reason_is_speculate(reason) ? (uint)PerMethodSpecTrapLimit : (uint)PerMethodTrapLimit;
402 }
403
404 static const char* trap_reason_name(int reason);
405 static const char* trap_action_name(int action);
406 // Format like reason='foo' action='bar' index='123'.
407 // This is suitable both for XML and for tty output.
408 static const char* format_trap_request(char* buf, size_t buflen,
409 int trap_request);
410
411 static jint total_deoptimization_count();
412 static jint deoptimization_count(DeoptReason reason);
413
414 // JVMTI PopFrame support
415
416 // Preserves incoming arguments to the popped frame when it is
417 // returning to a deoptimized caller
|