annotate src/share/vm/oops/constantPoolKlass.cpp @ 4137:04b9a2566eec

Merge with hsx23/hotspot.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 17 Dec 2011 21:40:27 +0100
parents c9a03402fe56
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
2227
e5383553fd4e 7014851: Remove unused parallel compaction code
stefank
parents: 2226
diff changeset
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
26 #include "classfile/javaClasses.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
27 #include "gc_implementation/shared/markSweep.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
28 #include "gc_interface/collectedHeap.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
29 #include "memory/oopFactory.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
30 #include "memory/permGen.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
31 #include "memory/universe.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
32 #include "oops/constantPoolKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
33 #include "oops/constantPoolOop.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
34 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
35 #include "oops/oop.inline2.hpp"
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
36 #include "oops/symbol.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
37 #include "runtime/handles.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
38 #ifdef TARGET_OS_FAMILY_linux
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
39 # include "thread_linux.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
40 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
41 #ifdef TARGET_OS_FAMILY_solaris
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
42 # include "thread_solaris.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
43 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
44 #ifdef TARGET_OS_FAMILY_windows
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
45 # include "thread_windows.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
46 #endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 3785
diff changeset
47 #ifdef TARGET_OS_FAMILY_bsd
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 3785
diff changeset
48 # include "thread_bsd.inline.hpp"
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 3785
diff changeset
49 #endif
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
50 #ifndef SERIALGC
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
51 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
52 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
53 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
54 #include "memory/cardTableRS.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
55 #include "oops/oop.pcgc.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
56 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
57
518
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
58 constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 int size = constantPoolOopDesc::object_size(length);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 KlassHandle klass (THREAD, as_klassOop());
2229
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
61 assert(klass()->is_oop(), "Can't be null, else handlizing of c below won't work");
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
62 constantPoolHandle pool;
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
63 {
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
64 constantPoolOop c =
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
65 (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
66 assert(c->klass_or_null() != NULL, "Handlizing below won't work");
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
67 pool = constantPoolHandle(THREAD, c);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
68 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69
2229
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
70 pool->set_length(length);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
71 pool->set_tags(NULL);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
72 pool->set_cache(NULL);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
73 pool->set_operands(NULL);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
74 pool->set_pool_holder(NULL);
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
75 pool->set_flags(0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // only set to non-zero if constant pool is merged by RedefineClasses
2229
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
77 pool->set_orig_length(0);
518
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
78 // if constant pool may change during RedefineClasses, it is created
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
79 // unsafe for GC concurrent processing.
2229
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
80 pool->set_is_conc_safe(is_conc_safe);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // all fields are initialized; needed for GC
a61af66fc99e Initial load
duke
parents:
diff changeset
82
2226
c5a923563727 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 2177
diff changeset
83 // Note: because we may be in this "conc_unsafe" state when allocating
c5a923563727 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 2177
diff changeset
84 // t_oop below, which may in turn cause a GC, it is imperative that our
c5a923563727 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 2177
diff changeset
85 // size be correct, consistent and henceforth stable, at this stage.
2229
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
86 assert(pool->is_oop() && pool->is_parsable(), "Else size() below is unreliable");
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
87 assert(size == pool->size(), "size() is wrong");
2226
c5a923563727 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 2177
diff changeset
88
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // initialize tag array
a61af66fc99e Initial load
duke
parents:
diff changeset
90 typeArrayOop t_oop = oopFactory::new_permanent_byteArray(length, CHECK_NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
91 typeArrayHandle tags (THREAD, t_oop);
a61af66fc99e Initial load
duke
parents:
diff changeset
92 for (int index = 0; index < length; index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 tags()->byte_at_put(index, JVM_CONSTANT_Invalid);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 pool->set_tags(tags());
a61af66fc99e Initial load
duke
parents:
diff changeset
96
2226
c5a923563727 6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents: 2177
diff changeset
97 // Check that our size was stable at its old value.
2229
183658a2d0b3 7018302: newly added assert related to size of constantPoolOop causes secondary assertions or crashes
ysr
parents: 2227
diff changeset
98 assert(size == pool->size(), "size() changed");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
99 return pool();
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 klassOop constantPoolKlass::create_klass(TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 constantPoolKlass o;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
104 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
105 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
106 // 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
107 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
108 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
0
a61af66fc99e Initial load
duke
parents:
diff changeset
109 return k();
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 int constantPoolKlass::oop_size(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 assert(obj->is_constantPool(), "must be constantPool");
a61af66fc99e Initial load
duke
parents:
diff changeset
114 return constantPoolOop(obj)->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void constantPoolKlass::oop_follow_contents(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
120 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // If the tags array is null we are in the middle of allocating this constant pool
a61af66fc99e Initial load
duke
parents:
diff changeset
125 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // gc of constant pool contents
a61af66fc99e Initial load
duke
parents:
diff changeset
127 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
128 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
130 if (*base != NULL) MarkSweep::mark_and_push(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // gc of constant pool instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
135 MarkSweep::mark_and_push(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
136 MarkSweep::mark_and_push(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
137 MarkSweep::mark_and_push(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
138 MarkSweep::mark_and_push(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
143 void constantPoolKlass::oop_follow_contents(ParCompactionManager* cm,
a61af66fc99e Initial load
duke
parents:
diff changeset
144 oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
146 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
152 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // gc of constant pool contents
a61af66fc99e Initial load
duke
parents:
diff changeset
154 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
155 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
157 if (*base != NULL) PSParallelCompact::mark_and_push(cm, base);
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // gc of constant pool instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
162 PSParallelCompact::mark_and_push(cm, cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
163 PSParallelCompact::mark_and_push(cm, cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
164 PSParallelCompact::mark_and_push(cm, cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
165 PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
166 }
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 int constantPoolKlass::oop_adjust_pointers(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
173 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
174 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
175 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
176 int size = cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
178 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
183 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
184 for (int i = 0; i< cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
185 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
186 MarkSweep::adjust_pointer(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
a61af66fc99e Initial load
duke
parents:
diff changeset
188 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
189 }
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191 MarkSweep::adjust_pointer(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
192 MarkSweep::adjust_pointer(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
193 MarkSweep::adjust_pointer(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
194 MarkSweep::adjust_pointer(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
195 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
196 }
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 int constantPoolKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
201 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
202 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
203 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
204 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
205 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
206 int size = cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
209 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
210 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
212 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
213 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 blk->do_oop(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
215 }
a61af66fc99e Initial load
duke
parents:
diff changeset
216 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
217 }
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 blk->do_oop(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
220 blk->do_oop(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
221 blk->do_oop(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
222 blk->do_oop(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
223 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
228 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
230 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
231 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
234 int size = cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
238 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
239 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
240 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
241 if (mr.contains(base)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
243 blk->do_oop(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245 }
a61af66fc99e Initial load
duke
parents:
diff changeset
246 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 oop* addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
250 addr = cp->tags_addr();
2427
a0de1dfd1933 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 2379
diff changeset
251 if (mr.contains(addr)) blk->do_oop(addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
252 addr = cp->cache_addr();
2427
a0de1dfd1933 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 2379
diff changeset
253 if (mr.contains(addr)) blk->do_oop(addr);
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
254 addr = cp->operands_addr();
2427
a0de1dfd1933 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 2379
diff changeset
255 if (mr.contains(addr)) blk->do_oop(addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
256 addr = cp->pool_holder_addr();
2427
a0de1dfd1933 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds
ysr
parents: 2379
diff changeset
257 if (mr.contains(addr)) blk->do_oop(addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
258 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
259 }
a61af66fc99e Initial load
duke
parents:
diff changeset
260
518
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
261 bool constantPoolKlass::oop_is_conc_safe(oop obj) const {
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
262 assert(obj->is_constantPool(), "must be constantPool");
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
263 return constantPoolOop(obj)->is_conc_safe();
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
264 }
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
265
0
a61af66fc99e Initial load
duke
parents:
diff changeset
266 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
267 int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
268 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
269 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
272 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
273 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
274 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
275 for (int i = 0; i < cp->length(); ++i, ++base) {
a61af66fc99e Initial load
duke
parents:
diff changeset
276 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
277 PSParallelCompact::adjust_pointer(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 }
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280 }
a61af66fc99e Initial load
duke
parents:
diff changeset
281 PSParallelCompact::adjust_pointer(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
282 PSParallelCompact::adjust_pointer(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
283 PSParallelCompact::adjust_pointer(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
284 PSParallelCompact::adjust_pointer(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
285 return cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
286 }
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 assert(obj->is_constantPool(), "should be constant pool");
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
290 constantPoolOop cp = (constantPoolOop) obj;
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
291 if (cp->tags() != NULL) {
2379
b099aaf51bf8 6962931: move interned strings out of the perm gen
jcoomes
parents: 2229
diff changeset
292 for (int i = 1; i < cp->length(); ++i) {
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
293 if (cp->is_pointer_entry(i)) {
2379
b099aaf51bf8 6962931: move interned strings out of the perm gen
jcoomes
parents: 2229
diff changeset
294 oop* base = cp->obj_at_addr_raw(i);
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
295 if (PSScavenge::should_scavenge(base)) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
296 pm->claim_or_forward_depth(base);
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
297 }
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
298 }
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
299 }
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
300 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
301 }
a61af66fc99e Initial load
duke
parents:
diff changeset
302 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
303
a61af66fc99e Initial load
duke
parents:
diff changeset
304 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 EXCEPTION_MARK;
a61af66fc99e Initial load
duke
parents:
diff changeset
308 oop anObj;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 assert(obj->is_constantPool(), "must be constantPool");
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
310 Klass::oop_print_on(obj, st);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
311 constantPoolOop cp = constantPoolOop(obj);
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
312 if (cp->flags() != 0) {
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
313 st->print(" - flags: 0x%x", cp->flags());
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
314 if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
726
be93aad57795 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 579
diff changeset
315 if (cp->has_invokedynamic()) st->print(" has_invokedynamic");
3785
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
316 if (cp->has_preresolution()) st->print(" has_preresolution");
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
317 st->cr();
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
318 }
3785
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
319 if (cp->pool_holder() != NULL) {
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
320 bool extra = (instanceKlass::cast(cp->pool_holder())->constants() != cp);
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
321 st->print_cr(" - holder: " INTPTR_FORMAT "%s", cp->pool_holder(), (extra? " (extra)" : ""));
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
322 }
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
323 st->print_cr(" - cache: " INTPTR_FORMAT, cp->cache());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
324 for (int index = 1; index < cp->length(); index++) { // Index 0 is unused
a61af66fc99e Initial load
duke
parents:
diff changeset
325 st->print(" - %3d : ", index);
a61af66fc99e Initial load
duke
parents:
diff changeset
326 cp->tag_at(index).print_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
327 st->print(" : ");
a61af66fc99e Initial load
duke
parents:
diff changeset
328 switch (cp->tag_at(index).value()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
329 case JVM_CONSTANT_Class :
a61af66fc99e Initial load
duke
parents:
diff changeset
330 { anObj = cp->klass_at(index, CATCH);
a61af66fc99e Initial load
duke
parents:
diff changeset
331 anObj->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
332 st->print(" {0x%lx}", (address)anObj);
a61af66fc99e Initial load
duke
parents:
diff changeset
333 }
a61af66fc99e Initial load
duke
parents:
diff changeset
334 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
335 case JVM_CONSTANT_Fieldref :
a61af66fc99e Initial load
duke
parents:
diff changeset
336 case JVM_CONSTANT_Methodref :
a61af66fc99e Initial load
duke
parents:
diff changeset
337 case JVM_CONSTANT_InterfaceMethodref :
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
338 st->print("klass_index=%d", cp->uncached_klass_ref_index_at(index));
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
339 st->print(" name_and_type_index=%d", cp->uncached_name_and_type_ref_index_at(index));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
340 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
341 case JVM_CONSTANT_UnresolvedString :
a61af66fc99e Initial load
duke
parents:
diff changeset
342 case JVM_CONSTANT_String :
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
343 if (cp->is_pseudo_string_at(index)) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
344 anObj = cp->pseudo_string_at(index);
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
345 } else {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
346 anObj = cp->string_at(index, CATCH);
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
347 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
348 anObj->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 st->print(" {0x%lx}", (address)anObj);
a61af66fc99e Initial load
duke
parents:
diff changeset
350 break;
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
351 case JVM_CONSTANT_Object :
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
352 anObj = cp->object_at(index);
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
353 anObj->print_value_on(st);
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
354 st->print(" {0x%lx}", (address)anObj);
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
355 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
356 case JVM_CONSTANT_Integer :
a61af66fc99e Initial load
duke
parents:
diff changeset
357 st->print("%d", cp->int_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
358 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
359 case JVM_CONSTANT_Float :
a61af66fc99e Initial load
duke
parents:
diff changeset
360 st->print("%f", cp->float_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
361 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
362 case JVM_CONSTANT_Long :
a61af66fc99e Initial load
duke
parents:
diff changeset
363 st->print_jlong(cp->long_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
364 index++; // Skip entry following eigth-byte constant
a61af66fc99e Initial load
duke
parents:
diff changeset
365 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
366 case JVM_CONSTANT_Double :
a61af66fc99e Initial load
duke
parents:
diff changeset
367 st->print("%lf", cp->double_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
368 index++; // Skip entry following eigth-byte constant
a61af66fc99e Initial load
duke
parents:
diff changeset
369 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
370 case JVM_CONSTANT_NameAndType :
a61af66fc99e Initial load
duke
parents:
diff changeset
371 st->print("name_index=%d", cp->name_ref_index_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
372 st->print(" signature_index=%d", cp->signature_ref_index_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
373 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
374 case JVM_CONSTANT_Utf8 :
a61af66fc99e Initial load
duke
parents:
diff changeset
375 cp->symbol_at(index)->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
376 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
377 case JVM_CONSTANT_UnresolvedClass : // fall-through
a61af66fc99e Initial load
duke
parents:
diff changeset
378 case JVM_CONSTANT_UnresolvedClassInError: {
a61af66fc99e Initial load
duke
parents:
diff changeset
379 // unresolved_klass_at requires lock or safe world.
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
380 CPSlot entry = cp->slot_at(index);
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
381 if (entry.is_oop()) {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
382 entry.get_oop()->print_value_on(st);
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
383 } else {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
384 entry.get_symbol()->print_value_on(st);
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
385 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
386 }
a61af66fc99e Initial load
duke
parents:
diff changeset
387 break;
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
388 case JVM_CONSTANT_MethodHandle :
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
389 st->print("ref_kind=%d", cp->method_handle_ref_kind_at(index));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
390 st->print(" ref_index=%d", cp->method_handle_index_at(index));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
391 break;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
392 case JVM_CONSTANT_MethodType :
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
393 st->print("signature_index=%d", cp->method_type_index_at(index));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
394 break;
1660
083fde3b838e 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 1602
diff changeset
395 case JVM_CONSTANT_InvokeDynamic :
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
396 {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
397 st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index));
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
398 st->print(" name_and_type_index=%d", cp->invoke_dynamic_name_and_type_ref_index_at(index));
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
399 int argc = cp->invoke_dynamic_argument_count_at(index);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
400 if (argc > 0) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
401 for (int arg_i = 0; arg_i < argc; arg_i++) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
402 int arg = cp->invoke_dynamic_argument_index_at(index, arg_i);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
403 st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
404 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
405 st->print("}");
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
406 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
407 }
1660
083fde3b838e 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 1602
diff changeset
408 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
409 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
410 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
411 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
412 }
a61af66fc99e Initial load
duke
parents:
diff changeset
413 st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
414 }
a61af66fc99e Initial load
duke
parents:
diff changeset
415 st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
416 }
a61af66fc99e Initial load
duke
parents:
diff changeset
417
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
418 void constantPoolKlass::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
419 assert(obj->is_constantPool(), "must be constantPool");
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
420 constantPoolOop cp = constantPoolOop(obj);
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
421 st->print("constant pool [%d]", cp->length());
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
422 if (cp->has_pseudo_string()) st->print("/pseudo_string");
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
423 if (cp->has_invokedynamic()) st->print("/invokedynamic");
3785
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
424 if (cp->has_preresolution()) st->print("/preresolution");
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
425 if (cp->operands() != NULL) st->print("/operands[%d]", cp->operands()->length());
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
426 cp->print_address_on(st);
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
427 st->print(" for ");
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
428 cp->pool_holder()->print_value_on(st);
3785
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
429 if (cp->pool_holder() != NULL) {
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
430 bool extra = (instanceKlass::cast(cp->pool_holder())->constants() != cp);
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
431 if (extra) st->print(" (extra)");
ddd894528dbc 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 3368
diff changeset
432 }
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
433 if (cp->cache() != NULL) {
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
434 st->print(" cache=" PTR_FORMAT, cp->cache());
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
435 }
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
436 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
437
a61af66fc99e Initial load
duke
parents:
diff changeset
438 const char* constantPoolKlass::internal_name() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
439 return "{constant pool}";
a61af66fc99e Initial load
duke
parents:
diff changeset
440 }
a61af66fc99e Initial load
duke
parents:
diff changeset
441
a61af66fc99e Initial load
duke
parents:
diff changeset
442 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
443
a61af66fc99e Initial load
duke
parents:
diff changeset
444 void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
445 Klass::oop_verify_on(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
446 guarantee(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
447 constantPoolOop cp = constantPoolOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
448 guarantee(cp->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
449 if (!cp->partially_loaded()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
450 for (int i = 0; i< cp->length(); i++) {
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
451 constantTag tag = cp->tag_at(i);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
452 CPSlot entry = cp->slot_at(i);
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
453 if (tag.is_klass()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
454 if (entry.is_oop()) {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
455 guarantee(entry.get_oop()->is_perm(), "should be in permspace");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
456 guarantee(entry.get_oop()->is_klass(), "should be klass");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
457 }
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
458 } else if (tag.is_unresolved_klass()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
459 if (entry.is_oop()) {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
460 guarantee(entry.get_oop()->is_perm(), "should be in permspace");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
461 guarantee(entry.get_oop()->is_klass(), "should be klass");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
462 }
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
463 } else if (tag.is_symbol()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
464 guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
465 } else if (tag.is_unresolved_string()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
466 if (entry.is_oop()) {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
467 guarantee(entry.get_oop()->is_perm(), "should be in permspace");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
468 guarantee(entry.get_oop()->is_instance(), "should be instance");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
469 }
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
470 else {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
471 guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
472 }
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
473 } else if (tag.is_string()) {
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
474 if (!cp->has_pseudo_string()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
475 if (entry.is_oop()) {
2379
b099aaf51bf8 6962931: move interned strings out of the perm gen
jcoomes
parents: 2229
diff changeset
476 guarantee(!JavaObjectsInPerm || entry.get_oop()->is_perm(),
b099aaf51bf8 6962931: move interned strings out of the perm gen
jcoomes
parents: 2229
diff changeset
477 "should be in permspace");
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
478 guarantee(entry.get_oop()->is_instance(), "should be instance");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2011
diff changeset
479 }
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
480 } else {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
481 // can be non-perm, can be non-instance (array)
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
482 }
3368
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
483 } else if (tag.is_object()) {
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
484 assert(entry.get_oop()->is_oop(), "should be some valid oop");
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
485 } else {
69c94f488271 7043040: JSR292: JRuby bench/shootout/binarytrees.ruby-2.ruby SEGV: constantPoolKlass::oop_follow_contents
never
parents: 2468
diff changeset
486 assert(!cp->is_pointer_entry(i), "unhandled oop type in constantPoolKlass::verify_on");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
487 }
a61af66fc99e Initial load
duke
parents:
diff changeset
488 }
a61af66fc99e Initial load
duke
parents:
diff changeset
489 guarantee(cp->tags()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
490 guarantee(cp->tags()->is_typeArray(), "should be type array");
a61af66fc99e Initial load
duke
parents:
diff changeset
491 if (cp->cache() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
492 // Note: cache() can be NULL before a class is completely setup or
a61af66fc99e Initial load
duke
parents:
diff changeset
493 // in temporary constant pools used during constant pool merging
a61af66fc99e Initial load
duke
parents:
diff changeset
494 guarantee(cp->cache()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
495 guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache");
a61af66fc99e Initial load
duke
parents:
diff changeset
496 }
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
497 if (cp->operands() != NULL) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
498 guarantee(cp->operands()->is_perm(), "should be in permspace");
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
499 guarantee(cp->operands()->is_typeArray(), "should be type array");
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
500 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
501 if (cp->pool_holder() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
502 // Note: pool_holder() can be NULL in temporary constant pools
a61af66fc99e Initial load
duke
parents:
diff changeset
503 // used during constant pool merging
a61af66fc99e Initial load
duke
parents:
diff changeset
504 guarantee(cp->pool_holder()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
505 guarantee(cp->pool_holder()->is_klass(), "should be klass");
a61af66fc99e Initial load
duke
parents:
diff changeset
506 }
a61af66fc99e Initial load
duke
parents:
diff changeset
507 }
a61af66fc99e Initial load
duke
parents:
diff changeset
508 }
a61af66fc99e Initial load
duke
parents:
diff changeset
509
a61af66fc99e Initial load
duke
parents:
diff changeset
510 bool constantPoolKlass::oop_partially_loaded(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
511 assert(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
512 constantPoolOop cp = constantPoolOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
513 return cp->tags() == NULL || cp->pool_holder() == (klassOop) cp; // Check whether pool holder points to self
a61af66fc99e Initial load
duke
parents:
diff changeset
514 }
a61af66fc99e Initial load
duke
parents:
diff changeset
515
a61af66fc99e Initial load
duke
parents:
diff changeset
516
a61af66fc99e Initial load
duke
parents:
diff changeset
517 void constantPoolKlass::oop_set_partially_loaded(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
518 assert(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
519 constantPoolOop cp = constantPoolOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
520 assert(cp->pool_holder() == NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
521 cp->set_pool_holder((klassOop) cp); // Temporarily set pool holder to point to self
a61af66fc99e Initial load
duke
parents:
diff changeset
522 }
a61af66fc99e Initial load
duke
parents:
diff changeset
523
a61af66fc99e Initial load
duke
parents:
diff changeset
524 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
525 // CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
a61af66fc99e Initial load
duke
parents:
diff changeset
526 void constantPoolKlass::preload_and_initialize_all_classes(oop obj, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
527 guarantee(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
528 constantPoolHandle cp(THREAD, (constantPoolOop)obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
529 guarantee(!cp->partially_loaded(), "must be fully loaded");
a61af66fc99e Initial load
duke
parents:
diff changeset
530
a61af66fc99e Initial load
duke
parents:
diff changeset
531 for (int i = 0; i< cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
532 if (cp->tag_at(i).is_unresolved_klass()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
533 // This will force loading of the class
a61af66fc99e Initial load
duke
parents:
diff changeset
534 klassOop klass = cp->klass_at(i, CHECK);
4060
c9a03402fe56 7105305: assert check_method_context proper context
never
parents: 3960
diff changeset
535 if (klass->klass_part()->oop_is_instance()) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
536 // Force initialization of class
a61af66fc99e Initial load
duke
parents:
diff changeset
537 instanceKlass::cast(klass)->initialize(CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
538 }
a61af66fc99e Initial load
duke
parents:
diff changeset
539 }
a61af66fc99e Initial load
duke
parents:
diff changeset
540 }
a61af66fc99e Initial load
duke
parents:
diff changeset
541 }
a61af66fc99e Initial load
duke
parents:
diff changeset
542
a61af66fc99e Initial load
duke
parents:
diff changeset
543 #endif