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

org.jruby.truffle.interop.ForeignReadStringCachedHelperNodeGen Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
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.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.objects.ReadObjectFieldNode;

@GeneratedBy(ForeignReadStringCachedHelperNode.class)
final class ForeignReadStringCachedHelperNodeGen extends ForeignReadStringCachedHelperNode implements SpecializedNode {

    @Child private RubyNode receiver_;
    @Child private RubyNode name_;
    @Child private RubyNode stringName_;
    @Child private RubyNode isIVar_;
    @CompilationFinal private Class isIVarType_;
    @Child private BaseNode_ specialization_;

    private ForeignReadStringCachedHelperNodeGen(RubyNode receiver, RubyNode name, RubyNode stringName, RubyNode isIVar) {
        this.receiver_ = receiver;
        this.name_ = name;
        this.stringName_ = stringName;
        this.isIVar_ = isIVar;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public Object executeStringCachedHelper(VirtualFrame frameValue, DynamicObject receiverValue, Object nameValue, Object stringNameValue, boolean isIVarValue) {
        return specialization_.execute1(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
    }

    @Override
    public Object execute(VirtualFrame frameValue) {
        return specialization_.execute0(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 ForeignReadStringCachedHelperNode create(RubyNode receiver, RubyNode name, RubyNode stringName, RubyNode isIVar) {
        return new ForeignReadStringCachedHelperNodeGen(receiver, name, stringName, isIVar);
    }

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

        @CompilationFinal protected ForeignReadStringCachedHelperNodeGen root;

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

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

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

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

        public abstract Object execute_(VirtualFrame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue);

        public Object execute1(VirtualFrame frameValue, DynamicObject receiverValue, Object nameValue, Object stringNameValue, boolean isIVarValue) {
            return execute_(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        public Object execute0(VirtualFrame frameValue) {
            Object receiverValue_ = root.receiver_.execute(frameValue);
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            Object isIVarValue_ = executeIsIVar_(frameValue);
            return execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((isIVarValue_)) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    ReadObjectFieldNode readObjectFieldNode1 = (root.createReadObjectFieldNode(stringNameValue));
                    return ReadInstanceVariableNode_.create(root, readObjectFieldNode1);
                } else if ((root.methodDefined((VirtualFrame) frameValue, receiverValue_, stringNameValue, root.getDefinedNode()))) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    return CallMethodNode_.create(root);
                }
                if ((!(isIVarValue_)) && (!(root.methodDefined((VirtualFrame) frameValue, receiverValue_, stringNameValue, root.getDefinedNode()))) && (root.methodDefined((VirtualFrame) frameValue, receiverValue_, ForeignReadStringCachedHelperNode.INDEX_METHOD_NAME, root.getIndexDefinedNode()))) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    return IndexNode_.create(root);
                }
            }
            return null;
        }

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

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

        protected final Object executeIsIVar_(Frame frameValue) {
            Class isIVarType_ = root.isIVarType_;
            try {
                if (isIVarType_ == boolean.class) {
                    return root.isIVar_.executeBoolean((VirtualFrame) frameValue);
                } else if (isIVarType_ == null) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    Class _type = Object.class;
                    try {
                        Object _value = root.isIVar_.execute((VirtualFrame) frameValue);
                        if (_value instanceof Boolean) {
                            _type = boolean.class;
                        } else {
                            _type = Object.class;
                        }
                        return _value;
                    } finally {
                        root.isIVarType_ = _type;
                    }
                } else {
                    return root.isIVar_.execute((VirtualFrame) frameValue);
                }
            } catch (UnexpectedResultException ex) {
                root.isIVarType_ = Object.class;
                return ex.getResult();
            }
        }

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

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

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

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

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

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

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

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

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

    }
    @GeneratedBy(methodName = "readInstanceVariable(DynamicObject, Object, Object, boolean, ReadObjectFieldNode)", value = ForeignReadStringCachedHelperNode.class)
    private static final class ReadInstanceVariableNode_ extends BaseNode_ {

        @Child private ReadObjectFieldNode readObjectFieldNode;

        ReadInstanceVariableNode_(ForeignReadStringCachedHelperNodeGen root, ReadObjectFieldNode readObjectFieldNode) {
            super(root, 1);
            this.readObjectFieldNode = readObjectFieldNode;
        }

