8249663: LogCompilation cannot process log from o.r.scala.dotty.JmhDotty

Fix stale site and uncommon trap processing in LogParser

Reviewed-by: vlivanov, kvn
This commit is contained in:
Eric Caspole 2020-07-29 15:41:37 -04:00
parent 4946a162aa
commit 0aefe6f20a

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2020, 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
@ -551,6 +551,11 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
*/
private Locator locator;
/**
* Record the location in a replace_string_concat.
*/
private boolean expectStringConcatTrap = false;
/**
* Callback for the SAX framework to set the document locator.
*/
@ -987,6 +992,8 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
cs.setIntrinsicName(id);
} else if (qname.equals("regalloc")) {
compile.setAttempts(Integer.parseInt(search(atts, "attempts")));
} else if (qname.equals("replace_string_concat")) {
expectStringConcatTrap = true;
} else if (qname.equals("inline_fail")) {
if (methodHandleSite != null) {
scopes.peek().add(methodHandleSite);
@ -1087,9 +1094,14 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
Method m = method(search(atts, "method"));
site = new CallSite(current_bci, m);
lateInlineScope.push(site);
} else if (expectStringConcatTrap == true) {
// Record the location of the replace_string_concat for the
// uncommon_trap 'intrinsic_or_type_checked_inlining' that should follow it
current_bci = Integer.parseInt(search(atts, "bci"));
Method m = method(search(atts, "method"));
site = new CallSite(current_bci, m);
} else {
// Ignore <eliminate_allocation type='667'>,
// <replace_string_concat arguments='2' string_alloc='0' multiple='0'>
}
} else if (qname.equals("inline_id")) {
if (methodHandleSite != null) {
@ -1142,7 +1154,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
// The method being parsed is *not* the current compilation's
// top scope; i.e., we're dealing with an actual call site
// in the top scope or somewhere further down a call stack.
if (site.getMethod() == m) {
if (site != null && site.getMethod() == m) {
// We're dealing with monomorphic inlining that didn't have
// to be narrowed down, because the receiver was known
// beforehand.
@ -1215,6 +1227,8 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
if (scopes.size() == 0) {
lateInlining = false;
}
// Don't carry a stale site to the next parse
site = null;
} else if (qname.equals("uncommon_trap")) {
currentTrap = null;
} else if (qname.startsWith("eliminate_lock")) {
@ -1289,6 +1303,8 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
methods.clear();
site = null;
lateInlining = false;
} else if (qname.equals("replace_string_concat")) {
expectStringConcatTrap = false;
}
} catch (Exception e) {
reportInternalError("exception while processing end element", e);