Merge
authormlarsson
Mon, 04 Apr 2016 09:59:57 +0200
changeset 37240 ddd59c67dc03
parent 37238 3d0a96116bff (diff)
parent 37239 a6cda2376a19 (current diff)
child 37243 34e1821bde93
Merge
--- a/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp	Mon Apr 04 08:58:38 2016 +0200
+++ b/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp	Mon Apr 04 09:59:57 2016 +0200
@@ -30,7 +30,6 @@
 #include "gc/shared/blockOffsetTable.inline.hpp"
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
-#include "gc/shared/liveRange.hpp"
 #include "gc/shared/space.inline.hpp"
 #include "gc/shared/spaceDecorator.hpp"
 #include "memory/allocation.inline.hpp"
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Mon Apr 04 08:58:38 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Mon Apr 04 09:59:57 2016 +0200
@@ -34,7 +34,6 @@
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/g1/heapRegionTracer.hpp"
 #include "gc/shared/genOopClosures.inline.hpp"
-#include "gc/shared/liveRange.hpp"
 #include "gc/shared/space.inline.hpp"
 #include "logging/log.hpp"
 #include "memory/iterator.hpp"
--- a/hotspot/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp	Mon Apr 04 08:58:38 2016 +0200
+++ b/hotspot/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp	Mon Apr 04 09:59:57 2016 +0200
@@ -29,7 +29,6 @@
 #include "gc/parallel/psMarkSweep.hpp"
 #include "gc/parallel/psMarkSweepDecorator.hpp"
 #include "gc/serial/markSweep.inline.hpp"
-#include "gc/shared/liveRange.hpp"
 #include "gc/shared/spaceDecorator.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
@@ -107,9 +106,6 @@
   HeapWord*  end_of_live= q;    /* One byte beyond the last byte of the last
                                    live object. */
   HeapWord*  first_dead = space()->end(); /* The first dead object. */
-  LiveRange* liveRange  = NULL; /* The current live range, recorded in the
-                                   first header of preceding free area. */
-  _first_dead = first_dead;
 
   const intx interval = PrefetchScanIntervalInBytes;
 
@@ -231,17 +227,8 @@
         }
       }
 
-      /* for the previous LiveRange, record the end of the live objects. */
-      if (liveRange) {
-        liveRange->set_end(q);
-      }
-
-      /* record the current LiveRange object.
-       * liveRange->start() is overlaid on the mark word.
-       */
-      liveRange = (LiveRange*)q;
-      liveRange->set_start(end);
-      liveRange->set_end(end);
+      // q is a pointer to a dead object. Use this dead memory to store a pointer to the next live object.
+      (*(HeapWord**)q) = end;
 
       /* see if this is the first dead region. */
       if (q < first_dead) {
@@ -254,9 +241,6 @@
   }
 
   assert(q == t, "just checking");
-  if (liveRange != NULL) {
-    liveRange->set_end(q);
-  }
   _end_of_live = end_of_live;
   if (end_of_live < first_dead) {
     first_dead = end_of_live;
@@ -307,9 +291,8 @@
     if (_first_dead == t) {
       q = t;
     } else {
-      // $$$ This is funky.  Using this to read the previously written
-      // LiveRange.  See also use below.
-      q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();
+      // The first dead object should contain a pointer to the first live object
+      q = *(HeapWord**)_first_dead;
     }
   }
   const intx interval = PrefetchScanIntervalInBytes;
@@ -325,11 +308,11 @@
       debug_only(prev_q = q);
       q += size;
     } else {
-      // q is not a live object, so its mark should point at the next
-      // live object
       debug_only(prev_q = q);
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();
-      assert(q > prev_q, "we should be moving forward through memory");
+      // The first dead object is no longer an object. At that memory address,
+      // there is a pointer to the first live object that the previous phase found.
+      q = *(HeapWord**)q;
+      assert(q > prev_q, "we should be moving forward through memory, q: " PTR_FORMAT ", prev_q: " PTR_FORMAT, p2i(q), p2i(prev_q));
     }
   }
 
