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

org.jruby.truffle.language.constants.GetConstantNodeGen Maven / Gradle / Ivy

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

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.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.profiles.ConditionProfile;
import org.jruby.truffle.language.RubyConstant;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.loader.RequireNode;

@GeneratedBy(GetConstantNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class GetConstantNodeGen extends GetConstantNode implements SpecializedNode {

    @Child private RubyNode module_;
    @Child private RubyNode name_;
    @Child private RubyNode constant_;
    @Child private RubyNode lookupConstantNode_;
    @Child private BaseNode_ specialization_;

    private GetConstantNodeGen(RubyNode module, RubyNode name, RubyNode constant, RubyNode lookupConstantNode) {
        this.module_ = module;
        this.name_ = name;
        this.constant_ = constant;
        this.lookupConstantNode_ = lookupConstantNode;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object executeGetConstant(VirtualFrame frameValue, Object moduleValue, String nameValue, RubyConstant constantValue, LookupConstantInterface lookupConstantNodeValue) {
        return specialization_.execute1(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
    }

    @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 GetConstantNode create(RubyNode module, RubyNode name, RubyNode constant, RubyNode lookupConstantNode) {
        return new GetConstantNodeGen(module, name, constant, lookupConstantNode);
    }

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

        @CompilationFinal protected GetConstantNodeGen root;

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

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

        @Override
        protected final Node[] getSuppliedChildren() {
            return new Node[] {root.module_, root.name_, root.constant_, root.lookupConstantNode_};
        }

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            return this.execute_((VirtualFrame) frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        public abstract Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue);

        public Object execute1(VirtualFrame frameValue, Object moduleValue, String nameValue, RubyConstant constantValue, LookupConstantInterface lookupConstantNodeValue) {
            return execute_(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        public Object execute0(VirtualFrame frameValue) {
            Object moduleValue_ = root.module_.execute(frameValue);
            Object nameValue_ = root.name_.execute(frameValue);
            Object constantValue_ = root.constant_.execute(frameValue);
            Object lookupConstantNodeValue_ = root.lookupConstantNode_.execute(frameValue);
            return execute_(frameValue, moduleValue_, nameValue_, constantValue_, lookupConstantNodeValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String && lookupConstantNodeValue instanceof LookupConstantInterface) {
                String nameValue_ = (String) nameValue;
                if (constantValue instanceof RubyConstant) {
                    RubyConstant constantValue_ = (RubyConstant) constantValue;
                    if ((constantValue_ != null) && (!(constantValue_.isAutoload()))) {
                        return GetConstantNode_.create(root);
                    }
                    if ((constantValue_ != null) && (constantValue_.isAutoload())) {
                        RequireNode requireNode2 = (RequireNode.create());
                        return AutoloadConstantNode_.create(root, requireNode2);
                    }
                }
                String cachedName3 = (nameValue_);
                ConditionProfile sameNameProfile3 = (ConditionProfile.createBinaryProfile());
                if ((constantValue == null) && (root.guardName(nameValue_, cachedName3, sameNameProfile3))) {
                    boolean isValidConstantName3 = (root.isValidConstantName(nameValue_));
                    DynamicObject symbolName3 = (root.getSymbol(nameValue_));
                    SpecializationNode s = MissingConstantCachedNode_.create(root, cachedName3, isValidConstantName3, symbolName3, sameNameProfile3);
                    if (countSame(s) < (root.getCacheLimit())) {
                        return s;
                    }
                }
                if ((constantValue == null)) {
                    ConditionProfile validNameProfile4 = (ConditionProfile.createBinaryProfile());
                    return MissingConstantUncachedNode_.create(root, validNameProfile4);
                }
            }
            return null;
        }

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

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

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

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

        @Override
        public Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            return uninitialized(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

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

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

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

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            return polymorphicMerge(newNode, super.merge(newNode, frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue));
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            return getNext().execute_(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

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

    }
    @GeneratedBy(methodName = "getConstant(DynamicObject, String, RubyConstant, LookupConstantInterface)", value = GetConstantNode.class)
    private static final class GetConstantNode_ extends BaseNode_ {

        GetConstantNode_(GetConstantNodeGen root) {
            super(root, 1);
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object moduleValue, String nameValue, RubyConstant constantValue, LookupConstantInterface lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                if ((constantValue != null) && (!(constantValue.isAutoload()))) {
                    return root.getConstant(moduleValue_, nameValue, constantValue, lookupConstantNodeValue);
                }
            }
            return getNext().execute1(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String && constantValue instanceof RubyConstant && lookupConstantNodeValue instanceof LookupConstantInterface) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                String nameValue_ = (String) nameValue;
                RubyConstant constantValue_ = (RubyConstant) constantValue;
                LookupConstantInterface lookupConstantNodeValue_ = (LookupConstantInterface) lookupConstantNodeValue;
                if ((constantValue_ != null) && (!(constantValue_.isAutoload()))) {
                    return root.getConstant(moduleValue_, nameValue_, constantValue_, lookupConstantNodeValue_);
                }
            }
            return getNext().execute_(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        static BaseNode_ create(GetConstantNodeGen root) {
            return new GetConstantNode_(root);
        }

    }
    @GeneratedBy(methodName = "autoloadConstant(VirtualFrame, DynamicObject, String, RubyConstant, LookupConstantInterface, RequireNode)", value = GetConstantNode.class)
    private static final class AutoloadConstantNode_ extends BaseNode_ {

        @Child private RequireNode requireNode;

        AutoloadConstantNode_(GetConstantNodeGen root, RequireNode requireNode) {
            super(root, 2);
            this.requireNode = requireNode;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object moduleValue, String nameValue, RubyConstant constantValue, LookupConstantInterface lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                if ((constantValue != null) && (constantValue.isAutoload())) {
                    return root.autoloadConstant(frameValue, moduleValue_, nameValue, constantValue, lookupConstantNodeValue, this.requireNode);
                }
            }
            return getNext().execute1(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String && constantValue instanceof RubyConstant && lookupConstantNodeValue instanceof LookupConstantInterface) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                String nameValue_ = (String) nameValue;
                RubyConstant constantValue_ = (RubyConstant) constantValue;
                LookupConstantInterface lookupConstantNodeValue_ = (LookupConstantInterface) lookupConstantNodeValue;
                if ((constantValue_ != null) && (constantValue_.isAutoload())) {
                    return root.autoloadConstant(frameValue, moduleValue_, nameValue_, constantValue_, lookupConstantNodeValue_, this.requireNode);
                }
            }
            return getNext().execute_(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        static BaseNode_ create(GetConstantNodeGen root, RequireNode requireNode) {
            return new AutoloadConstantNode_(root, requireNode);
        }

    }
    @GeneratedBy(methodName = "missingConstantCached(VirtualFrame, DynamicObject, String, Object, LookupConstantInterface, String, boolean, DynamicObject, ConditionProfile)", value = GetConstantNode.class)
    private static final class MissingConstantCachedNode_ extends BaseNode_ {

        private final String cachedName;
        private final boolean isValidConstantName;
        private final DynamicObject symbolName;
        private final ConditionProfile sameNameProfile;

        MissingConstantCachedNode_(GetConstantNodeGen root, String cachedName, boolean isValidConstantName, DynamicObject symbolName, ConditionProfile sameNameProfile) {
            super(root, 3);
            this.cachedName = cachedName;
            this.isValidConstantName = isValidConstantName;
            this.symbolName = symbolName;
            this.sameNameProfile = sameNameProfile;
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String && lookupConstantNodeValue instanceof LookupConstantInterface) {
                String nameValue_ = (String) nameValue;
                if ((constantValue == null) && (root.guardName(nameValue_, this.cachedName, this.sameNameProfile))) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object moduleValue, String nameValue, RubyConstant constantValue, LookupConstantInterface lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                if ((constantValue == null) && (root.guardName(nameValue, this.cachedName, this.sameNameProfile))) {
                    return root.missingConstantCached(frameValue, moduleValue_, nameValue, constantValue, lookupConstantNodeValue, this.cachedName, this.isValidConstantName, this.symbolName, this.sameNameProfile);
                }
            }
            return getNext().execute1(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String && lookupConstantNodeValue instanceof LookupConstantInterface) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                String nameValue_ = (String) nameValue;
                LookupConstantInterface lookupConstantNodeValue_ = (LookupConstantInterface) lookupConstantNodeValue;
                if ((constantValue == null) && (root.guardName(nameValue_, this.cachedName, this.sameNameProfile))) {
                    return root.missingConstantCached(frameValue, moduleValue_, nameValue_, constantValue, lookupConstantNodeValue_, this.cachedName, this.isValidConstantName, this.symbolName, this.sameNameProfile);
                }
            }
            return getNext().execute_(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        static BaseNode_ create(GetConstantNodeGen root, String cachedName, boolean isValidConstantName, DynamicObject symbolName, ConditionProfile sameNameProfile) {
            return new MissingConstantCachedNode_(root, cachedName, isValidConstantName, symbolName, sameNameProfile);
        }

    }
    @GeneratedBy(methodName = "missingConstantUncached(VirtualFrame, DynamicObject, String, Object, LookupConstantInterface, ConditionProfile)", value = GetConstantNode.class)
    private static final class MissingConstantUncachedNode_ extends BaseNode_ {

        private final ConditionProfile validNameProfile;

        MissingConstantUncachedNode_(GetConstantNodeGen root, ConditionProfile validNameProfile) {
            super(root, 4);
            this.validNameProfile = validNameProfile;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object moduleValue, String nameValue, RubyConstant constantValue, LookupConstantInterface lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                if ((constantValue == null)) {
                    return root.missingConstantUncached(frameValue, moduleValue_, nameValue, constantValue, lookupConstantNodeValue, this.validNameProfile);
                }
            }
            return getNext().execute1(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object moduleValue, Object nameValue, Object constantValue, Object lookupConstantNodeValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String && lookupConstantNodeValue instanceof LookupConstantInterface) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                String nameValue_ = (String) nameValue;
                LookupConstantInterface lookupConstantNodeValue_ = (LookupConstantInterface) lookupConstantNodeValue;
                if ((constantValue == null)) {
                    return root.missingConstantUncached(frameValue, moduleValue_, nameValue_, constantValue, lookupConstantNodeValue_, this.validNameProfile);
                }
            }
            return getNext().execute_(frameValue, moduleValue, nameValue, constantValue, lookupConstantNodeValue);
        }

        static BaseNode_ create(GetConstantNodeGen root, ConditionProfile validNameProfile) {
            return new MissingConstantUncachedNode_(root, validNameProfile);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy