RFR: JDK-8280274: Guard printing code of Compile::print_method in PRODUCT
Tobias Hartmann
thartmann at openjdk.java.net
Fri Jan 21 13:42:50 UTC 2022
On Thu, 20 Jan 2022 13:30:05 GMT, Tobias Holenstein <duke at openjdk.java.net> wrote:
> In `Compile::print_method(CompilerPhaseType cpt, Node* n, int level)` the code
> ```
> ResourceMark rm;
> stringStream ss;
> ss.print_raw(CompilerPhaseTypeHelper::to_string(cpt));
> if (n != NULL) {
> ss.print(": %d %s ", n->_idx, NodeClassNames[n->Opcode()]);
> } else {
> ss.print_raw(": NULL");
> }
> ```
> should to be guarded by a `#ifndef PRODUCT` since the usage of the string is also guarded in `Compile::print_method_impl`
>
> Tested on Tier1-3
Would it also be an option to move that code into `print_method_impl`?
src/hotspot/share/opto/compile.cpp line 4835:
> 4833: }
> 4834:
> 4835: void Compile::print_method_impl(CompilerPhaseType cpt, NOT_PRODUCT(const char *name COMMA) int level) {
Suggestion:
void Compile::print_method_impl(CompilerPhaseType cpt, NOT_PRODUCT(const char* name COMMA) int level) {
src/hotspot/share/opto/compile.hpp line 660:
> 658: void print_method(CompilerPhaseType cpt, int level);
> 659: void print_method(CompilerPhaseType cpt, Node* n, int level);
> 660: void print_method_impl(CompilerPhaseType cpt, NOT_PRODUCT(const char *name COMMA) int level);
Suggestion:
void print_method_impl(CompilerPhaseType cpt, NOT_PRODUCT(const char* name COMMA) int level);
-------------
PR: https://git.openjdk.java.net/jdk/pull/7158
More information about the hotspot-compiler-dev
mailing list