8330016: Stress seed should be initialized for runtime stub compilation

Reviewed-by: rcastanedalo, chagedorn
This commit is contained in:
Daniel Skantz 2024-05-07 15:50:15 +00:00 committed by Christian Hagedorn
parent 5746137e8a
commit 95d2f8072e
2 changed files with 21 additions and 11 deletions
src/hotspot/share/opto

@ -844,19 +844,9 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
if (failing()) return;
NOT_PRODUCT( verify_graph_edges(); )
// If any phase is randomized for stress testing, seed random number
// generation and log the seed for repeatability.
if (StressLCM || StressGCM || StressIGVN || StressCCP ||
StressIncrementalInlining || StressMacroExpansion) {
if (FLAG_IS_DEFAULT(StressSeed) || (FLAG_IS_ERGO(StressSeed) && directive->RepeatCompilationOption)) {
_stress_seed = static_cast<uint>(Ticks::now().nanoseconds());
FLAG_SET_ERGO(StressSeed, _stress_seed);
} else {
_stress_seed = StressSeed;
}
if (_log != nullptr) {
_log->elem("stress_test seed='%u'", _stress_seed);
}
initialize_stress_seed(directive);
}
// Now optimize
@ -983,6 +973,11 @@ Compile::Compile( ciEnv* ci_env,
_igvn_worklist = new (comp_arena()) Unique_Node_List(comp_arena());
_types = new (comp_arena()) Type_Array(comp_arena());
_node_hash = new (comp_arena()) NodeHash(comp_arena(), 255);
if (StressLCM || StressGCM) {
initialize_stress_seed(directive);
}
{
PhaseGVN gvn;
set_initial_gvn(&gvn); // not significant, but GraphKit guys use it pervasively
@ -5068,6 +5063,18 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
// Auxiliary methods to support randomized stressing/fuzzing.
void Compile::initialize_stress_seed(const DirectiveSet* directive) {
if (FLAG_IS_DEFAULT(StressSeed) || (FLAG_IS_ERGO(StressSeed) && directive->RepeatCompilationOption)) {
_stress_seed = static_cast<uint>(Ticks::now().nanoseconds());
FLAG_SET_ERGO(StressSeed, _stress_seed);
} else {
_stress_seed = StressSeed;
}
if (_log != nullptr) {
_log->elem("stress_test seed='%u'", _stress_seed);
}
}
int Compile::random() {
_stress_seed = os::next_random(_stress_seed);
return static_cast<int>(_stress_seed);

@ -1278,6 +1278,9 @@ private:
int random();
bool randomized_select(int count);
// seed random number generation and log the seed for repeatability.
void initialize_stress_seed(const DirectiveSet* directive);
// supporting clone_map
CloneMap& clone_map();
void set_clone_map(Dict* d);