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

org.jruby.truffle.language.yield.CallBlockNodeGen Maven / Gradle / Ivy

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

import com.oracle.truffle.api.CallTarget;
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.dsl.internal.SuppressFBWarnings;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DirectCallNode;
import com.oracle.truffle.api.nodes.IndirectCallNode;
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.RubyNode;
import org.jruby.truffle.language.methods.DeclarationContext;

@GeneratedBy(CallBlockNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class CallBlockNodeGen extends CallBlockNode implements SpecializedNode {

    @Child private RubyNode block_;
    @Child private RubyNode self_;
    @Child private RubyNode blockArgument_;
    @Child private RubyNode arguments0_;
    @CompilationFinal private boolean excludeCallBlockCached_;
    @Child private BaseNode_ specialization_;

    private CallBlockNodeGen(DeclarationContext declarationContext, RubyNode block, RubyNode self, RubyNode blockArgument, RubyNode[] arguments) {
        super(declarationContext);
        this.block_ = block;
        this.self_ = self;
        this.blockArgument_ = blockArgument;
        this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object executeCallBlock(VirtualFrame frameValue, DynamicObject blockValue, Object selfValue, Object blockArgumentValue, Object[] arguments0Value) {
        return specialization_.execute1(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
    }

    @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 CallBlockNode create(DeclarationContext declarationContext, RubyNode block, RubyNode self, RubyNode blockArgument, RubyNode[] arguments) {
        return new CallBlockNodeGen(declarationContext, block, self, blockArgument, arguments);
    }

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

        @CompilationFinal protected CallBlockNodeGen root;

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

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

        @Override
        protected final Node[] getSuppliedChildren() {
            return new Node[] {root.block_, root.self_, root.blockArgument_, root.arguments0_};
        }

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            return this.execute_((VirtualFrame) frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

        public abstract Object execute_(VirtualFrame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value);

        public Object execute1(VirtualFrame frameValue, DynamicObject blockValue, Object selfValue, Object blockArgumentValue, Object[] arguments0Value) {
            return execute_(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

        public Object execute0(VirtualFrame frameValue) {
            Object blockValue_ = root.block_.execute(frameValue);
            Object selfValue_ = root.self_.execute(frameValue);
            Object blockArgumentValue_ = root.blockArgument_.execute(frameValue);
            Object arguments0Value_ = root.arguments0_.execute(frameValue);
            return execute_(frameValue, blockValue_, selfValue_, blockArgumentValue_, arguments0Value_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            if (blockValue instanceof DynamicObject && arguments0Value instanceof Object[]) {
                DynamicObject blockValue_ = (DynamicObject) blockValue;
                CallTarget cachedCallTarget1 = (CallBlockNode.getBlockCallTarget(blockValue_));
                if ((CallBlockNode.getBlockCallTarget(blockValue_) == cachedCallTarget1)) {
                    if (!root.excludeCallBlockCached_) {
                        DirectCallNode callNode1 = (root.createBlockCallNode(cachedCallTarget1));
                        SpecializationNode s = CallBlockCachedNode_.create(root, cachedCallTarget1, callNode1);
                        if (countSame(s) < (root.getCacheLimit())) {
                            return s;
                        }
                    }
                }
                IndirectCallNode callNode2 = (IndirectCallNode.create());
                root.excludeCallBlockCached_ = true;
                return CallBlockUncachedNode_.create(root, callNode2);
            }
            return null;
        }

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

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

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

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

        @Override
        public Object execute_(VirtualFrame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            return uninitialized(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

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

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

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

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            return polymorphicMerge(newNode, super.merge(newNode, frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value));
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            return getNext().execute_(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

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

    }
    @GeneratedBy(methodName = "callBlockCached(VirtualFrame, DynamicObject, Object, Object, Object[], CallTarget, DirectCallNode)", value = CallBlockNode.class)
    private static final class CallBlockCachedNode_ extends BaseNode_ {

        private final CallTarget cachedCallTarget;
        @Child private DirectCallNode callNode;

        CallBlockCachedNode_(CallBlockNodeGen root, CallTarget cachedCallTarget, DirectCallNode callNode) {
            super(root, 1);
            this.cachedCallTarget = cachedCallTarget;
            this.callNode = callNode;
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            if (newNode.getClass() == CallBlockUncachedNode_.class) {
                removeSame("Contained by callBlockUncached(VirtualFrame, DynamicObject, Object, Object, Object[], IndirectCallNode)");
            }
            return super.merge(newNode, frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            if (blockValue instanceof DynamicObject && arguments0Value instanceof Object[]) {
                DynamicObject blockValue_ = (DynamicObject) blockValue;
                if ((CallBlockNode.getBlockCallTarget(blockValue_) == this.cachedCallTarget)) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, DynamicObject blockValue, Object selfValue, Object blockArgumentValue, Object[] arguments0Value) {
            if ((CallBlockNode.getBlockCallTarget(blockValue) == this.cachedCallTarget)) {
                return root.callBlockCached(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value, this.cachedCallTarget, this.callNode);
            }
            return getNext().execute1(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            if (blockValue instanceof DynamicObject && arguments0Value instanceof Object[]) {
                DynamicObject blockValue_ = (DynamicObject) blockValue;
                Object[] arguments0Value_ = (Object[]) arguments0Value;
                if ((CallBlockNode.getBlockCallTarget(blockValue_) == this.cachedCallTarget)) {
                    return root.callBlockCached(frameValue, blockValue_, selfValue, blockArgumentValue, arguments0Value_, this.cachedCallTarget, this.callNode);
                }
            }
            return getNext().execute_(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

        static BaseNode_ create(CallBlockNodeGen root, CallTarget cachedCallTarget, DirectCallNode callNode) {
            return new CallBlockCachedNode_(root, cachedCallTarget, callNode);
        }

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

        @Child private IndirectCallNode callNode;

        CallBlockUncachedNode_(CallBlockNodeGen root, IndirectCallNode callNode) {
            super(root, 2);
            this.callNode = callNode;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, DynamicObject blockValue, Object selfValue, Object blockArgumentValue, Object[] arguments0Value) {
            return root.callBlockUncached(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value, this.callNode);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object blockValue, Object selfValue, Object blockArgumentValue, Object arguments0Value) {
            if (blockValue instanceof DynamicObject && arguments0Value instanceof Object[]) {
                DynamicObject blockValue_ = (DynamicObject) blockValue;
                Object[] arguments0Value_ = (Object[]) arguments0Value;
                return root.callBlockUncached(frameValue, blockValue_, selfValue, blockArgumentValue, arguments0Value_, this.callNode);
            }
            return getNext().execute_(frameValue, blockValue, selfValue, blockArgumentValue, arguments0Value);
        }

        static BaseNode_ create(CallBlockNodeGen root, IndirectCallNode callNode) {
            return new CallBlockUncachedNode_(root, callNode);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy