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

org.pkl.thirdparty.truffle.polyglot.PolyglotParsedEvalGen Maven / Gradle / Ivy

Go to download

Shaded fat Jar for pkl-config-java, a Java config library based on the Pkl config language.

There is a newer version: 0.27.1
Show newest version
// CheckStyle: start generated
package org.pkl.thirdparty.truffle.polyglot;

import org.pkl.thirdparty.truffle.api.CompilerDirectives;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.CompilationFinal;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.TruffleBoundary;
import org.pkl.thirdparty.truffle.api.dsl.GeneratedBy;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.ReferenceField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import org.pkl.thirdparty.truffle.api.interop.ArityException;
import org.pkl.thirdparty.truffle.api.interop.InteropLibrary;
import org.pkl.thirdparty.truffle.api.interop.UnsupportedMessageException;
import org.pkl.thirdparty.truffle.api.interop.UnsupportedTypeException;
import org.pkl.thirdparty.truffle.api.library.DynamicDispatchLibrary;
import org.pkl.thirdparty.truffle.api.library.LibraryExport;
import org.pkl.thirdparty.truffle.api.library.LibraryFactory;
import org.pkl.thirdparty.truffle.api.nodes.DenyReplace;
import org.pkl.thirdparty.truffle.api.nodes.DirectCallNode;
import org.pkl.thirdparty.truffle.api.nodes.ExplodeLoop;
import org.pkl.thirdparty.truffle.api.nodes.IndirectCallNode;
import org.pkl.thirdparty.truffle.api.nodes.Node;
import org.pkl.thirdparty.truffle.api.nodes.NodeCost;
import org.pkl.thirdparty.truffle.api.utilities.TriState;
import org.pkl.thirdparty.truffle.polyglot.PolyglotParsedEval.Execute;
import org.pkl.thirdparty.truffle.polyglot.PolyglotParsedEval.IsIdenticalOrUndefined;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;

@GeneratedBy(PolyglotParsedEval.class)
@SuppressWarnings({"javadoc", "unused"})
final class PolyglotParsedEvalGen {

