annotate src/share/vm/gc_implementation/g1/heapRegion.inline.hpp @ 20417:d35872270666

8057658: Enable G1 FullGC extensions Summary: Refactored the G1 FullGC code to enable it to be extended. Reviewed-by: mgerdin, brutisso
author sjohanss
date Tue, 09 Sep 2014 00:05:25 +0200
parents f3aeae1f9fc5
children
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();
20282
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
97 if (ClassUnloadingWithConcurrentMark) {
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
98 return !g1h->is_obj_dead(oop(p), this);
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
99 }
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
100 return p < top();
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
101 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
102
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
103 inline size_t
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
104 HeapRegion::block_size(const HeapWord *addr) const {
20282
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
105 if (addr == top()) {
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
106 return pointer_delta(end(), addr);
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
107 }
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
108
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
109 if (block_is_obj(addr)) {
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
110 return oop(addr)->size();
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
111 }
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
112
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
113 assert(ClassUnloadingWithConcurrentMark,
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
114 err_msg("All blocks should be objects if G1 Class Unloading isn't used. "
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
115 "HR: ["PTR_FORMAT", "PTR_FORMAT", "PTR_FORMAT") "
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
116 "addr: " PTR_FORMAT,
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
117 p2i(bottom()), p2i(top()), p2i(end()), p2i(addr)));
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
118
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
119 // Old regions' dead objects may have dead classes
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
120 // 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
121 // manner than getting the oop size
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
122 G1CollectedHeap* g1h = G1CollectedHeap::heap();
20282
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
123 HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()->
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
124 getNextMarkedWordAddress(addr, prev_top_at_mark_start());
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 20276
diff changeset
125
20282
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
126 assert(next > addr, "must get the next live object");
f3aeae1f9fc5 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 20278
diff changeset
127 return pointer_delta(next, addr);
20276
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
128 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
129
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
130 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
131 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
132 return par_allocate_impl(word_size, end());
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
133 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
134
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
135 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
136 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
137 return allocate_impl(word_size, end());
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
138 }
1526a938e670 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 20273
diff changeset
139
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
140 inline void HeapRegion::note_start_of_marking() {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
141 _next_marked_bytes = 0;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
142 _next_top_at_mark_start = top();
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
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
145 inline void HeapRegion::note_end_of_marking() {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
146 _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
147 _prev_marked_bytes = _next_marked_bytes;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
148 _next_marked_bytes = 0;
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
149
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
150 assert(_prev_marked_bytes <=
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
151 (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
152 HeapWordSize, "invariant");
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
153 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
154
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
155 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
156 if (is_survivor()) {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
157 // This is how we always allocate survivors.
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
158 assert(_next_top_at_mark_start == bottom(), "invariant");
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
159 } else {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
160 if (during_initial_mark) {
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
161 // 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
162 // 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
163 // 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
164 // 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
165 // 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
166 // 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
167 // 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
168 _next_top_at_mark_start = end();
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
169 } else {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
170 // 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
171 // 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
172 // 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
173 // 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
174 // 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
175 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
176 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
177 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
178 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
179
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
180 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
181 if (is_survivor()) {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
182 // This is how we always allocate survivors.
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
183 assert(_next_top_at_mark_start == bottom(), "invariant");
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
184 } else {
eff609af17d7 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 4787
diff changeset
185 if (during_initial_mark) {
4787
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
186 // 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
187 // on this.
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
188 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
189 _next_top_at_mark_start = top();
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
190 } else {
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
191 // 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
192 // on this.
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
193 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
194 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
195 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
196 }
2ace1c4ee8da 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 2433
diff changeset
197
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
198 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP