diff agent/src/share/classes/sun/jvm/hotspot/oops/Mark.java @ 187:790e66e5fbac

6687581: Make CMS work with compressed oops Summary: Make FreeChunk read markword instead of LSB in _klass pointer to indicate that it's a FreeChunk for compressed oops. Reviewed-by: ysr, jmasa
author coleenp
date Mon, 09 Jun 2008 11:51:19 -0400
parents a61af66fc99e
children d1605aabd0a1
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Mark.java	Fri Jun 06 11:47:26 2008 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Mark.java	Mon Jun 09 11:51:19 2008 -0400
@@ -79,6 +79,11 @@
     noHashInPlace       = db.lookupLongConstant("markOopDesc::no_hash_in_place").longValue();
     noLockInPlace       = db.lookupLongConstant("markOopDesc::no_lock_in_place").longValue();
     maxAge              = db.lookupLongConstant("markOopDesc::max_age").longValue();
+
+    /* Constants in markOop used by CMS. */
+    cmsShift            = db.lookupLongConstant("markOopDesc::cms_shift").longValue();
+    cmsMask             = db.lookupLongConstant("markOopDesc::cms_mask").longValue();
+    sizeShift           = db.lookupLongConstant("markOopDesc::size_shift").longValue();
   }
 
   // Field accessors
@@ -120,6 +125,11 @@
 
   private static long maxAge;
 
+  /* Constants in markOop used by CMS. */
+  private static long cmsShift;
+  private static long cmsMask;
+  private static long sizeShift;
+
   public Mark(Address addr) {
     super(addr);
   }
@@ -290,4 +300,11 @@
   //
   //  // Recover address of oop from encoded form used in mark
   //  inline void* decode_pointer() { return clear_lock_bits(); }
+
+  // Copy markOop methods for CMS here.
+  public boolean isCmsFreeChunk() {
+    return isUnlocked() &&
+           (Bits.maskBitsLong(value() >> cmsShift, cmsMask) & 0x1L) == 0x1L;
+  }
+  public long getSize() { return (long)(value() >> sizeShift); }
 }