8325542: CTW: Runner can produce negative StressSeed

Reviewed-by: shade, xliu
This commit is contained in:
Joshua Cao 2024-02-20 08:54:48 +00:00 committed by Aleksey Shipilev
parent 5bf859c8e9
commit bb675afae6

View File

@ -38,6 +38,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.Random;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -266,7 +267,7 @@ public class CtwRunner {
private String[] cmd(long classStart, long classStop) {
String phase = phaseName(classStart);
Path file = Paths.get(phase + ".cmd");
var rng = Utils.getRandomInstance();
Random rng = Utils.getRandomInstance();
ArrayList<String> Args = new ArrayList<String>(Arrays.asList(
"-Xbatch",
@ -301,7 +302,7 @@ public class CtwRunner {
"-XX:+StressMacroExpansion",
"-XX:+StressIncrementalInlining",
// StressSeed is uint
"-XX:StressSeed=" + Math.abs(rng.nextInt())));
"-XX:StressSeed=" + rng.nextInt(Integer.MAX_VALUE)));
for (String arg : CTW_EXTRA_ARGS.split(",")) {
Args.add(arg);