com.oracle.graal.python.runtime.interop.InteropMapGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.runtime.interop;
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.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 java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(InteropMap.class)
@SuppressWarnings("javadoc")
final class InteropMapGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
static {
LibraryExport.register(InteropMap.class, new InteropLibraryExports());
}
private InteropMapGen() {
}
@GeneratedBy(InteropMap.class)
private static final class InteropLibraryExports extends LibraryExport {
private InteropLibraryExports() {
super(InteropLibrary.class, InteropMap.class, false, false, 0);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof InteropMap;
InteropLibrary uncached = new Uncached();
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof InteropMap;
return new Cached();
}
@GeneratedBy(InteropMap.class)
private static final class Cached extends InteropLibrary {
/**
* State Info:
* 0: SpecializationActive {@link InteropMap#getKey(InteropMap, String, GilNode)}
* 1: SpecializationActive {@link InteropMap#hasKey(InteropMap, String, GilNode)}
* 2: SpecializationActive {@link InteropMap#getKeys(InteropMap, boolean, GilNode)}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link InteropMap#getKey(InteropMap, String, GilNode)}
* Parameter: {@link GilNode} gil
*/
@Child private GilNode getKeyNode__getKey_gil_;
/**
* Source Info:
* Specialization: {@link InteropMap#hasKey(InteropMap, String, GilNode)}
* Parameter: {@link GilNode} gil
*/
@Child private GilNode hasKeyNode__hasKey_gil_;
/**
* Source Info:
* Specialization: {@link InteropMap#getKeys(InteropMap, boolean, GilNode)}
* Parameter: {@link GilNode} gil
*/
@Child private GilNode getKeysNode__getKeys_gil_;
protected Cached() {
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof InteropMap) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof InteropMap;
}
@Override
public boolean hasMembers(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((InteropMap) receiver)).hasMembers();
}
/**
* Debug Info:
* Specialization {@link InteropMap#getKey(InteropMap, String, GilNode)}
* Activation probability: 0.33333
* With/without class size: 10/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();
InteropMap arg0Value = ((InteropMap) arg0Value_);
int state_0 = this.state_0_;
if ((state_0 & 0b1) != 0 /* is SpecializationActive[InteropMap.getKey(InteropMap, String, GilNode)] */) {
{
GilNode gil__ = this.getKeyNode__getKey_gil_;
if (gil__ != null) {
return arg0Value.getKey(arg1Value, gil__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return getKeyNode_AndSpecialize(arg0Value, arg1Value);
}
private Object getKeyNode_AndSpecialize(InteropMap arg0Value, String arg1Value) {
int state_0 = this.state_0_;
GilNode gil__ = this.insert((GilNode.create()));
Objects.requireNonNull(gil__, "Specialization 'getKey(InteropMap, String, 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.getKeyNode__getKey_gil_ = gil__;
state_0 = state_0 | 0b1 /* add SpecializationActive[InteropMap.getKey(InteropMap, String, GilNode)] */;
this.state_0_ = state_0;
return arg0Value.getKey(arg1Value, gil__);
}
@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 InteropMap#hasKey(InteropMap, String, GilNode)}
* Activation probability: 0.33333
* With/without class size: 10/4 bytes
*
*/
@Override
public boolean isMemberReadable(Object arg0Value_, String arg1Value) {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
InteropMap arg0Value = ((InteropMap) arg0Value_);
int state_0 = this.state_0_;
if ((state_0 & 0b10) != 0 /* is SpecializationActive[InteropMap.hasKey(InteropMap, String, GilNode)] */) {
{
GilNode gil__ = this.hasKeyNode__hasKey_gil_;
if (gil__ != null) {
return arg0Value.hasKey(arg1Value, gil__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return hasKeyNode_AndSpecialize(arg0Value, arg1Value);
}
private boolean hasKeyNode_AndSpecialize(InteropMap arg0Value, String arg1Value) {
int state_0 = this.state_0_;
GilNode gil__ = this.insert((GilNode.create()));
Objects.requireNonNull(gil__, "Specialization 'hasKey(InteropMap, String, 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.hasKeyNode__hasKey_gil_ = gil__;
state_0 = state_0 | 0b10 /* add SpecializationActive[InteropMap.hasKey(InteropMap, String, GilNode)] */;
this.state_0_ = state_0;
return arg0Value.hasKey(arg1Value, gil__);
}
/**
* Debug Info:
* Specialization {@link InteropMap#getKeys(InteropMap, boolean, GilNode)}
* Activation probability: 0.33333
* With/without class size: 10/4 bytes
*
*/
@Override
public Object getMembers(Object arg0Value_, boolean arg1Value) throws UnsupportedMessageException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
InteropMap arg0Value = ((InteropMap) arg0Value_);
int state_0 = this.state_0_;
if ((state_0 & 0b100) != 0 /* is SpecializationActive[InteropMap.getKeys(InteropMap, boolean, GilNode)] */) {
{
GilNode gil__ = this.getKeysNode__getKeys_gil_;
if (gil__ != null) {
return arg0Value.getKeys(arg1Value, gil__);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return getKeysNode_AndSpecialize(arg0Value, arg1Value);
}
private Object getKeysNode_AndSpecialize(InteropMap arg0Value, boolean arg1Value) {
int state_0 = this.state_0_;
GilNode gil__ = this.insert((GilNode.create()));
Objects.requireNonNull(gil__, "Specialization 'getKeys(InteropMap, boolean, 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.getKeysNode__getKeys_gil_ = gil__;
state_0 = state_0 | 0b100 /* add SpecializationActive[InteropMap.getKeys(InteropMap, boolean, GilNode)] */;
this.state_0_ = state_0;
return arg0Value.getKeys(arg1Value, gil__);
}
}
@GeneratedBy(InteropMap.class)
@DenyReplace
private static final class Uncached extends InteropLibrary {
protected Uncached() {
}
@Override
@TruffleBoundary
public boolean accepts(Object receiver) {
assert !(receiver instanceof InteropMap) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof InteropMap;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public boolean hasMembers(Object receiver) {
// declared: true
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((InteropMap) receiver) .hasMembers();
}
@TruffleBoundary
@Override
public Object readMember(Object arg0Value_, String arg1Value) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
InteropMap arg0Value = ((InteropMap) arg0Value_);
return arg0Value.getKey(arg1Value, (GilNode.getUncached()));
}
@TruffleBoundary
@Override
public boolean isMemberReadable(Object arg0Value_, String arg1Value) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
InteropMap arg0Value = ((InteropMap) arg0Value_);
return arg0Value.hasKey(arg1Value, (GilNode.getUncached()));
}
@TruffleBoundary
@Override
public Object getMembers(Object arg0Value_, boolean arg1Value) {
// declared: true
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
InteropMap arg0Value = ((InteropMap) arg0Value_);
return arg0Value.getKeys(arg1Value, (GilNode.getUncached()));
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy