@@ -250,9 +250,7 @@ class ZHeapIteratorNMethodClosure : public NMethodClosure {
250
250
_bs_nm (BarrierSet::barrier_set()->barrier_set_nmethod ()) {}
251
251
252
252
virtual void do_nmethod (nmethod* nm) {
253
- assert (!ClassUnloading, " Only used if class unloading is turned off" );
254
-
255
- // ClassUnloading is turned off, all nmethods are considered strong,
253
+ // If ClassUnloading is turned off, all nmethods are considered strong,
256
254
// not only those on the call stacks. The heap iteration might happen
257
255
// before the concurrent processign of the code cache, make sure that
258
256
// all nmethods have been processed before visiting the oops.
@@ -264,35 +262,24 @@ class ZHeapIteratorNMethodClosure : public NMethodClosure {
264
262
265
263
class ZHeapIteratorThreadClosure : public ThreadClosure {
266
264
private:
267
- OopClosure* const _cl;
268
-
269
- class NMethodVisitor : public CodeBlobToOopClosure {
270
- public:
271
- NMethodVisitor (OopClosure* cl) :
272
- CodeBlobToOopClosure (cl, false /* fix_oop_relocations */ ) {}
273
-
274
- void do_code_blob (CodeBlob* cb) {
275
- assert (!cb->is_nmethod () || !ZNMethod::is_armed (cb->as_nmethod ()),
276
- " NMethods on stack should have been fixed and disarmed" );
277
-
278
- CodeBlobToOopClosure::do_code_blob (cb);
279
- }
280
- };
265
+ OopClosure* const _cl;
266
+ CodeBlobToNMethodClosure _cb_cl;
281
267
282
268
public:
283
- ZHeapIteratorThreadClosure (OopClosure* cl) : _cl(cl) {}
269
+ ZHeapIteratorThreadClosure (OopClosure* cl, NMethodClosure* nm_cl) :
270
+ _cl (cl),
271
+ _cb_cl (nm_cl) {}
284
272
285
273
void do_thread (Thread* thread) {
286
- NMethodVisitor code_cl (_cl);
287
- thread->oops_do (_cl, &code_cl);
274
+ thread->oops_do (_cl, &_cb_cl);
288
275
}
289
276
};
290
277
291
278
void ZHeapIterator::push_strong_roots (const ZHeapIteratorContext& context) {
292
279
ZHeapIteratorRootOopClosure<false /* Weak */ > cl (context);
293
280
ZHeapIteratorCLDCLosure cld_cl (&cl);
294
281
ZHeapIteratorNMethodClosure nm_cl (&cl);
295
- ZHeapIteratorThreadClosure thread_cl (&cl);
282
+ ZHeapIteratorThreadClosure thread_cl (&cl, &nm_cl );
296
283
297
284
_concurrent_roots.apply (&cl,
298
285
&cld_cl,
0 commit comments