@@ -570,22 +570,24 @@ protected RIntVector seqFromOneArgObj(Object from, RMissing to, RMissing by, RMi
570570 * third specialization handles other types and invalid arguments.
571571 */
572572
573- @ Specialization (guards = "validDoubleParams(fromVec, toVec)" )
573+ @ Specialization (guards = "validDoubleParams(fromDataLib, fromVec, toDataLib, toVec)" , limit = "getTypedVectorDataLibraryCacheSize( )" )
574574 protected RAbstractVector seqLengthByMissingDouble (RDoubleVector fromVec , RDoubleVector toVec , RMissing by , RMissing lengthOut , RMissing alongWith , Object dotdotdot ,
575+ @ CachedLibrary ("fromVec.getData()" ) VectorDataLibrary fromDataLib ,
576+ @ CachedLibrary ("toVec.getData()" ) VectorDataLibrary toDataLib ,
575577 @ Cached ("createBinaryProfile()" ) ConditionProfile directionProfile ) {
576- double from = fromVec .getDataAt (0 );
577- double to = toVec .getDataAt (0 );
578- RAbstractVector result = createRSequence (from , to , directionProfile );
579- return result ;
578+ double from = fromDataLib .getDoubleAt (fromVec .getData (), 0 );
579+ double to = toDataLib .getDoubleAt (toVec .getData (), 0 );
580+ return createRSequence (from , to , directionProfile );
580581 }
581582
582- @ Specialization (guards = "validIntParams(fromVec, toVec)" )
583+ @ Specialization (guards = "validIntParams(fromDataLib, fromVec, toDataLib, toVec)" , limit = "getTypedVectorDataLibraryCacheSize( )" )
583584 protected RAbstractVector seqLengthByMissingInt (RIntVector fromVec , RIntVector toVec , RMissing by , RMissing lengthOut , RMissing alongWith , Object dotdotdot ,
585+ @ CachedLibrary ("fromVec.getData()" ) VectorDataLibrary fromDataLib ,
586+ @ CachedLibrary ("toVec.getData()" ) VectorDataLibrary toDataLib ,
584587 @ Cached ("createBinaryProfile()" ) ConditionProfile directionProfile ) {
585- int from = fromVec .getDataAt (0 );
586- int to = toVec .getDataAt (0 );
587- RIntVector result = createRIntSequence (from , to , directionProfile );
588- return result ;
588+ int from = fromDataLib .getIntAt (fromVec .getData (), 0 );
589+ int to = toDataLib .getIntAt (toVec .getData (), 0 );
590+ return createRIntSequence (from , to , directionProfile );
589591 }
590592
591593 /**
@@ -620,20 +622,26 @@ protected RAbstractVector seqLengthByMissing(Object fromObj, Object toObj, RMiss
620622 * handled in the "One" specializations.
621623 */
622624
623- @ Specialization (guards = {"validDoubleParams(fromVec, toVec)" , "!isMissing(byObj)" })
625+ @ Specialization (guards = {"validDoubleParams(fromDataLib, fromVec, toDataLib, toVec)" , "!isMissing(byObj)" }, limit = "getTypedVectorDataLibraryCacheSize()" )
624626 protected Object seqLengthMissing (RDoubleVector fromVec , RDoubleVector toVec , Object byObj , RMissing lengthOut , RMissing alongWith , Object dotdotdot ,
627+ @ CachedLibrary ("fromVec.getData()" ) VectorDataLibrary fromDataLib ,
628+ @ CachedLibrary ("toVec.getData()" ) VectorDataLibrary toDataLib ,
625629 @ Cached ("create()" ) AsRealNode asRealby ) {
626630 validateLength (byObj , "by" );
627631 double by = asRealby .execute (byObj );
628- return doSeqLengthMissing (fromVec .getDataAt ( 0 ), toVec .getDataAt ( 0 ), by , false );
632+ return doSeqLengthMissing (fromDataLib . getDoubleAt ( fromVec .getData (), 0 ), toDataLib . getDoubleAt ( toVec .getData (), 0 ), by , false );
629633 }
630634
631- @ Specialization (guards = {"validIntParams(fromVec, toVec)" , "validIntParam(byVec)" , "byVec.getDataAt(0) != 0" })
635+ @ Specialization (guards = {"validIntParams(fromDataLib, fromVec, toDataLib, toVec)" , "validIntParam(byDataLib, byVec)" ,
636+ "byDataLib.getIntAt(byVec.getData(), 0) != 0" }, limit = "getTypedVectorDataLibraryCacheSize()" )
632637 protected RAbstractVector seqLengthMissing (RIntVector fromVec , RIntVector toVec , RIntVector byVec , RMissing lengthOut , RMissing alongWith , Object dotdotdot ,
638+ @ CachedLibrary ("fromVec.getData()" ) VectorDataLibrary fromDataLib ,
639+ @ CachedLibrary ("toVec.getData()" ) VectorDataLibrary toDataLib ,
640+ @ CachedLibrary ("byVec.getData()" ) VectorDataLibrary byDataLib ,
633641 @ Cached ("createBinaryProfile()" ) ConditionProfile directionProfile ) {
634- int by = byVec .getDataAt ( 0 );
635- int from = fromVec .getDataAt ( 0 );
636- int to = toVec .getDataAt ( 0 );
642+ int by = byDataLib . getIntAt ( byVec .getData (), 0 );
643+ int from = fromDataLib . getIntAt ( fromVec .getData (), 0 );
644+ int to = toDataLib . getIntAt ( toVec .getData (), 0 );
637645 RIntVector result ;
638646 if (directionProfile .profile (from < to )) {
639647 if (by < 0 ) {
@@ -975,16 +983,19 @@ protected RAbstractVector seqFallback(Object fromObj, Object toObj, Object byObj
975983
976984 // Guard methods
977985
978- public static boolean validDoubleParams (RDoubleVector from , RDoubleVector to ) {
979- return from .getLength () == 1 && to .getLength () == 1 && isFinite (from .getDataAt (0 )) && isFinite (to .getDataAt (0 ));
986+ public static boolean validDoubleParams (VectorDataLibrary fromDataLib , RDoubleVector from , VectorDataLibrary toDataLib , RDoubleVector to ) {
987+ Object fromData = from .getData ();
988+ Object toData = to .getData ();
989+ return fromDataLib .getLength (fromData ) == 1 && toDataLib .getLength (toData ) == 1 && isFinite (fromDataLib .getDoubleAt (fromData , 0 )) && isFinite (toDataLib .getDoubleAt (toData , 0 ));
980990 }
981991
982- public static boolean validIntParams (RIntVector from , RIntVector to ) {
983- return validIntParam (from ) && validIntParam (to );
992+ public static boolean validIntParams (VectorDataLibrary fromDataLib , RIntVector from , VectorDataLibrary toDataLib , RIntVector to ) {
993+ return validIntParam (fromDataLib , from ) && validIntParam (toDataLib , to );
984994 }
985995
986- public static boolean validIntParam (RIntVector vec ) {
987- return vec .getLength () == 1 && vec .getDataAt (0 ) != RRuntime .INT_NA ;
996+ public static boolean validIntParam (VectorDataLibrary dataLib , RIntVector vec ) {
997+ Object data = vec .getData ();
998+ return dataLib .getLength (data ) == 1 && dataLib .getIntAt (data , 0 ) != RRuntime .INT_NA ;
988999 }
9891000
9901001 public final int getLength (Object obj ) {
0 commit comments