src/share/vm/oops/constantPoolKlass.cpp

changeset 2900
69c94f488271
parent 2750
6c97c830fb6f
child 2982
ddd894528dbc
     1.1 --- a/src/share/vm/oops/constantPoolKlass.cpp	Tue May 10 12:57:21 2011 -0700
     1.2 +++ b/src/share/vm/oops/constantPoolKlass.cpp	Tue May 10 17:44:14 2011 -0700
     1.3 @@ -285,10 +285,9 @@
     1.4  void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
     1.5    assert(obj->is_constantPool(), "should be constant pool");
     1.6    constantPoolOop cp = (constantPoolOop) obj;
     1.7 -  if (cp->tags() != NULL &&
     1.8 -      (!JavaObjectsInPerm || (EnableInvokeDynamic && cp->has_pseudo_string()))) {
     1.9 +  if (cp->tags() != NULL) {
    1.10      for (int i = 1; i < cp->length(); ++i) {
    1.11 -      if (cp->tag_at(i).is_string()) {
    1.12 +      if (cp->is_pointer_entry(i)) {
    1.13          oop* base = cp->obj_at_addr_raw(i);
    1.14          if (PSScavenge::should_scavenge(base)) {
    1.15            pm->claim_or_forward_depth(base);
    1.16 @@ -342,6 +341,11 @@
    1.17          anObj->print_value_on(st);
    1.18          st->print(" {0x%lx}", (address)anObj);
    1.19          break;
    1.20 +      case JVM_CONSTANT_Object :
    1.21 +        anObj = cp->object_at(index);
    1.22 +        anObj->print_value_on(st);
    1.23 +        st->print(" {0x%lx}", (address)anObj);
    1.24 +        break;
    1.25        case JVM_CONSTANT_Integer :
    1.26          st->print("%d", cp->int_at(index));
    1.27          break;
    1.28 @@ -432,23 +436,21 @@
    1.29    guarantee(cp->is_perm(), "should be in permspace");
    1.30    if (!cp->partially_loaded()) {
    1.31      for (int i = 0; i< cp->length();  i++) {
    1.32 +      constantTag tag = cp->tag_at(i);
    1.33        CPSlot entry = cp->slot_at(i);
    1.34 -      if (cp->tag_at(i).is_klass()) {
    1.35 +      if (tag.is_klass()) {
    1.36          if (entry.is_oop()) {
    1.37            guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
    1.38            guarantee(entry.get_oop()->is_klass(),    "should be klass");
    1.39          }
    1.40 -      }
    1.41 -      if (cp->tag_at(i).is_unresolved_klass()) {
    1.42 +      } else if (tag.is_unresolved_klass()) {
    1.43          if (entry.is_oop()) {
    1.44            guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
    1.45            guarantee(entry.get_oop()->is_klass(),    "should be klass");
    1.46          }
    1.47 -      }
    1.48 -      if (cp->tag_at(i).is_symbol()) {
    1.49 +      } else if (tag.is_symbol()) {
    1.50          guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
    1.51 -      }
    1.52 -      if (cp->tag_at(i).is_unresolved_string()) {
    1.53 +      } else if (tag.is_unresolved_string()) {
    1.54          if (entry.is_oop()) {
    1.55            guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
    1.56            guarantee(entry.get_oop()->is_instance(), "should be instance");
    1.57 @@ -456,8 +458,7 @@
    1.58          else {
    1.59            guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
    1.60          }
    1.61 -      }
    1.62 -      if (cp->tag_at(i).is_string()) {
    1.63 +      } else if (tag.is_string()) {
    1.64          if (!cp->has_pseudo_string()) {
    1.65            if (entry.is_oop()) {
    1.66              guarantee(!JavaObjectsInPerm || entry.get_oop()->is_perm(),
    1.67 @@ -467,8 +468,11 @@
    1.68          } else {
    1.69            // can be non-perm, can be non-instance (array)
    1.70          }
    1.71 +      } else if (tag.is_object()) {
    1.72 +        assert(entry.get_oop()->is_oop(), "should be some valid oop");
    1.73 +      } else {
    1.74 +        assert(!cp->is_pointer_entry(i), "unhandled oop type in constantPoolKlass::verify_on");
    1.75        }
    1.76 -      // FIXME: verify JSR 292 tags JVM_CONSTANT_MethodHandle, etc.
    1.77      }
    1.78      guarantee(cp->tags()->is_perm(),         "should be in permspace");
    1.79      guarantee(cp->tags()->is_typeArray(),    "should be type array");

mercurial