--- old/src/hotspot/share/runtime/deoptimization.hpp 2020-07-12 22:24:38.119379149 +0200 +++ new/src/hotspot/share/runtime/deoptimization.hpp 2020-07-12 22:24:37.695378339 +0200 @@ -474,11 +474,6 @@ public: static void update_method_data_from_interpreter(MethodData* trap_mdo, int trap_bci, int reason); - -#if defined(ASSERT) && COMPILER2_OR_JVMCI - // Revert optimizations based on escape analysis for all compiled frames of all Java threads. - static void deoptimize_objects_alot_loop(); -#endif // defined(ASSERT) && COMPILER2_OR_JVMCI }; // EscapeBarriers should be put on execution paths, where JVMTI agents can access object @@ -505,14 +500,18 @@ public: // Revert ea based optimizations for given deoptee thread EscapeBarrier(JavaThread* calling_thread, JavaThread* deoptee_thread, bool barrier_active) - : _calling_thread(calling_thread), _deoptee_thread(deoptee_thread), _barrier_active(barrier_active) + : _calling_thread(calling_thread), _deoptee_thread(deoptee_thread), + _barrier_active(barrier_active && (JVMCI_ONLY(UseJVMCICompiler) NOT_JVMCI(false) + COMPILER2_PRESENT(|| DoEscapeAnalysis))) { if (_barrier_active) sync_and_suspend_one(); } // Revert ea based optimizations for all java threads EscapeBarrier(JavaThread* calling_thread, bool barrier_active) - : _calling_thread(calling_thread), _deoptee_thread(NULL), _barrier_active(barrier_active) + : _calling_thread(calling_thread), _deoptee_thread(NULL), + _barrier_active(barrier_active && (JVMCI_ONLY(UseJVMCICompiler) NOT_JVMCI(false) + COMPILER2_PRESENT(|| DoEscapeAnalysis))) { if (_barrier_active) sync_and_suspend_all(); } @@ -520,22 +519,29 @@ public: EscapeBarrier(JavaThread* calling_thread, JavaThread* deoptee_thread, bool barrier_active) { } EscapeBarrier(JavaThread* calling_thread, bool barrier_active) { } + static bool deoptimizing_objects_for_all_threads() { return false; } #endif // COMPILER2_OR_JVMCI // Deoptimize objects, i.e. reallocate and relock them. The target frames are deoptimized. // The methods return false iff at least one reallocation failed. - bool deoptimize_objects(intptr_t* fr_id) { return deoptimize_objects_internal(deoptee_thread(), fr_id); } + bool deoptimize_objects(intptr_t* fr_id) { + return true COMPILER2_OR_JVMCI_PRESENT(&& deoptimize_objects_internal(deoptee_thread(), fr_id)); + } bool deoptimize_objects(int depth) NOT_COMPILER2_OR_JVMCI_RETURN_(true); // Find and deoptimize non escaping objects and the holding frames on all stacks. bool deoptimize_objects_all_threads() NOT_COMPILER2_OR_JVMCI_RETURN_(true); // A java thread was added to the list of threads static void thread_added(JavaThread* jt) NOT_COMPILER2_OR_JVMCI_RETURN; + // A java thread was removed from the list of threads + static void thread_removed(JavaThread* jt) NOT_COMPILER2_OR_JVMCI_RETURN; #if COMPILER2_OR_JVMCI // Returns true iff objects were reallocated and relocked because of access through JVMTI static bool objs_are_deoptimized(JavaThread* thread, intptr_t* fr_id); + static bool deoptimizing_objects_for_all_threads() { return _deoptimizing_objects_for_all_threads; } + ~EscapeBarrier() { if (!barrier_active()) return; if (all_threads()) {