Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8139800: Remove OopsInGenClosure
Reviewed-by: kbarrett, sjohanss
  • Loading branch information
stefank committed Aug 31, 2020
1 parent e038528 commit 9ac307330705a3bbe4a6078f59b75a382d98b577
@@ -92,8 +92,8 @@ void DefNewGeneration::FastKeepAliveClosure::do_oop(narrowOop* p) { DefNewGenera

DefNewGeneration::FastEvacuateFollowersClosure::
FastEvacuateFollowersClosure(SerialHeap* heap,
FastScanClosure* cur,
FastScanClosure* older) :
DefNewScanClosure* cur,
DefNewYoungerGenClosure* older) :
_heap(heap), _scan_cur_or_nonheap(cur), _scan_older(older)
{
}
@@ -105,12 +105,6 @@ void DefNewGeneration::FastEvacuateFollowersClosure::do_void() {
guarantee(_heap->young_gen()->promo_failure_scan_is_complete(), "Failed to finish scan");
}

FastScanClosure::FastScanClosure(DefNewGeneration* g, bool gc_barrier) :
OopsInClassLoaderDataOrGenClosure(g), _g(g), _gc_barrier(gc_barrier)
{
_boundary = _g->reserved().end();
}

void CLDScanClosure::do_cld(ClassLoaderData* cld) {
NOT_PRODUCT(ResourceMark rm);
log_develop_trace(gc, scavenge)("CLDScanClosure::do_cld " PTR_FORMAT ", %s, dirty: %s",
@@ -570,16 +564,16 @@ void DefNewGeneration::collect(bool full,
assert(heap->no_allocs_since_save_marks(),
"save marks have not been newly set.");

FastScanClosure fsc_with_no_gc_barrier(this, false);
FastScanClosure fsc_with_gc_barrier(this, true);
DefNewScanClosure scan_closure(this);
DefNewYoungerGenClosure younger_gen_closure(this, _old_gen);

CLDScanClosure cld_scan_closure(&fsc_with_no_gc_barrier,
CLDScanClosure cld_scan_closure(&scan_closure,
heap->rem_set()->cld_rem_set()->accumulate_modified_oops());

set_promo_failure_scan_stack_closure(&fsc_with_no_gc_barrier);
set_promo_failure_scan_stack_closure(&scan_closure);
FastEvacuateFollowersClosure evacuate_followers(heap,
&fsc_with_no_gc_barrier,
&fsc_with_gc_barrier);
&scan_closure,
&younger_gen_closure);

assert(heap->no_allocs_since_save_marks(),
"save marks have not been newly set.");
@@ -591,8 +585,8 @@ void DefNewGeneration::collect(bool full,
StrongRootsScope srs(0);

heap->young_process_roots(&srs,
&fsc_with_no_gc_barrier,
&fsc_with_gc_barrier,
&scan_closure,
&younger_gen_closure,
&cld_scan_closure);
}

@@ -35,10 +35,12 @@
#include "utilities/stack.hpp"

class ContiguousSpace;
class STWGCTimer;
class CSpaceCounters;
class DefNewYoungerGenClosure;
class DefNewScanClosure;
class ScanWeakRefClosure;
class SerialHeap;
class STWGCTimer;

// DefNewGeneration is a young generation containing eden, from- and
// to-space.
@@ -180,12 +182,12 @@ class DefNewGeneration: public Generation {

class FastEvacuateFollowersClosure: public VoidClosure {
SerialHeap* _heap;
FastScanClosure* _scan_cur_or_nonheap;
FastScanClosure* _scan_older;
DefNewScanClosure* _scan_cur_or_nonheap;
DefNewYoungerGenClosure* _scan_older;
public:
FastEvacuateFollowersClosure(SerialHeap* heap,
FastScanClosure* cur,
FastScanClosure* older);
DefNewScanClosure* cur,
DefNewYoungerGenClosure* older);
void do_void();
};

@@ -90,11 +90,10 @@ inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {

template <typename OopClosureType>
void DefNewGeneration::oop_since_save_marks_iterate(OopClosureType* cl) {
cl->set_generation(this);
eden()->oop_since_save_marks_iterate(cl);
to()->oop_since_save_marks_iterate(cl);
from()->oop_since_save_marks_iterate(cl);
cl->reset_generation();

save_marks();
}

@@ -90,22 +90,20 @@ GrowableArray<MemoryPool*> SerialHeap::memory_pools() {
}

void SerialHeap::young_process_roots(StrongRootsScope* scope,
OopsInGenClosure* root_closure,
OopsInGenClosure* old_gen_closure,
OopIterateClosure* root_closure,
OopIterateClosure* old_gen_closure,
CLDClosure* cld_closure) {
MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);

process_roots(scope, SO_ScavengeCodeCache, root_closure,
cld_closure, cld_closure, &mark_code_closure);

if (_process_strong_tasks->try_claim_task(GCH_PS_younger_gens)) {
root_closure->reset_generation();

}

old_gen_closure->set_generation(_old_gen);
rem_set()->at_younger_refs_iterate();
old_gen()->younger_refs_iterate(old_gen_closure, scope->n_threads());
old_gen_closure->reset_generation();

_process_strong_tasks->all_tasks_completed(scope->n_threads());
}
@@ -32,7 +32,7 @@

class GCMemoryManager;
class MemoryPool;
class OopsInGenClosure;
class OopIterateClosure;
class TenuredGeneration;

class SerialHeap : public GenCollectedHeap {
@@ -78,8 +78,8 @@ class SerialHeap : public GenCollectedHeap {
OopClosureType2* older);

void young_process_roots(StrongRootsScope* scope,
OopsInGenClosure* root_closure,
OopsInGenClosure* old_gen_closure,
OopIterateClosure* root_closure,
OopIterateClosure* old_gen_closure,
CLDClosure* cld_closure);
};

@@ -55,9 +55,8 @@ bool TenuredGeneration::block_is_obj(const HeapWord* addr) const {

template <typename OopClosureType>
void TenuredGeneration::oop_since_save_marks_iterate(OopClosureType* blk) {
blk->set_generation(this);
_the_space->oop_since_save_marks_iterate(blk);
blk->reset_generation();

save_marks();
}

@@ -34,91 +34,76 @@ class CardTableBarrierSet;
class DefNewGeneration;
class KlassRemSet;

// Closure for iterating roots from a particular generation
// Note: all classes deriving from this MUST call this do_barrier
// method at the end of their own do_oop method!
// Note: no do_oop defined, this is an abstract class.

class OopsInGenClosure : public OopIterateClosure {
private:
Generation* _orig_gen; // generation originally set in ctor
Generation* _gen; // generation being scanned

protected:
// Some subtypes need access.
HeapWord* _gen_boundary; // start of generation
CardTableRS* _rs; // remembered set

// For assertions
Generation* generation() { return _gen; }
CardTableRS* rs() { return _rs; }
#if INCLUDE_SERIALGC

// Derived classes that modify oops so that they might be old-to-young
// pointers must call the method below.
template <class T> void do_barrier(T* p);
// Super closure class for scanning DefNewGeneration.
//
// - Derived: The derived type provides necessary barrier
// after an oop has been updated.
template <typename Derived>
class FastScanClosure : public BasicOopIterateClosure {
private:
DefNewGeneration* _young_gen;
HeapWord* _young_gen_end;

public:
OopsInGenClosure(Generation* gen);
void set_generation(Generation* gen);
template <typename T>
void do_oop_work(T* p);

void reset_generation() { _gen = _orig_gen; }
protected:
FastScanClosure(DefNewGeneration* g);

HeapWord* gen_boundary() { return _gen_boundary; }
public:
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
};

class BasicOopsInGenClosure: public OopsInGenClosure {
public:
BasicOopsInGenClosure(Generation* gen);

virtual bool do_metadata() { return false; }
virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
// Closure for scanning DefNewGeneration when iterating over the old generation.
//
// This closure performs barrier store calls on pointers into the DefNewGeneration.
class DefNewYoungerGenClosure : public FastScanClosure<DefNewYoungerGenClosure> {
private:
Generation* _old_gen;
HeapWord* _old_gen_start;
CardTableRS* _rs;

public:
DefNewYoungerGenClosure(DefNewGeneration* young_gen, Generation* old_gen);

template <typename T>
void barrier(T* p);
};

// Super class for scan closures. It contains code to dirty scanned class loader data.
class OopsInClassLoaderDataOrGenClosure: public BasicOopsInGenClosure {
// Closure for scanning DefNewGeneration when *not* iterating over the old generation.
//
// This closures records changes to oops in CLDs.
class DefNewScanClosure : public FastScanClosure<DefNewScanClosure> {
ClassLoaderData* _scanned_cld;
public:
OopsInClassLoaderDataOrGenClosure(Generation* g) : BasicOopsInGenClosure(g), _scanned_cld(NULL) {}

public:
DefNewScanClosure(DefNewGeneration* g);

void set_scanned_cld(ClassLoaderData* cld) {
assert(cld == NULL || _scanned_cld == NULL, "Must be");
_scanned_cld = cld;
}
bool is_scanning_a_cld() { return _scanned_cld != NULL; }
void do_cld_barrier();
};

#if INCLUDE_SERIALGC

// Closure for scanning DefNewGeneration.
//
// This closure only performs barrier store calls on
// pointers into the DefNewGeneration.
class FastScanClosure: public OopsInClassLoaderDataOrGenClosure {
protected:
DefNewGeneration* _g;
HeapWord* _boundary;
bool _gc_barrier;
template <class T> inline void do_oop_work(T* p);
public:
FastScanClosure(DefNewGeneration* g, bool gc_barrier);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
template <typename T>
void barrier(T* p);
};

#endif // INCLUDE_SERIALGC

class CLDScanClosure: public CLDClosure {
OopsInClassLoaderDataOrGenClosure* _scavenge_closure;
DefNewScanClosure* _scavenge_closure;
// true if the the modified oops state should be saved.
bool _accumulate_modified_oops;
bool _accumulate_modified_oops;
public:
CLDScanClosure(OopsInClassLoaderDataOrGenClosure* scavenge_closure,
CLDScanClosure(DefNewScanClosure* scavenge_closure,
bool accumulate_modified_oops) :
_scavenge_closure(scavenge_closure), _accumulate_modified_oops(accumulate_modified_oops) {}
void do_cld(ClassLoaderData* cld);
};

#endif // INCLUDE_SERIALGC

class FilteringClosure: public OopIterateClosure {
private:
HeapWord* _boundary;

0 comments on commit 9ac3073

Please sign in to comment.