src/share/vm/oops/constantPool.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8014013 Sdiff src/share/vm/oops

src/share/vm/oops/constantPool.cpp

Print this page




 379       KlassHandle klass(THREAD, k);
 380       // return NULL if verification fails
 381       verify_constant_pool_resolve(this_oop, klass, THREAD);
 382       if (HAS_PENDING_EXCEPTION) {
 383         CLEAR_PENDING_EXCEPTION;
 384         return NULL;
 385       }
 386       return klass();
 387     } else {
 388       return k;
 389     }
 390   }
 391 }
 392 
 393 
 394 Klass* ConstantPool::klass_ref_at_if_loaded(constantPoolHandle this_oop, int which) {
 395   return klass_at_if_loaded(this_oop, this_oop->klass_ref_index_at(which));
 396 }
 397 
 398 
 399 // This is an interface for the compiler that allows accessing non-resolved entries
 400 // in the constant pool - but still performs the validations tests. Must be used
 401 // in a pre-parse of the compiler - to determine what it can do and not do.
 402 // Note: We cannot update the ConstantPool from the vm_thread.
 403 Klass* ConstantPool::klass_ref_at_if_loaded_check(constantPoolHandle this_oop, int index, TRAPS) {
 404   int which = this_oop->klass_ref_index_at(index);
 405   CPSlot entry = this_oop->slot_at(which);
 406   if (entry.is_resolved()) {
 407     assert(entry.get_klass()->is_klass(), "must be");
 408     return entry.get_klass();
 409   } else {
 410     assert(entry.is_unresolved(), "must be either symbol or klass");
 411     Symbol*  name  = entry.get_symbol();
 412     oop loader = this_oop->pool_holder()->class_loader();
 413     oop protection_domain = this_oop->pool_holder()->protection_domain();
 414     Handle h_loader(THREAD, loader);
 415     Handle h_prot  (THREAD, protection_domain);
 416     KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD));
 417 
 418     // Do access check for klasses
 419     if( k.not_null() ) verify_constant_pool_resolve(this_oop, k, CHECK_NULL);
 420     return k();
 421   }
 422 }
 423 
 424 
 425 Method* ConstantPool::method_at_if_loaded(constantPoolHandle cpool,
 426                                                    int which) {
 427   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
 428   int cache_index = decode_cpcache_index(which, true);
 429   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
 430     // FIXME: should be an assert
 431     if (PrintMiscellaneous && (Verbose||WizardMode)) {
 432       tty->print_cr("bad operand %d in:", which); cpool->print();
 433     }
 434     return NULL;
 435   }
 436   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
 437   return e->method_if_resolved(cpool);
 438 }
 439 
 440 
 441 bool ConstantPool::has_appendix_at_if_loaded(constantPoolHandle cpool, int which) {
 442   if (cpool->cache() == NULL)  return false;  // nothing to load yet
 443   int cache_index = decode_cpcache_index(which, true);
 444   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);




 379       KlassHandle klass(THREAD, k);
 380       // return NULL if verification fails
 381       verify_constant_pool_resolve(this_oop, klass, THREAD);
 382       if (HAS_PENDING_EXCEPTION) {
 383         CLEAR_PENDING_EXCEPTION;
 384         return NULL;
 385       }
 386       return klass();
 387     } else {
 388       return k;
 389     }
 390   }
 391 }
 392 
 393 
 394 Klass* ConstantPool::klass_ref_at_if_loaded(constantPoolHandle this_oop, int which) {
 395   return klass_at_if_loaded(this_oop, this_oop->klass_ref_index_at(which));
 396 }
 397 
 398 


























 399 Method* ConstantPool::method_at_if_loaded(constantPoolHandle cpool,
 400                                                    int which) {
 401   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
 402   int cache_index = decode_cpcache_index(which, true);
 403   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
 404     // FIXME: should be an assert
 405     if (PrintMiscellaneous && (Verbose||WizardMode)) {
 406       tty->print_cr("bad operand %d in:", which); cpool->print();
 407     }
 408     return NULL;
 409   }
 410   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
 411   return e->method_if_resolved(cpool);
 412 }
 413 
 414 
 415 bool ConstantPool::has_appendix_at_if_loaded(constantPoolHandle cpool, int which) {
 416   if (cpool->cache() == NULL)  return false;  // nothing to load yet
 417   int cache_index = decode_cpcache_index(which, true);
 418   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);


src/share/vm/oops/constantPool.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File