Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 13 additions & 34 deletions src/hotspot/share/gc/serial/serialFullGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ ReferenceProcessor* SerialFullGC::_ref_processor;

StringDedup::Requests* SerialFullGC::_string_dedup_requests = nullptr;

SerialFullGC::FollowRootClosure SerialFullGC::follow_root_closure;

MarkAndPushClosure SerialFullGC::mark_and_push_closure(ClassLoaderData::_claim_stw_fullgc_mark);
CLDToOopClosure SerialFullGC::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_stw_fullgc_mark);
CLDToOopClosure SerialFullGC::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_stw_fullgc_adjust);
Expand Down Expand Up @@ -390,17 +388,6 @@ void SerialFullGC::follow_array(objArrayOop array) {
}
}

void SerialFullGC::follow_object(oop obj) {
assert(obj->is_gc_marked(), "should be marked");
if (obj->is_objArray()) {
// Handle object arrays explicitly to allow them to
// be split into chunks if needed.
SerialFullGC::follow_array((objArrayOop)obj);
} else {
obj->oop_iterate(&mark_and_push_closure);
}
}

void SerialFullGC::follow_array_chunk(objArrayOop array, int index) {
const int len = array->length();
const int beg_index = index;
Expand All @@ -421,7 +408,13 @@ void SerialFullGC::follow_stack() {
while (!_marking_stack.is_empty()) {
oop obj = _marking_stack.pop();
assert (obj->is_gc_marked(), "p must be marked");
follow_object(obj);
if (obj->is_objArray()) {
// Handle object arrays explicitly to allow them to
// be split into chunks if needed.
follow_array((objArrayOop)obj);
} else {
obj->oop_iterate(&mark_and_push_closure);
}
}
// Process ObjArrays one at a time to avoid marking stack bloat.
if (!_objarray_stack.is_empty()) {
Expand All @@ -435,23 +428,6 @@ SerialFullGC::FollowStackClosure SerialFullGC::follow_stack_closure;

void SerialFullGC::FollowStackClosure::do_void() { follow_stack(); }

template <class T> void SerialFullGC::follow_root(T* p) {
assert(!Universe::heap()->is_in(p),
"roots shouldn't be things within the heap");
T heap_oop = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(heap_oop)) {
oop obj = CompressedOops::decode_not_null(heap_oop);
if (!obj->mark().is_marked()) {
mark_object(obj);
follow_object(obj);
}
}
follow_stack();
}

void SerialFullGC::FollowRootClosure::do_oop(oop* p) { follow_root(p); }
void SerialFullGC::FollowRootClosure::do_oop(narrowOop* p) { follow_root(p); }

// We preserve the mark which should be replaced at the end and the location
// that it will go. Note that the object that this markWord belongs to isn't
// currently at that address but it will be after phase4
Expand Down Expand Up @@ -486,17 +462,20 @@ void SerialFullGC::phase1_mark(bool clear_all_softrefs) {
// enabled or not, applying the closure to both strong and weak or only
// strong CLDs.
ClassLoaderDataGraph::always_strong_cld_do(&follow_cld_closure);
follow_stack();

{
// 2. Threads stack frames and active nmethods in them.
NMethodMarkingScope nmethod_marking_scope;
MarkingNMethodClosure mark_code_closure(&follow_root_closure);
MarkingNMethodClosure mark_code_closure(&mark_and_push_closure);

Threads::oops_do(&follow_root_closure, &mark_code_closure);
Threads::oops_do(&mark_and_push_closure, &mark_code_closure);
follow_stack();
}

// 3. VM internal roots.
OopStorageSet::strong_oops_do(&follow_root_closure);
OopStorageSet::strong_oops_do(&mark_and_push_closure);
follow_stack();
}

// Process reference objects found during marking
Expand Down
11 changes: 0 additions & 11 deletions src/hotspot/share/gc/serial/serialFullGC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ class SerialFullGC : AllStatic {
//
// Inline closure decls
//
class FollowRootClosure: public BasicOopIterateClosure {
public:
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
};

class FollowStackClosure: public VoidClosure {
public:
virtual void do_void();
Expand Down Expand Up @@ -107,7 +101,6 @@ class SerialFullGC : AllStatic {

// Public closures
static IsAliveClosure is_alive;
static FollowRootClosure follow_root_closure;
static MarkAndPushClosure mark_and_push_closure;
static FollowStackClosure follow_stack_closure;
static CLDToOopClosure follow_cld_closure;
Expand Down Expand Up @@ -144,13 +137,9 @@ class SerialFullGC : AllStatic {

// Call backs for marking
static void mark_object(oop obj);
// Mark pointer and follow contents. Empty marking stack afterwards.
template <class T> static inline void follow_root(T* p);

static inline void push_objarray(oop obj, size_t index);

static void follow_object(oop obj);

static void follow_array(objArrayOop array);

static void follow_array_chunk(objArrayOop array, int index);
Expand Down