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

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

The newest version!
// 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.Location;
import com.oracle.truffle.api.object.Shape;
import org.jruby.truffle.language.objects.shared.WriteBarrierNode;

@GeneratedBy(WriteObjectFieldNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class WriteObjectFieldNodeGen extends WriteObjectFieldNode implements SpecializedNode {

    @CompilationFinal private boolean excludeWriteExistingField_;
    @CompilationFinal private boolean excludeWriteNewField_;
    @CompilationFinal private boolean excludeUpdateShapeAndWrite_;
    @Child private BaseNode_ specialization_;

    private WriteObjectFieldNodeGen(Object name) {
        super(name);
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public void execute(DynamicObject arg0Value, Object arg1Value) {
        specialization_.executeVoid(arg0Value, arg1Value);
        return;
    }

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

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

    public static WriteObjectFieldNode create(Object name) {
        return new WriteObjectFieldNodeGen(name);
    }

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

        @CompilationFinal protected WriteObjectFieldNodeGen root;

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

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

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

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

        public abstract void executeVoid(DynamicObject arg0Value, Object arg1Value);

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object arg0Value, Object arg1Value) {
            if (arg0Value instanceof DynamicObject) {
                DynamicObject arg0Value_ = (DynamicObject) arg0Value;
                Location location1 = (root.getLocation(arg0Value_, arg1Value));
                Shape cachedShape1 = (arg0Value_.getShape());
                Assumption validLocation1 = (root.createAssumption());
                if ((location1 != null) && (arg0Value_.getShape() == cachedShape1)) {
                    if (!root.excludeWriteExistingField_) {
                        boolean shared1 = (root.isShared(cachedShape1));
                        WriteBarrierNode writeBarrierNode1 = (root.createWriteBarrierNode(shared1));
                        Assumption assumption0_1 = (cachedShape1.getValidAssumption());
                        Assumption assumption1_1 = (validLocation1);
                        if (isValid(assumption0_1) && isValid(assumption1_1)) {
                            SpecializationNode s = WriteExistingFieldNode_.create(root, location1, cachedShape1, validLocation1, shared1, writeBarrierNode1, assumption0_1, assumption1_1);
                            if (countSame(s) < (root.getCacheLimit())) {
                                return s;
                            }
                        }
                    }
                }
                Location location2 = (root.getLocation(arg0Value_, arg1Value));
                Shape oldShape2 = (arg0Value_.getShape());
                Shape newShape2 = (root.defineProperty(oldShape2, arg1Value));
                Assumption validLocation2 = (root.createAssumption());
                if ((location2 == null) && (arg0Value_.getShape() == oldShape2)) {
                    if (!root.excludeWriteNewField_) {
                        Location newLocation2 = (root.getNewLocation(newShape2));
                        boolean shared2 = (root.isShared(oldShape2));
                        WriteBarrierNode writeBarrierNode2 = (root.createWriteBarrierNode(shared2));
                        Assumption assumption0_2 = (oldShape2.getValidAssumption());
                        Assumption assumption1_2 = (newShape2.getValidAssumption());
                        Assumption assumption2_2 = (validLocation2);
                        if (isValid(assumption0_2) && isValid(assumption1_2) && isValid(assumption2_2)) {
                            SpecializationNode s = WriteNewFieldNode_.create(root, location2, oldShape2, newShape2, newLocation2, validLocation2, shared2, writeBarrierNode2, assumption0_2, assumption1_2, assumption2_2);
                            if (countSame(s) < (root.getCacheLimit())) {
                                return s;
                            }
                        }
                    }
                }
                if ((ShapeCachingGuards.updateShape(arg0Value_))) {
                    if (!root.excludeUpdateShapeAndWrite_) {
                        return UpdateShapeAndWriteNode_.create(root);
                    }
                }
                root.excludeWriteExistingField_ = true;
                root.excludeWriteNewField_ = true;
                root.excludeUpdateShapeAndWrite_ = true;
                return WriteUncachedNode_.create(root);
            }
            return null;
        }

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

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

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

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

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

    }
    @GeneratedBy(methodName = "writeExistingField(DynamicObject, Object, Location, Shape, Assumption, boolean, WriteBarrierNode)", value = WriteObjectFieldNode.class)
    private static final class WriteExistingFieldNode_ extends BaseNode_ {

        private final Location location;
        private final Shape cachedShape;
        private final Assumption validLocation;
        private final boolean shared;
        @Child private WriteBarrierNode writeBarrierNode;
        @CompilationFinal private final Assumption assumption0_;
        @CompilationFinal private final Assumption assumption1_;

        WriteExistingFieldNode_(WriteObjectFieldNodeGen root, Location location, Shape cachedShape, Assumption validLocation, boolean shared, WriteBarrierNode writeBarrierNode, Assumption assumption0_, Assumption assumption1_) {
            super(root, 1);
            this.location = location;
            this.cachedShape = cachedShape;
            this.validLocation = validLocation;
            this.shared = shared;
            this.writeBarrierNode = writeBarrierNode;
            this.assumption0_ = assumption0_;
            this.assumption1_ = assumption1_;
        }

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

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

        @Override
        public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
            try {
                check(this.assumption0_);
                check(this.assumption1_);
            } catch (InvalidAssumptionException ae) {
                removeThis("Assumption [assumption0, assumption1] invalidated", null, arg0Value, arg1Value);
                return;
            }
            if ((arg0Value.getShape() == this.cachedShape)) {
                assert (this.location != null);
                root.writeExistingField(arg0Value, arg1Value, this.location, this.cachedShape, this.validLocation, this.shared, this.writeBarrierNode);
                return;
            }
            getNext().executeVoid(arg0Value, arg1Value);
            return;
        }

        static BaseNode_ create(WriteObjectFieldNodeGen root, Location location, Shape cachedShape, Assumption validLocation, boolean shared, WriteBarrierNode writeBarrierNode, Assumption assumption0_, Assumption assumption1_) {
            return new WriteExistingFieldNode_(root, location, cachedShape, validLocation, shared, writeBarrierNode, assumption0_, assumption1_);
        }

    }
    @GeneratedBy(methodName = "writeNewField(DynamicObject, Object, Location, Shape, Shape, Location, Assumption, boolean, WriteBarrierNode)", value = WriteObjectFieldNode.class)
    private static final class WriteNewFieldNode_ extends BaseNode_ {

        private final Location location;
        private final Shape oldShape;
        private final Shape newShape;
        private final Location newLocation;
        private final Assumption validLocation;
        private final boolean shared;
        @Child private WriteBarrierNode writeBarrierNode;
        @CompilationFinal private final Assumption assumption0_;
        @CompilationFinal private final Assumption assumption1_;
        @CompilationFinal private final Assumption assumption2_;

        WriteNewFieldNode_(WriteObjectFieldNodeGen root, Location location, Shape oldShape, Shape newShape, Location newLocation, Assumption validLocation, boolean shared, WriteBarrierNode writeBarrierNode, Assumption assumption0_, Assumption assumption1_, Assumption assumption2_) {
            super(root, 2);
            this.location = location;
            this.oldShape = oldShape;
            this.newShape = newShape;
            this.newLocation = newLocation;
            this.validLocation = validLocation;
            this.shared = shared;
            this.writeBarrierNode = writeBarrierNode;
            this.assumption0_ = assumption0_;
            this.assumption1_ = assumption1_;
            this.assumption2_ = assumption2_;
        }

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

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

        @Override
        public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
            try {
                check(this.assumption0_);
                check(this.assumption1_);
                check(this.assumption2_);
            } catch (InvalidAssumptionException ae) {
                removeThis("Assumption [assumption0, assumption1, assumption2] invalidated", null, arg0Value, arg1Value);
                return;
            }
            if ((arg0Value.getShape() == this.oldShape)) {
                assert (this.location == null);
                root.writeNewField(arg0Value, arg1Value, this.location, this.oldShape, this.newShape, this.newLocation, this.validLocation, this.shared, this.writeBarrierNode);
                return;
            }
            getNext().executeVoid(arg0Value, arg1Value);
            return;
        }

        static BaseNode_ create(WriteObjectFieldNodeGen root, Location location, Shape oldShape, Shape newShape, Location newLocation, Assumption validLocation, boolean shared, WriteBarrierNode writeBarrierNode, Assumption assumption0_, Assumption assumption1_, Assumption assumption2_) {
            return new WriteNewFieldNode_(root, location, oldShape, newShape, newLocation, validLocation, shared, writeBarrierNode, assumption0_, assumption1_, assumption2_);
        }

    }
    @GeneratedBy(methodName = "updateShapeAndWrite(DynamicObject, Object)", value = WriteObjectFieldNode.class)
    private static final class UpdateShapeAndWriteNode_ extends BaseNode_ {

        UpdateShapeAndWriteNode_(WriteObjectFieldNodeGen root) {
            super(root, 3);
        }

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

        @Override
        public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
            if ((ShapeCachingGuards.updateShape(arg0Value))) {
                root.updateShapeAndWrite(arg0Value, arg1Value);
                return;
            }
            getNext().executeVoid(arg0Value, arg1Value);
            return;
        }

        static BaseNode_ create(WriteObjectFieldNodeGen root) {
            return new UpdateShapeAndWriteNode_(root);
        }

    }
    @GeneratedBy(methodName = "writeUncached(DynamicObject, Object)", value = WriteObjectFieldNode.class)
    private static final class WriteUncachedNode_ extends BaseNode_ {

        WriteUncachedNode_(WriteObjectFieldNodeGen root) {
            super(root, 4);
        }

        @Override
        public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
            root.writeUncached(arg0Value, arg1Value);
            return;
        }

        static BaseNode_ create(WriteObjectFieldNodeGen root) {
            return new WriteUncachedNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy