changeset 4626:0d7106aa7e08

Merge
author dholmes
date Tue, 09 Jul 2013 21:16:38 -0400
parents c4a8806c0302 1478a623482d
children fc4858327ae8
files
diffstat 4 files changed, 52 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Tue Jul 09 21:05:44 2013 -0400
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Tue Jul 09 21:16:38 2013 -0400
@@ -89,6 +89,7 @@
     genericSignature     = type.getAddressField("_generic_signature");
     majorVersion         = new CIntField(type.getCIntegerField("_major_version"), Oop.getHeaderSize());
     minorVersion         = new CIntField(type.getCIntegerField("_minor_version"), Oop.getHeaderSize());
+    miscFlags            = new CIntField(type.getCIntegerField("_misc_flags"), Oop.getHeaderSize());
     headerSize           = alignObjectOffset(Oop.getHeaderSize() + type.getSize());
 
     // read field offset constants
@@ -147,6 +148,16 @@
   private static AddressField  genericSignature;
   private static CIntField majorVersion;
   private static CIntField minorVersion;
+  private static CIntField miscFlags;
+
+  private static final long MISC_REWRITTEN            = 1 << 0; // methods rewritten.
+  private static final long MISC_HAS_NONSTATIC_FIELDS = 1 << 1; // for sizing with UseCompressedOops
+  private static final long MISC_SHOULD_VERIFY_CLASS  = 1 << 1; // allow caching of preverification
+  private static final long MISC_IS_ANONYMOUS         = 1 << 3; // has embedded _inner_classes field
+
+  public boolean isAnonymous() {
+    return (miscFlags.getValue(this) & MISC_IS_ANONYMOUS) != 0;
+  }
 
   // type safe enum for ClassState from instanceKlass.hpp
   public static class ClassState {
@@ -799,9 +810,22 @@
 
 
   public long getObjectSize() {
-    long bodySize =    alignObjectOffset(getVtableLen() * getHeap().getOopSize())
-                     + alignObjectOffset(getItableLen() * getHeap().getOopSize())
-                     + (getNonstaticOopMapSize()) * getHeap().getOopSize();
+    final long oopSize = getHeap().getOopSize();
+
+    long vtableSize = alignObjectOffset(getVtableLen() * oopSize);
+    long itableSize = alignObjectOffset(getItableLen() * oopSize);
+
+    long nonStaticOopMapSizeBytes = getNonstaticOopMapSize() * oopSize;
+    long alignedNonStaticOopMapSize = isInterface() || isAnonymous() ?
+                                        alignObjectOffset(nonStaticOopMapSizeBytes) :
+                                        nonStaticOopMapSizeBytes;
+
+    long interfaceImplementorSize = isInterface() ? oopSize : 0;
+    long hostKlassSize = isAnonymous() ? oopSize : 0;
+
+    long bodySize = vtableSize + itableSize + nonStaticOopMapSizeBytes +
+                    interfaceImplementorSize + hostKlassSize;
+
     return alignObjectSize(headerSize + bodySize);
   }
 
--- a/src/share/vm/oops/instanceKlass.hpp	Tue Jul 09 21:05:44 2013 -0400
+++ b/src/share/vm/oops/instanceKlass.hpp	Tue Jul 09 21:16:38 2013 -0400
@@ -779,13 +779,16 @@
 
   int object_size() const
   {
-    return object_size(align_object_offset(vtable_length()) +
-                       align_object_offset(itable_length()) +
-                       ((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));
+    int vtable_size = align_object_offset(vtable_length());
+    int itable_size = align_object_offset(itable_length());
+    int aligned_nonstatic_oop_map_size = is_interface() || is_anonymous() ?
+                                        align_object_offset(nonstatic_oop_map_size()) :
+                                        nonstatic_oop_map_size();
+    int interface_implementor_size = is_interface() ? (int) sizeof(klassOop) / HeapWordSize : 0;
+    int host_klass_size = is_anonymous() ? (int) sizeof(klassOop) / HeapWordSize : 0;
+
+    return object_size(vtable_size + itable_size + aligned_nonstatic_oop_map_size +
+                       interface_implementor_size + host_klass_size);
   }
   static int vtable_start_offset()    { return header_size(); }
   static int vtable_length_offset()   { return oopDesc::header_size() + offset_of(instanceKlass, _vtable_len) / HeapWordSize; }
--- a/src/share/vm/runtime/vmStructs.cpp	Tue Jul 09 21:05:44 2013 -0400
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Jul 09 21:16:38 2013 -0400
@@ -316,6 +316,7 @@
   nonstatic_field(instanceKlass,               _static_oop_field_count,                       u2)                                   \
   nonstatic_field(instanceKlass,               _nonstatic_oop_map_size,                       int)                                   \
   nonstatic_field(instanceKlass,               _is_marked_dependent,                          bool)                                  \
+  nonstatic_field(instanceKlass,               _misc_flags,                                   u2)                                    \
   nonstatic_field(instanceKlass,               _minor_version,                                u2)                                    \
   nonstatic_field(instanceKlass,               _major_version,                                u2)                                    \
   nonstatic_field(instanceKlass,               _init_state,                                   u1)                                    \
--- a/src/share/vm/services/memTracker.hpp	Tue Jul 09 21:05:44 2013 -0400
+++ b/src/share/vm/services/memTracker.hpp	Tue Jul 09 21:16:38 2013 -0400
@@ -402,7 +402,21 @@
   static void check_NMT_load(Thread* thr) {
     assert(thr != NULL, "Sanity check");
     if (_slowdown_calling_thread && thr != _worker_thread) {
+#ifdef _WINDOWS
+      // On Windows, os::NakedYield() does not work as well
+      // as os::yield_all()
       os::yield_all();
+#else
+     // On Solaris, os::yield_all() depends on os::sleep()
+     // which requires JavaTherad in _thread_in_vm state.
+     // Transits thread to _thread_in_vm state can be dangerous
+     // if caller holds lock, as it may deadlock with Threads_lock.
+     // So use NaKedYield instead.
+     //
+     // Linux and BSD, NakedYield() and yield_all() implementations
+     // are the same.
+      os::NakedYield();
+#endif
     }
   }