From 72ac8c95b5ac2ae50aa4c19f3dfb9718872e35c8 Mon Sep 17 00:00:00 2001 From: Lukas Stadler <lukas.stadler@oracle.com> Date: Wed, 1 Feb 2017 17:12:54 +0100 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20use=20sequences=20in=20vector?= =?UTF-8?q?=20fast=20paths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/fastpaths/VectorFastPaths.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/VectorFastPaths.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/VectorFastPaths.java index 102ef1d27c..4e63574d6c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/VectorFastPaths.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/VectorFastPaths.java @@ -25,7 +25,7 @@ package com.oracle.truffle.r.nodes.builtin.base.fastpaths; import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Fallback; import com.oracle.truffle.api.dsl.Specialization; -import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.r.nodes.profile.VectorLengthProfile; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; @@ -43,20 +43,18 @@ public abstract class VectorFastPaths { @Specialization protected RAbstractIntVector get(int length, - @Cached("createBinaryProfile()") ConditionProfile emptyProfile) { - if (emptyProfile.profile(length == 0)) { - return RDataFactory.createIntVector(0); - } else if (length > 0) { - return RDataFactory.createIntSequence(0, 0, length); + @Cached("create()") VectorLengthProfile profile) { + if (length > 0) { + return RDataFactory.createIntVector(profile.profile(length)); } return null; } @Specialization protected RAbstractIntVector get(double length, - @Cached("createBinaryProfile()") ConditionProfile emptyProfile) { + @Cached("create()") VectorLengthProfile profile) { if (!Double.isNaN(length)) { - return get((int) length, emptyProfile); + return get((int) length, profile); } return null; } @@ -77,20 +75,18 @@ public abstract class VectorFastPaths { @Specialization protected RAbstractDoubleVector get(int length, - @Cached("createBinaryProfile()") ConditionProfile emptyProfile) { - if (emptyProfile.profile(length == 0)) { - return RDataFactory.createDoubleVector(0); - } else if (length > 0) { - return RDataFactory.createDoubleSequence(0, 0, length); + @Cached("create()") VectorLengthProfile profile) { + if (length > 0) { + return RDataFactory.createDoubleVector(profile.profile(length)); } return null; } @Specialization protected RAbstractDoubleVector get(double length, - @Cached("createBinaryProfile()") ConditionProfile emptyProfile) { + @Cached("create()") VectorLengthProfile profile) { if (!Double.isNaN(length)) { - return get((int) length, emptyProfile); + return get((int) length, profile); } return null; } -- GitLab