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

com.oracle.truffle.sl.nodes.local.SLReadLocalVariableNodeGen Maven / Gradle / Ivy

There is a newer version: 1.0.0-rc7
Show newest version
// CheckStyle: start generated
/*
 * Copyright (c) 2012, 2014, 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.local;

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.FrameSlot;
import com.oracle.truffle.api.frame.FrameSlotTypeException;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.sl.nodes.SLTypesGen;

@GeneratedBy(SLReadLocalVariableNode.class)
public final class SLReadLocalVariableNodeGen extends SLReadLocalVariableNode implements SpecializedNode {

    private final FrameSlot slot;
    @CompilationFinal private boolean excludeReadLong_;
    @CompilationFinal private boolean excludeReadBoolean_;
    @CompilationFinal private boolean excludeReadObject_;
    @Child private BaseNode_ specialization_;

    private SLReadLocalVariableNodeGen(SourceSection src, FrameSlot slot) {
        super(src);
        this.slot = slot;
        this.specialization_ = UninitializedNode_.create(this);
    }

    @Override
    protected FrameSlot getSlot() {
        return this.slot;
    }

    @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 boolean executeBoolean(VirtualFrame frameValue) throws UnexpectedResultException {
        return specialization_.executeBoolean(frameValue);
    }

    @Override
    public long executeLong(VirtualFrame frameValue) throws UnexpectedResultException {
        return specialization_.executeLong(frameValue);
    }

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

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

    public static SLReadLocalVariableNode create(SourceSection src, FrameSlot slot) {
        return new SLReadLocalVariableNodeGen(src, slot);
    }

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

        @CompilationFinal protected SLReadLocalVariableNodeGen root;

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

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

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

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

        public abstract Object execute(VirtualFrame frameValue);

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

        public boolean executeBoolean(VirtualFrame frameValue) throws UnexpectedResultException {
            return SLTypesGen.expectBoolean(execute(frameValue));
        }

        public long executeLong(VirtualFrame frameValue) throws UnexpectedResultException {
            return SLTypesGen.expectLong(execute(frameValue));
        }

        @Override
        protected final SpecializationNode createNext(Frame frameValue) {
            if (!root.excludeReadLong_) {
                return ReadLongNode_.create(root);
            }
            if (!root.excludeReadBoolean_) {
                return ReadBooleanNode_.create(root);
            }
            if (!root.excludeReadObject_) {
                return ReadObjectNode_.create(root);
            }
            root.excludeReadLong_ = true;
            root.excludeReadBoolean_ = true;
            root.excludeReadObject_ = true;
            return ReadNode_.create(root);
        }

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

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

        @Override
        public Object execute(VirtualFrame frameValue) {
            return uninitialized(frameValue);
        }

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

    }
    @GeneratedBy(methodName = "readLong(VirtualFrame)", value = SLReadLocalVariableNode.class)
    private static final class ReadLongNode_ extends BaseNode_ {

        ReadLongNode_(SLReadLocalVariableNodeGen root) {
            super(root, 1);
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue) {
            if (newNode.getClass() == ReadNode_.class) {
                removeSame("Contained by read(VirtualFrame)");
            }
            return super.merge(newNode, frameValue);
        }

        @Override
        public Object execute(VirtualFrame frameValue) {
            try {
                return executeLong(frameValue);
            } catch (UnexpectedResultException ex) {
                return ex.getResult();
            }
        }

        @Override
        public long executeLong(VirtualFrame frameValue) throws UnexpectedResultException {
            try {
                return root.readLong(frameValue);
            } catch (FrameSlotTypeException ex) {
                root.excludeReadLong_ = true;
                return SLTypesGen.expectLong(remove("threw rewrite exception", frameValue));
            }
        }

        static BaseNode_ create(SLReadLocalVariableNodeGen root) {
            return new ReadLongNode_(root);
        }

    }
    @GeneratedBy(methodName = "readBoolean(VirtualFrame)", value = SLReadLocalVariableNode.class)
    private static final class ReadBooleanNode_ extends BaseNode_ {

        ReadBooleanNode_(SLReadLocalVariableNodeGen root) {
            super(root, 2);
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue) {
            if (newNode.getClass() == ReadNode_.class) {
                removeSame("Contained by read(VirtualFrame)");
            }
            return super.merge(newNode, frameValue);
        }

        @Override
        public Object execute(VirtualFrame frameValue) {
            try {
                return executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                return ex.getResult();
            }
        }

        @Override
        public boolean executeBoolean(VirtualFrame frameValue) throws UnexpectedResultException {
            try {
                return root.readBoolean(frameValue);
            } catch (FrameSlotTypeException ex) {
                root.excludeReadBoolean_ = true;
                return SLTypesGen.expectBoolean(remove("threw rewrite exception", frameValue));
            }
        }

        static BaseNode_ create(SLReadLocalVariableNodeGen root) {
            return new ReadBooleanNode_(root);
        }

    }
    @GeneratedBy(methodName = "readObject(VirtualFrame)", value = SLReadLocalVariableNode.class)
    private static final class ReadObjectNode_ extends BaseNode_ {

        ReadObjectNode_(SLReadLocalVariableNodeGen root) {
            super(root, 3);
        }

        @Override
        public SpecializationNode merge(SpecializationNode newNode, Frame frameValue) {
            if (newNode.getClass() == ReadNode_.class) {
                removeSame("Contained by read(VirtualFrame)");
            }
            return super.merge(newNode, frameValue);
        }

        @Override
        public Object execute(VirtualFrame frameValue) {
            try {
                return root.readObject(frameValue);
            } catch (FrameSlotTypeException ex) {
                root.excludeReadObject_ = true;
                return remove("threw rewrite exception", frameValue);
            }
        }

        static BaseNode_ create(SLReadLocalVariableNodeGen root) {
            return new ReadObjectNode_(root);
        }

    }
    @GeneratedBy(methodName = "read(VirtualFrame)", value = SLReadLocalVariableNode.class)
    private static final class ReadNode_ extends BaseNode_ {

        ReadNode_(SLReadLocalVariableNodeGen root) {
            super(root, 4);
        }

        @Override
        public Object execute(VirtualFrame frameValue) {
            return root.read(frameValue);
        }

        static BaseNode_ create(SLReadLocalVariableNodeGen root) {
            return new ReadNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy