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

org.jruby.truffle.language.TruffleSafeNodesFactory Maven / Gradle / Ivy

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

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.NodeFactory;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
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 java.util.Arrays;
import java.util.List;
import org.jruby.truffle.builtins.CoreMethodNode;
import org.jruby.truffle.language.TruffleSafeNodes.AreProcessesSafeNode;
import org.jruby.truffle.language.TruffleSafeNodes.AreSignalsSafeNode;
import org.jruby.truffle.language.TruffleSafeNodes.IsIOSafeNode;
import org.jruby.truffle.language.TruffleSafeNodes.IsMemorySafeNode;
import org.jruby.truffle.language.TruffleSafeNodes.PutsNode;

@GeneratedBy(TruffleSafeNodes.class)
public final class TruffleSafeNodesFactory {

    public static List> getFactories() {
        return Arrays.asList(PutsNodeFactory.getInstance(), IsIOSafeNodeFactory.getInstance(), IsMemorySafeNodeFactory.getInstance(), AreSignalsSafeNodeFactory.getInstance(), AreProcessesSafeNodeFactory.getInstance());
    }

    @GeneratedBy(PutsNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class PutsNodeFactory implements NodeFactory {

        private static PutsNodeFactory putsNodeFactoryInstance;

        private PutsNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return PutsNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList(RubyNode.class);
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public PutsNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (putsNodeFactoryInstance == null) {
                putsNodeFactoryInstance = new PutsNodeFactory();
            }
            return putsNodeFactoryInstance;
        }

        public static PutsNode create(RubyNode[] arguments) {
            return new PutsNodeGen(arguments);
        }

        @GeneratedBy(PutsNode.class)
        public static final class PutsNodeGen extends PutsNode {

            @Child private RubyNode arguments0_;
            @CompilationFinal private boolean seenUnsupported0;

            private PutsNodeGen(RubyNode[] arguments) {
                this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
            }

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

            @Override
            public Object execute(VirtualFrame frameValue) {
                DynamicObject arguments0Value_;
                try {
                    arguments0Value_ = arguments0_.executeDynamicObject(frameValue);
                } catch (UnexpectedResultException ex) {
                    throw unsupported(ex.getResult());
                }
                if ((RubyGuards.isRubyString(arguments0Value_))) {
                    return this.puts(arguments0Value_);
                }
                throw unsupported(arguments0Value_);
            }

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

            private UnsupportedSpecializationException unsupported(Object arguments0Value) {
                if (!seenUnsupported0) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    seenUnsupported0 = true;
                }
                return new UnsupportedSpecializationException(this, new Node[] {arguments0_}, arguments0Value);
            }

        }
    }
    @GeneratedBy(IsIOSafeNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class IsIOSafeNodeFactory implements NodeFactory {

        private static IsIOSafeNodeFactory isIOSafeNodeFactoryInstance;

        private IsIOSafeNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return IsIOSafeNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList());
        }

        @Override
        public IsIOSafeNode createNode(Object... arguments) {
            if (arguments.length == 0) {
                return create();
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (isIOSafeNodeFactoryInstance == null) {
                isIOSafeNodeFactoryInstance = new IsIOSafeNodeFactory();
            }
            return isIOSafeNodeFactoryInstance;
        }

        public static IsIOSafeNode create() {
            return new IsIOSafeNodeGen();
        }

        @GeneratedBy(IsIOSafeNode.class)
        public static final class IsIOSafeNodeGen extends IsIOSafeNode {

            private IsIOSafeNodeGen() {
            }

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

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

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                executeBoolean(frameValue);
                return;
            }

            @Override
            public boolean executeBoolean(VirtualFrame frameValue) {
                return this.ioSafe();
            }

        }
    }
    @GeneratedBy(IsMemorySafeNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class IsMemorySafeNodeFactory implements NodeFactory {

        private static IsMemorySafeNodeFactory isMemorySafeNodeFactoryInstance;

        private IsMemorySafeNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return IsMemorySafeNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList());
        }

        @Override
        public IsMemorySafeNode createNode(Object... arguments) {
            if (arguments.length == 0) {
                return create();
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (isMemorySafeNodeFactoryInstance == null) {
                isMemorySafeNodeFactoryInstance = new IsMemorySafeNodeFactory();
            }
            return isMemorySafeNodeFactoryInstance;
        }

        public static IsMemorySafeNode create() {
            return new IsMemorySafeNodeGen();
        }

        @GeneratedBy(IsMemorySafeNode.class)
        public static final class IsMemorySafeNodeGen extends IsMemorySafeNode {

            private IsMemorySafeNodeGen() {
            }

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

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

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                executeBoolean(frameValue);
                return;
            }

            @Override
            public boolean executeBoolean(VirtualFrame frameValue) {
                return this.memorySafe();
            }

        }
    }
    @GeneratedBy(AreSignalsSafeNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class AreSignalsSafeNodeFactory implements NodeFactory {

        private static AreSignalsSafeNodeFactory areSignalsSafeNodeFactoryInstance;

        private AreSignalsSafeNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return AreSignalsSafeNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList());
        }

        @Override
        public AreSignalsSafeNode createNode(Object... arguments) {
            if (arguments.length == 0) {
                return create();
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (areSignalsSafeNodeFactoryInstance == null) {
                areSignalsSafeNodeFactoryInstance = new AreSignalsSafeNodeFactory();
            }
            return areSignalsSafeNodeFactoryInstance;
        }

        public static AreSignalsSafeNode create() {
            return new AreSignalsSafeNodeGen();
        }

        @GeneratedBy(AreSignalsSafeNode.class)
        public static final class AreSignalsSafeNodeGen extends AreSignalsSafeNode {

            private AreSignalsSafeNodeGen() {
            }

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

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

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                executeBoolean(frameValue);
                return;
            }

            @Override
            public boolean executeBoolean(VirtualFrame frameValue) {
                return this.signalsSafe();
            }

        }
    }
    @GeneratedBy(AreProcessesSafeNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class AreProcessesSafeNodeFactory implements NodeFactory {

        private static AreProcessesSafeNodeFactory areProcessesSafeNodeFactoryInstance;

        private AreProcessesSafeNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return AreProcessesSafeNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList());
        }

        @Override
        public AreProcessesSafeNode createNode(Object... arguments) {
            if (arguments.length == 0) {
                return create();
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (areProcessesSafeNodeFactoryInstance == null) {
                areProcessesSafeNodeFactoryInstance = new AreProcessesSafeNodeFactory();
            }
            return areProcessesSafeNodeFactoryInstance;
        }

        public static AreProcessesSafeNode create() {
            return new AreProcessesSafeNodeGen();
        }

        @GeneratedBy(AreProcessesSafeNode.class)
        public static final class AreProcessesSafeNodeGen extends AreProcessesSafeNode {

            private AreProcessesSafeNodeGen() {
            }

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

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

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                executeBoolean(frameValue);
                return;
            }

            @Override
            public boolean executeBoolean(VirtualFrame frameValue) {
                return this.processesSafe();
            }

        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy