annotate src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 78bbf4d43a14
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
1 /*
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
4 *
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
7 * published by the Free Software Foundation.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
8 *
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
13 * accompanied this code).
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
14 *
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1546
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1546
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: 1546
diff changeset
21 * questions.
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
22 *
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
23 */
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1777
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1777
diff changeset
26 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1777
diff changeset
27 #include "gc_implementation/concurrentMarkSweep/promotionInfo.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1777
diff changeset
28 #include "oops/markOop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1777
diff changeset
29 #include "oops/oop.inline.hpp"
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
30
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
31 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
32
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
33 /////////////////////////////////////////////////////////////////////////
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
34 //// PromotionInfo
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
35 /////////////////////////////////////////////////////////////////////////
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
36
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
37
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
38 //////////////////////////////////////////////////////////////////////////////
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
39 // We go over the list of promoted objects, removing each from the list,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
40 // and applying the closure (this may, in turn, add more elements to
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
41 // the tail of the promoted list, and these newly added objects will
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
42 // also be processed) until the list is empty.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
43 // To aid verification and debugging, in the non-product builds
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
44 // we actually forward _promoHead each time we process a promoted oop.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
45 // Note that this is not necessary in general (i.e. when we don't need to
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
46 // call PromotionInfo::verify()) because oop_iterate can only add to the
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
47 // end of _promoTail, and never needs to look at _promoHead.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
48
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
49 #define PROMOTED_OOPS_ITERATE_DEFN(OopClosureType, nv_suffix) \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
50 \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
51 void PromotionInfo::promoted_oops_iterate##nv_suffix(OopClosureType* cl) { \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
52 NOT_PRODUCT(verify()); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
53 PromotedObject *curObj, *nextObj; \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
54 for (curObj = _promoHead; curObj != NULL; curObj = nextObj) { \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
55 if ((nextObj = curObj->next()) == NULL) { \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
56 /* protect ourselves against additions due to closure application \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
57 below by resetting the list. */ \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
58 assert(_promoTail == curObj, "Should have been the tail"); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
59 _promoHead = _promoTail = NULL; \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
60 } \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
61 if (curObj->hasDisplacedMark()) { \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
62 /* restore displaced header */ \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
63 oop(curObj)->set_mark(nextDisplacedHeader()); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
64 } else { \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
65 /* restore prototypical header */ \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
66 oop(curObj)->init_mark(); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
67 } \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
68 /* The "promoted_mark" should now not be set */ \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
69 assert(!curObj->hasPromotedMark(), \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
70 "Should have been cleared by restoring displaced mark-word"); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
71 NOT_PRODUCT(_promoHead = nextObj); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
72 if (cl != NULL) oop(curObj)->oop_iterate(cl); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
73 if (nextObj == NULL) { /* start at head of list reset above */ \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
74 nextObj = _promoHead; \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
75 } \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
76 } \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
77 assert(noPromotions(), "post-condition violation"); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
78 assert(_promoHead == NULL && _promoTail == NULL, "emptied promoted list");\
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
79 assert(_spoolHead == _spoolTail, "emptied spooling buffers"); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
80 assert(_firstIndex == _nextIndex, "empty buffer"); \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
81 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
82
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
83 // This should have been ALL_SINCE_...() just like the others,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
84 // but, because the body of the method above is somehwat longer,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
85 // the MSVC compiler cannot cope; as a workaround, we split the
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
86 // macro into its 3 constituent parts below (see original macro
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
87 // definition in specializedOopClosures.hpp).
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
88 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(PROMOTED_OOPS_ITERATE_DEFN)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
89 PROMOTED_OOPS_ITERATE_DEFN(OopsInGenClosure,_v)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
90
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
91
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
92 // Return the next displaced header, incrementing the pointer and
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
93 // recycling spool area as necessary.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
94 markOop PromotionInfo::nextDisplacedHeader() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
95 assert(_spoolHead != NULL, "promotionInfo inconsistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
96 assert(_spoolHead != _spoolTail || _firstIndex < _nextIndex,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
97 "Empty spool space: no displaced header can be fetched");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
98 assert(_spoolHead->bufferSize > _firstIndex, "Off by one error at head?");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
99 markOop hdr = _spoolHead->displacedHdr[_firstIndex];
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
100 // Spool forward
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
101 if (++_firstIndex == _spoolHead->bufferSize) { // last location in this block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
102 // forward to next block, recycling this block into spare spool buffer
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
103 SpoolBlock* tmp = _spoolHead->nextSpoolBlock;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
104 assert(_spoolHead != _spoolTail, "Spooling storage mix-up");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
105 _spoolHead->nextSpoolBlock = _spareSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
106 _spareSpool = _spoolHead;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
107 _spoolHead = tmp;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
108 _firstIndex = 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
109 NOT_PRODUCT(
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
110 if (_spoolHead == NULL) { // all buffers fully consumed
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
111 assert(_spoolTail == NULL && _nextIndex == 1,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
112 "spool buffers processing inconsistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
113 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
114 )
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
115 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
116 return hdr;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
117 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
118
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
119 void PromotionInfo::track(PromotedObject* trackOop) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
120 track(trackOop, oop(trackOop)->klass());
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
121 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
122
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6028
diff changeset
123 void PromotionInfo::track(PromotedObject* trackOop, Klass* klassOfOop) {
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
124 // make a copy of header as it may need to be spooled
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
125 markOop mark = oop(trackOop)->mark();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 1972
diff changeset
126 trackOop->clear_next();
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
127 if (mark->must_be_preserved_for_cms_scavenge(klassOfOop)) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
128 // save non-prototypical header, and mark oop
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
129 saveDisplacedHeader(mark);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
130 trackOop->setDisplacedMark();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
131 } else {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
132 // we'd like to assert something like the following:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
133 // assert(mark == markOopDesc::prototype(), "consistency check");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
134 // ... but the above won't work because the age bits have not (yet) been
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
135 // cleared. The remainder of the check would be identical to the
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
136 // condition checked in must_be_preserved() above, so we don't really
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
137 // have anything useful to check here!
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
138 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
139 if (_promoTail != NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
140 assert(_promoHead != NULL, "List consistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
141 _promoTail->setNext(trackOop);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
142 _promoTail = trackOop;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
143 } else {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
144 assert(_promoHead == NULL, "List consistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
145 _promoHead = _promoTail = trackOop;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
146 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
147 // Mask as newly promoted, so we can skip over such objects
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
148 // when scanning dirty cards
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
149 assert(!trackOop->hasPromotedMark(), "Should not have been marked");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
150 trackOop->setPromotedMark();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
151 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
152
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
153 // Save the given displaced header, incrementing the pointer and
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
154 // obtaining more spool area as necessary.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
155 void PromotionInfo::saveDisplacedHeader(markOop hdr) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
156 assert(_spoolHead != NULL && _spoolTail != NULL,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
157 "promotionInfo inconsistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
158 assert(_spoolTail->bufferSize > _nextIndex, "Off by one error at tail?");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
159 _spoolTail->displacedHdr[_nextIndex] = hdr;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
160 // Spool forward
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
161 if (++_nextIndex == _spoolTail->bufferSize) { // last location in this block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
162 // get a new spooling block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
163 assert(_spoolTail->nextSpoolBlock == NULL, "tail should terminate spool list");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
164 _splice_point = _spoolTail; // save for splicing
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
165 _spoolTail->nextSpoolBlock = getSpoolBlock(); // might fail
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
166 _spoolTail = _spoolTail->nextSpoolBlock; // might become NULL ...
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
167 // ... but will attempt filling before next promotion attempt
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
168 _nextIndex = 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
169 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
170 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
171
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
172 // Ensure that spooling space exists. Return false if spooling space
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
173 // could not be obtained.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
174 bool PromotionInfo::ensure_spooling_space_work() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
175 assert(!has_spooling_space(), "Only call when there is no spooling space");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
176 // Try and obtain more spooling space
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
177 SpoolBlock* newSpool = getSpoolBlock();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
178 assert(newSpool == NULL ||
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
179 (newSpool->bufferSize != 0 && newSpool->nextSpoolBlock == NULL),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
180 "getSpoolBlock() sanity check");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
181 if (newSpool == NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
182 return false;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
183 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
184 _nextIndex = 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
185 if (_spoolTail == NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
186 _spoolTail = newSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
187 if (_spoolHead == NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
188 _spoolHead = newSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
189 _firstIndex = 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
190 } else {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
191 assert(_splice_point != NULL && _splice_point->nextSpoolBlock == NULL,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
192 "Splice point invariant");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
193 // Extra check that _splice_point is connected to list
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
194 #ifdef ASSERT
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
195 {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
196 SpoolBlock* blk = _spoolHead;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
197 for (; blk->nextSpoolBlock != NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
198 blk = blk->nextSpoolBlock);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
199 assert(blk != NULL && blk == _splice_point,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
200 "Splice point incorrect");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
201 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
202 #endif // ASSERT
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
203 _splice_point->nextSpoolBlock = newSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
204 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
205 } else {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
206 assert(_spoolHead != NULL, "spool list consistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
207 _spoolTail->nextSpoolBlock = newSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
208 _spoolTail = newSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
209 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
210 return true;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
211 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
212
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
213 // Get a free spool buffer from the free pool, getting a new block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
214 // from the heap if necessary.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
215 SpoolBlock* PromotionInfo::getSpoolBlock() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
216 SpoolBlock* res;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
217 if ((res = _spareSpool) != NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
218 _spareSpool = _spareSpool->nextSpoolBlock;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
219 res->nextSpoolBlock = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
220 } else { // spare spool exhausted, get some from heap
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
221 res = (SpoolBlock*)(space()->allocateScratch(refillSize()));
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
222 if (res != NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
223 res->init();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
224 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
225 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
226 assert(res == NULL || res->nextSpoolBlock == NULL, "postcondition");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
227 return res;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
228 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
229
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
230 void PromotionInfo::startTrackingPromotions() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
231 assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
232 "spooling inconsistency?");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
233 _firstIndex = _nextIndex = 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
234 _tracking = true;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
235 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
236
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
237 #define CMSPrintPromoBlockInfo 1
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
238
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
239 void PromotionInfo::stopTrackingPromotions(uint worker_id) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
240 assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
241 "spooling inconsistency?");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
242 _firstIndex = _nextIndex = 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
243 _tracking = false;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
244 if (CMSPrintPromoBlockInfo > 1) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
245 print_statistics(worker_id);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
246 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
247 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
248
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
249 void PromotionInfo::print_statistics(uint worker_id) const {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
250 assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
251 "Else will undercount");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
252 assert(CMSPrintPromoBlockInfo > 0, "Else unnecessary call");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
253 // Count the number of blocks and slots in the free pool
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
254 size_t slots = 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
255 size_t blocks = 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
256 for (SpoolBlock* cur_spool = _spareSpool;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
257 cur_spool != NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
258 cur_spool = cur_spool->nextSpoolBlock) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
259 // the first entry is just a self-pointer; indices 1 through
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
260 // bufferSize - 1 are occupied (thus, bufferSize - 1 slots).
1777
179464550c7d 6983930: CMS: Various small cleanups ca September 2010
ysr
parents: 1716
diff changeset
261 assert((void*)cur_spool->displacedHdr == (void*)&cur_spool->displacedHdr,
179464550c7d 6983930: CMS: Various small cleanups ca September 2010
ysr
parents: 1716
diff changeset
262 "first entry of displacedHdr should be self-referential");
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
263 slots += cur_spool->bufferSize - 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
264 blocks++;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
265 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
266 if (_spoolHead != NULL) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
267 slots += _spoolHead->bufferSize - 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
268 blocks++;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
269 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
270 gclog_or_tty->print_cr(" [worker %d] promo_blocks = %d, promo_slots = %d ",
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
271 worker_id, blocks, slots);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
272 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
273
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
274 // When _spoolTail is not NULL, then the slot <_spoolTail, _nextIndex>
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
275 // points to the next slot available for filling.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
276 // The set of slots holding displaced headers are then all those in the
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
277 // right-open interval denoted by:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
278 //
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
279 // [ <_spoolHead, _firstIndex>, <_spoolTail, _nextIndex> )
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
280 //
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
281 // When _spoolTail is NULL, then the set of slots with displaced headers
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
282 // is all those starting at the slot <_spoolHead, _firstIndex> and
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
283 // going up to the last slot of last block in the linked list.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
284 // In this lartter case, _splice_point points to the tail block of
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
285 // this linked list of blocks holding displaced headers.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
286 void PromotionInfo::verify() const {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
287 // Verify the following:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
288 // 1. the number of displaced headers matches the number of promoted
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
289 // objects that have displaced headers
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
290 // 2. each promoted object lies in this space
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
291 debug_only(
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
292 PromotedObject* junk = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
293 assert(junk->next_addr() == (void*)(oop(junk)->mark_addr()),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
294 "Offset of PromotedObject::_next is expected to align with "
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
295 " the OopDesc::_mark within OopDesc");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
296 )
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
297 // FIXME: guarantee????
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
298 guarantee(_spoolHead == NULL || _spoolTail != NULL ||
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
299 _splice_point != NULL, "list consistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
300 guarantee(_promoHead == NULL || _promoTail != NULL, "list consistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
301 // count the number of objects with displaced headers
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
302 size_t numObjsWithDisplacedHdrs = 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
303 for (PromotedObject* curObj = _promoHead; curObj != NULL; curObj = curObj->next()) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
304 guarantee(space()->is_in_reserved((HeapWord*)curObj), "Containment");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
305 // the last promoted object may fail the mark() != NULL test of is_oop().
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
306 guarantee(curObj->next() == NULL || oop(curObj)->is_oop(), "must be an oop");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
307 if (curObj->hasDisplacedMark()) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
308 numObjsWithDisplacedHdrs++;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
309 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
310 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
311 // Count the number of displaced headers
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
312 size_t numDisplacedHdrs = 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
313 for (SpoolBlock* curSpool = _spoolHead;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
314 curSpool != _spoolTail && curSpool != NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
315 curSpool = curSpool->nextSpoolBlock) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
316 // the first entry is just a self-pointer; indices 1 through
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
317 // bufferSize - 1 are occupied (thus, bufferSize - 1 slots).
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
318 guarantee((void*)curSpool->displacedHdr == (void*)&curSpool->displacedHdr,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
319 "first entry of displacedHdr should be self-referential");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
320 numDisplacedHdrs += curSpool->bufferSize - 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
321 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
322 guarantee((_spoolHead == _spoolTail) == (numDisplacedHdrs == 0),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
323 "internal consistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
324 guarantee(_spoolTail != NULL || _nextIndex == 1,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
325 "Inconsistency between _spoolTail and _nextIndex");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
326 // We overcounted (_firstIndex-1) worth of slots in block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
327 // _spoolHead and we undercounted (_nextIndex-1) worth of
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
328 // slots in block _spoolTail. We make an appropriate
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
329 // adjustment by subtracting the first and adding the
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
330 // second: - (_firstIndex - 1) + (_nextIndex - 1)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
331 numDisplacedHdrs += (_nextIndex - _firstIndex);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
332 guarantee(numDisplacedHdrs == numObjsWithDisplacedHdrs, "Displaced hdr count");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
333 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
334
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
335 void PromotionInfo::print_on(outputStream* st) const {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
336 SpoolBlock* curSpool = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
337 size_t i = 0;
1716
be3f9c242c9d 6948538: CMS: BOT walkers can fall into object allocation and initialization cracks
ysr
parents: 1552
diff changeset
338 st->print_cr(" start & end indices: [" SIZE_FORMAT ", " SIZE_FORMAT ")",
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
339 _firstIndex, _nextIndex);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
340 for (curSpool = _spoolHead; curSpool != _spoolTail && curSpool != NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
341 curSpool = curSpool->nextSpoolBlock) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
342 curSpool->print_on(st);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
343 st->print_cr(" active ");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
344 i++;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
345 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
346 for (curSpool = _spoolTail; curSpool != NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
347 curSpool = curSpool->nextSpoolBlock) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
348 curSpool->print_on(st);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
349 st->print_cr(" inactive ");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
350 i++;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
351 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
352 for (curSpool = _spareSpool; curSpool != NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
353 curSpool = curSpool->nextSpoolBlock) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
354 curSpool->print_on(st);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
355 st->print_cr(" free ");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
356 i++;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
357 }
1716
be3f9c242c9d 6948538: CMS: BOT walkers can fall into object allocation and initialization cracks
ysr
parents: 1552
diff changeset
358 st->print_cr(" " SIZE_FORMAT " header spooling blocks", i);
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
359 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
360
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
361 void SpoolBlock::print_on(outputStream* st) const {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
362 st->print("[" PTR_FORMAT "," PTR_FORMAT "), " SIZE_FORMAT " HeapWords -> " PTR_FORMAT,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
363 this, (HeapWord*)displacedHdr + bufferSize,
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
364 bufferSize, nextSpoolBlock);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
365 }