annotate src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.hpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children f69a5d43dc19
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 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1546
diff changeset
2 * Copyright (c) 2010, 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: 1552
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_PROMOTIONINFO_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_PROMOTIONINFO_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
31 // Forward declarations
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
32 class CompactibleFreeListSpace;
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 class PromotedObject VALUE_OBJ_CLASS_SPEC {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
35 private:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
36 enum {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
37 promoted_mask = right_n_bits(2), // i.e. 0x3
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
38 displaced_mark = nth_bit(2), // i.e. 0x4
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
39 next_mask = ~(right_n_bits(3)) // i.e. ~(0x7)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
40 };
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
41
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
42 // Below, we want _narrow_next in the "higher" 32 bit slot,
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
43 // whose position will depend on endian-ness of the platform.
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
44 // This is so that there is no interference with the
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
45 // cms_free_bit occupying bit position 7 (lsb == 0)
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
46 // when we are using compressed oops; see FreeChunk::isFree().
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
47 // We cannot move the cms_free_bit down because currently
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
48 // biased locking code assumes that age bits are contiguous
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
49 // with the lock bits. Even if that assumption were relaxed,
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
50 // the least position we could move this bit to would be
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
51 // to bit position 3, which would require 16 byte alignment.
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
52 typedef struct {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
53 #ifdef VM_LITTLE_ENDIAN
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
54 LP64_ONLY(narrowOop _pad;)
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
55 narrowOop _narrow_next;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
56 #else
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
57 narrowOop _narrow_next;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
58 LP64_ONLY(narrowOop _pad;)
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
59 #endif
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
60 } Data;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
61
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
62 union {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
63 intptr_t _next;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
64 Data _data;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
65 };
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
66 public:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
67 inline PromotedObject* next() const {
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
68 assert(!((FreeChunk*)this)->isFree(), "Error");
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
69 PromotedObject* res;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
70 if (UseCompressedOops) {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
71 // The next pointer is a compressed oop stored in the top 32 bits
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
72 res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next);
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
73 } else {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
74 res = (PromotedObject*)(_next & next_mask);
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
75 }
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
76 assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Not an oop?");
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
77 return res;
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
78 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
79 inline void setNext(PromotedObject* x) {
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
80 assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, "
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
81 "or insufficient alignment of objects");
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
82 if (UseCompressedOops) {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
83 assert(_data._narrow_next == 0, "Overwrite?");
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
84 _data._narrow_next = oopDesc::encode_heap_oop(oop(x));
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
85 } else {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
86 _next |= (intptr_t)x;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
87 }
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
88 assert(!((FreeChunk*)this)->isFree(), "Error");
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
89 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
90 inline void setPromotedMark() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
91 _next |= promoted_mask;
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
92 assert(!((FreeChunk*)this)->isFree(), "Error");
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
93 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
94 inline bool hasPromotedMark() const {
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
95 assert(!((FreeChunk*)this)->isFree(), "Error");
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
96 return (_next & promoted_mask) == promoted_mask;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
97 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
98 inline void setDisplacedMark() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
99 _next |= displaced_mark;
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
100 assert(!((FreeChunk*)this)->isFree(), "Error");
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
101 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
102 inline bool hasDisplacedMark() const {
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
103 assert(!((FreeChunk*)this)->isFree(), "Error");
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
104 return (_next & displaced_mark) != 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
105 }
1546
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
106 inline void clearNext() {
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
107 _next = 0;
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
108 assert(!((FreeChunk*)this)->isFree(), "Error");
a00b51b2dda4 6948539: CMS+UseCompressedOops: placement of cms_free bit interferes with promoted object link
ysr
parents: 1521
diff changeset
109 }
1521
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
110 debug_only(void *next_addr() { return (void *) &_next; })
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
111 };
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
112
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
113 class SpoolBlock: public FreeChunk {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
114 friend class PromotionInfo;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
115 protected:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
116 SpoolBlock* nextSpoolBlock;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
117 size_t bufferSize; // number of usable words in this block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
118 markOop* displacedHdr; // the displaced headers start here
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
119
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
120 // Note about bufferSize: it denotes the number of entries available plus 1;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
121 // legal indices range from 1 through BufferSize - 1. See the verification
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
122 // code verify() that counts the number of displaced headers spooled.
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
123 size_t computeBufferSize() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
124 return (size() * sizeof(HeapWord) - sizeof(*this)) / sizeof(markOop);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
125 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
126
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
127 public:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
128 void init() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
129 bufferSize = computeBufferSize();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
130 displacedHdr = (markOop*)&displacedHdr;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
131 nextSpoolBlock = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
132 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
133
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
134 void print_on(outputStream* st) const;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
135 void print() const { print_on(gclog_or_tty); }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
136 };
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
137
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
138 class PromotionInfo VALUE_OBJ_CLASS_SPEC {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
139 bool _tracking; // set if tracking
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
140 CompactibleFreeListSpace* _space; // the space to which this belongs
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
141 PromotedObject* _promoHead; // head of list of promoted objects
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
142 PromotedObject* _promoTail; // tail of list of promoted objects
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
143 SpoolBlock* _spoolHead; // first spooling block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
144 SpoolBlock* _spoolTail; // last non-full spooling block or null
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
145 SpoolBlock* _splice_point; // when _spoolTail is null, holds list tail
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
146 SpoolBlock* _spareSpool; // free spool buffer
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
147 size_t _firstIndex; // first active index in
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
148 // first spooling block (_spoolHead)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
149 size_t _nextIndex; // last active index + 1 in last
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
150 // spooling block (_spoolTail)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
151 private:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
152 // ensure that spooling space exists; return true if there is spooling space
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
153 bool ensure_spooling_space_work();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
154
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
155 public:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
156 PromotionInfo() :
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
157 _tracking(0), _space(NULL),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
158 _promoHead(NULL), _promoTail(NULL),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
159 _spoolHead(NULL), _spoolTail(NULL),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
160 _spareSpool(NULL), _firstIndex(1),
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
161 _nextIndex(1) {}
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
162
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
163 bool noPromotions() const {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
164 assert(_promoHead != NULL || _promoTail == NULL, "list inconsistency");
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
165 return _promoHead == NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
166 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
167 void startTrackingPromotions();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
168 void stopTrackingPromotions(uint worker_id = 0);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
169 bool tracking() const { return _tracking; }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
170 void track(PromotedObject* trackOop); // keep track of a promoted oop
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
171 // The following variant must be used when trackOop is not fully
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
172 // initialized and has a NULL klass:
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
173 void track(PromotedObject* trackOop, klassOop klassOfOop); // keep track of a promoted oop
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
174 void setSpace(CompactibleFreeListSpace* sp) { _space = sp; }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
175 CompactibleFreeListSpace* space() const { return _space; }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
176 markOop nextDisplacedHeader(); // get next header & forward spool pointer
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
177 void saveDisplacedHeader(markOop hdr);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
178 // save header and forward spool
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
179
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
180 inline size_t refillSize() const;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
181
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
182 SpoolBlock* getSpoolBlock(); // return a free spooling block
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
183 inline bool has_spooling_space() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
184 return _spoolTail != NULL && _spoolTail->bufferSize > _nextIndex;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
185 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
186 // ensure that spooling space exists
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
187 bool ensure_spooling_space() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
188 return has_spooling_space() || ensure_spooling_space_work();
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
189 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
190 #define PROMOTED_OOPS_ITERATE_DECL(OopClosureType, nv_suffix) \
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
191 void promoted_oops_iterate##nv_suffix(OopClosureType* cl);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
192 ALL_SINCE_SAVE_MARKS_CLOSURES(PROMOTED_OOPS_ITERATE_DECL)
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
193 #undef PROMOTED_OOPS_ITERATE_DECL
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
194 void promoted_oops_iterate(OopsInGenClosure* cl) {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
195 promoted_oops_iterate_v(cl);
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
196 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
197 void verify() const;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
198 void reset() {
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
199 _promoHead = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
200 _promoTail = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
201 _spoolHead = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
202 _spoolTail = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
203 _spareSpool = NULL;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
204 _firstIndex = 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
205 _nextIndex = 0;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
206
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
207 }
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
208
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
209 void print_on(outputStream* st) const;
a8127dc669ba 6951188: CMS: move PromotionInfo into its own file
ysr
parents:
diff changeset
210 void print_statistics(uint worker_id) const;
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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
213
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
214 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_PROMOTIONINFO_HPP