diff agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 63997f575155
children 8e47bac5643a
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java	Fri Aug 31 16:39:35 2012 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java	Sat Sep 01 13:25:18 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.memory.CompactingPermGenGen;
 
 // Oop represents the superclass for all types of
 // objects in the HotSpot object heap.
@@ -47,8 +46,11 @@
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type  = db.lookupType("oopDesc");
     mark       = new CIntField(type.getCIntegerField("_mark"), 0);
-    klass      = new OopField(type.getOopField("_metadata._klass"), 0);
-    compressedKlass  = new NarrowOopField(type.getOopField("_metadata._compressed_klass"), 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");
+    }
     headerSize = type.getSize();
   }
 
@@ -71,28 +73,16 @@
   public  static long getHeaderSize() { return headerSize; } // Header size in bytes.
 
   private static CIntField mark;
-  private static OopField  klass;
-  private static NarrowOopField compressedKlass;
-
-  public boolean isShared() {
-    return CompactingPermGenGen.isShared(handle);
-  }
-
-  public boolean isSharedReadOnly() {
-    return CompactingPermGenGen.isSharedReadOnly(handle);
-  }
-
-  public boolean isSharedReadWrite() {
-    return CompactingPermGenGen.isSharedReadWrite(handle);
-  }
+  private static MetadataField  klass;
+  private static CIntField compressedKlass;
 
   // Accessors for declared fields
   public Mark  getMark()   { return new Mark(getHandle()); }
   public Klass getKlass() {
-    if (VM.getVM().isCompressedOopsEnabled()) {
-      return (Klass) compressedKlass.getValue(this);
+    if (VM.getVM().isCompressedHeadersEnabled()) {
+      throw new InternalError("unimplemented");
     } else {
-      return (Klass) klass.getValue(this);
+      return (Klass)klass.getValue(getHandle());
     }
   }
 
@@ -113,14 +103,7 @@
   public boolean isArray()             { return false; }
   public boolean isObjArray()          { return false; }
   public boolean isTypeArray()         { return false; }
-  public boolean isSymbol()            { return false; }
-  public boolean isKlass()             { return false; }
   public boolean isThread()            { return false; }
-  public boolean isMethod()            { return false; }
-  public boolean isMethodData()        { return false; }
-  public boolean isConstantPool()      { return false; }
-  public boolean isConstantPoolCache() { return false; }
-  public boolean isCompiledICHolder()  { return false; }
 
   // Align the object size.
   public static long alignObjectSize(long size) {
@@ -167,10 +150,10 @@
   void iterateFields(OopVisitor visitor, boolean doVMFields) {
     if (doVMFields) {
       visitor.doCInt(mark, true);
-      if (VM.getVM().isCompressedOopsEnabled()) {
-        visitor.doOop(compressedKlass, true);
+      if (VM.getVM().isCompressedHeadersEnabled()) {
+        throw new InternalError("unimplemented");
       } else {
-        visitor.doOop(klass, true);
+        visitor.doMetadata(klass, true);
       }
     }
   }
@@ -223,14 +206,14 @@
   public boolean verify() { return true;}
 
   // Package-private routine to speed up ObjectHeap.newOop
-  static OopHandle getKlassForOopHandle(OopHandle handle) {
+  static Klass getKlassForOopHandle(OopHandle handle) {
     if (handle == null) {
       return null;
     }
-    if (VM.getVM().isCompressedOopsEnabled()) {
-      return handle.getCompOopHandleAt(compressedKlass.getOffset());
+    if (VM.getVM().isCompressedHeadersEnabled()) {
+      throw new InternalError("Unimplemented");
     } else {
-      return handle.getOopHandleAt(klass.getOffset());
+      return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
     }
   }
 };