From d17d2dbe25f437ce4d2e5351a923aed820d33563 Mon Sep 17 00:00:00 2001
From: Zbynek Slajchrt <zbynek.slajchrt@oracle.com>
Date: Tue, 13 Dec 2016 17:13:23 +0100
Subject: [PATCH] A specialization added to RemoveFixedAttributeNode

---
 .../r/nodes/attributes/RemoveFixedAttributeNode.java  | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveFixedAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveFixedAttributeNode.java
index 9356100103..b9c737057e 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveFixedAttributeNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveFixedAttributeNode.java
@@ -26,6 +26,8 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.object.DynamicObject;
+import com.oracle.truffle.api.object.Location;
+import com.oracle.truffle.api.object.Shape;
 import com.oracle.truffle.api.profiles.BranchProfile;
 import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.api.profiles.ValueProfile;
@@ -68,6 +70,15 @@ public abstract class RemoveFixedAttributeNode extends FixedAttributeAccessNode
 
     public abstract void execute(Object attrs);
 
+    @Specialization(limit = "3", //
+                    guards = {"shapeCheck(shape, attrs)", "location == null"}, //
+                    assumptions = {"shape.getValidAssumption()"})
+    protected void removeNonExistantAttr(@SuppressWarnings("unused") DynamicObject attrs,
+                    @SuppressWarnings("unused") @Cached("lookupShape(attrs)") Shape shape,
+                    @SuppressWarnings("unused") @Cached("lookupLocation(shape, name)") Location location) {
+        // do nothing
+    }
+
     @Specialization
     @TruffleBoundary
     protected void removeAttrFallback(DynamicObject attrs) {
-- 
GitLab