Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/hotspot/share/opto/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,18 +772,8 @@ 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) {
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
Expand Down Expand Up @@ -917,6 +907,10 @@ Compile::Compile( ciEnv* ci_env,
Init(/*AliasLevel=*/ 0);
init_tf((*generator)());

if (StressLCM || StressGCM) {
initialize_stress_seed(directive);
}

{
// The following is a dummy for the sake of GraphKit::gen_stub
Unique_Node_List for_igvn(comp_arena());
Expand Down Expand Up @@ -4660,6 +4654,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);
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/opto/compile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,9 @@ class Compile : public Phase {
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);
Expand Down
Loading