8139046: Compiler Control: IGVPrintLevel directive should set PrintIdealGraph

Make !PrintIdealGraph a synonym for PrintIdealGraphLevel=-1 => print nothing

Reviewed-by: simonis, phh, neliasso
This commit is contained in:
Xin Liu 2020-06-12 13:33:29 -07:00
parent be278bc564
commit 892d998587
7 changed files with 29 additions and 36 deletions

View File

@ -507,8 +507,8 @@ void CompilerConfig::ergo_initialize() {
if (!IncrementalInline) {
AlwaysIncrementalInline = false;
}
if (PrintIdealGraphLevel > 0) {
FLAG_SET_ERGO(PrintIdealGraph, true);
if (FLAG_IS_CMDLINE(PrintIdealGraph) && !PrintIdealGraph) {
FLAG_SET_ERGO(PrintIdealGraphLevel, -1);
}
#endif
if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) {

View File

@ -366,10 +366,12 @@
\
notproduct(intx, PrintIdealGraphLevel, 0, \
"Level of detail of the ideal graph printout. " \
"System-wide value, 0=nothing is printed, 4=all details printed. "\
"System-wide value, -1=printing is disabled, " \
"0=print nothing except IGVPrintLevel directives, " \
"4=all details printed. " \
"Level of detail of printouts can be set on a per-method level " \
"as well by using CompileCommand=option.") \
range(0, 4) \
range(-1, 4) \
\
notproduct(intx, PrintIdealGraphPort, 4444, \
"Ideal graph printer to network port") \

View File

@ -529,9 +529,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
_log(ci_env->log()),
_failure_reason(NULL),
_congraph(NULL),
#ifndef PRODUCT
_printer(IdealGraphPrinter::printer()),
#endif
NOT_PRODUCT(_printer(NULL) COMMA)
_dead_node_list(comp_arena()),
_dead_node_count(0),
_node_arena(mtCompiler),
@ -559,11 +557,6 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
#endif
{
C = this;
#ifndef PRODUCT
if (_printer != NULL) {
_printer->set_compile(this);
}
#endif
CompileWrapper cw(this);
if (CITimeVerbose) {
@ -725,7 +718,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
// Drain the list.
Finish_Warm();
#ifndef PRODUCT
if (_printer && _printer->should_print(1)) {
if (should_print(1)) {
_printer->print_inlining();
}
#endif
@ -821,9 +814,7 @@ Compile::Compile( ciEnv* ci_env,
_log(ci_env->log()),
_failure_reason(NULL),
_congraph(NULL),
#ifndef PRODUCT
_printer(NULL),
#endif
NOT_PRODUCT(_printer(NULL) COMMA)
_dead_node_list(comp_arena()),
_dead_node_count(0),
_node_arena(mtCompiler),
@ -4590,7 +4581,7 @@ void Compile::end_method(int level) {
}
#ifndef PRODUCT
if (_printer && _printer->should_print(level)) {
if (_method != NULL && should_print(level)) {
_printer->end_method();
}
#endif

View File

@ -614,9 +614,9 @@ class Compile : public Phase {
Ticks _latest_stage_start_counter;
void begin_method() {
void begin_method(int level = 1) {
#ifndef PRODUCT
if (_printer && _printer->should_print(1)) {
if (_method != NULL && should_print(level)) {
_printer->begin_method();
}
#endif
@ -625,7 +625,17 @@ class Compile : public Phase {
bool should_print(int level = 1) {
#ifndef PRODUCT
return (_printer && _printer->should_print(level));
if (PrintIdealGraphLevel < 0) { // disabled by the user
return false;
}
bool need = directive()->IGVPrintLevelOption >= level;
if (need && !_printer) {
_printer = IdealGraphPrinter::printer();
assert(_printer != NULL, "_printer is NULL when we need it!");
_printer->set_compile(this);
}
return need;
#else
return false;
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -75,10 +75,6 @@ const char *IdealGraphPrinter::ASSEMBLY_ELEMENT = "assembly";
int IdealGraphPrinter::_file_count = 0;
IdealGraphPrinter *IdealGraphPrinter::printer() {
if (!PrintIdealGraph) {
return NULL;
}
JavaThread *thread = JavaThread::current();
if (!thread->is_Compiler_thread()) return NULL;
@ -633,7 +629,7 @@ void IdealGraphPrinter::walk_nodes(Node *start, bool edges, VectorSet* temp_set)
}
void IdealGraphPrinter::print_method(const char *name, int level) {
if (should_print(level)) {
if (C->should_print(level)) {
print(name, (Node *) C->root());
}
}
@ -691,11 +687,6 @@ void IdealGraphPrinter::print(const char *name, Node *node) {
_xml->flush();
}
// Should method be printed?
bool IdealGraphPrinter::should_print(int level) {
return C->directive()->IGVPrintLevelOption >= level;
}
void IdealGraphPrinter::init_file_stream(const char* file_name, bool use_multiple_files, bool append) {
ThreadCritical tc;
if (use_multiple_files && _file_count != 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -126,7 +126,6 @@ class IdealGraphPrinter : public CHeapObj<mtCompiler> {
void end_method();
void print_method(const char *name, int level = 0);
void print(const char *name, Node *root);
bool should_print(int level);
void set_compile(Compile* compile) {C = compile; }
void update_compiled_method(ciMethod* current_method);
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -2842,8 +2842,8 @@ void Parse::do_one_bytecode() {
}
#ifndef PRODUCT
IdealGraphPrinter *printer = C->printer();
if (printer && printer->should_print(1)) {
if (C->should_print(1)) {
IdealGraphPrinter* printer = C->printer();
char buffer[256];
jio_snprintf(buffer, sizeof(buffer), "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
bool old = printer->traverse_outs();