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

org.jruby.truffle.interop.ForeignWriteStringCachedHelperNodeGen 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.WriteObjectFieldNode;

@GeneratedBy(ForeignWriteStringCachedHelperNode.class)
final class ForeignWriteStringCachedHelperNodeGen extends ForeignWriteStringCachedHelperNode implements SpecializedNode {

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

    private ForeignWriteStringCachedHelperNodeGen(RubyNode receiver, RubyNode name, RubyNode stringName, RubyNode isIVar, RubyNode value) {
        this.receiver_ = receiver;
        this.name_ = name;
        this.stringName_ = stringName;
        this.isIVar_ = isIVar;
        this.value_ = value;
        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, Object valueValue) {
        return specialization_.execute1(frameValue, receiverValue, nameValue, stringNameValue, isIVarValue, valueValue);
    }

    @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 ForeignWriteStringCachedHelperNode create(RubyNode receiver, RubyNode name, RubyNode stringName, RubyNode isIVar, RubyNode value) {
        return new ForeignWriteStringCachedHelperNodeGen(receiver, name, stringName, isIVar, value);
    }

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

        @CompilationFinal protected ForeignWriteStringCachedHelperNodeGen root;

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

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

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

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

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

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

        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);
            Object valueValue_ = root.value_.execute(frameValue);
            return execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue, Object valueValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((isIVarValue_)) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    WriteObjectFieldNode writeObjectFieldNode1 = (root.createWriteObjectFieldNode(stringNameValue));
                    return ReadInstanceVariableNode_.create(root, writeObjectFieldNode1);
                }
                String writeMethodName2 = (root.createWriteMethodName(stringNameValue));
                if ((root.not(isIVarValue_)) && (root.methodDefined((VirtualFrame) frameValue, receiverValue_, writeMethodName2, root.getDefinedNode()))) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    SpecializationNode s = CallMethodNode_.create(root, writeMethodName2);
                    if (countSame(s) < (3)) {
                        return s;
                    }
                }
                String writeMethodName3 = (root.createWriteMethodName(stringNameValue));
                if ((!(isIVarValue_)) && (!(root.methodDefined((VirtualFrame) frameValue, receiverValue_, writeMethodName3, root.getDefinedNode()))) && (root.methodDefined((VirtualFrame) frameValue, receiverValue_, ForeignWriteStringCachedHelperNode.INDEX_SET_METHOD_NAME, root.getIndexDefinedNode()))) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    SpecializationNode s = IndexNode_.create(root, writeMethodName3);
                    if (countSame(s) < (3)) {
                        return s;
                    }
                }
            }
            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(ForeignWriteStringCachedHelperNode.class)
    private static final class UninitializedNode_ extends BaseNode_ {

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

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

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

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

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

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

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

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

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

        @Child private WriteObjectFieldNode writeObjectFieldNode;

        ReadInstanceVariableNode_(ForeignWriteStringCachedHelperNodeGen root, WriteObjectFieldNode writeObjectFieldNode) {
            super(root, 1);
            this.writeObjectFieldNode = writeObjectFieldNode;
        }

        @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);
                Object valueValue = root.value_.execute(frameValue);
                return getNext().execute_(frameValue, ex.getResult(), nameValue, stringNameValue, isIVarValue, valueValue);
            }
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            boolean isIVarValue_;
            try {
                isIVarValue_ = root.isIVar_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                Object valueValue = root.value_.execute(frameValue);
                return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, ex.getResult(), valueValue);
            }
            Object valueValue_ = root.value_.execute(frameValue);
            if ((isIVarValue_)) {
                return root.readInstanceVariable(receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_, this.writeObjectFieldNode);
            }
            return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_);
        }

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

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

        static BaseNode_ create(ForeignWriteStringCachedHelperNodeGen root, WriteObjectFieldNode writeObjectFieldNode) {
            return new ReadInstanceVariableNode_(root, writeObjectFieldNode);
        }

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

        private final String writeMethodName;

        CallMethodNode_(ForeignWriteStringCachedHelperNodeGen root, String writeMethodName) {
            super(root, 2);
            this.writeMethodName = writeMethodName;
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue, Object valueValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((root.not(isIVarValue_)) && (root.methodDefined((VirtualFrame) frameValue, receiverValue_, this.writeMethodName, root.getDefinedNode()))) {
                    return true;
                }
            }
            return false;
        }

        @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);
                Object valueValue = root.value_.execute(frameValue);
                return getNext().execute_(frameValue, ex.getResult(), nameValue, stringNameValue, isIVarValue, valueValue);
            }
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            boolean isIVarValue_;
            try {
                isIVarValue_ = root.isIVar_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                Object valueValue = root.value_.execute(frameValue);
                return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, ex.getResult(), valueValue);
            }
            Object valueValue_ = root.value_.execute(frameValue);
            if ((root.not(isIVarValue_)) && (root.methodDefined(frameValue, receiverValue_, this.writeMethodName, root.getDefinedNode()))) {
                return root.callMethod(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_, this.writeMethodName);
            }
            return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_);
        }

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

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

        static BaseNode_ create(ForeignWriteStringCachedHelperNodeGen root, String writeMethodName) {
            return new CallMethodNode_(root, writeMethodName);
        }

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

        private final String writeMethodName;

        IndexNode_(ForeignWriteStringCachedHelperNodeGen root, String writeMethodName) {
            super(root, 3);
            this.writeMethodName = writeMethodName;
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object receiverValue, Object nameValue, Object stringNameValue, Object isIVarValue, Object valueValue) {
            if (receiverValue instanceof DynamicObject && isIVarValue instanceof Boolean) {
                DynamicObject receiverValue_ = (DynamicObject) receiverValue;
                boolean isIVarValue_ = (boolean) isIVarValue;
                if ((!(isIVarValue_)) && (!(root.methodDefined((VirtualFrame) frameValue, receiverValue_, this.writeMethodName, root.getDefinedNode()))) && (root.methodDefined((VirtualFrame) frameValue, receiverValue_, ForeignWriteStringCachedHelperNode.INDEX_SET_METHOD_NAME, root.getIndexDefinedNode()))) {
                    return true;
                }
            }
            return false;
        }

        @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);
                Object valueValue = root.value_.execute(frameValue);
                return getNext().execute_(frameValue, ex.getResult(), nameValue, stringNameValue, isIVarValue, valueValue);
            }
            Object nameValue_ = root.name_.execute(frameValue);
            Object stringNameValue_ = root.stringName_.execute(frameValue);
            boolean isIVarValue_;
            try {
                isIVarValue_ = root.isIVar_.executeBoolean(frameValue);
            } catch (UnexpectedResultException ex) {
                Object valueValue = root.value_.execute(frameValue);
                return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, ex.getResult(), valueValue);
            }
            Object valueValue_ = root.value_.execute(frameValue);
            if ((!(isIVarValue_)) && (!(root.methodDefined(frameValue, receiverValue_, this.writeMethodName, root.getDefinedNode()))) && (root.methodDefined(frameValue, receiverValue_, ForeignWriteStringCachedHelperNode.INDEX_SET_METHOD_NAME, root.getIndexDefinedNode()))) {
                return root.index(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_, this.writeMethodName);
            }
            return getNext().execute_(frameValue, receiverValue_, nameValue_, stringNameValue_, isIVarValue_, valueValue_);
        }

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

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

        static BaseNode_ create(ForeignWriteStringCachedHelperNodeGen root, String writeMethodName) {
            return new IndexNode_(root, writeMethodName);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy