changeset 11236:8e3ba1110a71

FrameAccessNode: check that constant frame slot is not null.
author Andreas Woess <andreas.woess@jku.at>
date Wed, 07 Aug 2013 12:52:39 +0200
parents cc5473cf32bb
children 2e38c55153e5
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameAccessNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameGetNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameSetNode.java
diffstat 3 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameAccessNode.java	Wed Aug 07 14:07:06 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameAccessNode.java	Wed Aug 07 12:52:39 2013 +0200
@@ -66,15 +66,15 @@
     }
 
     protected int getSlotIndex() {
-        return getFrameSlot().getIndex();
+        return getConstantFrameSlot().getIndex();
     }
 
-    protected boolean isFrameSlotConstant() {
-        return slot.isConstant();
+    protected boolean isConstantFrameSlot() {
+        return slot.isConstant() && !slot.isNullConstant();
     }
 
-    protected FrameSlot getFrameSlot() {
-        assert isFrameSlotConstant() : slot;
+    protected FrameSlot getConstantFrameSlot() {
+        assert isConstantFrameSlot() : slot;
         return (FrameSlot) slot.asConstant().asObject();
     }
 
@@ -87,14 +87,14 @@
     @Override
     public String toString(Verbosity verbosity) {
         if (verbosity == Verbosity.Name) {
-            return super.toString(verbosity) + getSlotKind().name() + (isFrameSlotConstant() ? " " + getFrameSlot() : "");
+            return super.toString(verbosity) + getSlotKind().name() + (isConstantFrameSlot() ? " " + getConstantFrameSlot() : "");
         } else {
             return super.toString(verbosity);
         }
     }
 
     protected final ValueNode getSlotOffset(int scale, MetaAccessProvider metaAccessProvider) {
-        if (isFrameSlotConstant()) {
+        if (isConstantFrameSlot()) {
             return ConstantNode.forInt(getSlotIndex() * scale, graph());
         } else {
             LoadFieldNode loadFrameSlotIndex = graph().add(new LoadFieldNode(getSlot(), metaAccessProvider.lookupJavaField(getFrameSlotIndexField())));
@@ -117,7 +117,7 @@
             return true;
         }
 
-        return getSlotKind() == getGraalKind(getFrameSlot().getKind());
+        return getSlotKind() == getGraalKind(getConstantFrameSlot().getKind());
     }
 
     private static Kind getGraalKind(FrameSlotKind kind) {
@@ -142,12 +142,12 @@
 
     @Override
     public final void simplify(SimplifierTool tool) {
-        if (isFrameSlotConstant()) {
+        if (isConstantFrameSlot()) {
             if (!isValidAccessKind()) {
                 tool.deleteBranch(this.next());
                 this.replaceAndDelete(graph().add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.UnreachedCode)));
             } else {
-                tool.assumptions().record(new AssumptionValidAssumption((OptimizedAssumption) getFrameSlot().getFrameDescriptor().getVersion()));
+                tool.assumptions().record(new AssumptionValidAssumption((OptimizedAssumption) getConstantFrameSlot().getFrameDescriptor().getVersion()));
             }
         }
     }
@@ -155,8 +155,8 @@
     @Override
     public Map<Object, Object> getDebugProperties(Map<Object, Object> map) {
         Map<Object, Object> properties = super.getDebugProperties(map);
-        if (isFrameSlotConstant()) {
-            properties.put("frameSlot", getFrameSlot().toString());
+        if (isConstantFrameSlot()) {
+            properties.put("frameSlot", getConstantFrameSlot().toString());
         }
         return properties;
     }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameGetNode.java	Wed Aug 07 14:07:06 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameGetNode.java	Wed Aug 07 12:52:39 2013 +0200
@@ -48,7 +48,7 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        if (!isFrameSlotConstant()) {
+        if (!isConstantFrameSlot()) {
             return;
         }
         assert isValidAccessKind();
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameSetNode.java	Wed Aug 07 14:07:06 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/FrameSetNode.java	Wed Aug 07 12:52:39 2013 +0200
@@ -52,7 +52,7 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        if (!isFrameSlotConstant()) {
+        if (!isConstantFrameSlot()) {
             return;
         }
         assert isValidAccessKind();