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

org.jruby.truffle.language.objects.shared.ShareObjectNodeGen Maven / Gradle / Ivy

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

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.Shape;
import org.jruby.truffle.language.objects.ShapeCachingGuards;

@GeneratedBy(ShareObjectNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class ShareObjectNodeGen extends ShareObjectNode implements SpecializedNode {

    @CompilationFinal private boolean excludeShareCached_;
    @CompilationFinal private boolean excludeUpdateShapeAndShare_;
    @Child private BaseNode_ specialization_;

    private ShareObjectNodeGen(int depth) {
        super(depth);
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public void executeShare(DynamicObject arg0Value) {
        specialization_.executeVoid(arg0Value);
        return;
    }

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

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

    public static ShareObjectNode create(int depth) {
        return new ShareObjectNodeGen(depth);
    }

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

        @CompilationFinal protected ShareObjectNodeGen root;

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

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

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

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

        public abstract void executeVoid(DynamicObject arg0Value);

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object arg0Value) {
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                Shape cachedShape1 = (ShareObjectNode.ensureSharedClasses(arg0Value_.getShape()));
                if ((arg0Value_.getShape() == cachedShape1)) {
                    if (!root.excludeShareCached_) {
                        ShareInternalFieldsNode shareInternalFieldsNode1 = (root.createShareInternalFieldsNode());
                        ReadAndShareFieldNode[] readAndShareFieldNodes1 = (root.createReadAndShareFieldNodes(ShareObjectNode.getObjectProperties(cachedShape1)));
                        Shape sharedShape1 = (ShareObjectNode.createSharedShape(arg0Value_));
                        Assumption assumption0_1 = (cachedShape1.getValidAssumption());
                        if (isValid(assumption0_1)) {
                            SpecializationNode s = ShareCachedNode_.create(root, cachedShape1, shareInternalFieldsNode1, readAndShareFieldNodes1, sharedShape1, assumption0_1);
                            if (countSame(s) < (ShareObjectNode.CACHE_LIMIT)) {
                                return s;
                            }
                        }
                    }
                }
                if ((ShapeCachingGuards.updateShape(arg0Value_))) {
                    if (!root.excludeUpdateShapeAndShare_) {
                        return UpdateShapeAndShareNode_.create(root);
                    }
                }
                root.excludeShareCached_ = true;
                root.excludeUpdateShapeAndShare_ = true;
                return ShareUncachedNode_.create(root);
            }
            return null;
        }

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

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

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

        @Override
        public void executeVoid(DynamicObject arg0Value) {
            uninitialized(null, arg0Value);
            return;
        }

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

    }
    @GeneratedBy(methodName = "shareCached(DynamicObject, Shape, ShareInternalFieldsNode, ReadAndShareFieldNode[], Shape)", value = ShareObjectNode.class)
    private static final class ShareCachedNode_ extends BaseNode_ {

        private final Shape cachedShape;
        @Child private ShareInternalFieldsNode shareInternalFieldsNode;
        @Children private final ReadAndShareFieldNode[] readAndShareFieldNodes;
        private final Shape sharedShape;
        @CompilationFinal private final Assumption assumption0_;

        ShareCachedNode_(ShareObjectNodeGen root, Shape cachedShape, ShareInternalFieldsNode shareInternalFieldsNode, ReadAndShareFieldNode[] readAndShareFieldNodes, Shape sharedShape, Assumption assumption0_) {
            super(root, 1);
            this.cachedShape = cachedShape;
            this.shareInternalFieldsNode = shareInternalFieldsNode;
            this.readAndShareFieldNodes = readAndShareFieldNodes;
            this.sharedShape = sharedShape;
            this.assumption0_ = assumption0_;
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value) {
            if (newNode.getClass() == ShareUncachedNode_.class) {
                removeSame("Contained by shareUncached(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 void executeVoid(DynamicObject arg0Value) {
            try {
                check(this.assumption0_);
            } catch (InvalidAssumptionException ae) {
                removeThis("Assumption [assumption0] invalidated", null, arg0Value);
                return;
            }
            if ((arg0Value.getShape() == this.cachedShape)) {
                root.shareCached(arg0Value, this.cachedShape, this.shareInternalFieldsNode, this.readAndShareFieldNodes, this.sharedShape);
                return;
            }
            getNext().executeVoid(arg0Value);
            return;
        }

        static BaseNode_ create(ShareObjectNodeGen root, Shape cachedShape, ShareInternalFieldsNode shareInternalFieldsNode, ReadAndShareFieldNode[] readAndShareFieldNodes, Shape sharedShape, Assumption assumption0_) {
            return new ShareCachedNode_(root, cachedShape, shareInternalFieldsNode, readAndShareFieldNodes, sharedShape, assumption0_);
        }

    }
    @GeneratedBy(methodName = "updateShapeAndShare(DynamicObject)", value = ShareObjectNode.class)
    private static final class UpdateShapeAndShareNode_ extends BaseNode_ {

        UpdateShapeAndShareNode_(ShareObjectNodeGen root) {
            super(root, 2);
        }

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

        @Override
        public void executeVoid(DynamicObject arg0Value) {
            if ((ShapeCachingGuards.updateShape(arg0Value))) {
                root.updateShapeAndShare(arg0Value);
                return;
            }
            getNext().executeVoid(arg0Value);
            return;
        }

        static BaseNode_ create(ShareObjectNodeGen root) {
            return new UpdateShapeAndShareNode_(root);
        }

    }
    @GeneratedBy(methodName = "shareUncached(DynamicObject)", value = ShareObjectNode.class)
    private static final class ShareUncachedNode_ extends BaseNode_ {

        ShareUncachedNode_(ShareObjectNodeGen root) {
            super(root, 3);
        }

        @Override
        public void executeVoid(DynamicObject arg0Value) {
            root.shareUncached(arg0Value);
            return;
        }

        static BaseNode_ create(ShareObjectNodeGen root) {
            return new ShareUncachedNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy