mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8213229: Investigate treating StringTable as weak in young collections
Reviewed-by: zgu, kbarrett
This commit is contained in:
parent
51e2252a73
commit
d800361151
42 changed files with 319 additions and 555 deletions
|
@ -25,6 +25,7 @@
|
|||
#ifndef SHARE_GC_SHARED_WEAKPROCESSOR_INLINE_HPP
|
||||
#define SHARE_GC_SHARED_WEAKPROCESSOR_INLINE_HPP
|
||||
|
||||
#include "classfile/stringTable.hpp"
|
||||
#include "gc/shared/oopStorage.inline.hpp"
|
||||
#include "gc/shared/oopStorageParState.inline.hpp"
|
||||
#include "gc/shared/weakProcessor.hpp"
|
||||
|
@ -36,6 +37,27 @@
|
|||
class BoolObjectClosure;
|
||||
class OopClosure;
|
||||
|
||||
template<typename T>
|
||||
class CountingIsAliveClosure : public BoolObjectClosure {
|
||||
T* _inner;
|
||||
|
||||
size_t _num_dead;
|
||||
size_t _num_total;
|
||||
|
||||
public:
|
||||
CountingIsAliveClosure(T* cl) : _inner(cl), _num_dead(0), _num_total(0) { }
|
||||
|
||||
virtual bool do_object_b(oop obj) {
|
||||
bool result = _inner->do_object_b(obj);
|
||||
_num_dead += !result;
|
||||
_num_total++;
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t num_dead() const { return _num_dead; }
|
||||
size_t num_total() const { return _num_total; }
|
||||
};
|
||||
|
||||
template<typename IsAlive, typename KeepAlive>
|
||||
void WeakProcessor::Task::work(uint worker_id,
|
||||
IsAlive* is_alive,
|
||||
|
@ -45,16 +67,26 @@ void WeakProcessor::Task::work(uint worker_id,
|
|||
worker_id, _nworkers);
|
||||
|
||||
FOR_EACH_WEAK_PROCESSOR_PHASE(phase) {
|
||||
CountingIsAliveClosure<IsAlive> cl(is_alive);
|
||||
if (WeakProcessorPhases::is_serial(phase)) {
|
||||
uint serial_index = WeakProcessorPhases::serial_index(phase);
|
||||
if (_serial_phases_done.try_claim_task(serial_index)) {
|
||||
WeakProcessorPhaseTimeTracker pt(_phase_times, phase);
|
||||
WeakProcessorPhases::processor(phase)(is_alive, keep_alive);
|
||||
WeakProcessorPhases::processor(phase)(&cl, keep_alive);
|
||||
if (_phase_times != NULL) {
|
||||
_phase_times->record_phase_items(phase, cl.num_dead(), cl.num_total());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
WeakProcessorPhaseTimeTracker pt(_phase_times, phase, worker_id);
|
||||
uint storage_index = WeakProcessorPhases::oop_storage_index(phase);
|
||||
_storage_states[storage_index].weak_oops_do(is_alive, keep_alive);
|
||||
_storage_states[storage_index].weak_oops_do(&cl, keep_alive);
|
||||
if (_phase_times != NULL) {
|
||||
_phase_times->record_worker_items(worker_id, phase, cl.num_dead(), cl.num_total());
|
||||
}
|
||||
}
|
||||
if (WeakProcessorPhases::is_stringtable(phase)) {
|
||||
StringTable::inc_dead_counter(cl.num_dead());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue