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

org.jruby.truffle.stdlib.bigdecimal.GetIntegerConstantNodeGen Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package org.jruby.truffle.stdlib.bigdecimal;

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.nodes.UnexpectedResultException;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.core.cast.IntegerCastNode;
import org.jruby.truffle.core.cast.ToIntNode;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.constants.GetConstantNode;
import org.jruby.truffle.language.constants.LookupConstantNode;

@GeneratedBy(GetIntegerConstantNode.class)
public final class GetIntegerConstantNodeGen extends GetIntegerConstantNode implements SpecializedNode {

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

    private GetIntegerConstantNodeGen(RubyNode module, RubyNode name) {
        this.module_ = module;
        this.name_ = name;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public int executeGetIntegerConstant(VirtualFrame frameValue, DynamicObject moduleValue, String nameValue) {
        return specialization_.executeInt1(frameValue, moduleValue, nameValue);
    }

    @Override
    public Object execute(VirtualFrame frameValue) {
        return specialization_.execute(frameValue);
    }

    @Override
    public void executeVoid(VirtualFrame frameValue) {
        specialization_.executeVoid(frameValue);
        return;
    }

    @Override
    public int executeInteger(VirtualFrame frameValue) {
        return specialization_.executeInt0(frameValue);
    }

    @Override
    public SpecializationNode getSpecializationNode() {
        return specialization_;
    }

    @Override
    public Node deepCopy() {
        return SpecializationNode.updateRoot(super.deepCopy());
    }

    private static String expectString(Object value) throws UnexpectedResultException {
        if (value instanceof String) {
            return (String) value;
        }
        throw new UnexpectedResultException(value);
    }

    public static GetIntegerConstantNode create(RubyNode module, RubyNode name) {
        return new GetIntegerConstantNodeGen(module, name);
    }

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

        @CompilationFinal protected GetIntegerConstantNodeGen root;

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

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

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

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

        public abstract int executeInt_(VirtualFrame frameValue, Object moduleValue, Object nameValue);

        public int executeInt1(VirtualFrame frameValue, DynamicObject moduleValue, String nameValue) {
            return executeInt_(frameValue, moduleValue, nameValue);
        }

        public Object execute(VirtualFrame frameValue) {
            Object moduleValue_ = root.module_.execute(frameValue);
            Object nameValue_ = root.name_.execute(frameValue);
            return executeInt_(frameValue, moduleValue_, nameValue_);
        }

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

        public int executeInt0(VirtualFrame frameValue) {
            return (int) execute(frameValue);
        }

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object moduleValue, Object nameValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                if ((RubyGuards.isRubyModule(moduleValue_))) {
                    LookupConstantNode lookupConstantNode1 = (root.createLookupConstantNode());
                    GetConstantNode getConstantNode1 = (GetConstantNode.create());
                    ToIntNode toIntNode1 = (ToIntNode.create());
                    IntegerCastNode integerCastNode1 = (root.createIntegerCastNode());
                    return IntegerNode_.create(root, lookupConstantNode1, getConstantNode1, toIntNode1, integerCastNode1);
                }
            }
            return null;
        }

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

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

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

        @Override
        public int executeInt_(VirtualFrame frameValue, Object moduleValue, Object nameValue) {
            return (int) uninitialized(frameValue, moduleValue, nameValue);
        }

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

    }
    @GeneratedBy(methodName = "doInteger(VirtualFrame, DynamicObject, String, LookupConstantNode, GetConstantNode, ToIntNode, IntegerCastNode)", value = GetIntegerConstantNode.class)
    private static final class IntegerNode_ extends BaseNode_ {

        @Child private LookupConstantNode lookupConstantNode;
        @Child private GetConstantNode getConstantNode;
        @Child private ToIntNode toIntNode;
        @Child private IntegerCastNode integerCastNode;

        IntegerNode_(GetIntegerConstantNodeGen root, LookupConstantNode lookupConstantNode, GetConstantNode getConstantNode, ToIntNode toIntNode, IntegerCastNode integerCastNode) {
            super(root, 1);
            this.lookupConstantNode = lookupConstantNode;
            this.getConstantNode = getConstantNode;
            this.toIntNode = toIntNode;
            this.integerCastNode = integerCastNode;
        }

        @Override
        public int executeInt0(VirtualFrame frameValue) {
            DynamicObject moduleValue_;
            try {
                moduleValue_ = root.module_.executeDynamicObject(frameValue);
            } catch (UnexpectedResultException ex) {
                Object nameValue = root.name_.execute(frameValue);
                return getNext().executeInt_(frameValue, ex.getResult(), nameValue);
            }
            String nameValue_;
            try {
                nameValue_ = expectString(root.name_.execute(frameValue));
            } catch (UnexpectedResultException ex) {
                return getNext().executeInt_(frameValue, moduleValue_, ex.getResult());
            }
            if ((RubyGuards.isRubyModule(moduleValue_))) {
                return root.doInteger(frameValue, moduleValue_, nameValue_, this.lookupConstantNode, this.getConstantNode, this.toIntNode, this.integerCastNode);
            }
            return getNext().executeInt_(frameValue, moduleValue_, nameValue_);
        }

        @Override
        public int executeInt1(VirtualFrame frameValue, DynamicObject moduleValue, String nameValue) {
            if ((RubyGuards.isRubyModule(moduleValue))) {
                return root.doInteger(frameValue, moduleValue, nameValue, this.lookupConstantNode, this.getConstantNode, this.toIntNode, this.integerCastNode);
            }
            return getNext().executeInt1(frameValue, moduleValue, nameValue);
        }

        @Override
        public int executeInt_(VirtualFrame frameValue, Object moduleValue, Object nameValue) {
            if (moduleValue instanceof DynamicObject && nameValue instanceof String) {
                DynamicObject moduleValue_ = (DynamicObject) moduleValue;
                String nameValue_ = (String) nameValue;
                if ((RubyGuards.isRubyModule(moduleValue_))) {
                    return root.doInteger(frameValue, moduleValue_, nameValue_, this.lookupConstantNode, this.getConstantNode, this.toIntNode, this.integerCastNode);
                }
            }
            return getNext().executeInt_(frameValue, moduleValue, nameValue);
        }

        static BaseNode_ create(GetIntegerConstantNodeGen root, LookupConstantNode lookupConstantNode, GetConstantNode getConstantNode, ToIntNode toIntNode, IntegerCastNode integerCastNode) {
            return new IntegerNode_(root, lookupConstantNode, getConstantNode, toIntNode, integerCastNode);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy