src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler

src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java

Print this page
rev 6133 : 8005079: fix LogCompilation for incremental inlining
Summary: report late inlining as part of the rest of the inlining output
Reviewed-by:
rev 6134 : [mq]: logcompilation-reviews


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package com.sun.hotspot.tools.compiler;
  26 
  27 import java.io.PrintStream;

  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 public class CallSite {
  32 
  33     private int bci;
  34     private Method method;
  35     private int count;
  36     private String receiver;
  37     private int receiver_count;
  38     private String reason;
  39     private List<CallSite> calls;
  40     private int endNodes;
  41     private int endLiveNodes;
  42     private double timeStamp;

  43 
  44     CallSite() {
  45     }
  46 
  47     CallSite(int bci, Method m) {
  48         this.bci = bci;
  49         this.method = m;
  50     }
  51 
  52     void add(CallSite site) {
  53         if (getCalls() == null) {
  54             setCalls(new ArrayList<CallSite>());
  55         }
  56         getCalls().add(site);
  57     }
  58 
  59     CallSite last() {
  60         return last(-1);
  61     }
  62 


  77                 sb.append(site);
  78                 sb.append("\n");
  79             }
  80         }
  81         return sb.toString();
  82     }
  83 
  84     public void print(PrintStream stream) {
  85         print(stream, 0);
  86     }
  87 
  88     void emit(PrintStream stream, int indent) {
  89         for (int i = 0; i < indent; i++) {
  90             stream.print(' ');
  91         }
  92     }
  93     private static boolean compat = true;
  94 
  95     public void print(PrintStream stream, int indent) {
  96         emit(stream, indent);
  97         String m = getMethod().getHolder().replace('/', '.') + "::" + getMethod().getName();
  98         if (getReason() == null) {
  99             stream.print("  @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)");
 100 
 101         } else {
 102             if (isCompat()) {
 103                 stream.print("  @ " + getBci() + " " + m + " " + getReason());
 104             } else {
 105                 stream.print("- @ " + getBci() + " " + m +
 106                         " (" + getMethod().getBytes() + " bytes) " + getReason());
 107             }
 108         }
 109         stream.printf(" (end time: %6.4f", getTimeStamp());
 110         if (getEndNodes() > 0) {
 111             stream.printf(" nodes: %d live: %d", getEndNodes(), getEndLiveNodes());
 112         }
 113         stream.println(")");
 114 
 115         if (getReceiver() != null) {
 116             emit(stream, indent + 4);
 117             //                 stream.println("type profile " + method.holder + " -> " + receiver + " (" +


 197     public int getEndNodes() {
 198         return endNodes;
 199     }
 200 
 201     void setEndLiveNodes(int n) {
 202         endLiveNodes = n;
 203     }
 204 
 205     public int getEndLiveNodes() {
 206         return endLiveNodes;
 207     }
 208 
 209     void setTimeStamp(double time) {
 210         timeStamp = time;
 211     }
 212 
 213     public double getTimeStamp() {
 214         return timeStamp;
 215     }
 216 









































 217 }


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package com.sun.hotspot.tools.compiler;
  26 
  27 import java.io.PrintStream;
  28 import java.util.ArrayDeque;
  29 import java.util.ArrayList;
  30 import java.util.List;
  31 
  32 public class CallSite {
  33 
  34     private int bci;
  35     private Method method;
  36     private int count;
  37     private String receiver;
  38     private int receiver_count;
  39     private String reason;
  40     private List<CallSite> calls;
  41     private int endNodes;
  42     private int endLiveNodes;
  43     private double timeStamp;
  44     private long inlineId;
  45 
  46     CallSite() {
  47     }
  48 
  49     CallSite(int bci, Method m) {
  50         this.bci = bci;
  51         this.method = m;
  52     }
  53 
  54     void add(CallSite site) {
  55         if (getCalls() == null) {
  56             setCalls(new ArrayList<CallSite>());
  57         }
  58         getCalls().add(site);
  59     }
  60 
  61     CallSite last() {
  62         return last(-1);
  63     }
  64 


  79                 sb.append(site);
  80                 sb.append("\n");
  81             }
  82         }
  83         return sb.toString();
  84     }
  85 
  86     public void print(PrintStream stream) {
  87         print(stream, 0);
  88     }
  89 
  90     void emit(PrintStream stream, int indent) {
  91         for (int i = 0; i < indent; i++) {
  92             stream.print(' ');
  93         }
  94     }
  95     private static boolean compat = true;
  96 
  97     public void print(PrintStream stream, int indent) {
  98         emit(stream, indent);
  99         String m = getMethod().getHolder() + "::" + getMethod().getName();
 100         if (getReason() == null) {
 101             stream.print("  @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)");
 102 
 103         } else {
 104             if (isCompat()) {
 105                 stream.print("  @ " + getBci() + " " + m + " " + getReason());
 106             } else {
 107                 stream.print("- @ " + getBci() + " " + m +
 108                         " (" + getMethod().getBytes() + " bytes) " + getReason());
 109             }
 110         }
 111         stream.printf(" (end time: %6.4f", getTimeStamp());
 112         if (getEndNodes() > 0) {
 113             stream.printf(" nodes: %d live: %d", getEndNodes(), getEndLiveNodes());
 114         }
 115         stream.println(")");
 116 
 117         if (getReceiver() != null) {
 118             emit(stream, indent + 4);
 119             //                 stream.println("type profile " + method.holder + " -> " + receiver + " (" +


 199     public int getEndNodes() {
 200         return endNodes;
 201     }
 202 
 203     void setEndLiveNodes(int n) {
 204         endLiveNodes = n;
 205     }
 206 
 207     public int getEndLiveNodes() {
 208         return endLiveNodes;
 209     }
 210 
 211     void setTimeStamp(double time) {
 212         timeStamp = time;
 213     }
 214 
 215     public double getTimeStamp() {
 216         return timeStamp;
 217     }
 218     
 219     private boolean matches(CallSite other) {
 220         // Every late inline call site has a unique inline id. If the
 221         // call site we're looking for has one then use it other rely
 222         // on method name and bci.
 223         if (other.inlineId != 0) {
 224             return inlineId == other.inlineId;
 225         }
 226         return method.equals(other.method) && bci == other.bci;
 227     }
 228     
 229     public CallSite findCallSite(ArrayDeque<CallSite> sites) {
 230         // Locate a late inline call site. Multiple chains of
 231         // identical call sites with the same method name/bci are
 232         // possible so we have to try them all until we find the late
 233         // inline call site that has a matching inline id.
 234         CallSite site = sites.pop();
 235         for (CallSite c : calls) {
 236             if (c.matches(site)) {
 237                 if (!sites.isEmpty()) {
 238                     CallSite res = c.findCallSite(sites);
 239                     if (res != null) {
 240                         sites.push(site);
 241                         return res;
 242                     }
 243                 } else {
 244                     sites.push(site);
 245                     return c;
 246                 }
 247             }
 248         }
 249         sites.push(site);
 250         return null;
 251     }
 252 
 253     public long getInlineId() {
 254         return inlineId;
 255     }
 256 
 257     public void setInlineId(long inlineId) {
 258         this.inlineId = inlineId;
 259     }
 260 }
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File