Thu, 07 Aug 2014 22:28:53 +0200
8054341: Remove some obsolete code in G1CollectedHeap class
Summary: Remove dead code.
Reviewed-by: stefank, brutisso
tonyp@2472 | 1 | /* |
jwilhelm@6422 | 2 | * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
tonyp@2472 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
tonyp@2472 | 4 | * |
tonyp@2472 | 5 | * This code is free software; you can redistribute it and/or modify it |
tonyp@2472 | 6 | * under the terms of the GNU General Public License version 2 only, as |
tonyp@2472 | 7 | * published by the Free Software Foundation. |
tonyp@2472 | 8 | * |
tonyp@2472 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
tonyp@2472 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
tonyp@2472 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
tonyp@2472 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
tonyp@2472 | 13 | * accompanied this code). |
tonyp@2472 | 14 | * |
tonyp@2472 | 15 | * You should have received a copy of the GNU General Public License version |
tonyp@2472 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
tonyp@2472 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
tonyp@2472 | 18 | * |
tonyp@2472 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
tonyp@2472 | 20 | * or visit www.oracle.com if you need additional information or have any |
tonyp@2472 | 21 | * questions. |
tonyp@2472 | 22 | * |
tonyp@2472 | 23 | */ |
tonyp@2472 | 24 | |
tonyp@2472 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP |
tonyp@2472 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP |
tonyp@2472 | 27 | |
tonyp@2472 | 28 | #include "gc_implementation/g1/heapRegionSet.hpp" |
tonyp@2472 | 29 | |
brutisso@6385 | 30 | inline void HeapRegionSetBase::add(HeapRegion* hr) { |
brutisso@6385 | 31 | check_mt_safety(); |
brutisso@6385 | 32 | assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u")); |
jwilhelm@6549 | 33 | assert(hr->next() == NULL && hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked")); |
tonyp@2472 | 34 | |
brutisso@6385 | 35 | _count.increment(1u, hr->capacity()); |
brutisso@6385 | 36 | hr->set_containing_set(this); |
brutisso@6385 | 37 | verify_region(hr); |
tonyp@2472 | 38 | } |
tonyp@2472 | 39 | |
brutisso@6385 | 40 | inline void HeapRegionSetBase::remove(HeapRegion* hr) { |
brutisso@6385 | 41 | check_mt_safety(); |
brutisso@6385 | 42 | verify_region(hr); |
jwilhelm@6549 | 43 | assert(hr->next() == NULL && hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked")); |
tonyp@2472 | 44 | |
tonyp@2472 | 45 | hr->set_containing_set(NULL); |
brutisso@6385 | 46 | assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition")); |
brutisso@6385 | 47 | _count.decrement(1u, hr->capacity()); |
tonyp@2472 | 48 | } |
tonyp@2472 | 49 | |
jwilhelm@6422 | 50 | inline void FreeRegionList::add_ordered(HeapRegion* hr) { |
jwilhelm@6422 | 51 | check_mt_safety(); |
jwilhelm@6422 | 52 | assert((length() == 0 && _head == NULL && _tail == NULL) || |
jwilhelm@6422 | 53 | (length() > 0 && _head != NULL && _tail != NULL), |
jwilhelm@6422 | 54 | hrs_ext_msg(this, "invariant")); |
jwilhelm@6422 | 55 | // add() will verify the region and check mt safety. |
jwilhelm@6422 | 56 | add(hr); |
jwilhelm@6422 | 57 | |
jwilhelm@6422 | 58 | // Now link the region |
jwilhelm@6422 | 59 | if (_head != NULL) { |
jwilhelm@6422 | 60 | HeapRegion* curr; |
jwilhelm@6422 | 61 | |
jwilhelm@6422 | 62 | if (_last != NULL && _last->hrs_index() < hr->hrs_index()) { |
jwilhelm@6422 | 63 | curr = _last; |
jwilhelm@6422 | 64 | } else { |
jwilhelm@6422 | 65 | curr = _head; |
jwilhelm@6422 | 66 | } |
jwilhelm@6422 | 67 | |
jwilhelm@6422 | 68 | // Find first entry with a Region Index larger than entry to insert. |
jwilhelm@6422 | 69 | while (curr != NULL && curr->hrs_index() < hr->hrs_index()) { |
jwilhelm@6422 | 70 | curr = curr->next(); |
jwilhelm@6422 | 71 | } |
jwilhelm@6422 | 72 | |
jwilhelm@6422 | 73 | hr->set_next(curr); |
jwilhelm@6422 | 74 | |
jwilhelm@6422 | 75 | if (curr == NULL) { |
jwilhelm@6422 | 76 | // Adding at the end |
jwilhelm@6422 | 77 | hr->set_prev(_tail); |
jwilhelm@6422 | 78 | _tail->set_next(hr); |
jwilhelm@6422 | 79 | _tail = hr; |
jwilhelm@6422 | 80 | } else if (curr->prev() == NULL) { |
jwilhelm@6422 | 81 | // Adding at the beginning |
jwilhelm@6422 | 82 | hr->set_prev(NULL); |
jwilhelm@6422 | 83 | _head = hr; |
jwilhelm@6422 | 84 | curr->set_prev(hr); |
jwilhelm@6422 | 85 | } else { |
jwilhelm@6422 | 86 | hr->set_prev(curr->prev()); |
jwilhelm@6422 | 87 | hr->prev()->set_next(hr); |
jwilhelm@6422 | 88 | curr->set_prev(hr); |
jwilhelm@6422 | 89 | } |
jwilhelm@6422 | 90 | } else { |
jwilhelm@6422 | 91 | // The list was empty |
jwilhelm@6422 | 92 | _tail = hr; |
jwilhelm@6422 | 93 | _head = hr; |
jwilhelm@6422 | 94 | } |
jwilhelm@6422 | 95 | _last = hr; |
jwilhelm@6422 | 96 | } |
jwilhelm@6422 | 97 | |
brutisso@6385 | 98 | inline void FreeRegionList::add_as_head(HeapRegion* hr) { |
tonyp@2714 | 99 | assert((length() == 0 && _head == NULL && _tail == NULL) || |
tonyp@2714 | 100 | (length() > 0 && _head != NULL && _tail != NULL), |
tonyp@2714 | 101 | hrs_ext_msg(this, "invariant")); |
brutisso@6385 | 102 | // add() will verify the region and check mt safety. |
brutisso@6385 | 103 | add(hr); |
tonyp@2714 | 104 | |
tonyp@2714 | 105 | // Now link the region. |
tonyp@2714 | 106 | if (_head != NULL) { |
tonyp@2714 | 107 | hr->set_next(_head); |
jwilhelm@6422 | 108 | _head->set_prev(hr); |
tonyp@2714 | 109 | } else { |
tonyp@2714 | 110 | _tail = hr; |
tonyp@2714 | 111 | } |
tonyp@2714 | 112 | _head = hr; |
tonyp@2714 | 113 | } |
tonyp@2714 | 114 | |
brutisso@6385 | 115 | inline void FreeRegionList::add_as_tail(HeapRegion* hr) { |
brutisso@6385 | 116 | check_mt_safety(); |
tonyp@2472 | 117 | assert((length() == 0 && _head == NULL && _tail == NULL) || |
tonyp@2472 | 118 | (length() > 0 && _head != NULL && _tail != NULL), |
tonyp@2643 | 119 | hrs_ext_msg(this, "invariant")); |
jwilhelm@6422 | 120 | // add() will verify the region and check mt safety. |
brutisso@6385 | 121 | add(hr); |
tonyp@2472 | 122 | |
tonyp@2472 | 123 | // Now link the region. |
tonyp@2472 | 124 | if (_tail != NULL) { |
tonyp@2472 | 125 | _tail->set_next(hr); |
jwilhelm@6422 | 126 | hr->set_prev(_tail); |
tonyp@2472 | 127 | } else { |
tonyp@2472 | 128 | _head = hr; |
tonyp@2472 | 129 | } |
tonyp@2472 | 130 | _tail = hr; |
tonyp@2472 | 131 | } |
tonyp@2472 | 132 | |
brutisso@6385 | 133 | inline HeapRegion* FreeRegionList::remove_head() { |
tonyp@2643 | 134 | assert(!is_empty(), hrs_ext_msg(this, "the list should not be empty")); |
tonyp@2472 | 135 | assert(length() > 0 && _head != NULL && _tail != NULL, |
tonyp@2643 | 136 | hrs_ext_msg(this, "invariant")); |
tonyp@2472 | 137 | |
tonyp@2472 | 138 | // We need to unlink it first. |
tonyp@2472 | 139 | HeapRegion* hr = _head; |
tonyp@2472 | 140 | _head = hr->next(); |
tonyp@2472 | 141 | if (_head == NULL) { |
tonyp@2472 | 142 | _tail = NULL; |
jwilhelm@6422 | 143 | } else { |
jwilhelm@6422 | 144 | _head->set_prev(NULL); |
tonyp@2472 | 145 | } |
tonyp@2472 | 146 | hr->set_next(NULL); |
tonyp@2472 | 147 | |
jwilhelm@6422 | 148 | if (_last == hr) { |
jwilhelm@6422 | 149 | _last = NULL; |
jwilhelm@6422 | 150 | } |
jwilhelm@6422 | 151 | |
jwilhelm@6422 | 152 | // remove() will verify the region and check mt safety. |
brutisso@6385 | 153 | remove(hr); |
tonyp@2472 | 154 | return hr; |
tonyp@2472 | 155 | } |
tonyp@2472 | 156 | |
brutisso@6385 | 157 | inline HeapRegion* FreeRegionList::remove_head_or_null() { |
brutisso@6385 | 158 | check_mt_safety(); |
tonyp@2472 | 159 | if (!is_empty()) { |
tonyp@2472 | 160 | return remove_head(); |
tonyp@2472 | 161 | } else { |
tonyp@2472 | 162 | return NULL; |
tonyp@2472 | 163 | } |
tonyp@2472 | 164 | } |
tonyp@2472 | 165 | |
jwilhelm@6422 | 166 | inline HeapRegion* FreeRegionList::remove_tail() { |
jwilhelm@6422 | 167 | assert(!is_empty(), hrs_ext_msg(this, "The list should not be empty")); |
jwilhelm@6422 | 168 | assert(length() > 0 && _head != NULL && _tail != NULL, |
jwilhelm@6422 | 169 | hrs_ext_msg(this, "invariant")); |
jwilhelm@6422 | 170 | |
jwilhelm@6422 | 171 | // We need to unlink it first |
jwilhelm@6422 | 172 | HeapRegion* hr = _tail; |
jwilhelm@6422 | 173 | |
jwilhelm@6422 | 174 | _tail = hr->prev(); |
jwilhelm@6422 | 175 | if (_tail == NULL) { |
jwilhelm@6422 | 176 | _head = NULL; |
jwilhelm@6422 | 177 | } else { |
jwilhelm@6422 | 178 | _tail->set_next(NULL); |
jwilhelm@6422 | 179 | } |
jwilhelm@6422 | 180 | hr->set_prev(NULL); |
jwilhelm@6422 | 181 | |
jwilhelm@6422 | 182 | if (_last == hr) { |
jwilhelm@6422 | 183 | _last = NULL; |
jwilhelm@6422 | 184 | } |
jwilhelm@6422 | 185 | |
jwilhelm@6422 | 186 | // remove() will verify the region and check mt safety. |
jwilhelm@6422 | 187 | remove(hr); |
jwilhelm@6422 | 188 | return hr; |
jwilhelm@6422 | 189 | } |
jwilhelm@6422 | 190 | |
jwilhelm@6422 | 191 | inline HeapRegion* FreeRegionList::remove_tail_or_null() { |
jwilhelm@6422 | 192 | check_mt_safety(); |
jwilhelm@6422 | 193 | |
jwilhelm@6422 | 194 | if (!is_empty()) { |
jwilhelm@6422 | 195 | return remove_tail(); |
jwilhelm@6422 | 196 | } else { |
jwilhelm@6422 | 197 | return NULL; |
jwilhelm@6422 | 198 | } |
jwilhelm@6422 | 199 | } |
jwilhelm@6422 | 200 | |
jwilhelm@6422 | 201 | inline HeapRegion* FreeRegionList::remove_region(bool from_head) { |
jwilhelm@6422 | 202 | if (from_head) { |
jwilhelm@6422 | 203 | return remove_head_or_null(); |
jwilhelm@6422 | 204 | } else { |
jwilhelm@6422 | 205 | return remove_tail_or_null(); |
jwilhelm@6422 | 206 | } |
jwilhelm@6422 | 207 | } |
jwilhelm@6422 | 208 | |
tonyp@2472 | 209 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP |