changeset 49996:29b840b16a96

8197447: LogCompilation throws "couldn't find bytecode" Summary: Handle unstable_fused_if Reviewed-by: kvn, gtriantafill
author ecaspole
date Fri, 04 May 2018 10:45:47 -0400
parents 44e581f54d08
children e4b3cc56e2b2 a2a0c61f8b09
files src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java
diffstat 1 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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>";
         }