From 4b783cca567ed2bb11e362144fa67bfd9d9cd043 Mon Sep 17 00:00:00 2001 From: Dan Lemmond Date: Wed, 16 Dec 2020 17:50:21 +0000 Subject: [PATCH 1/5] 8255216: ciEnv::_break_at_compile isn't in use _break_at_compile is no longer in use and can be safely removed. No new code, and Tier1 tests succeed after code is removed. Bug: https://bugs.openjdk.java.net/browse/JDK-8255216 --- src/hotspot/share/ci/ciEnv.cpp | 2 -- src/hotspot/share/ci/ciEnv.hpp | 4 ---- src/hotspot/share/compiler/compileBroker.cpp | 5 ----- 3 files changed, 11 deletions(-) diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index bda59ecbdc00e..bbd01c76c42a6 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -117,7 +117,6 @@ ciEnv::ciEnv(CompileTask* task) _failure_reason = NULL; _inc_decompile_count_on_failure = true; _compilable = MethodCompilable; - _break_at_compile = false; _compiler_data = NULL; #ifndef PRODUCT assert(!firstEnv, "not initialized properly"); @@ -181,7 +180,6 @@ ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) { _failure_reason = NULL; _inc_decompile_count_on_failure = true; _compilable = MethodCompilable_never; - _break_at_compile = false; _compiler_data = NULL; #ifndef PRODUCT assert(firstEnv, "must be first"); diff --git a/src/hotspot/share/ci/ciEnv.hpp b/src/hotspot/share/ci/ciEnv.hpp index 851c8638c0078..ad6f014d1c652 100644 --- a/src/hotspot/share/ci/ciEnv.hpp +++ b/src/hotspot/share/ci/ciEnv.hpp @@ -58,7 +58,6 @@ class ciEnv : StackObj { const char* _failure_reason; bool _inc_decompile_count_on_failure; int _compilable; - bool _break_at_compile; int _num_inlined_bytecodes; CompileTask* _task; // faster access to CompilerThread::task CompileLog* _log; // faster access to CompilerThread::log @@ -337,9 +336,6 @@ class ciEnv : StackObj { } } - bool break_at_compile() { return _break_at_compile; } - void set_break_at_compile(bool z) { _break_at_compile = z; } - // Cache Jvmti state bool cache_jvmti_state(); bool jvmti_state_changed() const; diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index ea095c86446b0..9f23d907a17c8 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -2200,7 +2200,6 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { int osr_bci = task->osr_bci(); bool is_osr = (osr_bci != standard_entry_bci); bool should_log = (thread->log() != NULL); - bool should_break = false; const int task_level = task->comp_level(); AbstractCompiler* comp = task->compiler(); @@ -2224,7 +2223,6 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level)); } - should_break = directive->BreakAtExecuteOption || task->check_break_at_flags(); if (should_log && !directive->LogOption) { should_log = false; } @@ -2283,9 +2281,6 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { ThreadToNativeFromVM ttn(thread); ciEnv ci_env(task); - if (should_break) { - ci_env.set_break_at_compile(true); - } if (should_log) { ci_env.set_log(thread->log()); } From 36bc753b6ae85392c3f5e34f85464c02b1c037de Mon Sep 17 00:00:00 2001 From: Dan Lemmond Date: Tue, 19 Jan 2021 21:59:54 +0000 Subject: [PATCH 2/5] Address PR feedback + comments Move to env()->break_at_compile() in compile.cpp --- src/hotspot/share/ci/ciEnv.cpp | 2 ++ src/hotspot/share/ci/ciEnv.hpp | 4 ++++ src/hotspot/share/opto/compile.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index bbd01c76c42a6..bda59ecbdc00e 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -117,6 +117,7 @@ ciEnv::ciEnv(CompileTask* task) _failure_reason = NULL; _inc_decompile_count_on_failure = true; _compilable = MethodCompilable; + _break_at_compile = false; _compiler_data = NULL; #ifndef PRODUCT assert(!firstEnv, "not initialized properly"); @@ -180,6 +181,7 @@ ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) { _failure_reason = NULL; _inc_decompile_count_on_failure = true; _compilable = MethodCompilable_never; + _break_at_compile = false; _compiler_data = NULL; #ifndef PRODUCT assert(firstEnv, "must be first"); diff --git a/src/hotspot/share/ci/ciEnv.hpp b/src/hotspot/share/ci/ciEnv.hpp index ad6f014d1c652..851c8638c0078 100644 --- a/src/hotspot/share/ci/ciEnv.hpp +++ b/src/hotspot/share/ci/ciEnv.hpp @@ -58,6 +58,7 @@ class ciEnv : StackObj { const char* _failure_reason; bool _inc_decompile_count_on_failure; int _compilable; + bool _break_at_compile; int _num_inlined_bytecodes; CompileTask* _task; // faster access to CompilerThread::task CompileLog* _log; // faster access to CompilerThread::log @@ -336,6 +337,9 @@ class ciEnv : StackObj { } } + bool break_at_compile() { return _break_at_compile; } + void set_break_at_compile(bool z) { _break_at_compile = z; } + // Cache Jvmti state bool cache_jvmti_state(); bool jvmti_state_changed() const; diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 98efa9c4f23ab..589911f3f93c3 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -2094,7 +2094,7 @@ void Compile::Optimize() { TracePhase tp("optimizer", &timers[_t_optimizer]); #ifndef PRODUCT - if (_directive->BreakAtCompileOption) { + if (env()->break_at_compile()) { BREAKPOINT; } From 41d01c051937f65dda7dade8964cc53cef3bd6fd Mon Sep 17 00:00:00 2001 From: Dan Lemmond Date: Wed, 20 Jan 2021 01:04:43 +0000 Subject: [PATCH 3/5] Revert "8255216: ciEnv::_break_at_compile isn't in use" This reverts commit 4b783cca567ed2bb11e362144fa67bfd9d9cd043. --- src/hotspot/share/compiler/compileBroker.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 9f23d907a17c8..ea095c86446b0 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -2200,6 +2200,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { int osr_bci = task->osr_bci(); bool is_osr = (osr_bci != standard_entry_bci); bool should_log = (thread->log() != NULL); + bool should_break = false; const int task_level = task->comp_level(); AbstractCompiler* comp = task->compiler(); @@ -2223,6 +2224,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level)); } + should_break = directive->BreakAtExecuteOption || task->check_break_at_flags(); if (should_log && !directive->LogOption) { should_log = false; } @@ -2281,6 +2283,9 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { ThreadToNativeFromVM ttn(thread); ciEnv ci_env(task); + if (should_break) { + ci_env.set_break_at_compile(true); + } if (should_log) { ci_env.set_log(thread->log()); } From 12eedef866f61e36d47cb57c6a03fc639b670506 Mon Sep 17 00:00:00 2001 From: Dan Lemmond Date: Thu, 21 Jan 2021 07:44:21 +0000 Subject: [PATCH 4/5] Remove additional _directive->BreakAtCompileOption calls Repurpose to env()->break_at_compile() --- src/hotspot/share/c1/c1_Compilation.cpp | 2 +- src/hotspot/share/opto/compile.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/c1/c1_Compilation.cpp b/src/hotspot/share/c1/c1_Compilation.cpp index c0de3bfad2f5b..a4949dfe0b348 100644 --- a/src/hotspot/share/c1/c1_Compilation.cpp +++ b/src/hotspot/share/c1/c1_Compilation.cpp @@ -446,7 +446,7 @@ void Compilation::compile_method() { dependency_recorder()->assert_evol_method(method()); } - if (directive()->BreakAtCompileOption) { + if (env()->break_at_compile()) { BREAKPOINT; } diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 589911f3f93c3..105ac11b3a6ad 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -503,7 +503,7 @@ void Compile::print_compile_messages() { tty->print_cr("** Bailout: Recompile without boxing elimination **"); tty->print_cr("*********************************************************"); } - if (C->directive()->BreakAtCompileOption) { + if (env()->break_at_compile()) { // Open the debugger when compiling this method. tty->print("### Breaking when compiling: "); method()->print_short_name(); From 783635d22c349f6eea22bd2985abd38c82a02cc7 Mon Sep 17 00:00:00 2001 From: Dan Lemmond Date: Fri, 22 Jan 2021 09:31:40 +0000 Subject: [PATCH 5/5] Update compileBroker to use BreakAtCompileOption BreakAtExecuteOption should not be used here, instead use BreakAtCompileOption --- src/hotspot/share/compiler/compileBroker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index ea095c86446b0..1364e20974945 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -2224,7 +2224,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level)); } - should_break = directive->BreakAtExecuteOption || task->check_break_at_flags(); + should_break = directive->BreakAtCompileOption || task->check_break_at_flags(); if (should_log && !directive->LogOption) { should_log = false; }