hotspot/src/share/vm/oops/constantPoolKlass.cpp
changeset 5696 93e15b419ad4
parent 4584 e2a449e8cc6f
child 5702 201c5cde25bb
equal deleted inserted replaced
5695:7fbbde5b4e3e 5696:93e15b419ad4
   308   oop anObj;
   308   oop anObj;
   309   assert(obj->is_constantPool(), "must be constantPool");
   309   assert(obj->is_constantPool(), "must be constantPool");
   310   Klass::oop_print_on(obj, st);
   310   Klass::oop_print_on(obj, st);
   311   constantPoolOop cp = constantPoolOop(obj);
   311   constantPoolOop cp = constantPoolOop(obj);
   312   if (cp->flags() != 0) {
   312   if (cp->flags() != 0) {
   313     st->print(" - flags : 0x%x", cp->flags());
   313     st->print(" - flags: 0x%x", cp->flags());
   314     if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
   314     if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
   315     if (cp->has_invokedynamic()) st->print(" has_invokedynamic");
   315     if (cp->has_invokedynamic()) st->print(" has_invokedynamic");
   316     st->cr();
   316     st->cr();
   317   }
   317   }
   318 
   318   st->print_cr(" - cache: " INTPTR_FORMAT, cp->cache());
   319   // Temp. remove cache so we can do lookups with original indicies.
       
   320   constantPoolCacheHandle cache (THREAD, cp->cache());
       
   321   cp->set_cache(NULL);
       
   322 
   319 
   323   for (int index = 1; index < cp->length(); index++) {      // Index 0 is unused
   320   for (int index = 1; index < cp->length(); index++) {      // Index 0 is unused
   324     st->print(" - %3d : ", index);
   321     st->print(" - %3d : ", index);
   325     cp->tag_at(index).print_on(st);
   322     cp->tag_at(index).print_on(st);
   326     st->print(" : ");
   323     st->print(" : ");
   332         }
   329         }
   333         break;
   330         break;
   334       case JVM_CONSTANT_Fieldref :
   331       case JVM_CONSTANT_Fieldref :
   335       case JVM_CONSTANT_Methodref :
   332       case JVM_CONSTANT_Methodref :
   336       case JVM_CONSTANT_InterfaceMethodref :
   333       case JVM_CONSTANT_InterfaceMethodref :
   337         st->print("klass_index=%d", cp->klass_ref_index_at(index));
   334         st->print("klass_index=%d", cp->uncached_klass_ref_index_at(index));
   338         st->print(" name_and_type_index=%d", cp->name_and_type_ref_index_at(index));
   335         st->print(" name_and_type_index=%d", cp->uncached_name_and_type_ref_index_at(index));
   339         break;
   336         break;
   340       case JVM_CONSTANT_UnresolvedString :
   337       case JVM_CONSTANT_UnresolvedString :
   341       case JVM_CONSTANT_String :
   338       case JVM_CONSTANT_String :
   342         if (cp->is_pseudo_string_at(index)) {
   339         if (cp->is_pseudo_string_at(index)) {
   343           anObj = cp->pseudo_string_at(index);
   340           anObj = cp->pseudo_string_at(index);
   380         break;
   377         break;
   381     }
   378     }
   382     st->cr();
   379     st->cr();
   383   }
   380   }
   384   st->cr();
   381   st->cr();
   385 
       
   386   // Restore cache
       
   387   cp->set_cache(cache());
       
   388 }
   382 }
   389 
   383 
   390 #endif
   384 #endif
   391 
   385 
   392 void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
   386 void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
   396   if (cp->has_pseudo_string()) st->print("/pseudo_string");
   390   if (cp->has_pseudo_string()) st->print("/pseudo_string");
   397   if (cp->has_invokedynamic()) st->print("/invokedynamic");
   391   if (cp->has_invokedynamic()) st->print("/invokedynamic");
   398   cp->print_address_on(st);
   392   cp->print_address_on(st);
   399   st->print(" for ");
   393   st->print(" for ");
   400   cp->pool_holder()->print_value_on(st);
   394   cp->pool_holder()->print_value_on(st);
       
   395   if (cp->cache() != NULL) {
       
   396     st->print(" cache=" PTR_FORMAT, cp->cache());
       
   397   }
   401 }
   398 }
   402 
   399 
   403 const char* constantPoolKlass::internal_name() const {
   400 const char* constantPoolKlass::internal_name() const {
   404   return "{constant pool}";
   401   return "{constant pool}";
   405 }
   402 }