Broken debug output

Stefan Marr java at stefan-marr.de
Thu Apr 10 14:27:55 UTC 2014


Dear Graal/Truffle team:

I have another little request: could you please add a job on your CI infrastructure that runs a few of selected benchmarks with all your debugging output enabled?

Please find below a patch, that might fix at least two issues. The last one was already broken for a long time, but I was not sure whether it is just something that’s showing up in TruffleSOM. Also, for the second part, I really don’t know what I am doing here.
But, `(ConstantNode) methodCallTargetNode.arguments().first()` seems to me as if it is a rather brittle construct. If you got such strong assumptions about that collection, perhaps it would be better to document that by extracting it as a method with a name.
That also might give people like me a few more clues about what’s going on there.


diff --git a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
index 802e759..6376fab 100644
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
@@ -86,7 +86,7 @@ public class PartialEvaluator {
             throw Debug.handle(e);
         }
 
-        if (TraceTruffleCompilationHistogram.getValue()) {
+        if (TraceTruffleCompilationHistogram.getValue() || TraceTruffleCompilationDetails.getValue()) {
             constantReceivers = new HashSet<>();
         }
 
@@ -203,8 +203,14 @@ public class PartialEvaluator {
                         }
 
                         if (TraceTruffleCompilationDetails.getValue() && kind == InvokeKind.Special) {
-                            ConstantNode constantNode = (ConstantNode) methodCallTargetNode.arguments().first();
-                            constantReceivers.add(constantNode.asConstant());
+                            ValueNode val = methodCallTargetNode.arguments().first();
+                            ConstantNode cat;  // I don’t know what I am doing here, but if it ain’t the first, perhaps it is the second...
+                            if (val instanceof ConstantNode) {
+                                cst = (ConstantNode) val;
+                            } else {
+                                cst = (ConstantNode) methodCallTargetNode.arguments().get(1);
+                            }
+                            constantReceivers.add(cst.asConstant());
                         }
 
                         StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTargetNode.targetMethod());



Thanks a lot
Stefan


-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the graal-dev mailing list