Skip to content

Commit

Permalink
8312597: Convert TraceTypeProfile to UL
Browse files Browse the repository at this point in the history
Reviewed-by: shade, phh
  • Loading branch information
Ben Taylor authored and Paul Hohensee committed Aug 14, 2023
1 parent 1f1c5c6 commit 0074b48
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/hotspot/share/opto/doCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "compiler/compileBroker.hpp"
#include "compiler/compileLog.hpp"
#include "interpreter/linkResolver.hpp"
#include "logging/log.hpp"
#include "logging/logLevel.hpp"
#include "logging/logMessage.hpp"
#include "logging/logStream.hpp"
#include "opto/addnode.hpp"
#include "opto/callGenerator.hpp"
#include "opto/castnode.hpp"
Expand All @@ -46,7 +50,15 @@
#include "jfr/jfr.hpp"
#endif

void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
void print_trace_type_profile(outputStream* out, int depth, ciKlass* prof_klass, int site_count, int receiver_count) {
CompileTask::print_inline_indent(depth, out);
out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
prof_klass->name()->print_symbol_on(out);
out->cr();
}

void trace_type_profile(Compile* C, ciMethod* method, int depth, int bci, ciMethod* prof_method,
ciKlass* prof_klass, int site_count, int receiver_count) {
if (TraceTypeProfile || C->print_inlining()) {
outputStream* out = tty;
if (!C->print_inlining()) {
Expand All @@ -58,12 +70,13 @@ void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMeth
} else {
out = C->print_inlining_stream();
}
CompileTask::print_inline_indent(depth, out);
out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
stringStream ss;
prof_klass->name()->print_symbol_on(&ss);
out->print("%s", ss.freeze());
out->cr();
print_trace_type_profile(out, depth, prof_klass, site_count, receiver_count);
}

LogTarget(Debug, jit, inlining) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
print_trace_type_profile(&ls, depth, prof_klass, site_count, receiver_count);
}
}

Expand Down
36 changes: 36 additions & 0 deletions test/hotspot/jtreg/compiler/arguments/TestLogJIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright Amazon.com Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Amazon designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* @test
* @summary Test running with log:jit*=debug enabled.
* @run main/othervm -Xlog:jit*=debug compiler.arguments.TestTraceTypeProfile
*/

package compiler.arguments;

public class TestLogJIT {

static public void main(String[] args) {
System.out.println("Passed");
}
}

37 changes: 37 additions & 0 deletions test/hotspot/jtreg/compiler/arguments/TestTraceTypeProfile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Amazon.com Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Amazon designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* @test
* @summary Test running TraceTypeProfile enabled.
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+TraceTypeProfile compiler.arguments.TestTraceTypeProfile
*/

package compiler.arguments;

public class TestTraceTypeProfile {

static public void main(String[] args) {
System.out.println("Passed");
}
}

1 comment on commit 0074b48

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.