Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8301459: Serial: Merge KeepAliveClosure into FastKeepAliveClosure #12310

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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