140
141 DependencyContext::cleaning_end();
142 }
143
144 void ZUnload::purge() {
145 {
146 SuspendibleThreadSetJoiner sts;
147 ZNMethod::purge(_workers);
148 }
149
150 ClassLoaderDataGraph::purge();
151 CodeCache::purge_exception_caches();
152 }
153
154 class ZUnloadRendezvousClosure : public ThreadClosure {
155 public:
156 void do_thread(Thread* thread) {}
157 };
158
159 void ZUnload::unload() {
160 if (!ClassUnloading) {
161 return;
162 }
163
164 ZStatTimer timer(ZSubPhaseConcurrentClassesUnload);
165
166 // Unlink stale metadata and nmethods
167 unlink();
168
169 // Make sure stale metadata and nmethods are no longer observable
170 ZUnloadRendezvousClosure cl;
171 Handshake::execute(&cl);
172
173 // Purge stale metadata and nmethods that were unlinked
174 purge();
175 }
176
177 void ZUnload::finish() {
178 // Resize and verify metaspace
179 MetaspaceGC::compute_new_size();
180 MetaspaceUtils::verify_metrics();
181 }
|
140
141 DependencyContext::cleaning_end();
142 }
143
144 void ZUnload::purge() {
145 {
146 SuspendibleThreadSetJoiner sts;
147 ZNMethod::purge(_workers);
148 }
149
150 ClassLoaderDataGraph::purge();
151 CodeCache::purge_exception_caches();
152 }
153
154 class ZUnloadRendezvousClosure : public ThreadClosure {
155 public:
156 void do_thread(Thread* thread) {}
157 };
158
159 void ZUnload::unload() {
160 ZUnloadRendezvousClosure cl;
161 if (!ClassUnloading) {
162 // Even when we don't use class unloading, we want a handshake to
163 // close the resurrection block window.
164 Handshake::execute(&cl);
165 return;
166 }
167
168 ZStatTimer timer(ZSubPhaseConcurrentClassesUnload);
169
170 // Unlink stale metadata and nmethods
171 unlink();
172
173 // Make sure stale metadata and nmethods are no longer observable
174 Handshake::execute(&cl);
175
176 // Purge stale metadata and nmethods that were unlinked
177 purge();
178 }
179
180 void ZUnload::finish() {
181 // Resize and verify metaspace
182 MetaspaceGC::compute_new_size();
183 MetaspaceUtils::verify_metrics();
184 }
|