Skip to content
Snippets Groups Projects
Commit fc7f3b90 authored by Stepan Sindelar's avatar Stepan Sindelar
Browse files

[GR-6959] [GR-6840] Strange interop behaviour of R complex number and other...

[GR-6959] [GR-6840] Strange interop behaviour of R complex number and other fixes in FastR message resolution.

PullRequest: fastr/1250
parents d7aa001e dae8400a
Branches
No related tags found
No related merge requests found
...@@ -24,9 +24,16 @@ package com.oracle.truffle.r.test.engine.interop; ...@@ -24,9 +24,16 @@ package com.oracle.truffle.r.test.engine.interop;
import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.RMissing;
import org.junit.Test;
public class RMissingMRTest extends AbstractMRTest { public class RMissingMRTest extends AbstractMRTest {
@Test
@Override
public void testIsNull() throws Exception {
super.testIsNull(); // force inherited tests from AbstractMRTest
}
@Override @Override
protected TruffleObject[] createTruffleObjects() throws Exception { protected TruffleObject[] createTruffleObjects() throws Exception {
return new TruffleObject[]{RMissing.instance}; return new TruffleObject[]{RMissing.instance};
......
...@@ -25,9 +25,16 @@ package com.oracle.truffle.r.test.engine.interop; ...@@ -25,9 +25,16 @@ package com.oracle.truffle.r.test.engine.interop;
import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RNull;
import org.junit.Test;
public class RNullMRTest extends AbstractMRTest { public class RNullMRTest extends AbstractMRTest {
@Test
@Override
public void testIsNull() throws Exception {
super.testIsNull(); // force inherited tests from AbstractMRTest
}
@Override @Override
protected TruffleObject[] createTruffleObjects() throws Exception { protected TruffleObject[] createTruffleObjects() throws Exception {
return new TruffleObject[]{RNull.instance}; return new TruffleObject[]{RNull.instance};
......
/*
* 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.test.engine.interop;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.r.runtime.data.RRaw;
import org.junit.Test;
public class RRawMRTest extends AbstractMRTest {
@Override
protected TruffleObject[] createTruffleObjects() throws Exception {
return new TruffleObject[]{RRaw.valueOf((byte) 1)};
}
@Test
@Override
public void testIsNull() throws Exception {
super.testIsNull(); // force inherited tests from AbstractMRTest
}
@Override
protected Object getUnboxed(TruffleObject obj) {
return ((RRaw) obj).getValue();
}
@Override
protected TruffleObject createEmptyTruffleObject() throws Exception {
return null;
}
}
...@@ -125,7 +125,7 @@ public class RS4ObjectMRTest extends AbstractMRTest { ...@@ -125,7 +125,7 @@ public class RS4ObjectMRTest extends AbstractMRTest {
} }
@Override @Override
protected String[] getKeys() { protected String[] getKeys(TruffleObject obj) {
return new String[]{"s", "d", "i", "b", "fn", "class"}; return new String[]{"s", "d", "i", "b", "fn", "class"};
} }
......
...@@ -24,9 +24,16 @@ package com.oracle.truffle.r.test.engine.interop; ...@@ -24,9 +24,16 @@ package com.oracle.truffle.r.test.engine.interop;
import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.r.runtime.data.RUnboundValue; import com.oracle.truffle.r.runtime.data.RUnboundValue;
import org.junit.Test;
public class RUboundValueMRTest extends AbstractMRTest { public class RUboundValueMRTest extends AbstractMRTest {
@Test
@Override
public void testIsNull() throws Exception {
super.testIsNull(); // force inherited tests from AbstractMRTest
}
@Override @Override
protected TruffleObject[] createTruffleObjects() throws Exception { protected TruffleObject[] createTruffleObjects() throws Exception {
return new TruffleObject[]{RUnboundValue.instance}; return new TruffleObject[]{RUnboundValue.instance};
......
...@@ -38,7 +38,6 @@ import com.oracle.truffle.api.interop.java.JavaInterop; ...@@ -38,7 +38,6 @@ import com.oracle.truffle.api.interop.java.JavaInterop;
import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RDataFactory;
import com.oracle.truffle.r.runtime.data.RObject; import com.oracle.truffle.r.runtime.data.RObject;
import com.oracle.truffle.r.runtime.data.RVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
...@@ -108,32 +107,17 @@ public class VectorMRTest extends AbstractMRTest { ...@@ -108,32 +107,17 @@ public class VectorMRTest extends AbstractMRTest {
return obj instanceof RObject; return obj instanceof RObject;
} }
@Override
protected boolean isBoxed(TruffleObject obj) {
return ((RAbstractVector) obj).getLength() == 1;
}
@Override @Override
protected Object getUnboxed(TruffleObject obj) { protected Object getUnboxed(TruffleObject obj) {
assertTrue(((RAbstractVector) obj).getLength() == 1); assertTrue(((RAbstractVector) obj).getLength() == 1);
return ((RAbstractVector) obj).getDataAtAsObject(0); return ((RAbstractVector) obj).getDataAtAsObject(0);
} }
@Override
protected boolean hasSize(TruffleObject obj) {
return true;
}
@Override @Override
protected int getSize(TruffleObject obj) { protected int getSize(TruffleObject obj) {
return ((RAbstractVector) obj).getLength(); return ((RAbstractVector) obj).getLength();
} }
@Override
protected boolean isPointer(TruffleObject obj) {
return obj instanceof RVector<?>;
}
private static TruffleObject create(String createTxt) throws Exception { private static TruffleObject create(String createTxt) throws Exception {
Source src = Source.newBuilder(createTxt).mimeType("text/x-r").name("test.R").build(); Source src = Source.newBuilder(createTxt).mimeType("text/x-r").name("test.R").build();
return engine.eval(src).as(RAbstractVector.class); return engine.eval(src).as(RAbstractVector.class);
......
...@@ -29,7 +29,7 @@ suite = { ...@@ -29,7 +29,7 @@ suite = {
{ {
"name" : "truffle", "name" : "truffle",
"subdir" : True, "subdir" : True,
"version" : "d1bb9076f1fa6af71c60be140f980794596a75b4", "version" : "e3ce4c4abc668fd637e64a467a8d5b999c2fbdae",
"urls" : [ "urls" : [
{"url" : "https://github.com/graalvm/graal", "kind" : "git"}, {"url" : "https://github.com/graalvm/graal", "kind" : "git"},
{"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment