mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8280076: Unify IGV and IR printing
Reviewed-by: chagedorn, thartmann, vlivanov
This commit is contained in:
parent
9e3f68d8f4
commit
88a8b239aa
7 changed files with 56 additions and 39 deletions
|
@ -67,6 +67,7 @@
|
||||||
NOT_PRODUCT(cflags(TraceOptoPipelining, bool, TraceOptoPipelining, TraceOptoPipelining)) \
|
NOT_PRODUCT(cflags(TraceOptoPipelining, bool, TraceOptoPipelining, TraceOptoPipelining)) \
|
||||||
NOT_PRODUCT(cflags(TraceOptoOutput, bool, TraceOptoOutput, TraceOptoOutput)) \
|
NOT_PRODUCT(cflags(TraceOptoOutput, bool, TraceOptoOutput, TraceOptoOutput)) \
|
||||||
NOT_PRODUCT(cflags(PrintIdeal, bool, PrintIdeal, PrintIdeal)) \
|
NOT_PRODUCT(cflags(PrintIdeal, bool, PrintIdeal, PrintIdeal)) \
|
||||||
|
NOT_PRODUCT(cflags(PrintIdealLevel, uintx, PrintIdealLevel, PrintIdealLevel)) \
|
||||||
cflags(TraceSpilling, bool, TraceSpilling, TraceSpilling) \
|
cflags(TraceSpilling, bool, TraceSpilling, TraceSpilling) \
|
||||||
cflags(Vectorize, bool, false, Vectorize) \
|
cflags(Vectorize, bool, false, Vectorize) \
|
||||||
cflags(CloneMapDebug, bool, false, CloneMapDebug) \
|
cflags(CloneMapDebug, bool, false, CloneMapDebug) \
|
||||||
|
|
|
@ -79,7 +79,8 @@ class methodHandle;
|
||||||
option(TraceOptoPipelining, "TraceOptoPipelining", Bool) \
|
option(TraceOptoPipelining, "TraceOptoPipelining", Bool) \
|
||||||
option(TraceOptoOutput, "TraceOptoOutput", Bool) \
|
option(TraceOptoOutput, "TraceOptoOutput", Bool) \
|
||||||
option(TraceSpilling, "TraceSpilling", Bool) \
|
option(TraceSpilling, "TraceSpilling", Bool) \
|
||||||
option(PrintIdeal, "PrintIdeal", Bool) \
|
option(PrintIdeal, "PrintIdeal", Bool) \
|
||||||
|
option(PrintIdealLevel, "PrintIdealLevel", Uintx) \
|
||||||
option(IGVPrintLevel, "IGVPrintLevel", Intx) \
|
option(IGVPrintLevel, "IGVPrintLevel", Intx) \
|
||||||
option(Vectorize, "Vectorize", Bool) \
|
option(Vectorize, "Vectorize", Bool) \
|
||||||
option(VectorizeDebug, "VectorizeDebug", Uintx) \
|
option(VectorizeDebug, "VectorizeDebug", Uintx) \
|
||||||
|
|
|
@ -112,6 +112,11 @@
|
||||||
notproduct(bool, PrintIdeal, false, \
|
notproduct(bool, PrintIdeal, false, \
|
||||||
"Print ideal graph before code generation") \
|
"Print ideal graph before code generation") \
|
||||||
\
|
\
|
||||||
|
notproduct(uintx, PrintIdealLevel, 0, \
|
||||||
|
"Print ideal IR on stdout. " \
|
||||||
|
"Same levels as PrintIdealGraphLevel") \
|
||||||
|
range(0, 4) \
|
||||||
|
\
|
||||||
notproduct(uintx, PrintIdealIndentThreshold, 0, \
|
notproduct(uintx, PrintIdealIndentThreshold, 0, \
|
||||||
"A depth threshold of ideal graph. Indentation is disabled " \
|
"A depth threshold of ideal graph. Indentation is disabled " \
|
||||||
"when users attempt to dump an ideal graph deeper than it.") \
|
"when users attempt to dump an ideal graph deeper than it.") \
|
||||||
|
|
|
@ -535,6 +535,26 @@ void Compile::print_compile_messages() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PRODUCT
|
||||||
|
void Compile::print_ideal_ir(const char* phase_name) {
|
||||||
|
ttyLocker ttyl;
|
||||||
|
// keep the following output all in one block
|
||||||
|
// This output goes directly to the tty, not the compiler log.
|
||||||
|
// To enable tools to match it up with the compilation activity,
|
||||||
|
// be sure to tag this tty output with the compile ID.
|
||||||
|
if (xtty != NULL) {
|
||||||
|
xtty->head("ideal compile_id='%d'%s compile_phase='%s'",
|
||||||
|
compile_id(),
|
||||||
|
is_osr_compilation() ? " compile_kind='osr'" : "",
|
||||||
|
phase_name);
|
||||||
|
}
|
||||||
|
root()->dump(9999);
|
||||||
|
if (xtty != NULL) {
|
||||||
|
xtty->tail("ideal");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
//------------------------------Compile standard-------------------------------
|
//------------------------------Compile standard-------------------------------
|
||||||
debug_only( int Compile::_debug_idx = 100000; )
|
debug_only( int Compile::_debug_idx = 100000; )
|
||||||
|
@ -563,7 +583,6 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
_igv_idx(0),
|
_igv_idx(0),
|
||||||
_trace_opto_output(directive->TraceOptoOutputOption),
|
_trace_opto_output(directive->TraceOptoOutputOption),
|
||||||
_print_ideal(directive->PrintIdealOption),
|
|
||||||
#endif
|
#endif
|
||||||
_has_method_handle_invokes(false),
|
_has_method_handle_invokes(false),
|
||||||
_clinit_barrier_on_entry(false),
|
_clinit_barrier_on_entry(false),
|
||||||
|
@ -582,7 +601,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
|
||||||
_for_post_loop_igvn(comp_arena(), 8, 0, NULL),
|
_for_post_loop_igvn(comp_arena(), 8, 0, NULL),
|
||||||
_coarsened_locks (comp_arena(), 8, 0, NULL),
|
_coarsened_locks (comp_arena(), 8, 0, NULL),
|
||||||
_congraph(NULL),
|
_congraph(NULL),
|
||||||
NOT_PRODUCT(_printer(NULL) COMMA)
|
NOT_PRODUCT(_igv_printer(NULL) COMMA)
|
||||||
_dead_node_list(comp_arena()),
|
_dead_node_list(comp_arena()),
|
||||||
_dead_node_count(0),
|
_dead_node_count(0),
|
||||||
_node_arena(mtCompiler),
|
_node_arena(mtCompiler),
|
||||||
|
@ -764,8 +783,8 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
|
||||||
set_default_node_notes(NULL);
|
set_default_node_notes(NULL);
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (should_print(1)) {
|
if (should_print_igv(1)) {
|
||||||
_printer->print_inlining();
|
_igv_printer->print_inlining();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -792,20 +811,8 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
|
||||||
NOT_PRODUCT( verify_graph_edges(); )
|
NOT_PRODUCT( verify_graph_edges(); )
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (print_ideal()) {
|
if (should_print_ideal()) {
|
||||||
ttyLocker ttyl; // keep the following output all in one block
|
print_ideal_ir("print_ideal");
|
||||||
// This output goes directly to the tty, not the compiler log.
|
|
||||||
// To enable tools to match it up with the compilation activity,
|
|
||||||
// be sure to tag this tty output with the compile ID.
|
|
||||||
if (xtty != NULL) {
|
|
||||||
xtty->head("ideal compile_id='%d'%s", compile_id(),
|
|
||||||
is_osr_compilation() ? " compile_kind='osr'" :
|
|
||||||
"");
|
|
||||||
}
|
|
||||||
root()->dump(9999);
|
|
||||||
if (xtty != NULL) {
|
|
||||||
xtty->tail("ideal");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -861,7 +868,6 @@ Compile::Compile( ciEnv* ci_env,
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
_igv_idx(0),
|
_igv_idx(0),
|
||||||
_trace_opto_output(directive->TraceOptoOutputOption),
|
_trace_opto_output(directive->TraceOptoOutputOption),
|
||||||
_print_ideal(directive->PrintIdealOption),
|
|
||||||
#endif
|
#endif
|
||||||
_has_method_handle_invokes(false),
|
_has_method_handle_invokes(false),
|
||||||
_clinit_barrier_on_entry(false),
|
_clinit_barrier_on_entry(false),
|
||||||
|
@ -873,7 +879,7 @@ Compile::Compile( ciEnv* ci_env,
|
||||||
_log(ci_env->log()),
|
_log(ci_env->log()),
|
||||||
_failure_reason(NULL),
|
_failure_reason(NULL),
|
||||||
_congraph(NULL),
|
_congraph(NULL),
|
||||||
NOT_PRODUCT(_printer(NULL) COMMA)
|
NOT_PRODUCT(_igv_printer(NULL) COMMA)
|
||||||
_dead_node_list(comp_arena()),
|
_dead_node_list(comp_arena()),
|
||||||
_dead_node_count(0),
|
_dead_node_count(0),
|
||||||
_node_arena(mtCompiler),
|
_node_arena(mtCompiler),
|
||||||
|
@ -4830,8 +4836,11 @@ void Compile::print_method_impl(CompilerPhaseType cpt, const char *name, int lev
|
||||||
CompilerEvent::PhaseEvent::post(event, C->_latest_stage_start_counter, cpt, C->_compile_id, level);
|
CompilerEvent::PhaseEvent::post(event, C->_latest_stage_start_counter, cpt, C->_compile_id, level);
|
||||||
}
|
}
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (should_print(level)) {
|
if (should_print_igv(level)) {
|
||||||
_printer->print_method(name, level);
|
_igv_printer->print_method(name, level);
|
||||||
|
}
|
||||||
|
if (should_print_ideal(level)) {
|
||||||
|
print_ideal_ir(name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
C->_latest_stage_start_counter.stamp();
|
C->_latest_stage_start_counter.stamp();
|
||||||
|
@ -4840,8 +4849,8 @@ void Compile::print_method_impl(CompilerPhaseType cpt, const char *name, int lev
|
||||||
// Only used from CompileWrapper
|
// Only used from CompileWrapper
|
||||||
void Compile::begin_method() {
|
void Compile::begin_method() {
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (_method != NULL && should_print(1)) {
|
if (_method != NULL && should_print_igv(1)) {
|
||||||
_printer->begin_method();
|
_igv_printer->begin_method();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
C->_latest_stage_start_counter.stamp();
|
C->_latest_stage_start_counter.stamp();
|
||||||
|
@ -4855,22 +4864,22 @@ void Compile::end_method() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (_method != NULL && should_print(1)) {
|
if (_method != NULL && should_print_igv(1)) {
|
||||||
_printer->end_method();
|
_igv_printer->end_method();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Compile::should_print(int level) {
|
bool Compile::should_print_igv(int level) {
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (PrintIdealGraphLevel < 0) { // disabled by the user
|
if (PrintIdealGraphLevel < 0) { // disabled by the user
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool need = directive()->IGVPrintLevelOption >= level;
|
bool need = directive()->IGVPrintLevelOption >= level;
|
||||||
if (need && _printer == nullptr) {
|
if (need && !_igv_printer) {
|
||||||
_printer = IdealGraphPrinter::printer();
|
_igv_printer = IdealGraphPrinter::printer();
|
||||||
_printer->set_compile(this);
|
_igv_printer->set_compile(this);
|
||||||
}
|
}
|
||||||
return need;
|
return need;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -327,7 +327,6 @@ class Compile : public Phase {
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
uint _igv_idx; // Counter for IGV node identifiers
|
uint _igv_idx; // Counter for IGV node identifiers
|
||||||
bool _trace_opto_output;
|
bool _trace_opto_output;
|
||||||
bool _print_ideal;
|
|
||||||
bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
|
bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
|
||||||
#endif
|
#endif
|
||||||
bool _has_irreducible_loop; // Found irreducible loops
|
bool _has_irreducible_loop; // Found irreducible loops
|
||||||
|
@ -354,7 +353,7 @@ class Compile : public Phase {
|
||||||
GrowableArray<Node_List*> _coarsened_locks; // List of coarsened Lock and Unlock nodes
|
GrowableArray<Node_List*> _coarsened_locks; // List of coarsened Lock and Unlock nodes
|
||||||
ConnectionGraph* _congraph;
|
ConnectionGraph* _congraph;
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
IdealGraphPrinter* _printer;
|
IdealGraphPrinter* _igv_printer;
|
||||||
static IdealGraphPrinter* _debug_file_printer;
|
static IdealGraphPrinter* _debug_file_printer;
|
||||||
static IdealGraphPrinter* _debug_network_printer;
|
static IdealGraphPrinter* _debug_network_printer;
|
||||||
#endif
|
#endif
|
||||||
|
@ -489,7 +488,7 @@ class Compile : public Phase {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
IdealGraphPrinter* printer() { return _printer; }
|
IdealGraphPrinter* igv_printer() { return _igv_printer; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void log_late_inline(CallGenerator* cg);
|
void log_late_inline(CallGenerator* cg);
|
||||||
|
@ -636,7 +635,9 @@ class Compile : public Phase {
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
uint next_igv_idx() { return _igv_idx++; }
|
uint next_igv_idx() { return _igv_idx++; }
|
||||||
bool trace_opto_output() const { return _trace_opto_output; }
|
bool trace_opto_output() const { return _trace_opto_output; }
|
||||||
bool print_ideal() const { return _print_ideal; }
|
void print_ideal_ir(const char* phase_name);
|
||||||
|
bool should_print_ideal() const { return _directive->PrintIdealOption; }
|
||||||
|
bool should_print_ideal(uint level) const { return _directive->PrintIdealLevelOption >= level; }
|
||||||
bool parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
|
bool parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
|
||||||
void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
|
void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
|
||||||
int _in_dump_cnt; // Required for dumping ir nodes.
|
int _in_dump_cnt; // Required for dumping ir nodes.
|
||||||
|
@ -652,7 +653,7 @@ class Compile : public Phase {
|
||||||
|
|
||||||
void begin_method();
|
void begin_method();
|
||||||
void end_method();
|
void end_method();
|
||||||
bool should_print(int level);
|
bool should_print_igv(int level);
|
||||||
|
|
||||||
void print_method(CompilerPhaseType cpt, int level);
|
void print_method(CompilerPhaseType cpt, int level);
|
||||||
void print_method(CompilerPhaseType cpt, Node* n, int level = 3);
|
void print_method(CompilerPhaseType cpt, Node* n, int level = 3);
|
||||||
|
|
|
@ -762,7 +762,7 @@ void IdealGraphPrinter::walk_nodes(Node* start, bool edges, VectorSet* temp_set)
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdealGraphPrinter::print_method(const char *name, int level) {
|
void IdealGraphPrinter::print_method(const char *name, int level) {
|
||||||
if (C->should_print(level)) {
|
if (C->should_print_igv(level)) {
|
||||||
print(name, (Node *) C->root());
|
print(name, (Node *) C->root());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2752,8 +2752,8 @@ void Parse::do_one_bytecode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (C->should_print(1)) {
|
if (C->should_print_igv(1)) {
|
||||||
IdealGraphPrinter* printer = C->printer();
|
IdealGraphPrinter* printer = C->igv_printer();
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
jio_snprintf(buffer, sizeof(buffer), "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
|
jio_snprintf(buffer, sizeof(buffer), "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
|
||||||
bool old = printer->traverse_outs();
|
bool old = printer->traverse_outs();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue