Skip to content
Snippets Groups Projects
Commit f714a158 authored by Florian Angerer's avatar Florian Angerer
Browse files

Added missing RFFIUpCallNode annotations and did necessary refactoring.

parent 86ba66b9
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,12 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
private final Map<String, Object> nameSymbolCache = new ConcurrentHashMap<>();
private static RuntimeException implementedAsNode() {
throw RInternalError.shouldNotReachHere("upcall function is implemented via a node");
// TODO: Exception handling over native boundaries is currently missing. Once this works,
// remove the following two lines.
System.err.println("upcall function is implemented via a node");
System.exit(1);
return RInternalError.shouldNotReachHere("upcall function is implemented via a node");
}
// Checkstyle: stop method name check
......
......@@ -113,7 +113,7 @@ public final class MiscNodes {
}
@TypeSystemReference(RTypes.class)
abstract static class RDoSlotNode extends FFIUpCallNode.Arg2 {
public abstract static class RDoSlotNode extends FFIUpCallNode.Arg2 {
@Child private AccessSlotNode accessSlotNode;
......@@ -137,7 +137,7 @@ public final class MiscNodes {
}
@TypeSystemReference(RTypes.class)
abstract static class RDoSlotAssignNode extends FFIUpCallNode.Arg3 {
public abstract static class RDoSlotAssignNode extends FFIUpCallNode.Arg3 {
@Child private UpdateSlotNode updateSlotNode;
......@@ -166,7 +166,7 @@ public final class MiscNodes {
}
@TypeSystemReference(RTypes.class)
abstract static class RDoNewObjectNode extends FFIUpCallNode.Arg1 {
public abstract static class RDoNewObjectNode extends FFIUpCallNode.Arg1 {
@Child private NewObject newObjectNode;
......@@ -185,7 +185,7 @@ public final class MiscNodes {
}
@TypeSystemReference(RTypes.class)
abstract static class NamesGetsNode extends FFIUpCallNode.Arg2 {
public abstract static class NamesGetsNode extends FFIUpCallNode.Arg2 {
@Child private SetNamesAttributeNode setNamesNode;
......@@ -198,6 +198,10 @@ public final class MiscNodes {
setNamesNode.execute(vec, val);
return vec;
}
public static NamesGetsNode create() {
return MiscNodesFactory.NamesGetsNodeGen.create();
}
}
}
......@@ -24,13 +24,16 @@ package com.oracle.truffle.r.ffi.impl.nodes;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.r.runtime.nmath.MathFunctions;
import com.oracle.truffle.r.runtime.nmath.MathFunctions.Function3_1;
import com.oracle.truffle.r.runtime.nmath.MathFunctions.Function3_2;
import com.oracle.truffle.r.runtime.nmath.RandomFunctions;
import com.oracle.truffle.r.runtime.nmath.RandomFunctions.RandFunction2_Double;
import com.oracle.truffle.r.runtime.nmath.RandomFunctions.RandomNumberProvider;
import com.oracle.truffle.r.runtime.nmath.distr.Unif;
public final class RandFunctionsNodes {
public abstract static class RandFunction3_2Node extends FFIUpCallNode.Arg5 {
abstract static class RandFunction3_2Node extends FFIUpCallNode.Arg5 {
private final MathFunctions.Function3_2 inner;
protected RandFunction3_2Node(MathFunctions.Function3_2 inner) {
......@@ -43,7 +46,7 @@ public final class RandFunctionsNodes {
}
}
public abstract static class RandFunction3_1Node extends FFIUpCallNode.Arg4 {
abstract static class RandFunction3_1Node extends FFIUpCallNode.Arg4 {
private final MathFunctions.Function3_1 inner;
protected RandFunction3_1Node(MathFunctions.Function3_1 inner) {
......@@ -56,7 +59,7 @@ public final class RandFunctionsNodes {
}
}
public abstract static class RandFunction2Node extends FFIUpCallNode.Arg2 {
abstract static class RandFunction2Node extends FFIUpCallNode.Arg2 {
@Child private RandomFunctions.RandFunction2_Double inner;
protected RandFunction2Node(RandFunction2_Double inner) {
......@@ -69,4 +72,51 @@ public final class RandFunctionsNodes {
}
}
public abstract static class RunifNode extends RandFunction2Node {
protected RunifNode(RandFunction2_Double inner) {
super(inner);
}
public static RunifNode create() {
return RandFunctionsNodesFactory.RunifNodeGen.create(new Unif.Runif());
}
}
public abstract static class DunifNode extends RandFunction3_1Node {
protected DunifNode(Function3_1 inner) {
super(inner);
}
public static DunifNode create() {
return RandFunctionsNodesFactory.DunifNodeGen.create(new Unif.DUnif());
}
}
public abstract static class QunifNode extends RandFunction3_2Node {
protected QunifNode(Function3_2 inner) {
super(inner);
}
public static QunifNode create() {
return RandFunctionsNodesFactory.QunifNodeGen.create(new Unif.QUnif());
}
}
public abstract static class PunifNode extends RandFunction3_2Node {
protected PunifNode(Function3_2 inner) {
super(inner);
}
public static PunifNode create() {
return RandFunctionsNodesFactory.PunifNodeGen.create(new Unif.PUnif());
}
}
}
......@@ -37,7 +37,9 @@ import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodes.CARNode;
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.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.RandFunctionsNodes;
import com.oracle.truffle.r.ffi.processor.RFFICstring;
import com.oracle.truffle.r.ffi.processor.RFFIRunGC;
import com.oracle.truffle.r.ffi.processor.RFFIUpCallNode;
......@@ -96,6 +98,7 @@ public interface StdUpCallsRFFI {
Object R_do_MAKE_CLASS(@RFFICstring String clazz);
@RFFIUpCallNode(MiscNodes.RDoNewObjectNode.class)
Object R_do_new_object(Object classDef);
/**
......@@ -316,8 +319,10 @@ public interface StdUpCallsRFFI {
boolean isSeekable(Object x);
@RFFIUpCallNode(MiscNodes.RDoSlotNode.class)
Object R_do_slot(Object o, Object name);
@RFFIUpCallNode(MiscNodes.RDoSlotAssignNode.class)
Object R_do_slot_assign(Object o, Object name, Object value);
Object R_MethodsNamespace();
......@@ -326,14 +331,19 @@ public interface StdUpCallsRFFI {
int FASTR_getConnectionChar(Object obj);
@RFFIUpCallNode(RandFunctionsNodes.DunifNode.class)
double Rf_dunif(double a, double b, double c, int d);
@RFFIUpCallNode(RandFunctionsNodes.QunifNode.class)
double Rf_qunif(double a, double b, double c, int d, int e);
@RFFIUpCallNode(RandFunctionsNodes.PunifNode.class)
double Rf_punif(double a, double b, double c, int d, int e);
@RFFIUpCallNode(RandFunctionsNodes.RunifNode.class)
double Rf_runif(double a, double b);
@RFFIUpCallNode(MiscNodes.NamesGetsNode.class)
Object Rf_namesgets(Object vec, Object val);
@RFFIUpCallNode(CopyMostAttrib.class)
......
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