annotate src/share/vm/oops/constantPoolKlass.cpp @ 1913:3b2dea75431e

6984311: JSR 292 needs optional bootstrap method parameters Summary: Allow CONSTANT_InvokeDynamic nodes to have any number of extra operands. Reviewed-by: twisti
author jrose
date Sat, 30 Oct 2010 13:08:23 -0700
parents 7fcd5f39bd7a
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
2 * Copyright (c) 1997, 2010, 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
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_constantPoolKlass.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
518
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
28 constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
29 int size = constantPoolOopDesc::object_size(length);
a61af66fc99e Initial load
duke
parents:
diff changeset
30 KlassHandle klass (THREAD, as_klassOop());
a61af66fc99e Initial load
duke
parents:
diff changeset
31 constantPoolOop c =
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
32 (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
34 c->set_length(length);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 c->set_tags(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
36 c->set_cache(NULL);
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
37 c->set_operands(NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
38 c->set_pool_holder(NULL);
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
39 c->set_flags(0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // only set to non-zero if constant pool is merged by RedefineClasses
a61af66fc99e Initial load
duke
parents:
diff changeset
41 c->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
42 // 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
43 // unsafe for GC concurrent processing.
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
44 c->set_is_conc_safe(is_conc_safe);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // all fields are initialized; needed for GC
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // initialize tag array
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // Note: cannot introduce constant pool handle before since it is not
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // completely initialized (no class) -> would cause assertion failure
a61af66fc99e Initial load
duke
parents:
diff changeset
50 constantPoolHandle pool (THREAD, c);
a61af66fc99e Initial load
duke
parents:
diff changeset
51 typeArrayOop t_oop = oopFactory::new_permanent_byteArray(length, CHECK_NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 typeArrayHandle tags (THREAD, t_oop);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 for (int index = 0; index < length; index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 tags()->byte_at_put(index, JVM_CONSTANT_Invalid);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 }
a61af66fc99e Initial load
duke
parents:
diff changeset
56 pool->set_tags(tags());
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 return pool();
a61af66fc99e Initial load
duke
parents:
diff changeset
59 }
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 klassOop constantPoolKlass::create_klass(TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 constantPoolKlass o;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
63 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
64 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
65 // 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
66 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
67 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
0
a61af66fc99e Initial load
duke
parents:
diff changeset
68 return k();
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 int constantPoolKlass::oop_size(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 assert(obj->is_constantPool(), "must be constantPool");
a61af66fc99e Initial load
duke
parents:
diff changeset
73 return constantPoolOop(obj)->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void constantPoolKlass::oop_follow_contents(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
79 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // If the tags array is null we are in the middle of allocating this constant pool
a61af66fc99e Initial load
duke
parents:
diff changeset
84 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // gc of constant pool contents
a61af66fc99e Initial load
duke
parents:
diff changeset
86 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
87 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 if (*base != NULL) MarkSweep::mark_and_push(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // gc of constant pool instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
94 MarkSweep::mark_and_push(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
95 MarkSweep::mark_and_push(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
96 MarkSweep::mark_and_push(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97 MarkSweep::mark_and_push(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
102 void constantPoolKlass::oop_follow_contents(ParCompactionManager* cm,
a61af66fc99e Initial load
duke
parents:
diff changeset
103 oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
105 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
111 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // gc of constant pool contents
a61af66fc99e Initial load
duke
parents:
diff changeset
113 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
114 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 if (*base != NULL) PSParallelCompact::mark_and_push(cm, base);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // gc of constant pool instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
121 PSParallelCompact::mark_and_push(cm, cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
122 PSParallelCompact::mark_and_push(cm, cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
123 PSParallelCompact::mark_and_push(cm, cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124 PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 int constantPoolKlass::oop_adjust_pointers(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
132 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
135 int size = cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
141 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
143 for (int i = 0; i< cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
144 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 MarkSweep::adjust_pointer(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149 }
a61af66fc99e Initial load
duke
parents:
diff changeset
150 MarkSweep::adjust_pointer(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
151 MarkSweep::adjust_pointer(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
152 MarkSweep::adjust_pointer(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
153 MarkSweep::adjust_pointer(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
154 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 int constantPoolKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
159 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
162 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
165 int size = cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
168 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
169 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
170 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
171 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 blk->do_oop(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178 blk->do_oop(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
179 blk->do_oop(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
180 blk->do_oop(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
181 blk->do_oop(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
182 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
187 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // know that Universe::constantPoolKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
190 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
193 int size = cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
196 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
197 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
199 for (int i = 0; i < cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 if (mr.contains(base)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
202 blk->do_oop(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
203 }
a61af66fc99e Initial load
duke
parents:
diff changeset
204 }
a61af66fc99e Initial load
duke
parents:
diff changeset
205 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208 oop* addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
209 addr = cp->tags_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
210 blk->do_oop(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
211 addr = cp->cache_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
212 blk->do_oop(addr);
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
213 addr = cp->operands_addr();
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
214 blk->do_oop(addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
215 addr = cp->pool_holder_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
216 blk->do_oop(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
217 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219
518
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
220 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
221 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
222 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
223 }
0af8b0718fc9 6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents: 431
diff changeset
224
0
a61af66fc99e Initial load
duke
parents:
diff changeset
225 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
226 int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
228 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
229
a61af66fc99e Initial load
duke
parents:
diff changeset
230 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
233 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
234 for (int i = 0; i < cp->length(); ++i, ++base) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 if (cp->is_pointer_entry(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
236 PSParallelCompact::adjust_pointer(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
237 }
a61af66fc99e Initial load
duke
parents:
diff changeset
238 }
a61af66fc99e Initial load
duke
parents:
diff changeset
239 }
a61af66fc99e Initial load
duke
parents:
diff changeset
240 PSParallelCompact::adjust_pointer(cp->tags_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
241 PSParallelCompact::adjust_pointer(cp->cache_addr());
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
242 PSParallelCompact::adjust_pointer(cp->operands_addr());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
243 PSParallelCompact::adjust_pointer(cp->pool_holder_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
244 return cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
245 }
a61af66fc99e Initial load
duke
parents:
diff changeset
246
a61af66fc99e Initial load
duke
parents:
diff changeset
247 int
a61af66fc99e Initial load
duke
parents:
diff changeset
248 constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
249 HeapWord* beg_addr, HeapWord* end_addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 assert (obj->is_constantPool(), "obj must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
251 constantPoolOop cp = (constantPoolOop) obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
252
a61af66fc99e Initial load
duke
parents:
diff changeset
253 // If the tags array is null we are in the middle of allocating this constant
a61af66fc99e Initial load
duke
parents:
diff changeset
254 // pool.
a61af66fc99e Initial load
duke
parents:
diff changeset
255 if (cp->tags() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
257 oop* const beg_oop = MAX2((oop*)beg_addr, base);
a61af66fc99e Initial load
duke
parents:
diff changeset
258 oop* const end_oop = MIN2((oop*)end_addr, base + cp->length());
a61af66fc99e Initial load
duke
parents:
diff changeset
259 const size_t beg_idx = pointer_delta(beg_oop, base, sizeof(oop*));
a61af66fc99e Initial load
duke
parents:
diff changeset
260 const size_t end_idx = pointer_delta(end_oop, base, sizeof(oop*));
a61af66fc99e Initial load
duke
parents:
diff changeset
261 for (size_t cur_idx = beg_idx; cur_idx < end_idx; ++cur_idx, ++base) {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 if (cp->is_pointer_entry(int(cur_idx))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
263 PSParallelCompact::adjust_pointer(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
264 }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 }
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267
a61af66fc99e Initial load
duke
parents:
diff changeset
268 oop* p;
a61af66fc99e Initial load
duke
parents:
diff changeset
269 p = cp->tags_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
270 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 p = cp->cache_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
272 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
273 p = cp->operands_addr();
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
274 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
275 p = cp->pool_holder_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
276 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
277
a61af66fc99e Initial load
duke
parents:
diff changeset
278 return cp->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
282 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
283 constantPoolOop cp = (constantPoolOop) obj;
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
284 if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
285 oop* base = (oop*)cp->base();
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
286 for (int i = 0; i < cp->length(); ++i, ++base) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
287 if (cp->tag_at(i).is_string()) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
288 if (PSScavenge::should_scavenge(base)) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
289 pm->claim_or_forward_depth(base);
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
290 }
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
291 }
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
292 }
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
293 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
294 }
a61af66fc99e Initial load
duke
parents:
diff changeset
295 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
298
a61af66fc99e Initial load
duke
parents:
diff changeset
299 void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
300 EXCEPTION_MARK;
a61af66fc99e Initial load
duke
parents:
diff changeset
301 oop anObj;
a61af66fc99e Initial load
duke
parents:
diff changeset
302 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
303 Klass::oop_print_on(obj, st);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
304 constantPoolOop cp = constantPoolOop(obj);
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
305 if (cp->flags() != 0) {
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
306 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
307 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
308 if (cp->has_invokedynamic()) st->print(" has_invokedynamic");
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
309 st->cr();
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
310 }
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
311 st->print_cr(" - cache: " INTPTR_FORMAT, cp->cache());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
312
a61af66fc99e Initial load
duke
parents:
diff changeset
313 for (int index = 1; index < cp->length(); index++) { // Index 0 is unused
a61af66fc99e Initial load
duke
parents:
diff changeset
314 st->print(" - %3d : ", index);
a61af66fc99e Initial load
duke
parents:
diff changeset
315 cp->tag_at(index).print_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
316 st->print(" : ");
a61af66fc99e Initial load
duke
parents:
diff changeset
317 switch (cp->tag_at(index).value()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
318 case JVM_CONSTANT_Class :
a61af66fc99e Initial load
duke
parents:
diff changeset
319 { anObj = cp->klass_at(index, CATCH);
a61af66fc99e Initial load
duke
parents:
diff changeset
320 anObj->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
321 st->print(" {0x%lx}", (address)anObj);
a61af66fc99e Initial load
duke
parents:
diff changeset
322 }
a61af66fc99e Initial load
duke
parents:
diff changeset
323 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
324 case JVM_CONSTANT_Fieldref :
a61af66fc99e Initial load
duke
parents:
diff changeset
325 case JVM_CONSTANT_Methodref :
a61af66fc99e Initial load
duke
parents:
diff changeset
326 case JVM_CONSTANT_InterfaceMethodref :
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
327 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
328 st->print(" name_and_type_index=%d", cp->uncached_name_and_type_ref_index_at(index));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
329 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
330 case JVM_CONSTANT_UnresolvedString :
a61af66fc99e Initial load
duke
parents:
diff changeset
331 case JVM_CONSTANT_String :
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
332 if (cp->is_pseudo_string_at(index)) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
333 anObj = cp->pseudo_string_at(index);
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
334 } else {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
335 anObj = cp->string_at(index, CATCH);
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
336 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
337 anObj->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
338 st->print(" {0x%lx}", (address)anObj);
a61af66fc99e Initial load
duke
parents:
diff changeset
339 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
340 case JVM_CONSTANT_Integer :
a61af66fc99e Initial load
duke
parents:
diff changeset
341 st->print("%d", cp->int_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
342 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
343 case JVM_CONSTANT_Float :
a61af66fc99e Initial load
duke
parents:
diff changeset
344 st->print("%f", cp->float_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
345 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
346 case JVM_CONSTANT_Long :
a61af66fc99e Initial load
duke
parents:
diff changeset
347 st->print_jlong(cp->long_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
348 index++; // Skip entry following eigth-byte constant
a61af66fc99e Initial load
duke
parents:
diff changeset
349 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
350 case JVM_CONSTANT_Double :
a61af66fc99e Initial load
duke
parents:
diff changeset
351 st->print("%lf", cp->double_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
352 index++; // Skip entry following eigth-byte constant
a61af66fc99e Initial load
duke
parents:
diff changeset
353 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
354 case JVM_CONSTANT_NameAndType :
a61af66fc99e Initial load
duke
parents:
diff changeset
355 st->print("name_index=%d", cp->name_ref_index_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
356 st->print(" signature_index=%d", cp->signature_ref_index_at(index));
a61af66fc99e Initial load
duke
parents:
diff changeset
357 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
358 case JVM_CONSTANT_Utf8 :
a61af66fc99e Initial load
duke
parents:
diff changeset
359 cp->symbol_at(index)->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
360 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
361 case JVM_CONSTANT_UnresolvedClass : // fall-through
a61af66fc99e Initial load
duke
parents:
diff changeset
362 case JVM_CONSTANT_UnresolvedClassInError: {
a61af66fc99e Initial load
duke
parents:
diff changeset
363 // unresolved_klass_at requires lock or safe world.
a61af66fc99e Initial load
duke
parents:
diff changeset
364 oop entry = *cp->obj_at_addr(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
365 entry->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
366 }
a61af66fc99e Initial load
duke
parents:
diff changeset
367 break;
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
368 case JVM_CONSTANT_MethodHandle :
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
369 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
370 st->print(" ref_index=%d", cp->method_handle_index_at(index));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
371 break;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
372 case JVM_CONSTANT_MethodType :
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
373 st->print("signature_index=%d", cp->method_type_index_at(index));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
374 break;
1660
083fde3b838e 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 1602
diff changeset
375 case JVM_CONSTANT_InvokeDynamic :
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
376 {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
377 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
378 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
379 int argc = cp->invoke_dynamic_argument_count_at(index);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
380 if (argc > 0) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
381 for (int arg_i = 0; arg_i < argc; arg_i++) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
382 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
383 st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
384 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
385 st->print("}");
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
386 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
387 }
1660
083fde3b838e 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 1602
diff changeset
388 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
389 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
390 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
391 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
392 }
a61af66fc99e Initial load
duke
parents:
diff changeset
393 st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
394 }
a61af66fc99e Initial load
duke
parents:
diff changeset
395 st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
396 }
a61af66fc99e Initial load
duke
parents:
diff changeset
397
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
398 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
399 assert(obj->is_constantPool(), "must be constantPool");
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
400 constantPoolOop cp = constantPoolOop(obj);
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
401 st->print("constant pool [%d]", cp->length());
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
402 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
403 if (cp->has_invokedynamic()) st->print("/invokedynamic");
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
404 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
405 cp->print_address_on(st);
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
406 st->print(" for ");
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
407 cp->pool_holder()->print_value_on(st);
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
408 if (cp->cache() != NULL) {
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
409 st->print(" cache=" PTR_FORMAT, cp->cache());
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1155
diff changeset
410 }
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 726
diff changeset
411 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
412
a61af66fc99e Initial load
duke
parents:
diff changeset
413 const char* constantPoolKlass::internal_name() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
414 return "{constant pool}";
a61af66fc99e Initial load
duke
parents:
diff changeset
415 }
a61af66fc99e Initial load
duke
parents:
diff changeset
416
a61af66fc99e Initial load
duke
parents:
diff changeset
417 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
418
a61af66fc99e Initial load
duke
parents:
diff changeset
419 void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
420 Klass::oop_verify_on(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
421 guarantee(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
422 constantPoolOop cp = constantPoolOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
423 guarantee(cp->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
424 if (!cp->partially_loaded()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 oop* base = (oop*)cp->base();
a61af66fc99e Initial load
duke
parents:
diff changeset
426 for (int i = 0; i< cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
427 if (cp->tag_at(i).is_klass()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
428 guarantee((*base)->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
429 guarantee((*base)->is_klass(), "should be klass");
a61af66fc99e Initial load
duke
parents:
diff changeset
430 }
a61af66fc99e Initial load
duke
parents:
diff changeset
431 if (cp->tag_at(i).is_unresolved_klass()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
432 guarantee((*base)->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
433 guarantee((*base)->is_symbol() || (*base)->is_klass(),
a61af66fc99e Initial load
duke
parents:
diff changeset
434 "should be symbol or klass");
a61af66fc99e Initial load
duke
parents:
diff changeset
435 }
a61af66fc99e Initial load
duke
parents:
diff changeset
436 if (cp->tag_at(i).is_symbol()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
437 guarantee((*base)->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
438 guarantee((*base)->is_symbol(), "should be symbol");
a61af66fc99e Initial load
duke
parents:
diff changeset
439 }
a61af66fc99e Initial load
duke
parents:
diff changeset
440 if (cp->tag_at(i).is_unresolved_string()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
441 guarantee((*base)->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
442 guarantee((*base)->is_symbol() || (*base)->is_instance(),
a61af66fc99e Initial load
duke
parents:
diff changeset
443 "should be symbol or instance");
a61af66fc99e Initial load
duke
parents:
diff changeset
444 }
a61af66fc99e Initial load
duke
parents:
diff changeset
445 if (cp->tag_at(i).is_string()) {
431
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
446 if (!cp->has_pseudo_string()) {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
447 guarantee((*base)->is_perm(), "should be in permspace");
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
448 guarantee((*base)->is_instance(), "should be instance");
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
449 } else {
a45484ea312d 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 196
diff changeset
450 // 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
451 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
452 }
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
453 // FIXME: verify JSR 292 tags JVM_CONSTANT_MethodHandle, etc.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
454 base++;
a61af66fc99e Initial load
duke
parents:
diff changeset
455 }
a61af66fc99e Initial load
duke
parents:
diff changeset
456 guarantee(cp->tags()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
457 guarantee(cp->tags()->is_typeArray(), "should be type array");
a61af66fc99e Initial load
duke
parents:
diff changeset
458 if (cp->cache() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
459 // Note: cache() can be NULL before a class is completely setup or
a61af66fc99e Initial load
duke
parents:
diff changeset
460 // in temporary constant pools used during constant pool merging
a61af66fc99e Initial load
duke
parents:
diff changeset
461 guarantee(cp->cache()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
462 guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache");
a61af66fc99e Initial load
duke
parents:
diff changeset
463 }
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
464 if (cp->operands() != NULL) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
465 guarantee(cp->operands()->is_perm(), "should be in permspace");
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
466 guarantee(cp->operands()->is_typeArray(), "should be type array");
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1713
diff changeset
467 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
468 if (cp->pool_holder() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
469 // Note: pool_holder() can be NULL in temporary constant pools
a61af66fc99e Initial load
duke
parents:
diff changeset
470 // used during constant pool merging
a61af66fc99e Initial load
duke
parents:
diff changeset
471 guarantee(cp->pool_holder()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
472 guarantee(cp->pool_holder()->is_klass(), "should be klass");
a61af66fc99e Initial load
duke
parents:
diff changeset
473 }
a61af66fc99e Initial load
duke
parents:
diff changeset
474 }
a61af66fc99e Initial load
duke
parents:
diff changeset
475 }
a61af66fc99e Initial load
duke
parents:
diff changeset
476
a61af66fc99e Initial load
duke
parents:
diff changeset
477 bool constantPoolKlass::oop_partially_loaded(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
478 assert(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
479 constantPoolOop cp = constantPoolOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
480 return cp->tags() == NULL || cp->pool_holder() == (klassOop) cp; // Check whether pool holder points to self
a61af66fc99e Initial load
duke
parents:
diff changeset
481 }
a61af66fc99e Initial load
duke
parents:
diff changeset
482
a61af66fc99e Initial load
duke
parents:
diff changeset
483
a61af66fc99e Initial load
duke
parents:
diff changeset
484 void constantPoolKlass::oop_set_partially_loaded(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
485 assert(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
486 constantPoolOop cp = constantPoolOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
487 assert(cp->pool_holder() == NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
488 cp->set_pool_holder((klassOop) cp); // Temporarily set pool holder to point to self
a61af66fc99e Initial load
duke
parents:
diff changeset
489 }
a61af66fc99e Initial load
duke
parents:
diff changeset
490
a61af66fc99e Initial load
duke
parents:
diff changeset
491 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
492 // CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
a61af66fc99e Initial load
duke
parents:
diff changeset
493 void constantPoolKlass::preload_and_initialize_all_classes(oop obj, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
494 guarantee(obj->is_constantPool(), "object must be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
495 constantPoolHandle cp(THREAD, (constantPoolOop)obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
496 guarantee(!cp->partially_loaded(), "must be fully loaded");
a61af66fc99e Initial load
duke
parents:
diff changeset
497
a61af66fc99e Initial load
duke
parents:
diff changeset
498 for (int i = 0; i< cp->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
499 if (cp->tag_at(i).is_unresolved_klass()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
500 // This will force loading of the class
a61af66fc99e Initial load
duke
parents:
diff changeset
501 klassOop klass = cp->klass_at(i, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
502 if (klass->is_instance()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
503 // Force initialization of class
a61af66fc99e Initial load
duke
parents:
diff changeset
504 instanceKlass::cast(klass)->initialize(CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
505 }
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 #endif