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

com.oracle.truffle.sl.builtins.SLIsInstanceBuiltinFactory Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package com.oracle.truffle.sl.builtins;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
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.interop.InteropLibrary;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.EncapsulatingNodeReference;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import java.lang.invoke.MethodHandles;
import java.util.List;
import java.util.Objects;

@GeneratedBy(SLIsInstanceBuiltin.class)
@SuppressWarnings({"javadoc", "unused"})
public final class SLIsInstanceBuiltinFactory implements NodeFactory {

    private static final SLIsInstanceBuiltinFactory INSTANCE = new SLIsInstanceBuiltinFactory();
    private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);

    private SLIsInstanceBuiltinFactory() {
    }

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

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

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

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

    public static NodeFactory getInstance() {
        return INSTANCE;
    }

    @NeverDefault
    public static SLIsInstanceBuiltin create(SLExpressionNode[] arguments) {
        return new SLIsInstanceBuiltinNodeGen(arguments);
    }

    /**
     * Debug Info: 
     *   Specialization {@link SLIsInstanceBuiltin#doDefault}
     *     Activation probability: 0.65000
     *     With/without class size: 19/4 bytes
     *   Specialization {@link SLIsInstanceBuiltin#doDefault}
     *     Activation probability: 0.35000
     *     With/without class size: 8/0 bytes
     * 
*/ @GeneratedBy(SLIsInstanceBuiltin.class) @SuppressWarnings("javadoc") public static final class SLIsInstanceBuiltinNodeGen extends SLIsInstanceBuiltin { static final ReferenceField DEFAULT0_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "default0_cache", Default0Data.class); @Child private SLExpressionNode arguments0_; @Child private SLExpressionNode arguments1_; /** * State Info:
         *   0: SpecializationActive {@link SLIsInstanceBuiltin#doDefault}
         *   1: SpecializationActive {@link SLIsInstanceBuiltin#doDefault}
         * 
*/ @CompilationFinal private int state_0_; @UnsafeAccessedField @Child private Default0Data default0_cache; private SLIsInstanceBuiltinNodeGen(SLExpressionNode[] arguments) { this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null; this.arguments1_ = arguments != null && 1 < arguments.length ? arguments[1] : null; } @ExplodeLoop @Override protected Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object arguments0Value_ = this.arguments0_.executeGeneric(frameValue); Object arguments1Value_ = this.arguments1_.executeGeneric(frameValue); if (state_0 != 0 /* is SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] || SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */) { Default0Data s0_ = this.default0_cache; while (s0_ != null) { if ((s0_.metaLib_.accepts(arguments0Value_)) && (s0_.metaLib_.isMetaObject(arguments0Value_))) { return doDefault(arguments0Value_, arguments1Value_, s0_.metaLib_); } s0_ = s0_.next_; } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */) { EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent(); Node prev_ = encapsulating_.set(this); try { { InteropLibrary metaLib__ = (INTEROP_LIBRARY_.getUncached()); if ((metaLib__.isMetaObject(arguments0Value_))) { return this.default1Boundary(state_0, arguments0Value_, arguments1Value_); } } } finally { encapsulating_.set(prev_); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arguments0Value_, arguments1Value_); } @SuppressWarnings("static-method") @TruffleBoundary private Object default1Boundary(int state_0, Object arguments0Value_, Object arguments1Value_) { { InteropLibrary metaLib__ = (INTEROP_LIBRARY_.getUncached()); return doDefault(arguments0Value_, arguments1Value_, metaLib__); } } @SuppressWarnings("unused") private Object executeAndSpecialize(Object arguments0Value, Object arguments1Value) { int state_0 = this.state_0_; if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */) { while (true) { int count0_ = 0; Default0Data s0_ = DEFAULT0_CACHE_UPDATER.getVolatile(this); Default0Data s0_original = s0_; while (s0_ != null) { if ((s0_.metaLib_.accepts(arguments0Value)) && (s0_.metaLib_.isMetaObject(arguments0Value))) { break; } count0_++; s0_ = s0_.next_; } if (s0_ == null) { { InteropLibrary metaLib__ = this.insert((INTEROP_LIBRARY_.create(arguments0Value))); // assert (s0_.metaLib_.accepts(arguments0Value)); if ((metaLib__.isMetaObject(arguments0Value)) && count0_ < (3)) { s0_ = this.insert(new Default0Data(s0_original)); Objects.requireNonNull(s0_.insert(metaLib__), "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_.metaLib_ = metaLib__; if (!DEFAULT0_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) { continue; } state_0 = state_0 | 0b1 /* add SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */; this.state_0_ = state_0; } } } if (s0_ != null) { return doDefault(arguments0Value, arguments1Value, s0_.metaLib_); } break; } } { InteropLibrary metaLib__ = null; { EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent(); Node prev_ = encapsulating_.set(this); try { { metaLib__ = (INTEROP_LIBRARY_.getUncached()); if ((metaLib__.isMetaObject(arguments0Value))) { this.default0_cache = null; state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */; state_0 = state_0 | 0b10 /* add SpecializationActive[SLIsInstanceBuiltin.doDefault(Object, Object, InteropLibrary)] */; this.state_0_ = state_0; return doDefault(arguments0Value, arguments1Value, metaLib__); } } } finally { encapsulating_.set(prev_); } } } throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_, this.arguments1_}, arguments0Value, arguments1Value); } @GeneratedBy(SLIsInstanceBuiltin.class) @DenyReplace private static final class Default0Data extends Node implements SpecializationDataNode { @Child Default0Data next_; /** * Source Info:
             *   Specialization: {@link SLIsInstanceBuiltin#doDefault}
             *   Parameter: {@link InteropLibrary} metaLib
*/ @Child InteropLibrary metaLib_; Default0Data(Default0Data next_) { this.next_ = next_; } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy