Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp @ 20380:9337d0e7ea4f
8055919: Remove dead code in G1 concurrent marking code
Reviewed-by: jmasa, jwilhelm
author | tschatzl |
---|---|
date | Tue, 02 Sep 2014 15:04:00 +0200 |
parents | a8ea2f110d87 |
children | 7848fc12602b |
rev | line source |
---|---|
2152 | 1 /* |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
2152 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP | |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP | |
27 | |
28 #include "gc_implementation/g1/heapRegionSet.hpp" | |
29 | |
17736
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
30 inline void HeapRegionSetBase::add(HeapRegion* hr) { |
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
31 check_mt_safety(); |
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
32 assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u")); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
33 assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked")); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
34 assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked")); |
2152 | 35 |
17736
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
36 _count.increment(1u, hr->capacity()); |
2152 | 37 hr->set_containing_set(this); |
17736
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
38 verify_region(hr); |
2152 | 39 } |
40 | |
17736
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
41 inline void HeapRegionSetBase::remove(HeapRegion* hr) { |
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
42 check_mt_safety(); |
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
43 verify_region(hr); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
44 assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked")); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
45 assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked")); |
2152 | 46 |
47 hr->set_containing_set(NULL); | |
17736
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
48 assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition")); |
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
49 _count.decrement(1u, hr->capacity()); |
2152 | 50 } |
51 | |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
52 inline void FreeRegionList::add_ordered(HeapRegion* hr) { |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
53 assert((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) || |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
54 (length() > 0 && _head != NULL && _tail != NULL), |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
55 hrs_ext_msg(this, "invariant")); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
56 // add() will verify the region and check mt safety. |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
57 add(hr); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
58 |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
59 // Now link the region |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
60 if (_head != NULL) { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
61 HeapRegion* curr; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
62 |
20377
a8ea2f110d87
8054819: Rename HeapRegionSeq to HeapRegionManager
tschatzl
parents:
20336
diff
changeset
|
63 if (_last != NULL && _last->hrm_index() < hr->hrm_index()) { |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
64 curr = _last; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
65 } else { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
66 curr = _head; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
67 } |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
68 |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
69 // Find first entry with a Region Index larger than entry to insert. |
20377
a8ea2f110d87
8054819: Rename HeapRegionSeq to HeapRegionManager
tschatzl
parents:
20336
diff
changeset
|
70 while (curr != NULL && curr->hrm_index() < hr->hrm_index()) { |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
71 curr = curr->next(); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
72 } |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
73 |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
74 hr->set_next(curr); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
75 |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
76 if (curr == NULL) { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
77 // Adding at the end |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
78 hr->set_prev(_tail); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
79 _tail->set_next(hr); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
80 _tail = hr; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
81 } else if (curr->prev() == NULL) { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
82 // Adding at the beginning |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
83 hr->set_prev(NULL); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
84 _head = hr; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
85 curr->set_prev(hr); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
86 } else { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
87 hr->set_prev(curr->prev()); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
88 hr->prev()->set_next(hr); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
89 curr->set_prev(hr); |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
90 } |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
91 } else { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
92 // The list was empty |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
93 _tail = hr; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
94 _head = hr; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
95 } |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
96 _last = hr; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
97 } |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
98 |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
99 inline HeapRegion* FreeRegionList::remove_from_head_impl() { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
100 HeapRegion* result = _head; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
101 _head = result->next(); |
2152 | 102 if (_head == NULL) { |
103 _tail = NULL; | |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
104 } else { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
105 _head->set_prev(NULL); |
2152 | 106 } |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
107 result->set_next(NULL); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
108 return result; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
109 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
110 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
111 inline HeapRegion* FreeRegionList::remove_from_tail_impl() { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
112 HeapRegion* result = _tail; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
113 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
114 _tail = result->prev(); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
115 if (_tail == NULL) { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
116 _head = NULL; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
117 } else { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
118 _tail->set_next(NULL); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
119 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
120 result->set_prev(NULL); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
121 return result; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
122 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
123 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
124 inline HeapRegion* FreeRegionList::remove_region(bool from_head) { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
125 check_mt_safety(); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
126 verify_optional(); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
127 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
128 if (is_empty()) { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
129 return NULL; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
130 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
131 assert(length() > 0 && _head != NULL && _tail != NULL, |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
132 hrs_ext_msg(this, "invariant")); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
133 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
134 HeapRegion* hr; |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
135 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
136 if (from_head) { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
137 hr = remove_from_head_impl(); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
138 } else { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
139 hr = remove_from_tail_impl(); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
140 } |
2152 | 141 |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
142 if (_last == hr) { |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
143 _last = NULL; |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
144 } |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
145 |
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
146 // remove() will verify the region and check mt safety. |
17736
58fc1b1523dc
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
6254
diff
changeset
|
147 remove(hr); |
2152 | 148 return hr; |
149 } | |
150 | |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
17841
diff
changeset
|
151 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP |
17773
8ee855b4e667
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
17736
diff
changeset
|
152 |