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

org.truffleruby.extra.TrufflePosixNodesFactory Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package org.truffleruby.extra;

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.NeverDefault;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import java.lang.invoke.MethodHandles;
import java.util.List;
import java.util.Objects;
import org.truffleruby.extra.TrufflePosixNodes.InvalidateEnvNode;
import org.truffleruby.language.RubyNode;
import org.truffleruby.language.library.RubyStringLibrary;

@GeneratedBy(TrufflePosixNodes.class)
@SuppressWarnings("javadoc")
public final class TrufflePosixNodesFactory {

    public static List> getFactories() {
        return List.of(InvalidateEnvNodeFactory.getInstance());
    }

    @GeneratedBy(InvalidateEnvNode.class)
    public static final class InvalidateEnvNodeFactory implements NodeFactory {

        private static final InvalidateEnvNodeFactory INVALIDATE_ENV_NODE_FACTORY_INSTANCE = new InvalidateEnvNodeFactory();

        private InvalidateEnvNodeFactory() {
        }

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

        @Override
        public List> getExecutionSignature() {
            return List.of(RubyNode.class);
        }

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

        @Override
        public InvalidateEnvNode 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() {
            return INVALIDATE_ENV_NODE_FACTORY_INSTANCE;
        }

        @NeverDefault
        public static InvalidateEnvNode create(RubyNode[] argumentNodes) {
            return new InvalidateEnvNodeGen(argumentNodes);
        }

        /**
         * Debug Info: 
         *   Specialization {@link InvalidateEnvNode#invalidate}
         *     Activation probability: 1.00000
         *     With/without class size: 20/4 bytes
         * 
*/ @GeneratedBy(InvalidateEnvNode.class) @SuppressWarnings("javadoc") public static final class InvalidateEnvNodeGen extends InvalidateEnvNode { static final ReferenceField INVALIDATE_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "invalidate_cache", InvalidateData.class); @Child private RubyNode argumentNodes0_; /** * State Info:
             *   0: SpecializationActive {@link InvalidateEnvNode#invalidate}
             * 
*/ @CompilationFinal private int state_0_; @UnsafeAccessedField @CompilationFinal private InvalidateData invalidate_cache; private InvalidateEnvNodeGen(RubyNode[] argumentNodes) { this.argumentNodes0_ = argumentNodes != null && 0 < argumentNodes.length ? argumentNodes[0] : null; } @Override public RubyNode[] getArgumentNodes() { return new RubyNode[] {this.argumentNodes0_}; } @Override public Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object argumentNodes0Value_ = this.argumentNodes0_.execute(frameValue); if (state_0 != 0 /* is SpecializationActive[TrufflePosixNodes.InvalidateEnvNode.invalidate(Object, RubyStringLibrary)] */) { InvalidateData s0_ = this.invalidate_cache; if (s0_ != null) { if ((s0_.libEnvVar_.isRubyString(argumentNodes0Value_))) { return invalidate(argumentNodes0Value_, s0_.libEnvVar_); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(argumentNodes0Value_); } @SuppressWarnings("unused") private Object executeAndSpecialize(Object argumentNodes0Value) { int state_0 = this.state_0_; while (true) { int count0_ = 0; InvalidateData s0_ = INVALIDATE_CACHE_UPDATER.getVolatile(this); InvalidateData s0_original = s0_; while (s0_ != null) { if ((s0_.libEnvVar_.isRubyString(argumentNodes0Value))) { break; } count0_++; s0_ = null; break; } if (s0_ == null && count0_ < 1) { { RubyStringLibrary libEnvVar__ = (RubyStringLibrary.create()); if ((libEnvVar__.isRubyString(argumentNodes0Value))) { s0_ = new InvalidateData(); Objects.requireNonNull(libEnvVar__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value."); s0_.libEnvVar_ = libEnvVar__; if (!INVALIDATE_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) { continue; } state_0 = state_0 | 0b1 /* add SpecializationActive[TrufflePosixNodes.InvalidateEnvNode.invalidate(Object, RubyStringLibrary)] */; this.state_0_ = state_0; } } } if (s0_ != null) { return invalidate(argumentNodes0Value, s0_.libEnvVar_); } break; } throw new UnsupportedSpecializationException(this, new Node[] {this.argumentNodes0_}, argumentNodes0Value); } @GeneratedBy(InvalidateEnvNode.class) @DenyReplace private static final class InvalidateData implements SpecializationDataNode { /** * Source Info:
                 *   Specialization: {@link InvalidateEnvNode#invalidate}
                 *   Parameter: {@link RubyStringLibrary} libEnvVar
*/ @CompilationFinal RubyStringLibrary libEnvVar_; InvalidateData() { } } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy