Skip to content
Snippets Groups Projects
Commit 5558da92 authored by stepan's avatar stepan
Browse files

RFFI: implement SETCADDR, SETCADDDR and SETCAD4R macros

parent 82a19107
No related branches found
No related tags found
No related merge requests found
......@@ -740,6 +740,21 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
throw implementedAsNode();
}
@Override
public Object SETCADDR(Object x, Object y) {
throw implementedAsNode();
}
@Override
public Object SETCADDDR(Object x, Object y) {
throw implementedAsNode();
}
@Override
public Object SETCAD4R(Object x, Object y) {
throw implementedAsNode();
}
@Override
@TruffleBoundary
public Object SYMVALUE(Object x) {
......
......@@ -172,6 +172,52 @@ public final class ListAccessNodes {
}
}
@TypeSystemReference(RTypes.class)
public static final class SETCADDRNode extends FFIUpCallNode.Arg2 {
@Child CDDRNode cddr = CDDRNode.create();
@Child SETCARNode setcarNode = SETCARNode.create();
@Override
public Object executeObject(Object x, Object val) {
return setcarNode.executeObject(cddr.executeObject(x), val);
}
public static SETCADDRNode create() {
return new SETCADDRNode();
}
}
@TypeSystemReference(RTypes.class)
public static final class SETCADDDRNode extends FFIUpCallNode.Arg2 {
@Child CDDDRNode cdddr = CDDDRNode.create();
@Child SETCARNode setcarNode = SETCARNode.create();
@Override
public Object executeObject(Object x, Object val) {
return setcarNode.executeObject(cdddr.executeObject(x), val);
}
public static SETCADDDRNode create() {
return new SETCADDDRNode();
}
}
@TypeSystemReference(RTypes.class)
public static final class SETCAD4RNode extends FFIUpCallNode.Arg2 {
@Child CDDDRNode cdddr = CDDDRNode.create();
@Child CDRNode cdr = CDRNode.create();
@Child SETCARNode setcarNode = SETCARNode.create();
@Override
public Object executeObject(Object x, Object val) {
return setcarNode.executeObject(cdddr.executeObject(cdr.executeObject(x)), val);
}
public static SETCAD4RNode create() {
return new SETCAD4RNode();
}
}
@TypeSystemReference(RTypes.class)
public abstract static class SETCARNode extends FFIUpCallNode.Arg2 {
public static SETCARNode create() {
......
......@@ -45,6 +45,9 @@ import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.CDARNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.CDDDRNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.CDDRNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.CDRNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.SETCAD4RNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.SETCADDDRNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.SETCADDRNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.SETCADRNode;
import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.SETCARNode;
import com.oracle.truffle.r.ffi.impl.nodes.MatchNodes;
......@@ -263,6 +266,15 @@ public interface StdUpCallsRFFI {
@RFFIUpCallNode(SETCADRNode.class)
Object SETCADR(Object x, Object y);
@RFFIUpCallNode(SETCADDRNode.class)
Object SETCADDR(Object x, Object y);
@RFFIUpCallNode(SETCADDDRNode.class)
Object SETCADDDR(Object x, Object y);
@RFFIUpCallNode(SETCAD4RNode.class)
Object SETCAD4R(Object x, Object y);
Object SYMVALUE(Object x);
void SET_SYMVALUE(Object x, Object v);
......
......@@ -157,42 +157,45 @@
#define Rf_warning_x 152
#define Rf_warningcall_x 153
#define Rprintf_x 154
#define SETCADR_x 155
#define SETCAR_x 156
#define SETCDR_x 157
#define SET_BODY_x 158
#define SET_CLOENV_x 159
#define SET_FORMALS_x 160
#define SET_NAMED_FASTR_x 161
#define SET_RDEBUG_x 162
#define SET_RSTEP_x 163
#define SET_S4_OBJECT_x 164
#define SET_STRING_ELT_x 165
#define SET_SYMVALUE_x 166
#define SET_TAG_x 167
#define SET_TYPEOF_FASTR_x 168
#define SET_VECTOR_ELT_x 169
#define STRING_ELT_x 170
#define SYMVALUE_x 171
#define TAG_x 172
#define TYPEOF_x 173
#define UNSET_S4_OBJECT_x 174
#define VECTOR_ELT_x 175
#define forceSymbols_x 176
#define getCCallable_x 177
#define getConnectionClassString_x 178
#define getEmbeddingDLLInfo_x 179
#define getOpenModeString_x 180
#define getSummaryDescription_x 181
#define isSeekable_x 182
#define octsize_x 183
#define registerCCallable_x 184
#define registerRoutines_x 185
#define restoreHandlerStacks_x 186
#define setDotSymbolValues_x 187
#define unif_rand_x 188
#define useDynamicSymbols_x 189
#define SETCAD4R_x 155
#define SETCADDDR_x 156
#define SETCADDR_x 157
#define SETCADR_x 158
#define SETCAR_x 159
#define SETCDR_x 160
#define SET_BODY_x 161
#define SET_CLOENV_x 162
#define SET_FORMALS_x 163
#define SET_NAMED_FASTR_x 164
#define SET_RDEBUG_x 165
#define SET_RSTEP_x 166
#define SET_S4_OBJECT_x 167
#define SET_STRING_ELT_x 168
#define SET_SYMVALUE_x 169
#define SET_TAG_x 170
#define SET_TYPEOF_FASTR_x 171
#define SET_VECTOR_ELT_x 172
#define STRING_ELT_x 173
#define SYMVALUE_x 174
#define TAG_x 175
#define TYPEOF_x 176
#define UNSET_S4_OBJECT_x 177
#define VECTOR_ELT_x 178
#define forceSymbols_x 179
#define getCCallable_x 180
#define getConnectionClassString_x 181
#define getEmbeddingDLLInfo_x 182
#define getOpenModeString_x 183
#define getSummaryDescription_x 184
#define isSeekable_x 185
#define octsize_x 186
#define registerCCallable_x 187
#define registerRoutines_x 188
#define restoreHandlerStacks_x 189
#define setDotSymbolValues_x 190
#define unif_rand_x 191
#define useDynamicSymbols_x 192
#define UPCALLS_TABLE_SIZE 190
#define UPCALLS_TABLE_SIZE 193
#endif // RFFI_UPCALLSINDEX_H
......@@ -771,19 +771,20 @@ SEXP SETCADR(SEXP x, SEXP y) {
SEXP SETCADDR(SEXP x, SEXP y) {
TRACE0();
unimplemented("SETCADDR");
// note: signature is same, we reuse call_SETCADR
SEXP result = ((call_SETCADR) callbacks[SETCADDR_x])(x, y);
return NULL;
}
SEXP SETCADDDR(SEXP x, SEXP y) {
TRACE0();
unimplemented("SETCADDDR");
SEXP result = ((call_SETCADR) callbacks[SETCADDDR_x])(x, y);
return NULL;
}
SEXP SETCAD4R(SEXP e, SEXP y) {
SEXP SETCAD4R(SEXP x, SEXP y) {
TRACE0();
unimplemented("SETCAD4R");
SEXP result = ((call_SETCADR) callbacks[SETCAD4R_x])(x, y);
return NULL;
}
......
52
53
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment