hotspot/src/share/vm/oops/constantPoolKlass.cpp
changeset 9635 f668c715d4aa
parent 9124 f60dee480d49
child 10008 d84de97ad847
equal deleted inserted replaced
9634:985153f94e98 9635:f668c715d4aa
   283 }
   283 }
   284 
   284 
   285 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
   285 void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
   286   assert(obj->is_constantPool(), "should be constant pool");
   286   assert(obj->is_constantPool(), "should be constant pool");
   287   constantPoolOop cp = (constantPoolOop) obj;
   287   constantPoolOop cp = (constantPoolOop) obj;
   288   if (cp->tags() != NULL &&
   288   if (cp->tags() != NULL) {
   289       (!JavaObjectsInPerm || (EnableInvokeDynamic && cp->has_pseudo_string()))) {
       
   290     for (int i = 1; i < cp->length(); ++i) {
   289     for (int i = 1; i < cp->length(); ++i) {
   291       if (cp->tag_at(i).is_string()) {
   290       if (cp->is_pointer_entry(i)) {
   292         oop* base = cp->obj_at_addr_raw(i);
   291         oop* base = cp->obj_at_addr_raw(i);
   293         if (PSScavenge::should_scavenge(base)) {
   292         if (PSScavenge::should_scavenge(base)) {
   294           pm->claim_or_forward_depth(base);
   293           pm->claim_or_forward_depth(base);
   295         }
   294         }
   296       }
   295       }
   337         if (cp->is_pseudo_string_at(index)) {
   336         if (cp->is_pseudo_string_at(index)) {
   338           anObj = cp->pseudo_string_at(index);
   337           anObj = cp->pseudo_string_at(index);
   339         } else {
   338         } else {
   340           anObj = cp->string_at(index, CATCH);
   339           anObj = cp->string_at(index, CATCH);
   341         }
   340         }
       
   341         anObj->print_value_on(st);
       
   342         st->print(" {0x%lx}", (address)anObj);
       
   343         break;
       
   344       case JVM_CONSTANT_Object :
       
   345         anObj = cp->object_at(index);
   342         anObj->print_value_on(st);
   346         anObj->print_value_on(st);
   343         st->print(" {0x%lx}", (address)anObj);
   347         st->print(" {0x%lx}", (address)anObj);
   344         break;
   348         break;
   345       case JVM_CONSTANT_Integer :
   349       case JVM_CONSTANT_Integer :
   346         st->print("%d", cp->int_at(index));
   350         st->print("%d", cp->int_at(index));
   430   guarantee(obj->is_constantPool(), "object must be constant pool");
   434   guarantee(obj->is_constantPool(), "object must be constant pool");
   431   constantPoolOop cp = constantPoolOop(obj);
   435   constantPoolOop cp = constantPoolOop(obj);
   432   guarantee(cp->is_perm(), "should be in permspace");
   436   guarantee(cp->is_perm(), "should be in permspace");
   433   if (!cp->partially_loaded()) {
   437   if (!cp->partially_loaded()) {
   434     for (int i = 0; i< cp->length();  i++) {
   438     for (int i = 0; i< cp->length();  i++) {
       
   439       constantTag tag = cp->tag_at(i);
   435       CPSlot entry = cp->slot_at(i);
   440       CPSlot entry = cp->slot_at(i);
   436       if (cp->tag_at(i).is_klass()) {
   441       if (tag.is_klass()) {
   437         if (entry.is_oop()) {
   442         if (entry.is_oop()) {
   438           guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
   443           guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
   439           guarantee(entry.get_oop()->is_klass(),    "should be klass");
   444           guarantee(entry.get_oop()->is_klass(),    "should be klass");
   440         }
   445         }
   441       }
   446       } else if (tag.is_unresolved_klass()) {
   442       if (cp->tag_at(i).is_unresolved_klass()) {
       
   443         if (entry.is_oop()) {
   447         if (entry.is_oop()) {
   444           guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
   448           guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
   445           guarantee(entry.get_oop()->is_klass(),    "should be klass");
   449           guarantee(entry.get_oop()->is_klass(),    "should be klass");
   446         }
   450         }
   447       }
   451       } else if (tag.is_symbol()) {
   448       if (cp->tag_at(i).is_symbol()) {
       
   449         guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
   452         guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
   450       }
   453       } else if (tag.is_unresolved_string()) {
   451       if (cp->tag_at(i).is_unresolved_string()) {
       
   452         if (entry.is_oop()) {
   454         if (entry.is_oop()) {
   453           guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
   455           guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
   454           guarantee(entry.get_oop()->is_instance(), "should be instance");
   456           guarantee(entry.get_oop()->is_instance(), "should be instance");
   455         }
   457         }
   456         else {
   458         else {
   457           guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
   459           guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
   458         }
   460         }
   459       }
   461       } else if (tag.is_string()) {
   460       if (cp->tag_at(i).is_string()) {
       
   461         if (!cp->has_pseudo_string()) {
   462         if (!cp->has_pseudo_string()) {
   462           if (entry.is_oop()) {
   463           if (entry.is_oop()) {
   463             guarantee(!JavaObjectsInPerm || entry.get_oop()->is_perm(),
   464             guarantee(!JavaObjectsInPerm || entry.get_oop()->is_perm(),
   464                       "should be in permspace");
   465                       "should be in permspace");
   465             guarantee(entry.get_oop()->is_instance(), "should be instance");
   466             guarantee(entry.get_oop()->is_instance(), "should be instance");
   466           }
   467           }
   467         } else {
   468         } else {
   468           // can be non-perm, can be non-instance (array)
   469           // can be non-perm, can be non-instance (array)
   469         }
   470         }
   470       }
   471       } else if (tag.is_object()) {
   471       // FIXME: verify JSR 292 tags JVM_CONSTANT_MethodHandle, etc.
   472         assert(entry.get_oop()->is_oop(), "should be some valid oop");
       
   473       } else {
       
   474         assert(!cp->is_pointer_entry(i), "unhandled oop type in constantPoolKlass::verify_on");
       
   475       }
   472     }
   476     }
   473     guarantee(cp->tags()->is_perm(),         "should be in permspace");
   477     guarantee(cp->tags()->is_perm(),         "should be in permspace");
   474     guarantee(cp->tags()->is_typeArray(),    "should be type array");
   478     guarantee(cp->tags()->is_typeArray(),    "should be type array");
   475     if (cp->cache() != NULL) {
   479     if (cp->cache() != NULL) {
   476       // Note: cache() can be NULL before a class is completely setup or
   480       // Note: cache() can be NULL before a class is completely setup or