diff agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicField.java @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicField.java	Fri Apr 11 09:56:35 2008 -0400
+++ b/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicField.java	Sun Apr 13 17:43:42 2008 -0400
@@ -43,6 +43,19 @@
   /** Used for static fields only */
   private Address staticFieldAddress;
 
+  // Copy constructor to create NarrowOopField from OopField.
+  public BasicField(Field fld) {
+    BasicField field = (BasicField)fld;
+
+    this.db = field.db;
+    this.containingType = field.containingType;
+    this.name = field.name;
+    this.type = field.type;
+    this.size = field.size;
+    this.isStatic = field.isStatic;
+    this.offset = field.offset;
+    this.staticFieldAddress = field.staticFieldAddress;
+  }
   /** offsetInBytes is ignored if the field is static;
       staticFieldAddress is used only if the field is static. */
   public BasicField(BasicTypeDataBase db, Type containingType, String name, Type type,
@@ -161,6 +174,13 @@
     }
     return addr.getOopHandleAt(offset);
   }
+  public OopHandle getNarrowOopHandle(Address addr)
+    throws UnmappedAddressException, UnalignedAddressException, WrongTypeException, NotInHeapException {
+    if (isStatic) {
+      throw new WrongTypeException();
+    }
+    return addr.getCompOopHandleAt(offset);
+  }
 
   //--------------------------------------------------------------------------------
   // Dereferencing operations for static fields
@@ -234,4 +254,11 @@
     }
     return staticFieldAddress.getOopHandleAt(0);
   }
+  public OopHandle getNarrowOopHandle()
+    throws UnmappedAddressException, UnalignedAddressException, WrongTypeException, NotInHeapException {
+    if (!isStatic) {
+      throw new WrongTypeException();
+    }
+    return staticFieldAddress.getCompOopHandleAt(0);
+  }
 }