RFR: 8017588: SA: jstack -l throws UnalignedAddressException while attaching to core file for java that was started with CMS GC

Erik Helin erik.helin at oracle.com
Wed Jul 3 08:33:14 UTC 2013


Hi all,

this change fixes an issue where we could not run jstack -l -F on a
java process running with -XX:+UseConcMarkSweepGC.

The problem originated from the following change in hotspot:
 changeset:   3707:8bafad97cd26
 parent:      3693:973046802b6f
 7158552: The instanceKlsss::_host_klass is only needed for anonymous class for JSR 292 support.

 diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp
 --- a/src/share/vm/oops/instanceKlass.hpp
 +++ b/src/share/vm/oops/instanceKlass.hpp
 @@ -717,9 +763,11 @@
    {
      return object_size(align_object_offset(vtable_length()) +
                         align_object_offset(itable_length()) +
 -                       (is_interface() ?
 -                        (align_object_offset(nonstatic_oop_map_size()) + (int)sizeof(klassOop)/HeapWordSize) :
 -                        nonstatic_oop_map_size()));
 +                       ((is_interface() || is_anonymous()) ?
 +                         align_object_offset(nonstatic_oop_map_size()) :
 +                         nonstatic_oop_map_size()) +
 +                       (is_interface() ? (int)sizeof(klassOop)/HeapWordSize : 0) +
 +                       (is_anonymous() ? (int)sizeof(klassOop)/HeapWordSize : 0));
    }

The corresponding code in the serviceability agent was not updated:

 agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java:
  public long getObjectSize() {
  long bodySize =    alignObjectOffset(getVtableLen() * getHeap().getOopSize())
                   + alignObjectOffset(getItableLen() * getHeap().getOopSize())
                   + (getNonstaticOopMapSize()) * getHeap().getOopSize();
  return alignObjectSize(headerSize + bodySize);
  }

This fix updates the SA code to be like the hotspot code. I've also
introduced variables in the hotspot code and in the SA code to make it
easier to compare the two versions.

Webrev: http://cr.openjdk.java.net/~ehelin/8017588/webrev.00/

Testing:
- JPRT
- Running jstack -l -F successfully on a java process using -XX:+UseConcMarkSweepGC

Thanks,
Erik



More information about the hotspot-gc-dev mailing list