        @Override
        public Object execute0(VirtualFrame frameValue) {
            DynamicObject receiverValue_;
            try {
                receiverValue_ = root.receiver_.executeDynamicObject(frameValue);
            } catch (UnexpectedResultException ex) {
                Object nameValue = root.name_.execute(frameValue);
                Object stringNameValue = root.stringName_.execute(frameValue);
                Object isIVarValue = executeIsIVar_(frameValue);
                return getNext().execute_(frameValue, ex.getResult(), nameValue, stringNameValue, isIVarValue);
            }
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            boolean isIVarValue_;
            try {
                isIVarValue_ = root.isIVar_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, ex.getResult());
            }
            if ((isIVarValue_)) {
                return root.readInstanceVariable(receiverValue_, nameValue_, stringNameValue_, isIVarValue_, this.readObjectFieldNode);
            }
            return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_);
        }

        @Override
        public Object execute1(VirtualFrame frameValue, DynamicObject receiverValue, Object nameValue, Object stringNameValue, boolean isIVarValue) {
            if ((isIVarValue)) {
                return root.readInstanceVariable(receiverValue, nameValue, stringNameValue, isIVarValue, this.readObjectFieldNode);
            }
            return getNext().execute1(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((isIVarValue_)) {
                    return root.readInstanceVariable(receiverValue_, nameValue, stringNameValue, isIVarValue_, this.readObjectFieldNode);
                }
            }
            return getNext().execute_(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        static BaseNode_ create(ForeignReadStringCachedHelperNodeGen root, ReadObjectFieldNode readObjectFieldNode) {
            return new ReadInstanceVariableNode_(root, readObjectFieldNode);
        }

    }
    @GeneratedBy(methodName = "callMethod(VirtualFrame, DynamicObject, Object, Object, boolean)", value = ForeignReadStringCachedHelperNode.class)
    private static final class CallMethodNode_ extends BaseNode_ {

        CallMethodNode_(ForeignReadStringCachedHelperNodeGen root) {
            super(root, 2);
        }

        @Override
        public Object execute0(VirtualFrame frameValue) {
            DynamicObject receiverValue_;
            try {
                receiverValue_ = root.receiver_.executeDynamicObject(frameValue);
            } catch (UnexpectedResultException ex) {
                Object nameValue = root.name_.execute(frameValue);
                Object stringNameValue = root.stringName_.execute(frameValue);
                Object isIVarValue = executeIsIVar_(frameValue);
                return getNext().execute_(frameValue, ex.getResult(), nameValue, stringNameValue, isIVarValue);
            }
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            boolean isIVarValue_;
            try {
                isIVarValue_ = root.isIVar_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, ex.getResult());
            }
            if ((!(isIVarValue_)) && (root.methodDefined(frameValue, receiverValue_, stringNameValue_, root.getDefinedNode()))) {
                return root.callMethod(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_);
            }
            return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_);
        }

        @Override
        public Object execute1(VirtualFrame frameValue, DynamicObject receiverValue, Object nameValue, Object stringNameValue, boolean isIVarValue) {
            if ((!(isIVarValue)) && (root.methodDefined(frameValue, receiverValue, stringNameValue, root.getDefinedNode()))) {
                return root.callMethod(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
            }
            return getNext().execute1(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((!(isIVarValue_)) && (root.methodDefined(frameValue, receiverValue_, stringNameValue, root.getDefinedNode()))) {
                    return root.callMethod(frameValue, receiverValue_, nameValue, stringNameValue, isIVarValue_);
                }
            }
            return getNext().execute_(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        static BaseNode_ create(ForeignReadStringCachedHelperNodeGen root) {
            return new CallMethodNode_(root);
        }

    }
    @GeneratedBy(methodName = "index(VirtualFrame, DynamicObject, Object, Object, boolean)", value = ForeignReadStringCachedHelperNode.class)
    private static final class IndexNode_ extends BaseNode_ {

        IndexNode_(ForeignReadStringCachedHelperNodeGen root) {
            super(root, 3);
        }

        @Override
        public Object execute0(VirtualFrame frameValue) {
            DynamicObject receiverValue_;
            try {
                receiverValue_ = root.receiver_.executeDynamicObject(frameValue);
            } catch (UnexpectedResultException ex) {
                Object nameValue = root.name_.execute(frameValue);
                Object stringNameValue = root.stringName_.execute(frameValue);
                Object isIVarValue = executeIsIVar_(frameValue);
                return getNext().execute_(frameValue, ex.getResult(), nameValue, stringNameValue, isIVarValue);
            }
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            boolean isIVarValue_;
            try {
                isIVarValue_ = root.isIVar_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, ex.getResult());
            }
            if ((!(isIVarValue_)) && (!(root.methodDefined(frameValue, receiverValue_, stringNameValue_, root.getDefinedNode()))) && (root.methodDefined(frameValue, receiverValue_, ForeignReadStringCachedHelperNode.INDEX_METHOD_NAME, root.getIndexDefinedNode()))) {
                return root.index(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_);
            }
            return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_);
        }

        @Override
        public Object execute1(VirtualFrame frameValue, DynamicObject receiverValue, Object nameValue, Object stringNameValue, boolean isIVarValue) {
            if ((!(isIVarValue)) && (!(root.methodDefined(frameValue, receiverValue, stringNameValue, root.getDefinedNode()))) && (root.methodDefined(frameValue, receiverValue, ForeignReadStringCachedHelperNode.INDEX_METHOD_NAME, root.getIndexDefinedNode()))) {
                return root.index(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
            }
            return getNext().execute1(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        @Override
        public Object execute_(VirtualFrame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((!(isIVarValue_)) && (!(root.methodDefined(frameValue, receiverValue_, stringNameValue, root.getDefinedNode()))) && (root.methodDefined(frameValue, receiverValue_, ForeignReadStringCachedHelperNode.INDEX_METHOD_NAME, root.getIndexDefinedNode()))) {
                    return root.index(frameValue, receiverValue_, nameValue, stringNameValue, isIVarValue_);
                }
            }
            return getNext().execute_(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue);
        }

        static BaseNode_ create(ForeignReadStringCachedHelperNodeGen root) {
            return new IndexNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy