hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
equal
deleted
inserted
replaced
23 */ |
23 */ |
24 |
24 |
25 package com.sun.hotspot.tools.compiler; |
25 package com.sun.hotspot.tools.compiler; |
26 |
26 |
27 import java.io.PrintStream; |
27 import java.io.PrintStream; |
|
28 import java.util.ArrayDeque; |
28 import java.util.ArrayList; |
29 import java.util.ArrayList; |
29 import java.util.List; |
30 import java.util.List; |
30 |
31 |
31 public class CallSite { |
32 public class CallSite { |
32 |
33 |
38 private String reason; |
39 private String reason; |
39 private List<CallSite> calls; |
40 private List<CallSite> calls; |
40 private int endNodes; |
41 private int endNodes; |
41 private int endLiveNodes; |
42 private int endLiveNodes; |
42 private double timeStamp; |
43 private double timeStamp; |
|
44 private long inlineId; |
43 |
45 |
44 CallSite() { |
46 CallSite() { |
45 } |
47 } |
46 |
48 |
47 CallSite(int bci, Method m) { |
49 CallSite(int bci, Method m) { |
92 } |
94 } |
93 private static boolean compat = true; |
95 private static boolean compat = true; |
94 |
96 |
95 public void print(PrintStream stream, int indent) { |
97 public void print(PrintStream stream, int indent) { |
96 emit(stream, indent); |
98 emit(stream, indent); |
97 String m = getMethod().getHolder().replace('/', '.') + "::" + getMethod().getName(); |
99 String m = getMethod().getHolder() + "::" + getMethod().getName(); |
98 if (getReason() == null) { |
100 if (getReason() == null) { |
99 stream.print(" @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)"); |
101 stream.print(" @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)"); |
100 |
102 |
101 } else { |
103 } else { |
102 if (isCompat()) { |
104 if (isCompat()) { |
212 |
214 |
213 public double getTimeStamp() { |
215 public double getTimeStamp() { |
214 return timeStamp; |
216 return timeStamp; |
215 } |
217 } |
216 |
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 } |
217 } |
260 } |