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 }
|
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 if (calls == null) {
235 return null;
236 }
237 CallSite site = sites.pop();
238 for (CallSite c : calls) {
239 if (c.matches(site)) {
240 if (!sites.isEmpty()) {
241 CallSite res = c.findCallSite(sites);
242 if (res != null) {
243 sites.push(site);
244 return res;
245 }
246 } else {
247 sites.push(site);
248 return c;
249 }
250 }
251 }
252 sites.push(site);
253 return null;
254 }
255
256 public ArrayDeque<CallSite> findCallSite2(CallSite site) {
257 if (calls == null) {
258 return null;
259 }
260
261 for (CallSite c : calls) {
262 if (c.matches(site)) {
263 ArrayDeque<CallSite> stack = new ArrayDeque<CallSite>();
264 stack.push(c);
265 return stack;
266 } else {
267 ArrayDeque<CallSite> stack = c.findCallSite2(site);
268 if (stack != null) {
269 stack.push(c);
270 return stack;
271 }
272 }
273 }
274 return null;
275 }
276
277 public long getInlineId() {
278 return inlineId;
279 }
280
281 public void setInlineId(long inlineId) {
282 this.inlineId = inlineId;
283 }
284 }
|