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

org.jruby.truffle.interop.RubyToForeignNodeGen Maven / Gradle / Ivy

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

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.core.cast.NameToJavaStringNode;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;

@GeneratedBy(RubyToForeignNode.class)
public final class RubyToForeignNodeGen extends RubyToForeignNode implements SpecializedNode {

    @Child private RubyNode value_;
    @Child private BaseNode_ specialization_;

    private RubyToForeignNodeGen(RubyNode value) {
        this.value_ = value;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object executeConvert(VirtualFrame frameValue, Object valueValue) {
        return specialization_.execute1(frameValue, valueValue);
    }

    @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 RubyToForeignNode create(RubyNode value) {
        return new RubyToForeignNodeGen(value);
    }

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

        @CompilationFinal protected RubyToForeignNodeGen root;

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

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

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

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

        public abstract Object execute1(VirtualFrame frameValue, Object valueValue);

        public Object execute0(VirtualFrame frameValue) {
            Object valueValue_ = root.value_.execute(frameValue);
            return execute1(frameValue, valueValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object valueValue) {
            if (valueValue instanceof DynamicObject) {
                DynamicObject valueValue_ = (DynamicObject) valueValue;
                if ((RubyGuards.isRubySymbol(valueValue_) || RubyGuards.isRubyString(valueValue_))) {
                    NameToJavaStringNode toJavaStringNode1 = (NameToJavaStringNode.create());
                    return Convert0Node_.create(root, toJavaStringNode1);
                }
            }
            if ((!(RubyGuards.isRubyString(valueValue))) && (!(RubyGuards.isRubySymbol(valueValue)))) {
                return Convert1Node_.create(root);
            }
            return null;
        }

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

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

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

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

        @Override
        public Object execute1(VirtualFrame frameValue, Object valueValue) {
            return uninitialized(frameValue, valueValue);
        }

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

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

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

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

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

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

    }
    @GeneratedBy(methodName = "convert(VirtualFrame, DynamicObject, NameToJavaStringNode)", value = RubyToForeignNode.class)
    private static final class Convert0Node_ extends BaseNode_ {

        @Child private NameToJavaStringNode toJavaStringNode;

        Convert0Node_(RubyToForeignNodeGen root, NameToJavaStringNode toJavaStringNode) {
            super(root, 1);
            this.toJavaStringNode = toJavaStringNode;
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object valueValue) {
            if (valueValue instanceof DynamicObject) {
                DynamicObject valueValue_ = (DynamicObject) valueValue;
                if ((RubyGuards.isRubySymbol(valueValue_) || RubyGuards.isRubyString(valueValue_))) {
                    return root.convert(frameValue, valueValue_, this.toJavaStringNode);
                }
            }
            return getNext().execute1(frameValue, valueValue);
        }

        static BaseNode_ create(RubyToForeignNodeGen root, NameToJavaStringNode toJavaStringNode) {
            return new Convert0Node_(root, toJavaStringNode);
        }

    }
    @GeneratedBy(methodName = "convert(Object)", value = RubyToForeignNode.class)
    private static final class Convert1Node_ extends BaseNode_ {

        Convert1Node_(RubyToForeignNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute1(VirtualFrame frameValue, Object valueValue) {
            if ((!(RubyGuards.isRubyString(valueValue))) && (!(RubyGuards.isRubySymbol(valueValue)))) {
                return root.convert(valueValue);
            }
            return getNext().execute1(frameValue, valueValue);
        }

        static BaseNode_ create(RubyToForeignNodeGen root) {
            return new Convert1Node_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy