Skip to content

Commit

Permalink
8301459: Serial: Merge KeepAliveClosure into FastKeepAliveClosure
Browse files Browse the repository at this point in the history
Reviewed-by: stefank, tschatzl
  • Loading branch information
albertnetymk committed Feb 1, 2023
1 parent d269ebb commit a0aed9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 52 deletions.
12 changes: 2 additions & 10 deletions src/hotspot/share/gc/serial/defNewGeneration.cpp
Expand Up @@ -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();
}

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::
FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl) :
DefNewGeneration::KeepAliveClosure(cl) {
_cl(cl) {
_rs = GenCollectedHeap::heap()->rem_set();
_boundary = g->reserved().end();
}

Expand Down
12 changes: 1 addition & 11 deletions src/hotspot/share/gc/serial/defNewGeneration.hpp
Expand Up @@ -167,19 +167,9 @@ class DefNewGeneration: public Generation {
bool do_object_b(oop p);
};

class KeepAliveClosure: public OopClosure {
protected:
class FastKeepAliveClosure: public OopClosure {
ScanWeakRefClosure* _cl;
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;
template <class T> void do_oop_work(T* p);
public:
Expand Down
31 changes: 0 additions & 31 deletions src/hotspot/share/gc/serial/defNewGeneration.inline.hpp
Expand Up @@ -36,37 +36,6 @@

// 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>
inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {
#ifdef ASSERT
Expand Down

1 comment on commit a0aed9b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.