251 return result;
252 }
253
254 public String makeId(Attributes atts) {
255 String id = atts.getValue("compile_id");
256 String kind = atts.getValue("kind");
257 if (kind != null && kind.equals("osr")) {
258 id += "%";
259 }
260 return id;
261 }
262
263 @Override
264 public void startElement(String uri,
265 String localName,
266 String qname,
267 Attributes atts) {
268 if (qname.equals("phase")) {
269 Phase p = new Phase(search(atts, "name"),
270 Double.parseDouble(search(atts, "stamp")),
271 Integer.parseInt(search(atts, "nodes")));
272 phaseStack.push(p);
273 } else if (qname.equals("phase_done")) {
274 Phase p = phaseStack.pop();
275 p.setEndNodes(Integer.parseInt(search(atts, "nodes")));
276 p.setEnd(Double.parseDouble(search(atts, "stamp")));
277 compile.getPhases().add(p);
278 } else if (qname.equals("task")) {
279 compile = new Compilation(Integer.parseInt(search(atts, "compile_id", "-1")));
280 compile.setStart(Double.parseDouble(search(atts, "stamp")));
281 compile.setICount(search(atts, "count", "0"));
282 compile.setBCount(search(atts, "backedge_count", "0"));
283
284 String method = atts.getValue("method");
285 int space = method.indexOf(' ');
286 method = method.substring(0, space) + "::" +
287 method.substring(space + 1, method.indexOf(' ', space + 1) + 1);
288 String compiler = atts.getValue("compiler");
289 if (compiler == null) {
290 compiler = "";
291 }
292 String kind = atts.getValue("compile_kind");
293 if (kind == null) {
294 kind = "normal";
295 }
296 if (kind.equals("osr")) {
389 events.add(nm);
390 } else if (qname.equals("parse")) {
391 Method m = method(search(atts, "method"));
392 if (scopes.size() == 0) {
393 compile.setMethod(m);
394 scopes.push(site);
395 } else {
396 if (site.getMethod() == m) {
397 scopes.push(site);
398 } else if (scopes.peek().getCalls().size() > 2 && m == scopes.peek().last(-2).getMethod()) {
399 scopes.push(scopes.peek().last(-2));
400 } else {
401 System.out.println(site.getMethod());
402 System.out.println(m);
403 throw new InternalError("call site and parse don't match");
404 }
405 }
406 } else if (qname.equals("parse_done")) {
407 CallSite call = scopes.pop();
408 call.setEndNodes(Integer.parseInt(search(atts, "nodes", "1")));
409 call.setTimeStamp(Double.parseDouble(search(atts, "stamp")));
410 scopes.push(call);
411 }
412 }
413
414 @Override
415 public void endElement(String uri,
416 String localName,
417 String qname) {
418 if (qname.equals("parse")) {
419 indent -= 2;
420 scopes.pop();
421 } else if (qname.equals("uncommon_trap")) {
422 currentTrap = null;
423 } else if (qname.equals("late_inline")) {
424 // Populate late inlining info.
425
426 // late_inline scopes are specified in reverse order:
427 // compiled method should be on top of stack.
428 CallSite caller = late_inline_scope.pop();
|
251 return result;
252 }
253
254 public String makeId(Attributes atts) {
255 String id = atts.getValue("compile_id");
256 String kind = atts.getValue("kind");
257 if (kind != null && kind.equals("osr")) {
258 id += "%";
259 }
260 return id;
261 }
262
263 @Override
264 public void startElement(String uri,
265 String localName,
266 String qname,
267 Attributes atts) {
268 if (qname.equals("phase")) {
269 Phase p = new Phase(search(atts, "name"),
270 Double.parseDouble(search(atts, "stamp")),
271 Integer.parseInt(search(atts, "nodes")),
272 Integer.parseInt(search(atts, "live")));
273 phaseStack.push(p);
274 } else if (qname.equals("phase_done")) {
275 Phase p = phaseStack.pop();
276 if (! p.getId().equals(search(atts, "name"))) {
277 System.out.println("phase: " + p.getId());
278 throw new InternalError("phase name mismatch");
279 }
280 p.setEnd(Double.parseDouble(search(atts, "stamp")));
281 p.setEndNodes(Integer.parseInt(search(atts, "nodes")));
282 p.setEndLiveNodes(Integer.parseInt(search(atts, "live")));
283 compile.getPhases().add(p);
284 } else if (qname.equals("task")) {
285 compile = new Compilation(Integer.parseInt(search(atts, "compile_id", "-1")));
286 compile.setStart(Double.parseDouble(search(atts, "stamp")));
287 compile.setICount(search(atts, "count", "0"));
288 compile.setBCount(search(atts, "backedge_count", "0"));
289
290 String method = atts.getValue("method");
291 int space = method.indexOf(' ');
292 method = method.substring(0, space) + "::" +
293 method.substring(space + 1, method.indexOf(' ', space + 1) + 1);
294 String compiler = atts.getValue("compiler");
295 if (compiler == null) {
296 compiler = "";
297 }
298 String kind = atts.getValue("compile_kind");
299 if (kind == null) {
300 kind = "normal";
301 }
302 if (kind.equals("osr")) {
395 events.add(nm);
396 } else if (qname.equals("parse")) {
397 Method m = method(search(atts, "method"));
398 if (scopes.size() == 0) {
399 compile.setMethod(m);
400 scopes.push(site);
401 } else {
402 if (site.getMethod() == m) {
403 scopes.push(site);
404 } else if (scopes.peek().getCalls().size() > 2 && m == scopes.peek().last(-2).getMethod()) {
405 scopes.push(scopes.peek().last(-2));
406 } else {
407 System.out.println(site.getMethod());
408 System.out.println(m);
409 throw new InternalError("call site and parse don't match");
410 }
411 }
412 } else if (qname.equals("parse_done")) {
413 CallSite call = scopes.pop();
414 call.setEndNodes(Integer.parseInt(search(atts, "nodes", "1")));
415 call.setEndLiveNodes(Integer.parseInt(search(atts, "live", "1")));
416 call.setTimeStamp(Double.parseDouble(search(atts, "stamp")));
417 scopes.push(call);
418 }
419 }
420
421 @Override
422 public void endElement(String uri,
423 String localName,
424 String qname) {
425 if (qname.equals("parse")) {
426 indent -= 2;
427 scopes.pop();
428 } else if (qname.equals("uncommon_trap")) {
429 currentTrap = null;
430 } else if (qname.equals("late_inline")) {
431 // Populate late inlining info.
432
433 // late_inline scopes are specified in reverse order:
434 // compiled method should be on top of stack.
435 CallSite caller = late_inline_scope.pop();
|