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

com.oracle.graal.python.ForeignLanguageViewGen Maven / Gradle / Ivy

There is a newer version: 24.1.1
Show newest version
// CheckStyle: start generated
package com.oracle.graal.python;

import com.oracle.graal.python.PythonLanguage.ForeignLanguageView;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.library.DynamicDispatchLibrary;
import com.oracle.truffle.api.library.Library;
import com.oracle.truffle.api.library.LibraryExport;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.utilities.FinalBitSet;

@GeneratedBy(ForeignLanguageView.class)
@SuppressWarnings("javadoc")
final class ForeignLanguageViewGen {

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

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

    private ForeignLanguageViewGen() {
    }

    @GeneratedBy(ForeignLanguageView.class)
    static class InteropLibraryExports extends LibraryExport {

        static final FinalBitSet ENABLED_MESSAGES = createMessageBitSet(INTEROP_LIBRARY_, "toDisplayString", "hasLanguage", "getLanguage");

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

        @Override
        protected InteropLibrary createUncached(Object receiver) {
            assert receiver instanceof ForeignLanguageView;
            InteropLibrary uncached = createDelegate(INTEROP_LIBRARY_, new Uncached(receiver));
            return uncached;
        }

        @Override
        protected InteropLibrary createCached(Object receiver) {
            assert receiver instanceof ForeignLanguageView;
            return createDelegate(INTEROP_LIBRARY_, new Cached(receiver));
        }

        @GeneratedBy(ForeignLanguageView.class)
        static class Cached extends InteropLibrary implements DelegateExport {

            @Child private InteropLibrary receiverDelegateInteropLibrary_;
            private final Class receiverClass_;

            protected Cached(Object receiver) {
                ForeignLanguageView castReceiver = ((ForeignLanguageView) receiver) ;
                this.receiverDelegateInteropLibrary_ = INTEROP_LIBRARY_.create((castReceiver.delegate));
                this.receiverClass_ = castReceiver.getClass();
            }

            @Override
            public FinalBitSet getDelegateExportMessages() {
                return ENABLED_MESSAGES;
            }

            @Override
            public Object readDelegateExport(Object receiver_) {
                return CompilerDirectives.castExact(receiver_, receiverClass_).delegate;
            }

            @Override
            public Library getDelegateExportLibrary(Object delegate) {
                return this.receiverDelegateInteropLibrary_;
            }

            @Override
            public boolean accepts(Object receiver) {
                assert receiver.getClass() != this.receiverClass_ || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
                if (!(CompilerDirectives.isExact(receiver, this.receiverClass_))) {
                    return false;
                } else if (!this.receiverDelegateInteropLibrary_.accepts((((ForeignLanguageView) receiver).delegate))) {
                    return false;
                } else {
                    return true;
                }
            }

            /**
             * Debug Info: 
             *   Specialization {@link ForeignLanguageView#toDisplayString(ForeignLanguageView, boolean, InteropLibrary)}
             *     Activation probability: 0.50000
             *     With/without class size: 10/0 bytes
             * 
*/ @Override public Object toDisplayString(Object arg0Value_, boolean arg1Value) { assert CompilerDirectives.isExact(arg0Value_, this.receiverClass_) : "Invalid library usage. Library does not accept given receiver."; ForeignLanguageView arg0Value = CompilerDirectives.castExact(arg0Value_, receiverClass_); { InteropLibrary lib__ = this.receiverDelegateInteropLibrary_; return arg0Value.toDisplayString(arg1Value, lib__); } } @Override public NodeCost getCost() { return NodeCost.MONOMORPHIC; } @Override public boolean hasLanguage(Object receiver) { assert CompilerDirectives.isExact(receiver, this.receiverClass_) : "Invalid library usage. Library does not accept given receiver."; return (CompilerDirectives.castExact(receiver, receiverClass_)).hasLanguage(); } @Override public Class> getLanguage(Object receiver) throws UnsupportedMessageException { assert CompilerDirectives.isExact(receiver, this.receiverClass_) : "Invalid library usage. Library does not accept given receiver."; return (CompilerDirectives.castExact(receiver, receiverClass_)).getLanguage(); } } @GeneratedBy(ForeignLanguageView.class) static class Uncached extends InteropLibrary implements DelegateExport { private final Class receiverClass_; protected Uncached(Object receiver) { this.receiverClass_ = ((ForeignLanguageView) receiver).getClass(); } @Override public FinalBitSet getDelegateExportMessages() { return ENABLED_MESSAGES; } @Override public Object readDelegateExport(Object receiver_) { return (((ForeignLanguageView) receiver_)).delegate; } @Override public Library getDelegateExportLibrary(Object delegate_) { return INTEROP_LIBRARY_.getUncached(delegate_); } @Override @TruffleBoundary public boolean accepts(Object receiver) { assert receiver.getClass() != this.receiverClass_ || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return CompilerDirectives.isExact(receiver, this.receiverClass_); } @Override public final boolean isAdoptable() { return false; } @Override public final NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @TruffleBoundary @Override public Object toDisplayString(Object arg0Value_, boolean arg1Value) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; ForeignLanguageView arg0Value = ((ForeignLanguageView) arg0Value_); return arg0Value.toDisplayString(arg1Value, INTEROP_LIBRARY_.getUncached((arg0Value.delegate))); } @TruffleBoundary @Override public boolean hasLanguage(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((ForeignLanguageView) receiver) .hasLanguage(); } @TruffleBoundary @Override public Class> getLanguage(Object receiver) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((ForeignLanguageView) receiver) .getLanguage(); } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy