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

org.jruby.truffle.stdlib.bigdecimal.BigDecimalCoerceNodeGen 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.object.DynamicObject;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;

@GeneratedBy(BigDecimalCoerceNode.class)
public final class BigDecimalCoerceNodeGen extends BigDecimalCoerceNode implements SpecializedNode {

    @Child private RubyNode value_;
    @Child private RoundModeNode roundingMode_;
    @Child private BigDecimalCastNode cast_;
    @Child private BaseNode_ specialization_;

    private BigDecimalCoerceNodeGen(RubyNode value, RoundModeNode roundingMode, BigDecimalCastNode cast) {
        this.value_ = value;
        this.roundingMode_ = roundingMode;
        this.cast_ = cast;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public DynamicObject executeBigDecimal(VirtualFrame frameValue, RoundingMode valueValue, Object roundingModeValue) {
        return specialization_.executeDynamicObject1(frameValue, valueValue, roundingModeValue);
    }

    @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 BigDecimalCoerceNode create(RubyNode value, RoundModeNode roundingMode, BigDecimalCastNode cast) {
        return new BigDecimalCoerceNodeGen(value, roundingMode, cast);
    }

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

        @CompilationFinal protected BigDecimalCoerceNodeGen root;

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

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

        @Override
        protected final Node[] getSuppliedChildren() {
            return new Node[] {root.value_, root.roundingMode_, root.cast_};
        }

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

        public abstract Object execute_(VirtualFrame frameValue, Object valueValue, Object roundingModeValue, Object castValue);

        public DynamicObject executeDynamicObject1(VirtualFrame frameValue, RoundingMode valueValue, Object roundingModeValue) {
            Object castValue_ = root.cast_.executeObject(frameValue, valueValue, (RoundingMode) roundingModeValue);
            return (DynamicObject) execute_(frameValue, valueValue, roundingModeValue, castValue_);
        }

        public Object execute(VirtualFrame frameValue) {
            Object valueValue_ = root.value_.execute(frameValue);
            Object roundingModeValue_ = root.roundingMode_.execute(frameValue);
            Object castValue_ = root.cast_.executeObject(frameValue, valueValue_, (RoundingMode) roundingModeValue_);
            return execute_(frameValue, valueValue_, roundingModeValue_, castValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object valueValue, Object roundingModeValue, Object castValue) {
            if (roundingModeValue instanceof RoundingMode) {
                if (castValue instanceof BigDecimal) {
                    return BigDecimal0Node_.create(root);
                }
                if (valueValue instanceof DynamicObject && castValue instanceof DynamicObject) {
                    DynamicObject valueValue_ = (DynamicObject) valueValue;
                    DynamicObject castValue_ = (DynamicObject) castValue;
                    if ((RubyGuards.isRubyBigDecimal(valueValue_)) && (root.isNil(castValue_))) {
                        return BigDecimal1Node_.create(root);
                    }
                }
            }
            return null;
        }

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

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

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

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

        @Override
        public Object execute_(VirtualFrame frameValue, Object valueValue, Object roundingModeValue, Object castValue) {
            return uninitialized(frameValue, valueValue, roundingModeValue, castValue);
        }

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

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

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

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

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

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

    }
    @GeneratedBy(methodName = "doBigDecimal(VirtualFrame, Object, RoundingMode, BigDecimal)", value = BigDecimalCoerceNode.class)
    private static final class BigDecimal0Node_ extends BaseNode_ {

        BigDecimal0Node_(BigDecimalCoerceNodeGen root) {
            super(root, 1);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object valueValue, Object roundingModeValue, Object castValue) {
            if (roundingModeValue instanceof RoundingMode && castValue instanceof BigDecimal) {
                RoundingMode roundingModeValue_ = (RoundingMode) roundingModeValue;
                BigDecimal castValue_ = (BigDecimal) castValue;
                return root.doBigDecimal(frameValue, valueValue, roundingModeValue_, castValue_);
            }
            return getNext().execute_(frameValue, valueValue, roundingModeValue, castValue);
        }

        static BaseNode_ create(BigDecimalCoerceNodeGen root) {
            return new BigDecimal0Node_(root);
        }

    }
    @GeneratedBy(methodName = "doBigDecimal(DynamicObject, RoundingMode, DynamicObject)", value = BigDecimalCoerceNode.class)
    private static final class BigDecimal1Node_ extends BaseNode_ {

        BigDecimal1Node_(BigDecimalCoerceNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object valueValue, Object roundingModeValue, Object castValue) {
            if (valueValue instanceof DynamicObject && roundingModeValue instanceof RoundingMode && castValue instanceof DynamicObject) {
                DynamicObject valueValue_ = (DynamicObject) valueValue;
                RoundingMode roundingModeValue_ = (RoundingMode) roundingModeValue;
                DynamicObject castValue_ = (DynamicObject) castValue;
                if ((RubyGuards.isRubyBigDecimal(valueValue_)) && (root.isNil(castValue_))) {
                    return root.doBigDecimal(valueValue_, roundingModeValue_, castValue_);
                }
            }
            return getNext().execute_(frameValue, valueValue, roundingModeValue, castValue);
        }

        static BaseNode_ create(BigDecimalCoerceNodeGen root) {
            return new BigDecimal1Node_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy