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

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

The newest version!
// CheckStyle: start generated
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.internal.SpecializationNode;
import com.oracle.truffle.api.dsl.internal.SpecializedNode;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.methods.CallBoundMethodNode;
import org.jruby.truffle.language.yield.CallBlockNode;

@GeneratedBy(ForeignExecuteHelperNode.class)
final class ForeignExecuteHelperNodeGen extends ForeignExecuteHelperNode implements SpecializedNode {

    @Child private RubyNode receiver_;
    @Child private RubyNode arguments_;
    @Child private BaseNode_ specialization_;

    private ForeignExecuteHelperNodeGen(RubyNode receiver, RubyNode arguments) {
        this.receiver_ = receiver;
        this.arguments_ = arguments;
        this.specialization_ = UninitializedNode_.create(this);
    }

    @Override
    public NodeCost getCost() {
        return specialization_.getNodeCost();
    }

    @Override
    public Object executeCall(VirtualFrame frameValue, Object receiverValue, Object[] argumentsValue) {
        return specialization_.execute1(frameValue, receiverValue, argumentsValue);
    }

    @Override
    public Object execute(VirtualFrame frameValue) {
        return specialization_.execute0(frameValue);
    }

    @Override
    public void executeVoid(VirtualFrame frameValue) {
        specialization_.executeVoid(frameValue);
        return;
    }

    @Override
    public SpecializationNode getSpecializationNode() {
        return specialization_;
    }

    @Override
    public Node deepCopy() {
        return SpecializationNode.updateRoot(super.deepCopy());
    }

    public static ForeignExecuteHelperNode create(RubyNode receiver, RubyNode arguments) {
        return new ForeignExecuteHelperNodeGen(receiver, arguments);
    }

    @GeneratedBy(ForeignExecuteHelperNode.class)
    private abstract static class BaseNode_ extends SpecializationNode {

        @CompilationFinal protected ForeignExecuteHelperNodeGen root;

        BaseNode_(ForeignExecuteHelperNodeGen root, int index) {
            super(index);
            this.root = root;
        }

        @Override
        protected final void setRoot(Node root) {
            this.root = (ForeignExecuteHelperNodeGen) root;
        }

        @Override
        protected final Node[] getSuppliedChildren() {
            return new Node[] {root.receiver_, root.arguments_};
        }

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object receiverValue, Object argumentsValue) {
            return this.execute_((VirtualFrame) frameValue, receiverValue, argumentsValue);
        }

        public abstract Object execute_(VirtualFrame frameValue, Object receiverValue, Object argumentsValue);

        public Object execute1(VirtualFrame frameValue, Object receiverValue, Object[] argumentsValue) {
            return execute_(frameValue, receiverValue, argumentsValue);
        }

        public Object execute0(VirtualFrame frameValue) {
            Object receiverValue_ = root.receiver_.execute(frameValue);
            Object argumentsValue_ = root.arguments_.execute(frameValue);
            return execute_(frameValue, receiverValue_, argumentsValue_);
        }

