src/share/vm/oops/constantPoolKlass.cpp

changeset 866
a45484ea312d
parent 631
d1605aabd0a1
child 953
0af8b0718fc9
     1.1 --- a/src/share/vm/oops/constantPoolKlass.cpp	Wed Nov 12 11:01:31 2008 -0800
     1.2 +++ b/src/share/vm/oops/constantPoolKlass.cpp	Wed Nov 12 22:33:26 2008 -0800
     1.3 @@ -35,6 +35,7 @@
     1.4    c->set_tags(NULL);
     1.5    c->set_cache(NULL);
     1.6    c->set_pool_holder(NULL);
     1.7 +  c->set_flags(0);
     1.8    // only set to non-zero if constant pool is merged by RedefineClasses
     1.9    c->set_orig_length(0);
    1.10    // all fields are initialized; needed for GC
    1.11 @@ -261,10 +262,32 @@
    1.12  
    1.13  void constantPoolKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
    1.14    assert(obj->is_constantPool(), "should be constant pool");
    1.15 +  constantPoolOop cp = (constantPoolOop) obj;
    1.16 +  if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) {
    1.17 +    oop* base = (oop*)cp->base();
    1.18 +    for (int i = 0; i < cp->length(); ++i, ++base) {
    1.19 +      if (cp->tag_at(i).is_string()) {
    1.20 +        if (PSScavenge::should_scavenge(base)) {
    1.21 +          pm->claim_or_forward_breadth(base);
    1.22 +        }
    1.23 +      }
    1.24 +    }
    1.25 +  }
    1.26  }
    1.27  
    1.28  void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
    1.29    assert(obj->is_constantPool(), "should be constant pool");
    1.30 +  constantPoolOop cp = (constantPoolOop) obj;
    1.31 +  if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) {
    1.32 +    oop* base = (oop*)cp->base();
    1.33 +    for (int i = 0; i < cp->length(); ++i, ++base) {
    1.34 +      if (cp->tag_at(i).is_string()) {
    1.35 +        if (PSScavenge::should_scavenge(base)) {
    1.36 +          pm->claim_or_forward_depth(base);
    1.37 +        }
    1.38 +      }
    1.39 +    }
    1.40 +  }
    1.41  }
    1.42  #endif // SERIALGC
    1.43  
    1.44 @@ -278,6 +301,11 @@
    1.45    assert(obj->is_constantPool(), "must be constantPool");
    1.46    Klass::oop_print_on(obj, st);
    1.47    constantPoolOop cp = constantPoolOop(obj);
    1.48 +  if (cp->flags() != 0) {
    1.49 +    st->print(" - flags : 0x%x", cp->flags());
    1.50 +    if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
    1.51 +    st->cr();
    1.52 +  }
    1.53  
    1.54    // Temp. remove cache so we can do lookups with original indicies.
    1.55    constantPoolCacheHandle cache (THREAD, cp->cache());
    1.56 @@ -302,7 +330,11 @@
    1.57          break;
    1.58        case JVM_CONSTANT_UnresolvedString :
    1.59        case JVM_CONSTANT_String :
    1.60 -        anObj = cp->string_at(index, CATCH);
    1.61 +        if (cp->is_pseudo_string_at(index)) {
    1.62 +          anObj = cp->pseudo_string_at(index);
    1.63 +        } else {
    1.64 +          anObj = cp->string_at(index, CATCH);
    1.65 +        }
    1.66          anObj->print_value_on(st);
    1.67          st->print(" {0x%lx}", (address)anObj);
    1.68          break;
    1.69 @@ -382,8 +414,12 @@
    1.70                    "should be symbol or instance");
    1.71        }
    1.72        if (cp->tag_at(i).is_string()) {
    1.73 -        guarantee((*base)->is_perm(),     "should be in permspace");
    1.74 -        guarantee((*base)->is_instance(), "should be instance");
    1.75 +        if (!cp->has_pseudo_string()) {
    1.76 +          guarantee((*base)->is_perm(),   "should be in permspace");
    1.77 +          guarantee((*base)->is_instance(), "should be instance");
    1.78 +        } else {
    1.79 +          // can be non-perm, can be non-instance (array)
    1.80 +        }
    1.81        }
    1.82        base++;
    1.83      }

mercurial