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

org.jruby.truffle.stdlib.EtcNodesFactory Maven / Gradle / Ivy

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

import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.NodeCost;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.jruby.truffle.stdlib.EtcNodes.NProcessors;

@GeneratedBy(EtcNodes.class)
public final class EtcNodesFactory {

    public static List> getFactories() {
        return Collections.singletonList(NProcessorsFactory.getInstance());
    }

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

        private static NProcessorsFactory nProcessorsFactoryInstance;

        private NProcessorsFactory() {
        }

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

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

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

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

        public static NodeFactory getInstance() {
            if (nProcessorsFactoryInstance == null) {
                nProcessorsFactoryInstance = new NProcessorsFactory();
            }
            return nProcessorsFactoryInstance;
        }

        public static NProcessors create() {
            return new NProcessorsNodeGen();
        }

        @GeneratedBy(NProcessors.class)
        public static final class NProcessorsNodeGen extends NProcessors {

            private NProcessorsNodeGen() {
            }

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

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

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

            @Override
            public int executeInteger(VirtualFrame frameValue) {
                return this.nprocessors();
            }

        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy