@Specialization protected Object accessWithTarget(com.oracle.truffle.api.vm.DefaultScope.VariableNamesObject varNames) { return access(varNames); } private static final class HAS_SIZERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.metadata.DefaultScopeVariables.VariablesMapObject varMap, java.lang.String name) { return access(varMap, name); } private static final class READRootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaFunctionObject function, java.lang.Object[] args) { return access(function, args); } private static final class EXECUTERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver, java.lang.Object[] args) { return access(receiver, args); } private static final class EXECUTERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject object, java.lang.Number index) { return access(object, index); } @Specialization
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver) { return access(receiver); } private static final class IS_EXECUTABLERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver) { return access(receiver); } private static final class GET_SIZERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver) { return access(receiver); } private static final class IS_INSTANTIABLERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.vm.HostLanguage.ClassNamesObject varNames, int index) { return access(varNames, index); } private static final class READRootNode extends RootNode {
@Specialization(replaces = "doCached") static boolean doUncached(JavaMethodDesc method, int argsLength) { return JavaInteropReflect.isApplicableByArity(method, argsLength); } }
@Specialization protected Object accessWithTarget(com.oracle.truffle.api.metadata.DefaultScopeVariables.VariableNamesObject varNames, int index) { return access(varNames, index); } private static final class READRootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.polyglot.DefaultScope.ArgumentsArrayObject argsArr, int index, java.lang.Object value) { return access(argsArr, index, value); } private static final class WRITERootNode extends RootNode {
@Specialization protected Object accessWithTarget(com.oracle.truffle.polyglot.HostLanguage.ClassNamesObject varNames) { return access(varNames); } private static final class GET_SIZERootNode extends RootNode {
@SuppressWarnings("unchecked") @TruffleBoundary @Specialization(guards = {"isMap(receiver)"}) protected Object doMapGeneric(JavaObject receiver, String name) { Map<String, Object> map = (Map<String, Object>) receiver.obj; if (!map.containsKey(name)) { throw UnknownIdentifierException.raise(name); } map.remove(name); return true; }
@SuppressWarnings("unused") @TruffleBoundary @Specialization(guards = {"!receiver.isArray()", "!isList(receiver)"}) protected static Object notArray(JavaObject receiver, Number index) { throw UnsupportedMessageException.raise(Message.READ); }
@SuppressWarnings("unused") @Specialization(guards = {"clazz == cachedClazz"}, limit = "LIMIT") static JavaMethodDesc doCached(Class<?> clazz, @Cached("clazz") Class<?> cachedClazz, @Cached("doUncached(clazz)") JavaMethodDesc cachedMethod) { assert cachedMethod == doUncached(clazz); return cachedMethod; }
@SuppressWarnings("unused") @Specialization(guards = {"argsLength == cachedArgsLength"}, limit = "LIMIT") static boolean doCached(JavaMethodDesc method, int argsLength, @Cached("argsLength") int cachedArgsLength, @Cached("doUncached(method, argsLength)") boolean applicableByArity) { assert applicableByArity == JavaInteropReflect.isApplicableByArity(method, argsLength); return applicableByArity; }
@Specialization(replaces = "doCached") void doUncached(SingleFieldDesc field, JavaObject object, Object rawValue) { Object val = toJava.execute(rawValue, field.getType(), field.getGenericType(), object.languageContext); field.set(object.obj, val); } }
@SuppressWarnings("unused") @Specialization(guards = {"clazz == cachedClazz", "cachedName.equals(name)"}, limit = "LIMIT") static Class<?> doCached(Class<?> clazz, String name, @Cached("clazz") Class<?> cachedClazz, @Cached("name") String cachedName, @Cached("doUncached(clazz, name)") Class<?> cachedInnerClass) { assert cachedInnerClass == JavaInteropReflect.findInnerClass(clazz, name); return cachedInnerClass; }
@SuppressWarnings("unused") @Specialization(guards = "acceptCached(receiver, foreignAccess, canHandleCall)", limit = "CACHE_SIZE") protected static Object doCached(TruffleObject receiver, Object[] arguments, @Cached("receiver.getForeignAccess()") ForeignAccess foreignAccess, @Cached("createInlinedCallNode(createMessageTarget(foreignAccess))") DirectCallNode sendMessageCall, @Cached("createCanHandleInlinedCallNode(foreignAccess, receiver)") DirectCallNode canHandleCall) { return sendMessageCall.call(arguments); }