Skip to content
Permalink
Browse files
8257676: Simplify WeakProcessorPhase
Reviewed-by: iwalulya, ayang, tschatzl
  • Loading branch information
Kim Barrett committed Dec 11, 2020
1 parent b90b7f5 commit fa20186cb688f5fcbc411cfa86fefcc81c3172e7
@@ -29,7 +29,6 @@
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/weakProcessor.inline.hpp"
#include "gc/shared/oopStorageSetParState.inline.hpp"
#include "gc/shared/weakProcessorPhases.hpp"
#include "gc/shared/weakProcessorPhaseTimes.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/iterator.hpp"
@@ -29,7 +29,7 @@
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageParState.inline.hpp"
#include "gc/shared/weakProcessor.hpp"
#include "gc/shared/weakProcessorPhases.hpp"
#include "gc/shared/weakProcessorPhase.hpp"
#include "gc/shared/weakProcessorPhaseTimes.hpp"
#include "gc/shared/workgroup.hpp"
#include "prims/resolvedMethodTable.hpp"
@@ -81,13 +81,12 @@ void WeakProcessor::Task::work(uint worker_id,
"worker_id (%u) exceeds task's configured workers (%u)",
worker_id, _nworkers);

typedef WeakProcessorPhases::Iterator Iterator;

for (Iterator it = WeakProcessorPhases::oopstorage_iterator(); !it.is_end(); ++it) {
WeakProcessorPhase phase = *it;
constexpr EnumRange<WeakProcessorPhase> phase_range{};
for (WeakProcessorPhase phase : phase_range) {
CountingClosure<IsAlive, KeepAlive> cl(is_alive, keep_alive);
WeakProcessorPhaseTimeTracker pt(_phase_times, phase, worker_id);
StorageState* cur_state = _storage_states.par_state(phase);
int state_index = checked_cast<int>(phase_range.index(phase));
StorageState* cur_state = _storage_states.par_state(state_index);
cur_state->oops_do(&cl);
cur_state->increment_num_dead(cl.dead());
if (_phase_times != NULL) {
@@ -22,25 +22,14 @@
*
*/

#include "precompiled.hpp"
#include "gc/shared/weakProcessorPhases.hpp"
#include "utilities/debug.hpp"
#include "utilities/macros.hpp"
#ifndef SHARE_GC_SHARED_WEAKPROCESSORPHASE_HPP
#define SHARE_GC_SHARED_WEAKPROCESSORPHASE_HPP

#ifdef ASSERT
#include "gc/shared/oopStorageSet.hpp"
#include "utilities/enumIterator.hpp"

void WeakProcessorPhases::Iterator::verify_nonsingular() const {
assert(_limit != singular_value, "precondition");
}
enum class WeakProcessorPhase : uint {};

void WeakProcessorPhases::Iterator::verify_category_match(const Iterator& other) const {
verify_nonsingular();
assert(_limit == other._limit, "precondition");
}
ENUMERATOR_VALUE_RANGE(WeakProcessorPhase, 0, OopStorageSet::weak_count);

void WeakProcessorPhases::Iterator::verify_dereferenceable() const {
verify_nonsingular();
assert(_index < _limit, "precondition");
}

#endif // ASSERT
#endif // SHARE_GC_SHARED_WEAKPROCESSORPHASE_HPP
@@ -24,7 +24,7 @@

#include "precompiled.hpp"
#include "gc/shared/oopStorage.hpp"
#include "gc/shared/weakProcessorPhases.hpp"
#include "gc/shared/weakProcessorPhase.hpp"
#include "gc/shared/weakProcessorPhaseTimes.hpp"
#include "gc/shared/workerDataArray.inline.hpp"
#include "logging/log.hpp"
@@ -100,7 +100,9 @@ void WeakProcessorPhaseTimes::record_total_time_sec(double time_sec) {
}

WorkerDataArray<double>* WeakProcessorPhaseTimes::worker_data(WeakProcessorPhase phase) const {
return _worker_data[phase];
size_t index = EnumRange<WeakProcessorPhase>().index(phase);
assert(index < ARRAY_SIZE(_worker_data), "invalid phase");
return _worker_data[index];
}

double WeakProcessorPhaseTimes::worker_time_sec(uint worker_id, WeakProcessorPhase phase) const {
@@ -203,9 +205,8 @@ void WeakProcessorPhaseTimes::log_phase_details(WorkerDataArray<T>* data,

void WeakProcessorPhaseTimes::log_print_phases(uint indent) const {
if (log_is_enabled(Debug, gc, phases)) {
typedef WeakProcessorPhases::Iterator Iterator;
for (Iterator it = WeakProcessorPhases::oopstorage_iterator(); !it.is_end(); ++it) {
log_phase_summary(*it, indent);
for (WeakProcessorPhase phase : EnumRange<WeakProcessorPhase>()) {
log_phase_summary(phase, indent);
}
}
}
@@ -25,7 +25,7 @@
#ifndef SHARE_GC_SHARED_WEAKPROCESSORPHASETIMES_HPP
#define SHARE_GC_SHARED_WEAKPROCESSORPHASETIMES_HPP

#include "gc/shared/weakProcessorPhases.hpp"
#include "gc/shared/weakProcessorPhase.hpp"
#include "memory/allocation.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/ticks.hpp"
@@ -44,9 +44,7 @@ class WeakProcessorPhaseTimes {
double _total_time_sec;

// Per-worker times and linked items.
static const uint worker_data_count = WeakProcessorPhases::oopstorage_phase_count;
WorkerDataArray<double>* _worker_data[worker_data_count];

WorkerDataArray<double>* _worker_data[EnumRange<WeakProcessorPhase>().size()];
WorkerDataArray<double>* worker_data(WeakProcessorPhase phase) const;

void log_phase_summary(WeakProcessorPhase phase, uint indent) const;

This file was deleted.

@@ -40,7 +40,6 @@
//
// case 2:
// enum has sequential values, with U start and U end (exclusive).
// WeakProcessorPhases is an example because of oopstorage.
// This can be mapped onto case 1 by casting start/(end-1).
//
// case 3:

1 comment on commit fa20186

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on fa20186 Dec 11, 2020

Please sign in to comment.