< prev index next >
test/compiler/loopopts/UseCountedLoopSafepoints.java
Print this page
@@ -23,36 +23,39 @@
*/
/**
* @test
* @bug 6869327
+ * @key stress
* @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop
* @library /test/lib
* @modules java.base/jdk.internal.misc
- * @ignore 8146096
* @run driver compiler.loopopts.UseCountedLoopSafepoints
*/
package compiler.loopopts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import java.util.concurrent.atomic.AtomicLong;
+import jdk.test.lib.Utils;
public class UseCountedLoopSafepoints {
- private static final AtomicLong _num = new AtomicLong(0);
+ private static final AtomicLong NUM = new AtomicLong(0);
+ private static final long FINISH_TIME = System.currentTimeMillis()
+ + Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT)/2; // stop loop at half of test timeout
// Uses the fact that an EnableBiasedLocking vmop will be started
// after 500ms, while we are still in the loop. If there is a
// safepoint in the counted loop, then we will reach safepoint
// very quickly. Otherwise SafepointTimeout will be hit.
public static void main (String args[]) throws Exception {
if (args.length == 1) {
final int loops = Integer.parseInt(args[0]);
- for (int i = 0; i < loops; i++) {
- _num.addAndGet(1);
+ for (int i = 0; i < loops && System.currentTimeMillis() < FINISH_TIME; i++) {
+ NUM.addAndGet(1);
}
} else {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:-TieredCompilation",
< prev index next >