@@ -286,7 +286,7 @@ void HeapRegion::remove_code_root(nmethod* nm) {
286286 rem_set ()->remove_code_root (nm);
287287}
288288
289- void HeapRegion::code_roots_do (CodeBlobClosure * blk) const {
289+ void HeapRegion::code_roots_do (NMethodClosure * blk) const {
290290 rem_set ()->code_roots_do (blk);
291291}
292292
@@ -328,28 +328,27 @@ class VerifyCodeRootOopClosure: public OopClosure {
328328 bool has_oops_in_region () { return _has_oops_in_region; }
329329};
330330
331- class VerifyCodeRootCodeBlobClosure : public CodeBlobClosure {
331+ class VerifyCodeRootNMethodClosure : public NMethodClosure {
332332 const HeapRegion* _hr;
333333 bool _failures;
334334public:
335- VerifyCodeRootCodeBlobClosure (const HeapRegion* hr) :
335+ VerifyCodeRootNMethodClosure (const HeapRegion* hr) :
336336 _hr (hr), _failures(false ) {}
337337
338- void do_code_blob (CodeBlob* cb) {
339- nmethod* nm = (cb == nullptr ) ? nullptr : cb->as_nmethod_or_null ();
340- if (nm != nullptr ) {
341- // Verify that the nemthod is live
342- VerifyCodeRootOopClosure oop_cl (_hr);
343- nm->oops_do (&oop_cl);
344- if (!oop_cl.has_oops_in_region ()) {
345- log_error (gc, verify)(" region [" PTR_FORMAT " ," PTR_FORMAT " ] has nmethod " PTR_FORMAT " in its code roots with no pointers into region" ,
346- p2i (_hr->bottom ()), p2i (_hr->end ()), p2i (nm));
347- _failures = true ;
348- } else if (oop_cl.failures ()) {
349- log_error (gc, verify)(" region [" PTR_FORMAT " ," PTR_FORMAT " ] has other failures for nmethod " PTR_FORMAT,
350- p2i (_hr->bottom ()), p2i (_hr->end ()), p2i (nm));
351- _failures = true ;
352- }
338+ void do_nmethod (nmethod* nm) {
339+ assert (nm != nullptr , " Sanity" );
340+
341+ // Verify that the nmethod is live
342+ VerifyCodeRootOopClosure oop_cl (_hr);
343+ nm->oops_do (&oop_cl);
344+ if (!oop_cl.has_oops_in_region ()) {
345+ log_error (gc, verify)(" region [" PTR_FORMAT " ," PTR_FORMAT " ] has nmethod " PTR_FORMAT " in its code roots with no pointers into region" ,
346+ p2i (_hr->bottom ()), p2i (_hr->end ()), p2i (nm));
347+ _failures = true ;
348+ } else if (oop_cl.failures ()) {
349+ log_error (gc, verify)(" region [" PTR_FORMAT " ," PTR_FORMAT " ] has other failures for nmethod " PTR_FORMAT,
350+ p2i (_hr->bottom ()), p2i (_hr->end ()), p2i (nm));
351+ _failures = true ;
353352 }
354353 }
355354
@@ -395,10 +394,10 @@ bool HeapRegion::verify_code_roots(VerifyOption vo) const {
395394 return has_code_roots;
396395 }
397396
398- VerifyCodeRootCodeBlobClosure cb_cl (this );
399- code_roots_do (&cb_cl );
397+ VerifyCodeRootNMethodClosure nm_cl (this );
398+ code_roots_do (&nm_cl );
400399
401- return cb_cl .failures ();
400+ return nm_cl .failures ();
402401}
403402
404403void HeapRegion::print () const { print_on (tty); }
0 commit comments