    private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);

    static  {
        LibraryExport.register(PolyglotParsedEval.class, new InteropLibraryExports());
    }

    private PolyglotParsedEvalGen() {
    }

    @GeneratedBy(PolyglotParsedEval.class)
    private static final class InteropLibraryExports extends LibraryExport {

        private InteropLibraryExports() {
            super(InteropLibrary.class, PolyglotParsedEval.class, false, false, 0);
        }

        @Override
        protected InteropLibrary createUncached(Object receiver) {
            assert receiver instanceof PolyglotParsedEval;
            InteropLibrary uncached = new Uncached();
            return uncached;
        }

        @Override
        protected InteropLibrary createCached(Object receiver) {
            assert receiver instanceof PolyglotParsedEval;
            return new Cached();
        }

        @GeneratedBy(PolyglotParsedEval.class)
        private static final class Cached extends InteropLibrary {

            static final ReferenceField EXECUTE_CACHED_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "execute_cached_cache", ExecuteCachedData.class);

            /**
             * State Info: 
             *   0: SpecializationActive {@link Execute#doCached}
             *   1: SpecializationActive {@link Execute#doIndirect}
             *   2: SpecializationActive {@link IsIdenticalOrUndefined#doDefault}
             *   3: SpecializationActive {@link IsIdenticalOrUndefined#doOther}
             * 
*/ @CompilationFinal private int state_0_; @UnsafeAccessedField @Child private ExecuteCachedData execute_cached_cache; /** * Source Info:
             *   Specialization: {@link Execute#doIndirect}
             *   Parameter: {@link IndirectCallNode} callNode
*/ @Child private IndirectCallNode execute_indirect_callNode_; protected Cached() { } @Override public boolean accepts(Object receiver) { assert !(receiver instanceof PolyglotParsedEval) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof PolyglotParsedEval; } /** * Debug Info:
             *   Specialization {@link Execute#doCached}
             *     Activation probability: 0.32500
             *     With/without class size: 11/4 bytes
             *   Specialization {@link Execute#doIndirect}
             *     Activation probability: 0.17500
             *     With/without class size: 7/4 bytes
             * 
*/ @ExplodeLoop @Override public Object execute(Object arg0Value_, Object... arg1Value) throws UnsupportedTypeException, ArityException, UnsupportedMessageException { assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); PolyglotParsedEval arg0Value = ((PolyglotParsedEval) arg0Value_); int state_0 = this.state_0_; if ((state_0 & 0b11) != 0 /* is SpecializationActive[PolyglotParsedEval.Execute.doCached(PolyglotParsedEval, Object[], DirectCallNode)] || SpecializationActive[PolyglotParsedEval.Execute.doIndirect(PolyglotParsedEval, Object[], IndirectCallNode)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[PolyglotParsedEval.Execute.doCached(PolyglotParsedEval, Object[], DirectCallNode)] */) { ExecuteCachedData s0_ = this.execute_cached_cache; while (s0_ != null) { if ((arg0Value.target == s0_.callNode_.getCallTarget())) { return Execute.doCached(arg0Value, arg1Value, s0_.callNode_); } s0_ = s0_.next_; } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[PolyglotParsedEval.Execute.doIndirect(PolyglotParsedEval, Object[], IndirectCallNode)] */) { { IndirectCallNode callNode__ = this.execute_indirect_callNode_; if (callNode__ != null) { return Execute.doIndirect(arg0Value, arg1Value, callNode__); } } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } private Object executeAndSpecialize(PolyglotParsedEval arg0Value, Object[] arg1Value) throws ArityException { int state_0 = this.state_0_; if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[PolyglotParsedEval.Execute.doIndirect(PolyglotParsedEval, Object[], IndirectCallNode)] */) { while (true) { int count0_ = 0; ExecuteCachedData s0_ = EXECUTE_CACHED_CACHE_UPDATER.getVolatile(this); ExecuteCachedData s0_original = s0_; while (s0_ != null) { if ((arg0Value.target == s0_.callNode_.getCallTarget())) { break; } count0_++; s0_ = s0_.next_; } if (s0_ == null) { { DirectCallNode callNode__1 = this.insert((DirectCallNode.create(arg0Value.target))); if ((arg0Value.target == callNode__1.getCallTarget()) && count0_ < (5)) { s0_ = this.insert(new ExecuteCachedData(s0_original)); s0_.callNode_ = s0_.insert(callNode__1); if (!EXECUTE_CACHED_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) { continue; } state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotParsedEval.Execute.doCached(PolyglotParsedEval, Object[], DirectCallNode)] */; this.state_0_ = state_0; } } } if (s0_ != null) { return Execute.doCached(arg0Value, arg1Value, s0_.callNode_); } break; } } VarHandle.storeStoreFence(); this.execute_indirect_callNode_ = this.insert((IndirectCallNode.create())); this.execute_cached_cache = null; state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[PolyglotParsedEval.Execute.doCached(PolyglotParsedEval, Object[], DirectCallNode)] */; state_0 = state_0 | 0b10 /* add SpecializationActive[PolyglotParsedEval.Execute.doIndirect(PolyglotParsedEval, Object[], IndirectCallNode)] */; this.state_0_ = state_0; return Execute.doIndirect(arg0Value, arg1Value, this.execute_indirect_callNode_); } @Override public NodeCost getCost() { int state_0 = this.state_0_; if ((state_0 & 0b11) == 0) { return NodeCost.UNINITIALIZED; } else { if (((state_0 & 0b11) & ((state_0 & 0b11) - 1)) == 0 /* is-single */) { ExecuteCachedData s0_ = this.execute_cached_cache; if ((s0_ == null || s0_.next_ == null)) { return NodeCost.MONOMORPHIC; } } } return NodeCost.POLYMORPHIC; } @SuppressWarnings("static-method") private boolean isIdenticalOrUndefinedFallbackGuard_(int state_0, PolyglotParsedEval arg0Value, Object arg1Value) { if (!((state_0 & 0b100) != 0 /* is SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doDefault(PolyglotParsedEval, PolyglotParsedEval)] */) && arg1Value instanceof PolyglotParsedEval) { return false; } return true; } /** * Debug Info:
             *   Specialization {@link IsIdenticalOrUndefined#doDefault}
             *     Activation probability: 0.32500
             *     With/without class size: 7/0 bytes
             *   Specialization {@link IsIdenticalOrUndefined#doOther}
             *     Activation probability: 0.17500
             *     With/without class size: 6/0 bytes
             * 
*/ @Override protected TriState isIdenticalOrUndefined(Object arg0Value_, Object arg1Value) { assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); PolyglotParsedEval arg0Value = ((PolyglotParsedEval) arg0Value_); int state_0 = this.state_0_; if ((state_0 & 0b1100) != 0 /* is SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doDefault(PolyglotParsedEval, PolyglotParsedEval)] || SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doOther(PolyglotParsedEval, Object)] */) { if ((state_0 & 0b100) != 0 /* is SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doDefault(PolyglotParsedEval, PolyglotParsedEval)] */ && arg1Value instanceof PolyglotParsedEval) { PolyglotParsedEval arg1Value_ = (PolyglotParsedEval) arg1Value; return IsIdenticalOrUndefined.doDefault(arg0Value, arg1Value_); } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doOther(PolyglotParsedEval, Object)] */) { if (isIdenticalOrUndefinedFallbackGuard_(state_0, arg0Value, arg1Value)) { return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return isIdenticalOrUndefinedAndSpecialize(arg0Value, arg1Value); } private TriState isIdenticalOrUndefinedAndSpecialize(PolyglotParsedEval arg0Value, Object arg1Value) { int state_0 = this.state_0_; if (arg1Value instanceof PolyglotParsedEval) { PolyglotParsedEval arg1Value_ = (PolyglotParsedEval) arg1Value; state_0 = state_0 | 0b100 /* add SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doDefault(PolyglotParsedEval, PolyglotParsedEval)] */; this.state_0_ = state_0; return IsIdenticalOrUndefined.doDefault(arg0Value, arg1Value_); } state_0 = state_0 | 0b1000 /* add SpecializationActive[PolyglotParsedEval.IsIdenticalOrUndefined.doOther(PolyglotParsedEval, Object)] */; this.state_0_ = state_0; return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value); } @Override public boolean isExecutable(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return PolyglotParsedEval.isExecutable((((PolyglotParsedEval) receiver))); } @Override public int identityHashCode(Object receiver) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return PolyglotParsedEval.identityHashCode((((PolyglotParsedEval) receiver))); } @Override public Object toDisplayString(Object receiver, boolean allowSideEffects) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return PolyglotParsedEval.toDisplayString((((PolyglotParsedEval) receiver)), allowSideEffects); } @GeneratedBy(PolyglotParsedEval.class) @DenyReplace private static final class ExecuteCachedData extends Node { @Child ExecuteCachedData next_; /** * Source Info:
                 *   Specialization: {@link Execute#doCached}
                 *   Parameter: {@link DirectCallNode} callNode
*/ @Child DirectCallNode callNode_; ExecuteCachedData(ExecuteCachedData next_) { this.next_ = next_; } @Override public NodeCost getCost() { return NodeCost.NONE; } } } @GeneratedBy(PolyglotParsedEval.class) @DenyReplace private static final class Uncached extends InteropLibrary { protected Uncached() { } @Override @TruffleBoundary public boolean accepts(Object receiver) { assert !(receiver instanceof PolyglotParsedEval) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof PolyglotParsedEval; } @Override public boolean isAdoptable() { return false; } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @TruffleBoundary @Override public Object execute(Object arg0Value_, Object... arg1Value) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; PolyglotParsedEval arg0Value = ((PolyglotParsedEval) arg0Value_); return Execute.doIndirect(arg0Value, arg1Value, (IndirectCallNode.getUncached())); } @TruffleBoundary @Override public TriState isIdenticalOrUndefined(Object arg0Value_, Object arg1Value) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; PolyglotParsedEval arg0Value = ((PolyglotParsedEval) arg0Value_); if (arg1Value instanceof PolyglotParsedEval) { PolyglotParsedEval arg1Value_ = (PolyglotParsedEval) arg1Value; return IsIdenticalOrUndefined.doDefault(arg0Value, arg1Value_); } return IsIdenticalOrUndefined.doOther(arg0Value, arg1Value); } @TruffleBoundary @Override public boolean isExecutable(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return PolyglotParsedEval.isExecutable(((PolyglotParsedEval) receiver) ); } @TruffleBoundary @Override public int identityHashCode(Object receiver) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return PolyglotParsedEval.identityHashCode(((PolyglotParsedEval) receiver) ); } @TruffleBoundary @Override public Object toDisplayString(Object receiver, boolean allowSideEffects) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return PolyglotParsedEval.toDisplayString(((PolyglotParsedEval) receiver) , allowSideEffects); } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy