hotspot/src/share/vm/oops/constantPool.cpp
changeset 37451 ab07c0e0b05c
parent 37248 11a660dbbb8e
child 37475 0da78fa10d78
equal deleted inserted replaced
37444:16caac2c1d9b 37451:ab07c0e0b05c
   281   // Make this class loader depend upon the class loader owning the class reference
   281   // Make this class loader depend upon the class loader owning the class reference
   282   ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
   282   ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
   283   this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
   283   this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
   284 
   284 
   285   // logging for classresolve tag.
   285   // logging for classresolve tag.
   286   trace_class_resolution(this_cp, k);
   286   if (log_is_enabled(Debug, classresolve)){
   287 
   287     trace_class_resolution(this_cp, k);
       
   288   }
   288   this_cp->klass_at_put(which, k());
   289   this_cp->klass_at_put(which, k());
   289   entry = this_cp->resolved_klass_at(which);
   290   entry = this_cp->resolved_klass_at(which);
   290   assert(entry.is_resolved() && entry.get_klass()->is_klass(), "must be resolved at this point");
   291   assert(entry.is_resolved() && entry.get_klass()->is_klass(), "must be resolved at this point");
   291   return entry.get_klass();
   292   return entry.get_klass();
   292 }
   293 }
   338                                                    int which) {
   339                                                    int which) {
   339   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   340   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   340   int cache_index = decode_cpcache_index(which, true);
   341   int cache_index = decode_cpcache_index(which, true);
   341   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
   342   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
   342     // FIXME: should be an assert
   343     // FIXME: should be an assert
   343     if (PrintMiscellaneous && (Verbose||WizardMode)) {
   344     log_debug(classresolve)("bad operand %d in:", which); cpool->print();
   344       tty->print_cr("bad operand %d in:", which); cpool->print();
       
   345     }
       
   346     return NULL;
   345     return NULL;
   347   }
   346   }
   348   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   347   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   349   return e->method_if_resolved(cpool);
   348   return e->method_if_resolved(cpool);
   350 }
   349 }
   670     {
   669     {
   671       int ref_kind                 = this_cp->method_handle_ref_kind_at(index);
   670       int ref_kind                 = this_cp->method_handle_ref_kind_at(index);
   672       int callee_index             = this_cp->method_handle_klass_index_at(index);
   671       int callee_index             = this_cp->method_handle_klass_index_at(index);
   673       Symbol*  name =      this_cp->method_handle_name_ref_at(index);
   672       Symbol*  name =      this_cp->method_handle_name_ref_at(index);
   674       Symbol*  signature = this_cp->method_handle_signature_ref_at(index);
   673       Symbol*  signature = this_cp->method_handle_signature_ref_at(index);
   675       if (PrintMiscellaneous)
   674       { ResourceMark rm(THREAD);
   676         tty->print_cr("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
   675         log_debug(classresolve)("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
   677                       ref_kind, index, this_cp->method_handle_index_at(index),
   676                               ref_kind, index, this_cp->method_handle_index_at(index),
   678                       callee_index, name->as_C_string(), signature->as_C_string());
   677                               callee_index, name->as_C_string(), signature->as_C_string());
       
   678       }
   679       KlassHandle callee;
   679       KlassHandle callee;
   680       { Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
   680       { Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
   681         callee = KlassHandle(THREAD, k);
   681         callee = KlassHandle(THREAD, k);
   682       }
   682       }
   683       KlassHandle klass(THREAD, this_cp->pool_holder());
   683       KlassHandle klass(THREAD, this_cp->pool_holder());
   692     }
   692     }
   693 
   693 
   694   case JVM_CONSTANT_MethodType:
   694   case JVM_CONSTANT_MethodType:
   695     {
   695     {
   696       Symbol*  signature = this_cp->method_type_signature_at(index);
   696       Symbol*  signature = this_cp->method_type_signature_at(index);
   697       if (PrintMiscellaneous)
   697       { ResourceMark rm(THREAD);
   698         tty->print_cr("resolve JVM_CONSTANT_MethodType [%d/%d] %s",
   698         log_debug(classresolve)("resolve JVM_CONSTANT_MethodType [%d/%d] %s",
   699                       index, this_cp->method_type_index_at(index),
   699                               index, this_cp->method_type_index_at(index),
   700                       signature->as_C_string());
   700                               signature->as_C_string());
       
   701       }
   701       KlassHandle klass(THREAD, this_cp->pool_holder());
   702       KlassHandle klass(THREAD, this_cp->pool_holder());
   702       Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
   703       Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
   703       result_oop = value();
   704       result_oop = value();
   704       if (HAS_PENDING_EXCEPTION) {
   705       if (HAS_PENDING_EXCEPTION) {
   705         save_and_throw_exception(this_cp, index, tag, CHECK_NULL);
   706         save_and_throw_exception(this_cp, index, tag, CHECK_NULL);