comparison src/hotspot/share/gc/z/zUnload.cpp @ 53894:bf1133e7dfba

8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class Reviewed-by: pliden
author stefank
date Thu, 21 Feb 2019 14:24:44 +0100
parents 9a8585f60c32
children a590b6107ab3
comparison
equal deleted inserted replaced
0:c776b9af3b8f 1:da8c7f5b5f84
28 #include "code/codeCache.hpp" 28 #include "code/codeCache.hpp"
29 #include "code/dependencyContext.hpp" 29 #include "code/dependencyContext.hpp"
30 #include "gc/shared/gcBehaviours.hpp" 30 #include "gc/shared/gcBehaviours.hpp"
31 #include "gc/shared/suspendibleThreadSet.hpp" 31 #include "gc/shared/suspendibleThreadSet.hpp"
32 #include "gc/z/zLock.inline.hpp" 32 #include "gc/z/zLock.inline.hpp"
33 #include "gc/z/zNMethodTable.hpp" 33 #include "gc/z/zNMethod.hpp"
34 #include "gc/z/zOopClosures.hpp" 34 #include "gc/z/zOopClosures.hpp"
35 #include "gc/z/zStat.hpp" 35 #include "gc/z/zStat.hpp"
36 #include "gc/z/zUnload.hpp" 36 #include "gc/z/zUnload.hpp"
37 #include "oops/access.inline.hpp" 37 #include "oops/access.inline.hpp"
38 38
73 } 73 }
74 74
75 public: 75 public:
76 virtual bool is_unloading(CompiledMethod* method) const { 76 virtual bool is_unloading(CompiledMethod* method) const {
77 nmethod* const nm = method->as_nmethod(); 77 nmethod* const nm = method->as_nmethod();
78 ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); 78 ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
79 if (lock == NULL) { 79 if (lock == NULL) {
80 return is_unloading(nm); 80 return is_unloading(nm);
81 } else { 81 } else {
82 ZLocker<ZReentrantLock> locker(lock); 82 ZLocker<ZReentrantLock> locker(lock);
83 return is_unloading(nm); 83 return is_unloading(nm);
87 87
88 class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour { 88 class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
89 public: 89 public:
90 virtual bool lock(CompiledMethod* method) { 90 virtual bool lock(CompiledMethod* method) {
91 nmethod* const nm = method->as_nmethod(); 91 nmethod* const nm = method->as_nmethod();
92 ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); 92 ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
93 if (lock != NULL) { 93 if (lock != NULL) {
94 lock->lock(); 94 lock->lock();
95 } 95 }
96 return true; 96 return true;
97 } 97 }
98 98
99 virtual void unlock(CompiledMethod* method) { 99 virtual void unlock(CompiledMethod* method) {
100 nmethod* const nm = method->as_nmethod(); 100 nmethod* const nm = method->as_nmethod();
101 ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); 101 ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
102 if (lock != NULL) { 102 if (lock != NULL) {
103 lock->unlock(); 103 lock->unlock();
104 } 104 }
105 } 105 }
106 106
108 if (SafepointSynchronize::is_at_safepoint()) { 108 if (SafepointSynchronize::is_at_safepoint()) {
109 return true; 109 return true;
110 } 110 }
111 111
112 nmethod* const nm = method->as_nmethod(); 112 nmethod* const nm = method->as_nmethod();
113 ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); 113 ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
114 return lock == NULL || lock->is_owned(); 114 return lock == NULL || lock->is_owned();
115 } 115 }
116 }; 116 };
117 117
118 ZUnload::ZUnload(ZWorkers* workers) : 118 ZUnload::ZUnload(ZWorkers* workers) :
147 unloading_occurred = SystemDictionary::do_unloading(ZStatPhase::timer()); 147 unloading_occurred = SystemDictionary::do_unloading(ZStatPhase::timer());
148 } 148 }
149 149
150 Klass::clean_weak_klass_links(unloading_occurred); 150 Klass::clean_weak_klass_links(unloading_occurred);
151 151
152 ZNMethodTable::unlink(_workers, unloading_occurred); 152 ZNMethod::unlink(_workers, unloading_occurred);
153 153
154 DependencyContext::cleaning_end(); 154 DependencyContext::cleaning_end();
155 } 155 }
156 156
157 void ZUnload::purge() { 157 void ZUnload::purge() {
158 { 158 {
159 SuspendibleThreadSetJoiner sts; 159 SuspendibleThreadSetJoiner sts;
160 ZNMethodTable::purge(_workers); 160 ZNMethod::purge(_workers);
161 } 161 }
162 162
163 ClassLoaderDataGraph::purge(); 163 ClassLoaderDataGraph::purge();
164 CodeCache::purge_exception_caches(); 164 CodeCache::purge_exception_caches();
165 } 165 }