8298281: Serial: Refactor MarkAndPushClosure

Reviewed-by: stefank, sjohanss
This commit is contained in:
Albert Mingkun Yang 2022-12-09 13:26:12 +00:00
parent e3c6cf8eaf
commit 05b0a018c7
3 changed files with 7 additions and 25 deletions

View File

@ -61,7 +61,7 @@ StringDedup::Requests* MarkSweep::_string_dedup_requests = NULL;
MarkSweep::FollowRootClosure MarkSweep::follow_root_closure;
MarkAndPushClosure MarkSweep::mark_and_push_closure;
MarkAndPushClosure MarkSweep::mark_and_push_closure(ClassLoaderData::_claim_stw_fullgc_mark);
CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_stw_fullgc_mark);
CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_stw_fullgc_adjust);

View File

@ -38,8 +38,6 @@
class ReferenceProcessor;
class DataLayout;
class Method;
class nmethod;
class SerialOldTracer;
class STWGCTimer;
@ -152,8 +150,6 @@ class MarkSweep : AllStatic {
static void follow_klass(Klass* klass);
static void follow_cld(ClassLoaderData* cld);
template <class T> static inline void adjust_pointer(T* p);
// Check mark and maybe push on marking stack
@ -174,17 +170,13 @@ class MarkSweep : AllStatic {
static void follow_array_chunk(objArrayOop array, int index);
};
class MarkAndPushClosure: public OopIterateClosure {
class MarkAndPushClosure: public ClaimMetadataVisitingOopIterateClosure {
public:
template <typename T> void do_oop_work(T* p);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
MarkAndPushClosure(int claim) : ClaimMetadataVisitingOopIterateClosure(claim) {}
virtual bool do_metadata() { return true; }
virtual void do_klass(Klass* k);
virtual void do_cld(ClassLoaderData* cld);
virtual void do_method(Method* m);
virtual void do_nmethod(nmethod* nm);
template <typename T> void do_oop_work(T* p);
virtual void do_oop( oop* p);
virtual void do_oop(narrowOop* p);
void set_ref_discoverer(ReferenceDiscoverer* rd) {
set_ref_discoverer_internal(rd);

View File

@ -29,14 +29,12 @@
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "code/nmethod.hpp"
#include "gc/shared/continuationGCSupport.inline.hpp"
#include "gc/serial/serialStringDedup.hpp"
#include "memory/universe.hpp"
#include "oops/markWord.hpp"
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/method.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/align.hpp"
#include "utilities/stack.inline.hpp"
@ -76,18 +74,10 @@ inline void MarkSweep::follow_klass(Klass* klass) {
MarkSweep::mark_and_push(&op);
}
inline void MarkSweep::follow_cld(ClassLoaderData* cld) {
MarkSweep::follow_cld_closure.do_cld(cld);
}
template <typename T>
inline void MarkAndPushClosure::do_oop_work(T* p) { MarkSweep::mark_and_push(p); }
inline void MarkAndPushClosure::do_oop(oop* p) { do_oop_work(p); }
inline void MarkAndPushClosure::do_oop( oop* p) { do_oop_work(p); }
inline void MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_work(p); }
inline void MarkAndPushClosure::do_klass(Klass* k) { MarkSweep::follow_klass(k); }
inline void MarkAndPushClosure::do_cld(ClassLoaderData* cld) { MarkSweep::follow_cld(cld); }
inline void MarkAndPushClosure::do_method(Method* m) { m->record_gc_epoch(); }
inline void MarkAndPushClosure::do_nmethod(nmethod* nm) { nm->follow_nmethod(this); }
template <class T> inline void MarkSweep::adjust_pointer(T* p) {
T heap_oop = RawAccess<>::oop_load(p);