# HG changeset patch # User brutisso # Date 1459438355 -7200 # Thu Mar 31 17:32:35 2016 +0200 # Node ID 2b2ec1a6ee7dddd9a53555de85823fa0fce83861 # Parent 2bf42f25d7ed2fdc594e72cf4b014cd01f9c9055 [mq]: liveRange diff --git a/src/share/vm/gc/cms/compactibleFreeListSpace.cpp b/src/share/vm/gc/cms/compactibleFreeListSpace.cpp --- a/src/share/vm/gc/cms/compactibleFreeListSpace.cpp +++ b/src/share/vm/gc/cms/compactibleFreeListSpace.cpp @@ -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" diff --git a/src/share/vm/gc/g1/heapRegion.cpp b/src/share/vm/gc/g1/heapRegion.cpp --- a/src/share/vm/gc/g1/heapRegion.cpp +++ b/src/share/vm/gc/g1/heapRegion.cpp @@ -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" diff --git a/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp b/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp --- a/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp +++ b/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp @@ -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,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)); } } diff --git a/src/share/vm/gc/shared/liveRange.hpp b/src/share/vm/gc/shared/liveRange.hpp deleted file mode 100644 --- a/src/share/vm/gc/shared/liveRange.hpp +++ /dev/null @@ -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 diff --git a/src/share/vm/gc/shared/space.cpp b/src/share/vm/gc/shared/space.cpp --- a/src/share/vm/gc/shared/space.cpp +++ b/src/share/vm/gc/shared/space.cpp @@ -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" diff --git a/src/share/vm/gc/shared/space.inline.hpp b/src/share/vm/gc/shared/space.inline.hpp --- a/src/share/vm/gc/shared/space.inline.hpp +++ b/src/share/vm/gc/shared/space.inline.hpp @@ -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,8 @@ 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 should contain a pointer to the first live object + q = *((HeapWord**)(space->_first_dead)); } } @@ -247,11 +231,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)); } }