hotspot/src/share/vm/oops/constantPoolOop.cpp

Print this page




 252     return (klassOop)entry.get_oop();
 253   } else {
 254     assert(entry.is_metadata(), "must be either symbol or klass");
 255     Symbol*  name  = entry.get_symbol();
 256     oop loader = instanceKlass::cast(this_oop->pool_holder())->class_loader();
 257     oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain();
 258     Handle h_loader(THREAD, loader);
 259     Handle h_prot  (THREAD, protection_domain);
 260     KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD));
 261 
 262     // Do access check for klasses
 263     if( k.not_null() ) verify_constant_pool_resolve(this_oop, k, CHECK_NULL);
 264     return k();
 265   }
 266 }
 267 
 268 
 269 methodOop constantPoolOopDesc::method_at_if_loaded(constantPoolHandle cpool,
 270                                                    int which, Bytecodes::Code invoke_code) {
 271   assert(!constantPoolCacheOopDesc::is_secondary_index(which), "no indy instruction here");
 272   if (cpool->cache() == NULL)  return false;  // nothing to load yet
 273   int cache_index = which - CPCACHE_INDEX_TAG;
 274   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
 275     if (PrintMiscellaneous && (Verbose||WizardMode)) {
 276       tty->print_cr("bad operand %d for %d in:", which, invoke_code); cpool->print();
 277     }
 278     return NULL;
 279   }
 280   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
 281   if (invoke_code != Bytecodes::_illegal)
 282     return e->get_method_if_resolved(invoke_code, cpool);
 283   Bytecodes::Code bc;
 284   if ((bc = e->bytecode_1()) != (Bytecodes::Code)0)
 285     return e->get_method_if_resolved(bc, cpool);
 286   if ((bc = e->bytecode_2()) != (Bytecodes::Code)0)
 287     return e->get_method_if_resolved(bc, cpool);
 288   return NULL;
 289 }
 290 
 291 
 292 Symbol* constantPoolOopDesc::impl_name_ref_at(int which, bool uncached) {




 252     return (klassOop)entry.get_oop();
 253   } else {
 254     assert(entry.is_metadata(), "must be either symbol or klass");
 255     Symbol*  name  = entry.get_symbol();
 256     oop loader = instanceKlass::cast(this_oop->pool_holder())->class_loader();
 257     oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain();
 258     Handle h_loader(THREAD, loader);
 259     Handle h_prot  (THREAD, protection_domain);
 260     KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD));
 261 
 262     // Do access check for klasses
 263     if( k.not_null() ) verify_constant_pool_resolve(this_oop, k, CHECK_NULL);
 264     return k();
 265   }
 266 }
 267 
 268 
 269 methodOop constantPoolOopDesc::method_at_if_loaded(constantPoolHandle cpool,
 270                                                    int which, Bytecodes::Code invoke_code) {
 271   assert(!constantPoolCacheOopDesc::is_secondary_index(which), "no indy instruction here");
 272   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
 273   int cache_index = which - CPCACHE_INDEX_TAG;
 274   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
 275     if (PrintMiscellaneous && (Verbose||WizardMode)) {
 276       tty->print_cr("bad operand %d for %d in:", which, invoke_code); cpool->print();
 277     }
 278     return NULL;
 279   }
 280   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
 281   if (invoke_code != Bytecodes::_illegal)
 282     return e->get_method_if_resolved(invoke_code, cpool);
 283   Bytecodes::Code bc;
 284   if ((bc = e->bytecode_1()) != (Bytecodes::Code)0)
 285     return e->get_method_if_resolved(bc, cpool);
 286   if ((bc = e->bytecode_2()) != (Bytecodes::Code)0)
 287     return e->get_method_if_resolved(bc, cpool);
 288   return NULL;
 289 }
 290 
 291 
 292 Symbol* constantPoolOopDesc::impl_name_ref_at(int which, bool uncached) {