Merge

Thu, 05 Dec 2013 17:49:55 +0100

author
ehelin
date
Thu, 05 Dec 2013 17:49:55 +0100
changeset 6151
816c89d5957d
parent 6147
e84d2afb2fb0
parent 6150
50287b659eb8
child 6156
6a8941dbd26f

Merge

src/share/vm/oops/instanceKlass.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1HeapRegionTable.java	Tue Dec 03 13:56:10 2013 -0800
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1HeapRegionTable.java	Thu Dec 05 17:49:55 2013 +0100
     1.3 @@ -103,14 +103,14 @@
     1.4          @Override
     1.5          public void remove()     { /* not supported */    }
     1.6  
     1.7 -        HeapRegionIterator(Address addr) {
     1.8 +        HeapRegionIterator(long committedLength) {
     1.9              index = 0;
    1.10 -            length = length();
    1.11 +            length = committedLength;
    1.12          }
    1.13      }
    1.14  
    1.15 -    public Iterator<HeapRegion> heapRegionIterator() {
    1.16 -        return new HeapRegionIterator(addr);
    1.17 +    public Iterator<HeapRegion> heapRegionIterator(long committedLength) {
    1.18 +        return new HeapRegionIterator(committedLength);
    1.19      }
    1.20  
    1.21      public G1HeapRegionTable(Address addr) {
     2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java	Tue Dec 03 13:56:10 2013 -0800
     2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java	Thu Dec 05 17:49:55 2013 +0100
     2.3 @@ -42,6 +42,8 @@
     2.4  public class HeapRegionSeq extends VMObject {
     2.5      // G1HeapRegionTable _regions
     2.6      static private long regionsFieldOffset;
     2.7 +    // uint _committed_length
     2.8 +    static private CIntegerField committedLengthField;
     2.9  
    2.10      static {
    2.11          VM.registerVMInitializedObserver(new Observer() {
    2.12 @@ -55,6 +57,7 @@
    2.13          Type type = db.lookupType("HeapRegionSeq");
    2.14  
    2.15          regionsFieldOffset = type.getField("_regions").getOffset();
    2.16 +        committedLengthField = type.getCIntegerField("_committed_length");
    2.17      }
    2.18  
    2.19      private G1HeapRegionTable regions() {
    2.20 @@ -67,8 +70,12 @@
    2.21          return regions().length();
    2.22      }
    2.23  
    2.24 +    public long committedLength() {
    2.25 +        return committedLengthField.getValue(addr);
    2.26 +    }
    2.27 +
    2.28      public Iterator<HeapRegion> heapRegionIterator() {
    2.29 -        return regions().heapRegionIterator();
    2.30 +        return regions().heapRegionIterator(committedLength());
    2.31      }
    2.32  
    2.33      public HeapRegionSeq(Address addr) {
     3.1 --- a/src/share/vm/gc_implementation/shared/markSweep.cpp	Tue Dec 03 13:56:10 2013 -0800
     3.2 +++ b/src/share/vm/gc_implementation/shared/markSweep.cpp	Thu Dec 05 17:49:55 2013 +0100
     3.3 @@ -66,29 +66,10 @@
     3.4    klass->oops_do(&MarkSweep::adjust_pointer_closure);
     3.5  }
     3.6  
     3.7 -void MarkSweep::follow_klass(Klass* klass) {
     3.8 -  ClassLoaderData* cld = klass->class_loader_data();
     3.9 -  // The actual processing of the klass is done when we
    3.10 -  // traverse the list of Klasses in the class loader data.
    3.11 -  MarkSweep::follow_class_loader(cld);
    3.12 -}
    3.13 -
    3.14 -void MarkSweep::adjust_klass(Klass* klass) {
    3.15 -  ClassLoaderData* cld = klass->class_loader_data();
    3.16 -  // The actual processing of the klass is done when we
    3.17 -  // traverse the list of Klasses in the class loader data.
    3.18 -  MarkSweep::adjust_class_loader(cld);
    3.19 -}
    3.20 -
    3.21  void MarkSweep::follow_class_loader(ClassLoaderData* cld) {
    3.22    cld->oops_do(&MarkSweep::mark_and_push_closure, &MarkSweep::follow_klass_closure, true);
    3.23  }
    3.24  
    3.25 -void MarkSweep::adjust_class_loader(ClassLoaderData* cld) {
    3.26 -  cld->oops_do(&MarkSweep::adjust_pointer_closure, &MarkSweep::adjust_klass_closure, true);
    3.27 -}
    3.28 -
    3.29 -
    3.30  void MarkSweep::follow_stack() {
    3.31    do {
    3.32      while (!_marking_stack.is_empty()) {
     4.1 --- a/src/share/vm/gc_implementation/shared/markSweep.hpp	Tue Dec 03 13:56:10 2013 -0800
     4.2 +++ b/src/share/vm/gc_implementation/shared/markSweep.hpp	Thu Dec 05 17:49:55 2013 +0100
     4.3 @@ -172,10 +172,8 @@
     4.4    static void follow_stack();   // Empty marking stack.
     4.5  
     4.6    static void follow_klass(Klass* klass);
     4.7 -  static void adjust_klass(Klass* klass);
     4.8  
     4.9    static void follow_class_loader(ClassLoaderData* cld);
    4.10 -  static void adjust_class_loader(ClassLoaderData* cld);
    4.11  
    4.12    static void preserve_mark(oop p, markOop mark);
    4.13                                  // Save the mark word so it can be restored later
     5.1 --- a/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Tue Dec 03 13:56:10 2013 -0800
     5.2 +++ b/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Thu Dec 05 17:49:55 2013 +0100
     5.3 @@ -44,6 +44,11 @@
     5.4    }
     5.5  }
     5.6  
     5.7 +inline void MarkSweep::follow_klass(Klass* klass) {
     5.8 +  oop op = klass->klass_holder();
     5.9 +  MarkSweep::mark_and_push(&op);
    5.10 +}
    5.11 +
    5.12  template <class T> inline void MarkSweep::follow_root(T* p) {
    5.13    assert(!Universe::heap()->is_in_reserved(p),
    5.14           "roots shouldn't be things within the heap");
     6.1 --- a/src/share/vm/oops/instanceKlass.cpp	Tue Dec 03 13:56:10 2013 -0800
     6.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Thu Dec 05 17:49:55 2013 +0100
     6.3 @@ -2180,7 +2180,6 @@
     6.4      obj, \
     6.5      MarkSweep::adjust_pointer(p), \
     6.6      assert_is_in)
     6.7 -  MarkSweep::adjust_klass(obj->klass());
     6.8    return size;
     6.9  }
    6.10  
     7.1 --- a/src/share/vm/oops/instanceMirrorKlass.cpp	Tue Dec 03 13:56:10 2013 -0800
     7.2 +++ b/src/share/vm/oops/instanceMirrorKlass.cpp	Thu Dec 05 17:49:55 2013 +0100
     7.3 @@ -155,7 +155,13 @@
     7.4    // Follow the klass field in the mirror.
     7.5    Klass* klass = java_lang_Class::as_Klass(obj);
     7.6    if (klass != NULL) {
     7.7 -    MarkSweep::follow_klass(klass);
     7.8 +    // For anonymous classes we need to handle the class loader data,
     7.9 +    // otherwise it won't be claimed and can be unloaded.
    7.10 +    if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
    7.11 +      MarkSweep::follow_class_loader(klass->class_loader_data());
    7.12 +    } else {
    7.13 +      MarkSweep::follow_klass(klass);
    7.14 +    }
    7.15    } else {
    7.16      // If klass is NULL then this a mirror for a primitive type.
    7.17      // We don't have to follow them, since they are handled as strong
    7.18 @@ -196,17 +202,6 @@
    7.19    int size = oop_size(obj);
    7.20    InstanceKlass::oop_adjust_pointers(obj);
    7.21  
    7.22 -  // Follow the klass field in the mirror.
    7.23 -  Klass* klass = java_lang_Class::as_Klass(obj);
    7.24 -  if (klass != NULL) {
    7.25 -    MarkSweep::adjust_klass(klass);
    7.26 -  } else {
    7.27 -    // If klass is NULL then this a mirror for a primitive type.
    7.28 -    // We don't have to follow them, since they are handled as strong
    7.29 -    // roots in Universe::oops_do.
    7.30 -    assert(java_lang_Class::is_primitive(obj), "Sanity check");
    7.31 -  }
    7.32 -
    7.33    InstanceMirrorKlass_OOP_ITERATE(                                                    \
    7.34      start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),        \
    7.35      MarkSweep::adjust_pointer(p),                                                     \
     8.1 --- a/src/share/vm/oops/objArrayKlass.cpp	Tue Dec 03 13:56:10 2013 -0800
     8.2 +++ b/src/share/vm/oops/objArrayKlass.cpp	Thu Dec 05 17:49:55 2013 +0100
     8.3 @@ -569,7 +569,6 @@
     8.4    // Get size before changing pointers.
     8.5    // Don't call size() or oop_size() since that is a virtual call.
     8.6    int size = a->object_size();
     8.7 -  MarkSweep::adjust_klass(a->klass());
     8.8    ObjArrayKlass_OOP_ITERATE(a, p, MarkSweep::adjust_pointer(p))
     8.9    return size;
    8.10  }

mercurial