mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8003420: NPG: make new GC root for pd_set
Move protection domain oops from system dictionary entries into a seperate set; the system dictionary references entries in that set now. This allows fast iteration during non-classunloading garbage collection. Implementation based on initial prototype from Ioi Lam (iklam). Reviewed-by: coleenp, iklam
This commit is contained in:
parent
2d75de8b05
commit
30ed89669a
7 changed files with 403 additions and 40 deletions
|
@ -1697,6 +1697,24 @@ int SystemDictionary::calculate_systemdictionary_size(int classcount) {
|
|||
return newsize;
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
class VerifySDReachableAndLiveClosure : public OopClosure {
|
||||
private:
|
||||
BoolObjectClosure* _is_alive;
|
||||
|
||||
template <class T> void do_oop_work(T* p) {
|
||||
oop obj = oopDesc::load_decode_heap_oop(p);
|
||||
guarantee(_is_alive->do_object_b(obj), "Oop in system dictionary must be live");
|
||||
}
|
||||
|
||||
public:
|
||||
VerifySDReachableAndLiveClosure(BoolObjectClosure* is_alive) : OopClosure(), _is_alive(is_alive) { }
|
||||
|
||||
virtual void do_oop(oop* p) { do_oop_work(p); }
|
||||
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
};
|
||||
#endif
|
||||
|
||||
// Assumes classes in the SystemDictionary are only unloaded at a safepoint
|
||||
// Note: anonymous classes are not in the SD.
|
||||
bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) {
|
||||
|
@ -1707,7 +1725,15 @@ bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) {
|
|||
unloading_occurred = dictionary()->do_unloading();
|
||||
constraints()->purge_loader_constraints();
|
||||
resolution_errors()->purge_resolution_errors();
|
||||
}
|
||||
}
|
||||
// Oops referenced by the system dictionary may get unreachable independently
|
||||
// of the class loader (eg. cached protection domain oops). So we need to
|
||||
// explicitly unlink them here instead of in Dictionary::do_unloading.
|
||||
dictionary()->unlink(is_alive);
|
||||
#ifdef ASSERT
|
||||
VerifySDReachableAndLiveClosure cl(is_alive);
|
||||
dictionary()->oops_do(&cl);
|
||||
#endif
|
||||
return unloading_occurred;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue