Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8255216: Change _directive->BreakAtCompileOption to env()->break_at_compile() #1806

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/share/c1/c1_Compilation.cpp
Expand Up @@ -446,7 +446,7 @@ void Compilation::compile_method() {
dependency_recorder()->assert_evol_method(method());
}

if (directive()->BreakAtCompileOption) {
if (env()->break_at_compile()) {
BREAKPOINT;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/compiler/compileBroker.cpp
Expand Up @@ -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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CompileTask::check_break_at_flags is dead code too, and CIBreakAtOSR, CIBreakAt
they are all defunct right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure whether or not we wanted to roll the removal of all dead code into this issue or just _break_at_compile. The JBS issue specifically mentions _break_at_compile so that's what I removed here - can expand to do other stuff if you think it's a good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to remove all that dead code with this issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should CIBreakAtOSR and CIBreakAt be removed too, or is it a bug that these flags are ignored?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fact that these flags are not working proves that no one is using them and therefore they should be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally it was used to break into debugger during compilation:
http://hg.openjdk.java.net/jdk8u/jdk8u-dev/hotspot/file/fffb29a53519/src/share/vm/opto/compile.cpp#l2104

In JDK 9 it was replaced with Compiler directive which skips compilation's ciEnv and consult CompilerOracle directly:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/compile.cpp#L2099

So I think cleaning ciEnv is fine.

I think it is bug that task->check_break_at_flags() is ignored. I used CIBreakAtOSR and CIBreakAt during debugging long ago before directives were introduced. I think it should be fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fact that these flags are not working proves that no one is using them and therefore they should be removed.

I tried to use BreakAtExecute recently, thinking it would generate a break in the generated code, but it didn't work, so I ended up using "break", which if I recall also sets a breakpoint when the method is compiled. I like having the choice of "break during compile" vs "break in generated code".

should_break = directive->BreakAtCompileOption || task->check_break_at_flags();
if (should_log && !directive->LogOption) {
should_log = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/compile.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -2094,7 +2094,7 @@ void Compile::Optimize() {
TracePhase tp("optimizer", &timers[_t_optimizer]);

#ifndef PRODUCT
if (_directive->BreakAtCompileOption) {
if (env()->break_at_compile()) {
BREAKPOINT;
}

Expand Down