agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java

Print this page
rev 3688 : 7054512: Compress class pointers after perm gen removal
Summary: support of compress class pointers in the compilers.
Reviewed-by:

@@ -45,14 +45,11 @@
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type  = db.lookupType("oopDesc");
     mark       = new CIntField(type.getCIntegerField("_mark"), 0);
     klass      = new MetadataField(type.getAddressField("_metadata._klass"), 0);
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      // compressedKlass  = new CIntField(type.getCIntegerField("_metadata._compressed_klass"), 0);
-      throw new InternalError("unimplemented");
-    }
+    compressedKlass  = new NarrowKlassField(type.getAddressField("_metadata._compressed_klass"), 0);
     headerSize = type.getSize();
   }
 
   private OopHandle  handle;
   private ObjectHeap heap;

@@ -72,17 +69,17 @@
   private static long headerSize;
   public  static long getHeaderSize() { return headerSize; } // Header size in bytes.
 
   private static CIntField mark;
   private static MetadataField  klass;
-  private static CIntField compressedKlass;
+  private static NarrowKlassField compressedKlass;
 
   // Accessors for declared fields
   public Mark  getMark()   { return new Mark(getHandle()); }
   public Klass getKlass() {
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      throw new InternalError("unimplemented");
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
+      return (Klass)compressedKlass.getValue(getHandle());
     } else {
       return (Klass)klass.getValue(getHandle());
     }
   }
 

@@ -148,11 +145,11 @@
   }
 
   void iterateFields(OopVisitor visitor, boolean doVMFields) {
     if (doVMFields) {
       visitor.doCInt(mark, true);
-      if (VM.getVM().isCompressedHeadersEnabled()) {
+      if (VM.getVM().isCompressedKlassPointersEnabled()) {
         throw new InternalError("unimplemented");
       } else {
         visitor.doMetadata(klass, true);
       }
     }

@@ -208,12 +205,12 @@
   // Package-private routine to speed up ObjectHeap.newOop
   static Klass getKlassForOopHandle(OopHandle handle) {
     if (handle == null) {
       return null;
     }
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      throw new InternalError("Unimplemented");
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
+      return (Klass)Metadata.instantiateWrapperFor(handle.getCompKlassAddressAt(compressedKlass.getOffset()));
     } else {
       return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
     }
   }
 };