com.oracle.graal.python.builtins.modules.PUnsignedBytesWrapperGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.builtins.modules;
import com.oracle.graal.python.builtins.modules.JavaModuleBuiltins.PUnsignedBytesWrapper;
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.interop.InteropLibrary;
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
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.NodeCost;
import com.oracle.truffle.api.utilities.FinalBitSet;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(PUnsignedBytesWrapper.class)
@SuppressWarnings("javadoc")
final class PUnsignedBytesWrapperGen {
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
static {
LibraryExport.register(PUnsignedBytesWrapper.class, new InteropLibraryExports());
}
private PUnsignedBytesWrapperGen() {
}
@GeneratedBy(PUnsignedBytesWrapper.class)
private static final class InteropLibraryExports extends LibraryExport {
static final FinalBitSet ENABLED_MESSAGES = createMessageBitSet(INTEROP_LIBRARY_, "hasArrayElements", "isArrayElementReadable", "getArraySize", "readArrayElement");
private InteropLibraryExports() {
super(InteropLibrary.class, PUnsignedBytesWrapper.class, false, false, 0);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof PUnsignedBytesWrapper;
InteropLibrary uncached = createDelegate(INTEROP_LIBRARY_, new Uncached());
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof PUnsignedBytesWrapper;
return createDelegate(INTEROP_LIBRARY_, new Cached(receiver));
}
@GeneratedBy(PUnsignedBytesWrapper.class)
private static final class Cached extends InteropLibrary implements DelegateExport {
@Child private InteropLibrary receiverDelegateInteropLibrary_;
/**
* State Info:
* 0: SpecializationActive {@link PUnsignedBytesWrapper#readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link PUnsignedBytesWrapper#readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)}
* Parameter: {@link InteropLibrary} elementLib
*/
@Child private InteropLibrary readArrayElementNode__readArrayElement_elementLib_;
/**
* Source Info:
* Specialization: {@link PUnsignedBytesWrapper#readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)}
* Parameter: {@link GilNode} gil
*/
@Child private GilNode readArrayElementNode__readArrayElement_gil_;
protected Cached(Object receiver) {
PUnsignedBytesWrapper castReceiver = ((PUnsignedBytesWrapper) receiver) ;
this.receiverDelegateInteropLibrary_ = INTEROP_LIBRARY_.create((castReceiver.delegate));
}
@Override
public FinalBitSet getDelegateExportMessages() {
return ENABLED_MESSAGES;
}
@Override
public Object readDelegateExport(Object receiver_) {
return ((PUnsignedBytesWrapper) receiver_).delegate;
}
@Override
public Library getDelegateExportLibrary(Object delegate) {
return this.receiverDelegateInteropLibrary_;
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof PUnsignedBytesWrapper) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
if (!(receiver instanceof PUnsignedBytesWrapper)) {
return false;
} else if (!this.receiverDelegateInteropLibrary_.accepts((((PUnsignedBytesWrapper) receiver).delegate))) {
return false;
} else {
return true;
}
}
/**
* Debug Info:
* Specialization {@link PUnsignedBytesWrapper#hasArrayElements(PUnsignedBytesWrapper, InteropLibrary)}
* Activation probability: 0.20000
* With/without class size: 6/0 bytes
*
*/
@Override
public boolean hasArrayElements(Object arg0Value_) {
assert arg0Value_ instanceof PUnsignedBytesWrapper : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
{
InteropLibrary delegateLib__ = this.receiverDelegateInteropLibrary_;
return arg0Value.hasArrayElements(delegateLib__);
}
}
@Override
public NodeCost getCost() {
return NodeCost.MONOMORPHIC;
}
/**
* Debug Info:
* Specialization {@link PUnsignedBytesWrapper#isArrayElementReadable(PUnsignedBytesWrapper, long, InteropLibrary)}
* Activation probability: 0.20000
* With/without class size: 6/0 bytes
*
*/
@Override
public boolean isArrayElementReadable(Object arg0Value_, long arg1Value) {
assert arg0Value_ instanceof PUnsignedBytesWrapper : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
{
InteropLibrary delegateLib__ = this.receiverDelegateInteropLibrary_;
return arg0Value.isArrayElementReadable(arg1Value, delegateLib__);
}
}
/**
* Debug Info:
* Specialization {@link PUnsignedBytesWrapper#getArraySize(PUnsignedBytesWrapper, InteropLibrary)}
* Activation probability: 0.20000
* With/without class size: 6/0 bytes
*
*/
@Override
public long getArraySize(Object arg0Value_) throws UnsupportedMessageException {
assert arg0Value_ instanceof PUnsignedBytesWrapper : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
{
InteropLibrary delegateLib__ = this.receiverDelegateInteropLibrary_;
return arg0Value.getArraySize(delegateLib__);
}
}
/**
* Debug Info:
* Specialization {@link PUnsignedBytesWrapper#readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)}
* Activation probability: 0.20000
* With/without class size: 8/8 bytes
*
*/
@Override
public Object readArrayElement(Object arg0Value_, long arg1Value) throws UnsupportedMessageException, InvalidArrayIndexException {
assert arg0Value_ instanceof PUnsignedBytesWrapper : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[PUnsignedBytesWrapper.readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)] */) {
{
InteropLibrary elementLib__ = this.readArrayElementNode__readArrayElement_elementLib_;
if (elementLib__ != null) {
GilNode gil__ = this.readArrayElementNode__readArrayElement_gil_;
if (gil__ != null) {
InteropLibrary delegateLib__ = this.receiverDelegateInteropLibrary_;
return arg0Value.readArrayElement(arg1Value, delegateLib__, elementLib__, gil__);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return readArrayElementNode_AndSpecialize(arg0Value, arg1Value);
}
private Object readArrayElementNode_AndSpecialize(PUnsignedBytesWrapper arg0Value, long arg1Value) throws InvalidArrayIndexException, UnsupportedMessageException {
int state_0 = this.state_0_;
{
InteropLibrary delegateLib__ = null;
delegateLib__ = this.receiverDelegateInteropLibrary_;
InteropLibrary elementLib__ = this.insert((INTEROP_LIBRARY_.createDispatched(1)));
Objects.requireNonNull(elementLib__, "Specialization 'readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)' cache 'elementLib' 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.readArrayElementNode__readArrayElement_elementLib_ = elementLib__;
GilNode gil__ = this.insert((GilNode.create()));
Objects.requireNonNull(gil__, "Specialization 'readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, 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.readArrayElementNode__readArrayElement_gil_ = gil__;
state_0 = state_0 | 0b1 /* add SpecializationActive[PUnsignedBytesWrapper.readArrayElement(PUnsignedBytesWrapper, long, InteropLibrary, InteropLibrary, GilNode)] */;
this.state_0_ = state_0;
return arg0Value.readArrayElement(arg1Value, delegateLib__, elementLib__, gil__);
}
}
}
@GeneratedBy(PUnsignedBytesWrapper.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 (((PUnsignedBytesWrapper) receiver_)).delegate;
}
@Override
public Library getDelegateExportLibrary(Object delegate_) {
return INTEROP_LIBRARY_.getUncached(delegate_);
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof PUnsignedBytesWrapper) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof PUnsignedBytesWrapper;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public boolean hasArrayElements(Object arg0Value_) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
return arg0Value.hasArrayElements(INTEROP_LIBRARY_.getUncached((arg0Value.delegate)));
}
@TruffleBoundary
@Override
public boolean isArrayElementReadable(Object arg0Value_, long arg1Value) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
return arg0Value.isArrayElementReadable(arg1Value, INTEROP_LIBRARY_.getUncached((arg0Value.delegate)));
}
@TruffleBoundary
@Override
public long getArraySize(Object arg0Value_) throws UnsupportedMessageException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
return arg0Value.getArraySize(INTEROP_LIBRARY_.getUncached((arg0Value.delegate)));
}
@TruffleBoundary
@Override
public Object readArrayElement(Object arg0Value_, long arg1Value) throws InvalidArrayIndexException, UnsupportedMessageException {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
PUnsignedBytesWrapper arg0Value = ((PUnsignedBytesWrapper) arg0Value_);
return arg0Value.readArrayElement(arg1Value, INTEROP_LIBRARY_.getUncached((arg0Value.delegate)), (INTEROP_LIBRARY_.getUncached()), (GilNode.getUncached()));
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy