Skip to content

Commit bfccf8d

Browse files
committed
Allow specifying a seed for CTW phase plan fuzzing
1 parent a8b0afe commit bfccf8d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotFuzzedSuitesProvider.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,17 @@
3232
import jdk.graal.compiler.options.OptionValues;
3333
import jdk.graal.compiler.phases.tiers.Suites;
3434
import jdk.graal.compiler.phases.tiers.SuitesProvider;
35-
35+
import jdk.graal.compiler.serviceprovider.GraalServices;
3636
import jdk.vm.ci.code.Architecture;
3737

3838
/**
3939
* {@link SuitesProvider} that provides different {@link FuzzedSuites} for each call to
4040
* {@link SuitesProvider#getDefaultSuites}.
4141
*/
4242
public class HotSpotFuzzedSuitesProvider extends HotSpotSuitesProvider {
43+
44+
public static final String SEED_SYSTEM_PROPERTY = "test.graal.compilationplan.fuzzing.seed";
45+
4346
private static ThreadLocal<Long> lastSeed = new ThreadLocal<>();
4447

4548
private final HotSpotSuitesProvider provider;
@@ -53,7 +56,13 @@ public HotSpotFuzzedSuitesProvider(HotSpotSuitesProvider provider) {
5356

5457
@Override
5558
public Suites getDefaultSuites(OptionValues options, Architecture arch) {
56-
long seed = random.nextLong();
59+
long seed;
60+
String seedString = GraalServices.getSavedProperty(SEED_SYSTEM_PROPERTY);
61+
if (seedString != null) {
62+
seed = Long.parseLong(seedString);
63+
} else {
64+
seed = random.nextLong();
65+
}
5766
lastSeed.set(seed);
5867
return createSuites(options, seed);
5968
}

0 commit comments

Comments
 (0)