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

com.oracle.graal.python.builtins.modules.AsciiStringBufferGen Maven / Gradle / Ivy

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

import com.oracle.graal.python.builtins.modules.BinasciiModuleBuiltins.AsciiBufferConverter.AsciiStringBuffer;
import com.oracle.graal.python.builtins.objects.buffer.PythonBufferAccessLibrary;
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.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.strings.TruffleString.CodePointAtIndexNode;
import com.oracle.truffle.api.strings.TruffleString.CodePointLengthNode;
import java.lang.invoke.VarHandle;
import java.util.Objects;

@GeneratedBy(AsciiStringBuffer.class)
@SuppressWarnings("javadoc")
final class AsciiStringBufferGen {

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

    static  {
        LibraryExport.register(AsciiStringBuffer.class, new PythonBufferAccessLibraryExports());
    }

    private AsciiStringBufferGen() {
    }

    @GeneratedBy(AsciiStringBuffer.class)
    private static final class PythonBufferAccessLibraryExports extends LibraryExport {

        private PythonBufferAccessLibraryExports() {
            super(PythonBufferAccessLibrary.class, AsciiStringBuffer.class, false, false, 0);
        }

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

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

        @GeneratedBy(AsciiStringBuffer.class)
        private static final class Cached extends PythonBufferAccessLibrary {

            /**
             * State Info: 
             *   0: SpecializationActive {@link AsciiStringBuffer#getBufferLength(AsciiStringBuffer, CodePointLengthNode)}
             *   1: SpecializationActive {@link AsciiStringBuffer#readByte(AsciiStringBuffer, int, CodePointAtIndexNode)}
             * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
             *   Specialization: {@link AsciiStringBuffer#getBufferLength(AsciiStringBuffer, CodePointLengthNode)}
             *   Parameter: {@link CodePointLengthNode} codePointLengthNode
*/ @Child private CodePointLengthNode getBufferLengthNode__getBufferLength_codePointLengthNode_; /** * Source Info:
             *   Specialization: {@link AsciiStringBuffer#readByte(AsciiStringBuffer, int, CodePointAtIndexNode)}
             *   Parameter: {@link CodePointAtIndexNode} codePointAtIndexNode
*/ @Child private CodePointAtIndexNode readByteNode__readByte_codePointAtIndexNode_; protected Cached() { } @Override public boolean accepts(Object receiver) { assert !(receiver instanceof AsciiStringBuffer) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof AsciiStringBuffer; } @Override protected boolean isBuffer(Object receiver) { assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(this); return (((AsciiStringBuffer) receiver)).isBuffer(); } /** * Debug Info:
             *   Specialization {@link AsciiStringBuffer#getBufferLength(AsciiStringBuffer, CodePointLengthNode)}
             *     Activation probability: 0.50000
             *     With/without class size: 14/4 bytes
             * 
*/ @Override public int getBufferLength(Object arg0Value_) { assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(this); AsciiStringBuffer arg0Value = ((AsciiStringBuffer) arg0Value_); int state_0 = this.state_0_; if ((state_0 & 0b1) != 0 /* is SpecializationActive[AsciiStringBuffer.getBufferLength(AsciiStringBuffer, CodePointLengthNode)] */) { { CodePointLengthNode codePointLengthNode__ = this.getBufferLengthNode__getBufferLength_codePointLengthNode_; if (codePointLengthNode__ != null) { return arg0Value.getBufferLength(codePointLengthNode__); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return getBufferLengthNode_AndSpecialize(arg0Value); } private int getBufferLengthNode_AndSpecialize(AsciiStringBuffer arg0Value) { int state_0 = this.state_0_; CodePointLengthNode codePointLengthNode__ = this.insert((CodePointLengthNode.create())); Objects.requireNonNull(codePointLengthNode__, "Specialization 'getBufferLength(AsciiStringBuffer, CodePointLengthNode)' cache 'codePointLengthNode' 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.getBufferLengthNode__getBufferLength_codePointLengthNode_ = codePointLengthNode__; state_0 = state_0 | 0b1 /* add SpecializationActive[AsciiStringBuffer.getBufferLength(AsciiStringBuffer, CodePointLengthNode)] */; this.state_0_ = state_0; return arg0Value.getBufferLength(codePointLengthNode__); } @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 AsciiStringBuffer#readByte(AsciiStringBuffer, int, CodePointAtIndexNode)}
             *     Activation probability: 0.50000
             *     With/without class size: 14/4 bytes
             * 
*/ @Override public byte readByte(Object arg0Value_, int arg1Value) { assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; assert assertAdopted(this); AsciiStringBuffer arg0Value = ((AsciiStringBuffer) arg0Value_); int state_0 = this.state_0_; if ((state_0 & 0b10) != 0 /* is SpecializationActive[AsciiStringBuffer.readByte(AsciiStringBuffer, int, CodePointAtIndexNode)] */) { { CodePointAtIndexNode codePointAtIndexNode__ = this.readByteNode__readByte_codePointAtIndexNode_; if (codePointAtIndexNode__ != null) { return arg0Value.readByte(arg1Value, codePointAtIndexNode__); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return readByteNode_AndSpecialize(arg0Value, arg1Value); } private byte readByteNode_AndSpecialize(AsciiStringBuffer arg0Value, int arg1Value) { int state_0 = this.state_0_; CodePointAtIndexNode codePointAtIndexNode__ = this.insert((CodePointAtIndexNode.create())); Objects.requireNonNull(codePointAtIndexNode__, "Specialization 'readByte(AsciiStringBuffer, int, CodePointAtIndexNode)' cache 'codePointAtIndexNode' 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.readByteNode__readByte_codePointAtIndexNode_ = codePointAtIndexNode__; state_0 = state_0 | 0b10 /* add SpecializationActive[AsciiStringBuffer.readByte(AsciiStringBuffer, int, CodePointAtIndexNode)] */; this.state_0_ = state_0; return arg0Value.readByte(arg1Value, codePointAtIndexNode__); } } @GeneratedBy(AsciiStringBuffer.class) @DenyReplace private static final class Uncached extends PythonBufferAccessLibrary { protected Uncached() { } @Override @TruffleBoundary public boolean accepts(Object receiver) { assert !(receiver instanceof AsciiStringBuffer) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected."; return receiver instanceof AsciiStringBuffer; } @Override public boolean isAdoptable() { return false; } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @TruffleBoundary @Override protected boolean isBuffer(Object receiver) { // declared: true assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver."; return ((AsciiStringBuffer) receiver) .isBuffer(); } @TruffleBoundary @Override public int getBufferLength(Object arg0Value_) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; AsciiStringBuffer arg0Value = ((AsciiStringBuffer) arg0Value_); return arg0Value.getBufferLength((CodePointLengthNode.getUncached())); } @TruffleBoundary @Override public byte readByte(Object arg0Value_, int arg1Value) { // declared: true assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver."; AsciiStringBuffer arg0Value = ((AsciiStringBuffer) arg0Value_); return arg0Value.readByte(arg1Value, (CodePointAtIndexNode.getUncached())); } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy