Mercurial > hg > truffle
annotate src/share/vm/oops/cpCacheKlass.cpp @ 3518:0ffcce571d09
Remove a Sysout debug message
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Tue, 09 Aug 2011 13:48:46 +0200 |
parents | c7f3d0b4570f |
children | baf763f388e6 |
rev | line source |
---|---|
0 | 1 /* |
2227 | 2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
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:
1155
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | |
27 #include "gc_implementation/shared/markSweep.inline.hpp" | |
28 #include "gc_interface/collectedHeap.hpp" | |
29 #include "interpreter/bytecodes.hpp" | |
30 #include "memory/genOopClosures.inline.hpp" | |
31 #include "memory/permGen.hpp" | |
32 #include "oops/constantPoolOop.hpp" | |
33 #include "oops/cpCacheKlass.hpp" | |
34 #include "oops/oop.inline.hpp" | |
35 #include "runtime/handles.inline.hpp" | |
36 #ifndef SERIALGC | |
37 #include "gc_implementation/parNew/parOopClosures.inline.hpp" | |
38 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" | |
39 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" | |
40 #include "memory/cardTableRS.hpp" | |
41 #include "oops/oop.pcgc.inline.hpp" | |
42 #endif | |
0 | 43 |
44 | |
45 int constantPoolCacheKlass::oop_size(oop obj) const { | |
46 assert(obj->is_constantPoolCache(), "must be constantPool"); | |
47 return constantPoolCacheOop(obj)->object_size(); | |
48 } | |
49 | |
50 | |
542
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
51 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, |
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
52 TRAPS) { |
0 | 53 // allocate memory |
54 int size = constantPoolCacheOopDesc::object_size(length); | |
542
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
55 |
0 | 56 KlassHandle klass (THREAD, as_klassOop()); |
542
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
57 |
2226
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
58 // Commented out below is the original code. The code from |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
59 // permanent_obj_allocate() was in-lined so that we could |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
60 // set the _length field, necessary to correctly compute its |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
61 // size(), before setting its klass word further below. |
542
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
62 // constantPoolCacheOop cache = (constantPoolCacheOop) |
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
63 // CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); |
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
64 |
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
65 oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL); |
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
66 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj, |
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
67 size)); |
2226
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
68 constantPoolCacheOop cache = (constantPoolCacheOop) obj; |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
69 assert(!UseConcMarkSweepGC || obj->klass_or_null() == NULL, |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
70 "klass should be NULL here when using CMS"); |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
71 cache->set_length(length); // should become visible before klass is set below. |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
72 cache->set_constant_pool(NULL); |
542
9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents:
196
diff
changeset
|
73 |
2226
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
74 OrderAccess::storestore(); |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
75 obj->set_klass(klass()); |
c5a923563727
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
1972
diff
changeset
|
76 assert(cache->size() == size, "Incorrect cache->size()"); |
0 | 77 return cache; |
78 } | |
79 | |
80 klassOop constantPoolCacheKlass::create_klass(TRAPS) { | |
81 constantPoolCacheKlass o; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
82 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
83 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 // Make sure size calculation is right |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 assert(k()->size() == align_object_size(header_size()), "wrong size for object"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
86 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror |
0 | 87 return k(); |
88 } | |
89 | |
90 | |
91 void constantPoolCacheKlass::oop_follow_contents(oop obj) { | |
92 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
93 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
94 // Performance tweak: We skip iterating over the klass pointer since we | |
95 // know that Universe::constantPoolCacheKlassObj never moves. | |
96 // gc of constant pool cache instance variables | |
97 MarkSweep::mark_and_push((oop*)cache->constant_pool_addr()); | |
98 // gc of constant pool cache entries | |
99 int i = cache->length(); | |
100 while (i-- > 0) cache->entry_at(i)->follow_contents(); | |
101 } | |
102 | |
103 #ifndef SERIALGC | |
104 void constantPoolCacheKlass::oop_follow_contents(ParCompactionManager* cm, | |
105 oop obj) { | |
106 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
107 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
108 // Performance tweak: We skip iterating over the klass pointer since we | |
109 // know that Universe::constantPoolCacheKlassObj never moves. | |
110 // gc of constant pool cache instance variables | |
111 PSParallelCompact::mark_and_push(cm, (oop*)cache->constant_pool_addr()); | |
112 // gc of constant pool cache entries | |
113 int i = cache->length(); | |
114 while (i-- > 0) cache->entry_at(i)->follow_contents(cm); | |
115 } | |
116 #endif // SERIALGC | |
117 | |
118 | |
119 int constantPoolCacheKlass::oop_oop_iterate(oop obj, OopClosure* blk) { | |
120 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
121 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
122 // Get size before changing pointers. | |
123 // Don't call size() or oop_size() since that is a virtual call. | |
124 int size = cache->object_size(); | |
125 // Performance tweak: We skip iterating over the klass pointer since we | |
126 // know that Universe::constantPoolCacheKlassObj never moves. | |
127 // iteration over constant pool cache instance variables | |
128 blk->do_oop((oop*)cache->constant_pool_addr()); | |
129 // iteration over constant pool cache entries | |
130 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate(blk); | |
131 return size; | |
132 } | |
133 | |
134 | |
135 int constantPoolCacheKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
136 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
137 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
138 // Get size before changing pointers. | |
139 // Don't call size() or oop_size() since that is a virtual call. | |
140 int size = cache->object_size(); | |
141 // Performance tweak: We skip iterating over the klass pointer since we | |
142 // know that Universe::constantPoolCacheKlassObj never moves. | |
143 // iteration over constant pool cache instance variables | |
144 oop* addr = (oop*)cache->constant_pool_addr(); | |
145 if (mr.contains(addr)) blk->do_oop(addr); | |
146 // iteration over constant pool cache entries | |
147 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate_m(blk, mr); | |
148 return size; | |
149 } | |
150 | |
151 int constantPoolCacheKlass::oop_adjust_pointers(oop obj) { | |
152 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
153 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
154 // Get size before changing pointers. | |
155 // Don't call size() or oop_size() since that is a virtual call. | |
156 int size = cache->object_size(); | |
157 // Performance tweak: We skip iterating over the klass pointer since we | |
158 // know that Universe::constantPoolCacheKlassObj never moves. | |
159 // Iteration over constant pool cache instance variables | |
160 MarkSweep::adjust_pointer((oop*)cache->constant_pool_addr()); | |
161 // iteration over constant pool cache entries | |
162 for (int i = 0; i < cache->length(); i++) | |
163 cache->entry_at(i)->adjust_pointers(); | |
164 return size; | |
165 } | |
166 | |
167 #ifndef SERIALGC | |
168 void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm, | |
169 oop obj) { | |
170 assert(obj->is_constantPoolCache(), "should be constant pool"); | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
171 if (ScavengeRootsInCode) { |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
172 constantPoolCacheOop cache = (constantPoolCacheOop)obj; |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
173 // during a scavenge, it is safe to inspect my pool, since it is perm |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
174 constantPoolOop pool = cache->constant_pool(); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
175 assert(pool->is_constantPool(), "should be constant pool"); |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
176 for (int i = 0; i < cache->length(); i++) { |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
177 ConstantPoolCacheEntry* e = cache->entry_at(i); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
178 oop* p = (oop*)&e->_f1; |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
179 if (PSScavenge::should_scavenge(p)) |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
180 pm->claim_or_forward_depth(p); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
181 assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)), |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2227
diff
changeset
|
182 "no live oops here"); |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
183 } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
184 } |
0 | 185 } |
186 | |
187 int | |
188 constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
189 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
190 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
191 | |
192 // Iteration over constant pool cache instance variables | |
193 PSParallelCompact::adjust_pointer((oop*)cache->constant_pool_addr()); | |
194 | |
195 // iteration over constant pool cache entries | |
196 for (int i = 0; i < cache->length(); ++i) { | |
197 cache->entry_at(i)->update_pointers(); | |
198 } | |
199 | |
200 return cache->object_size(); | |
201 } | |
202 #endif // SERIALGC | |
203 | |
204 void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) { | |
205 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
206 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
207 // super print | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
208 Klass::oop_print_on(obj, st); |
0 | 209 // print constant pool cache entries |
210 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i); | |
211 } | |
212 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
213 void constantPoolCacheKlass::oop_print_value_on(oop obj, outputStream* st) { |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
214 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
215 constantPoolCacheOop cache = (constantPoolCacheOop)obj; |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
216 st->print("cache [%d]", cache->length()); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
217 cache->print_address_on(st); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
218 st->print(" for "); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
219 cache->constant_pool()->print_value_on(st); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
220 } |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
726
diff
changeset
|
221 |
0 | 222 void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) { |
223 guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
224 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
225 // super verify | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
226 Klass::oop_verify_on(obj, st); |
0 | 227 // print constant pool cache entries |
228 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->verify(st); | |
229 } | |
230 | |
231 | |
232 const char* constantPoolCacheKlass::internal_name() const { | |
233 return "{constant pool cache}"; | |
234 } |