annotate src/share/vm/gc_implementation/g1/heapRegion.inline.hpp @ 20278:2c6ef90f030a

8049421: G1 Class Unloading after completing a concurrent mark cycle Reviewed-by: tschatzl, ehelin, brutisso, coleenp, roland, iveresov Contributed-by: stefan.karlsson@oracle.com, mikael.gerdin@oracle.com
author stefank
date Mon, 07 Jul 2014 10:12:40 +0200
parents 1526a938e670
children f3aeae1f9fc5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
1 /*
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
4 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
7 * published by the Free Software Foundation.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
8 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
13 * accompanied this code).
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
14 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
21 * questions.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
22 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
23 */
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
20273
9441d22e429a 8047820: G1 Block offset table does not need to support generic Space classes
mgerdin
parents: 6027
diff changeset
28 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
30 #include "gc_implementation/g1/heapRegion.hpp"
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
31 #include "memory/space.hpp"
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
32 #include "runtime/atomic.inline.hpp"
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
33
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
34 // This version requires locking.
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
35 inline HeapWord* G1OffsetTableContigSpace::allocate_impl(size_t size,
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
36 HeapWord* const end_value) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
37 HeapWord* obj = top();
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
38 if (pointer_delta(end_value, obj) >= size) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
39 HeapWord* new_top = obj + size;
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
40 set_top(new_top);
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
41 assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
42 return obj;
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
43 } else {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
44 return NULL;
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
45 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
46 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
47
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
48 // This version is lock-free.
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
49 inline HeapWord* G1OffsetTableContigSpace::par_allocate_impl(size_t size,
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
50 HeapWord* const end_value) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
51 do {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
52 HeapWord* obj = top();
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
53 if (pointer_delta(end_value, obj) >= size) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
54 HeapWord* new_top = obj + size;
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
55 HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
56 // result can be one of two:
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
57 // the old top value: the exchange succeeded
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
58 // otherwise: the new value of the top is returned.
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
59 if (result == obj) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
60 assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
61 return obj;
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
62 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
63 } else {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
64 return NULL;
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
65 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
66 } while (true);
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
67 }
20273
9441d22e429a 8047820: G1 Block offset table does not need to support generic Space classes
mgerdin
parents: 6027
diff changeset
68
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
69 inline HeapWord* G1OffsetTableContigSpace::allocate(size_t size) {
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
70 HeapWord* res = allocate_impl(size, end());
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
71 if (res != NULL) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
72 _offsets.alloc_block(res, size);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
73 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
74 return res;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
75 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
76
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
77 // Because of the requirement of keeping "_offsets" up to date with the
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
78 // allocations, we sequentialize these with a lock. Therefore, best if
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
79 // this is used for larger LAB allocations only.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
80 inline HeapWord* G1OffsetTableContigSpace::par_allocate(size_t size) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
81 MutexLocker x(&_par_alloc_lock);
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
82 return allocate(size);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
83 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
84
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
85 inline HeapWord* G1OffsetTableContigSpace::block_start(const void* p) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
86 return _offsets.block_start(p);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
87 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
88
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
89 inline HeapWord*
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
90 G1OffsetTableContigSpace::block_start_const(const void* p) const {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
91 return _offsets.block_start_const(p);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
92 }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
93
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
94 inline bool
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
95 HeapRegion::block_is_obj(const HeapWord* p) const {
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
96 G1CollectedHeap* g1h = G1CollectedHeap::heap();
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
97 return !g1h->is_obj_dead(oop(p), this);
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
98 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
99
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
100 inline size_t
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
101 HeapRegion::block_size(const HeapWord *addr) const {
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
102 // Old regions' dead objects may have dead classes
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
103 // We need to find the next live object in some other
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
104 // manner than getting the oop size
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
105 G1CollectedHeap* g1h = G1CollectedHeap::heap();
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
106 if (g1h->is_obj_dead(oop(addr), this)) {
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
107 HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()->
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
108 getNextMarkedWordAddress(addr, prev_top_at_mark_start());
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
109
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
110 assert(next > addr, "must get the next live object");
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
111
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
112 return pointer_delta(next, addr);
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
113 } else if (addr == top()) {
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
114 return pointer_delta(end(), addr);
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
115 }
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
116 return oop(addr)->size();
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
117 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
118
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
119 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t word_size) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
120 assert(is_young(), "we can only skip BOT updates on young regions");
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
121 return par_allocate_impl(word_size, end());
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
122 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
123
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
124 inline HeapWord* HeapRegion::allocate_no_bot_updates(size_t word_size) {
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
125 assert(is_young(), "we can only skip BOT updates on young regions");
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
126 return allocate_impl(word_size, end());
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
127 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
128
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
129 inline void HeapRegion::note_start_of_marking() {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
130 _next_marked_bytes = 0;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
131 _next_top_at_mark_start = top();
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
132 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
133
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
134 inline void HeapRegion::note_end_of_marking() {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
135 _prev_top_at_mark_start = _next_top_at_mark_start;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
136 _prev_marked_bytes = _next_marked_bytes;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
137 _next_marked_bytes = 0;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
138
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
139 assert(_prev_marked_bytes <=
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
140 (size_t) pointer_delta(prev_top_at_mark_start(), bottom()) *
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
141 HeapWordSize, "invariant");
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
142 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
143
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
144 inline void HeapRegion::note_start_of_copying(bool during_initial_mark) {
4837
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
145 if (is_survivor()) {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
146 // This is how we always allocate survivors.
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
147 assert(_next_top_at_mark_start == bottom(), "invariant");
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
148 } else {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
149 if (during_initial_mark) {
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
150 // During initial-mark we'll explicitly mark any objects on old
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
151 // regions that are pointed to by roots. Given that explicit
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
152 // marks only make sense under NTAMS it'd be nice if we could
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
153 // check that condition if we wanted to. Given that we don't
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
154 // know where the top of this region will end up, we simply set
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
155 // NTAMS to the end of the region so all marks will be below
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
156 // NTAMS. We'll set it to the actual top when we retire this region.
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
157 _next_top_at_mark_start = end();
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
158 } else {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
159 // We could have re-used this old region as to-space over a
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
160 // couple of GCs since the start of the concurrent marking
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
161 // cycle. This means that [bottom,NTAMS) will contain objects
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
162 // copied up to and including initial-mark and [NTAMS, top)
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
163 // will contain objects copied during the concurrent marking cycle.
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
164 assert(top() >= _next_top_at_mark_start, "invariant");
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
165 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
166 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
167 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
168
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
169 inline void HeapRegion::note_end_of_copying(bool during_initial_mark) {
4837
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
170 if (is_survivor()) {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
171 // This is how we always allocate survivors.
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
172 assert(_next_top_at_mark_start == bottom(), "invariant");
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
173 } else {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
174 if (during_initial_mark) {
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
175 // See the comment for note_start_of_copying() for the details
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
176 // on this.
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
177 assert(_next_top_at_mark_start == end(), "pre-condition");
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
178 _next_top_at_mark_start = top();
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
179 } else {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
180 // See the comment for note_start_of_copying() for the details
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
181 // on this.
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
182 assert(top() >= _next_top_at_mark_start, "invariant");
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
183 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
184 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
185 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
186
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
187 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP