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

com.oracle.truffle.sl.nodes.access.SLWritePropertyNodeGen Maven / Gradle / Ivy

There is a newer version: 1.0.0-rc7
Show newest version
// CheckStyle: start generated
/*
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * The Universal Permissive License (UPL), Version 1.0
 *
 * Subject to the condition set forth below, permission is hereby granted to any
 * person obtaining a copy of this software, associated documentation and/or
 * data (collectively the "Software"), free of charge and under any and all
 * copyright rights in the Software, and any and all patent rights owned or
 * freely licensable by each licensor hereunder covering either (i) the
 * unmodified Software as contributed to or provided by such licensor, or (ii)
 * the Larger Works (as defined below), to deal in both
 *
 * (a) the Software, and
 *
 * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
 * one is included with the Software each a "Larger Work" to which the Software
 * is contributed by such licensors),
 *
 * without restriction, including without limitation the rights to copy, create
 * derivative works of, display, perform, and distribute the Software and make,
 * use, sell, offer for sale, import, export, have made, and have sold the
 * Software and the Larger Work(s), and to sublicense the foregoing rights on
 * either these or other terms.
 *
 * This license is subject to the following condition:
 *
 * The above copyright notice and either this complete permission notice or at a
 * minimum a reference to the UPL must be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.oracle.truffle.sl.nodes.access;

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.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.TruffleObject;
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.source.SourceSection;
import com.oracle.truffle.sl.nodes.SLExpressionNode;

@GeneratedBy(SLWritePropertyNode.class)
public final class SLWritePropertyNodeGen extends SLWritePropertyNode implements SpecializedNode {

    @Child private SLExpressionNode receiver_;
    @Child private SLExpressionNode value_;
    @Child private BaseNode_ specialization_;

    private SLWritePropertyNodeGen(SourceSection src, String propertyName, SLExpressionNode receiver, SLExpressionNode value) {
        super(src, propertyName);
        this.receiver_ = receiver;
        this.value_ = value;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object executeGeneric(VirtualFrame frameValue) {
        return specialization_.execute(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 SLWritePropertyNode create(SourceSection src, String propertyName, SLExpressionNode receiver, SLExpressionNode value) {
        return new SLWritePropertyNodeGen(src, propertyName, receiver, value);
    }

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

        @CompilationFinal protected SLWritePropertyNodeGen root;

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

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

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

        @Override
        public final Object acceptAndExecute(Frame frameValue, Object receiverValue, Object valueValue) {
            return this.execute_((VirtualFrame) frameValue, receiverValue, valueValue);
        }

        public abstract Object execute_(VirtualFrame frameValue, Object receiverValue, Object valueValue);

        public Object execute(VirtualFrame frameValue) {
            Object receiverValue_ = root.receiver_.executeGeneric(frameValue);
            Object valueValue_ = root.value_.executeGeneric(frameValue);
            return execute_(frameValue, receiverValue_, valueValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object receiverValue, Object valueValue) {
            if (receiverValue instanceof DynamicObject) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                if ((SLExpressionNode.isSLObject(receiverValue_))) {
                    return SLObjectNode_.create(root);
                }
            }
            if (receiverValue instanceof TruffleObject) {
                return ForeignObjectNode_.create(root);
            }
            return null;
        }

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

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

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

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

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object valueValue) {
            return uninitialized(frameValue, receiverValue, valueValue);
        }

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

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

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

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

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object valueValue) {
            return getNext().execute_(frameValue, receiverValue, valueValue);
        }

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

    }
    @GeneratedBy(methodName = "doSLObject(DynamicObject, Object)", value = SLWritePropertyNode.class)
    private static final class SLObjectNode_ extends BaseNode_ {

        SLObjectNode_(SLWritePropertyNodeGen root) {
            super(root, 1);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object valueValue) {
            if (receiverValue instanceof DynamicObject) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                if ((SLExpressionNode.isSLObject(receiverValue_))) {
                    return root.doSLObject(receiverValue_, valueValue);
                }
            }
            return getNext().execute_(frameValue, receiverValue, valueValue);
        }

        static BaseNode_ create(SLWritePropertyNodeGen root) {
            return new SLObjectNode_(root);
        }

    }
    @GeneratedBy(methodName = "doForeignObject(VirtualFrame, TruffleObject, Object)", value = SLWritePropertyNode.class)
    private static final class ForeignObjectNode_ extends BaseNode_ {

        ForeignObjectNode_(SLWritePropertyNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object valueValue) {
            if (receiverValue instanceof TruffleObject) {
                TruffleObject receiverValue_ = (TruffleObject) receiverValue;
                return root.doForeignObject(frameValue, receiverValue_, valueValue);
            }
            return getNext().execute_(frameValue, receiverValue, valueValue);
        }

        static BaseNode_ create(SLWritePropertyNodeGen root) {
            return new ForeignObjectNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy