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

org.jruby.truffle.language.methods.CallInternalMethodNodeGen Maven / Gradle / Ivy

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

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 org.jruby.truffle.language.RubyNode;

@GeneratedBy(CallInternalMethodNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class CallInternalMethodNodeGen extends CallInternalMethodNode implements SpecializedNode {

    @Child private RubyNode method_;
    @Child private RubyNode arguments0_;
    @Child private BaseNode_ specialization_;

    private CallInternalMethodNodeGen(RubyNode method, RubyNode[] arguments) {
        this.method_ = method;
        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 executeCallMethod(VirtualFrame frameValue, InternalMethod methodValue, Object[] arguments0Value) {
        return specialization_.execute1(frameValue, methodValue, 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 CallInternalMethodNode create(RubyNode method, RubyNode[] arguments) {
        return new CallInternalMethodNodeGen(method, arguments);
    }

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

        @CompilationFinal protected CallInternalMethodNodeGen root;

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

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

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

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

        public abstract Object execute_(VirtualFrame frameValue, Object methodValue, Object arguments0Value);

        public Object execute1(VirtualFrame frameValue, InternalMethod methodValue, Object[] arguments0Value) {
            return execute_(frameValue, methodValue, arguments0Value);
        }

        public Object execute0(VirtualFrame frameValue) {
            Object methodValue_ = root.method_.execute(frameValue);
            Object arguments0Value_ = root.arguments0_.execute(frameValue);
            return execute_(frameValue, methodValue_, arguments0Value_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object methodValue, Object arguments0Value) {
            if (methodValue instanceof InternalMethod && arguments0Value instanceof Object[]) {
                InternalMethod methodValue_ = (InternalMethod) methodValue;
                CallTarget cachedCallTarget1 = (methodValue_.getCallTarget());
                if ((methodValue_.getCallTarget() == cachedCallTarget1)) {
                    DirectCallNode callNode1 = (DirectCallNode.create(cachedCallTarget1));
                    SpecializationNode s = CallMethodCachedNode_.create(root, cachedCallTarget1, callNode1);
                    if (countSame(s) < (root.getCacheLimit())) {
                        return s;
                    }
                }
                IndirectCallNode indirectCallNode2 = (IndirectCallNode.create());
                return CallMethodUncachedNode_.create(root, indirectCallNode2);
            }
            return null;
        }

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

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

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

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

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

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

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

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

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

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

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

    }
    @GeneratedBy(methodName = "callMethodCached(VirtualFrame, InternalMethod, Object[], CallTarget, DirectCallNode)", value = CallInternalMethodNode.class)
    private static final class CallMethodCachedNode_ extends BaseNode_ {

        private final CallTarget cachedCallTarget;
        @Child private DirectCallNode callNode;

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

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object methodValue, Object arguments0Value) {
            if (methodValue instanceof InternalMethod && arguments0Value instanceof Object[]) {
                InternalMethod methodValue_ = (InternalMethod) methodValue;
                if ((methodValue_.getCallTarget() == this.cachedCallTarget)) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, InternalMethod methodValue, Object[] arguments0Value) {
            if ((methodValue.getCallTarget() == this.cachedCallTarget)) {
                return root.callMethodCached(frameValue, methodValue, arguments0Value, this.cachedCallTarget, this.callNode);
            }
            return getNext().execute1(frameValue, methodValue, arguments0Value);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object methodValue, Object arguments0Value) {
            if (methodValue instanceof InternalMethod && arguments0Value instanceof Object[]) {
                InternalMethod methodValue_ = (InternalMethod) methodValue;
                Object[] arguments0Value_ = (Object[]) arguments0Value;
                if ((methodValue_.getCallTarget() == this.cachedCallTarget)) {
                    return root.callMethodCached(frameValue, methodValue_, arguments0Value_, this.cachedCallTarget, this.callNode);
                }
            }
            return getNext().execute_(frameValue, methodValue, arguments0Value);
        }

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

    }
    @GeneratedBy(methodName = "callMethodUncached(VirtualFrame, InternalMethod, Object[], IndirectCallNode)", value = CallInternalMethodNode.class)
    private static final class CallMethodUncachedNode_ extends BaseNode_ {

        @Child private IndirectCallNode indirectCallNode;

        CallMethodUncachedNode_(CallInternalMethodNodeGen root, IndirectCallNode indirectCallNode) {
            super(root, 2);
            this.indirectCallNode = indirectCallNode;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, InternalMethod methodValue, Object[] arguments0Value) {
            return root.callMethodUncached(frameValue, methodValue, arguments0Value, this.indirectCallNode);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object methodValue, Object arguments0Value) {
            if (methodValue instanceof InternalMethod && arguments0Value instanceof Object[]) {
                InternalMethod methodValue_ = (InternalMethod) methodValue;
                Object[] arguments0Value_ = (Object[]) arguments0Value;
                return root.callMethodUncached(frameValue, methodValue_, arguments0Value_, this.indirectCallNode);
            }
            return getNext().execute_(frameValue, methodValue, arguments0Value);
        }

        static BaseNode_ create(CallInternalMethodNodeGen root, IndirectCallNode indirectCallNode) {
            return new CallMethodUncachedNode_(root, indirectCallNode);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy