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

org.jruby.truffle.language.objects.shared.WriteBarrierNodeGen 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(WriteBarrierNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class WriteBarrierNodeGen extends WriteBarrierNode implements SpecializedNode {

    @CompilationFinal private boolean excludeWriteBarrierCached_;
    @CompilationFinal private boolean excludeUpdateShapeAndWriteBarrier_;
    @Child private BaseNode_ specialization_;

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

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

    @Override
    public void executeWriteBarrier(Object arg0Value) {
        specialization_.executeVoid(arg0Value);
        return;
    }

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

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

    public static WriteBarrierNode create(int depth) {
        return new WriteBarrierNodeGen(depth);
    }

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

        @CompilationFinal protected WriteBarrierNodeGen root;

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

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

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

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

        public abstract void executeVoid(Object 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) && (root.depth < WriteBarrierNode.MAX_DEPTH)) {
                    if (!root.excludeWriteBarrierCached_) {
                        boolean alreadyShared1 = (WriteBarrierNode.isShared(cachedShape1));
                        ShareObjectNode shareObjectNode1 = (root.createShareObjectNode(alreadyShared1));
                        Assumption assumption0_1 = (cachedShape1.getValidAssumption());
                        if (isValid(assumption0_1)) {
                            SpecializationNode s = WriteBarrierCachedNode_.create(root, cachedShape1, alreadyShared1, shareObjectNode1, assumption0_1);
                            if (countSame(s) < (WriteBarrierNode.CACHE_LIMIT)) {
                                return s;
                            }
                        }
                    }
                }
                if ((ShapeCachingGuards.updateShape(arg0Value_))) {
                    if (!root.excludeUpdateShapeAndWriteBarrier_) {
                        return UpdateShapeAndWriteBarrierNode_.create(root);
                    }
                }
                root.excludeWriteBarrierCached_ = true;
                root.excludeUpdateShapeAndWriteBarrier_ = true;
                return WriteBarrierUncachedNode_.create(root);
            }
            if ((!(WriteBarrierNode.isDynamicObject(arg0Value)))) {
                return NoWriteBarrierNode_.create(root);
            }
            return null;
        }

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

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

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

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

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

    }
    @GeneratedBy(methodName = "writeBarrierCached(DynamicObject, Shape, boolean, ShareObjectNode)", value = WriteBarrierNode.class)
    private static final class WriteBarrierCachedNode_ extends BaseNode_ {

        private final Shape cachedShape;
        private final boolean alreadyShared;
        @Child private ShareObjectNode shareObjectNode;
        @CompilationFinal private final Assumption assumption0_;

        WriteBarrierCachedNode_(WriteBarrierNodeGen root, Shape cachedShape, boolean alreadyShared, ShareObjectNode shareObjectNode, Assumption assumption0_) {
            super(root, 1);
            this.cachedShape = cachedShape;
            this.alreadyShared = alreadyShared;
            this.shareObjectNode = shareObjectNode;
            this.assumption0_ = assumption0_;
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value) {
            if (newNode.getClass() == WriteBarrierUncachedNode_.class) {
                removeSame("Contained by writeBarrierUncached(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)) {
                    assert (root.depth < WriteBarrierNode.MAX_DEPTH);
                    return true;
                }
            }
            return false;
        }

        @Override
        public void executeVoid(Object arg0Value) {
            try {
                check(this.assumption0_);
            } catch (InvalidAssumptionException ae) {
                removeThis("Assumption [assumption0] invalidated", null, arg0Value);
                return;
            }
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                if ((arg0Value_.getShape() == this.cachedShape)) {
                    assert (root.depth < WriteBarrierNode.MAX_DEPTH);
                    root.writeBarrierCached(arg0Value_, this.cachedShape, this.alreadyShared, this.shareObjectNode);
                    return;
                }
            }
            getNext().executeVoid(arg0Value);
            return;
        }

        static BaseNode_ create(WriteBarrierNodeGen root, Shape cachedShape, boolean alreadyShared, ShareObjectNode shareObjectNode, Assumption assumption0_) {
            return new WriteBarrierCachedNode_(root, cachedShape, alreadyShared, shareObjectNode, assumption0_);
        }

    }
    @GeneratedBy(methodName = "updateShapeAndWriteBarrier(DynamicObject)", value = WriteBarrierNode.class)
    private static final class UpdateShapeAndWriteBarrierNode_ extends BaseNode_ {

        UpdateShapeAndWriteBarrierNode_(WriteBarrierNodeGen root) {
            super(root, 2);
        }

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

        @Override
        public void executeVoid(Object arg0Value) {
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                if ((ShapeCachingGuards.updateShape(arg0Value_))) {
                    root.updateShapeAndWriteBarrier(arg0Value_);
                    return;
                }
            }
            getNext().executeVoid(arg0Value);
            return;
        }

        static BaseNode_ create(WriteBarrierNodeGen root) {
            return new UpdateShapeAndWriteBarrierNode_(root);
        }

    }
    @GeneratedBy(methodName = "writeBarrierUncached(DynamicObject)", value = WriteBarrierNode.class)
    private static final class WriteBarrierUncachedNode_ extends BaseNode_ {

        WriteBarrierUncachedNode_(WriteBarrierNodeGen root) {
            super(root, 3);
        }

        @Override
        public void executeVoid(Object arg0Value) {
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                root.writeBarrierUncached(arg0Value_);
                return;
            }
            getNext().executeVoid(arg0Value);
            return;
        }

        static BaseNode_ create(WriteBarrierNodeGen root) {
            return new WriteBarrierUncachedNode_(root);
        }

    }
    @GeneratedBy(methodName = "noWriteBarrier(Object)", value = WriteBarrierNode.class)
    private static final class NoWriteBarrierNode_ extends BaseNode_ {

        NoWriteBarrierNode_(WriteBarrierNodeGen root) {
            super(root, 4);
        }

        @Override
        public void executeVoid(Object arg0Value) {
            if ((!(WriteBarrierNode.isDynamicObject(arg0Value)))) {
                root.noWriteBarrier(arg0Value);
                return;
            }
            getNext().executeVoid(arg0Value);
            return;
        }

        static BaseNode_ create(WriteBarrierNodeGen root) {
            return new NoWriteBarrierNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy