diff --git a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/CodeGenBase.java b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/CodeGenBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..143d2064da4298299655659bac905f30147779ee
--- /dev/null
+++ b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/CodeGenBase.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.truffle.r.ffi.codegen;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Optional;
+
+public abstract class CodeGenBase {
+    protected static final String COPYRIGHT = "/*\n" +
+                    " * Copyright (c) 2018, " + Calendar.getInstance().get(Calendar.YEAR) + ", Oracle and/or its affiliates. All rights reserved.\n" +
+                    " * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" +
+                    " *\n" +
+                    " * This code is free software; you can redistribute it and/or modify it\n" +
+                    " * under the terms of the GNU General Public License version 2 only, as\n" +
+                    " * published by the Free Software Foundation.\n" +
+                    " *\n" +
+                    " * This code is distributed in the hope that it will be useful, but WITHOUT\n" +
+                    " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" +
+                    " * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\n" +
+                    " * version 2 for more details (a copy is included in the LICENSE file that\n" +
+                    " * accompanied this code).\n" +
+                    " *\n" +
+                    " * You should have received a copy of the GNU General Public License version\n" +
+                    " * 2 along with this work; if not, write to the Free Software Foundation,\n" +
+                    " * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" +
+                    " *\n" +
+                    " * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" +
+                    " * or visit www.oracle.com if you need additional information or have any\n" +
+                    " * questions.\n" +
+                    " */\n";
+
+    protected PrintStream out;
+
+    protected void initOutput(String[] args) {
+        Optional<String> filename = Arrays.stream(args).filter(x -> !x.contains("-")).findFirst();
+        if (filename.isPresent()) {
+            try {
+                out = new PrintStream(new FileOutputStream(filename.get()));
+            } catch (FileNotFoundException e) {
+                System.err.printf("Cannot open file '%s' for writing.\n", filename.get());
+                System.exit(1);
+            }
+        } else {
+            out = System.out;
+        }
+    }
+}
diff --git a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFITestsCodeGen.java b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFITestsCodeGen.java
index c7186ca9b0249042e826e337638939259c995d18..b96c168f538357e4290e5d1f85f92b0bdf72c964 100644
--- a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFITestsCodeGen.java
+++ b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFITestsCodeGen.java
@@ -26,7 +26,6 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Parameter;
 import java.util.Arrays;
-import java.util.Calendar;
 import java.util.HashSet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -45,11 +44,16 @@ import com.oracle.truffle.r.ffi.processor.RFFICstring;
  * The generated code is to be used in testrffi package located in
  * "com.oracle.truffle.r.test.native/packages/testrffi/testrffi".
  */
