This is a minor improvement of G1GCPhaseTimes::record_or_add_time_secs to reuse WorkerDataArray<T>::set_or_add rather than implement the logic in G1GCPhaseTimes itself.
diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
index 7c3eba2be94..cc4a90a36f1 100644
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
@@ -266,11 +266,7 @@ void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_id, double sec
}
void G1GCPhaseTimes::record_or_add_time_secs(GCParPhases phase, uint worker_id, double secs) {
- if (_gc_par_phases[phase]->get(worker_id) == _gc_par_phases[phase]->uninitialized()) {
- record_time_secs(phase, worker_id, secs);
- } else {
- add_time_secs(phase, worker_id, secs);
- }
+ _gc_par_phases[phase]->set_or_add(worker_id, secs);
}
diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
index 7c3eba2be94..cc4a90a36f1 100644
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
@@ -266,11 +266,7 @@ void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_id, double sec
}
void G1GCPhaseTimes::record_or_add_time_secs(GCParPhases phase, uint worker_id, double secs) {
- if (_gc_par_phases[phase]->get(worker_id) == _gc_par_phases[phase]->uninitialized()) {
- record_time_secs(phase, worker_id, secs);
- } else {
- add_time_secs(phase, worker_id, secs);
- }
+ _gc_par_phases[phase]->set_or_add(worker_id, secs);
}