changeset 11096:f12480688972

Merge
author jmasa
date Fri, 29 Apr 2016 18:55:41 +0000
parents 2d040098ee0b 9a28091479aa
children 0679677b7de3
files
diffstat 3 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri Apr 29 18:00:57 2016 +0200
+++ b/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri Apr 29 18:55:41 2016 +0000
@@ -249,7 +249,7 @@
   const size_t last = summary_data.addr_to_region_idx(end_addr);
   HeapWord* pdest = 0;
 
-  while (i <= last) {
+  while (i < last) {
     ParallelCompactData::RegionData* c = summary_data.region(i);
     if (c->data_size() != 0 || c->destination() != pdest) {
       print_generic_summary_region(i, c);
@@ -377,6 +377,33 @@
     print_generic_summary_data(summary_data, space->bottom(), space->top());
   } while (++id < PSParallelCompact::last_space_id);
 }
+
+void ParallelCompact_test() {
+  if (!UseParallelGC) {
+    return;
+  }
+  // Check that print_generic_summary_data() does not print the
+  // end region by placing a bad value in the destination of the
+  // end region.  The end region should not be printed because it
+  // corresponds to the space after the end of the heap.
+  ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
+  ParCompactionManager* const vmthread_cm =
+    ParCompactionManager::manager_array(ParallelGCThreads);
+  HeapWord* begin_heap =
+    (HeapWord*) heap->old_gen()->virtual_space()->low_boundary();
+  HeapWord* end_heap =
+    (HeapWord*) heap->young_gen()->virtual_space()->high_boundary();
+
+  size_t end_index =
+    PSParallelCompact::summary_data().addr_to_region_idx(end_heap);
+  ParallelCompactData::RegionData* c = PSParallelCompact::summary_data().region(end_index);
+
+  // Initialize the end region with a bad destination.
+  c->set_destination(begin_heap - 1);
+
+  print_generic_summary_data(PSParallelCompact::summary_data(),
+    begin_heap, end_heap);
+}
 #endif  // #ifndef PRODUCT
 
 #ifdef  ASSERT
--- a/src/share/vm/gc/parallel/psParallelCompact.hpp	Fri Apr 29 18:00:57 2016 +0200
+++ b/src/share/vm/gc/parallel/psParallelCompact.hpp	Fri Apr 29 18:55:41 2016 +0000
@@ -631,8 +631,8 @@
 inline size_t
 ParallelCompactData::addr_to_region_idx(const HeapWord* addr) const
 {
-  assert(addr >= _region_start, "bad addr");
-  assert(addr <= _region_end, "bad addr");
+  assert(addr >= _region_start, "bad addr " PTR_FORMAT " _region_start " PTR_FORMAT, p2i(addr), p2i(_region_start));
+  assert(addr <= _region_end, "bad addr " PTR_FORMAT " _region_end " PTR_FORMAT, p2i(addr), p2i(_region_end));
   return pointer_delta(addr, _region_start) >> Log2RegionSize;
 }
 
--- a/src/share/vm/utilities/internalVMTests.cpp	Fri Apr 29 18:00:57 2016 +0200
+++ b/src/share/vm/utilities/internalVMTests.cpp	Fri Apr 29 18:55:41 2016 +0000
@@ -98,6 +98,7 @@
   run_unit_test(test_memset_with_concurrent_readers);
   run_unit_test(TestPredictions_test);
   run_unit_test(WorkerDataArray_test);
+  run_unit_test(ParallelCompact_test);
 #endif
   tty->print_cr("All internal VM tests passed");
 }