diff agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java @ 14232:183bd5c00828

8028468: Add inlining information into ciReplay Summary: Allow dump and replay inlining for specified method during a program execution. Reviewed-by: roland, twisti
author kvn
date Wed, 08 Jan 2014 10:25:50 -0800
parents 79f492f184d0
children 4ca6dc0799b6
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java	Wed Jan 08 12:05:19 2014 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java	Wed Jan 08 10:25:50 2014 -0800
@@ -87,6 +87,11 @@
     return GrowableArray.create(addr, inlineTreeConstructor);
   }
 
+  public int inlineLevel() {
+    JVMState jvms = callerJvms();
+    return (jvms != null) ? jvms.depth() : 0;
+  }
+
   public void printImpl(PrintStream st, int indent) {
     for (int i = 0; i < indent; i++) st.print(" ");
     st.printf(" @ %d ", callerBci());
@@ -101,4 +106,28 @@
   public void print(PrintStream st) {
     printImpl(st, 2);
   }
+
+  // Count number of nodes in this subtree
+  public int count() {
+    int result = 1;
+    GrowableArray<InlineTree> subt = subtrees();
+    for (int i = 0 ; i < subt.length(); i++) {
+      result += subt.at(i).count();
+    }
+    return result;
+  }
+
+  public void dumpReplayData(PrintStream out) {
+    out.printf(" %d %d ", inlineLevel(), callerBci());
+    Method method = (Method)method().getMetadata();
+    Klass holder = method.getMethodHolder();
+    out.print(holder.getName().asString() + " " +
+              OopUtilities.escapeString(method.getName().asString()) + " " +
+              method.getSignature().asString());
+
+    GrowableArray<InlineTree> subt = subtrees();
+    for (int i = 0 ; i < subt.length(); i++) {
+      subt.at(i).dumpReplayData(out);
+    }
+  }
 }