Skip to content
Snippets Groups Projects
Commit 144d6049 authored by Mick Jordan's avatar Mick Jordan
Browse files

add RUnboundValue to ForeignAccess

parent ab008d05
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,7 @@ import com.oracle.truffle.r.runtime.data.RRawVector; ...@@ -52,6 +52,7 @@ import com.oracle.truffle.r.runtime.data.RRawVector;
import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.RStringVector;
import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.data.RSymbol;
import com.oracle.truffle.r.runtime.data.RTruffleObject; import com.oracle.truffle.r.runtime.data.RTruffleObject;
import com.oracle.truffle.r.runtime.data.RUnboundValue;
import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
import com.oracle.truffle.r.runtime.env.REnvironment; import com.oracle.truffle.r.runtime.env.REnvironment;
import com.oracle.truffle.r.runtime.ffi.DLL; import com.oracle.truffle.r.runtime.ffi.DLL;
...@@ -94,7 +95,7 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory { ...@@ -94,7 +95,7 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory {
RRawVector.class, RComplexVector.class, RStringVector.class, RLogicalVector.class, RRawVector.class, RComplexVector.class, RStringVector.class, RLogicalVector.class,
RFunction.class, RNull.class, REnvironment.class, RFunction.class, RNull.class, REnvironment.class,
RList.class, RSymbol.class, RList.class, RSymbol.class,
RPairList.class, RExternalPtr.class, RPairList.class, RExternalPtr.class, RUnboundValue.class,
DLLInfo.class, DotSymbol.class}; DLLInfo.class, DotSymbol.class};
private static final class ForeignAccessState { private static final class ForeignAccessState {
...@@ -205,6 +206,8 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory { ...@@ -205,6 +206,8 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory {
foreignAccess = RSymbolMRForeign.createAccess(); foreignAccess = RSymbolMRForeign.createAccess();
} else if (RExternalPtr.class.isAssignableFrom(clazz)) { } else if (RExternalPtr.class.isAssignableFrom(clazz)) {
foreignAccess = RExternalPtrMRForeign.createAccess(); foreignAccess = RExternalPtrMRForeign.createAccess();
} else if (RUnboundValue.class.isAssignableFrom(clazz)) {
foreignAccess = RUnboundValueMRForeign.createAccess();
} else { } else {
if (RAbstractVector.class.isAssignableFrom(clazz)) { if (RAbstractVector.class.isAssignableFrom(clazz)) {
foreignAccess = ForeignAccess.create(RAbstractVector.class, new RAbstractVectorAccessFactory()); foreignAccess = ForeignAccess.create(RAbstractVector.class, new RAbstractVectorAccessFactory());
......
/*
* Copyright (c) 2016, 2016, 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.engine.interop;
import com.oracle.truffle.api.interop.CanResolve;
import com.oracle.truffle.api.interop.MessageResolution;
import com.oracle.truffle.api.interop.Resolve;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.r.engine.TruffleRLanguage;
import com.oracle.truffle.r.runtime.data.RUnboundValue;
@MessageResolution(receiverType = RUnboundValue.class, language = TruffleRLanguage.class)
public class RUnboundValueMR {
@Resolve(message = "IS_BOXED")
public abstract static class RUnboundValueIsBoxedNode extends Node {
protected Object access(@SuppressWarnings("unused") RUnboundValue receiver) {
return false;
}
}
@Resolve(message = "HAS_SIZE")
public abstract static class RUnboundValueHasSizeNode extends Node {
protected Object access(@SuppressWarnings("unused") RUnboundValue receiver) {
return false;
}
}
@Resolve(message = "IS_NULL")
public abstract static class RUnboundValueIsNullNode extends Node {
protected Object access(@SuppressWarnings("unused") RUnboundValue receiver) {
return false;
}
}
@CanResolve
public abstract static class RUnboundValueCheck extends Node {
protected static boolean test(TruffleObject receiver) {
return receiver instanceof RUnboundValue;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment