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

org.jruby.truffle.language.threadlocal.ThreadLocalObjectNodeGen Maven / Gradle / Ivy

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

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.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;

@GeneratedBy(ThreadLocalObjectNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class ThreadLocalObjectNodeGen extends ThreadLocalObjectNode implements SpecializedNode {

    @CompilationFinal private boolean excludeGetThreadLocalObjectCached_;
    @Child private BaseNode_ specialization_;

    private ThreadLocalObjectNodeGen() {
        this.specialization_ = UninitializedNode_.create(this);
    }

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

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

    @Override
    public DynamicObject executeDynamicObject(VirtualFrame frameValue) {
        return specialization_.executeDynamicObject(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 ThreadLocalObjectNode create() {
        return new ThreadLocalObjectNodeGen();
    }

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

        @CompilationFinal protected ThreadLocalObjectNodeGen root;

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

        @Override
        protected final void setRoot(Node root) {
            this.root = (ThreadLocalObjectNodeGen) 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 DynamicObject executeDynamicObject(VirtualFrame frameValue) {
            return (DynamicObject) execute(frameValue);
        }

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

        @Override
        protected final SpecializationNode createNext(Frame frameValue) {
            DynamicObject cachedThread1 = (root.getCurrentThread((VirtualFrame) frameValue));
            if ((cachedThread1 == root.getCurrentThread((VirtualFrame) frameValue))) {
                if (!root.excludeGetThreadLocalObjectCached_) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    DynamicObject cachedThreadLocals1 = (root.getThreadLocals(cachedThread1));
                    SpecializationNode s = GetThreadLocalObjectCachedNode_.create(root, cachedThread1, cachedThreadLocals1);
                    if (countSame(s) < (root.getCacheLimit())) {
                        return s;
                    }
                }
            }
            CompilerDirectives.transferToInterpreterAndInvalidate();
            root.excludeGetThreadLocalObjectCached_ = true;
            return GetThreadLocalObjectUncachedNode_.create(root);
        }

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

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

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

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

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

    }
    @GeneratedBy(methodName = "getThreadLocalObjectCached(VirtualFrame, DynamicObject, DynamicObject)", value = ThreadLocalObjectNode.class)
    private static final class GetThreadLocalObjectCachedNode_ extends BaseNode_ {

        private final DynamicObject cachedThread;
        private final DynamicObject cachedThreadLocals;

        GetThreadLocalObjectCachedNode_(ThreadLocalObjectNodeGen root, DynamicObject cachedThread, DynamicObject cachedThreadLocals) {
            super(root, 1);
            this.cachedThread = cachedThread;
            this.cachedThreadLocals = cachedThreadLocals;
        }

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

        @Override
        public boolean isIdentical(SpecializationNode other, Frame frameValue) {
            if ((this.cachedThread == root.getCurrentThread((VirtualFrame) frameValue))) {
                return true;
            }
            return false;
        }

        @Override
        public Object execute(VirtualFrame frameValue) {
            if ((this.cachedThread == root.getCurrentThread(frameValue))) {
                return root.getThreadLocalObjectCached(frameValue, this.cachedThread, this.cachedThreadLocals);
            }
            return getNext().execute(frameValue);
        }

        static BaseNode_ create(ThreadLocalObjectNodeGen root, DynamicObject cachedThread, DynamicObject cachedThreadLocals) {
            return new GetThreadLocalObjectCachedNode_(root, cachedThread, cachedThreadLocals);
        }

    }
    @GeneratedBy(methodName = "getThreadLocalObjectUncached(VirtualFrame)", value = ThreadLocalObjectNode.class)
    private static final class GetThreadLocalObjectUncachedNode_ extends BaseNode_ {

        GetThreadLocalObjectUncachedNode_(ThreadLocalObjectNodeGen root) {
            super(root, 2);
        }

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

        static BaseNode_ create(ThreadLocalObjectNodeGen root) {
            return new GetThreadLocalObjectUncachedNode_(root);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy