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

org.jruby.truffle.language.objects.LookupForExistingModuleNodeGen Maven / Gradle / Ivy

// CheckStyle: start generated
package org.jruby.truffle.language.objects;

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 com.oracle.truffle.api.profiles.ConditionProfile;
import org.jruby.truffle.language.RubyConstant;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;

@GeneratedBy(LookupForExistingModuleNode.class)
public final class LookupForExistingModuleNodeGen extends LookupForExistingModuleNode implements SpecializedNode {

    @Child private RubyNode name_;
    @Child private RubyNode lexicalParent_;
    @Child private BaseNode_ specialization_;

    private LookupForExistingModuleNodeGen(RubyNode name, RubyNode lexicalParent) {
        this.name_ = name;
        this.lexicalParent_ = lexicalParent;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public RubyConstant executeLookupForExistingModule(VirtualFrame frameValue, String nameValue, DynamicObject lexicalParentValue) {
        return specialization_.executeRubyConstant(frameValue, nameValue, lexicalParentValue);
    }

    @Override
    public Object execute(VirtualFrame frameValue) {
        return specialization_.execute(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 LookupForExistingModuleNode create(RubyNode name, RubyNode lexicalParent) {
        return new LookupForExistingModuleNodeGen(name, lexicalParent);
    }

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

        @CompilationFinal protected LookupForExistingModuleNodeGen root;

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

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

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

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object nameValue, Object lexicalParentValue) {
            return this.executeRubyConstant_((VirtualFrame) frameValue, nameValue, lexicalParentValue);
        }

        public abstract RubyConstant executeRubyConstant_(VirtualFrame frameValue, Object nameValue, Object lexicalParentValue);

        public RubyConstant executeRubyConstant(VirtualFrame frameValue, String nameValue, DynamicObject lexicalParentValue) {
            return executeRubyConstant_(frameValue, nameValue, lexicalParentValue);
        }

        public Object execute(VirtualFrame frameValue) {
            Object nameValue_ = root.name_.execute(frameValue);
            Object lexicalParentValue_ = root.lexicalParent_.execute(frameValue);
            return executeRubyConstant_(frameValue, nameValue_, lexicalParentValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object nameValue, Object lexicalParentValue) {
            if (nameValue instanceof String && lexicalParentValue instanceof DynamicObject) {
                DynamicObject lexicalParentValue_ = (DynamicObject) lexicalParentValue;
                if ((RubyGuards.isRubyModule(lexicalParentValue_))) {
                    ConditionProfile autoloadProfile1 = (ConditionProfile.createBinaryProfile());
                    ConditionProfile warnProfile1 = (ConditionProfile.createBinaryProfile());
                    return LookupForExistingModuleNode_.create(root, autoloadProfile1, warnProfile1);
                }
            }
            return null;
        }

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

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

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

        @Override
        public RubyConstant executeRubyConstant_(VirtualFrame frameValue, Object nameValue, Object lexicalParentValue) {
            return (RubyConstant) uninitialized(frameValue, nameValue, lexicalParentValue);
        }

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

    }
    @GeneratedBy(methodName = "lookupForExistingModule(VirtualFrame, String, DynamicObject, ConditionProfile, ConditionProfile)", value = LookupForExistingModuleNode.class)
    private static final class LookupForExistingModuleNode_ extends BaseNode_ {

        private final ConditionProfile autoloadProfile;
        private final ConditionProfile warnProfile;

        LookupForExistingModuleNode_(LookupForExistingModuleNodeGen root, ConditionProfile autoloadProfile, ConditionProfile warnProfile) {
            super(root, 1);
            this.autoloadProfile = autoloadProfile;
            this.warnProfile = warnProfile;
        }

        @Override
        public RubyConstant executeRubyConstant(VirtualFrame frameValue, String nameValue, DynamicObject lexicalParentValue) {
            if ((RubyGuards.isRubyModule(lexicalParentValue))) {
                return root.lookupForExistingModule(frameValue, nameValue, lexicalParentValue, this.autoloadProfile, this.warnProfile);
            }
            return getNext().executeRubyConstant(frameValue, nameValue, lexicalParentValue);
        }

        @Override
        public RubyConstant executeRubyConstant_(VirtualFrame frameValue, Object nameValue, Object lexicalParentValue) {
            if (nameValue instanceof String && lexicalParentValue instanceof DynamicObject) {
                String nameValue_ = (String) nameValue;
                DynamicObject lexicalParentValue_ = (DynamicObject) lexicalParentValue;
                if ((RubyGuards.isRubyModule(lexicalParentValue_))) {
                    return root.lookupForExistingModule(frameValue, nameValue_, lexicalParentValue_, this.autoloadProfile, this.warnProfile);
                }
            }
            return getNext().executeRubyConstant_(frameValue, nameValue, lexicalParentValue);
        }

        static BaseNode_ create(LookupForExistingModuleNodeGen root, ConditionProfile autoloadProfile, ConditionProfile warnProfile) {
            return new LookupForExistingModuleNode_(root, autoloadProfile, warnProfile);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy