diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java index e549c05fa0e08f18113343d31eeb982aa6407660..3f5e404f7819f8c30e0f4c342261dca1d1c78fdd 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java @@ -69,6 +69,7 @@ import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.ExitException; import com.oracle.truffle.r.runtime.FastROptions; import com.oracle.truffle.r.runtime.JumpToTopLevelException; +import com.oracle.truffle.r.runtime.interop.R2Foreign; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RError; @@ -102,6 +103,7 @@ import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.env.REnvironment; +import com.oracle.truffle.r.runtime.interop.R2ForeignNodeGen; import com.oracle.truffle.r.runtime.nodes.RCodeBuilder; import com.oracle.truffle.r.runtime.nodes.RNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; @@ -335,6 +337,7 @@ final class REngine implements Engine, Engine.Timings { private final boolean printResult; @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode(); + @Child private R2Foreign r2Foreign = R2ForeignNodeGen.create(); @SuppressWarnings("deprecation") PolyglotEngineRootNode(List<RSyntaxNode> statements, SourceSection sourceSection, MaterializedFrame executionFrame) { @@ -367,7 +370,7 @@ final class REngine implements Engine, Engine.Timings { } lastValue = calls[i].call(new Object[]{executionFrame != null ? executionFrame : newContext.stateREnvironment.getGlobalFrame()}); } - return RRuntime.r2Java(lastValue); + return r2Foreign.execute(lastValue); } catch (ReturnException ex) { return ex.getResult(); } catch (DebugExitException | JumpToTopLevelException | ExitException | ThreadDeath e) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java index 9d55e2b44f1b2c1458e0db9300e163bfe05c36f5..237a24e80ab60e7c692c0ca282405dedac39c250 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java @@ -378,10 +378,10 @@ public class BasePackage extends RBuiltinPackage { add(FastRInterop.IsExecutable.class, FastRInteropFactory.IsExecutableNodeGen::create); add(FastRInterop.IsExternal.class, FastRInteropFactory.IsExternalNodeGen::create); add(FastRInterop.JavaClass.class, FastRInteropFactory.JavaClassNodeGen::create); - add(FastRInterop.IsJavaArray.class, FastRInteropFactory.IsJavaArrayNodeGen::create); + add(FastRInterop.IsForeignArray.class, FastRInteropFactory.IsForeignArrayNodeGen::create); add(FastRInterop.NewJavaArray.class, FastRInteropFactory.NewJavaArrayNodeGen::create); add(FastRInterop.ToJavaArray.class, FastRInteropFactory.ToJavaArrayNodeGen::create); - add(FastRInterop.FromJavaArray.class, FastRInteropFactory.FromJavaArrayNodeGen::create); + add(FastRInterop.FromForeignArray.class, FastRInteropFactory.FromForeignArrayNodeGen::create); add(FastRInterop.ToBoolean.class, FastRInteropFactory.ToBooleanNodeGen::create); add(FastRInterop.ToByte.class, FastRInteropFactory.ToByteNodeGen::create); add(FastRInterop.ToChar.class, FastRInteropFactory.ToCharNodeGen::create); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index 4c2f44c65435784378c9ac91b3fb8e3f55df718b..811be26c25978120aef478e5907385b1f6fb0bda 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -53,7 +53,6 @@ import com.oracle.truffle.api.interop.java.JavaInterop; import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.ConditionProfile; -import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.source.Source.Builder; import com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef; @@ -64,6 +63,8 @@ import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.rawValue; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.typeName; import com.oracle.truffle.r.nodes.builtin.NodeWithArgumentCasts.Casts; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.runtime.interop.Foreign2R; +import com.oracle.truffle.r.runtime.interop.R2Foreign; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RSource; @@ -87,6 +88,10 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; +import com.oracle.truffle.r.runtime.interop.Foreign2RNodeGen; +import com.oracle.truffle.r.runtime.interop.ForeignArray2R; +import com.oracle.truffle.r.runtime.interop.ForeignArray2RNodeGen; +import com.oracle.truffle.r.runtime.interop.R2ForeignNodeGen; import java.lang.reflect.Array; import java.util.logging.Level; import java.util.logging.Logger; @@ -199,13 +204,11 @@ public class FastRInterop { } @Specialization - @TruffleBoundary protected Object exportSymbol(@SuppressWarnings("unused") String name, @SuppressWarnings("unused") RMissing value) { throw error(RError.Message.ARGUMENT_MISSING, "value"); } @Fallback - @TruffleBoundary protected Object exportSymbol(@SuppressWarnings("unused") Object name, @SuppressWarnings("unused") Object value) { throw error(RError.Message.GENERIC, "only R language objects can be exported"); } @@ -279,7 +282,7 @@ public class FastRInterop { public abstract static class ToByte extends RBuiltinNode.Arg1 { static { - castToJavaNumberType(new Casts(ToByte.class)); + castToInteroptNumberType(new Casts(ToByte.class)); } @Specialization @@ -343,7 +346,7 @@ public class FastRInterop { public abstract static class ToFloat extends RBuiltinNode.Arg1 { static { - castToJavaNumberType(new Casts(ToFloat.class)); + castToInteroptNumberType(new Casts(ToFloat.class)); } @Specialization @@ -366,7 +369,7 @@ public class FastRInterop { public abstract static class ToLong extends RBuiltinNode.Arg1 { static { - castToJavaNumberType(new Casts(ToLong.class)); + castToInteroptNumberType(new Casts(ToLong.class)); } @Specialization @@ -389,7 +392,7 @@ public class FastRInterop { public abstract static class ToShort extends RBuiltinNode.Arg1 { static { - castToJavaNumberType(new Casts(ToShort.class)); + castToInteroptNumberType(new Casts(ToShort.class)); } @Specialization @@ -409,7 +412,7 @@ public class FastRInterop { } - private static void castToJavaNumberType(Casts casts) { + private static void castToInteroptNumberType(Casts casts) { casts.arg("value").mustBe(integerValue().or(doubleValue().or(rawValue())), RError.Message.INVALID_ARGUMENT_OF_TYPE, "value", Predef.typeName()).asVector().mustBe(singleElement()).findFirst(); } @@ -451,29 +454,24 @@ public class FastRInterop { } } - @ImportStatic({RRuntime.class}) - @RBuiltin(name = ".fastr.java.isArray", visibility = ON, kind = PRIMITIVE, parameterNames = {"obj"}, behavior = COMPLEX) - public abstract static class IsJavaArray extends RBuiltinNode.Arg1 { + @ImportStatic({Message.class, RRuntime.class}) + @RBuiltin(name = ".fastr.interop.isArray", visibility = ON, kind = PRIMITIVE, parameterNames = {"obj"}, behavior = COMPLEX) + public abstract static class IsForeignArray extends RBuiltinNode.Arg1 { static { - Casts.noCasts(IsJavaArray.class); + Casts.noCasts(IsForeignArray.class); } - private final ConditionProfile isJavaProfile = ConditionProfile.createBinaryProfile(); - private final ConditionProfile isArrayProfile = ConditionProfile.createBinaryProfile(); - @Specialization(guards = {"isForeignObject(obj)"}) @TruffleBoundary - public Object isArray(TruffleObject obj) { - // TODO does this return true only for java arrays, or also - // js arrays? - boolean result = isJavaProfile.profile(JavaInterop.isJavaObject(Object.class, obj)) && isArrayProfile.profile(JavaInterop.isArray(obj)); - return RRuntime.java2R(result); + public byte isArray(TruffleObject obj, + @Cached("HAS_SIZE.createNode()") Node hasSize) { + return RRuntime.asLogical(ForeignAccess.sendHasSize(hasSize, obj)); } @Fallback - public Object isArray(Object obj) { - return RRuntime.java2R(false); + public byte isArray(Object obj) { + return RRuntime.LOGICAL_FALSE; } } @@ -524,20 +522,23 @@ public class FastRInterop { @Specialization @TruffleBoundary - public Object toArray(RAbstractLogicalVector vec, @SuppressWarnings("unused") RMissing className, boolean flat) { - return toArray(vec, flat, boolean.class, (array, i) -> Array.set(array, i, RRuntime.r2Java(vec.getDataAt(i)))); + public Object toArray(RAbstractLogicalVector vec, @SuppressWarnings("unused") RMissing className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + return toArray(vec, flat, boolean.class, (array, i) -> Array.set(array, i, r2Foreign.execute(vec.getDataAt(i)))); } @Specialization @TruffleBoundary - public Object toArray(RAbstractLogicalVector vec, String className, boolean flat) { - return toArray(vec, flat, getClazz(className), (array, i) -> Array.set(array, i, RRuntime.r2Java(vec.getDataAt(i)))); + public Object toArray(RAbstractLogicalVector vec, String className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + return toArray(vec, flat, getClazz(className), (array, i) -> Array.set(array, i, r2Foreign.execute(vec.getDataAt(i)))); } @Specialization @TruffleBoundary - public Object toArray(RAbstractIntVector vec, @SuppressWarnings("unused") RMissing className, boolean flat) { - return toArray(vec, flat, int.class, (array, i) -> Array.set(array, i, RRuntime.r2Java(vec.getDataAt(i)))); + public Object toArray(RAbstractIntVector vec, @SuppressWarnings("unused") RMissing className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + return toArray(vec, flat, int.class, (array, i) -> Array.set(array, i, r2Foreign.execute(vec.getDataAt(i)))); } @Specialization @@ -572,28 +573,36 @@ public class FastRInterop { @Specialization @TruffleBoundary - public Object toArray(RAbstractVector vec, @SuppressWarnings("unused") RMissing className, boolean flat) { - return toArray(vec, flat, Object.class, (array, i) -> Array.set(array, i, RRuntime.r2Java(vec.getDataAtAsObject(i)))); + public Object toArray(RAbstractVector vec, @SuppressWarnings("unused") RMissing className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + return toArray(vec, flat, Object.class, (array, i) -> Array.set(array, i, r2Foreign.execute(vec.getDataAtAsObject(i)))); } @Specialization @TruffleBoundary - public Object toArray(RAbstractVector vec, String className, boolean flat) { - return toArray(vec, flat, getClazz(className), (array, i) -> Array.set(array, i, RRuntime.r2Java(vec.getDataAtAsObject(i)))); + public Object toArray(RAbstractVector vec, String className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + return toArray(vec, flat, getClazz(className), (array, i) -> Array.set(array, i, r2Foreign.execute(vec.getDataAtAsObject(i)))); } @Specialization @TruffleBoundary - public Object toArray(RInteropScalar ri, String className, boolean flat) { + public Object toArray(RInteropScalar ri, String className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { RList list = RDataFactory.createList(new Object[]{ri}); - return toArray(list, flat, getClazz(className), (array, i) -> Array.set(array, i, RRuntime.r2Java(list.getDataAt(i)))); + return toArray(list, flat, getClazz(className), (array, i) -> Array.set(array, i, r2Foreign.execute(list.getDataAt(i)))); } @Specialization @TruffleBoundary - public Object toArray(RInteropScalar ri, RMissing className, boolean flat) { + public Object toArray(RInteropScalar ri, RMissing className, boolean flat, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { RList list = RDataFactory.createList(new Object[]{ri}); - return toArray(list, flat, ri.getJavaType(), (array, i) -> Array.set(array, i, RRuntime.r2Java(list.getDataAt(i)))); + return toArray(list, flat, ri.getJavaType(), (array, i) -> Array.set(array, i, r2Foreign.execute(list.getDataAt(i)))); + } + + protected R2Foreign createR2Foreign() { + return R2ForeignNodeGen.create(); } private Class<?> getClazz(String className) throws RError { @@ -688,102 +697,35 @@ public class FastRInterop { } - @RBuiltin(name = ".fastr.java.fromArray", visibility = ON, kind = PRIMITIVE, parameterNames = {"array"}, behavior = COMPLEX) - public abstract static class FromJavaArray extends RBuiltinNode.Arg1 { - @Child Node getSize = Message.GET_SIZE.createNode(); - @Child Node read; - @Child Node isNull; - @Child Node isBoxed; - @Child Node unbox; + @ImportStatic({Message.class, RRuntime.class}) + @RBuiltin(name = ".fastr.interop.fromArray", visibility = ON, kind = PRIMITIVE, parameterNames = {"array"}, behavior = COMPLEX) + public abstract static class FromForeignArray extends RBuiltinNode.Arg1 { + static { - Casts casts = new Casts(FromJavaArray.class); + Casts casts = new Casts(FromForeignArray.class); casts.arg("array").mustNotBeMissing(); } - protected boolean isJavaArray(TruffleObject obj) { - return JavaInterop.isJavaObject(Object.class, obj) && JavaInterop.isArray(obj); + private final ConditionProfile isArrayProfile = ConditionProfile.createBinaryProfile(); + + protected ForeignArray2R createForeignArray2R(TruffleObject obj) { + return ForeignArray2RNodeGen.create(); } - @Specialization(guards = {"isJavaArray(obj)"}) + @Specialization(guards = {"isForeignObject(obj)"}) @TruffleBoundary - public Object fromArray(TruffleObject obj) { - int size; - try { - size = (int) ForeignAccess.sendGetSize(getSize, obj); - if (size == 0) { - return RDataFactory.createList(); - } - Object[] elements = new Object[size]; - boolean allBoolean = true; - boolean allInteger = true; - boolean allDouble = true; - boolean allString = true; - for (int i = 0; i < size; i++) { - if (read == null) { - read = insert(Message.READ.createNode()); - } - Object element = ForeignAccess.sendRead(read, obj, i); - if (element instanceof TruffleObject) { - if (isNull == null) { - isNull = insert(Message.IS_NULL.createNode()); - } - if (ForeignAccess.sendIsNull(isNull, (TruffleObject) element)) { - element = null; - } else { - if (isBoxed == null) { - isBoxed = insert(Message.IS_BOXED.createNode()); - } - if (ForeignAccess.sendIsBoxed(isBoxed, (TruffleObject) element)) { - if (unbox == null) { - unbox = insert(Message.UNBOX.createNode()); - } - element = ForeignAccess.sendIsBoxed(unbox, (TruffleObject) element); - } - } - } - allBoolean &= element instanceof Boolean; - allInteger &= element instanceof Byte || element instanceof Integer || element instanceof Short; - allDouble &= element instanceof Double || element instanceof Float || element instanceof Long; - allString &= element instanceof Character || element instanceof String; - - elements[i] = RRuntime.java2R(element); - } - if (allBoolean) { - byte[] ret = new byte[size]; - for (int i = 0; i < size; i++) { - ret[i] = ((Number) elements[i]).byteValue(); - } - return RDataFactory.createLogicalVector(ret, true); - } - if (allInteger) { - int[] ret = new int[size]; - for (int i = 0; i < size; i++) { - ret[i] = ((Number) elements[i]).intValue(); - } - return RDataFactory.createIntVector(ret, true); - } - if (allDouble) { - double[] ret = new double[size]; - for (int i = 0; i < size; i++) { - ret[i] = ((Number) elements[i]).doubleValue(); - } - return RDataFactory.createDoubleVector(ret, true); - } - if (allString) { - String[] ret = new String[size]; - for (int i = 0; i < size; i++) { - ret[i] = String.valueOf(elements[i]); - } - return RDataFactory.createStringVector(ret, true); - } - return RDataFactory.createList(elements); - } catch (UnsupportedMessageException | UnknownIdentifierException e) { - throw error(RError.Message.GENERIC, "error while converting array: " + e.getMessage()); + public Object fromArray(TruffleObject obj, + @Cached("HAS_SIZE.createNode()") Node hasSize, + @Cached("createForeignArray2R(obj)") ForeignArray2R array2R) { + if (isArrayProfile.profile(ForeignAccess.sendHasSize(hasSize, obj))) { + return array2R.execute(obj); + } else { + throw error(RError.Message.GENERIC, "not a java array"); } } @Fallback - public Object fromArray(@SuppressWarnings("unused") Object obj) { + public Object fromObject(Object obj) { throw error(RError.Message.GENERIC, "not a java array"); } } @@ -800,14 +742,16 @@ public class FastRInterop { @TruffleBoundary public Object interopNew(TruffleObject clazz, RArgsValuesAndNames args, @SuppressWarnings("unused") @Cached("args.getLength()") int length, - @Cached("createNew(length).createNode()") Node sendNew) { + @Cached("createNew(length).createNode()") Node sendNew, + @Cached("createR2Foreign()") R2Foreign r2Foreign, + @Cached("createForeign2R()") Foreign2R foreign2R) { try { Object[] argValues = new Object[args.getLength()]; for (int i = 0; i < argValues.length; i++) { - argValues[i] = RRuntime.r2Java(args.getArgument(i)); + argValues[i] = r2Foreign.execute(args.getArgument(i)); } Object result = ForeignAccess.sendNew(sendNew, clazz, argValues); - return RRuntime.java2R(result); + return foreign2R.execute(result); } catch (IllegalStateException | SecurityException | IllegalArgumentException | UnsupportedTypeException | ArityException | UnsupportedMessageException e) { String msg = isTesting ? "error during Java object instantiation" : "error during Java object instantiation: " + e.getMessage(); throw error(RError.Message.GENERIC, msg); @@ -818,6 +762,14 @@ public class FastRInterop { public Object interopNew(@SuppressWarnings("unused") Object clazz, @SuppressWarnings("unused") Object args) { throw error(RError.Message.GENERIC, "interop object needed as receiver of NEW message"); } + + protected R2Foreign createR2Foreign() { + return R2ForeignNodeGen.create(); + } + + protected Foreign2R createForeign2R() { + return Foreign2RNodeGen.create(); + } } @ImportStatic(RRuntime.class) diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java index ed622c1d7e981f2ab78fb34fb7678b752d39b7f2..6e05173990f1276a20f809c3861450de93d1e3cd 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java @@ -41,6 +41,7 @@ import com.oracle.truffle.r.nodes.binary.BoxPrimitiveNode; import com.oracle.truffle.r.nodes.profile.TruffleBoundaryNode; import com.oracle.truffle.r.nodes.unary.CastStringNode; import com.oracle.truffle.r.nodes.unary.FirstStringNode; +import com.oracle.truffle.r.runtime.interop.Foreign2R; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.data.RLogical; @@ -52,6 +53,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractListVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; +import com.oracle.truffle.r.runtime.interop.Foreign2RNodeGen; import com.oracle.truffle.r.runtime.nodes.RBaseNode; @ImportStatic({RRuntime.class, com.oracle.truffle.api.interop.Message.class}) @@ -103,6 +105,10 @@ public abstract class ExtractVectorNode extends RBaseNode { return FirstStringNode.createWithError(RError.Message.GENERIC, "Cannot coerce position to character for foreign access."); } + protected static Foreign2R createForeign2RNode() { + return Foreign2RNodeGen.create(); + } + @Specialization(guards = {"isForeignObject(object)", "positions.length == cachedLength"}) protected Object accessField(TruffleObject object, Object[] positions, @SuppressWarnings("unused") Object exact, @SuppressWarnings("unused") Object dropDimensions, @Cached("READ.createNode()") Node foreignRead, @@ -113,7 +119,8 @@ public abstract class ExtractVectorNode extends RBaseNode { @Cached("createClassProfile()") ValueProfile positionProfile, @Cached("IS_NULL.createNode()") Node isNullNode, @Cached("IS_BOXED.createNode()") Node isBoxedNode, - @Cached("UNBOX.createNode()") Node unboxNode) { + @Cached("UNBOX.createNode()") Node unboxNode, + @Cached("createForeign2RNode()") Foreign2R foreign2RNode) { if (positions.length == 0) { throw error(RError.Message.GENERIC, "No positions for foreign access."); } @@ -128,7 +135,7 @@ public abstract class ExtractVectorNode extends RBaseNode { assert result instanceof TruffleObject; } } - return unbox(result, isNullNode, isBoxedNode, unboxNode); + return unbox(result, isNullNode, isBoxedNode, unboxNode, foreign2RNode); } catch (UnknownIdentifierException | NoSuchFieldError e) { throw RError.interopError(RError.findParentRBase(this), e, object); } @@ -137,16 +144,16 @@ public abstract class ExtractVectorNode extends RBaseNode { } } - private Object unbox(Object obj, Node isNullNode, Node isBoxedNode, Node unboxNode) throws UnsupportedMessageException { + private Object unbox(Object obj, Node isNullNode, Node isBoxedNode, Node unboxNode, Foreign2R foreign2RNode) throws UnsupportedMessageException { if (RRuntime.isForeignObject(obj)) { if (ForeignAccess.sendIsNull(isNullNode, (TruffleObject) obj)) { return RNull.instance; } if (ForeignAccess.sendIsBoxed(isBoxedNode, (TruffleObject) obj)) { - return RRuntime.java2R(ForeignAccess.sendUnbox(unboxNode, (TruffleObject) obj)); + return foreign2RNode.execute(ForeignAccess.sendUnbox(unboxNode, (TruffleObject) obj)); } } - return RRuntime.java2R(obj); + return foreign2RNode.execute(obj); } public static Object read(RBaseNode caller, Object position, Node foreignRead, Node keyInfoNode, TruffleObject object, FirstStringNode firstString, CastStringNode castNode) diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java index f7af44de9b258d219caaac2fa85cf83f403c2c9f..360b51e94ea27ec900c54b20e8e1b135b6295b2b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java @@ -39,6 +39,7 @@ import com.oracle.truffle.r.nodes.binary.BoxPrimitiveNode; import com.oracle.truffle.r.nodes.profile.TruffleBoundaryNode; import com.oracle.truffle.r.nodes.unary.CastStringNode; import com.oracle.truffle.r.nodes.unary.FirstStringNode; +import com.oracle.truffle.r.runtime.interop.R2Foreign; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.data.RTypedValue; @@ -47,6 +48,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractListVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.nodes.RBaseNode; +import com.oracle.truffle.r.runtime.interop.R2ForeignNodeGen; /** * Syntax node for element writes. @@ -98,6 +100,10 @@ public abstract class ReplaceVectorNode extends RBaseNode { return FirstStringNode.createWithError(RError.Message.GENERIC, "Cannot corce position to character for foreign access."); } + protected R2Foreign createR2Foreign() { + return R2ForeignNodeGen.create(); + } + @Specialization(guards = {"isForeignObject(object)", "positions.length == cachedLength"}) protected Object accessField(TruffleObject object, Object[] positions, Object value, @Cached("WRITE.createNode()") Node foreignWrite, @@ -105,21 +111,22 @@ public abstract class ReplaceVectorNode extends RBaseNode { @Cached("KEY_INFO.createNode()") Node keyInfo, @SuppressWarnings("unused") @Cached("positions.length") int cachedLength, @Cached("create()") CastStringNode castNode, - @Cached("createFirstString()") FirstStringNode firstString) { - Object writtenValue = RRuntime.r2Java(value); + @Cached("createFirstString()") FirstStringNode firstString, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + Object writtenValue = value; try { TruffleObject result = object; for (int i = 0; i < positions.length - 1; i++) { result = (TruffleObject) ExtractVectorNode.read(this, positions[i], foreignRead, keyInfo, result, firstString, castNode); } - write(positions[positions.length - 1], foreignWrite, keyInfo, result, writtenValue, firstString, castNode); + write(positions[positions.length - 1], foreignWrite, keyInfo, result, writtenValue, firstString, castNode, r2Foreign); return object; } catch (InteropException e) { throw RError.interopError(RError.findParentRBase(this), e, object); } } - private void write(Object position, Node foreignWrite, Node keyInfoNode, TruffleObject object, Object writtenValue, FirstStringNode firstString, CastStringNode castNode) + private void write(Object position, Node foreignWrite, Node keyInfoNode, TruffleObject object, Object writtenValue, FirstStringNode firstString, CastStringNode castNode, R2Foreign r2Foreign) throws InteropException, RError { if (position instanceof Integer) { position = ((Integer) position) - 1; @@ -138,13 +145,13 @@ public abstract class ReplaceVectorNode extends RBaseNode { int info = ForeignAccess.sendKeyInfo(keyInfoNode, object, position); if (KeyInfo.isWritable(info)) { - ForeignAccess.sendWrite(foreignWrite, object, position, RRuntime.r2Java(writtenValue)); + ForeignAccess.sendWrite(foreignWrite, object, position, r2Foreign.execute(writtenValue)); return; } else if (position instanceof String && !KeyInfo.isExisting(info) && JavaInterop.isJavaObject(Object.class, object)) { TruffleObject clazz = JavaInterop.toJavaClass(object); info = ForeignAccess.sendKeyInfo(keyInfoNode, clazz, position); if (KeyInfo.isWritable(info)) { - ForeignAccess.sendWrite(foreignWrite, clazz, position, RRuntime.r2Java(writtenValue)); + ForeignAccess.sendWrite(foreignWrite, clazz, position, r2Foreign.execute(writtenValue)); return; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java index ea692637ede82a350f5340d74e004d14157f6d00..d74469a35924170b770981b7bb0a0ca2a47e0336 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java @@ -70,6 +70,8 @@ import com.oracle.truffle.r.nodes.profile.TruffleBoundaryNode; import com.oracle.truffle.r.nodes.profile.VectorLengthProfile; import com.oracle.truffle.r.runtime.Arguments; import com.oracle.truffle.r.runtime.ArgumentsSignature; +import com.oracle.truffle.r.runtime.interop.Foreign2R; +import com.oracle.truffle.r.runtime.interop.R2Foreign; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RArguments.S3Args; import com.oracle.truffle.r.runtime.RArguments.S3DefaultArguments; @@ -97,9 +99,10 @@ import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPromise; import com.oracle.truffle.r.runtime.data.RPromise.Closure; import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.env.REnvironment; import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor; +import com.oracle.truffle.r.runtime.interop.Foreign2RNodeGen; +import com.oracle.truffle.r.runtime.interop.R2ForeignNodeGen; import com.oracle.truffle.r.runtime.nodes.RBaseNode; import com.oracle.truffle.r.runtime.nodes.RFastPathNode; import com.oracle.truffle.r.runtime.nodes.RNode; @@ -543,7 +546,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS this.arguments = arguments; } - public Object execute(VirtualFrame frame, TruffleObject function) { + public Object execute(VirtualFrame frame, TruffleObject function, Foreign2R foreign2R, R2Foreign r2Foreign) { Object[] argumentsArray = explicitArgs != null ? ((RArgsValuesAndNames) explicitArgs.execute(frame)).getArguments() : arguments.evaluateFlattenObjects(frame, lookupVarArgs(frame)); if (foreignCall == null || foreignCallArgCount != argumentsArray.length) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -551,7 +554,10 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS foreignCallArgCount = argumentsArray.length; } try { - Object result = ForeignAccess.sendExecute(foreignCall, function, RRuntime.r2Java(argumentsArray)); + for (int i = 0; i < argumentsArray.length; i++) { + argumentsArray[i] = r2Foreign.execute(argumentsArray[i]); + } + Object result = ForeignAccess.sendExecute(foreignCall, function, argumentsArray); if (RRuntime.isForeignObject(result)) { if (isNullCall == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -561,7 +567,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS return RNull.instance; } } - return RRuntime.java2R(result); + return foreign2R.execute(result); } catch (ArityException | UnsupportedMessageException | UnsupportedTypeException e) { CompilerDirectives.transferToInterpreter(); RInternalError.reportError(e); @@ -574,14 +580,24 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS return new ForeignCall(createArguments(null, true, true)); } - protected static boolean isRTypedValue(Object value) { - return value instanceof RTypedValue; + protected static boolean isForeignObject(Object value) { + return RRuntime.isForeignObject(value); + } + + protected static Foreign2R createR2ForeignNode() { + return Foreign2RNodeGen.create(); + } + + protected R2Foreign createR2Foreign() { + return R2ForeignNodeGen.create(); } - @Specialization(guards = "!isRTypedValue(function)") + @Specialization(guards = "isForeignObject(function)") public Object call(VirtualFrame frame, TruffleObject function, - @Cached("createForeignCall()") ForeignCall foreignCall) { - return foreignCall.execute(frame, function); + @Cached("createForeignCall()") ForeignCall foreignCall, + @Cached("createR2ForeignNode()") Foreign2R foreign2RNode, + @Cached("createR2Foreign()") R2Foreign r2Foreign) { + return foreignCall.execute(frame, function, foreign2RNode, r2Foreign); } @TruffleBoundary diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java index 28425664c60a0e00e51f826fd6d7fed07ac1ec27..44840b3042121983a78a2462f947c02a7ff23733 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java @@ -20,32 +20,25 @@ import com.oracle.truffle.api.frame.FrameDescriptor; import com.oracle.truffle.api.frame.FrameSlotKind; import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.interop.ForeignAccess; import com.oracle.truffle.api.interop.TruffleObject; -import com.oracle.truffle.api.interop.java.JavaInterop; +import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RDouble; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.data.RInteger; -import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropByte; -import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropChar; -import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropFloat; -import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropLong; -import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropShort; import com.oracle.truffle.r.runtime.data.RLogical; -import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RRaw; import com.oracle.truffle.r.runtime.data.RString; 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.model.RAbstractAtomicVector; import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; -import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor; @@ -927,66 +920,4 @@ public class RRuntime { return xa.hasDimensions(); } - public static Object java2R(Object obj) { - if (obj == null) { - obj = RNull.instance; - } else if (obj instanceof Boolean) { - obj = RRuntime.asLogical((boolean) obj); - } else if (obj instanceof Byte) { - obj = ((Byte) obj).intValue(); - } else if (obj instanceof Short) { - obj = ((Short) obj).intValue(); - } else if (obj instanceof Long) { - obj = (((Long) obj).doubleValue()); - } else if (obj instanceof Float) { - obj = (((Float) obj).doubleValue()); - } else if (obj instanceof Character) { - obj = ((Character) obj).toString(); - } - return obj; - } - - public static Object[] r2Java(Object[] objects) { - Object[] ret = new Object[objects.length]; - for (int i = 0; i < objects.length; i++) { - ret[i] = RRuntime.r2Java(objects[i]); - } - return ret; - } - - public static Object r2Java(Object obj) { - if (obj == RNull.instance) { - return JavaInterop.asTruffleObject(null); - } else if (obj instanceof Byte) { - return RRuntime.fromLogical((byte) obj); - } else if (obj instanceof RInteropByte) { - return ((RInteropByte) obj).getValue(); - } else if (obj instanceof RInteropChar) { - return ((RInteropChar) obj).getValue(); - } else if (obj instanceof RInteropFloat) { - return ((RInteropFloat) obj).getValue(); - } else if (obj instanceof RInteropLong) { - return ((RInteropLong) obj).getValue(); - } else if (obj instanceof RInteropShort) { - return ((RInteropShort) obj).getValue(); - } else if (obj instanceof RAbstractAtomicVector && ((RAbstractAtomicVector) obj).getLength() == 1) { - if (obj instanceof RAbstractDoubleVector) { - RAbstractDoubleVector v = (RAbstractDoubleVector) obj; - return v.getDataAt(0); - } else if (obj instanceof RAbstractIntVector) { - RAbstractIntVector v = (RAbstractIntVector) obj; - return v.getDataAt(0); - } else if (obj instanceof RAbstractLogicalVector) { - RAbstractLogicalVector v = (RAbstractLogicalVector) obj; - return v.getDataAt(0) == RRuntime.LOGICAL_TRUE; - } else if (obj instanceof RAbstractRawVector) { - RAbstractRawVector v = (RAbstractRawVector) obj; - return v.getDataAt(0).getValue(); - } else if (obj instanceof RAbstractStringVector) { - RAbstractStringVector v = (RAbstractStringVector) obj; - return v.getDataAt(0); - } - } - return obj; - } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java index e4bdde9ff45ac1d7c3b801028d1081d55d32fcf8..1ea5e337e3abe7c577758b292bbb129f85b0e918 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java @@ -33,6 +33,7 @@ import java.nio.file.Paths; import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.runtime.RSrcref.SrcrefFields; +import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.env.REnvironment; /** @@ -195,14 +196,22 @@ public class RSource { * Create an (external) source from an R srcfile ({@link RSrcref#createSrcfile(String)}). */ public static Source fromSrcfile(REnvironment env) throws IOException { - Path filename = Paths.get((String) RRuntime.r2Java(env.get(SrcrefFields.filename.name()))); + Path filename = Paths.get(getPath(env, SrcrefFields.filename.name())); if (filename.isAbsolute()) { return fromFileName(filename.toString(), false); } - Path wd = Paths.get((String) RRuntime.r2Java(env.get(SrcrefFields.wd.name()))); + Path wd = Paths.get(getPath(env, SrcrefFields.wd.name())); return fromFileName(wd.resolve(filename).toString(), false); } + private static String getPath(REnvironment env, String name) { + Object o = env.get(name); + if (o instanceof RAbstractStringVector) { + return ((RAbstractStringVector) o).getDataAt(0); + } + return (String) o; + } + /** * Create an unknown source with the given name. */ diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/Foreign2R.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/Foreign2R.java new file mode 100644 index 0000000000000000000000000000000000000000..55e135df2cc7b1126d71414b3d3c0ac201bac130 --- /dev/null +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/Foreign2R.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 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.runtime.interop; + +import com.oracle.truffle.api.dsl.Fallback; +import com.oracle.truffle.api.dsl.ImportStatic; +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.interop.Message; +import com.oracle.truffle.r.runtime.RRuntime; +import com.oracle.truffle.r.runtime.data.RNull; +import com.oracle.truffle.r.runtime.nodes.RBaseNode; + +@ImportStatic(Message.class) +public abstract class Foreign2R extends RBaseNode { + + public abstract Object execute(Object obj); + + @Specialization + public byte doBoolean(Boolean obj) { + return RRuntime.asLogical((boolean) obj); + } + + @Specialization + public int doByte(byte obj) { + return ((Byte) obj).intValue(); + } + + @Specialization + public int doShort(short obj) { + return ((Short) obj).intValue(); + } + + @Specialization + public double doLong(long obj) { + return (((Long) obj).doubleValue()); + } + + @Specialization + public double doFloat(float obj) { + return (((Float) obj).doubleValue()); + } + + @Specialization + public String doChar(char obj) { + return ((Character) obj).toString(); + } + + @Specialization(guards = "isNull(obj)") + public RNull doNull(Object obj) { + return RNull.instance; + } + + @Fallback + public Object doObject(Object obj) { + return obj; + } + + protected boolean isNull(Object o) { + return o == null; + } +} diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java new file mode 100644 index 0000000000000000000000000000000000000000..a34174b0cdac5725bae3681b02601dac0b4e27ba --- /dev/null +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2017, 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.runtime.interop; + +import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.Fallback; +import com.oracle.truffle.api.dsl.ImportStatic; +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.interop.ForeignAccess; +import com.oracle.truffle.api.interop.Message; +import com.oracle.truffle.api.interop.TruffleObject; +import com.oracle.truffle.api.interop.UnknownIdentifierException; +import com.oracle.truffle.api.interop.UnsupportedMessageException; +import com.oracle.truffle.api.nodes.Node; +import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RRuntime; +import com.oracle.truffle.r.runtime.data.RDataFactory; +import com.oracle.truffle.r.runtime.nodes.RBaseNode; + +@ImportStatic({Message.class, RRuntime.class}) +public abstract class ForeignArray2R extends RBaseNode { + + @Child private Foreign2R foreign2R; + @Child private Node hasSize = Message.HAS_SIZE.createNode(); + @Child private Node getSize; + @Child private Node read; + @Child private Node isNull; + @Child private Node isBoxed; + @Child private Node unbox; + + private final ConditionProfile isArrayProfile = ConditionProfile.createBinaryProfile(); + + public abstract Object execute(Object obj); + + @Specialization(guards = "isForeignObject(obj)") + @TruffleBoundary + public Object array2r(TruffleObject obj) { + if (!isArrayProfile.profile(ForeignAccess.sendHasSize(hasSize, obj))) { + return obj; + } + if (getSize == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + getSize = insert(Message.GET_SIZE.createNode()); + } + int size; + try { + size = (int) ForeignAccess.sendGetSize(getSize, obj); + if (size == 0) { + return RDataFactory.createList(); + } + Object[] elements = new Object[size]; + boolean allBoolean = true; + boolean allInteger = true; + boolean allDouble = true; + boolean allString = true; + for (int i = 0; i < size; i++) { + if (read == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + read = insert(Message.READ.createNode()); + } + Object element = ForeignAccess.sendRead(read, obj, i); + if (element instanceof TruffleObject) { + if (isNull == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + isNull = insert(Message.IS_NULL.createNode()); + } + if (ForeignAccess.sendIsNull(isNull, (TruffleObject) element)) { + element = null; + } else { + if (isBoxed == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + isBoxed = insert(Message.IS_BOXED.createNode()); + } + if (ForeignAccess.sendIsBoxed(isBoxed, (TruffleObject) element)) { + if (unbox == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + unbox = insert(Message.UNBOX.createNode()); + } + element = ForeignAccess.sendIsBoxed(unbox, (TruffleObject) element); + } + } + } + allBoolean &= element instanceof Boolean; + allInteger &= element instanceof Byte || element instanceof Integer || element instanceof Short; + allDouble &= element instanceof Double || element instanceof Float || element instanceof Long; + allString &= element instanceof Character || element instanceof String; + + if (foreign2R == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + foreign2R = insert(Foreign2RNodeGen.create()); + } + elements[i] = foreign2R.execute(element); + } + + if (allBoolean) { + byte[] ret = new byte[size]; + for (int i = 0; i < size; i++) { + ret[i] = ((Number) elements[i]).byteValue(); + } + return RDataFactory.createLogicalVector(ret, true); + } + if (allInteger) { + int[] ret = new int[size]; + for (int i = 0; i < size; i++) { + ret[i] = ((Number) elements[i]).intValue(); + } + return RDataFactory.createIntVector(ret, true); + } + if (allDouble) { + double[] ret = new double[size]; + for (int i = 0; i < size; i++) { + ret[i] = ((Number) elements[i]).doubleValue(); + } + return RDataFactory.createDoubleVector(ret, true); + } + if (allString) { + String[] ret = new String[size]; + for (int i = 0; i < size; i++) { + ret[i] = String.valueOf(elements[i]); + } + return RDataFactory.createStringVector(ret, true); + } + return RDataFactory.createList(elements); + } catch (UnsupportedMessageException | UnknownIdentifierException e) { + throw error(RError.Message.GENERIC, "error while converting array: " + e.getMessage()); + } + } + + @Fallback + public Object object2r(Object obj) { + return obj; + } + +} diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/R2Foreign.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/R2Foreign.java new file mode 100644 index 0000000000000000000000000000000000000000..4b939950027f77ccaaed847e9387bc0fd3d4ac7e --- /dev/null +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/R2Foreign.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2017, 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.runtime.interop; + +import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Fallback; +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.interop.TruffleObject; +import com.oracle.truffle.api.interop.java.JavaInterop; +import com.oracle.truffle.r.runtime.RRuntime; +import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropByte; +import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropChar; +import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropFloat; +import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropLong; +import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropShort; +import com.oracle.truffle.r.runtime.data.RNull; +import com.oracle.truffle.r.runtime.data.RRaw; +import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; +import com.oracle.truffle.r.runtime.nodes.RBaseNode; + +public abstract class R2Foreign extends RBaseNode { + + public abstract Object execute(Object obj); + + @Specialization + public boolean doByte(byte obj) { + return RRuntime.fromLogical(obj); + } + + @Specialization() + public double doDouble(double vec) { + return vec; + } + + @Specialization() + public int doInt(int vec) { + return vec; + } + + @Specialization() + public String doString(String vec) { + return vec; + } + + @Specialization() + public byte doRaw(RRaw vec) { + return vec.getValue(); + } + + @Specialization(guards = "length == 1") + public double doDoubleVector(RAbstractDoubleVector vec, + @Cached("vec.getLength()") @SuppressWarnings("unused") int length) { + return vec.getDataAt(0); + } + + @Specialization(guards = "length == 1") + public int doIntVector(RAbstractIntVector vec, + @Cached("vec.getLength()") @SuppressWarnings("unused") int length) { + return vec.getDataAt(0); + } + + @Specialization(guards = "length == 1") + public boolean doLogicalVector(RAbstractLogicalVector vec, + @Cached("vec.getLength()") @SuppressWarnings("unused") int length) { + return vec.getDataAt(0) == RRuntime.LOGICAL_TRUE; + } + + @Specialization(guards = "length == 1") + public byte doRawVector(RAbstractRawVector vec, + @Cached("vec.getLength()") @SuppressWarnings("unused") int length) { + return vec.getDataAt(0).getValue(); + } + + @Specialization(guards = "length == 1") + public String doStrignVector(RAbstractStringVector vec, + @Cached("vec.getLength()") @SuppressWarnings("unused") int length) { + return vec.getDataAt(0); + } + + @Specialization + public byte doInteroptByte(RInteropByte obj) { + return obj.getValue(); + } + + @Specialization + public char doInteroptChar(RInteropChar obj) { + return obj.getValue(); + } + + @Specialization + public float doInteroptFloat(RInteropFloat obj) { + return obj.getValue(); + } + + @Specialization + public long doInteroptLong(RInteropLong obj) { + return obj.getValue(); + } + + @Specialization + public short doInteroptShort(RInteropShort obj) { + return obj.getValue(); + } + + @Specialization + public TruffleObject doNull(RNull obj) { + // TODO this is java interop specific + return JavaInterop.asTruffleObject(null); + } + + @Fallback + public static Object doObject(Object obj) { + return obj; + } + +} 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 87d5a1c6072eab10037e2a8c78bb5c67f766746b..3a5507a2578e0f5204e6d68e6cac6b5d8959cc3f 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 @@ -130696,11 +130696,11 @@ $stringValue [1] "a" "" "foo" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testAllTypes# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "true127a32767214748364792233720368547758071.7976931348623157E3083.4028235E38testString" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$allTypesMethod(TRUE,127,"a",32767,2147483647,9223372036854775807,1.7976931348623157E308,3.4028235E38,"testString") } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "true127a32767214748364792233720368547758071.7976931348623157E3083.4028235E38testString" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$allTypesMethod(TRUE,127,"a",32767,2147483647,9223372036854775807,1.7976931348623157E308,3.4028235E38,"testString") } [1] "true127a32767214748364792233720368547758071.7976931348623157E3083.4028235E38testString" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testAllTypes# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "true127a32767214748364792233720368547758071.7976931348623157E3083.4028235E38testString" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$allTypesStaticMethod(TRUE,127,"a",32767,2147483647,9223372036854775807,1.7976931348623157E308,3.4028235E38,"testString") } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "true127a32767214748364792233720368547758071.7976931348623157E3083.4028235E38testString" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$allTypesStaticMethod(TRUE,127,"a",32767,2147483647,9223372036854775807,1.7976931348623157E308,3.4028235E38,"testString") } [1] "true127a32767214748364792233720368547758071.7976931348623157E3083.4028235E38testString" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# @@ -130712,11 +130712,11 @@ $stringValue [1] 1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldIntArray[1]; } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldIntArray[1]; } [1] 1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldIntArray[[1]]; } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldIntArray[[1]]; } [1] 1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# @@ -130728,40 +130728,40 @@ $stringValue [1] 123 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 123 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldIntArray[1] <- 123L; t$fieldIntArray[1] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 123 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldIntArray[1] <- 123L; to$fieldIntArray[1] } [1] 123 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1234 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldIntArray[[1]] <- 1234L; t$fieldIntArray[[1]] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1234 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldIntArray[[1]] <- 1234L; to$fieldIntArray[[1]] } [1] 1234 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1234 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$int2DimArray[1,2] <- 1234L; t$int2DimArray[1,2] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1234 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$int2DimArray[1,2] <- 1234L; to$int2DimArray[1,2] } [1] 1234 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 12345 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$int2DimArray[[1,2]] <- 12345L; t$int2DimArray[[1,2]] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 12345 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$int2DimArray[[1,2]] <- 12345L; to$int2DimArray[[1,2]] } [1] 12345 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$int2DimArray[1,2] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$int2DimArray[1,2] } [1] 2 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$int2DimArray[[1,2]] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$int2DimArray[[1,2]] } [1] 2 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStringArray[1] <- NULL; t$fieldStringArray[1] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStringArray[1] <- NULL; to$fieldStringArray[1] } NULL ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$int2DimArray[1] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$int2DimArray[1] } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testArrayReadWrite# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$int2DimArray[[1]] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$int2DimArray[[1]] } [external object] [1] 1 2 3 @@ -130778,7 +130778,7 @@ Error in attr(to, "a") <- "a" : external object cannot be attributed Error in attr(to, which = "a") : external object cannot be attributed ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testClassAsParameter#Ignored.ImplementationError# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$classAsArg(tc) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$classAsArg(.fastr.java.class(com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass)) } [1] "com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testCombineInteropTypes# @@ -130798,377 +130798,377 @@ Error in attr(to, which = "a") : external object cannot be attributed [1] "list" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testCombineInteropTypes# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'list' } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); class(c(1, t)) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'list' } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t1 <- .fastr.interop.new(tc); class(c(t, t1)) } [1] "list" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testCombineInteropTypes# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'list' } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); class(c(t, 1)) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'list' } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); class(c(1, t)) } [1] "list" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testCombineInteropTypes# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'list' } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t1 <- .fastr.interop.new(tc); class(c(t, t1)) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'list' } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); class(c(t, 1)) } [1] "list" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testCombineInteropTypes# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'truffle.object' } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); class(c(t)) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 'truffle.object' } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); class(c(to)) } [1] "truffle.object" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticStringObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticStringObject } [1] "a string" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStringObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStringObject } [1] "a string" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldChar } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldChar } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldCharObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldCharObject } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticChar } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticChar } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticCharObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticCharObject } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldDouble } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldDouble } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldDoubleObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldDoubleObject } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticDouble } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticDouble } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticDoubleObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticDoubleObject } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldByte } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldByte } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldByteObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldByteObject } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticByte } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticByte } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticByteObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticByteObject } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldInteger } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldInteger } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldIntegerObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldIntegerObject } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticInteger } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticInteger } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticIntegerObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticIntegerObject } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldFloat } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldFloat } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldFloatObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldFloatObject } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticFloat } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticFloat } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticFloatObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticFloatObject } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldShort } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldShort } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldShortObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldShortObject } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticShort } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticShort } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticShortObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticShortObject } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldLong } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldLong } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldLongObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldLongObject } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticLong } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticLong } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticLongObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticLongObject } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldNullObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldNullObject } NULL ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticNullObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticNullObject } NULL ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NaN } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticNaN } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NaN } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticNaN } [1] NaN ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NaN } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticNaNObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NaN } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticNaNObject } [1] NaN ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldBoolean } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldBoolean } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldBooleanObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldBooleanObject } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticBoolean } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticBoolean } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticBooleanObject } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticBooleanObject } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] TRUE FALSE TRUE\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldBooleanArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] TRUE FALSE TRUE\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldBooleanArray } [external object] [1] TRUE FALSE TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] TRUE FALSE TRUE\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticBooleanArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] TRUE FALSE TRUE\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticBooleanArray } [external object] [1] TRUE FALSE TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldCharArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldCharArray } [external object] [1] "a" "b" "c" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticCharArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticCharArray } [external object] [1] "a" "b" "c" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticStringArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticStringArray } [external object] [1] "a" "b" "c" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStringArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStringArray } [external object] [1] "a" "b" "c" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldByteArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldByteArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldIntArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldIntArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldLongArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldLongArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldShortArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldShortArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticByteArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticByteArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticIntArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticIntArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticLongArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticLongArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticShortArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticShortArray } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldDoubleArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldDoubleArray } [external object] [1] 1.1 2.1 3.1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldFloatArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldFloatArray } [external object] [1] 1.1 2.1 3.1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticDoubleArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticDoubleArray } [external object] [1] 1.1 2.1 3.1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFields# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$fieldStaticFloatArray } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1.1 2.1 3.1\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$fieldStaticFloatArray } [external object] [1] 1.1 2.1 3.1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "character" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticCharArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "character" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticCharArray); typeof(v) } [1] "character" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "character" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticStringArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "character" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticStringArray); typeof(v) } [1] "character" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticDoubleArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticDoubleArray); typeof(v) } [1] "double" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticFloatArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticFloatArray); typeof(v) } [1] "double" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticLongArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticLongArray); typeof(v) } [1] "double" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$objectDoubleArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "double" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$objectDoubleArray); typeof(v) } [1] "double" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticByteArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticByteArray); typeof(v) } [1] "integer" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticIntArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticIntArray); typeof(v) } [1] "integer" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticShortArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticShortArray); typeof(v) } [1] "integer" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$objectIntArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "integer" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$objectIntArray); typeof(v) } [1] "integer" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "logical" } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticBooleanArray); typeof(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "logical" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticBooleanArray); typeof(v) } [1] "logical" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticBooleanArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticBooleanArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticByteArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticByteArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticCharArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticCharArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticDoubleArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticDoubleArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticFloatArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticFloatArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticIntArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticIntArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticLongArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticLongArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticShortArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticShortArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$fieldStaticStringArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$fieldStaticStringArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$hasNullIntArray); is.list(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$hasNullIntArray); is.list(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$mixedTypesArray); is.list(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$mixedTypesArray); is.list(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$objectArray); is.list(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$objectArray); is.list(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$objectDoubleArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$objectDoubleArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$objectIntArray); is.vector(v) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$objectIntArray); is.vector(v) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { list(1) } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$hasNullIntArray); v[1] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { list(1) } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$hasNullIntArray); v[1] } [[1]] [1] 1 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { list(3) } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$hasNullIntArray); v[3] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { list(3) } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$hasNullIntArray); v[3] } [[1]] [1] 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testFromArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { list(NULL) } else { t <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.java.fromArray(t$hasNullIntArray); v[2] } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { list(NULL) } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); v <- .fastr.interop.fromArray(to$hasNullIntArray); v[2] } [[1]] NULL @@ -131417,166 +131417,166 @@ Error in is.nan(to) : default method not implemented for type 'external object' ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticStringObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticStringObject() } [1] "a string" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStringObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a string" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStringObject() } [1] "a string" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodChar() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodChar() } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodCharObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodCharObject() } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticChar() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticChar() } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticCharObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { "a" } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticCharObject() } [1] "a" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodDouble() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodDouble() } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodDoubleObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodDoubleObject() } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticDouble() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticDouble() } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticDoubleObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 1.7976931348623157E308 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticDoubleObject() } [1] 1.797693e+308 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodByte() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodByte() } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodByteObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodByteObject() } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticByte() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticByte() } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticByteObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 127 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticByteObject() } [1] 127 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodInteger() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodInteger() } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodIntegerObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodIntegerObject() } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticInteger() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticInteger() } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticIntegerObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 2147483647 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticIntegerObject() } [1] 2147483647 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodFloat() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodFloat() } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodFloatObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodFloatObject() } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticFloat() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticFloat() } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticFloatObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 3.4028235E38 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticFloatObject() } [1] 3.402823e+38 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodShort() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodShort() } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodShortObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodShortObject() } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticShort() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticShort() } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticShortObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 32767 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticShortObject() } [1] 32767 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodLong() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodLong() } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodLongObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodLongObject() } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticLong() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticLong() } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticLongObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { 9223372036854775807 } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticLongObject() } [1] 9.223372e+18 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodReturnsNull() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodReturnsNull() } NULL ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticReturnsNull() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { NULL } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticReturnsNull() } NULL ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodBoolean() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodBoolean() } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodBooleanObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodBooleanObject() } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticBoolean() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticBoolean() } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticBooleanObject() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticBooleanObject() } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticStringArray() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticStringArray() } [external object] [1] "a" "b" "c" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStringArray() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] "a" "b" "c"\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStringArray() } [external object] [1] "a" "b" "c" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodIntArray() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodIntArray() } [external object] [1] 1 2 3 ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testMethods# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodStaticIntArray() } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[external object]\n[1] 1 2 3\n') } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodStaticIntArray() } [external object] [1] 1 2 3 @@ -131605,7 +131605,7 @@ NULL [1] "field" "method" "staticField" "staticMethod" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNamesForForeignObject# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { c('one', 'two') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestNamesClassMap'); t <- .fastr.interop.new(tc); sort(names(t$m())) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { c('one', 'two') } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestNamesClassMap'); to <- .fastr.interop.new(tc); sort(names(to$m())) } [1] "one" "two" ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNamesForForeignObject# @@ -131643,35 +131643,35 @@ Error in getClass(Class, where = topenv(parent.frame())) : “__bogus_class_name__†is not a defined class ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNonPrimitiveParameter# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$equals(t) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$equals(to) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNullParameters# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$methodAcceptsOnlyNull(NULL) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$methodAcceptsOnlyNull(NULL) } NULL ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNullParameters#Ignored.Unimplemented# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { java.lang.Long } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$isNull(1) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { java.lang.Long } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$isNull(1) } Error: object 'java.lang.Long' not found ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNullParameters#Ignored.Unimplemented# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { java.lang.String } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$isNull('string') } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { java.lang.String } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$isNull('string') } Error: object 'java.lang.String' not found ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testOverloaded#Ignored.Unimplemented# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { boolean } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$isOverloaded(TRUE) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { boolean } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$isOverloaded(TRUE) } Error: object 'boolean' not found ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testOverloaded#Ignored.Unimplemented# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { java.lang.String } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); t <- .fastr.interop.new(tc); t$isOverloaded('string') } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { java.lang.String } else { to <- .fastr.interop.new(.fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass')); to$isOverloaded('string') } Error: object 'java.lang.String' not found ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testToArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(c(to, to)); .fastr.java.isArray(a) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(c(to, to)); .fastr.interop.isArray(a) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testToArray# -#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(to); .fastr.java.isArray(a) } +#if (length(grep("FastR", R.Version()$version.string)) != 1) { TRUE } else { tc <- .fastr.java.class('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(to); .fastr.interop.isArray(a) } [1] TRUE ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testToArray# diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java index 8e829e3893e42f601e802dc9e7793914a6ee5ec5..76235f932429df5046c23fee5a66391ef24134f5 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java @@ -39,6 +39,7 @@ import org.junit.Before; public class TestJavaInterop extends TestBase { private static final String TEST_CLASS = TestClass.class.getName(); + private static final String CREATE_TRUFFLE_OBJECT = "to <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "'));"; @Before public void testInit() { @@ -163,8 +164,8 @@ public class TestJavaInterop extends TestBase { assertEvalFastR("a <- .fastr.java.toArray(.fastr.interop.toShort(1)); .fastr.java.toArray(a);", getRValue(new short[]{1})); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(to); .fastr.java.isArray(a)", "TRUE"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(c(to, to)); .fastr.java.isArray(a)", "TRUE"); + assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(to); .fastr.interop.isArray(a)", "TRUE"); + assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); to <- .fastr.interop.new(tc); a <- .fastr.java.toArray(c(to, to)); .fastr.interop.isArray(a)", "TRUE"); assertEvalFastR(Ignored.Unimplemented, "a <- .fastr.java.toArray(1L,,F); a;", getRValue(new int[]{1})); } @@ -181,20 +182,20 @@ public class TestJavaInterop extends TestBase { testFromArray("fieldStaticShortArray", "integer"); testFromArray("fieldStaticStringArray", "character"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$objectArray); is.list(v)", "TRUE"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$objectArray); is.list(v)", "TRUE"); testFromArray("objectIntArray", "integer"); testFromArray("objectDoubleArray", "double"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$mixedTypesArray); is.list(v)", "TRUE"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$mixedTypesArray); is.list(v)", "TRUE"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$hasNullIntArray); is.list(v)", "TRUE"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$hasNullIntArray); v[1]", "list(1)"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$hasNullIntArray); v[2]", "list(NULL)"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$hasNullIntArray); v[3]", "list(3)"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$hasNullIntArray); is.list(v)", "TRUE"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$hasNullIntArray); v[1]", "list(1)"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$hasNullIntArray); v[2]", "list(NULL)"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$hasNullIntArray); v[3]", "list(3)"); } public void testFromArray(String field, String type) { - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$" + field + "); is.vector(v)", "TRUE"); - assertEvalFastR("t <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); v <- .fastr.java.fromArray(t$" + field + "); typeof(v)", getRValue(type)); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$" + field + "); is.vector(v)", "TRUE"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " v <- .fastr.interop.fromArray(to$" + field + "); typeof(v)", getRValue(type)); } @Test @@ -233,10 +234,10 @@ public class TestJavaInterop extends TestBase { assertEvalFastR("class(c(.fastr.interop.toByte(123), 1))", "'list'"); assertEvalFastR("class(c(1, .fastr.interop.toByte(123)))", "'list'"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); class(c(t))", "'truffle.object'"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " class(c(to))", "'truffle.object'"); assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t1 <- .fastr.interop.new(tc); class(c(t, t1))", "'list'"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); class(c(1, t))", "'list'"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); class(c(t, 1))", "'list'"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " class(c(1, t))", "'list'"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " class(c(t, 1))", "'list'"); } @Test @@ -266,7 +267,7 @@ public class TestJavaInterop extends TestBase { } private void testForValue(String member, Object value) { - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$" + member, getRValue(value)); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$" + member, getRValue(value)); } @Test @@ -277,13 +278,13 @@ public class TestJavaInterop extends TestBase { @Test public void testNonPrimitiveParameter() { - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$equals(t)", "TRUE"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$equals(to)", "TRUE"); } @Test public void testClassAsParameter() { // fails in testdownstream - assertEvalFastR(Ignored.ImplementationError, "tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$classAsArg(tc)", getRValue(TEST_CLASS)); + assertEvalFastR(Ignored.ImplementationError, CREATE_TRUFFLE_OBJECT + " to$classAsArg(.fastr.java.class(" + TEST_CLASS + "))", getRValue(TEST_CLASS)); } private void getValueForAllTypesMethod(String method) { @@ -296,22 +297,22 @@ public class TestJavaInterop extends TestBase { double d = Double.MAX_VALUE; float f = Float.MAX_VALUE; String s = "testString"; - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$" + method + "(" + getRValuesAsString(bo, bt, c, sh, i, l, d, f, s) + ")", + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$" + method + "(" + getRValuesAsString(bo, bt, c, sh, i, l, d, f, s) + ")", getRValue("" + bo + bt + c + sh + i + l + d + f + s)); } @Test public void testNullParameters() { - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$methodAcceptsOnlyNull(NULL)", ""); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$methodAcceptsOnlyNull(NULL)", ""); - assertEvalFastR(Ignored.Unimplemented, "tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$isNull('string')", "java.lang.String"); - assertEvalFastR(Ignored.Unimplemented, "tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$isNull(1)", "java.lang.Long"); + assertEvalFastR(Ignored.Unimplemented, CREATE_TRUFFLE_OBJECT + " to$isNull('string')", "java.lang.String"); + assertEvalFastR(Ignored.Unimplemented, CREATE_TRUFFLE_OBJECT + " to$isNull(1)", "java.lang.Long"); } @Test public void testOverloaded() { - assertEvalFastR(Ignored.Unimplemented, "tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$isOverloaded(TRUE)", "boolean"); - assertEvalFastR(Ignored.Unimplemented, "tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$isOverloaded('string')", String.class.getName()); + assertEvalFastR(Ignored.Unimplemented, CREATE_TRUFFLE_OBJECT + " to$isOverloaded(TRUE)", "boolean"); + assertEvalFastR(Ignored.Unimplemented, CREATE_TRUFFLE_OBJECT + " to$isOverloaded('string')", String.class.getName()); // TODO add remaining isOverloaded(...) calls once this is fixed } @@ -320,31 +321,31 @@ public class TestJavaInterop extends TestBase { assertEvalFastR("a <- .fastr.java.toArray(c(1,2,3)); a[1]", "1"); assertEvalFastR("a <- .fastr.java.toArray(c(1,2,3)); a[[1]]", "1"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$fieldIntArray[1];", "1"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$fieldIntArray[[1]];", "1"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$fieldIntArray[1];", "1"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$fieldIntArray[[1]];", "1"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$int2DimArray[1]", getRValue(new int[]{1, 2, 3})); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$int2DimArray[[1]]", getRValue(new int[]{1, 2, 3})); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$int2DimArray[1,2]", "2"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$int2DimArray[[1,2]]", "2"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$int2DimArray[1]", getRValue(new int[]{1, 2, 3})); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$int2DimArray[[1]]", getRValue(new int[]{1, 2, 3})); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$int2DimArray[1,2]", "2"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$int2DimArray[[1,2]]", "2"); assertEvalFastR("a <- .fastr.java.toArray(c(1,2,3)); a[1] <- 123; a[1]", "123"); assertEvalFastR("a <- .fastr.java.toArray(c(1,2,3)); a[[1]] <- 123; a[[1]]", "123"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$fieldIntArray[1] <- 123L; t$fieldIntArray[1]", "123"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$fieldIntArray[[1]] <- 1234L; t$fieldIntArray[[1]]", "1234"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$fieldIntArray[1] <- 123L; to$fieldIntArray[1]", "123"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$fieldIntArray[[1]] <- 1234L; to$fieldIntArray[[1]]", "1234"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$fieldStringArray[1] <- NULL; t$fieldStringArray[1]", "NULL"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$fieldStringArray[1] <- NULL; to$fieldStringArray[1]", "NULL"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$int2DimArray[1,2] <- 1234L; t$int2DimArray[1,2]", "1234"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); t$int2DimArray[[1,2]] <- 12345L; t$int2DimArray[[1,2]]", "12345"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$int2DimArray[1,2] <- 1234L; to$int2DimArray[1,2]", "1234"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " to$int2DimArray[[1,2]] <- 12345L; to$int2DimArray[[1,2]]", "12345"); } public void testMap() { - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); m <- t$map; m['one']", "'1'"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); m <- t$map; m['two']", "'2'"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " m <- to$map; m['one']", "'1'"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " m <- to$map; m['two']", "'2'"); - assertEvalFastR("tc <- .fastr.java.class('" + TEST_CLASS + "'); t <- .fastr.interop.new(tc); m <- t$map; m['one']<-'11'; m['one']", "'11'"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " m <- to$map; m['one']<-'11'; m['one']", "'11'"); // truffle assertEvalFastR(Ignored.Unimplemented, "how to put into map?", "'11'"); @@ -359,7 +360,7 @@ public class TestJavaInterop extends TestBase { assertEvalFastR("tc <- .fastr.java.class('" + TestNamesClass.class.getName() + "'); names(tc$staticMethod)", "NULL"); assertEvalFastR("tc <- .fastr.java.class('" + TestNamesClass.class.getName() + "'); t <- .fastr.interop.new(tc); sort(names(t))", "c('field', 'method', 'staticField', 'staticMethod')"); assertEvalFastR("cl <- .fastr.java.class('java.util.Collections'); em<-cl$EMPTY_MAP; names(em)", "NULL"); - assertEvalFastR("tc <- .fastr.java.class('" + TestNamesClassMap.class.getName() + "'); t <- .fastr.interop.new(tc); sort(names(t$m()))", "c('one', 'two')"); + assertEvalFastR("tc <- .fastr.java.class('" + TestNamesClassMap.class.getName() + "'); to <- .fastr.interop.new(tc); sort(names(to$m()))", "c('one', 'two')"); } @Test @@ -416,14 +417,14 @@ public class TestJavaInterop extends TestBase { } private void assertPassingForeighObjectToFunction(String function, String expectedOutput) { - assertEvalFastR("to <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); " + function + "(to)", expectedOutput); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " " + function + "(to)", expectedOutput); } @Test public void testAttributes() { - assertEvalFastR("to <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); attributes(to)", "NULL"); - assertEvalFastR("to <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); attr(to, 'a')<-'a'", "cat('Error in attr(to, \"a\") <- \"a\" : external object cannot be attributed\n')"); - assertEvalFastR("to <- .fastr.interop.new(.fastr.java.class('" + TEST_CLASS + "')); attr(to, which = 'a')", "cat('Error in attr(to, which = \"a\") : external object cannot be attributed\n')"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " attributes(to)", "NULL"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " attr(to, 'a')<-'a'", "cat('Error in attr(to, \"a\") <- \"a\" : external object cannot be attributed\n')"); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + " attr(to, which = 'a')", "cat('Error in attr(to, which = \"a\") : external object cannot be attributed\n')"); } @Test @@ -932,7 +933,6 @@ public class TestJavaInterop extends TestBase { public static class TestArrayClass { public static TestArrayClass[] testArray = new TestArrayClass[]{new TestArrayClass(), new TestArrayClass(), new TestArrayClass()}; - } }