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

com.oracle.truffle.nfi.backend.libffi.LibFFILibraryGen Maven / Gradle / Ivy

// CheckStyle: start generated
package com.oracle.truffle.nfi.backend.libffi;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.TruffleLanguage;
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.interop.InteropLibrary;
import com.oracle.truffle.api.interop.UnknownIdentifierException;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
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.DenyReplace;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.profiles.BranchProfile;
import java.lang.invoke.VarHandle;
import java.util.Objects;

@GeneratedBy(LibFFILibrary.class)
@SuppressWarnings("javadoc")
final class LibFFILibraryGen {

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

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

    private LibFFILibraryGen() {
    }

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

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

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

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

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

            /**
             * State Info: 
             *   0: SpecializationActive {@link LibFFILibrary#readMember(LibFFILibrary, String, BranchProfile, InteropLibrary)}
             * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
             *   Specialization: {@link LibFFILibrary#readMember(LibFFILibrary, String, BranchProfile, InteropLibrary)}
             *   Parameter: {@link BranchProfile} exception
*/ @CompilationFinal private BranchProfile exception_; protected Cached() { } @Override public boolean accepts(Object receiver) { assert !(receiver instanceof LibFFILibrary) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof LibFFILibrary; } @Override public boolean isPointer(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return LibFFILibrary.isPointer((((LibFFILibrary) receiver))); } @Override public long asPointer(Object receiver) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).asPointer(); } @Override public boolean hasMembers(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).hasMembers(); } @Override public Object getMembers(Object receiver, boolean includeInternal) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).getMembers(includeInternal); } @Override public boolean isMemberReadable(Object receiver, String member) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).isMemberReadable(member); } /** * Debug Info:
             *   Specialization {@link LibFFILibrary#readMember(LibFFILibrary, String, BranchProfile, InteropLibrary)}
             *     Activation probability: 1.00000
             *     With/without class size: 20/4 bytes
             * 
*/ @Override public Object readMember(Object arg0Value_, String arg1Value) throws UnsupportedMessageException, UnknownIdentifierException { assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); LibFFILibrary arg0Value = ((LibFFILibrary) arg0Value_); int state_0 = this.state_0_; if (state_0 != 0 /* is SpecializationActive[LibFFILibrary.readMember(LibFFILibrary, String, BranchProfile, InteropLibrary)] */) { { BranchProfile exception__ = this.exception_; if (exception__ != null) { InteropLibrary node__ = (this); return arg0Value.readMember(arg1Value, exception__, node__); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } private Object executeAndSpecialize(LibFFILibrary arg0Value, String arg1Value) throws UnknownIdentifierException { int state_0 = this.state_0_; { InteropLibrary node__ = null; BranchProfile exception__ = (BranchProfile.create()); Objects.requireNonNull(exception__, "Specialization 'readMember(LibFFILibrary, String, BranchProfile, InteropLibrary)' cache 'exception' returned a 'null' 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 'null'."); VarHandle.storeStoreFence(); this.exception_ = exception__; node__ = (this); state_0 = state_0 | 0b1 /* add SpecializationActive[LibFFILibrary.readMember(LibFFILibrary, String, BranchProfile, InteropLibrary)] */; this.state_0_ = state_0; return arg0Value.readMember(arg1Value, exception__, node__); } } @Override public NodeCost getCost() { int state_0 = this.state_0_; if (state_0 == 0) { return NodeCost.UNINITIALIZED; } else { return NodeCost.MONOMORPHIC; } } @Override public boolean hasLanguage(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).hasLanguage(); } @Override public Class> getLanguage(Object receiver) throws UnsupportedMessageException { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).getLanguage(); } @Override public Object toDisplayString(Object receiver, boolean allowSideEffects) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((LibFFILibrary) receiver)).toDisplayString(allowSideEffects); } } @GeneratedBy(LibFFILibrary.class) @DenyReplace private static final class Uncached extends InteropLibrary { protected Uncached() { } @Override @TruffleBoundary public boolean accepts(Object receiver) { assert !(receiver instanceof LibFFILibrary) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof LibFFILibrary; } @Override public boolean isAdoptable() { return false; } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @TruffleBoundary @Override public boolean isPointer(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return LibFFILibrary.isPointer(((LibFFILibrary) receiver) ); } @TruffleBoundary @Override public long asPointer(Object receiver) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((LibFFILibrary) receiver) .asPointer(); } @TruffleBoundary @Override public boolean hasMembers(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((LibFFILibrary) receiver) .hasMembers(); } @TruffleBoundary @Override public Object getMembers(Object receiver, boolean includeInternal) throws UnsupportedMessageException { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((LibFFILibrary) receiver) .getMembers(includeInternal); } @TruffleBoundary @Override public boolean isMemberReadable(Object receiver, String member) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((LibFFILibrary) receiver) .isMemberReadable(member); } @TruffleBoundary @Override public Object readMember(Object arg0Value_, String arg1Value) throws UnknownIdentifierException { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; LibFFILibrary arg0Value = ((LibFFILibrary) arg0Value_); return arg0Value.readMember(arg1Value, (BranchProfile.getUncached()), (this)); } @TruffleBoundary @Override public boolean hasLanguage(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((LibFFILibrary) 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 ((LibFFILibrary) receiver) .getLanguage(); } @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 ((LibFFILibrary) receiver) .toDisplayString(allowSideEffects); } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy