src/hotspot/share/gc/g1/heapRegion.cpp
changeset 53839 31dde2f0ddf1
parent 53034 de99beff5c0e
child 53985 0da5c17f5e43
equal deleted inserted replaced
53838:c8c9bd65c198 53839:31dde2f0ddf1
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   334       // current region. We only look at those which are.
   334       // current region. We only look at those which are.
   335       if (_hr->is_in(obj)) {
   335       if (_hr->is_in(obj)) {
   336         // Object is in the region. Check that its less than top
   336         // Object is in the region. Check that its less than top
   337         if (_hr->top() <= (HeapWord*)obj) {
   337         if (_hr->top() <= (HeapWord*)obj) {
   338           // Object is above top
   338           // Object is above top
   339           log_error(gc, verify)("Object " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ") is above top " PTR_FORMAT,
   339           log_error(gc, verify)("Object " PTR_FORMAT " in region " HR_FORMAT " is above top ",
   340                                p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top()));
   340                                 p2i(obj), HR_FORMAT_PARAMS(_hr));
   341           _failures = true;
   341           _failures = true;
   342           return;
   342           return;
   343         }
   343         }
   344         // Nmethod has at least one oop in the current region
   344         // Nmethod has at least one oop in the current region
   345         _has_oops_in_region = true;
   345         _has_oops_in_region = true;
   413 
   413 
   414   // if this region is empty then there should be no entries
   414   // if this region is empty then there should be no entries
   415   // on its strong code root list
   415   // on its strong code root list
   416   if (is_empty()) {
   416   if (is_empty()) {
   417     if (strong_code_roots_length > 0) {
   417     if (strong_code_roots_length > 0) {
   418       log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] is empty but has " SIZE_FORMAT " code root entries",
   418       log_error(gc, verify)("region " HR_FORMAT " is empty but has " SIZE_FORMAT " code root entries",
   419                             p2i(bottom()), p2i(end()), strong_code_roots_length);
   419                             HR_FORMAT_PARAMS(this), strong_code_roots_length);
   420       *failures = true;
   420       *failures = true;
   421     }
   421     }
   422     return;
   422     return;
   423   }
   423   }
   424 
   424 
   522           log.error("----------");
   522           log.error("----------");
   523         }
   523         }
   524         ResourceMark rm;
   524         ResourceMark rm;
   525         if (!_g1h->is_in_closed_subset(obj)) {
   525         if (!_g1h->is_in_closed_subset(obj)) {
   526           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
   526           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
   527           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
   527           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
   528             p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));
   528                     p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
   529           LogStream ls(log.error());
   529           LogStream ls(log.error());
   530           print_object(&ls, _containing_obj);
   530           print_object(&ls, _containing_obj);
   531           HeapRegion* const to = _g1h->heap_region_containing(obj);
   531           HeapRegion* const to = _g1h->heap_region_containing(obj);
   532           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
   532           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s",
       
   533                     p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
   533         } else {
   534         } else {
   534           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
   535           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
   535           HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
   536           HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
   536           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
   537           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
   537             p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));
   538                     p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
   538           LogStream ls(log.error());
   539           LogStream ls(log.error());
   539           print_object(&ls, _containing_obj);
   540           print_object(&ls, _containing_obj);
   540           log.error("points to dead obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
   541           log.error("points to dead obj " PTR_FORMAT " in region " HR_FORMAT,
   541             p2i(obj), p2i(to->bottom()), p2i(to->end()));
   542                     p2i(obj), HR_FORMAT_PARAMS(to));
   542           print_object(&ls, obj);
   543           print_object(&ls, obj);
   543         }
   544         }
   544         log.error("----------");
   545         log.error("----------");
   545         _failures = true;
   546         _failures = true;
   546         failed = true;
   547         failed = true;
   591 
   592 
   592           if (!_failures) {
   593           if (!_failures) {
   593             log.error("----------");
   594             log.error("----------");
   594           }
   595           }
   595           log.error("Missing rem set entry:");
   596           log.error("Missing rem set entry:");
   596           log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT,
   597           log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT " in region " HR_FORMAT,
   597             p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
   598                     p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
   598           ResourceMark rm;
   599           ResourceMark rm;
   599           LogStream ls(log.error());
   600           LogStream ls(log.error());
   600           _containing_obj->print_on(&ls);
   601           _containing_obj->print_on(&ls);
   601           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
   602           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s",
       
   603                     p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
   602           if (oopDesc::is_oop(obj)) {
   604           if (oopDesc::is_oop(obj)) {
   603             obj->print_on(&ls);
   605             obj->print_on(&ls);
   604           }
   606           }
   605           log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
   607           log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
   606           log.error("----------");
   608           log.error("----------");