8301459: Serial: Merge KeepAliveClosure into FastKeepAliveClosure
Reviewed-by: stefank, tschatzl
This commit is contained in:
parent
d269ebbad2
commit
a0aed9bd89
@ -76,18 +76,10 @@ bool DefNewGeneration::IsAliveClosure::do_object_b(oop p) {
|
|||||||
return cast_from_oop<HeapWord*>(p) >= _young_gen->reserved().end() || p->is_forwarded();
|
return cast_from_oop<HeapWord*>(p) >= _young_gen->reserved().end() || p->is_forwarded();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefNewGeneration::KeepAliveClosure::
|
|
||||||
KeepAliveClosure(ScanWeakRefClosure* cl) : _cl(cl) {
|
|
||||||
_rs = GenCollectedHeap::heap()->rem_set();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DefNewGeneration::KeepAliveClosure::do_oop(oop* p) { DefNewGeneration::KeepAliveClosure::do_oop_work(p); }
|
|
||||||
void DefNewGeneration::KeepAliveClosure::do_oop(narrowOop* p) { DefNewGeneration::KeepAliveClosure::do_oop_work(p); }
|
|
||||||
|
|
||||||
|
|
||||||
DefNewGeneration::FastKeepAliveClosure::
|
DefNewGeneration::FastKeepAliveClosure::
|
||||||
FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl) :
|
FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl) :
|
||||||
DefNewGeneration::KeepAliveClosure(cl) {
|
_cl(cl) {
|
||||||
|
_rs = GenCollectedHeap::heap()->rem_set();
|
||||||
_boundary = g->reserved().end();
|
_boundary = g->reserved().end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,19 +167,9 @@ protected:
|
|||||||
bool do_object_b(oop p);
|
bool do_object_b(oop p);
|
||||||
};
|
};
|
||||||
|
|
||||||
class KeepAliveClosure: public OopClosure {
|
class FastKeepAliveClosure: public OopClosure {
|
||||||
protected:
|
|
||||||
ScanWeakRefClosure* _cl;
|
ScanWeakRefClosure* _cl;
|
||||||
CardTableRS* _rs;
|
CardTableRS* _rs;
|
||||||
template <class T> void do_oop_work(T* p);
|
|
||||||
public:
|
|
||||||
KeepAliveClosure(ScanWeakRefClosure* cl);
|
|
||||||
virtual void do_oop(oop* p);
|
|
||||||
virtual void do_oop(narrowOop* p);
|
|
||||||
};
|
|
||||||
|
|
||||||
class FastKeepAliveClosure: public KeepAliveClosure {
|
|
||||||
protected:
|
|
||||||
HeapWord* _boundary;
|
HeapWord* _boundary;
|
||||||
template <class T> void do_oop_work(T* p);
|
template <class T> void do_oop_work(T* p);
|
||||||
public:
|
public:
|
||||||
|
@ -36,37 +36,6 @@
|
|||||||
|
|
||||||
// Methods of protected closure types
|
// Methods of protected closure types
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) {
|
|
||||||
#ifdef ASSERT
|
|
||||||
{
|
|
||||||
// We never expect to see a null reference being processed
|
|
||||||
// as a weak reference.
|
|
||||||
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
|
|
||||||
assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs");
|
|
||||||
}
|
|
||||||
#endif // ASSERT
|
|
||||||
|
|
||||||
Devirtualizer::do_oop(_cl, p);
|
|
||||||
|
|
||||||
// Card marking is trickier for weak refs.
|
|
||||||
// This oop is a 'next' field which was filled in while we
|
|
||||||
// were discovering weak references. While we might not need
|
|
||||||
// to take a special action to keep this reference alive, we
|
|
||||||
// will need to dirty a card as the field was modified.
|
|
||||||
//
|
|
||||||
// Alternatively, we could create a method which iterates through
|
|
||||||
// each generation, allowing them in turn to examine the modified
|
|
||||||
// field.
|
|
||||||
//
|
|
||||||
// We could check that p is also in the old generation, but
|
|
||||||
// dirty cards in the young gen are never scanned, so the
|
|
||||||
// extra check probably isn't worthwhile.
|
|
||||||
if (GenCollectedHeap::heap()->is_in_reserved(p)) {
|
|
||||||
_rs->inline_write_ref_field_gc(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {
|
inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user