--- a/hotspot/src/share/vm/gc/shared/liveRange.hpp	Mon Apr 04 08:58:38 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_GC_SHARED_LIVERANGE_HPP
-#define SHARE_VM_GC_SHARED_LIVERANGE_HPP
-
-#include "memory/memRegion.hpp"
-#include "utilities/copy.hpp"
-
-// This is a shared helper class used during phase 3 and 4 to move all the objects
-// Dead regions in a Space are linked together to keep track of the live regions
-// so that the live data can be traversed quickly without having to look at each
-// object.
-
-class LiveRange: public MemRegion {
-public:
-  LiveRange(HeapWord* bottom, HeapWord* top): MemRegion(bottom, top) {}
-
-  void set_end(HeapWord* e) {
-    assert(e >= start(), "should be a non-zero range");
-    MemRegion::set_end(e);
-  }
-  void set_word_size(size_t ws) {
-    MemRegion::set_word_size(ws);
-  }
-
-  LiveRange * next() { return (LiveRange *) end(); }
-
-  void move_to(HeapWord* destination) {
-    Copy::aligned_conjoint_words(start(), destination, word_size());
-  }
-};
-
-#endif // SHARE_VM_GC_SHARED_LIVERANGE_HPP
--- a/hotspot/src/share/vm/gc/shared/space.cpp	Mon Apr 04 08:58:38 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/space.cpp	Mon Apr 04 09:59:57 2016 +0200
@@ -30,7 +30,6 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/genOopClosures.inline.hpp"
-#include "gc/shared/liveRange.hpp"
 #include "gc/shared/space.hpp"
 #include "gc/shared/space.inline.hpp"
 #include "gc/shared/spaceDecorator.hpp"
--- a/hotspot/src/share/vm/gc/shared/space.inline.hpp	Mon Apr 04 08:58:38 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/space.inline.hpp	Mon Apr 04 09:59:57 2016 +0200
@@ -28,7 +28,6 @@
 #include "gc/serial/markSweep.inline.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/generation.hpp"
-#include "gc/shared/liveRange.hpp"
 #include "gc/shared/space.hpp"
 #include "gc/shared/spaceDecorator.hpp"
 #include "memory/universe.hpp"
@@ -117,9 +116,6 @@
   HeapWord*  end_of_live= q;            // One byte beyond the last byte of the last
                                         // live object.
   HeapWord*  first_dead = space->end(); // The first dead object.
-  LiveRange* liveRange  = NULL;         // The current live range, recorded in the
-                                        // first header of preceding free area.
-  space->_first_dead = first_dead;
 
   const intx interval = PrefetchScanIntervalInBytes;
 
@@ -158,16 +154,8 @@
 
       // otherwise, it really is a free region.
 
-      // for the previous LiveRange, record the end of the live objects.
-      if (liveRange) {
-        liveRange->set_end(q);
-      }
-
-      // record the current LiveRange object.
-      // liveRange->start() is overlaid on the mark word.
-      liveRange = (LiveRange*)q;
-      liveRange->set_start(end);
-      liveRange->set_end(end);
+      // q is a pointer to a dead object. Use this dead memory to store a pointer to the next live object.
+      (*(HeapWord**)q) = end;
 
       // see if this is the first dead region.
       if (q < first_dead) {
@@ -180,9 +168,6 @@
   }
 
   assert(q == t, "just checking");
-  if (liveRange != NULL) {
-    liveRange->set_end(q);
-  }
   space->_end_of_live = end_of_live;
   if (end_of_live < first_dead) {
     first_dead = end_of_live;
@@ -227,9 +212,9 @@
     if (space->_first_dead == t) {
       q = t;
     } else {
-      // $$$ This is funky.  Using this to read the previously written
-      // LiveRange.  See also use below.
-      q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer();
+      // The first dead object is no longer an object. At that memory address,
+      // there is a pointer to the first live object that the previous phase found.
+      q = *((HeapWord**)(space->_first_dead));
     }
   }
 
@@ -247,11 +232,10 @@
       debug_only(prev_q = q);
       q += size;
     } else {
-      // q is not a live object, so its mark should point at the next
-      // live object
       debug_only(prev_q = q);
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();
-      assert(q > prev_q, "we should be moving forward through memory");
+      // q is not a live object, instead it points at the next live object
+      q = *(HeapWord**)q;
+      assert(q > prev_q, "we should be moving forward through memory, q: " PTR_FORMAT ", prev_q: " PTR_FORMAT, p2i(q), p2i(prev_q));
     }
   }