8316702: Only evaluate buffer when IGVPrintLevelOption >= 5

Reviewed-by: chagedorn, thartmann
This commit is contained in:
Xin Liu 2023-09-22 08:35:35 +00:00
parent 4b65483921
commit bd2439f3fc
2 changed files with 4 additions and 3 deletions

View File

@ -5127,7 +5127,7 @@ bool Compile::should_print_phase(CompilerPhaseType cpt) {
return false;
}
bool Compile::should_print_igv(int level) {
bool Compile::should_print_igv(const int level) {
#ifndef PRODUCT
if (PrintIdealGraphLevel < 0) { // disabled by the user
return false;

View File

@ -2779,13 +2779,14 @@ void Parse::do_one_bytecode() {
}
#ifndef PRODUCT
if (C->should_print_igv(1)) {
constexpr int perBytecode = 5;
if (C->should_print_igv(perBytecode)) {
IdealGraphPrinter* printer = C->igv_printer();
char buffer[256];
jio_snprintf(buffer, sizeof(buffer), "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
bool old = printer->traverse_outs();
printer->set_traverse_outs(true);
printer->print_method(buffer, 5);
printer->print_method(buffer, perBytecode);
printer->set_traverse_outs(old);
}
#endif