8312596: Null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976

Reviewed-by: chagedorn, dlong, shade
This commit is contained in:
Ashutosh Mehra 2023-08-01 19:26:45 +00:00 committed by Aleksey Shipilev
parent ec2f38fd38
commit 7ba8c69a2c
2 changed files with 43 additions and 3 deletions

View File

@ -4332,10 +4332,13 @@ void Compile::record_failure(const char* reason) {
Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator)
: TraceTime(name, accumulator, CITime, CITimeVerbose),
_compile(nullptr), _log(nullptr), _phase_name(name), _dolog(CITimeVerbose)
_compile(Compile::current()),
_log(nullptr),
_phase_name(name),
_dolog(CITimeVerbose)
{
assert(_compile != nullptr, "sanity check");
if (_dolog) {
_compile = Compile::current();
_log = _compile->log();
}
if (_log != nullptr) {
@ -4353,7 +4356,7 @@ Compile::TracePhase::~TracePhase() {
}
if (VerifyIdealNodeCount) {
Compile::current()->print_missing_nodes();
_compile->print_missing_nodes();
}
#endif

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2023, Oracle and/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.
*
* 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.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8312596
* @requires vm.debug == true & vm.compiler2.enabled
* @summary Run with -Xcomp -XX:-TieredCompilation to force C2 compilations to test -XX:+PrintIdealNodeCount in debug builds.
*
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+PrintIdealNodeCount compiler.c2.TestPrintIdealNodeCount
*/
package compiler.c2;
public class TestPrintIdealNodeCount {
public static void main(String[] args) {
}
}