        public void executeVoid(VirtualFrame frameValue) {
            execute0(frameValue);
            return;
        }

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object receiverValue, Object argumentsValue) {
            if (receiverValue instanceof DynamicObject && argumentsValue instanceof Object[]) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                if ((RubyGuards.isRubyProc(receiverValue_))) {
                    CallBlockNode callBlockNode1 = (root.createCallBlockNode());
                    return CallProcNode_.create(root, callBlockNode1);
                }
                if ((RubyGuards.isRubyMethod(receiverValue_))) {
                    CallBoundMethodNode callBoundMethodNode2 = (root.createCallBoundMethodNode());
                    return CallMethodNode_.create(root, callBoundMethodNode2);
                }
            }
            return null;
        }

        @Override
        protected final SpecializationNode createPolymorphic() {
            return PolymorphicNode_.create(root);
        }

        protected final BaseNode_ getNext() {
            return (BaseNode_) this.next;
        }

    }
    @GeneratedBy(ForeignExecuteHelperNode.class)
    private static final class UninitializedNode_ extends BaseNode_ {

        UninitializedNode_(ForeignExecuteHelperNodeGen root) {
            super(root, 2147483647);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object argumentsValue) {
            return uninitialized(frameValue, receiverValue, argumentsValue);
        }

        static BaseNode_ create(ForeignExecuteHelperNodeGen root) {
            return new UninitializedNode_(root);
        }

    }
    @GeneratedBy(ForeignExecuteHelperNode.class)
    private static final class PolymorphicNode_ extends BaseNode_ {

        PolymorphicNode_(ForeignExecuteHelperNodeGen root) {
            super(root, 0);
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object receiverValue, Object argumentsValue) {
            return polymorphicMerge(newNode, super.merge(newNode, frameValue, receiverValue, argumentsValue));
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object argumentsValue) {
            return getNext().execute_(frameValue, receiverValue, argumentsValue);
        }

        static BaseNode_ create(ForeignExecuteHelperNodeGen root) {
            return new PolymorphicNode_(root);
        }

    }
    @GeneratedBy(methodName = "callProc(VirtualFrame, DynamicObject, Object[], CallBlockNode)", value = ForeignExecuteHelperNode.class)
    private static final class CallProcNode_ extends BaseNode_ {

        @Child private CallBlockNode callBlockNode;

        CallProcNode_(ForeignExecuteHelperNodeGen root, CallBlockNode callBlockNode) {
            super(root, 1);
            this.callBlockNode = callBlockNode;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object receiverValue, Object[] argumentsValue) {
            if (receiverValue instanceof DynamicObject) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                if ((RubyGuards.isRubyProc(receiverValue_))) {
                    return root.callProc(frameValue, receiverValue_, argumentsValue, this.callBlockNode);
                }
            }
            return getNext().execute1(frameValue, receiverValue, argumentsValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object argumentsValue) {
            if (receiverValue instanceof DynamicObject && argumentsValue instanceof Object[]) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                Object[] argumentsValue_ = (Object[]) argumentsValue;
                if ((RubyGuards.isRubyProc(receiverValue_))) {
                    return root.callProc(frameValue, receiverValue_, argumentsValue_, this.callBlockNode);
                }
            }
            return getNext().execute_(frameValue, receiverValue, argumentsValue);
        }

        static BaseNode_ create(ForeignExecuteHelperNodeGen root, CallBlockNode callBlockNode) {
            return new CallProcNode_(root, callBlockNode);
        }

    }
    @GeneratedBy(methodName = "callMethod(VirtualFrame, DynamicObject, Object[], CallBoundMethodNode)", value = ForeignExecuteHelperNode.class)
    private static final class CallMethodNode_ extends BaseNode_ {

        @Child private CallBoundMethodNode callBoundMethodNode;

        CallMethodNode_(ForeignExecuteHelperNodeGen root, CallBoundMethodNode callBoundMethodNode) {
            super(root, 2);
            this.callBoundMethodNode = callBoundMethodNode;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object receiverValue, Object[] argumentsValue) {
            if (receiverValue instanceof DynamicObject) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                if ((RubyGuards.isRubyMethod(receiverValue_))) {
                    return root.callMethod(frameValue, receiverValue_, argumentsValue, this.callBoundMethodNode);
                }
            }
            return getNext().execute1(frameValue, receiverValue, argumentsValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object argumentsValue) {
            if (receiverValue instanceof DynamicObject && argumentsValue instanceof Object[]) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                Object[] argumentsValue_ = (Object[]) argumentsValue;
                if ((RubyGuards.isRubyMethod(receiverValue_))) {
                    return root.callMethod(frameValue, receiverValue_, argumentsValue_, this.callBoundMethodNode);
                }
            }
            return getNext().execute_(frameValue, receiverValue, argumentsValue);
        }

        static BaseNode_ create(ForeignExecuteHelperNodeGen root, CallBoundMethodNode callBoundMethodNode) {
            return new CallMethodNode_(root, callBoundMethodNode);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy