--- old/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java 2015-02-17 08:08:23.000000000 -0500 +++ new/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java 2015-02-17 08:08:23.000000000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ /** * A SAX based parser of LogCompilation output from HotSpot. It takes a complete - * @author never */ package com.sun.hotspot.tools.compiler; import java.io.FileReader; +import java.io.PrintStream; import java.io.Reader; import java.util.ArrayDeque; import java.util.ArrayList; @@ -134,6 +134,44 @@ } }; + class Jvms { + Jvms(Method method, int bci) { + this.method = method; + this.bci = bci; + } + final public Method method; + final public int bci; + final public String toString() { + return "@" + bci + " " + method; + } + } + + class LockElimination extends BasicLogEvent { + + ArrayList jvms = new ArrayList(1); + final String kind; + final String classId; + final String tagName; + LockElimination(String tagName, double start, String id, String kind, String classId) { + super(start, id); + this.kind = kind; + this.classId = classId; + this.tagName = tagName; + } + + @Override + public void print(PrintStream stream) { + stream.printf("%s %s %s %s %.3f ", getId(), tagName, kind, classId, getStart()); + stream.print(jvms.toString()); + stream.print("\n"); + } + + void addJVMS(Method method, int bci) { + jvms.add(new Jvms(method, bci)); + } + + } + private ArrayList events = new ArrayList(); private HashMap types = new HashMap(); @@ -147,6 +185,7 @@ private CallSite site; private CallSite methodHandleSite; private Stack phaseStack = new Stack(); + private LockElimination currentLockElimination; private UncommonTrapEvent currentTrap; private Stack lateInlineScope; private boolean lateInlining; @@ -192,7 +231,12 @@ } LogParser log = new LogParser(); - p.parse(new InputSource(reader), log); + try { + p.parse(new InputSource(reader), log); + } catch (Throwable th) { + th.printStackTrace(); + // Carry on with what we've got... + } // Associate compilations with their NMethods for (NMethod nm : log.nmethods.values()) { @@ -418,8 +462,22 @@ // uncommon trap inserted during parsing. // ignore for now } + } else if (qname.startsWith("eliminate_lock")) { + String id = atts.getValue("compile_id"); + if (id != null) { + id = makeId(atts); + String kind = atts.getValue("kind"); + String classId = atts.getValue("class_id"); + currentLockElimination = new LockElimination(qname, Double.parseDouble(search(atts, "stamp")), id, kind, classId); + events.add(currentLockElimination); + } } else if (qname.equals("late_inline")) { - long inlineId = Long.parseLong(search(atts, "inline_id")); + long inlineId = 0; + try { + Long.parseLong(search(atts, "inline_id")); + } catch (InternalError ex) { + // 0 is an acceptable default value. + } lateInlineScope = new Stack(); site = new CallSite(-999, method(search(atts, "method"))); site.setInlineId(inlineId); @@ -428,6 +486,8 @@ // if (currentTrap != null) { currentTrap.addJVMS(atts.getValue("method"), Integer.parseInt(atts.getValue("bci"))); + } else if (currentLockElimination != null) { + currentLockElimination.addJVMS(method(atts.getValue("method")), Integer.parseInt(atts.getValue("bci"))); } else if (lateInlineScope != null) { bci = Integer.parseInt(search(atts, "bci")); site = new CallSite(bci, method(search(atts, "method"))); @@ -512,6 +572,8 @@ } } else if (qname.equals("uncommon_trap")) { currentTrap = null; + } else if (qname.startsWith("eliminate_lock")) { + currentLockElimination = null; } else if (qname.equals("late_inline")) { // Populate late inlining info. if (scopes.size() != 0) { @@ -522,8 +584,8 @@ CallSite caller = lateInlineScope.pop(); Method m = compile.getMethod(); if (m != caller.getMethod()) { - System.out.println(m); - System.out.println(caller.getMethod() + " bci: " + bci); + System.err.println(m); + System.err.println(caller.getMethod() + " bci: " + bci); throw new InternalError("call site and late_inline info don't match"); }