1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
32
32
import jdk .graal .compiler .options .OptionValues ;
33
33
import jdk .graal .compiler .phases .tiers .Suites ;
34
34
import jdk .graal .compiler .phases .tiers .SuitesProvider ;
35
-
35
+ import jdk . graal . compiler . serviceprovider . GraalServices ;
36
36
import jdk .vm .ci .code .Architecture ;
37
37
38
38
/**
39
39
* {@link SuitesProvider} that provides different {@link FuzzedSuites} for each call to
40
40
* {@link SuitesProvider#getDefaultSuites}.
41
41
*/
42
42
public class HotSpotFuzzedSuitesProvider extends HotSpotSuitesProvider {
43
+
44
+ public static final String SEED_SYSTEM_PROPERTY = "test.graal.compilationplan.fuzzing.seed" ;
45
+
43
46
private static ThreadLocal <Long > lastSeed = new ThreadLocal <>();
44
47
45
48
private final HotSpotSuitesProvider provider ;
@@ -53,7 +56,13 @@ public HotSpotFuzzedSuitesProvider(HotSpotSuitesProvider provider) {
53
56
54
57
@ Override
55
58
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
+ }
57
66
lastSeed .set (seed );
58
67
return createSuites (options , seed );
59
68
}
0 commit comments