8253765: C2: Control randomization in StressLCM and StressGCM

Use the compilation-local seed in 'StressLCM' and 'StressGCM' rather than the
global one. As a consequence, these options use by default a fresh seed in every
compilation, unless 'StressSeed=N' is specified, in which case they behave
deterministically. Annotate tests that use 'StressLCM' and 'StressGCM' with the
'stress' and 'randomness' keys to reflect this change in default behavior.

Reviewed-by: kvn, thartmann
This commit is contained in:
Roberto Castañeda Lozano 2020-10-12 11:40:50 +00:00 committed by Tobias Hartmann
parent 6620b617a7
commit 05459df0c7
18 changed files with 105 additions and 15 deletions

View file

@ -729,9 +729,9 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
if (failing()) return;
NOT_PRODUCT( verify_graph_edges(); )
// If IGVN is randomized for stress testing, seed random number
// generation and log the seed for repeatability.
if (StressIGVN) {
// If LCM, GCM, or IGVN are randomized for stress testing, seed
// random number generation and log the seed for repeatability.
if (StressLCM || StressGCM || StressIGVN) {
_stress_seed = FLAG_IS_DEFAULT(StressSeed) ?
static_cast<uint>(Ticks::now().nanoseconds()) : StressSeed;
if (_log != NULL) {
@ -4489,7 +4489,7 @@ int Compile::random() {
#define RANDOMIZED_DOMAIN_MASK ((1 << (RANDOMIZED_DOMAIN_POW + 1)) - 1)
bool Compile::randomized_select(int count) {
assert(count > 0, "only positive");
return (os::random() & RANDOMIZED_DOMAIN_MASK) < (RANDOMIZED_DOMAIN / count);
return (random() & RANDOMIZED_DOMAIN_MASK) < (RANDOMIZED_DOMAIN / count);
}
CloneMap& Compile::clone_map() { return _clone_map; }