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

com.oracle.truffle.sl.nodes.call.SLInvokeNodeGen Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2012, 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.
 */
// CheckStyle: start generated
package com.oracle.truffle.sl.nodes.call;

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.source.SourceSection;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import com.oracle.truffle.sl.runtime.SLFunction;

@GeneratedBy(SLInvokeNode.class)
public final class SLInvokeNodeGen extends SLInvokeNode implements SpecializedNode {

    @Child private SLExpressionNode functionNode_;
    @Child private BaseNode_ specialization_;

    private SLInvokeNodeGen(SourceSection src, SLExpressionNode[] argumentNodes, SLExpressionNode functionNode) {
        super(src, argumentNodes);
        this.functionNode_ = functionNode;
        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 SLInvokeNode create(SourceSection src, SLExpressionNode[] argumentNodes, SLExpressionNode functionNode) {
        return new SLInvokeNodeGen(src, argumentNodes, functionNode);
    }

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

        protected final SLInvokeNodeGen root;

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

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

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

        public abstract Object execute_(VirtualFrame frameValue, Object functionNodeValue);

        public Object execute(VirtualFrame frameValue) {
            Object functionNodeValue_ = root.functionNode_.executeGeneric(frameValue);
            return execute_(frameValue, functionNodeValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object functionNodeValue) {
            if (functionNodeValue instanceof SLFunction) {
                return ExecuteGeneric0Node_.create(root);
            }
            if (functionNodeValue instanceof TruffleObject) {
                return ExecuteGeneric1Node_.create(root);
            }
            return null;
        }

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

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

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

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

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

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

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

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

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

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

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

    }
    @GeneratedBy(methodName = "executeGeneric(VirtualFrame, SLFunction)", value = SLInvokeNode.class)
    private static final class ExecuteGeneric0Node_ extends BaseNode_ {

        ExecuteGeneric0Node_(SLInvokeNodeGen root) {
            super(root, 1);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object functionNodeValue) {
            if (functionNodeValue instanceof SLFunction) {
                SLFunction functionNodeValue_ = (SLFunction) functionNodeValue;
                return root.executeGeneric(frameValue, functionNodeValue_);
            }
            return getNext().execute_(frameValue, functionNodeValue);
        }

        static BaseNode_ create(SLInvokeNodeGen root) {
            return new ExecuteGeneric0Node_(root);
        }

    }
    @GeneratedBy(methodName = "executeGeneric(VirtualFrame, TruffleObject)", value = SLInvokeNode.class)
    private static final class ExecuteGeneric1Node_ extends BaseNode_ {

        ExecuteGeneric1Node_(SLInvokeNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object functionNodeValue) {
            if (functionNodeValue instanceof TruffleObject) {
                TruffleObject functionNodeValue_ = (TruffleObject) functionNodeValue;
                return root.executeGeneric(frameValue, functionNodeValue_);
            }
            return getNext().execute_(frameValue, functionNodeValue);
        }

        static BaseNode_ create(SLInvokeNodeGen root) {
            return new ExecuteGeneric1Node_(root);
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy