8375905: Add a missing bailout check in PhaseCFG::schedule_late and a test to exercise more bailout code paths

Reviewed-by: dfenacci, chagedorn, rcastanedalo
This commit is contained in:
Daniel Skantz 2026-04-20 06:38:10 +00:00
parent da0a7b1eec
commit e4076b09df
2 changed files with 22 additions and 9 deletions

View File

@ -1743,6 +1743,9 @@ void PhaseCFG::schedule_late(VectorSet &visited, Node_Stack &stack) {
// are needed make sure that after placement in a block we don't
// need any new precedence edges.
verify_anti_dependences(late, self);
if (C->failing()) {
return;
}
}
#endif
} // Loop until all nodes have been visited

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -24,6 +24,7 @@
package compiler.debug;
import java.util.Random;
import java.util.stream.Stream;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
@ -36,24 +37,33 @@ import jdk.test.lib.Utils;
* @requires vm.debug == true & vm.compiler2.enabled & (vm.opt.AbortVMOnCompilationFailure == "null" | !vm.opt.AbortVMOnCompilationFailure)
* @summary Basic tests for bailout stress flag.
* @library /test/lib /
* @run driver compiler.debug.TestStressBailout
* @run main compiler.debug.TestStressBailout
*/
/*
* @test
* @key stress randomness
* @bug 8375905
* @requires vm.debug == true & vm.compiler2.enabled & (vm.opt.AbortVMOnCompilationFailure == "null" | !vm.opt.AbortVMOnCompilationFailure)
* @summary Additional crashes revealed by diagnostic code run during VerifyIterativeGVN
* @library /test/lib /
* @run main compiler.debug.TestStressBailout -XX:VerifyIterativeGVN=1111
*/
public class TestStressBailout {
static void runTest(int invprob) throws Exception {
String[] procArgs = {"-Xcomp", "-XX:-TieredCompilation", "-XX:+StressBailout",
"-XX:StressBailoutMean=" + invprob, "-version"};
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(procArgs);
static void runTest(int invprob, Stream<String> vmArgs) throws Exception {
Stream<String> procArgs = Stream.of("-Xcomp", "-XX:-TieredCompilation", "-XX:+StressBailout", "-XX:StressBailoutMean=" + invprob, "-version");
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(Stream.concat(vmArgs, procArgs).toArray(x -> new String[x]));
OutputAnalyzer out = new OutputAnalyzer(pb.start());
out.shouldHaveExitValue(0);
}
public static void main(String[] args) throws Exception {
public static void main(String[] vmArgs) throws Exception {
Random r = Utils.getRandomInstance();
// Likely bail out on -version, for some low Mean value.
runTest(r.nextInt(1, 10));
runTest(r.nextInt(1, 10), Stream.of(vmArgs));
// Higher value
runTest(r.nextInt(10, 1_000_000));
runTest(r.nextInt(10, 1_000_000), Stream.of(vmArgs));
}
}