< prev index next >

src/hotspot/share/gc/g1/heapRegion.cpp

Print this page
rev 56449 : imported patch 8220310.mut.1
rev 56452 : [mq]: 8220310.mut.3-stefan
rev 56453 : [mq]: 8220310.mut.3-kim


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/nmethod.hpp"
  27 #include "gc/g1/g1BlockOffsetTable.inline.hpp"
  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/g1CollectionSet.hpp"
  30 #include "gc/g1/g1HeapRegionTraceType.hpp"

  31 #include "gc/g1/g1OopClosures.inline.hpp"
  32 #include "gc/g1/heapRegion.inline.hpp"
  33 #include "gc/g1/heapRegionBounds.inline.hpp"
  34 #include "gc/g1/heapRegionManager.inline.hpp"
  35 #include "gc/g1/heapRegionRemSet.hpp"
  36 #include "gc/g1/heapRegionTracer.hpp"
  37 #include "gc/shared/genOopClosures.inline.hpp"
  38 #include "gc/shared/space.inline.hpp"
  39 #include "logging/log.hpp"
  40 #include "logging/logStream.hpp"
  41 #include "memory/iterator.inline.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "oops/access.inline.hpp"
  44 #include "oops/compressedOops.inline.hpp"
  45 #include "oops/oop.inline.hpp"
  46 #include "runtime/atomic.hpp"
  47 #include "runtime/orderAccess.hpp"
  48 #include "utilities/growableArray.hpp"
  49 
  50 int    HeapRegion::LogOfHRGrainBytes = 0;


 231   _bot_part.set_object_can_span(false);
 232 }
 233 
 234 HeapRegion::HeapRegion(uint hrm_index,
 235                        G1BlockOffsetTable* bot,
 236                        MemRegion mr) :
 237     G1ContiguousSpace(bot),
 238     _rem_set(NULL),
 239     _hrm_index(hrm_index),
 240     _type(),
 241     _humongous_start_region(NULL),
 242     _evacuation_failed(false),
 243     _next(NULL), _prev(NULL),
 244 #ifdef ASSERT
 245     _containing_set(NULL),
 246 #endif
 247     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
 248     _index_in_opt_cset(InvalidCSetIndex), _young_index_in_cset(-1),
 249     _surv_rate_group(NULL), _age_index(-1),
 250     _prev_top_at_mark_start(NULL), _next_top_at_mark_start(NULL),
 251     _recorded_rs_length(0), _predicted_elapsed_time_ms(0)

 252 {
 253   _rem_set = new HeapRegionRemSet(bot, this);
 254 
 255   initialize(mr);
 256 }
 257 
 258 void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 259   assert(_rem_set->is_empty(), "Remembered set must be empty");
 260 
 261   G1ContiguousSpace::initialize(mr, clear_space, mangle_space);
 262 
 263   hr_clear(false /*par*/, false /*clear_space*/);
 264   set_top(bottom());
 265 }
 266 
 267 void HeapRegion::report_region_type_change(G1HeapRegionTraceType::Type to) {
 268   HeapRegionTracer::send_region_type_change(_hrm_index,
 269                                             get_trace_type(),
 270                                             to,
 271                                             (uintptr_t)bottom(),


 438   VerifyStrongCodeRootCodeBlobClosure cb_cl(this);
 439   strong_code_roots_do(&cb_cl);
 440 
 441   if (cb_cl.failures()) {
 442     *failures = true;
 443   }
 444 }
 445 
 446 void HeapRegion::print() const { print_on(tty); }
 447 void HeapRegion::print_on(outputStream* st) const {
 448   st->print("|%4u", this->_hrm_index);
 449   st->print("|" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT,
 450             p2i(bottom()), p2i(top()), p2i(end()));
 451   st->print("|%3d%%", (int) ((double) used() * 100 / capacity()));
 452   st->print("|%2s", get_short_type_str());
 453   if (in_collection_set()) {
 454     st->print("|CS");
 455   } else {
 456     st->print("|  ");
 457   }
 458   st->print_cr("|TAMS " PTR_FORMAT ", " PTR_FORMAT "| %s ",
 459                p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start()), rem_set()->get_state_str());





 460 }
 461 
 462 class G1VerificationClosure : public BasicOopIterateClosure {
 463 protected:
 464   G1CollectedHeap* _g1h;
 465   G1CardTable *_ct;
 466   oop _containing_obj;
 467   bool _failures;
 468   int _n_failures;
 469   VerifyOption _vo;
 470 public:
 471   // _vo == UsePrevMarking -> use "prev" marking information,
 472   // _vo == UseNextMarking -> use "next" marking information,
 473   // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS.
 474   G1VerificationClosure(G1CollectedHeap* g1h, VerifyOption vo) :
 475     _g1h(g1h), _ct(g1h->card_table()),
 476     _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo) {
 477   }
 478 
 479   void set_containing_obj(oop obj) {




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/nmethod.hpp"
  27 #include "gc/g1/g1BlockOffsetTable.inline.hpp"
  28 #include "gc/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc/g1/g1CollectionSet.hpp"
  30 #include "gc/g1/g1HeapRegionTraceType.hpp"
  31 #include "gc/g1/g1MemoryNodeManager.hpp"
  32 #include "gc/g1/g1OopClosures.inline.hpp"
  33 #include "gc/g1/heapRegion.inline.hpp"
  34 #include "gc/g1/heapRegionBounds.inline.hpp"
  35 #include "gc/g1/heapRegionManager.inline.hpp"
  36 #include "gc/g1/heapRegionRemSet.hpp"
  37 #include "gc/g1/heapRegionTracer.hpp"
  38 #include "gc/shared/genOopClosures.inline.hpp"
  39 #include "gc/shared/space.inline.hpp"
  40 #include "logging/log.hpp"
  41 #include "logging/logStream.hpp"
  42 #include "memory/iterator.inline.hpp"
  43 #include "memory/resourceArea.hpp"
  44 #include "oops/access.inline.hpp"
  45 #include "oops/compressedOops.inline.hpp"
  46 #include "oops/oop.inline.hpp"
  47 #include "runtime/atomic.hpp"
  48 #include "runtime/orderAccess.hpp"
  49 #include "utilities/growableArray.hpp"
  50 
  51 int    HeapRegion::LogOfHRGrainBytes = 0;


 232   _bot_part.set_object_can_span(false);
 233 }
 234 
 235 HeapRegion::HeapRegion(uint hrm_index,
 236                        G1BlockOffsetTable* bot,
 237                        MemRegion mr) :
 238     G1ContiguousSpace(bot),
 239     _rem_set(NULL),
 240     _hrm_index(hrm_index),
 241     _type(),
 242     _humongous_start_region(NULL),
 243     _evacuation_failed(false),
 244     _next(NULL), _prev(NULL),
 245 #ifdef ASSERT
 246     _containing_set(NULL),
 247 #endif
 248     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
 249     _index_in_opt_cset(InvalidCSetIndex), _young_index_in_cset(-1),
 250     _surv_rate_group(NULL), _age_index(-1),
 251     _prev_top_at_mark_start(NULL), _next_top_at_mark_start(NULL),
 252     _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
 253     _node_index(G1MemoryNodeManager::UnknownNodeIndex)
 254 {
 255   _rem_set = new HeapRegionRemSet(bot, this);
 256 
 257   initialize(mr);
 258 }
 259 
 260 void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 261   assert(_rem_set->is_empty(), "Remembered set must be empty");
 262 
 263   G1ContiguousSpace::initialize(mr, clear_space, mangle_space);
 264 
 265   hr_clear(false /*par*/, false /*clear_space*/);
 266   set_top(bottom());
 267 }
 268 
 269 void HeapRegion::report_region_type_change(G1HeapRegionTraceType::Type to) {
 270   HeapRegionTracer::send_region_type_change(_hrm_index,
 271                                             get_trace_type(),
 272                                             to,
 273                                             (uintptr_t)bottom(),


 440   VerifyStrongCodeRootCodeBlobClosure cb_cl(this);
 441   strong_code_roots_do(&cb_cl);
 442 
 443   if (cb_cl.failures()) {
 444     *failures = true;
 445   }
 446 }
 447 
 448 void HeapRegion::print() const { print_on(tty); }
 449 void HeapRegion::print_on(outputStream* st) const {
 450   st->print("|%4u", this->_hrm_index);
 451   st->print("|" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT,
 452             p2i(bottom()), p2i(top()), p2i(end()));
 453   st->print("|%3d%%", (int) ((double) used() * 100 / capacity()));
 454   st->print("|%2s", get_short_type_str());
 455   if (in_collection_set()) {
 456     st->print("|CS");
 457   } else {
 458     st->print("|  ");
 459   }
 460   st->print("|TAMS " PTR_FORMAT ", " PTR_FORMAT "| %s ",
 461                p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start()), rem_set()->get_state_str());
 462   if (UseNUMA) {
 463     const int* node_ids = G1MemoryNodeManager::mgr()->node_ids();
 464     st->print("|Node ID %02d", node_ids[this->node_index()]);
 465   }
 466   st->print_cr("");
 467 }
 468 
 469 class G1VerificationClosure : public BasicOopIterateClosure {
 470 protected:
 471   G1CollectedHeap* _g1h;
 472   G1CardTable *_ct;
 473   oop _containing_obj;
 474   bool _failures;
 475   int _n_failures;
 476   VerifyOption _vo;
 477 public:
 478   // _vo == UsePrevMarking -> use "prev" marking information,
 479   // _vo == UseNextMarking -> use "next" marking information,
 480   // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS.
 481   G1VerificationClosure(G1CollectedHeap* g1h, VerifyOption vo) :
 482     _g1h(g1h), _ct(g1h->card_table()),
 483     _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo) {
 484   }
 485 
 486   void set_containing_obj(oop obj) {


< prev index next >