Skip to content
Snippets Groups Projects
Commit 0edabdf6 authored by Zbynek Slajchrt's avatar Zbynek Slajchrt
Browse files

Truffle boundary added at several places in FastR NFI

parent 55d3fd36
No related branches found
No related tags found
No related merge requests found
......@@ -1714,31 +1714,37 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
public abstract long execute(Object vector);
@Specialization
@TruffleBoundary
protected static long get(RIntVector vector) {
return vector.allocateNativeContents();
}
@Specialization
@TruffleBoundary
protected static long get(RLogicalVector vector) {
return vector.allocateNativeContents();
}
@Specialization
@TruffleBoundary
protected static long get(RRawVector vector) {
return vector.allocateNativeContents();
}
@Specialization
@TruffleBoundary
protected static long get(RDoubleVector vector) {
return vector.allocateNativeContents();
}
@Specialization
@TruffleBoundary
protected static long get(RComplexVector vector) {
return vector.allocateNativeContents();
}
@Specialization
@TruffleBoundary
protected static long get(CharSXPWrapper vector) {
return vector.allocateNativeContents();
}
......
......@@ -26,6 +26,7 @@ import static com.oracle.truffle.r.runtime.data.NativeDataAccess.readNativeStrin
import java.io.IOException;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.interop.ForeignAccess;
......@@ -45,6 +46,7 @@ public abstract class NewCustomConnectionNode extends FFIUpCallNode.Arg4 {
}
@Specialization
@TruffleBoundary
Object handleStrings(String description, String mode, String className, RExternalPtr connAddr) {
try {
return new NativeRConnection(description, mode, className, connAddr).asVector();
......@@ -58,6 +60,7 @@ public abstract class NewCustomConnectionNode extends FFIUpCallNode.Arg4 {
}
@Specialization
@TruffleBoundary
Object handleAddresses(TruffleObject description, TruffleObject mode, TruffleObject className, RExternalPtr connAddr,
@Cached("createAsPointerNode()") Node descriptionAsPtrNode, @Cached("createAsPointerNode()") Node modeAsPtrNode, @Cached("createAsPointerNode()") Node classNameAsPtrNode) {
try {
......
......@@ -172,8 +172,9 @@ public interface Engine {
RExpression parse(Source source) throws ParseException;
/**
* This is the external interface from {@link org.graalvm.polyglot.Context#eval(Source)}. It is
* required to return a {@link CallTarget} which may be cached for future use, and the
* This is the external interface from
* {@link org.graalvm.polyglot.Context#eval(org.graalvm.polyglot.Source)}. It is required to
* return a {@link CallTarget} which may be cached for future use, and the
* {@link org.graalvm.polyglot.Context} is responsible for actually invoking the call target.
*/
CallTarget parseToCallTarget(Source source, MaterializedFrame executionFrame) throws ParseException;
......
......@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
import java.nio.charset.StandardCharsets;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.r.runtime.RRuntime;
/**
......@@ -48,6 +49,7 @@ public final class CharSXPWrapper extends RObject implements RTruffleObject {
this.contents = contents;
}
@TruffleBoundary
public String getContents() {
if (this == NA) {
// The NA string may have been moved to the native space if someone called R_CHAR on it,
......@@ -58,10 +60,12 @@ public final class CharSXPWrapper extends RObject implements RTruffleObject {
return NativeDataAccess.getData(this, contents);
}
@TruffleBoundary
public byte getByteAt(int index) {
return NativeDataAccess.getDataAt(this, getBytes(), index);
}
@TruffleBoundary
public int getLength() {
return NativeDataAccess.getDataLength(this, getBytes());
}
......
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