8060215: per-method PrintIdealGraphLevel
Use CompileCommand=option to set PrintIdealGraphLevel on a per-method level. Introduce the PrintIdealGraph develop to control/check if printing the graph is enabled for any method Reviewed-by: kvn, dlong, thartmann
This commit is contained in:
parent
38e46e728d
commit
bde7fd61b4
@ -343,10 +343,16 @@
|
|||||||
product(bool, UseRDPCForConstantTableBase, false, \
|
product(bool, UseRDPCForConstantTableBase, false, \
|
||||||
"Use Sparc RDPC instruction for the constant table base.") \
|
"Use Sparc RDPC instruction for the constant table base.") \
|
||||||
\
|
\
|
||||||
develop(intx, PrintIdealGraphLevel, 0, \
|
develop(bool, PrintIdealGraph, false, \
|
||||||
"Print ideal graph to XML file / network interface. " \
|
"Print ideal graph to XML file / network interface. " \
|
||||||
"By default attempts to connect to the visualizer on a socket.") \
|
"By default attempts to connect to the visualizer on a socket.") \
|
||||||
\
|
\
|
||||||
|
develop(intx, PrintIdealGraphLevel, 0, \
|
||||||
|
"Level of detail of the ideal graph printout. " \
|
||||||
|
"System-wide value, 0=nothing is printed, 3=all details printed. "\
|
||||||
|
"Level of detail of printouts can be set on a per-method level " \
|
||||||
|
"as well by using CompileCommand=option.") \
|
||||||
|
\
|
||||||
develop(intx, PrintIdealGraphPort, 4444, \
|
develop(intx, PrintIdealGraphPort, 4444, \
|
||||||
"Ideal graph printer to network port") \
|
"Ideal graph printer to network port") \
|
||||||
\
|
\
|
||||||
|
@ -827,7 +827,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
|
|||||||
// Drain the list.
|
// Drain the list.
|
||||||
Finish_Warm();
|
Finish_Warm();
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (_printer) {
|
if (_printer && _printer->should_print(_method)) {
|
||||||
_printer->print_inlining(this);
|
_printer->print_inlining(this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -622,7 +622,9 @@ class Compile : public Phase {
|
|||||||
|
|
||||||
void begin_method() {
|
void begin_method() {
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (_printer) _printer->begin_method(this);
|
if (_printer && _printer->should_print(_method)) {
|
||||||
|
_printer->begin_method(this);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
C->_latest_stage_start_counter.stamp();
|
C->_latest_stage_start_counter.stamp();
|
||||||
}
|
}
|
||||||
@ -639,7 +641,9 @@ class Compile : public Phase {
|
|||||||
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level);
|
if (_printer && _printer->should_print(_method)) {
|
||||||
|
_printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
C->_latest_stage_start_counter.stamp();
|
C->_latest_stage_start_counter.stamp();
|
||||||
}
|
}
|
||||||
@ -654,7 +658,9 @@ class Compile : public Phase {
|
|||||||
event.commit();
|
event.commit();
|
||||||
}
|
}
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (_printer) _printer->end_method();
|
if (_printer && _printer->should_print(_method)) {
|
||||||
|
_printer->end_method();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,9 @@ const char *IdealGraphPrinter::ASSEMBLY_ELEMENT = "assembly";
|
|||||||
int IdealGraphPrinter::_file_count = 0;
|
int IdealGraphPrinter::_file_count = 0;
|
||||||
|
|
||||||
IdealGraphPrinter *IdealGraphPrinter::printer() {
|
IdealGraphPrinter *IdealGraphPrinter::printer() {
|
||||||
if (PrintIdealGraphLevel == 0) return NULL;
|
if (!PrintIdealGraph) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
JavaThread *thread = JavaThread::current();
|
JavaThread *thread = JavaThread::current();
|
||||||
if (!thread->is_Compiler_thread()) return NULL;
|
if (!thread->is_Compiler_thread()) return NULL;
|
||||||
@ -193,7 +195,6 @@ IdealGraphPrinter::~IdealGraphPrinter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IdealGraphPrinter::begin_elem(const char *s) {
|
void IdealGraphPrinter::begin_elem(const char *s) {
|
||||||
_xml->begin_elem("%s", s);
|
_xml->begin_elem("%s", s);
|
||||||
}
|
}
|
||||||
@ -680,7 +681,7 @@ void IdealGraphPrinter::print_method(Compile* compile, const char *name, int lev
|
|||||||
// Print current ideal graph
|
// Print current ideal graph
|
||||||
void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) {
|
void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) {
|
||||||
|
|
||||||
if (!_current_method || !_should_send_method || level > PrintIdealGraphLevel) return;
|
if (!_current_method || !_should_send_method || !should_print(_current_method, level)) return;
|
||||||
|
|
||||||
this->C = compile;
|
this->C = compile;
|
||||||
|
|
||||||
@ -732,6 +733,13 @@ void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, in
|
|||||||
output()->flush();
|
output()->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should method be printed?
|
||||||
|
bool IdealGraphPrinter::should_print(ciMethod* method, int level) {
|
||||||
|
intx ideal_graph_level = PrintIdealGraphLevel;
|
||||||
|
method->has_option_value("PrintIdealGraphLevel", ideal_graph_level); // update value with per-method value (if available)
|
||||||
|
return ideal_graph_level >= level;
|
||||||
|
}
|
||||||
|
|
||||||
extern const char *NodeClassNames[];
|
extern const char *NodeClassNames[];
|
||||||
|
|
||||||
outputStream *IdealGraphPrinter::output() {
|
outputStream *IdealGraphPrinter::output() {
|
||||||
|
@ -134,6 +134,7 @@ class IdealGraphPrinter : public CHeapObj<mtCompiler> {
|
|||||||
void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false);
|
void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false);
|
||||||
void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false);
|
void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false);
|
||||||
void print_xml(const char *name);
|
void print_xml(const char *name);
|
||||||
|
static bool should_print(ciMethod* method, int level = 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2344,7 +2344,7 @@ void Parse::do_one_bytecode() {
|
|||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
IdealGraphPrinter *printer = IdealGraphPrinter::printer();
|
IdealGraphPrinter *printer = IdealGraphPrinter::printer();
|
||||||
if(printer) {
|
if (printer && printer->should_print(_method)) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf(buffer, "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
|
sprintf(buffer, "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
|
||||||
bool old = printer->traverse_outs();
|
bool old = printer->traverse_outs();
|
||||||
|
@ -3922,6 +3922,15 @@ jint Arguments::apply_ergo() {
|
|||||||
"Incompatible compilation policy selected", NULL);
|
"Incompatible compilation policy selected", NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPILER2
|
||||||
|
#ifndef PRODUCT
|
||||||
|
if (PrintIdealGraphLevel > 0) {
|
||||||
|
FLAG_SET_ERGO(bool, PrintIdealGraph, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered)
|
// Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered)
|
||||||
if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
|
if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
|
||||||
FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
|
FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user