--- old/src/hotspot/share/runtime/thread.hpp 2018-09-26 14:03:57.000000000 +0200 +++ new/src/hotspot/share/runtime/thread.hpp 2018-09-26 14:03:56.000000000 +0200 @@ -281,6 +281,14 @@ void leave_signal_handler() { _num_nested_signal--; } bool is_inside_signal_handler() const { return _num_nested_signal > 0; } + // Determines if a heap allocation failure will be retried + // (e.g., by deoptimizing and re-executing in the interpreter). + // In this case, the failed allocation must raise + // Universe::out_of_memory_error_retry() and omit side effects + // such as JVMTI events and handling -XX:+HeapDumpOnOutOfMemoryError + // and -XX:OnOutOfMemoryError. + virtual bool in_retryable_allocation() const { return false; } + #ifdef ASSERT void set_suspendible_thread() { _suspendible_thread = true; @@ -1048,6 +1056,10 @@ // Guard for re-entrant call to JVMCIRuntime::adjust_comp_level bool _adjusting_comp_level; + // True if in a runtime call from compiled code that will deoptimize + // and re-execute a failed heap allocation in the interpreter. + bool _in_retryable_allocation; + // An id of a speculation that JVMCI compiled code can use to further describe and // uniquely identify the speculative optimization guarded by the uncommon trap long _pending_failed_speculation; @@ -1458,7 +1470,7 @@ #if INCLUDE_JVMCI int pending_deoptimization() const { return _pending_deoptimization; } - long pending_failed_speculation() const { return _pending_failed_speculation; } + long pending_failed_speculation() const { return _pending_failed_speculation; } bool adjusting_comp_level() const { return _adjusting_comp_level; } void set_adjusting_comp_level(bool b) { _adjusting_comp_level = b; } bool has_pending_monitorenter() const { return _pending_monitorenter; } @@ -1468,6 +1480,9 @@ void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; } void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; } void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; } + + virtual bool in_retryable_allocation() const { return _in_retryable_allocation; } + void set_in_retryable_allocation(bool b) { _in_retryable_allocation = b; } #endif // INCLUDE_JVMCI // Exception handling for compiled methods