348 events.add(e);
349 } else if (qname.equals("uncommon_trap")) {
350 String id = atts.getValue("compile_id");
351 if (id != null) {
352 id = makeId(atts);
353 currentTrap = new UncommonTrapEvent(Double.parseDouble(search(atts, "stamp")),
354 id,
355 atts.getValue("reason"),
356 atts.getValue("action"),
357 Integer.parseInt(search(atts, "count", "0")));
358 events.add(currentTrap);
359 } else {
360 // uncommon trap inserted during parsing.
361 // ignore for now
362 }
363 } else if (qname.equals("jvms")) {
364 // <jvms bci='4' method='java/io/DataInputStream readChar ()C' bytes='40' count='5815' iicount='20815'/>
365 if (currentTrap != null) {
366 currentTrap.addJVMS(atts.getValue("method"), Integer.parseInt(atts.getValue("bci")));
367 } else {
368 System.err.println("Missing uncommon_trap for jvms");
369 }
370 } else if (qname.equals("nmethod")) {
371 String id = makeId(atts);
372 NMethod nm = new NMethod(Double.parseDouble(search(atts, "stamp")),
373 id,
374 parseLong(atts.getValue("address")),
375 parseLong(atts.getValue("size")));
376 nmethods.put(id, nm);
377 events.add(nm);
378 } else if (qname.equals("parse")) {
379 Method m = method(search(atts, "method"));
380 if (scopes.size() == 0) {
381 compile.setMethod(m);
382 scopes.push(compile.getCall());
383 } else {
384 if (site.getMethod() == m) {
385 scopes.push(site);
386 } else if (scopes.peek().getCalls().size() > 2 && m == scopes.peek().last(-2).getMethod()) {
387 scopes.push(scopes.peek().last(-2));
388 } else {
389 System.out.println(site.getMethod());
390 System.out.println(m);
391 throw new InternalError("call site and parse don't match");
392 }
393 }
394 }
395 }
396
397 @Override
398 public void endElement(String uri,
399 String localName,
400 String qname) {
401 if (qname.equals("parse")) {
402 indent -= 2;
403 scopes.pop();
404 } else if (qname.equals("uncommon_trap")) {
405 currentTrap = null;
406 } else if (qname.equals("task")) {
407 types.clear();
408 methods.clear();
409 site = null;
410 }
411 }
412
413 @Override
|
348 events.add(e);
349 } else if (qname.equals("uncommon_trap")) {
350 String id = atts.getValue("compile_id");
351 if (id != null) {
352 id = makeId(atts);
353 currentTrap = new UncommonTrapEvent(Double.parseDouble(search(atts, "stamp")),
354 id,
355 atts.getValue("reason"),
356 atts.getValue("action"),
357 Integer.parseInt(search(atts, "count", "0")));
358 events.add(currentTrap);
359 } else {
360 // uncommon trap inserted during parsing.
361 // ignore for now
362 }
363 } else if (qname.equals("jvms")) {
364 // <jvms bci='4' method='java/io/DataInputStream readChar ()C' bytes='40' count='5815' iicount='20815'/>
365 if (currentTrap != null) {
366 currentTrap.addJVMS(atts.getValue("method"), Integer.parseInt(atts.getValue("bci")));
367 } else {
368 // Ignore <eliminate_allocation type='667'> and <eliminate_lock lock='1'>
369 }
370 } else if (qname.equals("nmethod")) {
371 String id = makeId(atts);
372 NMethod nm = new NMethod(Double.parseDouble(search(atts, "stamp")),
373 id,
374 parseLong(atts.getValue("address")),
375 parseLong(atts.getValue("size")));
376 nmethods.put(id, nm);
377 events.add(nm);
378 } else if (qname.equals("parse")) {
379 Method m = method(search(atts, "method"));
380 if (scopes.size() == 0) {
381 compile.setMethod(m);
382 scopes.push(compile.getCall());
383 } else {
384 if (site.getMethod() == m) {
385 scopes.push(site);
386 } else if (scopes.peek().getCalls().size() > 2 && m == scopes.peek().last(-2).getMethod()) {
387 scopes.push(scopes.peek().last(-2));
388 } else {
389 System.out.println(site.getMethod());
390 System.out.println(m);
391 throw new InternalError("call site and parse don't match");
392 }
393 }
394 } else if (qname.equals("parse_done")) {
395 CallSite call = scopes.pop();
396 call.setEndNodes(Integer.parseInt(search(atts, "nodes")));
397 call.setTimeStamp(Double.parseDouble(search(atts, "stamp")));
398 scopes.push(call);
399 }
400 }
401
402 @Override
403 public void endElement(String uri,
404 String localName,
405 String qname) {
406 if (qname.equals("parse")) {
407 indent -= 2;
408 scopes.pop();
409 } else if (qname.equals("uncommon_trap")) {
410 currentTrap = null;
411 } else if (qname.equals("task")) {
412 types.clear();
413 methods.clear();
414 site = null;
415 }
416 }
417
418 @Override
|