changeset 7929:9ac11c77d128

Mark PTX parameters as non-null.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 05 Mar 2013 11:49:29 +0100
parents 47a7e8d80536
children fe64b5da8229
files graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXCompare.java
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java	Tue Mar 05 11:03:33 2013 +0100
+++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java	Tue Mar 05 11:49:29 2013 +0100
@@ -25,6 +25,7 @@
 import org.junit.*;
 
 import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.ptx.*;
@@ -32,6 +33,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.PhasePlan.*;
 import com.oracle.graal.ptx.*;
@@ -67,7 +69,23 @@
         PhasePlan phasePlan = new PhasePlan();
         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE);
         phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
+        phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PTXPhase());
+        new PTXPhase().apply(graph);
         CompilationResult result = GraalCompiler.compileMethod(runtime, ptxBackend, target, graph.method(), graph, null, phasePlan, OptimisticOptimizations.NONE);
         System.out.println("result=" + result);
     }
+
+    private static class PTXPhase extends Phase {
+
+        @Override
+        protected void run(StructuredGraph graph) {
+            System.out.println("PTX phase");
+            for (LocalNode local : graph.getNodes(LocalNode.class)) {
+                if (local.kind() == Kind.Object) {
+                    local.setStamp(StampFactory.declaredNonNull(local.objectStamp().type()));
+                }
+            }
+        }
+
+    }
 }
--- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXCompare.java	Tue Mar 05 11:03:33 2013 +0100
+++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXCompare.java	Tue Mar 05 11:49:29 2013 +0100
@@ -38,7 +38,7 @@
     public static class CompareOp extends PTXLIRInstruction {
 
         @Opcode private final PTXCompare opcode;
-        @Use({REG}) protected Value x;
+        @Use({REG, STACK, CONST}) protected Value x;
         @Use({REG, STACK, CONST}) protected Value y;
         private final Condition condition;