From 880deb28a6f56b459abb0c863ea8348ec56e4af4 Mon Sep 17 00:00:00 2001
From: Florian Angerer <florian.angerer@oracle.com>
Date: Wed, 23 Aug 2017 18:52:26 +0200
Subject: [PATCH] Refined guards in CastDoubleNode.

---
 .../com/oracle/truffle/r/nodes/unary/CastDoubleNode.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java
index 5f8e94ac36..a135756833 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java
@@ -107,12 +107,12 @@ public abstract class CastDoubleNode extends CastDoubleBaseNode {
         return (RAbstractDoubleVector) castWithReuse(RType.Double, operand, naProfile.getConditionProfile());
     }
 
-    @Specialization
+    @Specialization(guards = "!isReusable(operand)")
     protected RDoubleVector doIntVector(RAbstractIntVector operand) {
         return createResultVector(operand, index -> naCheck.convertIntToDouble(operand.getDataAt(index)));
     }
 
-    @Specialization
+    @Specialization(guards = "!isReusable(operand)")
     protected RDoubleVector doLogicalVectorDims(RAbstractLogicalVector operand) {
         return createResultVector(operand, index -> naCheck.convertLogicalToDouble(operand.getDataAt(index)));
     }
@@ -172,7 +172,7 @@ public abstract class CastDoubleNode extends CastDoubleBaseNode {
         return vectorCopy(operand, ddata, naCheck.neverSeenNA());
     }
 
-    @Specialization
+    @Specialization(guards = "!isReusable(operand)")
     protected RDoubleVector doRawVector(RRawVector operand) {
         return createResultVector(operand, index -> RRuntime.raw2double(operand.getDataAt(index)));
     }
-- 
GitLab