src/share/vm/oops/constantPoolKlass.cpp

changeset 2497
3582bf76420e
parent 2353
dad31fc330cd
child 2533
c5a923563727
     1.1 --- a/src/share/vm/oops/constantPoolKlass.cpp	Thu Jan 27 13:42:28 2011 -0800
     1.2 +++ b/src/share/vm/oops/constantPoolKlass.cpp	Thu Jan 27 16:11:27 2011 -0800
     1.3 @@ -33,7 +33,7 @@
     1.4  #include "oops/constantPoolOop.hpp"
     1.5  #include "oops/oop.inline.hpp"
     1.6  #include "oops/oop.inline2.hpp"
     1.7 -#include "oops/symbolOop.hpp"
     1.8 +#include "oops/symbol.hpp"
     1.9  #include "runtime/handles.inline.hpp"
    1.10  #ifdef TARGET_OS_FAMILY_linux
    1.11  # include "thread_linux.inline.hpp"
    1.12 @@ -388,8 +388,12 @@
    1.13        case JVM_CONSTANT_UnresolvedClass :               // fall-through
    1.14        case JVM_CONSTANT_UnresolvedClassInError: {
    1.15          // unresolved_klass_at requires lock or safe world.
    1.16 -        oop entry = *cp->obj_at_addr(index);
    1.17 -        entry->print_value_on(st);
    1.18 +        CPSlot entry = cp->slot_at(index);
    1.19 +        if (entry.is_oop()) {
    1.20 +          entry.get_oop()->print_value_on(st);
    1.21 +        } else {
    1.22 +          entry.get_symbol()->print_value_on(st);
    1.23 +        }
    1.24          }
    1.25          break;
    1.26        case JVM_CONSTANT_MethodHandle :
    1.27 @@ -450,36 +454,43 @@
    1.28    constantPoolOop cp = constantPoolOop(obj);
    1.29    guarantee(cp->is_perm(), "should be in permspace");
    1.30    if (!cp->partially_loaded()) {
    1.31 -    oop* base = (oop*)cp->base();
    1.32      for (int i = 0; i< cp->length();  i++) {
    1.33 +      CPSlot entry = cp->slot_at(i);
    1.34        if (cp->tag_at(i).is_klass()) {
    1.35 -        guarantee((*base)->is_perm(),     "should be in permspace");
    1.36 -        guarantee((*base)->is_klass(),    "should be klass");
    1.37 +        if (entry.is_oop()) {
    1.38 +          guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
    1.39 +          guarantee(entry.get_oop()->is_klass(),    "should be klass");
    1.40 +        }
    1.41        }
    1.42        if (cp->tag_at(i).is_unresolved_klass()) {
    1.43 -        guarantee((*base)->is_perm(),     "should be in permspace");
    1.44 -        guarantee((*base)->is_symbol() || (*base)->is_klass(),
    1.45 -                  "should be symbol or klass");
    1.46 +        if (entry.is_oop()) {
    1.47 +          guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
    1.48 +          guarantee(entry.get_oop()->is_klass(),    "should be klass");
    1.49 +        }
    1.50        }
    1.51        if (cp->tag_at(i).is_symbol()) {
    1.52 -        guarantee((*base)->is_perm(),     "should be in permspace");
    1.53 -        guarantee((*base)->is_symbol(),   "should be symbol");
    1.54 +        guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
    1.55        }
    1.56        if (cp->tag_at(i).is_unresolved_string()) {
    1.57 -        guarantee((*base)->is_perm(),     "should be in permspace");
    1.58 -        guarantee((*base)->is_symbol() || (*base)->is_instance(),
    1.59 -                  "should be symbol or instance");
    1.60 +        if (entry.is_oop()) {
    1.61 +          guarantee(entry.get_oop()->is_perm(),     "should be in permspace");
    1.62 +          guarantee(entry.get_oop()->is_instance(), "should be instance");
    1.63 +        }
    1.64 +        else {
    1.65 +          guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
    1.66 +        }
    1.67        }
    1.68        if (cp->tag_at(i).is_string()) {
    1.69          if (!cp->has_pseudo_string()) {
    1.70 -          guarantee((*base)->is_perm(),   "should be in permspace");
    1.71 -          guarantee((*base)->is_instance(), "should be instance");
    1.72 +          if (entry.is_oop()) {
    1.73 +            guarantee(entry.get_oop()->is_perm(),   "should be in permspace");
    1.74 +            guarantee(entry.get_oop()->is_instance(), "should be instance");
    1.75 +          }
    1.76          } else {
    1.77            // can be non-perm, can be non-instance (array)
    1.78          }
    1.79        }
    1.80        // FIXME: verify JSR 292 tags JVM_CONSTANT_MethodHandle, etc.
    1.81 -      base++;
    1.82      }
    1.83      guarantee(cp->tags()->is_perm(),         "should be in permspace");
    1.84      guarantee(cp->tags()->is_typeArray(),    "should be type array");

mercurial