diff agent/src/share/classes/sun/jvm/hotspot/oops/Method.java @ 3939:f6f3bb0ee072

7088955: add C2 IR support to the SA Reviewed-by: kvn
author never
date Sun, 11 Sep 2011 14:48:24 -0700
parents 6a991dcb52bb
children 2fe087c3e814
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Sat Sep 10 17:29:02 2011 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Sun Sep 11 14:48:24 2011 -0700
@@ -49,6 +49,7 @@
     Type type                  = db.lookupType("methodOopDesc");
     constMethod                = new OopField(type.getOopField("_constMethod"), 0);
     constants                  = new OopField(type.getOopField("_constants"), 0);
+    methodData                 = new OopField(type.getOopField("_method_data"), 0);
     methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
     maxStack                   = new CIntField(type.getCIntegerField("_max_stack"), 0);
     maxLocals                  = new CIntField(type.getCIntegerField("_max_locals"), 0);
@@ -58,9 +59,13 @@
     vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
     if (!VM.getVM().isCore()) {
       invocationCounter        = new CIntField(type.getCIntegerField("_invocation_counter"), 0);
+      backedgeCounter          = new CIntField(type.getCIntegerField("_backedge_counter"), 0);
     }
     bytecodeOffset = type.getSize();
 
+    interpreterThrowoutCountField = new CIntField(type.getCIntegerField("_interpreter_throwout_count"), 0);
+    interpreterInvocationCountField = new CIntField(type.getCIntegerField("_interpreter_invocation_count"), 0);
+
     /*
     interpreterEntry           = type.getAddressField("_interpreter_entry");
     fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
@@ -79,6 +84,7 @@
   // Fields
   private static OopField  constMethod;
   private static OopField  constants;
+  private static OopField  methodData;
   private static CIntField methodSize;
   private static CIntField maxStack;
   private static CIntField maxLocals;
@@ -86,10 +92,14 @@
   private static CIntField accessFlags;
   private static CIntField vtableIndex;
   private static CIntField invocationCounter;
+  private static CIntField backedgeCounter;
   private static long      bytecodeOffset;
 
   private static AddressField       code;
 
+  private static CIntField interpreterThrowoutCountField;
+  private static CIntField interpreterInvocationCountField;
+
   // constant method names - <init>, <clinit>
   // Initialized lazily to avoid initialization ordering dependencies between Method and SymbolTable
   private static Symbol objectInitializerName;
@@ -116,6 +126,7 @@
   // Accessors for declared fields
   public ConstMethod  getConstMethod()                { return (ConstMethod)  constMethod.getValue(this);       }
   public ConstantPool getConstants()                  { return (ConstantPool) constants.getValue(this);         }
+  public MethodData   getMethodData()                 { return (MethodData) methodData.getValue(this);          }
   public TypeArray    getExceptionTable()             { return getConstMethod().getExceptionTable();            }
   /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
   public long         getMethodSize()                 { return                methodSize.getValue(this);        }
@@ -134,6 +145,12 @@
     }
     return invocationCounter.getValue(this);
   }
+  public long         getBackedgeCounter()          {
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(!VM.getVM().isCore(), "must not be used in core build");
+    }
+    return backedgeCounter.getValue(this);
+  }
 
   // get associated compiled native method, if available, else return null.
   public NMethod getNativeMethod() {
@@ -333,4 +350,11 @@
     buf.append(")");
     return buf.toString().replace('/', '.');
   }
+  public int interpreterThrowoutCount() {
+    return (int) interpreterThrowoutCountField.getValue(getHandle());
+  }
+
+  public int interpreterInvocationCount() {
+    return (int) interpreterInvocationCountField.getValue(getHandle());
+  }
 }