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

org.jruby.truffle.interop.ForeignIsBoxedNodeSub Maven / Gradle / Ivy

The newest version!
package org.jruby.truffle.interop;
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 org.jruby.truffle.interop.RubyMessageResolution.ForeignIsBoxedNode}
 * It is used by the foreign access factory {@link org.jruby.truffle.interop.RubyMessageResolutionForeign}
 */
public abstract class ForeignIsBoxedNodeSub extends org.jruby.truffle.interop.RubyMessageResolution.ForeignIsBoxedNode {
    public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
    @Specialization
    protected Object accessWithTarget(com.oracle.truffle.api.object.DynamicObject object) {
        return access(object);
    }
    private static final class IS_BOXEDRootNode extends RootNode {
        protected IS_BOXEDRootNode(Class> language) {
            super(language, null, null);
        }

        @Child private ForeignIsBoxedNodeSub node = org.jruby.truffle.interop.ForeignIsBoxedNodeSubNodeGen.create();
        @Override
        public Object execute(VirtualFrame frame) {
            Object receiver = ForeignAccess.getReceiver(frame);
            try {
                return node.executeWithTarget(frame, receiver);
            } catch (UnsupportedSpecializationException e) {
                if (e.getNode() instanceof ForeignIsBoxedNodeSub) {
                  throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
                } else {
                  throw e;
                }
            }
        }

    }
    public static RootNode createRoot(Class> language) {
        return new IS_BOXEDRootNode(language);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy