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

com.oracle.graal.python.runtime.EmulatedUniversalSockAddrImplGen Maven / Gradle / Ivy

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

import com.oracle.graal.python.runtime.EmulatedPosixSupport.EmulatedUniversalSockAddrImpl;
import com.oracle.graal.python.runtime.PosixSupportLibrary.Inet4SockAddr;
import com.oracle.graal.python.runtime.PosixSupportLibrary.Inet6SockAddr;
import com.oracle.graal.python.runtime.PosixSupportLibrary.UniversalSockAddr;
import com.oracle.graal.python.runtime.PosixSupportLibrary.UniversalSockAddrLibrary;
import com.oracle.graal.python.runtime.PosixSupportLibrary.UnixSockAddr;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.library.DynamicDispatchLibrary;
import com.oracle.truffle.api.library.LibraryExport;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.NodeCost;

@GeneratedBy(EmulatedUniversalSockAddrImpl.class)
final class EmulatedUniversalSockAddrImplGen {

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

    static  {
        LibraryExport.register(EmulatedUniversalSockAddrImpl.class, new UniversalSockAddrLibraryExports());
    }

    private EmulatedUniversalSockAddrImplGen() {
    }

    @GeneratedBy(EmulatedUniversalSockAddrImpl.class)
    protected static class UniversalSockAddrLibraryExports extends LibraryExport {

        private UniversalSockAddrLibraryExports() {
            super(UniversalSockAddrLibrary.class, EmulatedUniversalSockAddrImpl.class, false, false, 0);
        }

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

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

        @GeneratedBy(EmulatedUniversalSockAddrImpl.class)
        protected static class Cached extends UniversalSockAddrLibrary {

            private final Class receiverClass_;

            protected Cached(Object receiver) {
                EmulatedUniversalSockAddrImpl castReceiver = ((EmulatedUniversalSockAddrImpl) receiver) ;
                this.receiverClass_ = castReceiver.getClass();
            }

            @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.";
                return CompilerDirectives.isExact(receiver, this.receiverClass_);
            }

            @Override
            public int getFamily(UniversalSockAddr receiver) {
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return (CompilerDirectives.castExact(receiver, receiverClass_)).getFamily();
            }

            @Override
            public Inet4SockAddr asInet4SockAddr(UniversalSockAddr receiver) {
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return (CompilerDirectives.castExact(receiver, receiverClass_)).asInet4SockAddr();
            }

            @Override
            public Inet6SockAddr asInet6SockAddr(UniversalSockAddr receiver) {
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return (CompilerDirectives.castExact(receiver, receiverClass_)).asInet6SockAddr();
            }

            @Override
            public UnixSockAddr asUnixSockAddr(UniversalSockAddr receiver) {
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return (CompilerDirectives.castExact(receiver, receiverClass_)).asUnixSockAddr();
            }

        }
        @GeneratedBy(EmulatedUniversalSockAddrImpl.class)
        protected static class Uncached extends UniversalSockAddrLibrary {

            private final Class receiverClass_;

            protected Uncached(Object receiver) {
                this.receiverClass_ = ((EmulatedUniversalSockAddrImpl) receiver).getClass();
            }

            @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 int getFamily(UniversalSockAddr receiver) {
                // declared: true
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return ((EmulatedUniversalSockAddrImpl) receiver) .getFamily();
            }

            @TruffleBoundary
            @Override
            public Inet4SockAddr asInet4SockAddr(UniversalSockAddr receiver) {
                // declared: true
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return ((EmulatedUniversalSockAddrImpl) receiver) .asInet4SockAddr();
            }

            @TruffleBoundary
            @Override
            public Inet6SockAddr asInet6SockAddr(UniversalSockAddr receiver) {
                // declared: true
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return ((EmulatedUniversalSockAddrImpl) receiver) .asInet6SockAddr();
            }

            @TruffleBoundary
            @Override
            public UnixSockAddr asUnixSockAddr(UniversalSockAddr receiver) {
                // declared: true
                assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
                return ((EmulatedUniversalSockAddrImpl) receiver) .asUnixSockAddr();
            }

        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy