All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.truffle.api.interop.java.ClassMessageNodeSub Maven / Gradle / Ivy

Go to download

Truffle is a multi-language framework for executing dynamic languages that achieves high performance when combined with Graal.

There is a newer version: 1.0.0-rc7
Show newest version
package com.oracle.truffle.api.interop.java;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;

/**
 * This message resolution is generated by {@link com.oracle.truffle.api.interop.java.JavaObjectMessageResolution.ClassMessageNode}
 * It is used by the foreign access factory {@link com.oracle.truffle.api.interop.java.JavaObjectMessageResolutionForeign}
 */
abstract class ClassMessageNodeSub extends com.oracle.truffle.api.interop.java.JavaObjectMessageResolution.ClassMessageNode {
    public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
    @Specialization
    protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver) {
        return access(receiver);
    }
    private static final class ClassMessageRootNode extends RootNode {
        protected ClassMessageRootNode() {
            super(null);
        }

        @Child private ClassMessageNodeSub node = com.oracle.truffle.api.interop.java.ClassMessageNodeSubNodeGen.create();
        @Override
        public Object execute(VirtualFrame frame) {
            try {
              Object receiver = ForeignAccess.getReceiver(frame);
              return node.executeWithTarget(frame, receiver);
            } catch (UnsupportedSpecializationException e) {
                if (e.getNode() instanceof ClassMessageNodeSub) {
                  throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
                } else {
                  throw e;
                }
            }
        }

    }
    @Deprecated
    @SuppressWarnings("unused")
    public static RootNode createRoot(Class> language) {
        return createRoot();
    }
    public static RootNode createRoot() {
        return new ClassMessageRootNode();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy