8197447: LogCompilation throws "couldn't find bytecode"
Summary: Handle unstable_fused_if
Reviewed-by: kvn, gtriantafill
--- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java Fri May 04 14:37:58 2018 +0100
+++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java Fri May 04 10:45:47 2018 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, 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
@@ -60,6 +60,10 @@
setCount(Math.max(getCount(), trap.getCount()));
}
+ public String toString() {
+ return "uncommon trap " + bytecode + " " + getReason() + " " + getAction();
+ }
+
public void print(PrintStream stream, boolean printID) {
if (printID) {
stream.print(getId() + " ");
@@ -92,6 +96,20 @@
this.count = count;
}
+ private boolean trapReasonsAreEqual(String otherReason) {
+ if (otherReason.equals(getReason())) {
+ return true;
+ }
+
+ // Optimization may combine 2 if's into 1
+ if (otherReason.equals("unstable_if")
+ && getReason().equals("unstable_fused_if")) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Set the compilation for this event. This involves identifying the call
* site to which this uncommon trap event belongs. In addition to setting
@@ -127,13 +145,14 @@
}
for (UncommonTrap trap : traps) {
if (trap.getBCI() == jvmsBCIs.get(i) &&
- trap.getReason().equals(getReason()) &&
+ trapReasonsAreEqual(trap.getReason()) &&
trap.getAction().equals(getAction())) {
bytecode = trap.getBytecode();
return;
}
}
- throw new InternalError("couldn't find bytecode");
+ throw new InternalError("couldn't find bytecode for [" + this + "] in Compilation:" + compilation);
+
} catch (Exception e) {
bytecode = "<unknown>";
}