-public class FFITestsCodeGen {
+public final class FFITestsCodeGen extends CodeGenBase {
     private static final String FUN_PREFIX = "api_";
     private static final HashSet<String> IGNORE_FUNS = new HashSet<>(Arrays.asList("Rf_duplicate", "SET_TYPEOF_FASTR", "R_ToplevelExec", "R_CleanUp", "R_ParseVector", "octsize", "R_NewHashedEnv"));
 
     public static void main(String[] args) {
+        new FFITestsCodeGen().run(args);
+    }
+
+    private void run(String[] args) {
+        this.initOutput(args);
         if (Arrays.stream(args).anyMatch(x -> "-init".equals(x))) {
             generateCInit();
         } else if (Arrays.stream(args).anyMatch(x -> "-h".equals(x))) {
@@ -61,58 +65,64 @@ public class FFITestsCodeGen {
         }
     }
 
-    private static void generateR() {
-        System.out.println("#############");
-        System.out.printf("# Code generated by %s class run with option '-r'\n", FFITestsCodeGen.class.getName());
-        System.out.println("# R wrappers for all the generated RFFI C wrappers\n");
+    private void generateR() {
+        out.println("#############");
+        out.printf("# Code generated by %s class run with option '-r'\n", FFITestsCodeGen.class.getName());
+        printMxHelp("#");
+        out.println("# R wrappers for all the generated RFFI C wrappers\n");
         getFFIMethods().forEach(method -> {
-            System.out.printf("api.%s <- function(...) .Call(C_api_%s, ...)\n", getName(method), getName(method));
+            out.printf("api.%s <- function(...) .Call(C_api_%s, ...)\n", getName(method), getName(method));
         });
     }
 
-    private static void generateCInit() {
-        System.out.printf("// Code generated by %s class run with option '-init'\n", FFITestsCodeGen.class.getName());
-        System.out.println("// The following code registers all C functions that wrap RFFI functions and convert SEXP <-> primitive types.");
-        System.out.println("// The definitions of the C functions could be generated by the same Java class (but run without any option)");
-        System.out.println("// RFFI functions that take/return C pointers are ignored");
+    private void generateCInit() {
+        out.println(COPYRIGHT);
+        out.printf("// Code generated by %s class run with option '-init'\n", FFITestsCodeGen.class.getName());
+        printMxHelp("//");
+        out.println("// The following code registers all C functions that wrap RFFI functions and convert SEXP <-> primitive types.");
+        out.println("// The definitions of the C functions could be generated by the same Java class (but run without any option)");
+        out.println("// RFFI functions that take/return C pointers are ignored");
+        out.println("// This code is '#included' into init.c ");
         getFFIMethods().forEach(method -> {
-            System.out.printf("CALLDEF(%s%s, %d),\n", FUN_PREFIX, getName(method), method.getParameterCount());
+            out.printf("CALLDEF(%s%s, %d),\n", FUN_PREFIX, getName(method), method.getParameterCount());
         });
-        System.out.println("// ---- end of generated code");
+        out.println("// ---- end of generated code");
     }
 
-    private static void generateH() {
-        System.out.println(COPYRIGHT);
-        System.out.printf("// Code generated by %s class run with option '-h'\n", FFITestsCodeGen.class.getName());
-        System.out.println("// See the corresponding C file for more details");
+    private void generateH() {
+        out.println(COPYRIGHT);
+        out.printf("// Code generated by %s class run with option '-h'\n", FFITestsCodeGen.class.getName());
+        printMxHelp("//");
+        out.println("// See the corresponding C file for more details");
         printIncludes();
         getFFIMethods().forEach(method -> {
-            System.out.println(getDeclaration(method) + ";\n");
+            out.println(getDeclaration(method) + ";\n");
         });
     }
 
-    private static void generateC() {
-        System.out.println(COPYRIGHT);
-        System.out.printf("// Code generated by %s class", FFITestsCodeGen.class.getName());
-        System.out.println("// The following code defines a 'SEXP' variant of every RFFI function implemented in FastR");
-        System.out.println("// Run the same Java class with '-init' option to get sequence of CALLDEF statements that register those functions for use from R");
-        System.out.println("// RFFI functions that take/return C pointers are ignored");
+    private void generateC() {
+        out.println(COPYRIGHT);
+        out.printf("// Code generated by %s class\n", FFITestsCodeGen.class.getName());
+        printMxHelp("//");
+        out.println("// The following code defines a 'SEXP' variant of every RFFI function implemented in FastR");
+        out.println("// Run the same Java class with '-init' option to get sequence of CALLDEF statements that register those functions for use from R");
+        out.println("// RFFI functions that take/return C pointers are ignored");
         printIncludes();
-        System.out.println("#include \"rffiwrappers.h\"\n");
-        System.out.println("#pragma GCC diagnostic push");
-        System.out.println("#pragma GCC diagnostic ignored \"-Wint-conversion\"\n");
-        System.out.println("#pragma GCC diagnostic ignored \"-Wincompatible-pointer-types\"\n");
+        out.println("#include \"rffiwrappers.h\"\n");
+        out.println("#pragma GCC diagnostic push");
+        out.println("#pragma GCC diagnostic ignored \"-Wint-conversion\"\n");
+        out.println("#pragma GCC diagnostic ignored \"-Wincompatible-pointer-types\"\n");
         getFFIMethods().forEach(method -> {
-            System.out.println(getDeclaration(method) + " {");
+            out.println(getDeclaration(method) + " {");
             String stmt = String.format("%s(%s)", getName(method), Arrays.stream(method.getParameters()).map(FFITestsCodeGen::toCValue).collect(Collectors.joining(", ")));
-            System.out.println("    " + getReturnStmt(method.getReturnType(), stmt) + ';');
+            out.println("    " + getReturnStmt(method.getReturnType(), stmt) + ';');
             if (method.getReturnType() == void.class) {
-                System.out.println("    return R_NilValue;");
+                out.println("    return R_NilValue;");
             }
-            System.out.println("}\n");
+            out.println("}\n");
         });
-        System.out.println("#pragma GCC diagnostic pop");
-        System.out.println("#pragma GCC diagnostic pop");
+        out.println("#pragma GCC diagnostic pop");
+        out.println("#pragma GCC diagnostic pop");
     }
 
     private static String getDeclaration(Method method) {
@@ -124,8 +134,8 @@ public class FFITestsCodeGen {
         return m.getName().replace("_FASTR", "").replace("FASTR_", "");
     }
 
-    private static void printIncludes() {
-        System.out.print("#define NO_FASTR_REDEFINE\n" +
+    private void printIncludes() {
+        out.print("#define NO_FASTR_REDEFINE\n" +
                         "#include <R.h>\n" +
                         "#include <Rdefines.h>\n" +
                         "#include <Rinterface.h>\n" +
@@ -178,30 +188,11 @@ public class FFITestsCodeGen {
         }
     }
 
+    private void printMxHelp(String prefix) {
+        out.println(prefix + " All the generated files in testrffi can be regenerated by running 'mx testrfficodegen'");
+    }
+
     private static boolean anyCPointer(Annotation[] items) {
         return Arrays.stream(items).anyMatch(a -> a.annotationType() == RFFICpointer.class);
     }
-
-    private static final String COPYRIGHT = "/*\n" +
-                    " * Copyright (c) 2018, YEAR, Oracle and/or its affiliates. All rights reserved.\n" +
-                    " * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" +
-                    " *\n" +
-                    " * This code is free software; you can redistribute it and/or modify it\n" +
-                    " * under the terms of the GNU General Public License version 2 only, as\n" +
-                    " * published by the Free Software Foundation.\n" +
-                    " *\n" +
-                    " * This code is distributed in the hope that it will be useful, but WITHOUT\n" +
-                    " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" +
-                    " * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\n" +
-                    " * version 2 for more details (a copy is included in the LICENSE file that\n" +
-                    " * accompanied this code).\n" +
-                    " *\n" +
-                    " * You should have received a copy of the GNU General Public License version\n" +
-                    " * 2 along with this work; if not, write to the Free Software Foundation,\n" +
-                    " * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" +
-                    " *\n" +
-                    " * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" +
-                    " * or visit www.oracle.com if you need additional information or have any\n" +
-                    " * questions.\n" +
-                    " */\n".replace("YEAR", "" + Calendar.getInstance().get(Calendar.YEAR));
 }
diff --git a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java
new file mode 100644
index 0000000000000000000000000000000000000000..6dd2cd8601eb9515440b0161c8e81047a06379d0
--- /dev/null
+++ b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.truffle.r.ffi.codegen;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import com.oracle.truffle.r.ffi.impl.upcalls.UpCallsRFFI;
+
+/**
+ * Generates code for the {@code rffi_upcallsindex.h} file, which defines a numeric constant for
+ * each method of {@link FFIUpCallsIndexCodeGen}. Those constants are used to map C to Java
+ * functions.
+ */
+public final class FFIUpCallsIndexCodeGen extends CodeGenBase {
+    public static void main(String[] args) {
+        new FFIUpCallsIndexCodeGen().run(args);
+    }
+
+    private void run(String[] args) {
+        initOutput(args);
+        out.printf("// GENERATED by %s class; DO NOT EDIT\n", FFIUpCallsIndexCodeGen.class.getName());
+        out.println("// This file can be regenerated by running 'mx rfficodegen'");
+        out.append("#ifndef RFFI_UPCALLSINDEX_H\n");
+        out.append("#define RFFI_UPCALLSINDEX_H\n");
+        out.append('\n');
+        Method[] methods = UpCallsRFFI.class.getMethods();
+        Arrays.sort(methods, new Comparator<Method>() {
+            @Override
+            public int compare(Method e1, Method e2) {
+                return e1.getName().toString().compareTo(e2.getName().toString());
+            }
+        });
+        for (int i = 0; i < methods.length; i++) {
+            Method method = methods[i];
+            out.append("#define ").append(method.getName()).append("_x ").append(Integer.toString(i)).append('\n');
+        }
+        out.append('\n');
+        out.append("#define ").append("UPCALLS_TABLE_SIZE ").append(Integer.toString(methods.length)).append('\n');
+        out.append('\n');
+        out.append("#endif // RFFI_UPCALLSINDEX_H\n");
+    }
+}
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 5c4f604aa5853122bbf3d7bc854efbebbe02b2de..071912314d8917df3734d2e043ee173d3c0ba41f 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
@@ -524,6 +524,11 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
         list.setElement((int) i, v);
     }
 
+    @Override
+    public void SET_ATTRIB(Object target, Object attributes) {
+        throw implementedAsNode();
+    }
+
     @Override
     public Object STRING_ELT(Object x, long i) {
         RAbstractStringVector vector = guaranteeInstanceOf(RRuntime.asAbstractVector(x), RAbstractStringVector.class);
@@ -550,6 +555,11 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
         }
     }
 
+    @Override
+    public void SET_OBJECT(Object x, int flag) {
+        throw implementedAsNode();
+    }
+
     @Override
     public void SET_NAMED_FASTR(Object x, int v) {
         // Note: In GNUR this is a macro that sets the sxpinfo.named regardless of whether it makes
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
index a6d0515c5166861b7f7047f7142942b638e96445..272b93ca537ee356b208279ffb1957407812f559 100644
--- 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
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.ffi.impl.nodes;
 
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.singleElement;
 import static com.oracle.truffle.r.nodes.builtin.casts.fluent.CastNodeBuilder.newCastBuilder;
+import static com.oracle.truffle.r.runtime.RError.NO_CALLER;
 
 import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
@@ -33,10 +34,12 @@ import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodesFactory.ATTRIBNodeGen;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodesFactory.CopyMostAttribNodeGen;
+import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodesFactory.SetAttribNodeGen;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodesFactory.TAGNodeGen;
 import com.oracle.truffle.r.nodes.attributes.CopyOfRegAttributesNode;
 import com.oracle.truffle.r.nodes.attributes.GetAttributeNode;
 import com.oracle.truffle.r.nodes.attributes.GetAttributesNode;
+import com.oracle.truffle.r.nodes.attributes.SetAttributeNode;
 import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetNamesAttributeNode;
 import com.oracle.truffle.r.nodes.function.opt.UpdateShareableChildValueNode;
 import com.oracle.truffle.r.nodes.unary.CastNode;
@@ -45,14 +48,18 @@ 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.Utils;
 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.RAttributesLayout;
 import com.oracle.truffle.r.runtime.data.RDataFactory;
 import com.oracle.truffle.r.runtime.data.RExternalPtr;
+import com.oracle.truffle.r.runtime.data.RLanguage;
 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.RSharingAttributeStorage;
 import com.oracle.truffle.r.runtime.data.RStringVector;
 import com.oracle.truffle.r.runtime.data.RSymbol;
 
@@ -94,7 +101,21 @@ public final class AttributesAccessNodes {
                 CompilerDirectives.transferToInterpreterAndInvalidate();
                 getAttributesNode = GetAttributesNode.create();
             }
-            return getAttributesNode.execute(obj);
+            Object resultObj = getAttributesNode.execute(obj);
+            if (resultObj == RNull.instance) {
+                return resultObj;
+            }
+            assert resultObj instanceof RList : "GetAttributesNode should return RList or RNull";
+            RList list = (RList) resultObj;
+            Object result = RNull.instance;
+            RStringVector names = list.getNames();
+            assert names.getLength() == list.getLength();
+            for (int i = list.getLength() - 1; i >= 0; i--) {
+                Object item = list.getDataAt(i);
+                RSymbol symbol = RDataFactory.createSymbol(names.getDataAt(i));
+                result = RDataFactory.createPairList(item, result, symbol);
+            }
+            return result;
         }
 
         @Fallback
@@ -104,7 +125,7 @@ public final class AttributesAccessNodes {
             } 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");
+                throw RError.error(NO_CALLER, Message.GENERIC, "object of type '" + type + "' cannot be attributed");
             }
         }
 
@@ -186,4 +207,50 @@ public final class AttributesAccessNodes {
             return CopyMostAttribNodeGen.create();
         }
     }
+
+    public abstract static class SetAttribNode extends FFIUpCallNode.Arg2 {
+
+        public static SetAttribNode create() {
+            return SetAttribNodeGen.create();
+        }
+
+        @Specialization
+        protected Object doLanguage(RSharingAttributeStorage target, RLanguage attributes,
+                        @Cached("create()") SetAttributeNode setAttribNode) {
+            return doIt(target, getPairList(attributes), setAttribNode);
+        }
+
+        @Specialization
+        protected Object doIt(RSharingAttributeStorage target, RPairList attributes,
+                        @Cached("create()") SetAttributeNode setAttribNode) {
+            clearAttrs(target);
+            for (RPairList attr : attributes) {
+                Object tag = attr.getTag();
+                if (!(tag instanceof RSymbol)) {
+                    CompilerDirectives.transferToInterpreter();
+                    // GNUR seems to set the attr name to NULL and fails when printing
+                    // To be compatible we don't fail, but at least print warning...
+                    RError.warning(NO_CALLER, Message.GENERIC, String.format("SET_ATTRIB: tag in the attributes pairlist must be a symbol. %s given.", Utils.getTypeName(tag)));
+                    continue;
+                }
+                setAttribNode.execute(target, ((RSymbol) tag).getName(), attr.car());
+            }
+            return RNull.instance;
+        }
+
+        @Fallback
+        protected Object doOthers(Object target, Object attrs) {
+            throw unsupportedTypes("SET_ATTRIB", target, attrs);
+        }
+
+        @TruffleBoundary
+        private static void clearAttrs(RSharingAttributeStorage target) {
+            target.initAttributes(RAttributesLayout.createRAttributes());
+        }
+
+        @TruffleBoundary
+        private static RPairList getPairList(RLanguage attributes) {
+            return attributes.getPairList();
+        }
+    }
 }
diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java
index f1e3036783898b9ad48b5e7ac6421db16af3fa00..d33dce24251486421bac34e98ff080935c1f10e0 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java
@@ -63,6 +63,9 @@ public final class ListAccessNodes {
 
         @Specialization
         protected Object car(RArgsValuesAndNames args) {
+            if (args.isEmpty()) {
+                return RNull.instance;
+            }
             return args.getArgument(0);
         }
 
diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java
index c7259e65589b01a8b4b0b5d128386b69e8c5b6e2..3349fe9d242285e2de6f4838d0029f07f170db79 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java
@@ -41,12 +41,14 @@ import com.oracle.truffle.r.ffi.impl.nodes.MiscNodesFactory.RHasSlotNodeGen;
 import com.oracle.truffle.r.ffi.impl.nodes.MiscNodesFactory.SetFunctionBodyNodeGen;
 import com.oracle.truffle.r.ffi.impl.nodes.MiscNodesFactory.SetFunctionEnvironmentNodeGen;
 import com.oracle.truffle.r.ffi.impl.nodes.MiscNodesFactory.SetFunctionFormalsNodeGen;
+import com.oracle.truffle.r.ffi.impl.nodes.MiscNodesFactory.SetObjectNodeGen;
 import com.oracle.truffle.r.nodes.RASTUtils;
 import com.oracle.truffle.r.nodes.access.AccessSlotNode;
 import com.oracle.truffle.r.nodes.access.AccessSlotNodeGen;
 import com.oracle.truffle.r.nodes.access.HasSlotNode;
 import com.oracle.truffle.r.nodes.access.UpdateSlotNode;
 import com.oracle.truffle.r.nodes.access.UpdateSlotNodeGen;
+import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetClassAttributeNode;
 import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetNamesAttributeNode;
 import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctionsFactory.SetNamesAttributeNodeGen;
 import com.oracle.truffle.r.nodes.builtin.EnvironmentNodes.GetFunctionEnvironmentNode;
@@ -57,13 +59,17 @@ import com.oracle.truffle.r.nodes.objects.NewObjectNodeGen;
 import com.oracle.truffle.r.nodes.unary.CastNode;
 import com.oracle.truffle.r.nodes.unary.SizeToOctalRawNode;
 import com.oracle.truffle.r.runtime.RError;
+import com.oracle.truffle.r.runtime.RError.Message;
 import com.oracle.truffle.r.runtime.context.RContext;
 import com.oracle.truffle.r.runtime.data.CharSXPWrapper;
 import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
 import com.oracle.truffle.r.runtime.data.RFunction;
 import com.oracle.truffle.r.runtime.data.RNull;
 import com.oracle.truffle.r.runtime.data.RRawVector;
+import com.oracle.truffle.r.runtime.data.RSharingAttributeStorage;
+import com.oracle.truffle.r.runtime.data.RStringVector;
 import com.oracle.truffle.r.runtime.data.RSymbol;
+import com.oracle.truffle.r.runtime.data.RTypedValue;
 import com.oracle.truffle.r.runtime.data.RTypes;
 import com.oracle.truffle.r.runtime.data.model.RAbstractContainer;
 import com.oracle.truffle.r.runtime.env.REnvironment;
@@ -369,4 +375,45 @@ public final class MiscNodes {
             return RNull.instance;
         }
     }
+
+    public abstract static class SetObjectNode extends FFIUpCallNode.Arg2 {
+        public static SetObjectNode create() {
+            return SetObjectNodeGen.create();
+        }
+
+        @Child private GetClassAttributeNode getClassAttributeNode;
+
+        @Specialization
+        protected Object doIt(RTypedValue target, int flag) {
+            // Note: "OBJECT" is an internal flag in SEXP that internal dispatching (in FastR
+            // INTERNAL_DISPATCH builtins) is checking first before even checking the attributes
+            // collection for presence of the "class" attribute. FastR always checks attributes and
+            // ignores the OBJECT flag. The only possible difference is hence if someone sets
+            // OBJECT flag to 0 for a SEXP that actually has some class, in which case in GNUR the
+            // internal dispatch builtins like 'as.character' will not dispatch to the S3 method
+            // even thought the object has S3 class and FastR would dispatch.
+            // See simpleTests.R in testrffi package for example.
+            if (flag == 0 && target instanceof RSharingAttributeStorage) {
+                RStringVector clazz = getClass((RSharingAttributeStorage) target);
+                if (clazz != null && clazz.getLength() != 0) {
+                    CompilerDirectives.transferToInterpreter();
+                    throw RError.error(RError.NO_CALLER, Message.GENERIC, String.format("SET_OBJECT(SEXP, 0) not implemented for SEXP with 'class' attribute"));
+                }
+            }
+            return RNull.instance;
+        }
+
+        @Specialization
+        protected Object doOthers(Object value, Object flag) {
+            throw unsupportedTypes("SET_OBJECT", value, flag);
+        }
+
+        private RStringVector getClass(RSharingAttributeStorage value) {
+            if (getClassAttributeNode == null) {
+                CompilerDirectives.transferToInterpreterAndInvalidate();
+                getClassAttributeNode = insert(GetClassAttributeNode.create());
+            }
+            return getClassAttributeNode.getClassAttr(value);
+        }
+    }
 }
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 0e2b98f28185a2fb91be7bf31b10b7d9aab836c0..e9bbeb09d1c1dce2218199897ece6acd1f77f8a7 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
@@ -29,6 +29,7 @@ import com.oracle.truffle.r.ffi.impl.nodes.AsRealNode;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodes.ATTRIB;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodes.CopyMostAttrib;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodes.GetAttrib;
+import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodes.SetAttribNode;
 import com.oracle.truffle.r.ffi.impl.nodes.AttributesAccessNodes.TAG;
 import com.oracle.truffle.r.ffi.impl.nodes.CoerceNodes.CoerceVectorNode;
 import com.oracle.truffle.r.ffi.impl.nodes.CoerceNodes.VectorToPairListNode;
@@ -57,6 +58,7 @@ import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.SETCARNode;
 import com.oracle.truffle.r.ffi.impl.nodes.MatchNodes;
 import com.oracle.truffle.r.ffi.impl.nodes.MiscNodes;
 import com.oracle.truffle.r.ffi.impl.nodes.MiscNodes.LENGTHNode;
+import com.oracle.truffle.r.ffi.impl.nodes.MiscNodes.SetObjectNode;
 import com.oracle.truffle.r.ffi.impl.nodes.NewCustomConnectionNode;
 import com.oracle.truffle.r.ffi.impl.nodes.RMakeExternalPtrNode;
 import com.oracle.truffle.r.ffi.impl.nodes.RandFunctionsNodes;
@@ -242,6 +244,9 @@ public interface StdUpCallsRFFI {
 
     void SET_VECTOR_ELT(Object x, long i, Object v);
 
+    @RFFIUpCallNode(SetAttribNode.class)
+    void SET_ATTRIB(Object target, Object attributes);
+
     @RFFICpointer
     Object RAW(Object x);
 
@@ -263,6 +268,9 @@ public interface StdUpCallsRFFI {
 
     int NAMED(Object x);
 
+    @RFFIUpCallNode(SetObjectNode.class)
+    void SET_OBJECT(Object x, int flag);
+
     void SET_NAMED_FASTR(Object x, int v);
 
     Object SET_TYPEOF_FASTR(Object x, int v);
diff --git a/com.oracle.truffle.r.ffi.processor/src/com/oracle/truffle/r/ffi/processor/FFIProcessor.java b/com.oracle.truffle.r.ffi.processor/src/com/oracle/truffle/r/ffi/processor/FFIProcessor.java
index d287d9866015a0f8784e0eea73d9026fb8b9f315..1b525d3378ffbce8aae1e59f64483ca509f86a82 100644
--- a/com.oracle.truffle.r.ffi.processor/src/com/oracle/truffle/r/ffi/processor/FFIProcessor.java
+++ b/com.oracle.truffle.r.ffi.processor/src/com/oracle/truffle/r/ffi/processor/FFIProcessor.java
@@ -47,9 +47,7 @@ import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.Types;
 import javax.tools.Diagnostic;
 import javax.tools.Diagnostic.Kind;
-import javax.tools.FileObject;
 import javax.tools.JavaFileObject;
-import javax.tools.StandardLocation;
 
 public final class FFIProcessor extends AbstractProcessor {
 
@@ -117,7 +115,7 @@ public final class FFIProcessor extends AbstractProcessor {
         generateTable(methods);
         generateMessageClasses(methods);
         generateCallbacks(methods);
-        generateCallbacksIndexHeader(methods);
+        note("If you edited any UpCallsRFFI interfaces do: 'mx rfficodegen'.\n");
     }
 
     private void generateTable(ExecutableElement[] methods) throws IOException {
@@ -139,25 +137,6 @@ public final class FFIProcessor extends AbstractProcessor {
         w.close();
     }
 
-    private void generateCallbacksIndexHeader(ExecutableElement[] methods) throws IOException {
-        FileObject fileObj = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "com.oracle.truffle.r.ffi.impl.upcalls", "rffi_upcallsindex.h");
-        note("If you edited any UpCallsRFFI interfaces do: cp " + fileObj.toUri().getPath() + " com.oracle.truffle.r.native/fficall/src/common\n");
-        Writer w = fileObj.openWriter();
-        w.append("// GENERATED by com.oracle.truffle.r.ffi.processor.FFIProcessor class; DO NOT EDIT\n");
-        w.append("#ifndef RFFI_UPCALLSINDEX_H\n");
-        w.append("#define RFFI_UPCALLSINDEX_H\n");
-        w.append('\n');
-        for (int i = 0; i < methods.length; i++) {
-            ExecutableElement method = methods[i];
-            w.append("#define ").append(method.getSimpleName().toString()).append("_x ").append(Integer.toString(i)).append('\n');
-        }
-        w.append('\n');
-        w.append("#define ").append("UPCALLS_TABLE_SIZE ").append(Integer.toString(methods.length)).append('\n');
-        w.append('\n');
-        w.append("#endif // RFFI_UPCALLSINDEX_H\n");
-        w.close();
-    }
-
     private void generateMessageClasses(ExecutableElement[] methods) throws IOException {
         for (int i = 0; i < methods.length; i++) {
             ExecutableElement m = methods[i];
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 3174c03b89b32912c789b1baae99409bc1432862..28b3d41c7bd2e56a88e9affddb86e9781905b421 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
@@ -1,4 +1,5 @@
-// GENERATED by com.oracle.truffle.r.ffi.processor.FFIProcessor class; DO NOT EDIT
+// GENERATED by com.oracle.truffle.r.ffi.codegen.FFIUpCallsIndexCodeGen class; DO NOT EDIT
+// This file can be regenerated by running 'mx rfficodegen'
 #ifndef RFFI_UPCALLSINDEX_H
 #define RFFI_UPCALLSINDEX_H
 
@@ -249,39 +250,41 @@
 #define SETCADR_x 244
 #define SETCAR_x 245
 #define SETCDR_x 246
-#define SET_BODY_x 247
-#define SET_CLOENV_x 248
-#define SET_FORMALS_x 249
-#define SET_NAMED_FASTR_x 250
-#define SET_RDEBUG_x 251
-#define SET_RSTEP_x 252
-#define SET_S4_OBJECT_x 253
-#define SET_STRING_ELT_x 254
-#define SET_SYMVALUE_x 255
-#define SET_TAG_x 256
-#define SET_TYPEOF_FASTR_x 257
-#define SET_VECTOR_ELT_x 258
-#define STRING_ELT_x 259
-#define SYMVALUE_x 260
-#define TAG_x 261
-#define TYPEOF_x 262
-#define UNSET_S4_OBJECT_x 263
-#define VECTOR_ELT_x 264
-#define forceSymbols_x 265
-#define getCCallable_x 266
-#define getConnectionClassString_x 267
-#define getEmbeddingDLLInfo_x 268
-#define getOpenModeString_x 269
-#define getSummaryDescription_x 270
-#define isSeekable_x 271
-#define octsize_x 272
-#define registerCCallable_x 273
-#define registerRoutines_x 274
-#define restoreHandlerStacks_x 275
-#define setDotSymbolValues_x 276
-#define unif_rand_x 277
-#define useDynamicSymbols_x 278
+#define SET_ATTRIB_x 247
+#define SET_BODY_x 248
+#define SET_CLOENV_x 249
+#define SET_FORMALS_x 250
+#define SET_NAMED_FASTR_x 251
+#define SET_OBJECT_x 252
+#define SET_RDEBUG_x 253
+#define SET_RSTEP_x 254
+#define SET_S4_OBJECT_x 255
+#define SET_STRING_ELT_x 256
+#define SET_SYMVALUE_x 257
+#define SET_TAG_x 258
+#define SET_TYPEOF_FASTR_x 259
+#define SET_VECTOR_ELT_x 260
+#define STRING_ELT_x 261
+#define SYMVALUE_x 262
+#define TAG_x 263
+#define TYPEOF_x 264
+#define UNSET_S4_OBJECT_x 265
+#define VECTOR_ELT_x 266
+#define forceSymbols_x 267
+#define getCCallable_x 268
+#define getConnectionClassString_x 269
+#define getEmbeddingDLLInfo_x 270
+#define getOpenModeString_x 271
+#define getSummaryDescription_x 272
+#define isSeekable_x 273
+#define octsize_x 274
+#define registerCCallable_x 275
+#define registerRoutines_x 276
+#define restoreHandlerStacks_x 277
+#define setDotSymbolValues_x 278
+#define unif_rand_x 279
+#define useDynamicSymbols_x 280
 
-#define UPCALLS_TABLE_SIZE 279
+#define UPCALLS_TABLE_SIZE 281
 
 #endif // RFFI_UPCALLSINDEX_H
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 70f1a481e0de407c10a7b6e7ac313b55a8569fee..c1e44d5c68a2208a070b400e6a0ab110b3017c3f 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
@@ -1218,11 +1218,12 @@ int REFCNT(SEXP x) {
 
 void SET_OBJECT(SEXP x, int v) {
     TRACE0();
-    unimplemented("SET_OBJECT");
+    ((call_SET_OBJECT) callbacks[SET_OBJECT_x])(x, v);
 }
 
 void SET_TYPEOF(SEXP x, int v) {
     TRACE0();
+    // TODO: we will be able to implement this for RLanguage <-> RPairList once they are unified in one Java class
     unimplemented("SET_TYPEOF");
 }
 
@@ -1241,7 +1242,7 @@ void SET_NAMED(SEXP x, int v) {
 
 void SET_ATTRIB(SEXP x, SEXP v) {
     TRACE0();
-    unimplemented("SET_ATTRIB");
+    ((call_SET_ATTRIB) callbacks[SET_ATTRIB_x])(x, v);
 }
 
 void DUPLICATE_ATTRIB(SEXP to, SEXP from) {
@@ -1253,6 +1254,7 @@ void DUPLICATE_ATTRIB(SEXP to, SEXP from) {
 R_len_t R_BadLongVector(SEXP x, const char *y, int z) {
     TRACE0();
     unimplemented("R_BadLongVector");
+    exit(1);
     // "no return" function
 }
 
diff --git a/com.oracle.truffle.r.native/version.source b/com.oracle.truffle.r.native/version.source
index 8c61d23e125b800e69cb950b09e23c06f728fff9..04f9fe46068b397a6fc24d647b7e3ec4315c15e7 100644
--- a/com.oracle.truffle.r.native/version.source
+++ b/com.oracle.truffle.r.native/version.source
@@ -1 +1 @@
-58
+59
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqFunctions.java
index c3fd500728362be44f4d04c20f8236cf97118da7..e5afc0e1e3757a5d375f03d76f7ac1e2bfd173fd 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqFunctions.java
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1995, 1998  Robert Gentleman and Ross Ihaka
  * Copyright (c) 1998-2015,  The R Core Team
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates
  *
  * All rights reserved.
  */
@@ -354,7 +354,8 @@ public final class SeqFunctions {
         @Child private ClassHierarchyNode classHierarchyNode = ClassHierarchyNode.create();
 
         static {
-            Casts.noCasts(SeqAlong.class);
+            Casts casts = new Casts(SeqAlong.class);
+            casts.arg(0).mustNotBeMissing(Message.ARGUMENTS_PASSED, 0, "'seq_along'", 1);
         }
 
         @Specialization(guards = "!hasClass(value)")
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributesLayout.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributesLayout.java
index 6245346502eefc5ea5f4f06ac514c3bfb18b58f1..dfc779e6fd3a5b31e8e97dd7b44b4354356f93e8 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributesLayout.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributesLayout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,13 +74,6 @@ public final class RAttributesLayout {
         return EMPTY_ATTRS_LAYOUT.factory.newInstance();
     }
 
-    public static DynamicObject createRAttributes(String[] names, Object[] values) {
-        assert names != null && values != null && names.length == values.length;
-
-        AttrsLayout attrsLayout = new AttrsLayout(names);
-        return attrsLayout.factory.newInstance(values);
-    }
-
     public static DynamicObject createClass(Object cls) {
         return CLASS_ATTRS_LAYOUT.factory.newInstance(cls);
     }
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/api.R b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/api.R
new file mode 100644
index 0000000000000000000000000000000000000000..433e496efc9b16392eed16ca689b4115271b0140
--- /dev/null
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/api.R
@@ -0,0 +1,231 @@
+#############
+# Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class run with option '-r'
+# All the generated files in testrffi can be regenerated by running 'mx testrfficodegen'
+# R wrappers for all the generated RFFI C wrappers
+
+api.Rf_ScalarReal <- function(...) .Call(C_api_Rf_ScalarReal, ...)
+api.Rf_ScalarString <- function(...) .Call(C_api_Rf_ScalarString, ...)
+api.Rf_ScalarLogical <- function(...) .Call(C_api_Rf_ScalarLogical, ...)
+api.Rf_ScalarInteger <- function(...) .Call(C_api_Rf_ScalarInteger, ...)
+api.Rf_asInteger <- function(...) .Call(C_api_Rf_asInteger, ...)
+api.Rf_asReal <- function(...) .Call(C_api_Rf_asReal, ...)
+api.Rf_asLogical <- function(...) .Call(C_api_Rf_asLogical, ...)
+api.Rf_asChar <- function(...) .Call(C_api_Rf_asChar, ...)
+api.Rf_coerceVector <- function(...) .Call(C_api_Rf_coerceVector, ...)
+api.Rf_mkCharLenCE <- function(...) .Call(C_api_Rf_mkCharLenCE, ...)
+api.Rf_cons <- function(...) .Call(C_api_Rf_cons, ...)
+api.Rf_defineVar <- function(...) .Call(C_api_Rf_defineVar, ...)
+api.R_getClassDef <- function(...) .Call(C_api_R_getClassDef, ...)
+api.R_do_MAKE_CLASS <- function(...) .Call(C_api_R_do_MAKE_CLASS, ...)
+api.R_do_new_object <- function(...) .Call(C_api_R_do_new_object, ...)
+api.Rf_findVar <- function(...) .Call(C_api_Rf_findVar, ...)
+api.Rf_findVarInFrame <- function(...) .Call(C_api_Rf_findVarInFrame, ...)
+api.Rf_findVarInFrame3 <- function(...) .Call(C_api_Rf_findVarInFrame3, ...)
+api.ATTRIB <- function(...) .Call(C_api_ATTRIB, ...)
+api.Rf_getAttrib <- function(...) .Call(C_api_Rf_getAttrib, ...)
+api.Rf_setAttrib <- function(...) .Call(C_api_Rf_setAttrib, ...)
+api.Rf_inherits <- function(...) .Call(C_api_Rf_inherits, ...)
+api.Rf_install <- function(...) .Call(C_api_Rf_install, ...)
+api.Rf_installChar <- function(...) .Call(C_api_Rf_installChar, ...)
+api.Rf_lengthgets <- function(...) .Call(C_api_Rf_lengthgets, ...)
+api.Rf_isString <- function(...) .Call(C_api_Rf_isString, ...)
+api.Rf_isNull <- function(...) .Call(C_api_Rf_isNull, ...)
+api.Rf_PairToVectorList <- function(...) .Call(C_api_Rf_PairToVectorList, ...)
+api.Rf_error <- function(...) .Call(C_api_Rf_error, ...)
+api.Rf_warning <- function(...) .Call(C_api_Rf_warning, ...)
+api.Rf_warningcall <- function(...) .Call(C_api_Rf_warningcall, ...)
+api.Rf_errorcall <- function(...) .Call(C_api_Rf_errorcall, ...)
+api.Rf_allocVector <- function(...) .Call(C_api_Rf_allocVector, ...)
+api.Rf_allocArray <- function(...) .Call(C_api_Rf_allocArray, ...)
+api.Rf_allocMatrix <- function(...) .Call(C_api_Rf_allocMatrix, ...)
+api.Rf_nrows <- function(...) .Call(C_api_Rf_nrows, ...)
+api.Rf_ncols <- function(...) .Call(C_api_Rf_ncols, ...)
+api.LENGTH <- function(...) .Call(C_api_LENGTH, ...)
+api.SET_STRING_ELT <- function(...) .Call(C_api_SET_STRING_ELT, ...)
+api.SET_VECTOR_ELT <- function(...) .Call(C_api_SET_VECTOR_ELT, ...)
+api.SET_ATTRIB <- function(...) .Call(C_api_SET_ATTRIB, ...)
+api.STRING_ELT <- function(...) .Call(C_api_STRING_ELT, ...)
+api.VECTOR_ELT <- function(...) .Call(C_api_VECTOR_ELT, ...)
+api.NAMED <- function(...) .Call(C_api_NAMED, ...)
+api.SET_OBJECT <- function(...) .Call(C_api_SET_OBJECT, ...)
+api.SET_NAMED <- function(...) .Call(C_api_SET_NAMED, ...)
+api.TYPEOF <- function(...) .Call(C_api_TYPEOF, ...)
+api.Rf_any_duplicated <- function(...) .Call(C_api_Rf_any_duplicated, ...)
+api.Rf_any_duplicated3 <- function(...) .Call(C_api_Rf_any_duplicated3, ...)
+api.PRINTNAME <- function(...) .Call(C_api_PRINTNAME, ...)
+api.TAG <- function(...) .Call(C_api_TAG, ...)
+api.CAR <- function(...) .Call(C_api_CAR, ...)
+api.CAAR <- function(...) .Call(C_api_CAAR, ...)
+api.CDR <- function(...) .Call(C_api_CDR, ...)
+api.CDAR <- function(...) .Call(C_api_CDAR, ...)
+api.CADR <- function(...) .Call(C_api_CADR, ...)
+api.CADDR <- function(...) .Call(C_api_CADDR, ...)
+api.CADDDR <- function(...) .Call(C_api_CADDDR, ...)
+api.CAD4R <- function(...) .Call(C_api_CAD4R, ...)
+api.CDDR <- function(...) .Call(C_api_CDDR, ...)
+api.CDDDR <- function(...) .Call(C_api_CDDDR, ...)
+api.SET_TAG <- function(...) .Call(C_api_SET_TAG, ...)
+api.SETCAR <- function(...) .Call(C_api_SETCAR, ...)
+api.SETCDR <- function(...) .Call(C_api_SETCDR, ...)
+api.FORMALS <- function(...) .Call(C_api_FORMALS, ...)
+api.BODY <- function(...) .Call(C_api_BODY, ...)
+api.CLOENV <- function(...) .Call(C_api_CLOENV, ...)
+api.SET_FORMALS <- function(...) .Call(C_api_SET_FORMALS, ...)
+api.SET_BODY <- function(...) .Call(C_api_SET_BODY, ...)
+api.SET_CLOENV <- function(...) .Call(C_api_SET_CLOENV, ...)
+api.SETCADR <- function(...) .Call(C_api_SETCADR, ...)
+api.SETCADDR <- function(...) .Call(C_api_SETCADDR, ...)
+api.SETCADDDR <- function(...) .Call(C_api_SETCADDDR, ...)
+api.SETCAD4R <- function(...) .Call(C_api_SETCAD4R, ...)
+api.SYMVALUE <- function(...) .Call(C_api_SYMVALUE, ...)
+api.SET_SYMVALUE <- function(...) .Call(C_api_SET_SYMVALUE, ...)
+api.R_BindingIsLocked <- function(...) .Call(C_api_R_BindingIsLocked, ...)
+api.R_LockBinding <- function(...) .Call(C_api_R_LockBinding, ...)
+api.R_unLockBinding <- function(...) .Call(C_api_R_unLockBinding, ...)
+api.R_FindNamespace <- function(...) .Call(C_api_R_FindNamespace, ...)
+api.Rf_eval <- function(...) .Call(C_api_Rf_eval, ...)
+api.Rf_findFun <- function(...) .Call(C_api_Rf_findFun, ...)
+api.Rf_GetOption1 <- function(...) .Call(C_api_Rf_GetOption1, ...)
+api.Rf_gsetVar <- function(...) .Call(C_api_Rf_gsetVar, ...)
+api.DUPLICATE_ATTRIB <- function(...) .Call(C_api_DUPLICATE_ATTRIB, ...)
+api.R_compute_identical <- function(...) .Call(C_api_R_compute_identical, ...)
+api.Rf_copyListMatrix <- function(...) .Call(C_api_Rf_copyListMatrix, ...)
+api.Rf_copyMatrix <- function(...) .Call(C_api_Rf_copyMatrix, ...)
+api.RDEBUG <- function(...) .Call(C_api_RDEBUG, ...)
+api.SET_RDEBUG <- function(...) .Call(C_api_SET_RDEBUG, ...)
+api.RSTEP <- function(...) .Call(C_api_RSTEP, ...)
+api.SET_RSTEP <- function(...) .Call(C_api_SET_RSTEP, ...)
+api.ENCLOS <- function(...) .Call(C_api_ENCLOS, ...)
+api.PRVALUE <- function(...) .Call(C_api_PRVALUE, ...)
+api.R_lsInternal3 <- function(...) .Call(C_api_R_lsInternal3, ...)
+api.R_HomeDir <- function(...) .Call(C_api_R_HomeDir, ...)
+api.IS_S4_OBJECT <- function(...) .Call(C_api_IS_S4_OBJECT, ...)
+api.SET_S4_OBJECT <- function(...) .Call(C_api_SET_S4_OBJECT, ...)
+api.UNSET_S4_OBJECT <- function(...) .Call(C_api_UNSET_S4_OBJECT, ...)
+api.Rprintf <- function(...) .Call(C_api_Rprintf, ...)
+api.GetRNGstate <- function(...) .Call(C_api_GetRNGstate, ...)
+api.PutRNGstate <- function(...) .Call(C_api_PutRNGstate, ...)
+api.unif_rand <- function(...) .Call(C_api_unif_rand, ...)
+api.Rf_classgets <- function(...) .Call(C_api_Rf_classgets, ...)
+api.R_ExternalPtrAddr <- function(...) .Call(C_api_R_ExternalPtrAddr, ...)
+api.R_ExternalPtrTag <- function(...) .Call(C_api_R_ExternalPtrTag, ...)
+api.R_ExternalPtrProtected <- function(...) .Call(C_api_R_ExternalPtrProtected, ...)
+api.R_SetExternalPtrAddr <- function(...) .Call(C_api_R_SetExternalPtrAddr, ...)
+api.R_SetExternalPtrTag <- function(...) .Call(C_api_R_SetExternalPtrTag, ...)
+api.R_SetExternalPtrProtected <- function(...) .Call(C_api_R_SetExternalPtrProtected, ...)
+api.PRSEEN <- function(...) .Call(C_api_PRSEEN, ...)
+api.PRENV <- function(...) .Call(C_api_PRENV, ...)
+api.R_PromiseExpr <- function(...) .Call(C_api_R_PromiseExpr, ...)
+api.PRCODE <- function(...) .Call(C_api_PRCODE, ...)
+api.R_new_custom_connection <- function(...) .Call(C_api_R_new_custom_connection, ...)
+api.R_ReadConnection <- function(...) .Call(C_api_R_ReadConnection, ...)
+api.R_WriteConnection <- function(...) .Call(C_api_R_WriteConnection, ...)
+api.R_GetConnection <- function(...) .Call(C_api_R_GetConnection, ...)
+api.R_do_slot <- function(...) .Call(C_api_R_do_slot, ...)
+api.R_do_slot_assign <- function(...) .Call(C_api_R_do_slot_assign, ...)
+api.Rf_str2type <- function(...) .Call(C_api_Rf_str2type, ...)
+api.Rf_dunif <- function(...) .Call(C_api_Rf_dunif, ...)
+api.Rf_qunif <- function(...) .Call(C_api_Rf_qunif, ...)
+api.Rf_punif <- function(...) .Call(C_api_Rf_punif, ...)
+api.Rf_runif <- function(...) .Call(C_api_Rf_runif, ...)
+api.Rf_dchisq <- function(...) .Call(C_api_Rf_dchisq, ...)
+api.Rf_pchisq <- function(...) .Call(C_api_Rf_pchisq, ...)
+api.Rf_qchisq <- function(...) .Call(C_api_Rf_qchisq, ...)
+api.Rf_rchisq <- function(...) .Call(C_api_Rf_rchisq, ...)
+api.Rf_dnchisq <- function(...) .Call(C_api_Rf_dnchisq, ...)
+api.Rf_pnchisq <- function(...) .Call(C_api_Rf_pnchisq, ...)
+api.Rf_qnchisq <- function(...) .Call(C_api_Rf_qnchisq, ...)
+api.Rf_rnchisq <- function(...) .Call(C_api_Rf_rnchisq, ...)
+api.Rf_dnorm4 <- function(...) .Call(C_api_Rf_dnorm4, ...)
+api.Rf_pnorm5 <- function(...) .Call(C_api_Rf_pnorm5, ...)
+api.Rf_qnorm5 <- function(...) .Call(C_api_Rf_qnorm5, ...)
+api.Rf_rnorm <- function(...) .Call(C_api_Rf_rnorm, ...)
+api.Rf_dlnorm <- function(...) .Call(C_api_Rf_dlnorm, ...)
+api.Rf_plnorm <- function(...) .Call(C_api_Rf_plnorm, ...)
+api.Rf_qlnorm <- function(...) .Call(C_api_Rf_qlnorm, ...)
+api.Rf_rlnorm <- function(...) .Call(C_api_Rf_rlnorm, ...)
+api.Rf_dgamma <- function(...) .Call(C_api_Rf_dgamma, ...)
+api.Rf_pgamma <- function(...) .Call(C_api_Rf_pgamma, ...)
+api.Rf_qgamma <- function(...) .Call(C_api_Rf_qgamma, ...)
+api.Rf_rgamma <- function(...) .Call(C_api_Rf_rgamma, ...)
+api.Rf_dbeta <- function(...) .Call(C_api_Rf_dbeta, ...)
+api.Rf_pbeta <- function(...) .Call(C_api_Rf_pbeta, ...)
+api.Rf_qbeta <- function(...) .Call(C_api_Rf_qbeta, ...)
+api.Rf_rbeta <- function(...) .Call(C_api_Rf_rbeta, ...)
+api.Rf_df <- function(...) .Call(C_api_Rf_df, ...)
+api.Rf_pf <- function(...) .Call(C_api_Rf_pf, ...)
+api.Rf_qf <- function(...) .Call(C_api_Rf_qf, ...)
+api.Rf_rf <- function(...) .Call(C_api_Rf_rf, ...)
+api.Rf_dt <- function(...) .Call(C_api_Rf_dt, ...)
+api.Rf_pt <- function(...) .Call(C_api_Rf_pt, ...)
+api.Rf_qt <- function(...) .Call(C_api_Rf_qt, ...)
+api.Rf_rt <- function(...) .Call(C_api_Rf_rt, ...)
+api.Rf_dbinom <- function(...) .Call(C_api_Rf_dbinom, ...)
+api.Rf_pbinom <- function(...) .Call(C_api_Rf_pbinom, ...)
+api.Rf_qbinom <- function(...) .Call(C_api_Rf_qbinom, ...)
+api.Rf_rbinom <- function(...) .Call(C_api_Rf_rbinom, ...)
+api.Rf_dcauchy <- function(...) .Call(C_api_Rf_dcauchy, ...)
+api.Rf_pcauchy <- function(...) .Call(C_api_Rf_pcauchy, ...)
+api.Rf_qcauchy <- function(...) .Call(C_api_Rf_qcauchy, ...)
+api.Rf_rcauchy <- function(...) .Call(C_api_Rf_rcauchy, ...)
+api.Rf_dexp <- function(...) .Call(C_api_Rf_dexp, ...)
+api.Rf_pexp <- function(...) .Call(C_api_Rf_pexp, ...)
+api.Rf_qexp <- function(...) .Call(C_api_Rf_qexp, ...)
+api.Rf_rexp <- function(...) .Call(C_api_Rf_rexp, ...)
+api.Rf_dgeom <- function(...) .Call(C_api_Rf_dgeom, ...)
+api.Rf_pgeom <- function(...) .Call(C_api_Rf_pgeom, ...)
+api.Rf_qgeom <- function(...) .Call(C_api_Rf_qgeom, ...)
+api.Rf_rgeom <- function(...) .Call(C_api_Rf_rgeom, ...)
+api.Rf_dhyper <- function(...) .Call(C_api_Rf_dhyper, ...)
+api.Rf_phyper <- function(...) .Call(C_api_Rf_phyper, ...)
+api.Rf_qhyper <- function(...) .Call(C_api_Rf_qhyper, ...)
+api.Rf_rhyper <- function(...) .Call(C_api_Rf_rhyper, ...)
+api.Rf_dnbinom <- function(...) .Call(C_api_Rf_dnbinom, ...)
+api.Rf_pnbinom <- function(...) .Call(C_api_Rf_pnbinom, ...)
+api.Rf_qnbinom <- function(...) .Call(C_api_Rf_qnbinom, ...)
+api.Rf_rnbinom <- function(...) .Call(C_api_Rf_rnbinom, ...)
+api.Rf_dnbinom_mu <- function(...) .Call(C_api_Rf_dnbinom_mu, ...)
+api.Rf_pnbinom_mu <- function(...) .Call(C_api_Rf_pnbinom_mu, ...)
+api.Rf_qnbinom_mu <- function(...) .Call(C_api_Rf_qnbinom_mu, ...)
+api.Rf_rnbinom_mu <- function(...) .Call(C_api_Rf_rnbinom_mu, ...)
+api.Rf_dpois <- function(...) .Call(C_api_Rf_dpois, ...)
+api.Rf_ppois <- function(...) .Call(C_api_Rf_ppois, ...)
+api.Rf_qpois <- function(...) .Call(C_api_Rf_qpois, ...)
+api.Rf_rpois <- function(...) .Call(C_api_Rf_rpois, ...)
+api.Rf_dweibull <- function(...) .Call(C_api_Rf_dweibull, ...)
+api.Rf_pweibull <- function(...) .Call(C_api_Rf_pweibull, ...)
+api.Rf_qweibull <- function(...) .Call(C_api_Rf_qweibull, ...)
+api.Rf_rweibull <- function(...) .Call(C_api_Rf_rweibull, ...)
+api.Rf_dlogis <- function(...) .Call(C_api_Rf_dlogis, ...)
+api.Rf_plogis <- function(...) .Call(C_api_Rf_plogis, ...)
+api.Rf_qlogis <- function(...) .Call(C_api_Rf_qlogis, ...)
+api.Rf_rlogis <- function(...) .Call(C_api_Rf_rlogis, ...)
+api.Rf_dnbeta <- function(...) .Call(C_api_Rf_dnbeta, ...)
+api.Rf_pnbeta <- function(...) .Call(C_api_Rf_pnbeta, ...)
+api.Rf_qnbeta <- function(...) .Call(C_api_Rf_qnbeta, ...)
+api.Rf_dnf <- function(...) .Call(C_api_Rf_dnf, ...)
+api.Rf_pnf <- function(...) .Call(C_api_Rf_pnf, ...)
+api.Rf_qnf <- function(...) .Call(C_api_Rf_qnf, ...)
+api.Rf_dnt <- function(...) .Call(C_api_Rf_dnt, ...)
+api.Rf_pnt <- function(...) .Call(C_api_Rf_pnt, ...)
+api.Rf_qnt <- function(...) .Call(C_api_Rf_qnt, ...)
+api.Rf_ptukey <- function(...) .Call(C_api_Rf_ptukey, ...)
+api.Rf_qtukey <- function(...) .Call(C_api_Rf_qtukey, ...)
+api.Rf_dwilcox <- function(...) .Call(C_api_Rf_dwilcox, ...)
+api.Rf_pwilcox <- function(...) .Call(C_api_Rf_pwilcox, ...)
+api.Rf_qwilcox <- function(...) .Call(C_api_Rf_qwilcox, ...)
+api.Rf_rwilcox <- function(...) .Call(C_api_Rf_rwilcox, ...)
+api.Rf_dsignrank <- function(...) .Call(C_api_Rf_dsignrank, ...)
+api.Rf_psignrank <- function(...) .Call(C_api_Rf_psignrank, ...)
+api.Rf_qsignrank <- function(...) .Call(C_api_Rf_qsignrank, ...)
+api.Rf_rsignrank <- function(...) .Call(C_api_Rf_rsignrank, ...)
+api.Rf_ftrunc <- function(...) .Call(C_api_Rf_ftrunc, ...)
+api.Rf_namesgets <- function(...) .Call(C_api_Rf_namesgets, ...)
+api.Rf_copyMostAttrib <- function(...) .Call(C_api_Rf_copyMostAttrib, ...)
+api.Rf_VectorToPairList <- function(...) .Call(C_api_Rf_VectorToPairList, ...)
+api.Rf_asCharacterFactor <- function(...) .Call(C_api_Rf_asCharacterFactor, ...)
+api.Rf_match <- function(...) .Call(C_api_Rf_match, ...)
+api.Rf_NonNullStringMatch <- function(...) .Call(C_api_Rf_NonNullStringMatch, ...)
+api.R_has_slot <- function(...) .Call(C_api_R_has_slot, ...)
+api.Rf_PrintValue <- function(...) .Call(C_api_Rf_PrintValue, ...)
+api.OBJECT <- function(...) .Call(C_api_OBJECT, ...)
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/testrffi.R b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/testrffi.R
index 4f186c345d8a19aae3ad5495713b5a192195fd99..54ea96bf5f5a82e7093176791cf6ca7e3a22ae1b 100644
--- a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/testrffi.R
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/testrffi.R
@@ -224,232 +224,3 @@ rffi.RfRMultinom <- function() {
 rffi.RfFunctions <- function() {
 	.Call('test_RfFunctions')
 }
-
-#############
-# Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class run with option '-r'
-# R wrappers for all the generated RFFI C wrappers
-
-api.Rf_ScalarInteger <- function(...) .Call(C_api_Rf_ScalarInteger, ...)
-api.Rf_ScalarLogical <- function(...) .Call(C_api_Rf_ScalarLogical, ...)
-api.Rf_ScalarString <- function(...) .Call(C_api_Rf_ScalarString, ...)
-api.Rf_asInteger <- function(...) .Call(C_api_Rf_asInteger, ...)
-api.Rf_asReal <- function(...) .Call(C_api_Rf_asReal, ...)
-api.Rf_asLogical <- function(...) .Call(C_api_Rf_asLogical, ...)
-api.Rf_ScalarReal <- function(...) .Call(C_api_Rf_ScalarReal, ...)
-api.Rf_asChar <- function(...) .Call(C_api_Rf_asChar, ...)
-api.Rf_coerceVector <- function(...) .Call(C_api_Rf_coerceVector, ...)
-api.Rf_mkCharLenCE <- function(...) .Call(C_api_Rf_mkCharLenCE, ...)
-api.Rf_cons <- function(...) .Call(C_api_Rf_cons, ...)
-api.Rf_defineVar <- function(...) .Call(C_api_Rf_defineVar, ...)
-api.R_getClassDef <- function(...) .Call(C_api_R_getClassDef, ...)
-api.R_do_MAKE_CLASS <- function(...) .Call(C_api_R_do_MAKE_CLASS, ...)
-api.R_do_new_object <- function(...) .Call(C_api_R_do_new_object, ...)
-api.Rf_findVar <- function(...) .Call(C_api_Rf_findVar, ...)
-api.Rf_findVarInFrame <- function(...) .Call(C_api_Rf_findVarInFrame, ...)
-api.Rf_findVarInFrame3 <- function(...) .Call(C_api_Rf_findVarInFrame3, ...)
-api.ATTRIB <- function(...) .Call(C_api_ATTRIB, ...)
-api.Rf_getAttrib <- function(...) .Call(C_api_Rf_getAttrib, ...)
-api.Rf_setAttrib <- function(...) .Call(C_api_Rf_setAttrib, ...)
-api.Rf_inherits <- function(...) .Call(C_api_Rf_inherits, ...)
-api.Rf_install <- function(...) .Call(C_api_Rf_install, ...)
-api.Rf_installChar <- function(...) .Call(C_api_Rf_installChar, ...)
-api.Rf_lengthgets <- function(...) .Call(C_api_Rf_lengthgets, ...)
-api.Rf_isString <- function(...) .Call(C_api_Rf_isString, ...)
-api.Rf_isNull <- function(...) .Call(C_api_Rf_isNull, ...)
-api.Rf_PairToVectorList <- function(...) .Call(C_api_Rf_PairToVectorList, ...)
-api.Rf_error <- function(...) .Call(C_api_Rf_error, ...)
-api.Rf_warning <- function(...) .Call(C_api_Rf_warning, ...)
-api.Rf_warningcall <- function(...) .Call(C_api_Rf_warningcall, ...)
-api.Rf_errorcall <- function(...) .Call(C_api_Rf_errorcall, ...)
-api.Rf_allocVector <- function(...) .Call(C_api_Rf_allocVector, ...)
-api.Rf_allocArray <- function(...) .Call(C_api_Rf_allocArray, ...)
-api.Rf_allocMatrix <- function(...) .Call(C_api_Rf_allocMatrix, ...)
-api.Rf_nrows <- function(...) .Call(C_api_Rf_nrows, ...)
-api.Rf_ncols <- function(...) .Call(C_api_Rf_ncols, ...)
-api.LENGTH <- function(...) .Call(C_api_LENGTH, ...)
-api.SET_STRING_ELT <- function(...) .Call(C_api_SET_STRING_ELT, ...)
-api.SET_VECTOR_ELT <- function(...) .Call(C_api_SET_VECTOR_ELT, ...)
-api.STRING_ELT <- function(...) .Call(C_api_STRING_ELT, ...)
-api.VECTOR_ELT <- function(...) .Call(C_api_VECTOR_ELT, ...)
-api.NAMED <- function(...) .Call(C_api_NAMED, ...)
-api.SET_NAMED <- function(...) .Call(C_api_SET_NAMED, ...)
-api.TYPEOF <- function(...) .Call(C_api_TYPEOF, ...)
-api.Rf_any_duplicated <- function(...) .Call(C_api_Rf_any_duplicated, ...)
-api.Rf_any_duplicated3 <- function(...) .Call(C_api_Rf_any_duplicated3, ...)
-api.PRINTNAME <- function(...) .Call(C_api_PRINTNAME, ...)
-api.TAG <- function(...) .Call(C_api_TAG, ...)
-api.CAR <- function(...) .Call(C_api_CAR, ...)
-api.CAAR <- function(...) .Call(C_api_CAAR, ...)
-api.CDR <- function(...) .Call(C_api_CDR, ...)
-api.CDAR <- function(...) .Call(C_api_CDAR, ...)
-api.CADR <- function(...) .Call(C_api_CADR, ...)
-api.CADDR <- function(...) .Call(C_api_CADDR, ...)
-api.CADDDR <- function(...) .Call(C_api_CADDDR, ...)
-api.CAD4R <- function(...) .Call(C_api_CAD4R, ...)
-api.CDDR <- function(...) .Call(C_api_CDDR, ...)
-api.CDDDR <- function(...) .Call(C_api_CDDDR, ...)
-api.SET_TAG <- function(...) .Call(C_api_SET_TAG, ...)
-api.SETCAR <- function(...) .Call(C_api_SETCAR, ...)
-api.SETCDR <- function(...) .Call(C_api_SETCDR, ...)
-api.FORMALS <- function(...) .Call(C_api_FORMALS, ...)
-api.BODY <- function(...) .Call(C_api_BODY, ...)
-api.CLOENV <- function(...) .Call(C_api_CLOENV, ...)
-api.SET_FORMALS <- function(...) .Call(C_api_SET_FORMALS, ...)
-api.SET_BODY <- function(...) .Call(C_api_SET_BODY, ...)
-api.SET_CLOENV <- function(...) .Call(C_api_SET_CLOENV, ...)
-api.SETCADR <- function(...) .Call(C_api_SETCADR, ...)
-api.SETCADDR <- function(...) .Call(C_api_SETCADDR, ...)
-api.SETCADDDR <- function(...) .Call(C_api_SETCADDDR, ...)
-api.SETCAD4R <- function(...) .Call(C_api_SETCAD4R, ...)
-api.SYMVALUE <- function(...) .Call(C_api_SYMVALUE, ...)
-api.SET_SYMVALUE <- function(...) .Call(C_api_SET_SYMVALUE, ...)
-api.R_BindingIsLocked <- function(...) .Call(C_api_R_BindingIsLocked, ...)
-api.R_LockBinding <- function(...) .Call(C_api_R_LockBinding, ...)
-api.R_unLockBinding <- function(...) .Call(C_api_R_unLockBinding, ...)
-api.R_FindNamespace <- function(...) .Call(C_api_R_FindNamespace, ...)
-api.Rf_eval <- function(...) .Call(C_api_Rf_eval, ...)
-api.Rf_findFun <- function(...) .Call(C_api_Rf_findFun, ...)
-api.Rf_GetOption1 <- function(...) .Call(C_api_Rf_GetOption1, ...)
-api.Rf_gsetVar <- function(...) .Call(C_api_Rf_gsetVar, ...)
-api.DUPLICATE_ATTRIB <- function(...) .Call(C_api_DUPLICATE_ATTRIB, ...)
-api.R_compute_identical <- function(...) .Call(C_api_R_compute_identical, ...)
-api.Rf_copyListMatrix <- function(...) .Call(C_api_Rf_copyListMatrix, ...)
-api.Rf_copyMatrix <- function(...) .Call(C_api_Rf_copyMatrix, ...)
-api.RDEBUG <- function(...) .Call(C_api_RDEBUG, ...)
-api.SET_RDEBUG <- function(...) .Call(C_api_SET_RDEBUG, ...)
-api.RSTEP <- function(...) .Call(C_api_RSTEP, ...)
-api.SET_RSTEP <- function(...) .Call(C_api_SET_RSTEP, ...)
-api.ENCLOS <- function(...) .Call(C_api_ENCLOS, ...)
-api.PRVALUE <- function(...) .Call(C_api_PRVALUE, ...)
-api.R_lsInternal3 <- function(...) .Call(C_api_R_lsInternal3, ...)
-api.R_HomeDir <- function(...) .Call(C_api_R_HomeDir, ...)
-api.IS_S4_OBJECT <- function(...) .Call(C_api_IS_S4_OBJECT, ...)
-api.SET_S4_OBJECT <- function(...) .Call(C_api_SET_S4_OBJECT, ...)
-api.UNSET_S4_OBJECT <- function(...) .Call(C_api_UNSET_S4_OBJECT, ...)
-api.Rprintf <- function(...) .Call(C_api_Rprintf, ...)
-api.GetRNGstate <- function(...) .Call(C_api_GetRNGstate, ...)
-api.PutRNGstate <- function(...) .Call(C_api_PutRNGstate, ...)
-api.unif_rand <- function(...) .Call(C_api_unif_rand, ...)
-api.Rf_classgets <- function(...) .Call(C_api_Rf_classgets, ...)
-api.R_ExternalPtrAddr <- function(...) .Call(C_api_R_ExternalPtrAddr, ...)
-api.R_ExternalPtrTag <- function(...) .Call(C_api_R_ExternalPtrTag, ...)
-api.R_ExternalPtrProtected <- function(...) .Call(C_api_R_ExternalPtrProtected, ...)
-api.R_SetExternalPtrAddr <- function(...) .Call(C_api_R_SetExternalPtrAddr, ...)
-api.R_SetExternalPtrTag <- function(...) .Call(C_api_R_SetExternalPtrTag, ...)
-api.R_SetExternalPtrProtected <- function(...) .Call(C_api_R_SetExternalPtrProtected, ...)
-api.PRSEEN <- function(...) .Call(C_api_PRSEEN, ...)
-api.PRENV <- function(...) .Call(C_api_PRENV, ...)
-api.R_PromiseExpr <- function(...) .Call(C_api_R_PromiseExpr, ...)
-api.PRCODE <- function(...) .Call(C_api_PRCODE, ...)
-api.R_new_custom_connection <- function(...) .Call(C_api_R_new_custom_connection, ...)
-api.R_ReadConnection <- function(...) .Call(C_api_R_ReadConnection, ...)
-api.R_WriteConnection <- function(...) .Call(C_api_R_WriteConnection, ...)
-api.R_GetConnection <- function(...) .Call(C_api_R_GetConnection, ...)
-api.R_do_slot <- function(...) .Call(C_api_R_do_slot, ...)
-api.R_do_slot_assign <- function(...) .Call(C_api_R_do_slot_assign, ...)
-api.Rf_str2type <- function(...) .Call(C_api_Rf_str2type, ...)
-api.Rf_dunif <- function(...) .Call(C_api_Rf_dunif, ...)
-api.Rf_qunif <- function(...) .Call(C_api_Rf_qunif, ...)
-api.Rf_punif <- function(...) .Call(C_api_Rf_punif, ...)
-api.Rf_runif <- function(...) .Call(C_api_Rf_runif, ...)
-api.Rf_dchisq <- function(...) .Call(C_api_Rf_dchisq, ...)
-api.Rf_pchisq <- function(...) .Call(C_api_Rf_pchisq, ...)
-api.Rf_qchisq <- function(...) .Call(C_api_Rf_qchisq, ...)
-api.Rf_rchisq <- function(...) .Call(C_api_Rf_rchisq, ...)
-api.Rf_dnchisq <- function(...) .Call(C_api_Rf_dnchisq, ...)
-api.Rf_pnchisq <- function(...) .Call(C_api_Rf_pnchisq, ...)
-api.Rf_qnchisq <- function(...) .Call(C_api_Rf_qnchisq, ...)
-api.Rf_rnchisq <- function(...) .Call(C_api_Rf_rnchisq, ...)
-api.Rf_dnorm4 <- function(...) .Call(C_api_Rf_dnorm4, ...)
-api.Rf_pnorm5 <- function(...) .Call(C_api_Rf_pnorm5, ...)
-api.Rf_qnorm5 <- function(...) .Call(C_api_Rf_qnorm5, ...)
-api.Rf_rnorm <- function(...) .Call(C_api_Rf_rnorm, ...)
-api.Rf_dlnorm <- function(...) .Call(C_api_Rf_dlnorm, ...)
-api.Rf_plnorm <- function(...) .Call(C_api_Rf_plnorm, ...)
-api.Rf_qlnorm <- function(...) .Call(C_api_Rf_qlnorm, ...)
-api.Rf_rlnorm <- function(...) .Call(C_api_Rf_rlnorm, ...)
-api.Rf_dgamma <- function(...) .Call(C_api_Rf_dgamma, ...)
-api.Rf_pgamma <- function(...) .Call(C_api_Rf_pgamma, ...)
-api.Rf_qgamma <- function(...) .Call(C_api_Rf_qgamma, ...)
-api.Rf_rgamma <- function(...) .Call(C_api_Rf_rgamma, ...)
-api.Rf_dbeta <- function(...) .Call(C_api_Rf_dbeta, ...)
-api.Rf_pbeta <- function(...) .Call(C_api_Rf_pbeta, ...)
-api.Rf_qbeta <- function(...) .Call(C_api_Rf_qbeta, ...)
-api.Rf_rbeta <- function(...) .Call(C_api_Rf_rbeta, ...)
-api.Rf_df <- function(...) .Call(C_api_Rf_df, ...)
-api.Rf_pf <- function(...) .Call(C_api_Rf_pf, ...)
-api.Rf_qf <- function(...) .Call(C_api_Rf_qf, ...)
-api.Rf_rf <- function(...) .Call(C_api_Rf_rf, ...)
-api.Rf_dt <- function(...) .Call(C_api_Rf_dt, ...)
-api.Rf_pt <- function(...) .Call(C_api_Rf_pt, ...)
-api.Rf_qt <- function(...) .Call(C_api_Rf_qt, ...)
-api.Rf_rt <- function(...) .Call(C_api_Rf_rt, ...)
-api.Rf_dbinom <- function(...) .Call(C_api_Rf_dbinom, ...)
-api.Rf_pbinom <- function(...) .Call(C_api_Rf_pbinom, ...)
-api.Rf_qbinom <- function(...) .Call(C_api_Rf_qbinom, ...)
-api.Rf_rbinom <- function(...) .Call(C_api_Rf_rbinom, ...)
-api.Rf_dcauchy <- function(...) .Call(C_api_Rf_dcauchy, ...)
-api.Rf_pcauchy <- function(...) .Call(C_api_Rf_pcauchy, ...)
-api.Rf_qcauchy <- function(...) .Call(C_api_Rf_qcauchy, ...)
-api.Rf_rcauchy <- function(...) .Call(C_api_Rf_rcauchy, ...)
-api.Rf_dexp <- function(...) .Call(C_api_Rf_dexp, ...)
-api.Rf_pexp <- function(...) .Call(C_api_Rf_pexp, ...)
-api.Rf_qexp <- function(...) .Call(C_api_Rf_qexp, ...)
-api.Rf_rexp <- function(...) .Call(C_api_Rf_rexp, ...)
-api.Rf_dgeom <- function(...) .Call(C_api_Rf_dgeom, ...)
-api.Rf_pgeom <- function(...) .Call(C_api_Rf_pgeom, ...)
-api.Rf_qgeom <- function(...) .Call(C_api_Rf_qgeom, ...)
-api.Rf_rgeom <- function(...) .Call(C_api_Rf_rgeom, ...)
-api.Rf_dhyper <- function(...) .Call(C_api_Rf_dhyper, ...)
-api.Rf_phyper <- function(...) .Call(C_api_Rf_phyper, ...)
-api.Rf_qhyper <- function(...) .Call(C_api_Rf_qhyper, ...)
-api.Rf_rhyper <- function(...) .Call(C_api_Rf_rhyper, ...)
-api.Rf_dnbinom <- function(...) .Call(C_api_Rf_dnbinom, ...)
-api.Rf_pnbinom <- function(...) .Call(C_api_Rf_pnbinom, ...)
-api.Rf_qnbinom <- function(...) .Call(C_api_Rf_qnbinom, ...)
-api.Rf_rnbinom <- function(...) .Call(C_api_Rf_rnbinom, ...)
-api.Rf_dnbinom_mu <- function(...) .Call(C_api_Rf_dnbinom_mu, ...)
-api.Rf_pnbinom_mu <- function(...) .Call(C_api_Rf_pnbinom_mu, ...)
-api.Rf_qnbinom_mu <- function(...) .Call(C_api_Rf_qnbinom_mu, ...)
-api.Rf_rnbinom_mu <- function(...) .Call(C_api_Rf_rnbinom_mu, ...)
-api.Rf_dpois <- function(...) .Call(C_api_Rf_dpois, ...)
-api.Rf_ppois <- function(...) .Call(C_api_Rf_ppois, ...)
-api.Rf_qpois <- function(...) .Call(C_api_Rf_qpois, ...)
-api.Rf_rpois <- function(...) .Call(C_api_Rf_rpois, ...)
-api.Rf_dweibull <- function(...) .Call(C_api_Rf_dweibull, ...)
-api.Rf_pweibull <- function(...) .Call(C_api_Rf_pweibull, ...)
-api.Rf_qweibull <- function(...) .Call(C_api_Rf_qweibull, ...)
-api.Rf_rweibull <- function(...) .Call(C_api_Rf_rweibull, ...)
-api.Rf_dlogis <- function(...) .Call(C_api_Rf_dlogis, ...)
-api.Rf_plogis <- function(...) .Call(C_api_Rf_plogis, ...)
-api.Rf_qlogis <- function(...) .Call(C_api_Rf_qlogis, ...)
-api.Rf_rlogis <- function(...) .Call(C_api_Rf_rlogis, ...)
-api.Rf_dnbeta <- function(...) .Call(C_api_Rf_dnbeta, ...)
-api.Rf_pnbeta <- function(...) .Call(C_api_Rf_pnbeta, ...)
-api.Rf_qnbeta <- function(...) .Call(C_api_Rf_qnbeta, ...)
-api.Rf_dnf <- function(...) .Call(C_api_Rf_dnf, ...)
-api.Rf_pnf <- function(...) .Call(C_api_Rf_pnf, ...)
-api.Rf_qnf <- function(...) .Call(C_api_Rf_qnf, ...)
-api.Rf_dnt <- function(...) .Call(C_api_Rf_dnt, ...)
-api.Rf_pnt <- function(...) .Call(C_api_Rf_pnt, ...)
-api.Rf_qnt <- function(...) .Call(C_api_Rf_qnt, ...)
-api.Rf_ptukey <- function(...) .Call(C_api_Rf_ptukey, ...)
-api.Rf_qtukey <- function(...) .Call(C_api_Rf_qtukey, ...)
-api.Rf_dwilcox <- function(...) .Call(C_api_Rf_dwilcox, ...)
-api.Rf_pwilcox <- function(...) .Call(C_api_Rf_pwilcox, ...)
-api.Rf_qwilcox <- function(...) .Call(C_api_Rf_qwilcox, ...)
-api.Rf_rwilcox <- function(...) .Call(C_api_Rf_rwilcox, ...)
-api.Rf_dsignrank <- function(...) .Call(C_api_Rf_dsignrank, ...)
-api.Rf_psignrank <- function(...) .Call(C_api_Rf_psignrank, ...)
-api.Rf_qsignrank <- function(...) .Call(C_api_Rf_qsignrank, ...)
-api.Rf_rsignrank <- function(...) .Call(C_api_Rf_rsignrank, ...)
-api.Rf_ftrunc <- function(...) .Call(C_api_Rf_ftrunc, ...)
-api.Rf_namesgets <- function(...) .Call(C_api_Rf_namesgets, ...)
-api.Rf_copyMostAttrib <- function(...) .Call(C_api_Rf_copyMostAttrib, ...)
-api.Rf_VectorToPairList <- function(...) .Call(C_api_Rf_VectorToPairList, ...)
-api.Rf_asCharacterFactor <- function(...) .Call(C_api_Rf_asCharacterFactor, ...)
-api.Rf_match <- function(...) .Call(C_api_Rf_match, ...)
-api.Rf_NonNullStringMatch <- function(...) .Call(C_api_Rf_NonNullStringMatch, ...)
-api.R_has_slot <- function(...) .Call(C_api_R_has_slot, ...)
-api.Rf_PrintValue <- function(...) .Call(C_api_Rf_PrintValue, ...)
-api.OBJECT <- function(...) .Call(C_api_OBJECT, ...)
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init.c b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init.c
index ecea6b4040151c6b9d4c4db60bb6c18aa3312053..38516b5c985d12622de2a71410fc211ce1cfe1bc 100644
--- a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init.c
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init.c
@@ -90,235 +90,7 @@ static const R_CallMethodDef CallEntries[] = {
         CALLDEF(test_RfRandomFunctions, 0),
         CALLDEF(test_RfRMultinom, 0),
         CALLDEF(test_RfFunctions, 0),
-        // Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class run with option '-init'
-        // The following code registers all C functions that wrap RFFI functions and convert SEXP <-> primitive types.
-        // The definitions of the C functions could be generated by the same Java class (but run without any option)
-        // RFFI functions that take/return C pointers are ignored
-        CALLDEF(api_Rf_ScalarInteger, 1),
-        CALLDEF(api_Rf_ScalarLogical, 1),
-        CALLDEF(api_Rf_ScalarString, 1),
-        CALLDEF(api_Rf_asInteger, 1),
-        CALLDEF(api_Rf_ScalarReal, 1),
-        CALLDEF(api_Rf_asReal, 1),
-        CALLDEF(api_Rf_asLogical, 1),
-        CALLDEF(api_Rf_asChar, 1),
-        CALLDEF(api_Rf_coerceVector, 2),
-        CALLDEF(api_Rf_mkCharLenCE, 3),
-        CALLDEF(api_Rf_cons, 2),
-        CALLDEF(api_Rf_defineVar, 3),
-        CALLDEF(api_R_getClassDef, 1),
-        CALLDEF(api_R_do_MAKE_CLASS, 1),
-        CALLDEF(api_R_do_new_object, 1),
-        CALLDEF(api_Rf_findVar, 2),
-        CALLDEF(api_Rf_findVarInFrame, 2),
-        CALLDEF(api_Rf_findVarInFrame3, 3),
-        CALLDEF(api_ATTRIB, 1),
-        CALLDEF(api_Rf_getAttrib, 2),
-        CALLDEF(api_Rf_setAttrib, 3),
-        CALLDEF(api_Rf_inherits, 2),
-        CALLDEF(api_Rf_install, 1),
-        CALLDEF(api_Rf_installChar, 1),
-        CALLDEF(api_Rf_lengthgets, 2),
-        CALLDEF(api_Rf_isString, 1),
-        CALLDEF(api_Rf_isNull, 1),
-        CALLDEF(api_Rf_PairToVectorList, 1),
-        CALLDEF(api_Rf_error, 1),
-        CALLDEF(api_Rf_warning, 1),
-        CALLDEF(api_Rf_warningcall, 2),
-        CALLDEF(api_Rf_errorcall, 2),
-        CALLDEF(api_Rf_allocVector, 2),
-        CALLDEF(api_Rf_allocArray, 2),
-        CALLDEF(api_Rf_allocMatrix, 3),
-        CALLDEF(api_Rf_nrows, 1),
-        CALLDEF(api_Rf_ncols, 1),
-        CALLDEF(api_LENGTH, 1),
-        CALLDEF(api_SET_STRING_ELT, 3),
-        CALLDEF(api_SET_VECTOR_ELT, 3),
-        CALLDEF(api_STRING_ELT, 2),
-        CALLDEF(api_VECTOR_ELT, 2),
-        CALLDEF(api_NAMED, 1),
-        CALLDEF(api_SET_NAMED, 2),
-        CALLDEF(api_TYPEOF, 1),
-        CALLDEF(api_Rf_any_duplicated, 2),
-        CALLDEF(api_Rf_any_duplicated3, 3),
-        CALLDEF(api_PRINTNAME, 1),
-        CALLDEF(api_TAG, 1),
-        CALLDEF(api_CAR, 1),
-        CALLDEF(api_CAAR, 1),
-        CALLDEF(api_CDR, 1),
-        CALLDEF(api_CDAR, 1),
-        CALLDEF(api_CADR, 1),
-        CALLDEF(api_CADDR, 1),
-        CALLDEF(api_CADDDR, 1),
-        CALLDEF(api_CAD4R, 1),
-        CALLDEF(api_CDDR, 1),
-        CALLDEF(api_CDDDR, 1),
-        CALLDEF(api_SET_TAG, 2),
-        CALLDEF(api_SETCAR, 2),
-        CALLDEF(api_SETCDR, 2),
-        CALLDEF(api_FORMALS, 1),
-        CALLDEF(api_BODY, 1),
-        CALLDEF(api_CLOENV, 1),
-        CALLDEF(api_SET_FORMALS, 2),
-        CALLDEF(api_SET_BODY, 2),
-        CALLDEF(api_SET_CLOENV, 2),
-        CALLDEF(api_SETCADR, 2),
-        CALLDEF(api_SETCADDR, 2),
-        CALLDEF(api_SETCADDDR, 2),
-        CALLDEF(api_SETCAD4R, 2),
-        CALLDEF(api_SYMVALUE, 1),
-        CALLDEF(api_SET_SYMVALUE, 2),
-        CALLDEF(api_R_BindingIsLocked, 2),
-        CALLDEF(api_R_LockBinding, 2),
-        CALLDEF(api_R_unLockBinding, 2),
-        CALLDEF(api_R_FindNamespace, 1),
-        CALLDEF(api_Rf_eval, 2),
-        CALLDEF(api_Rf_findFun, 2),
-        CALLDEF(api_Rf_GetOption1, 1),
-        CALLDEF(api_Rf_gsetVar, 3),
-        CALLDEF(api_DUPLICATE_ATTRIB, 2),
-        CALLDEF(api_R_compute_identical, 3),
-        CALLDEF(api_Rf_copyListMatrix, 3),
-        CALLDEF(api_Rf_copyMatrix, 3),
-        CALLDEF(api_RDEBUG, 1),
-        CALLDEF(api_SET_RDEBUG, 2),
-        CALLDEF(api_RSTEP, 1),
-        CALLDEF(api_SET_RSTEP, 2),
-        CALLDEF(api_ENCLOS, 1),
-        CALLDEF(api_PRVALUE, 1),
-        CALLDEF(api_R_lsInternal3, 3),
-        CALLDEF(api_R_HomeDir, 0),
-        CALLDEF(api_IS_S4_OBJECT, 1),
-        CALLDEF(api_SET_S4_OBJECT, 1),
-        CALLDEF(api_UNSET_S4_OBJECT, 1),
-        CALLDEF(api_Rprintf, 1),
-        CALLDEF(api_GetRNGstate, 0),
-        CALLDEF(api_PutRNGstate, 0),
-        CALLDEF(api_unif_rand, 0),
-        CALLDEF(api_Rf_classgets, 2),
-        CALLDEF(api_R_ExternalPtrAddr, 1),
-        CALLDEF(api_R_ExternalPtrTag, 1),
-        CALLDEF(api_R_ExternalPtrProtected, 1),
-        CALLDEF(api_R_SetExternalPtrAddr, 2),
-        CALLDEF(api_R_SetExternalPtrTag, 2),
-        CALLDEF(api_R_SetExternalPtrProtected, 2),
-        CALLDEF(api_PRSEEN, 1),
-        CALLDEF(api_PRENV, 1),
-        CALLDEF(api_R_PromiseExpr, 1),
-        CALLDEF(api_PRCODE, 1),
-        CALLDEF(api_R_new_custom_connection, 4),
-        CALLDEF(api_R_ReadConnection, 3),
-        CALLDEF(api_R_WriteConnection, 3),
-        CALLDEF(api_R_GetConnection, 1),
-        CALLDEF(api_R_do_slot, 2),
-        CALLDEF(api_R_do_slot_assign, 3),
-        CALLDEF(api_Rf_str2type, 1),
-        CALLDEF(api_Rf_dunif, 4),
-        CALLDEF(api_Rf_qunif, 5),
-        CALLDEF(api_Rf_punif, 5),
-        CALLDEF(api_Rf_runif, 2),
-        CALLDEF(api_Rf_dchisq, 3),
-        CALLDEF(api_Rf_pchisq, 4),
-        CALLDEF(api_Rf_qchisq, 4),
-        CALLDEF(api_Rf_rchisq, 1),
-        CALLDEF(api_Rf_dnchisq, 4),
-        CALLDEF(api_Rf_pnchisq, 5),
-        CALLDEF(api_Rf_qnchisq, 5),
-        CALLDEF(api_Rf_rnchisq, 2),
-        CALLDEF(api_Rf_dnorm4, 4),
-        CALLDEF(api_Rf_pnorm5, 5),
-        CALLDEF(api_Rf_qnorm5, 5),
-        CALLDEF(api_Rf_rnorm, 2),
-        CALLDEF(api_Rf_dlnorm, 4),
-        CALLDEF(api_Rf_plnorm, 5),
-        CALLDEF(api_Rf_qlnorm, 5),
-        CALLDEF(api_Rf_rlnorm, 2),
-        CALLDEF(api_Rf_dgamma, 4),
-        CALLDEF(api_Rf_pgamma, 5),
-        CALLDEF(api_Rf_qgamma, 5),
-        CALLDEF(api_Rf_rgamma, 2),
-        CALLDEF(api_Rf_dbeta, 4),
-        CALLDEF(api_Rf_pbeta, 5),
-        CALLDEF(api_Rf_qbeta, 5),
-        CALLDEF(api_Rf_rbeta, 2),
-        CALLDEF(api_Rf_df, 4),
-        CALLDEF(api_Rf_pf, 5),
-        CALLDEF(api_Rf_qf, 5),
-        CALLDEF(api_Rf_rf, 2),
-        CALLDEF(api_Rf_dt, 3),
-        CALLDEF(api_Rf_pt, 4),
-        CALLDEF(api_Rf_qt, 4),
-        CALLDEF(api_Rf_rt, 1),
-        CALLDEF(api_Rf_dbinom, 4),
-        CALLDEF(api_Rf_pbinom, 5),
-        CALLDEF(api_Rf_qbinom, 5),
-        CALLDEF(api_Rf_rbinom, 2),
-        CALLDEF(api_Rf_dcauchy, 4),
-        CALLDEF(api_Rf_pcauchy, 5),
-        CALLDEF(api_Rf_qcauchy, 5),
-        CALLDEF(api_Rf_rcauchy, 2),
-        CALLDEF(api_Rf_dexp, 3),
-        CALLDEF(api_Rf_pexp, 4),
-        CALLDEF(api_Rf_qexp, 4),
-        CALLDEF(api_Rf_rexp, 1),
-        CALLDEF(api_Rf_dgeom, 3),
-        CALLDEF(api_Rf_pgeom, 4),
-        CALLDEF(api_Rf_qgeom, 4),
-        CALLDEF(api_Rf_rgeom, 1),
-        CALLDEF(api_Rf_dhyper, 5),
-        CALLDEF(api_Rf_phyper, 6),
-        CALLDEF(api_Rf_qhyper, 6),
-        CALLDEF(api_Rf_rhyper, 3),
-        CALLDEF(api_Rf_dnbinom, 4),
-        CALLDEF(api_Rf_pnbinom, 5),
-        CALLDEF(api_Rf_qnbinom, 5),
-        CALLDEF(api_Rf_rnbinom, 2),
-        CALLDEF(api_Rf_dnbinom_mu, 4),
-        CALLDEF(api_Rf_pnbinom_mu, 5),
-        CALLDEF(api_Rf_qnbinom_mu, 5),
-        CALLDEF(api_Rf_rnbinom_mu, 2),
-        CALLDEF(api_Rf_dpois, 3),
-        CALLDEF(api_Rf_ppois, 4),
-        CALLDEF(api_Rf_qpois, 4),
-        CALLDEF(api_Rf_rpois, 1),
-        CALLDEF(api_Rf_dweibull, 4),
-        CALLDEF(api_Rf_pweibull, 5),
-        CALLDEF(api_Rf_qweibull, 5),
-        CALLDEF(api_Rf_rweibull, 2),
-        CALLDEF(api_Rf_dlogis, 4),
-        CALLDEF(api_Rf_plogis, 5),
-        CALLDEF(api_Rf_qlogis, 5),
-        CALLDEF(api_Rf_rlogis, 2),
-        CALLDEF(api_Rf_dnbeta, 5),
-        CALLDEF(api_Rf_pnbeta, 6),
-        CALLDEF(api_Rf_qnbeta, 6),
-        CALLDEF(api_Rf_dnf, 5),
-        CALLDEF(api_Rf_pnf, 6),
-        CALLDEF(api_Rf_qnf, 6),
-        CALLDEF(api_Rf_dnt, 4),
-        CALLDEF(api_Rf_pnt, 5),
-        CALLDEF(api_Rf_qnt, 5),
-        CALLDEF(api_Rf_ptukey, 6),
-        CALLDEF(api_Rf_qtukey, 6),
-        CALLDEF(api_Rf_dwilcox, 4),
-        CALLDEF(api_Rf_pwilcox, 5),
-        CALLDEF(api_Rf_qwilcox, 5),
-        CALLDEF(api_Rf_rwilcox, 2),
-        CALLDEF(api_Rf_dsignrank, 3),
-        CALLDEF(api_Rf_psignrank, 4),
-        CALLDEF(api_Rf_qsignrank, 4),
-        CALLDEF(api_Rf_rsignrank, 1),
-        CALLDEF(api_Rf_ftrunc, 1),
-        CALLDEF(api_Rf_namesgets, 2),
-        CALLDEF(api_Rf_copyMostAttrib, 2),
-        CALLDEF(api_Rf_VectorToPairList, 1),
-        CALLDEF(api_Rf_asCharacterFactor, 1),
-        CALLDEF(api_Rf_match, 3),
-        CALLDEF(api_Rf_NonNullStringMatch, 2),
-        CALLDEF(api_R_has_slot, 2),
-        CALLDEF(api_Rf_PrintValue, 1),
-        CALLDEF(api_OBJECT, 1),
-        // ---- end of generated code
+        #include "init_api.h"
         {NULL, NULL, 0}
 };
 
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init_api.h b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..345fc0f7b540cf39b1acfeee4e02d545ccdbd18a
--- /dev/null
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init_api.h
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class run with option '-init'
+// All the generated files in testrffi can be regenerated by running 'mx testrfficodegen'
+// The following code registers all C functions that wrap RFFI functions and convert SEXP <-> primitive types.
+// The definitions of the C functions could be generated by the same Java class (but run without any option)
+// RFFI functions that take/return C pointers are ignored
+// This code is '#included' into init.c 
+CALLDEF(api_Rf_ScalarInteger, 1),
+CALLDEF(api_Rf_ScalarLogical, 1),
+CALLDEF(api_Rf_ScalarReal, 1),
+CALLDEF(api_Rf_ScalarString, 1),
+CALLDEF(api_Rf_asInteger, 1),
+CALLDEF(api_Rf_asReal, 1),
+CALLDEF(api_Rf_asLogical, 1),
+CALLDEF(api_Rf_asChar, 1),
+CALLDEF(api_Rf_coerceVector, 2),
+CALLDEF(api_Rf_mkCharLenCE, 3),
+CALLDEF(api_Rf_cons, 2),
+CALLDEF(api_Rf_defineVar, 3),
+CALLDEF(api_R_getClassDef, 1),
+CALLDEF(api_R_do_MAKE_CLASS, 1),
+CALLDEF(api_R_do_new_object, 1),
+CALLDEF(api_Rf_findVar, 2),
+CALLDEF(api_Rf_findVarInFrame, 2),
+CALLDEF(api_Rf_findVarInFrame3, 3),
+CALLDEF(api_ATTRIB, 1),
+CALLDEF(api_Rf_getAttrib, 2),
+CALLDEF(api_Rf_setAttrib, 3),
+CALLDEF(api_Rf_inherits, 2),
+CALLDEF(api_Rf_install, 1),
+CALLDEF(api_Rf_installChar, 1),
+CALLDEF(api_Rf_lengthgets, 2),
+CALLDEF(api_Rf_isString, 1),
+CALLDEF(api_Rf_isNull, 1),
+CALLDEF(api_Rf_PairToVectorList, 1),
+CALLDEF(api_Rf_error, 1),
+CALLDEF(api_Rf_warning, 1),
+CALLDEF(api_Rf_warningcall, 2),
+CALLDEF(api_Rf_errorcall, 2),
+CALLDEF(api_Rf_allocVector, 2),
+CALLDEF(api_Rf_allocArray, 2),
+CALLDEF(api_Rf_allocMatrix, 3),
+CALLDEF(api_Rf_nrows, 1),
+CALLDEF(api_Rf_ncols, 1),
+CALLDEF(api_LENGTH, 1),
+CALLDEF(api_SET_STRING_ELT, 3),
+CALLDEF(api_SET_VECTOR_ELT, 3),
+CALLDEF(api_SET_ATTRIB, 2),
+CALLDEF(api_STRING_ELT, 2),
+CALLDEF(api_VECTOR_ELT, 2),
+CALLDEF(api_NAMED, 1),
+CALLDEF(api_SET_OBJECT, 2),
+CALLDEF(api_SET_NAMED, 2),
+CALLDEF(api_TYPEOF, 1),
+CALLDEF(api_Rf_any_duplicated, 2),
+CALLDEF(api_Rf_any_duplicated3, 3),
+CALLDEF(api_PRINTNAME, 1),
+CALLDEF(api_TAG, 1),
+CALLDEF(api_CAR, 1),
+CALLDEF(api_CAAR, 1),
+CALLDEF(api_CDR, 1),
+CALLDEF(api_CDAR, 1),
+CALLDEF(api_CADR, 1),
+CALLDEF(api_CADDR, 1),
+CALLDEF(api_CADDDR, 1),
+CALLDEF(api_CAD4R, 1),
+CALLDEF(api_CDDR, 1),
+CALLDEF(api_CDDDR, 1),
+CALLDEF(api_SET_TAG, 2),
+CALLDEF(api_SETCAR, 2),
+CALLDEF(api_SETCDR, 2),
+CALLDEF(api_FORMALS, 1),
+CALLDEF(api_BODY, 1),
+CALLDEF(api_CLOENV, 1),
+CALLDEF(api_SET_FORMALS, 2),
+CALLDEF(api_SET_BODY, 2),
+CALLDEF(api_SET_CLOENV, 2),
+CALLDEF(api_SETCADR, 2),
+CALLDEF(api_SETCADDR, 2),
+CALLDEF(api_SETCADDDR, 2),
+CALLDEF(api_SETCAD4R, 2),
+CALLDEF(api_SYMVALUE, 1),
+CALLDEF(api_SET_SYMVALUE, 2),
+CALLDEF(api_R_BindingIsLocked, 2),
+CALLDEF(api_R_LockBinding, 2),
+CALLDEF(api_R_unLockBinding, 2),
+CALLDEF(api_R_FindNamespace, 1),
+CALLDEF(api_Rf_eval, 2),
+CALLDEF(api_Rf_findFun, 2),
+CALLDEF(api_Rf_GetOption1, 1),
+CALLDEF(api_Rf_gsetVar, 3),
+CALLDEF(api_DUPLICATE_ATTRIB, 2),
+CALLDEF(api_R_compute_identical, 3),
+CALLDEF(api_Rf_copyListMatrix, 3),
+CALLDEF(api_Rf_copyMatrix, 3),
+CALLDEF(api_RDEBUG, 1),
+CALLDEF(api_SET_RDEBUG, 2),
+CALLDEF(api_RSTEP, 1),
+CALLDEF(api_SET_RSTEP, 2),
+CALLDEF(api_ENCLOS, 1),
+CALLDEF(api_PRVALUE, 1),
+CALLDEF(api_R_lsInternal3, 3),
+CALLDEF(api_R_HomeDir, 0),
+CALLDEF(api_IS_S4_OBJECT, 1),
+CALLDEF(api_SET_S4_OBJECT, 1),
+CALLDEF(api_UNSET_S4_OBJECT, 1),
+CALLDEF(api_Rprintf, 1),
+CALLDEF(api_GetRNGstate, 0),
+CALLDEF(api_PutRNGstate, 0),
+CALLDEF(api_unif_rand, 0),
+CALLDEF(api_Rf_classgets, 2),
+CALLDEF(api_R_ExternalPtrAddr, 1),
+CALLDEF(api_R_ExternalPtrTag, 1),
+CALLDEF(api_R_ExternalPtrProtected, 1),
+CALLDEF(api_R_SetExternalPtrAddr, 2),
+CALLDEF(api_R_SetExternalPtrTag, 2),
+CALLDEF(api_R_SetExternalPtrProtected, 2),
+CALLDEF(api_PRSEEN, 1),
+CALLDEF(api_PRENV, 1),
+CALLDEF(api_R_PromiseExpr, 1),
+CALLDEF(api_PRCODE, 1),
+CALLDEF(api_R_new_custom_connection, 4),
+CALLDEF(api_R_ReadConnection, 3),
+CALLDEF(api_R_WriteConnection, 3),
+CALLDEF(api_R_GetConnection, 1),
+CALLDEF(api_R_do_slot, 2),
+CALLDEF(api_R_do_slot_assign, 3),
+CALLDEF(api_Rf_str2type, 1),
+CALLDEF(api_Rf_dunif, 4),
+CALLDEF(api_Rf_qunif, 5),
+CALLDEF(api_Rf_punif, 5),
+CALLDEF(api_Rf_runif, 2),
+CALLDEF(api_Rf_dchisq, 3),
+CALLDEF(api_Rf_pchisq, 4),
+CALLDEF(api_Rf_qchisq, 4),
+CALLDEF(api_Rf_rchisq, 1),
+CALLDEF(api_Rf_dnchisq, 4),
+CALLDEF(api_Rf_pnchisq, 5),
+CALLDEF(api_Rf_qnchisq, 5),
+CALLDEF(api_Rf_rnchisq, 2),
+CALLDEF(api_Rf_dnorm4, 4),
+CALLDEF(api_Rf_pnorm5, 5),
+CALLDEF(api_Rf_qnorm5, 5),
+CALLDEF(api_Rf_rnorm, 2),
+CALLDEF(api_Rf_dlnorm, 4),
+CALLDEF(api_Rf_plnorm, 5),
+CALLDEF(api_Rf_qlnorm, 5),
+CALLDEF(api_Rf_rlnorm, 2),
+CALLDEF(api_Rf_dgamma, 4),
+CALLDEF(api_Rf_pgamma, 5),
+CALLDEF(api_Rf_qgamma, 5),
+CALLDEF(api_Rf_rgamma, 2),
+CALLDEF(api_Rf_dbeta, 4),
+CALLDEF(api_Rf_pbeta, 5),
+CALLDEF(api_Rf_qbeta, 5),
+CALLDEF(api_Rf_rbeta, 2),
+CALLDEF(api_Rf_df, 4),
+CALLDEF(api_Rf_pf, 5),
+CALLDEF(api_Rf_qf, 5),
+CALLDEF(api_Rf_rf, 2),
+CALLDEF(api_Rf_dt, 3),
+CALLDEF(api_Rf_pt, 4),
+CALLDEF(api_Rf_qt, 4),
+CALLDEF(api_Rf_rt, 1),
+CALLDEF(api_Rf_dbinom, 4),
+CALLDEF(api_Rf_pbinom, 5),
+CALLDEF(api_Rf_qbinom, 5),
+CALLDEF(api_Rf_rbinom, 2),
+CALLDEF(api_Rf_dcauchy, 4),
+CALLDEF(api_Rf_pcauchy, 5),
+CALLDEF(api_Rf_qcauchy, 5),
+CALLDEF(api_Rf_rcauchy, 2),
+CALLDEF(api_Rf_dexp, 3),
+CALLDEF(api_Rf_pexp, 4),
+CALLDEF(api_Rf_qexp, 4),
+CALLDEF(api_Rf_rexp, 1),
+CALLDEF(api_Rf_dgeom, 3),
+CALLDEF(api_Rf_pgeom, 4),
+CALLDEF(api_Rf_qgeom, 4),
+CALLDEF(api_Rf_rgeom, 1),
+CALLDEF(api_Rf_dhyper, 5),
+CALLDEF(api_Rf_phyper, 6),
+CALLDEF(api_Rf_qhyper, 6),
+CALLDEF(api_Rf_rhyper, 3),
+CALLDEF(api_Rf_dnbinom, 4),
+CALLDEF(api_Rf_pnbinom, 5),
+CALLDEF(api_Rf_qnbinom, 5),
+CALLDEF(api_Rf_rnbinom, 2),
+CALLDEF(api_Rf_dnbinom_mu, 4),
+CALLDEF(api_Rf_pnbinom_mu, 5),
+CALLDEF(api_Rf_qnbinom_mu, 5),
+CALLDEF(api_Rf_rnbinom_mu, 2),
+CALLDEF(api_Rf_dpois, 3),
+CALLDEF(api_Rf_ppois, 4),
+CALLDEF(api_Rf_qpois, 4),
+CALLDEF(api_Rf_rpois, 1),
+CALLDEF(api_Rf_dweibull, 4),
+CALLDEF(api_Rf_pweibull, 5),
+CALLDEF(api_Rf_qweibull, 5),
+CALLDEF(api_Rf_rweibull, 2),
+CALLDEF(api_Rf_dlogis, 4),
+CALLDEF(api_Rf_plogis, 5),
+CALLDEF(api_Rf_qlogis, 5),
+CALLDEF(api_Rf_rlogis, 2),
+CALLDEF(api_Rf_dnbeta, 5),
+CALLDEF(api_Rf_pnbeta, 6),
+CALLDEF(api_Rf_qnbeta, 6),
+CALLDEF(api_Rf_dnf, 5),
+CALLDEF(api_Rf_pnf, 6),
+CALLDEF(api_Rf_qnf, 6),
+CALLDEF(api_Rf_dnt, 4),
+CALLDEF(api_Rf_pnt, 5),
+CALLDEF(api_Rf_qnt, 5),
+CALLDEF(api_Rf_ptukey, 6),
+CALLDEF(api_Rf_qtukey, 6),
+CALLDEF(api_Rf_dwilcox, 4),
+CALLDEF(api_Rf_pwilcox, 5),
+CALLDEF(api_Rf_qwilcox, 5),
+CALLDEF(api_Rf_rwilcox, 2),
+CALLDEF(api_Rf_dsignrank, 3),
+CALLDEF(api_Rf_psignrank, 4),
+CALLDEF(api_Rf_qsignrank, 4),
+CALLDEF(api_Rf_rsignrank, 1),
+CALLDEF(api_Rf_ftrunc, 1),
+CALLDEF(api_Rf_namesgets, 2),
+CALLDEF(api_Rf_copyMostAttrib, 2),
+CALLDEF(api_Rf_VectorToPairList, 1),
+CALLDEF(api_Rf_asCharacterFactor, 1),
+CALLDEF(api_Rf_match, 3),
+CALLDEF(api_Rf_NonNullStringMatch, 2),
+CALLDEF(api_R_has_slot, 2),
+CALLDEF(api_Rf_PrintValue, 1),
+CALLDEF(api_OBJECT, 1),
+// ---- end of generated code
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.c b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.c
index 3a9ed90d865f45b973bb84e1655d2acb286dd48c..c9bf742466e25cf3a81e165e1d763a169ddd938b 100644
--- a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.c
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.c
@@ -21,7 +21,9 @@
  * questions.
  */
 
-// Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class// The following code defines a 'SEXP' variant of every RFFI function implemented in FastR
+// Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class
+// All the generated files in testrffi can be regenerated by running 'mx testrfficodegen'
+// The following code defines a 'SEXP' variant of every RFFI function implemented in FastR
 // Run the same Java class with '-init' option to get sequence of CALLDEF statements that register those functions for use from R
 // RFFI functions that take/return C pointers are ignored
 #define NO_FASTR_REDEFINE
@@ -41,14 +43,6 @@
 
 #pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
 
-SEXP api_Rf_asInteger(SEXP x) {
-    return ScalarInteger(Rf_asInteger(x));
-}
-
-SEXP api_Rf_asReal(SEXP x) {
-    return ScalarReal(Rf_asReal(x));
-}
-
 SEXP api_Rf_ScalarInteger(SEXP value) {
     return Rf_ScalarInteger(INTEGER_VALUE(value));
 }
@@ -65,6 +59,14 @@ SEXP api_Rf_ScalarString(SEXP value) {
     return Rf_ScalarString(value);
 }
 
+SEXP api_Rf_asInteger(SEXP x) {
+    return ScalarInteger(Rf_asInteger(x));
+}
+
+SEXP api_Rf_asReal(SEXP x) {
+    return ScalarReal(Rf_asReal(x));
+}
+
 SEXP api_Rf_asLogical(SEXP x) {
     return ScalarInteger(Rf_asLogical(x));
 }
@@ -209,6 +211,11 @@ SEXP api_SET_VECTOR_ELT(SEXP x, SEXP i, SEXP v) {
     return R_NilValue;
 }
 
+SEXP api_SET_ATTRIB(SEXP target, SEXP attributes) {
+    SET_ATTRIB(target, attributes);
+    return R_NilValue;
+}
+
 SEXP api_STRING_ELT(SEXP x, SEXP i) {
     return STRING_ELT(x, INTEGER_VALUE(i));
 }
@@ -221,6 +228,11 @@ SEXP api_NAMED(SEXP x) {
     return ScalarInteger(NAMED(x));
 }
 
+SEXP api_SET_OBJECT(SEXP x, SEXP flag) {
+    SET_OBJECT(x, INTEGER_VALUE(flag));
+    return R_NilValue;
+}
+
 SEXP api_SET_NAMED(SEXP x, SEXP v) {
     SET_NAMED(x, INTEGER_VALUE(v));
     return R_NilValue;
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.h b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.h
index c7a75d910727edb969201f64d75b1adba7b4ee10..f59eb727b14a0abc1bb8cd43a771e8f8fd6a6967 100644
--- a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.h
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/rffiwrappers.h
@@ -22,6 +22,7 @@
  */
 
 // Code generated by com.oracle.truffle.r.ffi.codegen.FFITestsCodeGen class run with option '-h'
+// All the generated files in testrffi can be regenerated by running 'mx testrfficodegen'
 // See the corresponding C file for more details
 #define NO_FASTR_REDEFINE
 #include <R.h>
@@ -35,17 +36,17 @@
 
 SEXP api_Rf_ScalarInteger(SEXP value);
 
-SEXP api_Rf_ScalarReal(SEXP value);
-
-SEXP api_Rf_asReal(SEXP x);
+SEXP api_Rf_ScalarLogical(SEXP value);
 
-SEXP api_Rf_asLogical(SEXP x);
+SEXP api_Rf_ScalarReal(SEXP value);
 
 SEXP api_Rf_ScalarString(SEXP value);
 
 SEXP api_Rf_asInteger(SEXP x);
 
-SEXP api_Rf_ScalarLogical(SEXP value);
+SEXP api_Rf_asReal(SEXP x);
+
+SEXP api_Rf_asLogical(SEXP x);
 
 SEXP api_Rf_asChar(SEXP x);
 
@@ -113,12 +114,16 @@ SEXP api_SET_STRING_ELT(SEXP x, SEXP i, SEXP v);
 
 SEXP api_SET_VECTOR_ELT(SEXP x, SEXP i, SEXP v);
 
+SEXP api_SET_ATTRIB(SEXP target, SEXP attributes);
+
 SEXP api_STRING_ELT(SEXP x, SEXP i);
 
 SEXP api_VECTOR_ELT(SEXP x, SEXP i);
 
 SEXP api_NAMED(SEXP x);
 
+SEXP api_SET_OBJECT(SEXP x, SEXP flag);
+
 SEXP api_SET_NAMED(SEXP x, SEXP v);
 
 SEXP api_TYPEOF(SEXP x);
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/pairlists.R b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/pairlists.R
new file mode 100644
index 0000000000000000000000000000000000000000..8260d0d90eadf62d3367a3bf8101ae1792500977
--- /dev/null
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/pairlists.R
@@ -0,0 +1,11 @@
+# Some more tests that work with pairlists and related objects like '...' or language
+stopifnot(require(testrffi))
+
+# Note: GNU R returns the promise, FastR the value, we check that at least there are not exceptions
+foo <- function(...) api.CAR(get('...'))
+invisible(foo(a=3))
+invisible(foo(a=4, b=6))
+
+foo <- function(...) api.CDR(get('...'))
+is.null(foo(a=3))
+names(foo(a=4, b=6))
diff --git a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/simpleTests.R b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/simpleTests.R
index 6c3f566281bfffa0e9f971d7f9806b62f278d8d3..dfd740c94c209f2a740e1b7aae211b4c96a1c5f2 100644
--- a/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/simpleTests.R
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/tests/simpleTests.R
@@ -141,3 +141,35 @@ rffi.RfRandomFunctions()
 
 rffi.RfRMultinom()
 rffi.RfFunctions()
+
+setAttrTarget <- c(1,2,3)
+attr(setAttrTarget, 'myattr2') <- 'some value';
+api.SET_ATTRIB(setAttrTarget, as.pairlist(list(myattr=42)))
+setAttrTarget
+
+typeof(api.ATTRIB(mtcars))
+api.ATTRIB(structure(c(1,2,3), myattr3 = 33))
+
+# SET_OBJECT
+# FastR does not fully support the SET_OBJECT fully,
+# the test is left here in case there is a need to actually implement it.
+x <- structure(3, class='abc')
+# just to make sure tirivial SET_OBJECT examples work
+api.SET_OBJECT(x, 1)
+api.SET_OBJECT(c(1,2,3), 0)
+
+## before SET_OBJECT(x,0), S3 dispatching works as expected:
+# foo <- function(x) UseMethod('foo')
+# foo.default <- function(x) cat("foo.default\n")
+# foo.abc <- function(x) cat("foo.abc\n")
+# as.character.abc <- function(...) "42"
+# paste(x) # "42"
+# foo(x) # "foo.abc"
+
+# api.SET_OBJECT(x, 0) # FastR throws error saying that this is not implemented
+
+## after SET_OBJECT(x,0), S3 dispatching does not work for internals
+# paste(x) # "3" -- as.character.abc not called
+# inherits(x, 'abc') # TRUE
+# foo(x) # "foo.abc"
+
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
index 440ac65414ad32b7126fb05f6e1781f0e148f82b..57f734463d8a4bb4bd387d9254e61ccf87fe0e94 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
@@ -67789,6 +67789,10 @@ integer(0)
 [41] 26163.27 26367.35 26571.43 26775.51 26979.59 27183.67 27387.76 27591.84
 [49] 27795.92 28000.00
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_seq_along.testWithNonStandardLength#
+#seq_along()
+Error in seq_along() : 0 arguments passed to 'seq_along' which requires 1
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_seq_along.testWithNonStandardLength#
 #{ assign('length.myclass', function(...) 42, envir=.__S3MethodsTable__.); x <- 1; class(x) <- 'myclass'; res <- seq_along(x); rm('length.myclass', envir=.__S3MethodsTable__.); res }
  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java
index e71494b48a9b932dbed42640ad664c807880a1fe..98b69beaa39845714e5eeae987085cd3b68f8aef 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java
@@ -4,7 +4,7 @@
  * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * Copyright (c) 2012-2014, Purdue University
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates
  *
  * All rights reserved.
  */
@@ -141,5 +141,6 @@ public class TestBuiltin_seq_along extends TestBase {
         assertEval(Output.IgnoreWarningContext, Output.IgnoreErrorContext, "{ x <- c(1,2,3); class(x) <- 'myclass'; length.myclass <- function(w) 'hello world'; seq_along(x) }");
         assertEval("{ length <- function(x) 42; seq_along(c(1,2,3)) }");
         assertEval("{ assign('length.myclass', function(...) 42, envir=.__S3MethodsTable__.); x <- 1; class(x) <- 'myclass'; res <- seq_along(x); rm('length.myclass', envir=.__S3MethodsTable__.); res }");
+        assertEval("seq_along()");
     }
 }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/data/RPairListTests.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/data/RPairListTests.java
index e7015b15084eaa9551d7e85f6942ac50b30251f2..5b0a4bfa62a0f132b04fea2bf6c647b0dcb28438 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/data/RPairListTests.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/data/RPairListTests.java
@@ -34,6 +34,7 @@ import com.oracle.truffle.r.runtime.data.RDataFactory;
 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.RSymbol;
 
 public class RPairListTests {
     @Test
@@ -48,7 +49,7 @@ public class RPairListTests {
 
     @Test
     public void testToList() {
-        RPairList pairList = RDataFactory.createPairList(1, RDataFactory.createPairList(2, RNull.instance, "name2"), "name1");
+        RPairList pairList = RDataFactory.createPairList(1, RDataFactory.createPairList(2, RNull.instance, sym("name2")), sym("name1"));
         RList result = pairList.toRList();
         assertArrayEquals(new String[]{"name1", "name2"}, result.getNames().getReadonlyData());
         assertArrayEquals(new Object[]{1, 2}, result.getDataWithoutCopying());
@@ -56,13 +57,17 @@ public class RPairListTests {
 
     @Test
     public void testCopy() {
-        RPairList pairList = RDataFactory.createPairList(1, RDataFactory.createPairList(2, RNull.instance, "name2"), "name1");
+        RPairList pairList = RDataFactory.createPairList(1, RDataFactory.createPairList(2, RNull.instance, sym("name2")), sym("name1"));
         RPairList copy = pairList.copy();
         assertEquals(2, copy.getLength());
-        assertEquals("name1", copy.getTag());
+        assertEquals("name1", copy.getTag().toString());
         assertEquals(1, copy.car());
-        assertEquals("name2", ((RPairList) copy.cdr()).getTag());
+        assertEquals("name2", ((RPairList) copy.cdr()).getTag().toString());
         assertEquals(2, ((RPairList) copy.cdr()).car());
         assertSame(RNull.instance, ((RPairList) copy.cdr()).cdr());
     }
+
+    private static RSymbol sym(String name) {
+        return RDataFactory.createSymbol(name);
+    }
 }
diff --git a/mx.fastr/mx_fastr.py b/mx.fastr/mx_fastr.py
index 544dff959380038b5a81bfcd5b3bd8fcae6e1dfa..b9f4dbccfac9c865206eea468658a8b8a5b24bd4 100644
--- a/mx.fastr/mx_fastr.py
+++ b/mx.fastr/mx_fastr.py
@@ -526,6 +526,37 @@ def gnu_rtests(args, env=None):
     finally:
         shutil.rmtree(join(_fastr_suite.dir, 'deparse'), True)
 
+def run_codegen(main, args, **kwargs):
+    '''
+    Runs java with the com.oracle.truffle.r.ffi.codegen project on the class path and "main" as the entry point.
+    '''
+    jdk = get_default_jdk()
+    vmArgs = mx.get_runtime_jvm_args('com.oracle.truffle.r.ffi.codegen', jdk=jdk)
+    vmArgs += ['-ea', '-esa']
+    vmArgs = _sanitize_vmArgs(jdk, vmArgs)
+    vmArgs.append(main)
+    return mx.run_java(vmArgs + args, jdk=jdk, **kwargs)
+
+def run_testrfficodegen(args):
+    '''
+    Regenerates the generated code in com.oracle.truffle.r.test.native/packages/testrffi/testrffi package.
+    '''
+    testrffi_path = join(_fastr_suite.dir, 'com.oracle.truffle.r.test.native/packages/testrffi/testrffi')
+    package = 'com.oracle.truffle.r.ffi.codegen.'
+    run_codegen(package + 'FFITestsCodeGen', [join(testrffi_path, 'src/rffiwrappers.c')])
+    run_codegen(package + 'FFITestsCodeGen', ['-h', join(testrffi_path, 'src/rffiwrappers.h')])
+    run_codegen(package + 'FFITestsCodeGen', ['-init', join(testrffi_path, 'src/init_api.h')])
+    run_codegen(package + 'FFITestsCodeGen', ['-r', join(testrffi_path, 'R/api.R')])
+
+def run_rfficodegen(args):
+    '''
+    Regenerates the generated code that glues together the Java and C part.
+    The generated files are located in in com.oracle.truffle.r.native/fficall/src.
+    '''
+    rffisrc_path = join(_fastr_suite.dir, 'com.oracle.truffle.r.native/fficall/src')
+    package = 'com.oracle.truffle.r.ffi.codegen.'
+    run_codegen(package + 'FFIUpCallsIndexCodeGen', [join(rffisrc_path, 'common/rffi_upcallsindex.h')])
+
 def nativebuild(args):
     '''
     force the build of part or all of the native project
@@ -586,6 +617,8 @@ _commands = {
     'gnu-rscript' : [gnu_rscript, '[]'],
     'gnu-rtests' : [gnu_rtests, '[]'],
     'nativebuild' : [nativebuild, '[]'],
+    'testrfficodegen' : [run_testrfficodegen, '[]'],
+    'rfficodegen' : [run_rfficodegen, '[]']
     }
 
 mx.update_commands(_fastr_suite, _commands)
diff --git a/mx.fastr/mx_fastr_edinclude.py b/mx.fastr/mx_fastr_edinclude.py
index 40d357e92ea0c54e58b544ea598780ae36d2c79a..5f2efebcfd18ef31d49e145b920c4cf7dd9b02a3 100644
--- a/mx.fastr/mx_fastr_edinclude.py
+++ b/mx.fastr/mx_fastr_edinclude.py
@@ -74,6 +74,9 @@ use_internals_end = '''#endif
 
 '''
 
+# This rewrite is disabled, because it causes compilation error with Rcpp
+# The long term solution shall be to unify RPairList and RLanguage and
+# possibly RArgsValuesAndNames(?) to be able to change the type in place.
 set_typeof_rewrite = '''#ifdef FASTR
 SEXP SET_TYPEOF_FASTR(SEXP x, int v);
 #ifndef NO_FASTR_REDEFINE
@@ -113,9 +116,10 @@ def ed_r_internals(gnu_dir):
                     rewrite_var(f, var, line)
                 else:
                     f.write(line)
-            elif 'SET_TYPEOF' in line and '(SEXP' in line:
-                f.write(line)
-                f.write(set_typeof_rewrite)
+            # disabled because of compilations problems with Rcpp
+            # elif 'SET_TYPEOF' in line and '(SEXP' in line:
+            #     f.write(line)
+            #     f.write(set_typeof_rewrite)
             else:
                 f.write(line)