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

com.oracle.graal.python.runtime.exception.PExceptionGen Maven / Gradle / Ivy

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

import com.oracle.graal.python.runtime.GilNode;
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.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.interop.ExceptionType;
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.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.FinalBitSet;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;

@GeneratedBy(PException.class)
@SuppressWarnings("javadoc")
final class PExceptionGen {

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

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

    private PExceptionGen() {
    }

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

        static final FinalBitSet ENABLED_MESSAGES = createMessageBitSet(INTEROP_LIBRARY_, "isException", "getExceptionType", "throwException", "hasSourceLocation", "getSourceLocation");

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

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

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

        @GeneratedBy(PException.class)
        private static final class Cached extends InteropLibrary implements DelegateExport {

            private static final StateField STATE_0_GetExceptionSourceLocationNode__UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
            /**
             * Source Info: 
             *   Specialization: {@link PException#getExceptionSourceLocation(PException, Node, InlinedBranchProfile)}
             *   Parameter: {@link InlinedBranchProfile} unsupportedProfile
             *   Inline method: {@link InlinedBranchProfile#inline}
*/ private static final InlinedBranchProfile INLINED_GET_EXCEPTION_SOURCE_LOCATION_NODE__GET_EXCEPTION_SOURCE_LOCATION_UNSUPPORTED_PROFILE_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_GetExceptionSourceLocationNode__UPDATER.subUpdater(2, 1))); @Child private InteropLibrary receiverPythonExceptionInteropLibrary_; /** * State Info:
             *   0: SpecializationActive {@link PException#getExceptionType(PException, InteropLibrary)}
             *   1: SpecializationActive {@link PException#throwException(PException, GilNode)}
             *   2: InlinedCache
             *        Specialization: {@link PException#getExceptionSourceLocation}
             *        Parameter: {@link InlinedBranchProfile} unsupportedProfile
             *        Inline method: {@link InlinedBranchProfile#inline}
             * 
*/ @CompilationFinal @UnsafeAccessedField private int state_0_; /** * Source Info:
             *   Specialization: {@link PException#getExceptionType(PException, InteropLibrary)}
             *   Parameter: {@link InteropLibrary} lib
*/ @Child private InteropLibrary getExceptionTypeNode__getExceptionType_lib_; /** * Source Info:
             *   Specialization: {@link PException#throwException(PException, GilNode)}
             *   Parameter: {@link GilNode} gil
*/ @Child private GilNode throwExceptionNode__throwException_gil_; protected Cached(Object receiver) { PException castReceiver = ((PException) receiver) ; this.receiverPythonExceptionInteropLibrary_ = INTEROP_LIBRARY_.create((castReceiver.pythonException)); } @Override public FinalBitSet getDelegateExportMessages() { return ENABLED_MESSAGES; } @Override public Object readDelegateExport(Object receiver_) { return ((PException) receiver_).pythonException; } @Override public Library getDelegateExportLibrary(Object delegate) { return this.receiverPythonExceptionInteropLibrary_; } @Override public boolean accepts(Object receiver) { assert !(receiver instanceof PException) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; if (!(receiver instanceof PException)) { return false; } else if (!this.receiverPythonExceptionInteropLibrary_.accepts((((PException) receiver).pythonException))) { return false; } else { return true; } } @Override public boolean isException(Object receiver) { assert receiver instanceof PException : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((PException) receiver)).isException(); } /** * Debug Info:
             *   Specialization {@link PException#getExceptionType(PException, InteropLibrary)}
             *     Activation probability: 0.25000
             *     With/without class size: 9/4 bytes
             * 
*/ @Override public ExceptionType getExceptionType(Object arg0Value_) throws UnsupportedMessageException { assert arg0Value_ instanceof PException : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); PException arg0Value = ((PException) arg0Value_); int state_0 = this.state_0_; if ((state_0 & 0b1) != 0 /* is SpecializationActive[PException.getExceptionType(PException, InteropLibrary)] */) { { InteropLibrary lib__ = this.getExceptionTypeNode__getExceptionType_lib_; if (lib__ != null) { return arg0Value.getExceptionType(lib__); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return getExceptionTypeNode_AndSpecialize(arg0Value); } private ExceptionType getExceptionTypeNode_AndSpecialize(PException arg0Value) throws UnsupportedMessageException { int state_0 = this.state_0_; InteropLibrary lib__ = this.insert((INTEROP_LIBRARY_.createDispatched(1))); Objects.requireNonNull(lib__, "Specialization 'getExceptionType(PException, InteropLibrary)' cache 'lib' 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.getExceptionTypeNode__getExceptionType_lib_ = lib__; state_0 = state_0 | 0b1 /* add SpecializationActive[PException.getExceptionType(PException, InteropLibrary)] */; this.state_0_ = state_0; return arg0Value.getExceptionType(lib__); } @Override public NodeCost getCost() { int state_0 = this.state_0_; if ((state_0 & 0b1) == 0) { return NodeCost.UNINITIALIZED; } else { return NodeCost.MONOMORPHIC; } } /** * Debug Info:
             *   Specialization {@link PException#throwException(PException, GilNode)}
             *     Activation probability: 0.25000
             *     With/without class size: 9/4 bytes
             * 
*/ @Override public RuntimeException throwException(Object arg0Value_) throws UnsupportedMessageException { assert arg0Value_ instanceof PException : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); PException arg0Value = ((PException) arg0Value_); int state_0 = this.state_0_; if ((state_0 & 0b10) != 0 /* is SpecializationActive[PException.throwException(PException, GilNode)] */) { { GilNode gil__ = this.throwExceptionNode__throwException_gil_; if (gil__ != null) { return arg0Value.throwException(gil__); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return throwExceptionNode_AndSpecialize(arg0Value); } private RuntimeException throwExceptionNode_AndSpecialize(PException arg0Value) { int state_0 = this.state_0_; GilNode gil__ = this.insert((GilNode.create())); Objects.requireNonNull(gil__, "Specialization 'throwException(PException, GilNode)' cache 'gil' 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.throwExceptionNode__throwException_gil_ = gil__; state_0 = state_0 | 0b10 /* add SpecializationActive[PException.throwException(PException, GilNode)] */; this.state_0_ = state_0; return arg0Value.throwException(gil__); } @Override public boolean hasSourceLocation(Object receiver) { assert receiver instanceof PException : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); return (((PException) receiver)).hasSourceLocation(); } /** * Debug Info:
             *   Specialization {@link PException#getExceptionSourceLocation(PException, Node, InlinedBranchProfile)}
             *     Activation probability: 0.25000
             *     With/without class size: 9/1 bytes
             * 
*/ @Override public SourceSection getSourceLocation(Object arg0Value_) throws UnsupportedMessageException { assert arg0Value_ instanceof PException : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(); PException arg0Value = ((PException) arg0Value_); { Node inliningTarget__ = (this); return arg0Value.getExceptionSourceLocation(inliningTarget__, INLINED_GET_EXCEPTION_SOURCE_LOCATION_NODE__GET_EXCEPTION_SOURCE_LOCATION_UNSUPPORTED_PROFILE_); } } } @GeneratedBy(PException.class) @DenyReplace private static final class Uncached extends InteropLibrary implements DelegateExport { protected Uncached() { } @Override public FinalBitSet getDelegateExportMessages() { return ENABLED_MESSAGES; } @Override public Object readDelegateExport(Object receiver_) { return (((PException) receiver_)).pythonException; } @Override public Library getDelegateExportLibrary(Object delegate_) { return INTEROP_LIBRARY_.getUncached(delegate_); } @Override @TruffleBoundary public boolean accepts(Object receiver) { assert !(receiver instanceof PException) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof PException; } @Override public boolean isAdoptable() { return false; } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @TruffleBoundary @Override public boolean isException(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((PException) receiver) .isException(); } @TruffleBoundary @Override public ExceptionType getExceptionType(Object arg0Value_) throws UnsupportedMessageException { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; PException arg0Value = ((PException) arg0Value_); return arg0Value.getExceptionType((INTEROP_LIBRARY_.getUncached())); } @TruffleBoundary @Override public RuntimeException throwException(Object arg0Value_) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; PException arg0Value = ((PException) arg0Value_); return arg0Value.throwException((GilNode.getUncached())); } @TruffleBoundary @Override public boolean hasSourceLocation(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((PException) receiver) .hasSourceLocation(); } @TruffleBoundary @Override public SourceSection getSourceLocation(Object arg0Value_) throws UnsupportedMessageException { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; PException arg0Value = ((PException) arg0Value_); return arg0Value.getExceptionSourceLocation((this), (InlinedBranchProfile.getUncached())); } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy