mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
Reviewed-by: tschatzl, ehelin
This commit is contained in:
parent
802664728f
commit
2dbd4dd578
9 changed files with 127 additions and 61 deletions
|
@ -121,6 +121,8 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
|
|||
return _surviving_young_words + 1;
|
||||
}
|
||||
|
||||
void flush();
|
||||
|
||||
private:
|
||||
#define G1_PARTIAL_ARRAY_MASK 0x2
|
||||
|
||||
|
@ -189,4 +191,34 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
|
|||
oop handle_evacuation_failure_par(oop obj, markOop m);
|
||||
};
|
||||
|
||||
class G1ParScanThreadStateSet : public StackObj {
|
||||
G1CollectedHeap* _g1h;
|
||||
G1ParScanThreadState** _states;
|
||||
uint _n_workers;
|
||||
bool _flushed;
|
||||
|
||||
public:
|
||||
G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers) :
|
||||
_g1h(g1h),
|
||||
_states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)),
|
||||
_n_workers(n_workers),
|
||||
_flushed(false) {
|
||||
for (uint i = 0; i < n_workers; ++i) {
|
||||
_states[i] = new_par_scan_state(i);
|
||||
}
|
||||
}
|
||||
|
||||
~G1ParScanThreadStateSet() {
|
||||
assert(_flushed, "thread local state from the per thread states should have been flushed");
|
||||
FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states);
|
||||
}
|
||||
|
||||
void flush();
|
||||
|
||||
G1ParScanThreadState* state_for_worker(uint worker_id);
|
||||
|
||||
private:
|
||||
G1ParScanThreadState* new_par_scan_state(uint worker_id);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue