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

org.jruby.truffle.language.objects.ObjectIVarGetNodeGen 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.dsl.internal.SuppressFBWarnings;
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.RubyNode;

@GeneratedBy(ObjectIVarGetNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class ObjectIVarGetNodeGen extends ObjectIVarGetNode implements SpecializedNode {

    @Child private RubyNode object_;
    @Child private RubyNode name_;
    @CompilationFinal private boolean excludeIvarGetCached_;
    @Child private BaseNode_ specialization_;

    private ObjectIVarGetNodeGen(boolean checkName, RubyNode object, RubyNode name) {
        super(checkName);
        this.object_ = object;
        this.name_ = name;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object executeIVarGet(DynamicObject objectValue, String nameValue) {
        return specialization_.execute1(objectValue, nameValue);
    }

    @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 ObjectIVarGetNode create(boolean checkName, RubyNode object, RubyNode name) {
        return new ObjectIVarGetNodeGen(checkName, object, name);
    }

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

        @CompilationFinal protected ObjectIVarGetNodeGen root;

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

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

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

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

        public abstract Object execute_(Object objectValue, Object nameValue);

        public Object execute1(DynamicObject objectValue, String nameValue) {
            return execute_(objectValue, nameValue);
        }

        public Object execute0(VirtualFrame frameValue) {
            Object objectValue_ = root.object_.execute(frameValue);
            Object nameValue_ = root.name_.execute(frameValue);
            return execute_(objectValue_, nameValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object objectValue, Object nameValue) {
            if (objectValue instanceof DynamicObject && nameValue instanceof String) {
                DynamicObject objectValue_ = (DynamicObject) objectValue;
                String nameValue_ = (String) nameValue;
                String cachedName1 = (nameValue_);
                if ((nameValue_ == cachedName1)) {
                    if (!root.excludeIvarGetCached_) {
                        ReadObjectFieldNode readObjectFieldNode1 = (root.createReadFieldNode(root.checkName(cachedName1, objectValue_)));
                        SpecializationNode s = IvarGetCachedNode_.create(root, cachedName1, readObjectFieldNode1);
                        if (countSame(s) < (root.getCacheLimit())) {
                            return s;
                        }
                    }
                }
                root.excludeIvarGetCached_ = true;
                return IvarGetUncachedNode_.create(root);
            }
            return null;
        }

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

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

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

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

        @Override
        public Object execute_(Object objectValue, Object nameValue) {
            return uninitialized(null, objectValue, nameValue);
        }

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

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

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

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

        @Override
        public Object execute_(Object objectValue, Object nameValue) {
            return getNext().execute_(objectValue, nameValue);
        }

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

    }
    @GeneratedBy(methodName = "ivarGetCached(DynamicObject, String, String, ReadObjectFieldNode)", value = ObjectIVarGetNode.class)
    private static final class IvarGetCachedNode_ extends BaseNode_ {

        private final String cachedName;
        @Child private ReadObjectFieldNode readObjectFieldNode;

        IvarGetCachedNode_(ObjectIVarGetNodeGen root, String cachedName, ReadObjectFieldNode readObjectFieldNode) {
            super(root, 1);
            this.cachedName = cachedName;
            this.readObjectFieldNode = readObjectFieldNode;
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object objectValue, Object nameValue) {
            if (newNode.getClass() == IvarGetUncachedNode_.class) {
                removeSame("Contained by ivarGetUncached(DynamicObject, String)");
            }
            return super.merge(newNode, frameValue, objectValue, nameValue);
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object objectValue, Object nameValue) {
            if (objectValue instanceof DynamicObject && nameValue instanceof String) {
                String nameValue_ = (String) nameValue;
                if ((nameValue_ == this.cachedName)) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Object execute1(DynamicObject objectValue, String nameValue) {
            if ((nameValue == this.cachedName)) {
                return root.ivarGetCached(objectValue, nameValue, this.cachedName, this.readObjectFieldNode);
            }
            return getNext().execute1(objectValue, nameValue);
        }

        @Override
        public Object execute_(Object objectValue, Object nameValue) {
            if (objectValue instanceof DynamicObject && nameValue instanceof String) {
                DynamicObject objectValue_ = (DynamicObject) objectValue;
                String nameValue_ = (String) nameValue;
                if ((nameValue_ == this.cachedName)) {
                    return root.ivarGetCached(objectValue_, nameValue_, this.cachedName, this.readObjectFieldNode);
                }
            }
            return getNext().execute_(objectValue, nameValue);
        }

        static BaseNode_ create(ObjectIVarGetNodeGen root, String cachedName, ReadObjectFieldNode readObjectFieldNode) {
            return new IvarGetCachedNode_(root, cachedName, readObjectFieldNode);
        }

    }
    @GeneratedBy(methodName = "ivarGetUncached(DynamicObject, String)", value = ObjectIVarGetNode.class)
    private static final class IvarGetUncachedNode_ extends BaseNode_ {

        IvarGetUncachedNode_(ObjectIVarGetNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute1(DynamicObject objectValue, String nameValue) {
            return root.ivarGetUncached(objectValue, nameValue);
        }

        @Override
        public Object execute_(Object objectValue, Object nameValue) {
            if (objectValue instanceof DynamicObject && nameValue instanceof String) {
                DynamicObject objectValue_ = (DynamicObject) objectValue;
                String nameValue_ = (String) nameValue;
                return root.ivarGetUncached(objectValue_, nameValue_);
            }
            return getNext().execute_(objectValue, nameValue);
        }

        static BaseNode_ create(ObjectIVarGetNodeGen root) {
            return new IvarGetUncachedNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy