--- old/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java 2015-02-12 16:42:16.000000000 -0500 +++ new/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java 2015-02-12 16:42:16.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(); @@ -192,7 +230,12 @@ } LogParser log = new LogParser(); + 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,6 +461,15 @@ // 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")); lateInlineScope = new Stack(); @@ -512,6 +564,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 +576,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"); }