From 98bff1f5cbea469ea8d234e091188dfd6f2b2fbe Mon Sep 17 00:00:00 2001
From: Florian Angerer <florian.angerer@oracle.com>
Date: Tue, 29 Aug 2017 07:42:43 +0200
Subject: [PATCH] Implemented native function 'Rf_copyMostAttrib'.

---
 .../ffi/impl/common/JavaUpCallsRFFIImpl.java  |   9 +-
 .../impl/common/TracingUpCallsRFFIImpl.java   |   6 +
 .../ffi/impl/nodes/AttributesAccessNodes.java | 105 +++++++++++++++++
 .../r/ffi/impl/nodes/FFIUpCallRootNode.java   |   1 +
 .../r/ffi/impl/upcalls/StdUpCallsRFFI.java    |   1 +
 .../fficall/src/common/rffi_upcalls.h         |   2 +-
 .../fficall/src/common/rffi_upcallsindex.h    | 109 +++++++++---------
 .../fficall/src/jni/Rinternals.c              |   6 +-
 .../Rinternals_truffle_common.h               |   2 +-
 .../attributes/CopyOfRegAttributesNode.java   |  25 ++--
 10 files changed, 194 insertions(+), 72 deletions(-)
 create mode 100644 com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java

diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java
index 2f363dea87..59edf0bdf8 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java
@@ -29,7 +29,6 @@ import static com.oracle.truffle.r.ffi.impl.common.RFFIUtils.unimplemented;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
-import java.rmi.RMISecurityException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
@@ -69,7 +68,6 @@ import com.oracle.truffle.r.runtime.conn.NativeConnections.NativeRConnection;
 import com.oracle.truffle.r.runtime.conn.RConnection;
 import com.oracle.truffle.r.runtime.context.Engine.ParseException;
 import com.oracle.truffle.r.runtime.context.RContext;
-import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
 import com.oracle.truffle.r.runtime.data.RAttributable;
 import com.oracle.truffle.r.runtime.data.RAttributesLayout;
 import com.oracle.truffle.r.runtime.data.RDataFactory;
@@ -83,7 +81,6 @@ import com.oracle.truffle.r.runtime.data.RIntVector;
 import com.oracle.truffle.r.runtime.data.RLanguage;
 import com.oracle.truffle.r.runtime.data.RList;
 import com.oracle.truffle.r.runtime.data.RLogicalVector;
-import com.oracle.truffle.r.runtime.data.RMissing;
 import com.oracle.truffle.r.runtime.data.RNull;
 import com.oracle.truffle.r.runtime.data.RPairList;
 import com.oracle.truffle.r.runtime.data.RPromise;
@@ -1597,4 +1594,10 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
         return FFIUpCallRootNode.getCallTarget(RFFIUpCallTable.Rf_namesgets).call(x, y);
     }
 
+    @Override
+    public int Rf_copyMostAttrib(Object x, Object y) {
+        FFIUpCallRootNode.getCallTarget(RFFIUpCallTable.Rf_copyMostAttrib).call(x, y);
+        return 0;
+    }
+
 }
diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/TracingUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/TracingUpCallsRFFIImpl.java
index 8b5fc1e7b7..3b49641693 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/TracingUpCallsRFFIImpl.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/TracingUpCallsRFFIImpl.java
@@ -878,4 +878,10 @@ final class TracingUpCallsRFFIImpl implements UpCallsRFFI {
         return delegate.Rf_namesgets(vec, val);
     }
 
+    @Override
+    public int Rf_copyMostAttrib(Object x, Object y) {
+        RFFIUtils.traceUpCall("Rf_copyMostAttrib", x, y);
+        return delegate.Rf_copyMostAttrib(x, y);
+    }
+
 }
diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java
new file mode 100644
index 0000000000..12afbe0f64
--- /dev/null
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java
@@ -0,0 +1,105 @@
+package com.oracle.truffle.r.ffi.impl.nodes;
+
+import com.oracle.truffle.api.CompilerDirectives;
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
+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.r.nodes.attributes.CopyOfRegAttributesNode;
+import com.oracle.truffle.r.nodes.attributes.GetAttributesNode;
+import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetNamesAttributeNode;
+import com.oracle.truffle.r.runtime.ArgumentsSignature;
+import com.oracle.truffle.r.runtime.RError;
+import com.oracle.truffle.r.runtime.RError.Message;
+import com.oracle.truffle.r.runtime.RInternalError;
+import com.oracle.truffle.r.runtime.RRuntime;
+import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
+import com.oracle.truffle.r.runtime.data.RAttributable;
+import com.oracle.truffle.r.runtime.data.RAttributeStorage;
+import com.oracle.truffle.r.runtime.data.RExternalPtr;
+import com.oracle.truffle.r.runtime.data.RList;
+import com.oracle.truffle.r.runtime.data.RNull;
+import com.oracle.truffle.r.runtime.data.RPairList;
+import com.oracle.truffle.r.runtime.data.RStringVector;
+
+public final class AttributesAccessNodes {
+
+    abstract static class ATTRIB extends FFIUpCallNode.Arg1 {
+        @Child private GetAttributesNode getAttributesNode = GetAttributesNode.create();
+
+        @Specialization
+        public Object doAttributable(RAttributable obj) {
+            return getAttributesNode.execute(obj);
+        }
+
+        @Fallback
+        public RNull doOthers(Object obj) {
+            if (obj == RNull.instance || RRuntime.isForeignObject(obj)) {
+                return RNull.instance;
+            } else {
+                CompilerDirectives.transferToInterpreter();
+                String type = obj == null ? "null" : obj.getClass().getSimpleName();
+                throw RError.error(RError.NO_CALLER, Message.GENERIC, "object of type '" + type + "' cannot be attributed");
+            }
+        }
+    }
+
+    abstract static class TAG extends FFIUpCallNode.Arg1 {
+
+        @Specialization
+        public Object doPairlist(RPairList obj) {
+            return obj.getTag();
+        }
+
+        @Specialization
+        public Object doArgs(RArgsValuesAndNames obj) {
+            ArgumentsSignature signature = obj.getSignature();
+            if (signature.getLength() > 0 && signature.getName(0) != null) {
+                return signature.getName(0);
+            }
+            return RNull.instance;
+        }
+
+        @Specialization
+        public Object doExternalPtr(RExternalPtr obj) {
+            return obj.getTag();
+        }
+
+        @Specialization
+        public Object doList(RList obj,
+                        @Cached("create()") GetNamesAttributeNode getNamesAttributeNode) {
+            RStringVector names = getNamesAttributeNode.getNames(obj);
+            if (names != null && names.getLength() > 0) {
+                return names.getDataAt(0);
+            }
+            return RNull.instance;
+        }
+
+        @Fallback
+        @TruffleBoundary
+        public RNull doOthers(Object obj) {
+            throw RInternalError.unimplemented("TAG is not implemented for type " + obj.getClass().getSimpleName());
+        }
+    }
+
+    abstract static class CopyMostAttrib extends FFIUpCallNode.Arg2 {
+
+        @Child protected CopyOfRegAttributesNode copyRegAttributes = CopyOfRegAttributesNode.create();
+
+        @Specialization
+        public Object doList(RAttributeStorage x, RAttributeStorage y) {
+// if (copyRegAttributes == null) {
+// CompilerDirectives.transferToInterpreterAndInvalidate();
+// copyRegAttributes = CopyOfRegAttributesNode.create();
+// }
+            copyRegAttributes.execute(x, y);
+            return null;
+        }
+
+        @Fallback
+        @SuppressWarnings("unused")
+        public Void doOthers(Object x, Object y) {
+            throw RInternalError.unimplemented("Rf_copyMostAttrib only works with atrributables.");
+        }
+    }
+}
diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallRootNode.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallRootNode.java
index 45836333d2..e8a06297ba 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallRootNode.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallRootNode.java
@@ -115,5 +115,6 @@ public final class FFIUpCallRootNode extends RootNode {
         FFIUpCallRootNode.add(RFFIUpCallTable.Rf_punif, () -> RandFunction3_2NodeGen.create(new Unif.PUnif()));
         FFIUpCallRootNode.add(RFFIUpCallTable.Rf_namesgets, MiscNodesFactory.NamesGetsNodeGen::create);
         FFIUpCallRootNode.add(RFFIUpCallTable.TAG, AttributesAccessNodesFactory.TAGNodeGen::create);
+        FFIUpCallRootNode.add(RFFIUpCallTable.Rf_copyMostAttrib, AttributesAccessNodesFactory.CopyMostAttribNodeGen::create);
     }
 }
diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java
index 76c10d6ac9..1dd634f978 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java
@@ -305,4 +305,5 @@ public interface StdUpCallsRFFI {
 
     Object Rf_namesgets(Object vec, Object val);
 
+    int Rf_copyMostAttrib(Object x, Object y);
 }
diff --git a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h
index 44b8bf7102..3452fe945c 100644
--- a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h
+++ b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h
@@ -58,7 +58,7 @@ typedef SEXP (*call_Rf_coerceVector)(SEXP x, SEXPTYPE mode);
 typedef R_xlen_t (*call_Rf_any_duplicated)(SEXP x, Rboolean from_last);
 typedef SEXP (*call_Rf_duplicated)(SEXP x, Rboolean y);
 typedef SEXP (*call_Rf_applyClosure)(SEXP x, SEXP y, SEXP z, SEXP a, SEXP b);
-typedef void (*call_Rf_copyMostAttrib)(SEXP x, SEXP y);
+typedef int (*call_Rf_copyMostAttrib)(SEXP x, SEXP y);
 typedef void (*call_Rf_copyVector)(SEXP x, SEXP y);
 typedef int (*call_Rf_countContexts)(int x, int y);
 typedef Rboolean (*call_Rf_inherits)(SEXP x, const char * klass);
diff --git a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h
index f17d3f1c19..23862841f7 100644
--- a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h
+++ b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h
@@ -91,60 +91,61 @@
 #define Rf_cons_x 86
 #define Rf_copyListMatrix_x 87
 #define Rf_copyMatrix_x 88
-#define Rf_defineVar_x 89
-#define Rf_dunif_x 90
-#define Rf_duplicate_x 91
-#define Rf_error_x 92
-#define Rf_errorcall_x 93
-#define Rf_eval_x 94
-#define Rf_findFun_x 95
-#define Rf_findVar_x 96
-#define Rf_findVarInFrame_x 97
-#define Rf_findVarInFrame3_x 98
-#define Rf_getAttrib_x 99
-#define Rf_gsetVar_x 100
-#define Rf_inherits_x 101
-#define Rf_install_x 102
-#define Rf_installChar_x 103
-#define Rf_isNull_x 104
-#define Rf_isString_x 105
-#define Rf_lengthgets_x 106
-#define Rf_mkCharLenCE_x 107
-#define Rf_namesgets_x 108
-#define Rf_ncols_x 109
-#define Rf_nrows_x 110
-#define Rf_punif_x 111
-#define Rf_qunif_x 112
-#define Rf_runif_x 113
-#define Rf_setAttrib_x 114
-#define Rf_str2type_x 115
-#define Rf_warning_x 116
-#define Rf_warningcall_x 117
-#define Rprintf_x 118
-#define SETCADR_x 119
-#define SETCAR_x 120
-#define SETCDR_x 121
-#define SET_NAMED_FASTR_x 122
-#define SET_RDEBUG_x 123
-#define SET_RSTEP_x 124
-#define SET_S4_OBJECT_x 125
-#define SET_STRING_ELT_x 126
-#define SET_SYMVALUE_x 127
-#define SET_TAG_x 128
-#define SET_TYPEOF_FASTR_x 129
-#define SET_VECTOR_ELT_x 130
-#define STRING_ELT_x 131
-#define SYMVALUE_x 132
-#define TAG_x 133
-#define TYPEOF_x 134
-#define UNSET_S4_OBJECT_x 135
-#define VECTOR_ELT_x 136
-#define getConnectionClassString_x 137
-#define getOpenModeString_x 138
-#define getSummaryDescription_x 139
-#define isSeekable_x 140
-#define unif_rand_x 141
+#define Rf_copyMostAttrib_x 89
+#define Rf_defineVar_x 90
+#define Rf_dunif_x 91
+#define Rf_duplicate_x 92
+#define Rf_error_x 93
+#define Rf_errorcall_x 94
+#define Rf_eval_x 95
+#define Rf_findFun_x 96
+#define Rf_findVar_x 97
+#define Rf_findVarInFrame_x 98
+#define Rf_findVarInFrame3_x 99
+#define Rf_getAttrib_x 100
+#define Rf_gsetVar_x 101
+#define Rf_inherits_x 102
+#define Rf_install_x 103
+#define Rf_installChar_x 104
+#define Rf_isNull_x 105
+#define Rf_isString_x 106
+#define Rf_lengthgets_x 107
+#define Rf_mkCharLenCE_x 108
+#define Rf_namesgets_x 109
+#define Rf_ncols_x 110
+#define Rf_nrows_x 111
+#define Rf_punif_x 112
+#define Rf_qunif_x 113
+#define Rf_runif_x 114
+#define Rf_setAttrib_x 115
+#define Rf_str2type_x 116
+#define Rf_warning_x 117
+#define Rf_warningcall_x 118
+#define Rprintf_x 119
+#define SETCADR_x 120
+#define SETCAR_x 121
+#define SETCDR_x 122
+#define SET_NAMED_FASTR_x 123
+#define SET_RDEBUG_x 124
+#define SET_RSTEP_x 125
+#define SET_S4_OBJECT_x 126
+#define SET_STRING_ELT_x 127
+#define SET_SYMVALUE_x 128
+#define SET_TAG_x 129
+#define SET_TYPEOF_FASTR_x 130
+#define SET_VECTOR_ELT_x 131
+#define STRING_ELT_x 132
+#define SYMVALUE_x 133
+#define TAG_x 134
+#define TYPEOF_x 135
+#define UNSET_S4_OBJECT_x 136
+#define VECTOR_ELT_x 137
+#define getConnectionClassString_x 138
+#define getOpenModeString_x 139
+#define getSummaryDescription_x 140
+#define isSeekable_x 141
+#define unif_rand_x 142
 
-#define UPCALLS_TABLE_SIZE 142
+#define UPCALLS_TABLE_SIZE 143
 
 #endif // RFFI_UPCALLSINDEX_H
diff --git a/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c b/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c
index 87605b88e8..2ee61ef405 100644
--- a/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c
+++ b/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c
@@ -147,6 +147,7 @@ static jmethodID Rf_copyMatrixMethodID;
 static jmethodID Rf_nrowsMethodID;
 static jmethodID Rf_ncolsMethodID;
 static jmethodID Rf_namesgetsMethodID;
+static jmethodID Rf_copyMostAttribMethodID;
 
 static jclass CharSXPWrapperClass;
 jclass JNIUpCallsRFFIImplClass;
@@ -265,6 +266,7 @@ void init_internals(JNIEnv *env) {
     Rf_nrowsMethodID = checkGetMethodID(env, UpCallsRFFIClass, "Rf_nrows", "(Ljava/lang/Object;)I", 0);
     Rf_ncolsMethodID = checkGetMethodID(env, UpCallsRFFIClass, "Rf_ncols", "(Ljava/lang/Object;)I", 0);
     Rf_namesgetsMethodID = checkGetMethodID(env, UpCallsRFFIClass, "Rf_namesgets", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", 0);
+    Rf_copyMostAttribMethodID = checkGetMethodID(env, UpCallsRFFIClass, "Rf_copyMostAttrib", "(Ljava/lang/Object;Ljava/lang/Object;)I", 0);
 
     // static JNI-specific methods
 	JNIUpCallsRFFIImplClass = checkFindClass(env, "com/oracle/truffle/r/ffi/impl/jni/JNIUpCallsRFFIImpl");
@@ -446,7 +448,9 @@ SEXP Rf_applyClosure(SEXP x, SEXP y, SEXP z, SEXP a, SEXP b) {
 }
 
 void Rf_copyMostAttrib(SEXP x, SEXP y) {
-	unimplemented("Rf_copyMostAttrib");
+	TRACE(TARGpp, x, y);
+	JNIEnv *thisenv = getEnv();
+    (*thisenv)->CallIntMethod(thisenv, UpCallsRFFIObject, Rf_copyMostAttribMethodID, x, y);
 }
 
 void Rf_copyVector(SEXP x, SEXP y) {
diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h
index 916a6d0a4b..1acc334cb5 100644
--- a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h
+++ b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h
@@ -311,7 +311,7 @@ SEXP Rf_applyClosure(SEXP x, SEXP y, SEXP z, SEXP a, SEXP b) {
 }
 
 void Rf_copyMostAttrib(SEXP x, SEXP y) {
-	unimplemented("Rf_copyMostAttrib");
+	((call_Rf_copyMostAttrib) callbacks[Rf_copyMostAttrib_x])(x, y);
 }
 
 void Rf_copyVector(SEXP x, SEXP y) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java
index 7118f008d8..ed4000857b 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java
@@ -30,9 +30,10 @@ import com.oracle.truffle.api.object.Property;
 import com.oracle.truffle.api.object.Shape;
 import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.RRuntime;
+import com.oracle.truffle.r.runtime.data.RAttributable;
+import com.oracle.truffle.r.runtime.data.RAttributeStorage;
 import com.oracle.truffle.r.runtime.data.RAttributesLayout;
 import com.oracle.truffle.r.runtime.data.RVector;
-import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 
 /**
@@ -52,60 +53,60 @@ public abstract class CopyOfRegAttributesNode extends RBaseNode {
     @Child private GetFixedAttributeNode namesAttrGetter = GetFixedAttributeNode.createNames();
     @Child private GetFixedAttributeNode classAttrGetter = GetFixedAttributeNode.createClass();
 
-    public abstract void execute(RAbstractVector source, RVector<?> target);
+    public abstract void execute(RAttributable source, RAttributable target);
 
     public static CopyOfRegAttributesNode create() {
         return CopyOfRegAttributesNodeGen.create();
     }
 
     @Specialization(guards = "source.getAttributes() == null")
-    protected void copyNoAttributes(@SuppressWarnings("unused") RAbstractVector source, @SuppressWarnings("unused") RVector<?> target) {
+    protected void copyNoAttributes(@SuppressWarnings("unused") RAttributeStorage source, @SuppressWarnings("unused") RAttributeStorage target) {
         // nothing to do
     }
 
-    protected static final boolean emptyAttributes(RAbstractVector source) {
+    protected static final boolean emptyAttributes(RAttributeStorage source) {
         DynamicObject attributes = source.getAttributes();
         return attributes == null || attributes.isEmpty();
     }
 
     @Specialization(guards = "emptyAttributes(source)", replaces = "copyNoAttributes")
-    protected void copyEmptyAttributes(@SuppressWarnings("unused") RAbstractVector source, @SuppressWarnings("unused") RVector<?> target) {
+    protected void copyEmptyAttributes(@SuppressWarnings("unused") RAttributeStorage source, @SuppressWarnings("unused") RAttributeStorage target) {
         // nothing to do
     }
 
-    protected final boolean onlyDimAttribute(RAbstractVector source) {
+    protected final boolean onlyDimAttribute(RAttributeStorage source) {
         DynamicObject attributes = source.getAttributes();
         return attributes != null && sizeOneProfile.profile(attributes.size() == 1) && dimAttrGetter.execute(attributes) != null;
     }
 
     @Specialization(guards = "onlyDimAttribute(source)")
-    protected void copyDimOnly(@SuppressWarnings("unused") RAbstractVector source, @SuppressWarnings("unused") RVector<?> target) {
+    protected void copyDimOnly(@SuppressWarnings("unused") RAttributeStorage source, @SuppressWarnings("unused") RAttributeStorage target) {
         // nothing to do
     }
 
-    protected final boolean onlyNamesAttribute(RAbstractVector source) {
+    protected final boolean onlyNamesAttribute(RAttributeStorage source) {
         DynamicObject attributes = source.getAttributes();
         return attributes != null && sizeOneProfile.profile(attributes.size() == 1) && namesAttrGetter.execute(attributes) != null;
     }
 
     @Specialization(guards = "onlyNamesAttribute(source)")
-    protected void copyNamesOnly(@SuppressWarnings("unused") RAbstractVector source, @SuppressWarnings("unused") RVector<?> target) {
+    protected void copyNamesOnly(@SuppressWarnings("unused") RAttributeStorage source, @SuppressWarnings("unused") RAttributeStorage target) {
         // nothing to do
     }
 
-    protected final boolean onlyClassAttribute(RAbstractVector source) {
+    protected final boolean onlyClassAttribute(RAttributeStorage source) {
         DynamicObject attributes = source.getAttributes();
         return attributes != null && sizeOneProfile.profile(attributes.size() == 1) && classAttrGetter.execute(attributes) != null;
     }
 
     @Specialization(guards = "onlyClassAttribute(source)")
-    protected void copyClassOnly(RAbstractVector source, RVector<?> target) {
+    protected void copyClassOnly(RAttributeStorage source, RVector<?> target) {
         Object classAttr = classAttrGetter.execute(source.getAttributes());
         target.initAttributes(RAttributesLayout.createClass(classAttr));
     }
 
     @Specialization
-    protected void copyGeneric(RAbstractVector source, RVector<?> target) {
+    protected void copyGeneric(RAttributeStorage source, RAttributeStorage target) {
         DynamicObject orgAttributes = source.getAttributes();
         if (orgAttributes != null) {
             Shape shape = orgAttributes.getShape();
-- 
GitLab