提交 35ef6e02 编写于 作者: S stefank

8012687: Remove unused is_root checks and closures

Reviewed-by: tschatzl, jmasa
上级 eda775b3
...@@ -5079,10 +5079,9 @@ g1_process_strong_roots(bool is_scavenging, ...@@ -5079,10 +5079,9 @@ g1_process_strong_roots(bool is_scavenging,
} }
void void
G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure, G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure) {
OopClosure* non_root_closure) {
CodeBlobToOopClosure roots_in_blobs(root_closure, /*do_marking=*/ false); CodeBlobToOopClosure roots_in_blobs(root_closure, /*do_marking=*/ false);
SharedHeap::process_weak_roots(root_closure, &roots_in_blobs, non_root_closure); SharedHeap::process_weak_roots(root_closure, &roots_in_blobs);
} }
// Weak Reference Processing support // Weak Reference Processing support
......
...@@ -827,8 +827,7 @@ protected: ...@@ -827,8 +827,7 @@ protected:
// Apply "blk" to all the weak roots of the system. These include // Apply "blk" to all the weak roots of the system. These include
// JNI weak roots, the code cache, system dictionary, symbol table, // JNI weak roots, the code cache, system dictionary, symbol table,
// string table, and referents of reachable weak refs. // string table, and referents of reachable weak refs.
void g1_process_weak_roots(OopClosure* root_closure, void g1_process_weak_roots(OopClosure* root_closure);
OopClosure* non_root_closure);
// Frees a non-humongous region by initializing its contents and // Frees a non-humongous region by initializing its contents and
// adding it to the free list that's passed as a parameter (this is // adding it to the free list that's passed as a parameter (this is
......
...@@ -308,17 +308,16 @@ void G1MarkSweep::mark_sweep_phase3() { ...@@ -308,17 +308,16 @@ void G1MarkSweep::mark_sweep_phase3() {
sh->process_strong_roots(true, // activate StrongRootsScope sh->process_strong_roots(true, // activate StrongRootsScope
false, // not scavenging. false, // not scavenging.
SharedHeap::SO_AllClasses, SharedHeap::SO_AllClasses,
&GenMarkSweep::adjust_root_pointer_closure, &GenMarkSweep::adjust_pointer_closure,
NULL, // do not touch code cache here NULL, // do not touch code cache here
&GenMarkSweep::adjust_klass_closure); &GenMarkSweep::adjust_klass_closure);
assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity"); assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity");
g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_root_pointer_closure); g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
// Now adjust pointers in remaining weak roots. (All of which should // Now adjust pointers in remaining weak roots. (All of which should
// have been cleared if they pointed to non-surviving objects.) // have been cleared if they pointed to non-surviving objects.)
g1h->g1_process_weak_roots(&GenMarkSweep::adjust_root_pointer_closure, g1h->g1_process_weak_roots(&GenMarkSweep::adjust_pointer_closure);
&GenMarkSweep::adjust_pointer_closure);
GenMarkSweep::adjust_marks(); GenMarkSweep::adjust_marks();
......
...@@ -583,28 +583,27 @@ void PSMarkSweep::mark_sweep_phase3() { ...@@ -583,28 +583,27 @@ void PSMarkSweep::mark_sweep_phase3() {
ClassLoaderDataGraph::clear_claimed_marks(); ClassLoaderDataGraph::clear_claimed_marks();
// General strong roots. // General strong roots.
Universe::oops_do(adjust_root_pointer_closure()); Universe::oops_do(adjust_pointer_closure());
JNIHandles::oops_do(adjust_root_pointer_closure()); // Global (strong) JNI handles JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles
CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure()); CLDToOopClosure adjust_from_cld(adjust_pointer_closure());
Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL); Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL);
ObjectSynchronizer::oops_do(adjust_root_pointer_closure()); ObjectSynchronizer::oops_do(adjust_pointer_closure());
FlatProfiler::oops_do(adjust_root_pointer_closure()); FlatProfiler::oops_do(adjust_pointer_closure());
Management::oops_do(adjust_root_pointer_closure()); Management::oops_do(adjust_pointer_closure());
JvmtiExport::oops_do(adjust_root_pointer_closure()); JvmtiExport::oops_do(adjust_pointer_closure());
// SO_AllClasses // SO_AllClasses
SystemDictionary::oops_do(adjust_root_pointer_closure()); SystemDictionary::oops_do(adjust_pointer_closure());
ClassLoaderDataGraph::oops_do(adjust_root_pointer_closure(), adjust_klass_closure(), true); ClassLoaderDataGraph::oops_do(adjust_pointer_closure(), adjust_klass_closure(), true);
//CodeCache::scavenge_root_nmethods_oops_do(adjust_root_pointer_closure());
// Now adjust pointers in remaining weak roots. (All of which should // Now adjust pointers in remaining weak roots. (All of which should
// have been cleared if they pointed to non-surviving objects.) // have been cleared if they pointed to non-surviving objects.)
// Global (weak) JNI handles // Global (weak) JNI handles
JNIHandles::weak_oops_do(&always_true, adjust_root_pointer_closure()); JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure());
CodeCache::oops_do(adjust_pointer_closure()); CodeCache::oops_do(adjust_pointer_closure());
StringTable::oops_do(adjust_root_pointer_closure()); StringTable::oops_do(adjust_pointer_closure());
ref_processor()->weak_oops_do(adjust_root_pointer_closure()); ref_processor()->weak_oops_do(adjust_pointer_closure());
PSScavenge::reference_processor()->weak_oops_do(adjust_root_pointer_closure()); PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure());
adjust_marks(); adjust_marks();
......
...@@ -44,7 +44,6 @@ class PSMarkSweep : public MarkSweep { ...@@ -44,7 +44,6 @@ class PSMarkSweep : public MarkSweep {
static KlassClosure* follow_klass_closure() { return &MarkSweep::follow_klass_closure; } static KlassClosure* follow_klass_closure() { return &MarkSweep::follow_klass_closure; }
static VoidClosure* follow_stack_closure() { return (VoidClosure*)&MarkSweep::follow_stack_closure; } static VoidClosure* follow_stack_closure() { return (VoidClosure*)&MarkSweep::follow_stack_closure; }
static OopClosure* adjust_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_pointer_closure; } static OopClosure* adjust_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_pointer_closure; }
static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_root_pointer_closure; }
static KlassClosure* adjust_klass_closure() { return &MarkSweep::adjust_klass_closure; } static KlassClosure* adjust_klass_closure() { return &MarkSweep::adjust_klass_closure; }
static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&MarkSweep::is_alive; } static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&MarkSweep::is_alive; }
......
...@@ -787,12 +787,11 @@ bool PSParallelCompact::IsAliveClosure::do_object_b(oop p) { return mark_bitmap( ...@@ -787,12 +787,11 @@ bool PSParallelCompact::IsAliveClosure::do_object_b(oop p) { return mark_bitmap(
void PSParallelCompact::KeepAliveClosure::do_oop(oop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); } void PSParallelCompact::KeepAliveClosure::do_oop(oop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); }
void PSParallelCompact::KeepAliveClosure::do_oop(narrowOop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); } void PSParallelCompact::KeepAliveClosure::do_oop(narrowOop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); }
PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_root_pointer_closure(true); PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_pointer_closure;
PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_pointer_closure(false);
PSParallelCompact::AdjustKlassClosure PSParallelCompact::_adjust_klass_closure; PSParallelCompact::AdjustKlassClosure PSParallelCompact::_adjust_klass_closure;
void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { adjust_pointer(p, _is_root); } void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { adjust_pointer(p); }
void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p, _is_root); } void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p); }
void PSParallelCompact::FollowStackClosure::do_void() { _compaction_manager->follow_marking_stacks(); } void PSParallelCompact::FollowStackClosure::do_void() { _compaction_manager->follow_marking_stacks(); }
...@@ -805,7 +804,7 @@ void PSParallelCompact::FollowKlassClosure::do_klass(Klass* klass) { ...@@ -805,7 +804,7 @@ void PSParallelCompact::FollowKlassClosure::do_klass(Klass* klass) {
klass->oops_do(_mark_and_push_closure); klass->oops_do(_mark_and_push_closure);
} }
void PSParallelCompact::AdjustKlassClosure::do_klass(Klass* klass) { void PSParallelCompact::AdjustKlassClosure::do_klass(Klass* klass) {
klass->oops_do(&PSParallelCompact::_adjust_root_pointer_closure); klass->oops_do(&PSParallelCompact::_adjust_pointer_closure);
} }
void PSParallelCompact::post_initialize() { void PSParallelCompact::post_initialize() {
...@@ -2398,7 +2397,7 @@ void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, ...@@ -2398,7 +2397,7 @@ void PSParallelCompact::follow_class_loader(ParCompactionManager* cm,
void PSParallelCompact::adjust_class_loader(ParCompactionManager* cm, void PSParallelCompact::adjust_class_loader(ParCompactionManager* cm,
ClassLoaderData* cld) { ClassLoaderData* cld) {
cld->oops_do(PSParallelCompact::adjust_root_pointer_closure(), cld->oops_do(PSParallelCompact::adjust_pointer_closure(),
PSParallelCompact::adjust_klass_closure(), PSParallelCompact::adjust_klass_closure(),
true); true);
} }
...@@ -2419,32 +2418,31 @@ void PSParallelCompact::adjust_roots() { ...@@ -2419,32 +2418,31 @@ void PSParallelCompact::adjust_roots() {
ClassLoaderDataGraph::clear_claimed_marks(); ClassLoaderDataGraph::clear_claimed_marks();
// General strong roots. // General strong roots.
Universe::oops_do(adjust_root_pointer_closure()); Universe::oops_do(adjust_pointer_closure());
JNIHandles::oops_do(adjust_root_pointer_closure()); // Global (strong) JNI handles JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles
CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure()); CLDToOopClosure adjust_from_cld(adjust_pointer_closure());
Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL); Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL);
ObjectSynchronizer::oops_do(adjust_root_pointer_closure()); ObjectSynchronizer::oops_do(adjust_pointer_closure());
FlatProfiler::oops_do(adjust_root_pointer_closure()); FlatProfiler::oops_do(adjust_pointer_closure());
Management::oops_do(adjust_root_pointer_closure()); Management::oops_do(adjust_pointer_closure());
JvmtiExport::oops_do(adjust_root_pointer_closure()); JvmtiExport::oops_do(adjust_pointer_closure());
// SO_AllClasses // SO_AllClasses
SystemDictionary::oops_do(adjust_root_pointer_closure()); SystemDictionary::oops_do(adjust_pointer_closure());
ClassLoaderDataGraph::oops_do(adjust_root_pointer_closure(), adjust_klass_closure(), true); ClassLoaderDataGraph::oops_do(adjust_pointer_closure(), adjust_klass_closure(), true);
// Now adjust pointers in remaining weak roots. (All of which should // Now adjust pointers in remaining weak roots. (All of which should
// have been cleared if they pointed to non-surviving objects.) // have been cleared if they pointed to non-surviving objects.)
// Global (weak) JNI handles // Global (weak) JNI handles
JNIHandles::weak_oops_do(&always_true, adjust_root_pointer_closure()); JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure());
CodeCache::oops_do(adjust_pointer_closure()); CodeCache::oops_do(adjust_pointer_closure());
StringTable::oops_do(adjust_root_pointer_closure()); StringTable::oops_do(adjust_pointer_closure());
ref_processor()->weak_oops_do(adjust_root_pointer_closure()); ref_processor()->weak_oops_do(adjust_pointer_closure());
// Roots were visited so references into the young gen in roots // Roots were visited so references into the young gen in roots
// may have been scanned. Process them also. // may have been scanned. Process them also.
// Should the reference processor have a span that excludes // Should the reference processor have a span that excludes
// young gen objects? // young gen objects?
PSScavenge::reference_processor()->weak_oops_do( PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure());
adjust_root_pointer_closure());
} }
void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q,
......
...@@ -799,16 +799,6 @@ class PSParallelCompact : AllStatic { ...@@ -799,16 +799,6 @@ class PSParallelCompact : AllStatic {
virtual void do_oop(narrowOop* p); virtual void do_oop(narrowOop* p);
}; };
// Current unused
class FollowRootClosure: public OopsInGenClosure {
private:
ParCompactionManager* _compaction_manager;
public:
FollowRootClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
};
class FollowStackClosure: public VoidClosure { class FollowStackClosure: public VoidClosure {
private: private:
ParCompactionManager* _compaction_manager; ParCompactionManager* _compaction_manager;
...@@ -818,10 +808,7 @@ class PSParallelCompact : AllStatic { ...@@ -818,10 +808,7 @@ class PSParallelCompact : AllStatic {
}; };
class AdjustPointerClosure: public OopClosure { class AdjustPointerClosure: public OopClosure {
private:
bool _is_root;
public: public:
AdjustPointerClosure(bool is_root) : _is_root(is_root) { }
virtual void do_oop(oop* p); virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p); virtual void do_oop(narrowOop* p);
// do not walk from thread stacks to the code cache on this phase // do not walk from thread stacks to the code cache on this phase
...@@ -838,7 +825,6 @@ class PSParallelCompact : AllStatic { ...@@ -838,7 +825,6 @@ class PSParallelCompact : AllStatic {
friend class AdjustPointerClosure; friend class AdjustPointerClosure;
friend class AdjustKlassClosure; friend class AdjustKlassClosure;
friend class FollowKlassClosure; friend class FollowKlassClosure;
friend class FollowRootClosure;
friend class InstanceClassLoaderKlass; friend class InstanceClassLoaderKlass;
friend class RefProcTaskProxy; friend class RefProcTaskProxy;
...@@ -853,7 +839,6 @@ class PSParallelCompact : AllStatic { ...@@ -853,7 +839,6 @@ class PSParallelCompact : AllStatic {
static IsAliveClosure _is_alive_closure; static IsAliveClosure _is_alive_closure;
static SpaceInfo _space_info[last_space_id]; static SpaceInfo _space_info[last_space_id];
static bool _print_phases; static bool _print_phases;
static AdjustPointerClosure _adjust_root_pointer_closure;
static AdjustPointerClosure _adjust_pointer_closure; static AdjustPointerClosure _adjust_pointer_closure;
static AdjustKlassClosure _adjust_klass_closure; static AdjustKlassClosure _adjust_klass_closure;
...@@ -889,9 +874,6 @@ class PSParallelCompact : AllStatic { ...@@ -889,9 +874,6 @@ class PSParallelCompact : AllStatic {
static void marking_phase(ParCompactionManager* cm, static void marking_phase(ParCompactionManager* cm,
bool maximum_heap_compaction); bool maximum_heap_compaction);
template <class T> static inline void adjust_pointer(T* p, bool is_root);
static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); }
template <class T> template <class T>
static inline void follow_root(ParCompactionManager* cm, T* p); static inline void follow_root(ParCompactionManager* cm, T* p);
...@@ -1046,7 +1028,6 @@ class PSParallelCompact : AllStatic { ...@@ -1046,7 +1028,6 @@ class PSParallelCompact : AllStatic {
// Closure accessors // Closure accessors
static OopClosure* adjust_pointer_closure() { return (OopClosure*)&_adjust_pointer_closure; } static OopClosure* adjust_pointer_closure() { return (OopClosure*)&_adjust_pointer_closure; }
static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&_adjust_root_pointer_closure; }
static KlassClosure* adjust_klass_closure() { return (KlassClosure*)&_adjust_klass_closure; } static KlassClosure* adjust_klass_closure() { return (KlassClosure*)&_adjust_klass_closure; }
static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&_is_alive_closure; } static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&_is_alive_closure; }
...@@ -1067,6 +1048,7 @@ class PSParallelCompact : AllStatic { ...@@ -1067,6 +1048,7 @@ class PSParallelCompact : AllStatic {
// Check mark and maybe push on marking stack // Check mark and maybe push on marking stack
template <class T> static inline void mark_and_push(ParCompactionManager* cm, template <class T> static inline void mark_and_push(ParCompactionManager* cm,
T* p); T* p);
template <class T> static inline void adjust_pointer(T* p);
static void follow_klass(ParCompactionManager* cm, Klass* klass); static void follow_klass(ParCompactionManager* cm, Klass* klass);
static void adjust_klass(ParCompactionManager* cm, Klass* klass); static void adjust_klass(ParCompactionManager* cm, Klass* klass);
...@@ -1151,9 +1133,6 @@ class PSParallelCompact : AllStatic { ...@@ -1151,9 +1133,6 @@ class PSParallelCompact : AllStatic {
static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; } static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; }
static ParallelCompactData& summary_data() { return _summary_data; } static ParallelCompactData& summary_data() { return _summary_data; }
static inline void adjust_pointer(oop* p) { adjust_pointer(p, false); }
static inline void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
// Reference Processing // Reference Processing
static ReferenceProcessor* const ref_processor() { return _ref_processor; } static ReferenceProcessor* const ref_processor() { return _ref_processor; }
...@@ -1230,7 +1209,7 @@ inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) { ...@@ -1230,7 +1209,7 @@ inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) {
} }
template <class T> template <class T>
inline void PSParallelCompact::adjust_pointer(T* p, bool isroot) { inline void PSParallelCompact::adjust_pointer(T* p) {
T heap_oop = oopDesc::load_heap_oop(p); T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop)) { if (!oopDesc::is_null(heap_oop)) {
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
......
...@@ -81,7 +81,7 @@ void MarkSweep::follow_class_loader(ClassLoaderData* cld) { ...@@ -81,7 +81,7 @@ void MarkSweep::follow_class_loader(ClassLoaderData* cld) {
} }
void MarkSweep::adjust_class_loader(ClassLoaderData* cld) { void MarkSweep::adjust_class_loader(ClassLoaderData* cld) {
cld->oops_do(&MarkSweep::adjust_root_pointer_closure, &MarkSweep::adjust_klass_closure, true); cld->oops_do(&MarkSweep::adjust_pointer_closure, &MarkSweep::adjust_klass_closure, true);
} }
...@@ -121,11 +121,10 @@ void MarkSweep::preserve_mark(oop obj, markOop mark) { ...@@ -121,11 +121,10 @@ void MarkSweep::preserve_mark(oop obj, markOop mark) {
} }
} }
MarkSweep::AdjustPointerClosure MarkSweep::adjust_root_pointer_closure(true); MarkSweep::AdjustPointerClosure MarkSweep::adjust_pointer_closure;
MarkSweep::AdjustPointerClosure MarkSweep::adjust_pointer_closure(false);
void MarkSweep::AdjustPointerClosure::do_oop(oop* p) { adjust_pointer(p, _is_root); } void MarkSweep::AdjustPointerClosure::do_oop(oop* p) { adjust_pointer(p); }
void MarkSweep::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p, _is_root); } void MarkSweep::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p); }
void MarkSweep::adjust_marks() { void MarkSweep::adjust_marks() {
assert( _preserved_oop_stack.size() == _preserved_mark_stack.size(), assert( _preserved_oop_stack.size() == _preserved_mark_stack.size(),
......
...@@ -80,10 +80,7 @@ class MarkSweep : AllStatic { ...@@ -80,10 +80,7 @@ class MarkSweep : AllStatic {
}; };
class AdjustPointerClosure: public OopsInGenClosure { class AdjustPointerClosure: public OopsInGenClosure {
private:
bool _is_root;
public: public:
AdjustPointerClosure(bool is_root) : _is_root(is_root) {}
virtual void do_oop(oop* p); virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p); virtual void do_oop(narrowOop* p);
}; };
...@@ -146,7 +143,6 @@ class MarkSweep : AllStatic { ...@@ -146,7 +143,6 @@ class MarkSweep : AllStatic {
static MarkAndPushClosure mark_and_push_closure; static MarkAndPushClosure mark_and_push_closure;
static FollowKlassClosure follow_klass_closure; static FollowKlassClosure follow_klass_closure;
static FollowStackClosure follow_stack_closure; static FollowStackClosure follow_stack_closure;
static AdjustPointerClosure adjust_root_pointer_closure;
static AdjustPointerClosure adjust_pointer_closure; static AdjustPointerClosure adjust_pointer_closure;
static AdjustKlassClosure adjust_klass_closure; static AdjustKlassClosure adjust_klass_closure;
...@@ -179,12 +175,7 @@ class MarkSweep : AllStatic { ...@@ -179,12 +175,7 @@ class MarkSweep : AllStatic {
static void adjust_marks(); // Adjust the pointers in the preserved marks table static void adjust_marks(); // Adjust the pointers in the preserved marks table
static void restore_marks(); // Restore the marks that we saved in preserve_mark static void restore_marks(); // Restore the marks that we saved in preserve_mark
template <class T> static inline void adjust_pointer(T* p, bool isroot); template <class T> static inline void adjust_pointer(T* p);
static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); }
static void adjust_pointer(oop* p) { adjust_pointer(p, false); }
static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
}; };
class PreservedMark VALUE_OBJ_CLASS_SPEC { class PreservedMark VALUE_OBJ_CLASS_SPEC {
......
...@@ -76,7 +76,7 @@ void MarkSweep::push_objarray(oop obj, size_t index) { ...@@ -76,7 +76,7 @@ void MarkSweep::push_objarray(oop obj, size_t index) {
_objarray_stack.push(task); _objarray_stack.push(task);
} }
template <class T> inline void MarkSweep::adjust_pointer(T* p, bool isroot) { template <class T> inline void MarkSweep::adjust_pointer(T* p) {
T heap_oop = oopDesc::load_heap_oop(p); T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop)) { if (!oopDesc::is_null(heap_oop)) {
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
......
...@@ -633,9 +633,8 @@ gen_process_strong_roots(int level, ...@@ -633,9 +633,8 @@ gen_process_strong_roots(int level,
} }
void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure, void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure,
CodeBlobClosure* code_roots, CodeBlobClosure* code_roots) {
OopClosure* non_root_closure) { SharedHeap::process_weak_roots(root_closure, code_roots);
SharedHeap::process_weak_roots(root_closure, code_roots, non_root_closure);
// "Local" "weak" refs // "Local" "weak" refs
for (int i = 0; i < _n_gens; i++) { for (int i = 0; i < _n_gens; i++) {
_gens[i]->ref_processor()->weak_oops_do(root_closure); _gens[i]->ref_processor()->weak_oops_do(root_closure);
......
...@@ -432,8 +432,7 @@ public: ...@@ -432,8 +432,7 @@ public:
// JNI weak roots, the code cache, system dictionary, symbol table, // JNI weak roots, the code cache, system dictionary, symbol table,
// string table, and referents of reachable weak refs. // string table, and referents of reachable weak refs.
void gen_process_weak_roots(OopClosure* root_closure, void gen_process_weak_roots(OopClosure* root_closure,
CodeBlobClosure* code_roots, CodeBlobClosure* code_roots);
OopClosure* non_root_closure);
// Set the saved marks of generations, if that makes sense. // Set the saved marks of generations, if that makes sense.
// In particular, if any generation might iterate over the oops // In particular, if any generation might iterate over the oops
......
...@@ -282,11 +282,10 @@ void GenMarkSweep::mark_sweep_phase3(int level) { ...@@ -282,11 +282,10 @@ void GenMarkSweep::mark_sweep_phase3(int level) {
// Need new claim bits for the pointer adjustment tracing. // Need new claim bits for the pointer adjustment tracing.
ClassLoaderDataGraph::clear_claimed_marks(); ClassLoaderDataGraph::clear_claimed_marks();
// Because the two closures below are created statically, cannot // Because the closure below is created statically, we cannot
// use OopsInGenClosure constructor which takes a generation, // use OopsInGenClosure constructor which takes a generation,
// as the Universe has not been created when the static constructors // as the Universe has not been created when the static constructors
// are run. // are run.
adjust_root_pointer_closure.set_orig_generation(gch->get_gen(level));
adjust_pointer_closure.set_orig_generation(gch->get_gen(level)); adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
gch->gen_process_strong_roots(level, gch->gen_process_strong_roots(level,
...@@ -294,18 +293,17 @@ void GenMarkSweep::mark_sweep_phase3(int level) { ...@@ -294,18 +293,17 @@ void GenMarkSweep::mark_sweep_phase3(int level) {
true, // activate StrongRootsScope true, // activate StrongRootsScope
false, // not scavenging false, // not scavenging
SharedHeap::SO_AllClasses, SharedHeap::SO_AllClasses,
&adjust_root_pointer_closure, &adjust_pointer_closure,
false, // do not walk code false, // do not walk code
&adjust_root_pointer_closure, &adjust_pointer_closure,
&adjust_klass_closure); &adjust_klass_closure);
// Now adjust pointers in remaining weak roots. (All of which should // Now adjust pointers in remaining weak roots. (All of which should
// have been cleared if they pointed to non-surviving objects.) // have been cleared if they pointed to non-surviving objects.)
CodeBlobToOopClosure adjust_code_pointer_closure(&adjust_pointer_closure, CodeBlobToOopClosure adjust_code_pointer_closure(&adjust_pointer_closure,
/*do_marking=*/ false); /*do_marking=*/ false);
gch->gen_process_weak_roots(&adjust_root_pointer_closure, gch->gen_process_weak_roots(&adjust_pointer_closure,
&adjust_code_pointer_closure, &adjust_code_pointer_closure);
&adjust_pointer_closure);
adjust_marks(); adjust_marks();
GenAdjustPointersClosure blk; GenAdjustPointersClosure blk;
......
...@@ -218,14 +218,13 @@ public: ...@@ -218,14 +218,13 @@ public:
static AlwaysTrueClosure always_true; static AlwaysTrueClosure always_true;
void SharedHeap::process_weak_roots(OopClosure* root_closure, void SharedHeap::process_weak_roots(OopClosure* root_closure,
CodeBlobClosure* code_roots, CodeBlobClosure* code_roots) {
OopClosure* non_root_closure) {
// Global (weak) JNI handles // Global (weak) JNI handles
JNIHandles::weak_oops_do(&always_true, root_closure); JNIHandles::weak_oops_do(&always_true, root_closure);
CodeCache::blobs_do(code_roots); CodeCache::blobs_do(code_roots);
StringTable::oops_do(root_closure); StringTable::oops_do(root_closure);
} }
void SharedHeap::set_barrier_set(BarrierSet* bs) { void SharedHeap::set_barrier_set(BarrierSet* bs) {
_barrier_set = bs; _barrier_set = bs;
......
...@@ -249,8 +249,7 @@ public: ...@@ -249,8 +249,7 @@ public:
// JNI weak roots, the code cache, system dictionary, symbol table, // JNI weak roots, the code cache, system dictionary, symbol table,
// string table. // string table.
void process_weak_roots(OopClosure* root_closure, void process_weak_roots(OopClosure* root_closure,
CodeBlobClosure* code_roots, CodeBlobClosure* code_roots);
OopClosure* non_root_closure);
// The functions below are helper functions that a subclass of // The functions below are helper functions that a subclass of
// "SharedHeap" can use in the implementation of its virtual // "SharedHeap" can use in the implementation of its virtual
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册