7147416: LogCompilation tool does not work with post parse inlining
Fixed few problems in LogCompilation parser. Reviewed-by: never
This commit is contained in:
parent
22db6951dc
commit
9c6ab6372f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2012, 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
|
||||
@ -33,6 +33,7 @@ public class Compilation implements LogEvent {
|
||||
private boolean osr;
|
||||
private Method method;
|
||||
private CallSite call = new CallSite();
|
||||
private CallSite lateInlineCall = new CallSite();
|
||||
private int osrBci;
|
||||
private String icount;
|
||||
private String bcount;
|
||||
@ -80,6 +81,13 @@ public class Compilation implements LogEvent {
|
||||
sb.append(site);
|
||||
sb.append("\n");
|
||||
}
|
||||
if (getLateInlineCall().getCalls() != null) {
|
||||
sb.append("late inline:\n");
|
||||
for (CallSite site : getLateInlineCall().getCalls()) {
|
||||
sb.append(site);
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@ -115,6 +123,12 @@ public class Compilation implements LogEvent {
|
||||
site.print(stream, indent + 2);
|
||||
}
|
||||
}
|
||||
if (printInlining && lateInlineCall.getCalls() != null) {
|
||||
stream.println("late inline:");
|
||||
for (CallSite site : lateInlineCall.getCalls()) {
|
||||
site.print(stream, indent + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +229,11 @@ public class Compilation implements LogEvent {
|
||||
}
|
||||
|
||||
public void setMethod(Method method) {
|
||||
this.method = method;
|
||||
// Don't change method if it is already set to avoid changing
|
||||
// it by post parse inlining info.
|
||||
if (getMethod() == null) {
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
|
||||
public CallSite getCall() {
|
||||
@ -226,6 +244,10 @@ public class Compilation implements LogEvent {
|
||||
this.call = call;
|
||||
}
|
||||
|
||||
public CallSite getLateInlineCall() {
|
||||
return lateInlineCall;
|
||||
}
|
||||
|
||||
public double getElapsedTime() {
|
||||
return end - start;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2012, 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
|
||||
@ -146,6 +146,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
|
||||
private CallSite site;
|
||||
private Stack<Phase> phaseStack = new Stack<Phase>();
|
||||
private UncommonTrapEvent currentTrap;
|
||||
private Stack<CallSite> late_inline_scope;
|
||||
|
||||
long parseLong(String l) {
|
||||
try {
|
||||
@ -302,6 +303,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
|
||||
}
|
||||
events.add(compile);
|
||||
compiles.put(makeId(atts), compile);
|
||||
site = compile.getCall();
|
||||
} else if (qname.equals("type")) {
|
||||
type(search(atts, "id"), search(atts, "name"));
|
||||
} else if (qname.equals("bc")) {
|
||||
@ -360,12 +362,22 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
|
||||
// uncommon trap inserted during parsing.
|
||||
// ignore for now
|
||||
}
|
||||
} else if (qname.equals("late_inline")) {
|
||||
late_inline_scope = new Stack<CallSite>();
|
||||
site = new CallSite(-999, method(search(atts, "method")));
|
||||
late_inline_scope.push(site);
|
||||
} else if (qname.equals("jvms")) {
|
||||
// <jvms bci='4' method='java/io/DataInputStream readChar ()C' bytes='40' count='5815' iicount='20815'/>
|
||||
if (currentTrap != null) {
|
||||
currentTrap.addJVMS(atts.getValue("method"), Integer.parseInt(atts.getValue("bci")));
|
||||
} else if (late_inline_scope != null) {
|
||||
bci = Integer.parseInt(search(atts, "bci"));
|
||||
site = new CallSite(bci, method(search(atts, "method")));
|
||||
late_inline_scope.push(site);
|
||||
} else {
|
||||
// Ignore <eliminate_allocation type='667'> and <eliminate_lock lock='1'>
|
||||
// Ignore <eliminate_allocation type='667'>,
|
||||
// <eliminate_lock lock='1'>,
|
||||
// <replace_string_concat arguments='2' string_alloc='0' multiple='0'>
|
||||
}
|
||||
} else if (qname.equals("nmethod")) {
|
||||
String id = makeId(atts);
|
||||
@ -379,7 +391,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
|
||||
Method m = method(search(atts, "method"));
|
||||
if (scopes.size() == 0) {
|
||||
compile.setMethod(m);
|
||||
scopes.push(compile.getCall());
|
||||
scopes.push(site);
|
||||
} else {
|
||||
if (site.getMethod() == m) {
|
||||
scopes.push(site);
|
||||
@ -393,7 +405,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
|
||||
}
|
||||
} else if (qname.equals("parse_done")) {
|
||||
CallSite call = scopes.pop();
|
||||
call.setEndNodes(Integer.parseInt(search(atts, "nodes")));
|
||||
call.setEndNodes(Integer.parseInt(search(atts, "nodes", "1")));
|
||||
call.setTimeStamp(Double.parseDouble(search(atts, "stamp")));
|
||||
scopes.push(call);
|
||||
}
|
||||
@ -408,6 +420,43 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
|
||||
scopes.pop();
|
||||
} else if (qname.equals("uncommon_trap")) {
|
||||
currentTrap = null;
|
||||
} else if (qname.equals("late_inline")) {
|
||||
// Populate late inlining info.
|
||||
|
||||
// late_inline scopes are specified in reverse order:
|
||||
// compiled method should be on top of stack.
|
||||
CallSite caller = late_inline_scope.pop();
|
||||
Method m = compile.getMethod();
|
||||
if (m != caller.getMethod()) {
|
||||
System.out.println(m);
|
||||
System.out.println(caller.getMethod() + " bci: " + bci);
|
||||
throw new InternalError("call site and late_inline info don't match");
|
||||
}
|
||||
|
||||
// late_inline contains caller+bci info, convert it
|
||||
// to bci+callee info used by LogCompilation.
|
||||
site = compile.getLateInlineCall();
|
||||
do {
|
||||
bci = caller.getBci();
|
||||
// Next inlined call.
|
||||
caller = late_inline_scope.pop();
|
||||
CallSite callee = new CallSite(bci, caller.getMethod());
|
||||
site.add(callee);
|
||||
site = callee;
|
||||
} while (!late_inline_scope.empty());
|
||||
|
||||
if (caller.getBci() != -999) {
|
||||
System.out.println(caller.getMethod());
|
||||
throw new InternalError("broken late_inline info");
|
||||
}
|
||||
if (site.getMethod() != caller.getMethod()) {
|
||||
System.out.println(site.getMethod());
|
||||
System.out.println(caller.getMethod());
|
||||
throw new InternalError("call site and late_inline info don't match");
|
||||
}
|
||||
// late_inline is followed by parse with scopes.size() == 0,
|
||||
// 'site' will be pushed to scopes.
|
||||
late_inline_scope = null;
|
||||
} else if (qname.equals("task")) {
|
||||
types.clear();
|
||||
methods.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user