author | kbarrett |
Tue, 30 Aug 2016 23:48:16 -0400 | |
changeset 40892 | 330a02d935ad |
parent 40655 | 9f644073d3a0 |
child 46517 | 14de3e5151a9 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
39698
4016de4e596b
8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents:
35461
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
1374 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1374
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1374
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1374
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP |
26 |
#define SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/g1/g1BlockOffsetTable.inline.hpp" |
32185
49a57ff2c3cb
8073052: Rename and clean up the allocation manager hierarchy in g1Allocator.?pp
tschatzl
parents:
31592
diff
changeset
|
29 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
30764 | 30 |
#include "gc/g1/heapRegion.hpp" |
31 |
#include "gc/shared/space.hpp" |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
25908
diff
changeset
|
32 |
#include "oops/oop.inline.hpp" |
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
39698
diff
changeset
|
33 |
#include "runtime/atomic.hpp" |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
34 |
|
35461 | 35 |
inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size, |
36 |
size_t desired_word_size, |
|
37 |
size_t* actual_size) { |
|
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
38 |
HeapWord* obj = top(); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
39 |
size_t available = pointer_delta(end(), obj); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
40 |
size_t want_to_allocate = MIN2(available, desired_word_size); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
41 |
if (want_to_allocate >= min_word_size) { |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
42 |
HeapWord* new_top = obj + want_to_allocate; |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
43 |
set_top(new_top); |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
44 |
assert(is_aligned(obj) && is_aligned(new_top), "checking alignment"); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
45 |
*actual_size = want_to_allocate; |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
46 |
return obj; |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
47 |
} else { |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
48 |
return NULL; |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
49 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
50 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
51 |
|
35461 | 52 |
inline HeapWord* G1ContiguousSpace::par_allocate_impl(size_t min_word_size, |
53 |
size_t desired_word_size, |
|
54 |
size_t* actual_size) { |
|
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
55 |
do { |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
56 |
HeapWord* obj = top(); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
57 |
size_t available = pointer_delta(end(), obj); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
58 |
size_t want_to_allocate = MIN2(available, desired_word_size); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
59 |
if (want_to_allocate >= min_word_size) { |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
60 |
HeapWord* new_top = obj + want_to_allocate; |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
61 |
HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj); |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
62 |
// result can be one of two: |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
63 |
// the old top value: the exchange succeeded |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
64 |
// otherwise: the new value of the top is returned. |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
65 |
if (result == obj) { |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
66 |
assert(is_aligned(obj) && is_aligned(new_top), "checking alignment"); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
67 |
*actual_size = want_to_allocate; |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
68 |
return obj; |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
69 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
70 |
} else { |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
71 |
return NULL; |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
72 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
73 |
} while (true); |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
74 |
} |
25361
5146d1e12a2f
8047820: G1 Block offset table does not need to support generic Space classes
mgerdin
parents:
12508
diff
changeset
|
75 |
|
35461 | 76 |
inline HeapWord* G1ContiguousSpace::allocate(size_t min_word_size, |
77 |
size_t desired_word_size, |
|
78 |
size_t* actual_size) { |
|
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
79 |
HeapWord* res = allocate_impl(min_word_size, desired_word_size, actual_size); |
1374 | 80 |
if (res != NULL) { |
35461 | 81 |
_bot_part.alloc_block(res, *actual_size); |
1374 | 82 |
} |
83 |
return res; |
|
84 |
} |
|
85 |
||
35461 | 86 |
inline HeapWord* G1ContiguousSpace::allocate(size_t word_size) { |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
87 |
size_t temp; |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
88 |
return allocate(word_size, word_size, &temp); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
89 |
} |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
90 |
|
35461 | 91 |
inline HeapWord* G1ContiguousSpace::par_allocate(size_t word_size) { |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
92 |
size_t temp; |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
93 |
return par_allocate(word_size, word_size, &temp); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
94 |
} |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
95 |
|
1374 | 96 |
// Because of the requirement of keeping "_offsets" up to date with the |
97 |
// allocations, we sequentialize these with a lock. Therefore, best if |
|
98 |
// this is used for larger LAB allocations only. |
|
35461 | 99 |
inline HeapWord* G1ContiguousSpace::par_allocate(size_t min_word_size, |
100 |
size_t desired_word_size, |
|
101 |
size_t* actual_size) { |
|
1374 | 102 |
MutexLocker x(&_par_alloc_lock); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
103 |
return allocate(min_word_size, desired_word_size, actual_size); |
1374 | 104 |
} |
105 |
||
35461 | 106 |
inline HeapWord* G1ContiguousSpace::block_start(const void* p) { |
107 |
return _bot_part.block_start(p); |
|
1374 | 108 |
} |
109 |
||
110 |
inline HeapWord* |
|
35461 | 111 |
G1ContiguousSpace::block_start_const(const void* p) const { |
112 |
return _bot_part.block_start_const(p); |
|
1374 | 113 |
} |
7397 | 114 |
|
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
115 |
inline bool |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
116 |
HeapRegion::block_is_obj(const HeapWord* p) const { |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
117 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
33786
ac8da6513351
8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents:
33105
diff
changeset
|
118 |
|
ac8da6513351
8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents:
33105
diff
changeset
|
119 |
if (!this->is_in(p)) { |
ac8da6513351
8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents:
33105
diff
changeset
|
120 |
assert(is_continues_humongous(), "This case can only happen for humongous regions"); |
ac8da6513351
8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents:
33105
diff
changeset
|
121 |
return (p == humongous_start_region()->bottom()); |
ac8da6513351
8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents:
33105
diff
changeset
|
122 |
} |
25908
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
123 |
if (ClassUnloadingWithConcurrentMark) { |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
124 |
return !g1h->is_obj_dead(oop(p), this); |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
125 |
} |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
126 |
return p < top(); |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
127 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
128 |
|
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
129 |
inline size_t |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
130 |
HeapRegion::block_size(const HeapWord *addr) const { |
25908
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
131 |
if (addr == top()) { |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
132 |
return pointer_delta(end(), addr); |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
133 |
} |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
134 |
|
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
135 |
if (block_is_obj(addr)) { |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
136 |
return oop(addr)->size(); |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
137 |
} |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
138 |
|
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
139 |
assert(ClassUnloadingWithConcurrentMark, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32389
diff
changeset
|
140 |
"All blocks should be objects if G1 Class Unloading isn't used. " |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32389
diff
changeset
|
141 |
"HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") " |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32389
diff
changeset
|
142 |
"addr: " PTR_FORMAT, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32389
diff
changeset
|
143 |
p2i(bottom()), p2i(top()), p2i(end()), p2i(addr)); |
25908
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
144 |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
145 |
// Old regions' dead objects may have dead classes |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
146 |
// We need to find the next live object in some other |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
147 |
// manner than getting the oop size |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
148 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
25908
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
149 |
HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()-> |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
150 |
getNextMarkedWordAddress(addr, prev_top_at_mark_start()); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
151 |
|
25908
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
152 |
assert(next > addr, "must get the next live object"); |
8adb2fb6fc3c
8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents:
25492
diff
changeset
|
153 |
return pointer_delta(next, addr); |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
154 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
155 |
|
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
156 |
inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t min_word_size, |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
157 |
size_t desired_word_size, |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
158 |
size_t* actual_word_size) { |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
159 |
assert(is_young(), "we can only skip BOT updates on young regions"); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
160 |
return par_allocate_impl(min_word_size, desired_word_size, actual_word_size); |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
161 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
162 |
|
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
163 |
inline HeapWord* HeapRegion::allocate_no_bot_updates(size_t word_size) { |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
164 |
size_t temp; |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
165 |
return allocate_no_bot_updates(word_size, word_size, &temp); |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
166 |
} |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
167 |
|
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
168 |
inline HeapWord* HeapRegion::allocate_no_bot_updates(size_t min_word_size, |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
169 |
size_t desired_word_size, |
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
170 |
size_t* actual_word_size) { |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
171 |
assert(is_young(), "we can only skip BOT updates on young regions"); |
32389
626f27450e12
8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents:
32185
diff
changeset
|
172 |
return allocate_impl(min_word_size, desired_word_size, actual_word_size); |
25481
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
173 |
} |
1427aa24638c
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
25361
diff
changeset
|
174 |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
175 |
inline void HeapRegion::note_start_of_marking() { |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
176 |
_next_marked_bytes = 0; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
177 |
_next_top_at_mark_start = top(); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
178 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
179 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
180 |
inline void HeapRegion::note_end_of_marking() { |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
181 |
_prev_top_at_mark_start = _next_top_at_mark_start; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
182 |
_prev_marked_bytes = _next_marked_bytes; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
183 |
_next_marked_bytes = 0; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
184 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
185 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
186 |
inline void HeapRegion::note_start_of_copying(bool during_initial_mark) { |
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
187 |
if (is_survivor()) { |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
188 |
// This is how we always allocate survivors. |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
189 |
assert(_next_top_at_mark_start == bottom(), "invariant"); |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
190 |
} else { |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
191 |
if (during_initial_mark) { |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
192 |
// During initial-mark we'll explicitly mark any objects on old |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
193 |
// regions that are pointed to by roots. Given that explicit |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
194 |
// marks only make sense under NTAMS it'd be nice if we could |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
195 |
// check that condition if we wanted to. Given that we don't |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
196 |
// know where the top of this region will end up, we simply set |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
197 |
// NTAMS to the end of the region so all marks will be below |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
198 |
// NTAMS. We'll set it to the actual top when we retire this region. |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
199 |
_next_top_at_mark_start = end(); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
200 |
} else { |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
201 |
// We could have re-used this old region as to-space over a |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
202 |
// couple of GCs since the start of the concurrent marking |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
203 |
// cycle. This means that [bottom,NTAMS) will contain objects |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
204 |
// copied up to and including initial-mark and [NTAMS, top) |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
205 |
// will contain objects copied during the concurrent marking cycle. |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
206 |
assert(top() >= _next_top_at_mark_start, "invariant"); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
207 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
208 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
209 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
210 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
211 |
inline void HeapRegion::note_end_of_copying(bool during_initial_mark) { |
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
212 |
if (is_survivor()) { |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
213 |
// This is how we always allocate survivors. |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
214 |
assert(_next_top_at_mark_start == bottom(), "invariant"); |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
215 |
} else { |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11455
diff
changeset
|
216 |
if (during_initial_mark) { |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
217 |
// See the comment for note_start_of_copying() for the details |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
218 |
// on this. |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
219 |
assert(_next_top_at_mark_start == end(), "pre-condition"); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
220 |
_next_top_at_mark_start = top(); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
221 |
} else { |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
222 |
// See the comment for note_start_of_copying() for the details |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
223 |
// on this. |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
224 |
assert(top() >= _next_top_at_mark_start, "invariant"); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
225 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
226 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
227 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
8928
diff
changeset
|
228 |
|
29470
e34bbcd36e53
8030646: track collection set membership in one place
ehelin
parents:
29081
diff
changeset
|
229 |
inline bool HeapRegion::in_collection_set() const { |
e34bbcd36e53
8030646: track collection set membership in one place
ehelin
parents:
29081
diff
changeset
|
230 |
return G1CollectedHeap::heap()->is_in_cset(this); |
e34bbcd36e53
8030646: track collection set membership in one place
ehelin
parents:
29081
diff
changeset
|
231 |
} |
e34bbcd36e53
8030646: track collection set membership in one place
ehelin
parents:
29081
diff
changeset
|
232 |
|
30764 | 233 |
#endif // SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP |