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

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

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

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
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.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyTypes;
import org.jruby.truffle.language.RubyTypesGen;

@GeneratedBy(IsTaintedNode.class)
public final class IsTaintedNodeGen extends IsTaintedNode implements SpecializedNode {

    @Child private RubyNode child_;
    @CompilationFinal private Class childType_;
    @Child private BaseNode_ specialization_;

    private IsTaintedNodeGen(RubyNode child) {
        this.child_ = child;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public boolean executeIsTainted(Object childValue) {
        return specialization_.executeBoolean1(childValue);
    }

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

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

    @Override
    public boolean executeBoolean(VirtualFrame frameValue) {
        return specialization_.executeBoolean0(frameValue);
    }

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

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

    public static IsTaintedNode create(RubyNode child) {
        return new IsTaintedNodeGen(child);
    }

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

        @CompilationFinal protected IsTaintedNodeGen root;

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

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

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

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object childValue) {
            return this.executeBoolean1(childValue);
        }

        public abstract boolean executeBoolean1(Object childValue);

        public Object execute(VirtualFrame frameValue) {
            Object childValue_ = executeChild_(frameValue);
            return executeBoolean1(childValue_);
        }

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

        public boolean executeBoolean0(VirtualFrame frameValue) {
            return (boolean) execute(frameValue);
        }

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object childValue) {
            if (childValue instanceof Boolean) {
                return IsTainted0Node_.create(root);
            }
            if (RubyTypesGen.isImplicitInteger(childValue)) {
                return IsTainted1Node_.create(root, childValue);
            }
            if (RubyTypesGen.isImplicitLong(childValue)) {
                return IsTainted2Node_.create(root, childValue);
            }
            if (RubyTypesGen.isImplicitDouble(childValue)) {
                return IsTainted3Node_.create(root, childValue);
            }
            if (childValue instanceof DynamicObject) {
                DynamicObject childValue_ = (DynamicObject) childValue;
                if ((RubyGuards.isRubySymbol(childValue_) || root.isNil(childValue_))) {
                    return IsTaintedNilOrSymbolNode_.create(root);
                }
                if ((!(RubyGuards.isRubySymbol(childValue_))) && (!(root.isNil(childValue_)))) {
                    ReadObjectFieldNode readTaintedNode6 = (root.createReadTaintedNode());
                    return IsTainted4Node_.create(root, readTaintedNode6);
                }
            }
            return null;
        }

        @Override
        protected final SpecializationNode createFallback() {
            return FallbackNode_.create(root);
        }

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

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

        protected final Object executeChild_(Frame frameValue) {
            Class childType_ = root.childType_;
            try {
                if (childType_ == boolean.class) {
                    return root.child_.executeBoolean((VirtualFrame) frameValue);
                } else if (childType_ == double.class) {
                    return root.child_.executeDouble((VirtualFrame) frameValue);
                } else if (childType_ == int.class) {
                    return root.child_.executeInteger((VirtualFrame) frameValue);
                } else if (childType_ == long.class) {
                    return root.child_.executeLong((VirtualFrame) frameValue);
                } else if (childType_ == null) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    Class _type = Object.class;
                    try {
                        Object _value = root.child_.execute((VirtualFrame) frameValue);
                        if (_value instanceof Boolean) {
                            _type = boolean.class;
                        } else if (_value instanceof Double) {
                            _type = double.class;
                        } else if (_value instanceof Integer) {
                            _type = int.class;
                        } else if (_value instanceof Long) {
                            _type = long.class;
                        } else {
                            _type = Object.class;
                        }
                        return _value;
                    } finally {
                        root.childType_ = _type;
                    }
                } else {
                    return root.child_.execute((VirtualFrame) frameValue);
                }
            } catch (UnexpectedResultException ex) {
                root.childType_ = Object.class;
                return ex.getResult();
            }
        }

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

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

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            Object childValue_ = executeChild_(frameValue);
            return (boolean) uninitialized(frameValue, childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            return (boolean) uninitialized(null, childValue);
        }

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

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

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

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

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            Object childValue_ = executeChild_(frameValue);
            return getNext().executeBoolean1(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            return getNext().executeBoolean1(childValue);
        }

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

    }
    @GeneratedBy(methodName = "isTainted(boolean)", value = IsTaintedNode.class)
    private static final class IsTainted0Node_ extends BaseNode_ {

        IsTainted0Node_(IsTaintedNodeGen root) {
            super(root, 1);
        }

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

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            boolean childValue_;
            try {
                childValue_ = root.child_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                return getNext().executeBoolean1(ex.getResult());
            }
            return root.isTainted(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (childValue instanceof Boolean) {
                boolean childValue_ = (boolean) childValue;
                return root.isTainted(childValue_);
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root) {
            return new IsTainted0Node_(root);
        }

    }
    @GeneratedBy(methodName = "isTainted(int)", value = IsTaintedNode.class)
    private static final class IsTainted1Node_ extends BaseNode_ {

        private final Class childImplicitType;

        IsTainted1Node_(IsTaintedNodeGen root, Object childValue) {
            super(root, 2);
            this.childImplicitType = RubyTypesGen.getImplicitIntegerClass(childValue);
        }

        @Override
        public boolean isSame(SpecializationNode other) {
            return super.isSame(other) && this.childImplicitType == ((IsTainted1Node_) other).childImplicitType;
        }

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

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            int childValue_;
            try {
                if (childImplicitType == int.class) {
                    childValue_ = root.child_.executeInteger(frameValue);
                } else {
                    Object childValue__ = executeChild_(frameValue);
                    childValue_ = RubyTypesGen.expectImplicitInteger(childValue__, childImplicitType);
                }
            } catch (UnexpectedResultException ex) {
                return getNext().executeBoolean1(ex.getResult());
            }
            return root.isTainted(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (RubyTypesGen.isImplicitInteger(childValue, childImplicitType)) {
                int childValue_ = RubyTypesGen.asImplicitInteger(childValue, childImplicitType);
                return root.isTainted(childValue_);
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root, Object childValue) {
            return new IsTainted1Node_(root, childValue);
        }

    }
    @GeneratedBy(methodName = "isTainted(long)", value = IsTaintedNode.class)
    private static final class IsTainted2Node_ extends BaseNode_ {

        private final Class childImplicitType;

        IsTainted2Node_(IsTaintedNodeGen root, Object childValue) {
            super(root, 3);
            this.childImplicitType = RubyTypesGen.getImplicitLongClass(childValue);
        }

        @Override
        public boolean isSame(SpecializationNode other) {
            return super.isSame(other) && this.childImplicitType == ((IsTainted2Node_) other).childImplicitType;
        }

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

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            long childValue_;
            try {
                if (childImplicitType == long.class) {
                    childValue_ = root.child_.executeLong(frameValue);
                } else if (childImplicitType == int.class) {
                    childValue_ = RubyTypes.promoteToLong(root.child_.executeInteger(frameValue));
                } else {
                    Object childValue__ = executeChild_(frameValue);
                    childValue_ = RubyTypesGen.expectImplicitLong(childValue__, childImplicitType);
                }
            } catch (UnexpectedResultException ex) {
                return getNext().executeBoolean1(ex.getResult());
            }
            return root.isTainted(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (RubyTypesGen.isImplicitLong(childValue, childImplicitType)) {
                long childValue_ = RubyTypesGen.asImplicitLong(childValue, childImplicitType);
                return root.isTainted(childValue_);
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root, Object childValue) {
            return new IsTainted2Node_(root, childValue);
        }

    }
    @GeneratedBy(methodName = "isTainted(double)", value = IsTaintedNode.class)
    private static final class IsTainted3Node_ extends BaseNode_ {

        private final Class childImplicitType;

        IsTainted3Node_(IsTaintedNodeGen root, Object childValue) {
            super(root, 4);
            this.childImplicitType = RubyTypesGen.getImplicitDoubleClass(childValue);
        }

        @Override
        public boolean isSame(SpecializationNode other) {
            return super.isSame(other) && this.childImplicitType == ((IsTainted3Node_) other).childImplicitType;
        }

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

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            double childValue_;
            try {
                if (childImplicitType == double.class) {
                    childValue_ = root.child_.executeDouble(frameValue);
                } else {
                    Object childValue__ = executeChild_(frameValue);
                    childValue_ = RubyTypesGen.expectImplicitDouble(childValue__, childImplicitType);
                }
            } catch (UnexpectedResultException ex) {
                return getNext().executeBoolean1(ex.getResult());
            }
            return root.isTainted(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (RubyTypesGen.isImplicitDouble(childValue, childImplicitType)) {
                double childValue_ = RubyTypesGen.asImplicitDouble(childValue, childImplicitType);
                return root.isTainted(childValue_);
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root, Object childValue) {
            return new IsTainted3Node_(root, childValue);
        }

    }
    @GeneratedBy(methodName = "isTaintedNilOrSymbol(DynamicObject)", value = IsTaintedNode.class)
    private static final class IsTaintedNilOrSymbolNode_ extends BaseNode_ {

        IsTaintedNilOrSymbolNode_(IsTaintedNodeGen root) {
            super(root, 5);
        }

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            DynamicObject childValue_;
            try {
                childValue_ = root.child_.executeDynamicObject(frameValue);
            } catch (UnexpectedResultException ex) {
                return getNext().executeBoolean1(ex.getResult());
            }
            if ((RubyGuards.isRubySymbol(childValue_) || root.isNil(childValue_))) {
                return root.isTaintedNilOrSymbol(childValue_);
            }
            return getNext().executeBoolean1(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (childValue instanceof DynamicObject) {
                DynamicObject childValue_ = (DynamicObject) childValue;
                if ((RubyGuards.isRubySymbol(childValue_) || root.isNil(childValue_))) {
                    return root.isTaintedNilOrSymbol(childValue_);
                }
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root) {
            return new IsTaintedNilOrSymbolNode_(root);
        }

    }
    @GeneratedBy(methodName = "isTainted(DynamicObject, ReadObjectFieldNode)", value = IsTaintedNode.class)
    private static final class IsTainted4Node_ extends BaseNode_ {

        @Child private ReadObjectFieldNode readTaintedNode;

        IsTainted4Node_(IsTaintedNodeGen root, ReadObjectFieldNode readTaintedNode) {
            super(root, 6);
            this.readTaintedNode = readTaintedNode;
        }

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            DynamicObject childValue_;
            try {
                childValue_ = root.child_.executeDynamicObject(frameValue);
            } catch (UnexpectedResultException ex) {
                return getNext().executeBoolean1(ex.getResult());
            }
            if ((!(RubyGuards.isRubySymbol(childValue_))) && (!(root.isNil(childValue_)))) {
                return root.isTainted(childValue_, this.readTaintedNode);
            }
            return getNext().executeBoolean1(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (childValue instanceof DynamicObject) {
                DynamicObject childValue_ = (DynamicObject) childValue;
                if ((!(RubyGuards.isRubySymbol(childValue_))) && (!(root.isNil(childValue_)))) {
                    return root.isTainted(childValue_, this.readTaintedNode);
                }
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root, ReadObjectFieldNode readTaintedNode) {
            return new IsTainted4Node_(root, readTaintedNode);
        }

    }
    @GeneratedBy(methodName = "isTainted(Object)", value = IsTaintedNode.class)
    private static final class FallbackNode_ extends BaseNode_ {

        FallbackNode_(IsTaintedNodeGen root) {
            super(root, 2147483646);
        }

        @TruffleBoundary
        private boolean guardFallback(Object childValue) {
            return createNext(null, childValue) == null;
        }

        @Override
        public boolean executeBoolean0(VirtualFrame frameValue) {
            Object childValue_ = executeChild_(frameValue);
            if (guardFallback(childValue_)) {
                return root.isTainted(childValue_);
            }
            return getNext().executeBoolean1(childValue_);
        }

        @Override
        public boolean executeBoolean1(Object childValue) {
            if (guardFallback(childValue)) {
                return root.isTainted(childValue);
            }
            return getNext().executeBoolean1(childValue);
        }

        static BaseNode_ create(IsTaintedNodeGen root) {
            return new FallbackNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy