changeset 17409:4c0dcd164718

Truffle: fix potential null dereference error in partial evaluator.
author Christian Humer <christian.humer@gmail.com>
date Fri, 10 Oct 2014 10:54:11 +0200
parents f0792f868d7d
children c58171f94377
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Thu Oct 09 17:25:35 2014 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Fri Oct 10 10:54:11 2014 +0200
@@ -369,33 +369,26 @@
         }
 
         TruffleInliningDecision decision = inlining.findByCall(callNode);
-        boolean inline;
         if (decision == null) {
             if (TruffleCompilerOptions.TraceTrufflePerformanceWarnings.getValue()) {
                 Map<String, Object> properties = new LinkedHashMap<>();
                 properties.put("callNode", callNode);
                 logPerformanceWarning("A direct call within the Truffle AST is not reachable anymore. Call node could not be inlined.", properties);
             }
-            inline = false;
-        } else {
-            inline = decision.isInline();
         }
 
-        assert decision.getProfile().getCallNode() == callNode;
-
-        OptimizedCallTarget currentTarget = decision.getProfile().getCallNode().getCurrentCallTarget();
-        if (decision.getTarget() != currentTarget) {
+        if (decision != null && decision.getTarget() != decision.getProfile().getCallNode().getCurrentCallTarget()) {
             if (TruffleCompilerOptions.TraceTrufflePerformanceWarnings.getValue()) {
                 Map<String, Object> properties = new LinkedHashMap<>();
                 properties.put("originalTarget", decision.getTarget());
                 properties.put("callNode", callNode);
                 logPerformanceWarning(String.format("CallTarget changed during compilation. Call node could not be inlined."), properties);
             }
-            inline = false;
+            decision = null;
         }
 
         StructuredGraph graph;
-        if (inline) {
+        if (decision != null && decision.isInline()) {
             if (inliningCache == null) {
                 graph = createInlineGraph(phaseContext, assumptions, null, decision);
             } else {