diff agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java @ 6848:8e47bac5643a

7054512: Compress class pointers after perm gen removal Summary: support of compress class pointers in the compilers. Reviewed-by: kvn, twisti
author roland
date Tue, 09 Oct 2012 10:11:38 +0200
parents da91efe96a93
children 8552f0992748
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java	Mon Oct 08 17:04:00 2012 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java	Tue Oct 09 10:11:38 2012 +0200
@@ -47,10 +47,7 @@
     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();
   }
 
@@ -74,13 +71,13 @@
 
   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());
     }
@@ -150,7 +147,7 @@
   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);
@@ -210,8 +207,8 @@
     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()));
     }