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

org.jruby.truffle.language.supercall.LookupSuperMethodNodeGen Maven / Gradle / Ivy

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

import com.oracle.truffle.api.Assumption;
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.dsl.internal.SuppressFBWarnings;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.InvalidAssumptionException;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.methods.InternalMethod;

@GeneratedBy(LookupSuperMethodNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class LookupSuperMethodNodeGen extends LookupSuperMethodNode implements SpecializedNode {

    @Child private RubyNode self_;
    @Child private BaseNode_ specialization_;

    private LookupSuperMethodNodeGen(RubyNode self) {
        this.self_ = self;
        this.specialization_ = UninitializedNode_.create(this);
    }

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

    @Override
    public InternalMethod executeLookupSuperMethod(VirtualFrame frameValue, Object selfValue) {
        return specialization_.executeInternalMethod(frameValue, selfValue);
    }

    @Override
    public Object execute(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 LookupSuperMethodNode create(RubyNode self) {
        return new LookupSuperMethodNodeGen(self);
    }

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

        @CompilationFinal protected LookupSuperMethodNodeGen root;

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

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

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

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

        public abstract InternalMethod executeInternalMethod(VirtualFrame frameValue, Object selfValue);

        public Object execute(VirtualFrame frameValue) {
            Object selfValue_ = root.self_.execute(frameValue);
            return executeInternalMethod(frameValue, selfValue_);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue, Object selfValue) {
            if (selfValue instanceof DynamicObject) {
                DynamicObject selfValue_ = (DynamicObject) selfValue;
                InternalMethod currentMethod1 = (root.getCurrentMethod((VirtualFrame) frameValue));
                DynamicObject selfMetaClass1 = (root.metaClass(selfValue_));
                if ((root.getCurrentMethod((VirtualFrame) frameValue) == currentMethod1) && (root.metaClass(selfValue_) == selfMetaClass1)) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    InternalMethod superMethod1 = (root.doLookup(currentMethod1, selfMetaClass1));
                    Assumption assumption0_1 = (root.getUnmodifiedAssumption(selfMetaClass1));
                    if (isValid(assumption0_1)) {
                        SpecializationNode s = LookupSuperMethodCachedDynamicObjectNode_.create(root, currentMethod1, selfMetaClass1, superMethod1, assumption0_1);
                        if (countSame(s) < (root.getCacheLimit())) {
                            return s;
                        }
                    }
                }
            }
            CompilerDirectives.transferToInterpreterAndInvalidate();
            return LookupSuperMethodUncachedNode_.create(root);
        }

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

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

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

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

        @Override
        public InternalMethod executeInternalMethod(VirtualFrame frameValue, Object selfValue) {
            return (InternalMethod) uninitialized(frameValue, selfValue);
        }

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

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

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

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

        @Override
        public InternalMethod executeInternalMethod(VirtualFrame frameValue, Object selfValue) {
            return getNext().executeInternalMethod(frameValue, selfValue);
        }

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

    }
    @GeneratedBy(methodName = "lookupSuperMethodCachedDynamicObject(VirtualFrame, DynamicObject, InternalMethod, DynamicObject, InternalMethod)", value = LookupSuperMethodNode.class)
    private static final class LookupSuperMethodCachedDynamicObjectNode_ extends BaseNode_ {

        private final InternalMethod currentMethod;
        private final DynamicObject selfMetaClass;
        private final InternalMethod superMethod;
        @CompilationFinal private final Assumption assumption0_;

        LookupSuperMethodCachedDynamicObjectNode_(LookupSuperMethodNodeGen root, InternalMethod currentMethod, DynamicObject selfMetaClass, InternalMethod superMethod, Assumption assumption0_) {
            super(root, 1);
            this.currentMethod = currentMethod;
            this.selfMetaClass = selfMetaClass;
            this.superMethod = superMethod;
            this.assumption0_ = assumption0_;
        }

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue, Object selfValue) {
            if (selfValue instanceof DynamicObject) {
                DynamicObject selfValue_ = (DynamicObject) selfValue;
                if ((root.getCurrentMethod((VirtualFrame) frameValue) == this.currentMethod) && (root.metaClass(selfValue_) == this.selfMetaClass)) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public InternalMethod executeInternalMethod(VirtualFrame frameValue, Object selfValue) {
            try {
                check(this.assumption0_);
            } catch (InvalidAssumptionException ae) {
                return (InternalMethod) removeThis("Assumption [assumption0] invalidated", frameValue, selfValue);
            }
            if (selfValue instanceof DynamicObject) {
                DynamicObject selfValue_ = (DynamicObject) selfValue;
                if ((root.getCurrentMethod(frameValue) == this.currentMethod) && (root.metaClass(selfValue_) == this.selfMetaClass)) {
                    return root.lookupSuperMethodCachedDynamicObject(frameValue, selfValue_, this.currentMethod, this.selfMetaClass, this.superMethod);
                }
            }
            return getNext().executeInternalMethod(frameValue, selfValue);
        }

        static BaseNode_ create(LookupSuperMethodNodeGen root, InternalMethod currentMethod, DynamicObject selfMetaClass, InternalMethod superMethod, Assumption assumption0_) {
            return new LookupSuperMethodCachedDynamicObjectNode_(root, currentMethod, selfMetaClass, superMethod, assumption0_);
        }

    }
    @GeneratedBy(methodName = "lookupSuperMethodUncached(VirtualFrame, Object)", value = LookupSuperMethodNode.class)
    private static final class LookupSuperMethodUncachedNode_ extends BaseNode_ {

        LookupSuperMethodUncachedNode_(LookupSuperMethodNodeGen root) {
            super(root, 2);
        }

        @Override
        public InternalMethod executeInternalMethod(VirtualFrame frameValue, Object selfValue) {
            return root.lookupSuperMethodUncached(frameValue, selfValue);
        }

        static BaseNode_ create(LookupSuperMethodNodeGen root) {
            return new LookupSuperMethodUncachedNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy