changeset 23086:089d48dfe8ce

8143730 [JVMCI] infopoint recording is too restrictive
author Doug Simon <doug.simon@oracle.com>
date Thu, 26 Nov 2015 00:55:12 +0100
parents a19b68d309a2
children d95078df25d0
files graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFile.java graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFileDisassemblerProvider.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java
diffstat 6 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFile.java	Wed Nov 25 15:32:07 2015 +0100
+++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFile.java	Thu Nov 26 00:55:12 2015 +0100
@@ -122,7 +122,7 @@
      * Map from a machine code position to a comment for the operands of the instruction at the
      * position.
      */
-    public final Map<Integer, String> operandComments = new TreeMap<>();
+    public final Map<Integer, List<String>> operandComments = new TreeMap<>();
 
     public final byte[] code;
 
@@ -180,8 +180,10 @@
             }
         }
 
-        for (Map.Entry<Integer, String> e : operandComments.entrySet()) {
-            ps.printf("OperandComment %d %s %s%n", e.getKey(), e.getValue(), SECTION_DELIM);
+        for (Map.Entry<Integer, List<String>> e : operandComments.entrySet()) {
+            for (String c : e.getValue()) {
+                ps.printf("OperandComment %d %s %s%n", e.getKey(), c, SECTION_DELIM);
+            }
         }
         ps.flush();
     }
@@ -218,12 +220,15 @@
     }
 
     /**
-     * Sets an operand comment for a given position.
-     *
-     * @return the previous operand comment for {@code pos}
+     * Adds an operand comment for a given position.
      */
-    public String addOperandComment(int pos, String comment) {
-        return operandComments.put(pos, encodeString(comment));
+    public void addOperandComment(int pos, String comment) {
+        List<String> list = comments.get(pos);
+        if (list == null) {
+            list = new ArrayList<>(1);
+            comments.put(pos, list);
+        }
+        list.add(encodeString(comment));
     }
 
     /**
--- a/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFileDisassemblerProvider.java	Wed Nov 25 15:32:07 2015 +0100
+++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFileDisassemblerProvider.java	Thu Nov 26 00:55:12 2015 +0100
@@ -117,8 +117,7 @@
     }
 
     private static void addOperandComment(HexCodeFile hcf, int pos, String comment) {
-        String oldValue = hcf.addOperandComment(pos, comment);
-        assert oldValue == null : "multiple comments for operand of instruction at " + pos + ": " + comment + ", " + oldValue;
+        hcf.addOperandComment(pos, comment);
     }
 
     /**
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Wed Nov 25 15:32:07 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Thu Nov 26 00:55:12 2015 +0100
@@ -83,7 +83,7 @@
         final StructuredGraph graph = parseDebug(method, AllowAssumptions.from(OptAssumptions.getValue()));
         int graphLineSPs = 0;
         for (FullInfopointNode ipn : graph.getNodes().filter(FullInfopointNode.class)) {
-            if (ipn.getReason() == InfopointReason.LINE_NUMBER) {
+            if (ipn.getReason() == InfopointReason.BYTECODE_POSITION) {
                 ++graphLineSPs;
             }
         }
@@ -95,7 +95,7 @@
         int lineSPs = 0;
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
-            if (sp.reason == InfopointReason.LINE_NUMBER) {
+            if (sp.reason == InfopointReason.BYTECODE_POSITION) {
                 ++lineSPs;
             }
         }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Wed Nov 25 15:32:07 2015 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Thu Nov 26 00:55:12 2015 +0100
@@ -451,7 +451,7 @@
             BytecodePosition position = node.getNodeContext(BytecodePosition.class);
             if (position != null && (lastPosition == null || !lastPosition.equals(position))) {
                 lastPosition = position;
-                recordSimpleInfopoint(InfopointReason.LINE_NUMBER, position);
+                recordSimpleInfopoint(InfopointReason.BYTECODE_POSITION, position);
             }
         }
         if (node instanceof LIRLowerable) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Wed Nov 25 15:32:07 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Thu Nov 26 00:55:12 2015 +0100
@@ -1387,7 +1387,7 @@
 
     protected void genThrow() {
         if (GraalOptions.OldInfopoints.getValue() && graphBuilderConfig.insertNonSafepointDebugInfo() && !parsingIntrinsic()) {
-            genInfoPointNode(InfopointReason.LINE_NUMBER, null);
+            genInfoPointNode(InfopointReason.BYTECODE_POSITION, null);
         }
 
         ValueNode exception = frameState.pop(JavaKind.Object);
@@ -2638,7 +2638,7 @@
             if (GraalOptions.OldInfopoints.getValue() && graphBuilderConfig.insertNonSafepointDebugInfo() && !parsingIntrinsic()) {
                 currentLineNumber = lnt != null ? lnt.getLineNumber(bci) : (graphBuilderConfig.insertFullDebugInfo() ? -1 : bci);
                 if (currentLineNumber != previousLineNumber) {
-                    genInfoPointNode(InfopointReason.LINE_NUMBER, null);
+                    genInfoPointNode(InfopointReason.BYTECODE_POSITION, null);
                     previousLineNumber = currentLineNumber;
                 }
             }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java	Wed Nov 25 15:32:07 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java	Thu Nov 26 00:55:12 2015 +0100
@@ -276,7 +276,7 @@
         if (op instanceof SimpleInfopointOp) {
             currentInfo = null;
         } else if (currentInfo != null) {
-            lirForBlock.add(new SimpleInfopointOp(InfopointReason.LINE_NUMBER, currentInfo));
+            lirForBlock.add(new SimpleInfopointOp(InfopointReason.BYTECODE_POSITION, currentInfo));
             currentInfo = null;
         }
         lirForBlock.add(op);