annotate src/share/vm/oops/constantPoolKlass.cpp @ 431:a45484ea312d

6653858: dynamic languages need to be able to load anonymous classes Summary: low-level privileged sun.misc.Unsafe.defineAnonymousClass Reviewed-by: kvn
author jrose
date Wed, 12 Nov 2008 22:33:26 -0800
parents d1605aabd0a1
children 0af8b0718fc9
rev   line source
duke@0 1 /*
xdono@196 2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 # include "incls/_precompiled.incl"
duke@0 26 # include "incls/_constantPoolKlass.cpp.incl"
duke@0 27
duke@0 28 constantPoolOop constantPoolKlass::allocate(int length, TRAPS) {
duke@0 29 int size = constantPoolOopDesc::object_size(length);
duke@0 30 KlassHandle klass (THREAD, as_klassOop());
duke@0 31 constantPoolOop c =
coleenp@113 32 (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
duke@0 33
coleenp@113 34 c->set_length(length);
duke@0 35 c->set_tags(NULL);
duke@0 36 c->set_cache(NULL);
duke@0 37 c->set_pool_holder(NULL);
jrose@431 38 c->set_flags(0);
duke@0 39 // only set to non-zero if constant pool is merged by RedefineClasses
duke@0 40 c->set_orig_length(0);
duke@0 41 // all fields are initialized; needed for GC
duke@0 42
duke@0 43 // initialize tag array
duke@0 44 // Note: cannot introduce constant pool handle before since it is not
duke@0 45 // completely initialized (no class) -> would cause assertion failure
duke@0 46 constantPoolHandle pool (THREAD, c);
duke@0 47 typeArrayOop t_oop = oopFactory::new_permanent_byteArray(length, CHECK_NULL);
duke@0 48 typeArrayHandle tags (THREAD, t_oop);
duke@0 49 for (int index = 0; index < length; index++) {
duke@0 50 tags()->byte_at_put(index, JVM_CONSTANT_Invalid);
duke@0 51 }
duke@0 52 pool->set_tags(tags());
duke@0 53
duke@0 54 return pool();
duke@0 55 }
duke@0 56
duke@0 57 klassOop constantPoolKlass::create_klass(TRAPS) {
duke@0 58 constantPoolKlass o;
coleenp@113 59 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
coleenp@113 60 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
coleenp@113 61 // Make sure size calculation is right
coleenp@113 62 assert(k()->size() == align_object_size(header_size()), "wrong size for object");
coleenp@113 63 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
duke@0 64 return k();
duke@0 65 }
duke@0 66
duke@0 67 int constantPoolKlass::oop_size(oop obj) const {
duke@0 68 assert(obj->is_constantPool(), "must be constantPool");
duke@0 69 return constantPoolOop(obj)->object_size();
duke@0 70 }
duke@0 71
duke@0 72
duke@0 73 void constantPoolKlass::oop_follow_contents(oop obj) {
duke@0 74 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 75 constantPoolOop cp = (constantPoolOop) obj;
duke@0 76 // Performance tweak: We skip iterating over the klass pointer since we
duke@0 77 // know that Universe::constantPoolKlassObj never moves.
duke@0 78
duke@0 79 // If the tags array is null we are in the middle of allocating this constant pool
duke@0 80 if (cp->tags() != NULL) {
duke@0 81 // gc of constant pool contents
duke@0 82 oop* base = (oop*)cp->base();
duke@0 83 for (int i = 0; i < cp->length(); i++) {
duke@0 84 if (cp->is_pointer_entry(i)) {
duke@0 85 if (*base != NULL) MarkSweep::mark_and_push(base);
duke@0 86 }
duke@0 87 base++;
duke@0 88 }
duke@0 89 // gc of constant pool instance variables
duke@0 90 MarkSweep::mark_and_push(cp->tags_addr());
duke@0 91 MarkSweep::mark_and_push(cp->cache_addr());
duke@0 92 MarkSweep::mark_and_push(cp->pool_holder_addr());
duke@0 93 }
duke@0 94 }
duke@0 95
duke@0 96 #ifndef SERIALGC
duke@0 97 void constantPoolKlass::oop_follow_contents(ParCompactionManager* cm,
duke@0 98 oop obj) {
duke@0 99 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 100 constantPoolOop cp = (constantPoolOop) obj;
duke@0 101 // Performance tweak: We skip iterating over the klass pointer since we
duke@0 102 // know that Universe::constantPoolKlassObj never moves.
duke@0 103
duke@0 104 // If the tags array is null we are in the middle of allocating this constant
duke@0 105 // pool.
duke@0 106 if (cp->tags() != NULL) {
duke@0 107 // gc of constant pool contents
duke@0 108 oop* base = (oop*)cp->base();
duke@0 109 for (int i = 0; i < cp->length(); i++) {
duke@0 110 if (cp->is_pointer_entry(i)) {
duke@0 111 if (*base != NULL) PSParallelCompact::mark_and_push(cm, base);
duke@0 112 }
duke@0 113 base++;
duke@0 114 }
duke@0 115 // gc of constant pool instance variables
duke@0 116 PSParallelCompact::mark_and_push(cm, cp->tags_addr());
duke@0 117 PSParallelCompact::mark_and_push(cm, cp->cache_addr());
duke@0 118 PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr());
duke@0 119 }
duke@0 120 }
duke@0 121 #endif // SERIALGC
duke@0 122
duke@0 123
duke@0 124 int constantPoolKlass::oop_adjust_pointers(oop obj) {
duke@0 125 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 126 constantPoolOop cp = (constantPoolOop) obj;
duke@0 127 // Get size before changing pointers.
duke@0 128 // Don't call size() or oop_size() since that is a virtual call.
duke@0 129 int size = cp->object_size();
duke@0 130 // Performance tweak: We skip iterating over the klass pointer since we
duke@0 131 // know that Universe::constantPoolKlassObj never moves.
duke@0 132
duke@0 133 // If the tags array is null we are in the middle of allocating this constant
duke@0 134 // pool.
duke@0 135 if (cp->tags() != NULL) {
duke@0 136 oop* base = (oop*)cp->base();
duke@0 137 for (int i = 0; i< cp->length(); i++) {
duke@0 138 if (cp->is_pointer_entry(i)) {
duke@0 139 MarkSweep::adjust_pointer(base);
duke@0 140 }
duke@0 141 base++;
duke@0 142 }
duke@0 143 }
duke@0 144 MarkSweep::adjust_pointer(cp->tags_addr());
duke@0 145 MarkSweep::adjust_pointer(cp->cache_addr());
duke@0 146 MarkSweep::adjust_pointer(cp->pool_holder_addr());
duke@0 147 return size;
duke@0 148 }
duke@0 149
duke@0 150
duke@0 151 int constantPoolKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
duke@0 152 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 153 // Performance tweak: We skip iterating over the klass pointer since we
duke@0 154 // know that Universe::constantPoolKlassObj never moves.
duke@0 155 constantPoolOop cp = (constantPoolOop) obj;
duke@0 156 // Get size before changing pointers.
duke@0 157 // Don't call size() or oop_size() since that is a virtual call.
duke@0 158 int size = cp->object_size();
duke@0 159
duke@0 160 // If the tags array is null we are in the middle of allocating this constant
duke@0 161 // pool.
duke@0 162 if (cp->tags() != NULL) {
duke@0 163 oop* base = (oop*)cp->base();
duke@0 164 for (int i = 0; i < cp->length(); i++) {
duke@0 165 if (cp->is_pointer_entry(i)) {
duke@0 166 blk->do_oop(base);
duke@0 167 }
duke@0 168 base++;
duke@0 169 }
duke@0 170 }
duke@0 171 blk->do_oop(cp->tags_addr());
duke@0 172 blk->do_oop(cp->cache_addr());
duke@0 173 blk->do_oop(cp->pool_holder_addr());
duke@0 174 return size;
duke@0 175 }
duke@0 176
duke@0 177
duke@0 178 int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
duke@0 179 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 180 // Performance tweak: We skip iterating over the klass pointer since we
duke@0 181 // know that Universe::constantPoolKlassObj never moves.
duke@0 182 constantPoolOop cp = (constantPoolOop) obj;
duke@0 183 // Get size before changing pointers.
duke@0 184 // Don't call size() or oop_size() since that is a virtual call.
duke@0 185 int size = cp->object_size();
duke@0 186
duke@0 187 // If the tags array is null we are in the middle of allocating this constant
duke@0 188 // pool.
duke@0 189 if (cp->tags() != NULL) {
duke@0 190 oop* base = (oop*)cp->base();
duke@0 191 for (int i = 0; i < cp->length(); i++) {
duke@0 192 if (mr.contains(base)) {
duke@0 193 if (cp->is_pointer_entry(i)) {
duke@0 194 blk->do_oop(base);
duke@0 195 }
duke@0 196 }
duke@0 197 base++;
duke@0 198 }
duke@0 199 }
duke@0 200 oop* addr;
duke@0 201 addr = cp->tags_addr();
duke@0 202 blk->do_oop(addr);
duke@0 203 addr = cp->cache_addr();
duke@0 204 blk->do_oop(addr);
duke@0 205 addr = cp->pool_holder_addr();
duke@0 206 blk->do_oop(addr);
duke@0 207 return size;
duke@0 208 }
duke@0 209
duke@0 210 #ifndef SERIALGC
duke@0 211 int constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
duke@0 212 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 213 constantPoolOop cp = (constantPoolOop) obj;
duke@0 214
duke@0 215 // If the tags array is null we are in the middle of allocating this constant
duke@0 216 // pool.
duke@0 217 if (cp->tags() != NULL) {
duke@0 218 oop* base = (oop*)cp->base();
duke@0 219 for (int i = 0; i < cp->length(); ++i, ++base) {
duke@0 220 if (cp->is_pointer_entry(i)) {
duke@0 221 PSParallelCompact::adjust_pointer(base);
duke@0 222 }
duke@0 223 }
duke@0 224 }
duke@0 225 PSParallelCompact::adjust_pointer(cp->tags_addr());
duke@0 226 PSParallelCompact::adjust_pointer(cp->cache_addr());
duke@0 227 PSParallelCompact::adjust_pointer(cp->pool_holder_addr());
duke@0 228 return cp->object_size();
duke@0 229 }
duke@0 230
duke@0 231 int
duke@0 232 constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
duke@0 233 HeapWord* beg_addr, HeapWord* end_addr) {
duke@0 234 assert (obj->is_constantPool(), "obj must be constant pool");
duke@0 235 constantPoolOop cp = (constantPoolOop) obj;
duke@0 236
duke@0 237 // If the tags array is null we are in the middle of allocating this constant
duke@0 238 // pool.
duke@0 239 if (cp->tags() != NULL) {
duke@0 240 oop* base = (oop*)cp->base();
duke@0 241 oop* const beg_oop = MAX2((oop*)beg_addr, base);
duke@0 242 oop* const end_oop = MIN2((oop*)end_addr, base + cp->length());
duke@0 243 const size_t beg_idx = pointer_delta(beg_oop, base, sizeof(oop*));
duke@0 244 const size_t end_idx = pointer_delta(end_oop, base, sizeof(oop*));
duke@0 245 for (size_t cur_idx = beg_idx; cur_idx < end_idx; ++cur_idx, ++base) {
duke@0 246 if (cp->is_pointer_entry(int(cur_idx))) {
duke@0 247 PSParallelCompact::adjust_pointer(base);
duke@0 248 }
duke@0 249 }
duke@0 250 }
duke@0 251
duke@0 252 oop* p;
duke@0 253 p = cp->tags_addr();
duke@0 254 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
duke@0 255 p = cp->cache_addr();
duke@0 256 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
duke@0 257 p = cp->pool_holder_addr();
duke@0 258 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
duke@0 259
duke@0 260 return cp->object_size();
duke@0 261 }
duke@0 262
duke@0 263 void constantPoolKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
duke@0 264 assert(obj->is_constantPool(), "should be constant pool");
jrose@431 265 constantPoolOop cp = (constantPoolOop) obj;
jrose@431 266 if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) {
jrose@431 267 oop* base = (oop*)cp->base();
jrose@431 268 for (int i = 0; i < cp->length(); ++i, ++base) {
jrose@431 269 if (cp->tag_at(i).is_string()) {
jrose@431 270 if (PSScavenge::should_scavenge(base)) {
jrose@431 271 pm->claim_or_forward_breadth(base);
jrose@431 272 }
jrose@431 273 }
jrose@431 274 }
jrose@431 275 }
duke@0 276 }
duke@0 277
duke@0 278 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
duke@0 279 assert(obj->is_constantPool(), "should be constant pool");
jrose@431 280 constantPoolOop cp = (constantPoolOop) obj;
jrose@431 281 if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) {
jrose@431 282 oop* base = (oop*)cp->base();
jrose@431 283 for (int i = 0; i < cp->length(); ++i, ++base) {
jrose@431 284 if (cp->tag_at(i).is_string()) {
jrose@431 285 if (PSScavenge::should_scavenge(base)) {
jrose@431 286 pm->claim_or_forward_depth(base);
jrose@431 287 }
jrose@431 288 }
jrose@431 289 }
jrose@431 290 }
duke@0 291 }
duke@0 292 #endif // SERIALGC
duke@0 293
duke@0 294 #ifndef PRODUCT
duke@0 295
duke@0 296 // Printing
duke@0 297
duke@0 298 void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
duke@0 299 EXCEPTION_MARK;
duke@0 300 oop anObj;
duke@0 301 assert(obj->is_constantPool(), "must be constantPool");
coleenp@113 302 Klass::oop_print_on(obj, st);
duke@0 303 constantPoolOop cp = constantPoolOop(obj);
jrose@431 304 if (cp->flags() != 0) {
jrose@431 305 st->print(" - flags : 0x%x", cp->flags());
jrose@431 306 if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
jrose@431 307 st->cr();
jrose@431 308 }
duke@0 309
duke@0 310 // Temp. remove cache so we can do lookups with original indicies.
duke@0 311 constantPoolCacheHandle cache (THREAD, cp->cache());
duke@0 312 cp->set_cache(NULL);
duke@0 313
duke@0 314 for (int index = 1; index < cp->length(); index++) { // Index 0 is unused
duke@0 315 st->print(" - %3d : ", index);
duke@0 316 cp->tag_at(index).print_on(st);
duke@0 317 st->print(" : ");
duke@0 318 switch (cp->tag_at(index).value()) {
duke@0 319 case JVM_CONSTANT_Class :
duke@0 320 { anObj = cp->klass_at(index, CATCH);
duke@0 321 anObj->print_value_on(st);
duke@0 322 st->print(" {0x%lx}", (address)anObj);
duke@0 323 }
duke@0 324 break;
duke@0 325 case JVM_CONSTANT_Fieldref :
duke@0 326 case JVM_CONSTANT_Methodref :
duke@0 327 case JVM_CONSTANT_InterfaceMethodref :
duke@0 328 st->print("klass_index=%d", cp->klass_ref_index_at(index));
duke@0 329 st->print(" name_and_type_index=%d", cp->name_and_type_ref_index_at(index));
duke@0 330 break;
duke@0 331 case JVM_CONSTANT_UnresolvedString :
duke@0 332 case JVM_CONSTANT_String :
jrose@431 333 if (cp->is_pseudo_string_at(index)) {
jrose@431 334 anObj = cp->pseudo_string_at(index);
jrose@431 335 } else {
jrose@431 336 anObj = cp->string_at(index, CATCH);
jrose@431 337 }
duke@0 338 anObj->print_value_on(st);
duke@0 339 st->print(" {0x%lx}", (address)anObj);
duke@0 340 break;
duke@0 341 case JVM_CONSTANT_Integer :
duke@0 342 st->print("%d", cp->int_at(index));
duke@0 343 break;
duke@0 344 case JVM_CONSTANT_Float :
duke@0 345 st->print("%f", cp->float_at(index));
duke@0 346 break;
duke@0 347 case JVM_CONSTANT_Long :
duke@0 348 st->print_jlong(cp->long_at(index));
duke@0 349 index++; // Skip entry following eigth-byte constant
duke@0 350 break;
duke@0 351 case JVM_CONSTANT_Double :
duke@0 352 st->print("%lf", cp->double_at(index));
duke@0 353 index++; // Skip entry following eigth-byte constant
duke@0 354 break;
duke@0 355 case JVM_CONSTANT_NameAndType :
duke@0 356 st->print("name_index=%d", cp->name_ref_index_at(index));
duke@0 357 st->print(" signature_index=%d", cp->signature_ref_index_at(index));
duke@0 358 break;
duke@0 359 case JVM_CONSTANT_Utf8 :
duke@0 360 cp->symbol_at(index)->print_value_on(st);
duke@0 361 break;
duke@0 362 case JVM_CONSTANT_UnresolvedClass : // fall-through
duke@0 363 case JVM_CONSTANT_UnresolvedClassInError: {
duke@0 364 // unresolved_klass_at requires lock or safe world.
duke@0 365 oop entry = *cp->obj_at_addr(index);
duke@0 366 entry->print_value_on(st);
duke@0 367 }
duke@0 368 break;
duke@0 369 default:
duke@0 370 ShouldNotReachHere();
duke@0 371 break;
duke@0 372 }
duke@0 373 st->cr();
duke@0 374 }
duke@0 375 st->cr();
duke@0 376
duke@0 377 // Restore cache
duke@0 378 cp->set_cache(cache());
duke@0 379 }
duke@0 380
duke@0 381
duke@0 382 #endif
duke@0 383
duke@0 384 const char* constantPoolKlass::internal_name() const {
duke@0 385 return "{constant pool}";
duke@0 386 }
duke@0 387
duke@0 388 // Verification
duke@0 389
duke@0 390 void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) {
duke@0 391 Klass::oop_verify_on(obj, st);
duke@0 392 guarantee(obj->is_constantPool(), "object must be constant pool");
duke@0 393 constantPoolOop cp = constantPoolOop(obj);
duke@0 394 guarantee(cp->is_perm(), "should be in permspace");
duke@0 395 if (!cp->partially_loaded()) {
duke@0 396 oop* base = (oop*)cp->base();
duke@0 397 for (int i = 0; i< cp->length(); i++) {
duke@0 398 if (cp->tag_at(i).is_klass()) {
duke@0 399 guarantee((*base)->is_perm(), "should be in permspace");
duke@0 400 guarantee((*base)->is_klass(), "should be klass");
duke@0 401 }
duke@0 402 if (cp->tag_at(i).is_unresolved_klass()) {
duke@0 403 guarantee((*base)->is_perm(), "should be in permspace");
duke@0 404 guarantee((*base)->is_symbol() || (*base)->is_klass(),
duke@0 405 "should be symbol or klass");
duke@0 406 }
duke@0 407 if (cp->tag_at(i).is_symbol()) {
duke@0 408 guarantee((*base)->is_perm(), "should be in permspace");
duke@0 409 guarantee((*base)->is_symbol(), "should be symbol");
duke@0 410 }
duke@0 411 if (cp->tag_at(i).is_unresolved_string()) {
duke@0 412 guarantee((*base)->is_perm(), "should be in permspace");
duke@0 413 guarantee((*base)->is_symbol() || (*base)->is_instance(),
duke@0 414 "should be symbol or instance");
duke@0 415 }
duke@0 416 if (cp->tag_at(i).is_string()) {
jrose@431 417 if (!cp->has_pseudo_string()) {
jrose@431 418 guarantee((*base)->is_perm(), "should be in permspace");
jrose@431 419 guarantee((*base)->is_instance(), "should be instance");
jrose@431 420 } else {
jrose@431 421 // can be non-perm, can be non-instance (array)
jrose@431 422 }
duke@0 423 }
duke@0 424 base++;
duke@0 425 }
duke@0 426 guarantee(cp->tags()->is_perm(), "should be in permspace");
duke@0 427 guarantee(cp->tags()->is_typeArray(), "should be type array");
duke@0 428 if (cp->cache() != NULL) {
duke@0 429 // Note: cache() can be NULL before a class is completely setup or
duke@0 430 // in temporary constant pools used during constant pool merging
duke@0 431 guarantee(cp->cache()->is_perm(), "should be in permspace");
duke@0 432 guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache");
duke@0 433 }
duke@0 434 if (cp->pool_holder() != NULL) {
duke@0 435 // Note: pool_holder() can be NULL in temporary constant pools
duke@0 436 // used during constant pool merging
duke@0 437 guarantee(cp->pool_holder()->is_perm(), "should be in permspace");
duke@0 438 guarantee(cp->pool_holder()->is_klass(), "should be klass");
duke@0 439 }
duke@0 440 }
duke@0 441 }
duke@0 442
duke@0 443 bool constantPoolKlass::oop_partially_loaded(oop obj) const {
duke@0 444 assert(obj->is_constantPool(), "object must be constant pool");
duke@0 445 constantPoolOop cp = constantPoolOop(obj);
duke@0 446 return cp->tags() == NULL || cp->pool_holder() == (klassOop) cp; // Check whether pool holder points to self
duke@0 447 }
duke@0 448
duke@0 449
duke@0 450 void constantPoolKlass::oop_set_partially_loaded(oop obj) {
duke@0 451 assert(obj->is_constantPool(), "object must be constant pool");
duke@0 452 constantPoolOop cp = constantPoolOop(obj);
duke@0 453 assert(cp->pool_holder() == NULL, "just checking");
duke@0 454 cp->set_pool_holder((klassOop) cp); // Temporarily set pool holder to point to self
duke@0 455 }
duke@0 456
duke@0 457 #ifndef PRODUCT
duke@0 458 // CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
duke@0 459 void constantPoolKlass::preload_and_initialize_all_classes(oop obj, TRAPS) {
duke@0 460 guarantee(obj->is_constantPool(), "object must be constant pool");
duke@0 461 constantPoolHandle cp(THREAD, (constantPoolOop)obj);
duke@0 462 guarantee(!cp->partially_loaded(), "must be fully loaded");
duke@0 463
duke@0 464 for (int i = 0; i< cp->length(); i++) {
duke@0 465 if (cp->tag_at(i).is_unresolved_klass()) {
duke@0 466 // This will force loading of the class
duke@0 467 klassOop klass = cp->klass_at(i, CHECK);
duke@0 468 if (klass->is_instance()) {
duke@0 469 // Force initialization of class
duke@0 470 instanceKlass::cast(klass)->initialize(CHECK);
duke@0 471 }
duke@0 472 }
duke@0 473 }
duke@0 474 }
duke@0 475
duke@0 476 #endif