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..9f3f8a09acbcb615ba8105ab67a8fda63c666745
--- /dev/null
+++ b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java
@@ -0,0 +1,69 @@
+/*
+ * 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.Writer;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import javax.lang.model.element.ExecutableElement;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+
+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.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..66c90e6111156e59c95d3b019fd4b10f3f7d722a 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
@@ -117,7 +117,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 +139,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..3454b09213b81f39223bdb35d5ce54c573c7e210 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
 
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..9503277930944e6cc788183e94e3ee0d7d4a89f3
--- /dev/null
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/R/api.R
@@ -0,0 +1,230 @@
+#############
+# 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_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..cdb6fde7609a5f45eb5ee13bbeb155572aa14713
--- /dev/null
+++ b/com.oracle.truffle.r.test.native/packages/testrffi/testrffi/src/init_api.h
@@ -0,0 +1,255 @@
+/*
+ * 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_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..b15db1b7720a95ffdb756235c84cb87fbc04c3cd 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));
 }
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..da4473e42e03a3b2a9816dd02c8a3155a8e11e7f 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,6 +114,8 @@ 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);
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)