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

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

// CheckStyle: start generated
package org.jruby.truffle.language.objects;

import com.oracle.truffle.api.Assumption;
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.nodes.InvalidAssumptionException;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.Property;
import com.oracle.truffle.api.object.Shape;

@GeneratedBy(ReadObjectFieldNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class ReadObjectFieldNodeGen extends ReadObjectFieldNode implements SpecializedNode {

    @CompilationFinal private boolean excludeReadObjectFieldCached_;
    @CompilationFinal private boolean excludeUpdateShapeAndRead_;
    @Child private BaseNode_ specialization_;

    private ReadObjectFieldNodeGen(Object name, Object defaultValue) {
        super(name, defaultValue);
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object execute(DynamicObject arg0Value) {
        return specialization_.execute(arg0Value);
    }

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

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

    public static ReadObjectFieldNode create(Object name, Object defaultValue) {
        return new ReadObjectFieldNodeGen(name, defaultValue);
    }

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

        @CompilationFinal protected ReadObjectFieldNodeGen root;

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

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

        @Override
        protected final Node[] getSuppliedChildren() {
            return new Node[] {null};
        }

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object arg0Value) {
            return this.execute((DynamicObject) arg0Value);
        }

        public abstract Object execute(DynamicObject arg0Value);

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object arg0Value) {
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                Shape cachedShape1 = (arg0Value_.getShape());
                if ((arg0Value_.getShape() == cachedShape1)) {
                    if (!root.excludeReadObjectFieldCached_) {
                        Property property1 = (root.getProperty(cachedShape1, root.name));
                        Assumption assumption0_1 = (cachedShape1.getValidAssumption());
                        if (isValid(assumption0_1)) {
                            SpecializationNode s = ReadObjectFieldCachedNode_.create(root, cachedShape1, property1, assumption0_1);
                            if (countSame(s) < (root.getCacheLimit())) {
                                return s;
                            }
                        }
                    }
                }
                if ((ShapeCachingGuards.updateShape(arg0Value_))) {
                    if (!root.excludeUpdateShapeAndRead_) {
                        return UpdateShapeAndReadNode_.create(root);
                    }
                }
                root.excludeReadObjectFieldCached_ = true;
                root.excludeUpdateShapeAndRead_ = true;
                return ReadObjectFieldUncachedNode_.create(root);
            }
            return null;
        }

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

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

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

        @Override
        public Object execute(DynamicObject arg0Value) {
            return uninitialized(null, arg0Value);
        }

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

    }
    @GeneratedBy(methodName = "readObjectFieldCached(DynamicObject, Shape, Property)", value = ReadObjectFieldNode.class)
    private static final class ReadObjectFieldCachedNode_ extends BaseNode_ {

        private final Shape cachedShape;
        private final Property property;
        @CompilationFinal private final Assumption assumption0_;

        ReadObjectFieldCachedNode_(ReadObjectFieldNodeGen root, Shape cachedShape, Property property, Assumption assumption0_) {
            super(root, 1);
            this.cachedShape = cachedShape;
            this.property = property;
            this.assumption0_ = assumption0_;
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value) {
            if (newNode.getClass() == ReadObjectFieldUncachedNode_.class) {
                removeSame("Contained by readObjectFieldUncached(DynamicObject)");
            }
            return super.merge(newNode, frameValue, arg0Value);
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object arg0Value) {
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                if ((arg0Value_.getShape() == this.cachedShape)) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Object execute(DynamicObject arg0Value) {
            try {
                check(this.assumption0_);
            } catch (InvalidAssumptionException ae) {
                return removeThis("Assumption [assumption0] invalidated", null, arg0Value);
            }
            if ((arg0Value.getShape() == this.cachedShape)) {
                return root.readObjectFieldCached(arg0Value, this.cachedShape, this.property);
            }
            return getNext().execute(arg0Value);
        }

        static BaseNode_ create(ReadObjectFieldNodeGen root, Shape cachedShape, Property property, Assumption assumption0_) {
            return new ReadObjectFieldCachedNode_(root, cachedShape, property, assumption0_);
        }

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

        UpdateShapeAndReadNode_(ReadObjectFieldNodeGen root) {
            super(root, 2);
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value) {
            if (newNode.getClass() == ReadObjectFieldUncachedNode_.class) {
                removeSame("Contained by readObjectFieldUncached(DynamicObject)");
            }
            return super.merge(newNode, frameValue, arg0Value);
        }

        @Override
        public Object execute(DynamicObject arg0Value) {
            if ((ShapeCachingGuards.updateShape(arg0Value))) {
                return root.updateShapeAndRead(arg0Value);
            }
            return getNext().execute(arg0Value);
        }

        static BaseNode_ create(ReadObjectFieldNodeGen root) {
            return new UpdateShapeAndReadNode_(root);
        }

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

        ReadObjectFieldUncachedNode_(ReadObjectFieldNodeGen root) {
            super(root, 3);
        }

        @Override
        public Object execute(DynamicObject arg0Value) {
            return root.readObjectFieldUncached(arg0Value);
        }

        static BaseNode_ create(ReadObjectFieldNodeGen root) {
            return new ReadObjectFieldUncachedNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy