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

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

The newest version!
// 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 org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;

@GeneratedBy(DefineModuleNode.class)
public final class DefineModuleNodeGen extends DefineModuleNode implements SpecializedNode {

    @Child private RubyNode lexicalParentModule_;
    @Child private BaseNode_ specialization_;

    private DefineModuleNodeGen(String name, RubyNode lexicalParentModule) {
        super(name);
        this.lexicalParentModule_ = lexicalParentModule;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @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 DefineModuleNode create(String name, RubyNode lexicalParentModule) {
        return new DefineModuleNodeGen(name, lexicalParentModule);
    }

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

        @CompilationFinal protected DefineModuleNodeGen root;

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

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

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

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

        public abstract Object execute_(VirtualFrame frameValue, Object lexicalParentModuleValue);

        public Object execute(VirtualFrame frameValue) {
            Object lexicalParentModuleValue_ = root.lexicalParentModule_.execute(frameValue);
            return execute_(frameValue, lexicalParentModuleValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object lexicalParentModuleValue) {
            if (lexicalParentModuleValue instanceof DynamicObject) {
                DynamicObject lexicalParentModuleValue_ = (DynamicObject) lexicalParentModuleValue;
                if ((RubyGuards.isRubyModule(lexicalParentModuleValue_))) {
                    return DefineModuleNode_.create(root);
                }
            }
            if ((!(RubyGuards.isRubyModule(lexicalParentModuleValue)))) {
                return DefineModuleWrongParentNode_.create(root);
            }
            return null;
        }

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

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

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

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

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

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

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

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

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

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

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

    }
    @GeneratedBy(methodName = "defineModule(VirtualFrame, DynamicObject)", value = DefineModuleNode.class)
    private static final class DefineModuleNode_ extends BaseNode_ {

        DefineModuleNode_(DefineModuleNodeGen root) {
            super(root, 1);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object lexicalParentModuleValue) {
            if (lexicalParentModuleValue instanceof DynamicObject) {
                DynamicObject lexicalParentModuleValue_ = (DynamicObject) lexicalParentModuleValue;
                if ((RubyGuards.isRubyModule(lexicalParentModuleValue_))) {
                    return root.defineModule(frameValue, lexicalParentModuleValue_);
                }
            }
            return getNext().execute_(frameValue, lexicalParentModuleValue);
        }

        static BaseNode_ create(DefineModuleNodeGen root) {
            return new DefineModuleNode_(root);
        }

    }
    @GeneratedBy(methodName = "defineModuleWrongParent(VirtualFrame, Object)", value = DefineModuleNode.class)
    private static final class DefineModuleWrongParentNode_ extends BaseNode_ {

        DefineModuleWrongParentNode_(DefineModuleNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object lexicalParentModuleValue) {
            if ((!(RubyGuards.isRubyModule(lexicalParentModuleValue)))) {
                return root.defineModuleWrongParent(frameValue, lexicalParentModuleValue);
            }
            return getNext().execute_(frameValue, lexicalParentModuleValue);
        }

        static BaseNode_ create(DefineModuleNodeGen root) {
            return new DefineModuleWrongParentNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy