Mercurial > hg > truffle
comparison src/share/vm/classfile/systemDictionary.cpp @ 12837:82af7d7a0128
8003420: NPG: make new GC root for pd_set
Summary: 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
author | tschatzl |
---|---|
date | Wed, 09 Oct 2013 10:57:01 +0200 |
parents | f2110083203d |
children | 1c90f0072f0d |
comparison
equal
deleted
inserted
replaced
12836:b4d8a3d4db73 | 12837:82af7d7a0128 |
---|---|
1695 } | 1695 } |
1696 } | 1696 } |
1697 return newsize; | 1697 return newsize; |
1698 } | 1698 } |
1699 | 1699 |
1700 #ifdef ASSERT | |
1701 class VerifySDReachableAndLiveClosure : public OopClosure { | |
1702 private: | |
1703 BoolObjectClosure* _is_alive; | |
1704 | |
1705 template <class T> void do_oop_work(T* p) { | |
1706 oop obj = oopDesc::load_decode_heap_oop(p); | |
1707 guarantee(_is_alive->do_object_b(obj), "Oop in system dictionary must be live"); | |
1708 } | |
1709 | |
1710 public: | |
1711 VerifySDReachableAndLiveClosure(BoolObjectClosure* is_alive) : OopClosure(), _is_alive(is_alive) { } | |
1712 | |
1713 virtual void do_oop(oop* p) { do_oop_work(p); } | |
1714 virtual void do_oop(narrowOop* p) { do_oop_work(p); } | |
1715 }; | |
1716 #endif | |
1717 | |
1700 // Assumes classes in the SystemDictionary are only unloaded at a safepoint | 1718 // Assumes classes in the SystemDictionary are only unloaded at a safepoint |
1701 // Note: anonymous classes are not in the SD. | 1719 // Note: anonymous classes are not in the SD. |
1702 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) { | 1720 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) { |
1703 // First, mark for unload all ClassLoaderData referencing a dead class loader. | 1721 // First, mark for unload all ClassLoaderData referencing a dead class loader. |
1704 bool has_dead_loaders = ClassLoaderDataGraph::do_unloading(is_alive); | 1722 bool has_dead_loaders = ClassLoaderDataGraph::do_unloading(is_alive); |
1705 bool unloading_occurred = false; | 1723 bool unloading_occurred = false; |
1706 if (has_dead_loaders) { | 1724 if (has_dead_loaders) { |
1707 unloading_occurred = dictionary()->do_unloading(); | 1725 unloading_occurred = dictionary()->do_unloading(); |
1708 constraints()->purge_loader_constraints(); | 1726 constraints()->purge_loader_constraints(); |
1709 resolution_errors()->purge_resolution_errors(); | 1727 resolution_errors()->purge_resolution_errors(); |
1710 } | 1728 } |
1729 // Oops referenced by the system dictionary may get unreachable independently | |
1730 // of the class loader (eg. cached protection domain oops). So we need to | |
1731 // explicitly unlink them here instead of in Dictionary::do_unloading. | |
1732 dictionary()->unlink(is_alive); | |
1733 #ifdef ASSERT | |
1734 VerifySDReachableAndLiveClosure cl(is_alive); | |
1735 dictionary()->oops_do(&cl); | |
1736 #endif | |
1711 return unloading_occurred; | 1737 return unloading_occurred; |
1712 } | 1738 } |
1713 | 1739 |
1714 void SystemDictionary::oops_do(OopClosure* f) { | 1740 void SystemDictionary::oops_do(OopClosure* f) { |
1715 f->do_oop(&_java_system_loader); | 1741 f->do_oop(&_java_system_loader); |