com.oracle.graal.python.lib.PyMappingCheckNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.objects.array.PArray;
import com.oracle.graal.python.builtins.objects.deque.PDeque;
import com.oracle.graal.python.builtins.objects.dict.PDict;
import com.oracle.graal.python.builtins.objects.mappingproxy.PMappingproxy;
import com.oracle.graal.python.builtins.objects.memoryview.PMemoryView;
import com.oracle.graal.python.builtins.objects.object.PythonObject;
import com.oracle.graal.python.builtins.objects.range.PRange;
import com.oracle.graal.python.builtins.objects.set.PBaseSet;
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
import com.oracle.graal.python.nodes.attributes.LookupCallableSlotInMRONode;
import com.oracle.graal.python.nodes.object.GetClassNode;
import com.oracle.graal.python.nodes.object.GetClassNodeGen;
import com.oracle.graal.python.runtime.sequence.PSequence;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.RequiredField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
import com.oracle.truffle.api.interop.InteropLibrary;
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.strings.TruffleString;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link PyMappingCheckNode#doDict}
* Activation probability: 0.15909
* With/without class size: 5/0 bytes
* Specialization {@link PyMappingCheckNode#doString}
* Activation probability: 0.14545
* With/without class size: 5/0 bytes
* Specialization {@link PyMappingCheckNode#doSequence}
* Activation probability: 0.13182
* With/without class size: 5/0 bytes
* Specialization {@link PyMappingCheckNode#doArray}
* Activation probability: 0.11818
* With/without class size: 5/0 bytes
* Specialization {@link PyMappingCheckNode#doMemoryView}
* Activation probability: 0.10455
* With/without class size: 5/0 bytes
* Specialization {@link PyMappingCheckNode#doMappingproxy}
* Activation probability: 0.09091
* With/without class size: 5/0 bytes
* Specialization {@link PyMappingCheckNode#doRange}
* Activation probability: 0.07727
* With/without class size: 4/0 bytes
* Specialization {@link PyMappingCheckNode#doDeque}
* Activation probability: 0.06364
* With/without class size: 4/0 bytes
* Specialization {@link PyMappingCheckNode#doSet}
* Activation probability: 0.05000
* With/without class size: 4/0 bytes
* Specialization {@link PyMappingCheckNode#doPythonObject}
* Activation probability: 0.03636
* With/without class size: 4/0 bytes
* Specialization {@link PyMappingCheckNode#doGeneric}
* Activation probability: 0.02273
* With/without class size: 4/4 bytes
*
*/
@GeneratedBy(PyMappingCheckNode.class)
@SuppressWarnings("javadoc")
public final class PyMappingCheckNodeGen {
private static final Uncached UNCACHED = new Uncached();
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
@NeverDefault
public static PyMappingCheckNode getUncached() {
return PyMappingCheckNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#getClass_field1_}
*
- {@link Inlined#lookupGetItem}
*
- {@link Inlined#generic_lib_}
*
*/
@NeverDefault
public static PyMappingCheckNode inline(@RequiredField(bits = 28, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PyMappingCheckNodeGen.Inlined(target);
}
@GeneratedBy(PyMappingCheckNode.class)
@DenyReplace
private static final class Inlined extends PyMappingCheckNode {
/**
* State Info:
* 0: SpecializationActive {@link PyMappingCheckNode#doDict}
* 1: SpecializationActive {@link PyMappingCheckNode#doString}
* 2: SpecializationActive {@link PyMappingCheckNode#doSequence}
* 3: SpecializationActive {@link PyMappingCheckNode#doArray}
* 4: SpecializationActive {@link PyMappingCheckNode#doMemoryView}
* 5: SpecializationActive {@link PyMappingCheckNode#doMappingproxy}
* 6: SpecializationActive {@link PyMappingCheckNode#doRange}
* 7: SpecializationActive {@link PyMappingCheckNode#doDeque}
* 8: SpecializationActive {@link PyMappingCheckNode#doSet}
* 9: SpecializationActive {@link PyMappingCheckNode#doPythonObject}
* 10: SpecializationActive {@link PyMappingCheckNode#doGeneric}
* 11-27: InlinedCache
* Specialization: {@link PyMappingCheckNode#doPythonObject}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField getClass_field1_;
private final ReferenceField lookupGetItem;
private final ReferenceField generic_lib_;
/**
* Source Info:
* Specialization: {@link PyMappingCheckNode#doPythonObject}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private final GetClassNode getClass;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PyMappingCheckNode.class);
this.state_0_ = target.getState(0, 28);
this.getClass_field1_ = target.getReference(1, Node.class);
this.lookupGetItem = target.getReference(2, LookupCallableSlotInMRONode.class);
this.generic_lib_ = target.getReference(3, InteropLibrary.class);
this.getClass = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, state_0_.subUpdater(11, 17), getClass_field1_));
}
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b11111111111) != 0 /* is SpecializationActive[PyMappingCheckNode.doDict(PDict)] || SpecializationActive[PyMappingCheckNode.doString(TruffleString)] || SpecializationActive[PyMappingCheckNode.doSequence(PSequence)] || SpecializationActive[PyMappingCheckNode.doArray(PArray)] || SpecializationActive[PyMappingCheckNode.doMemoryView(PMemoryView)] || SpecializationActive[PyMappingCheckNode.doMappingproxy(PMappingproxy)] || SpecializationActive[PyMappingCheckNode.doRange(PRange)] || SpecializationActive[PyMappingCheckNode.doDeque(PDeque)] || SpecializationActive[PyMappingCheckNode.doSet(PBaseSet)] || SpecializationActive[PyMappingCheckNode.doPythonObject(Node, PythonObject, GetClassNode, LookupCallableSlotInMRONode)] || SpecializationActive[PyMappingCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, InteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyMappingCheckNode.doDict(PDict)] */ && arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return PyMappingCheckNode.doDict(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyMappingCheckNode.doString(TruffleString)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return PyMappingCheckNode.doString(arg1Value_);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PyMappingCheckNode.doSequence(PSequence)] */ && arg1Value instanceof PSequence) {
PSequence arg1Value_ = (PSequence) arg1Value;
return PyMappingCheckNode.doSequence(arg1Value_);
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PyMappingCheckNode.doArray(PArray)] */ && arg1Value instanceof PArray) {
PArray arg1Value_ = (PArray) arg1Value;
return PyMappingCheckNode.doArray(arg1Value_);
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[PyMappingCheckNode.doMemoryView(PMemoryView)] */ && arg1Value instanceof PMemoryView) {
PMemoryView arg1Value_ = (PMemoryView) arg1Value;
return PyMappingCheckNode.doMemoryView(arg1Value_);
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[PyMappingCheckNode.doMappingproxy(PMappingproxy)] */ && arg1Value instanceof PMappingproxy) {
PMappingproxy arg1Value_ = (PMappingproxy) arg1Value;
return PyMappingCheckNode.doMappingproxy(arg1Value_);
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[PyMappingCheckNode.doRange(PRange)] */ && arg1Value instanceof PRange) {
PRange arg1Value_ = (PRange) arg1Value;
return PyMappingCheckNode.doRange(arg1Value_);
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[PyMappingCheckNode.doDeque(PDeque)] */ && arg1Value instanceof PDeque) {
PDeque arg1Value_ = (PDeque) arg1Value;
return PyMappingCheckNode.doDeque(arg1Value_);
}
if ((state_0 & 0b100000000) != 0 /* is SpecializationActive[PyMappingCheckNode.doSet(PBaseSet)] */ && arg1Value instanceof PBaseSet) {
PBaseSet arg1Value_ = (PBaseSet) arg1Value;
return PyMappingCheckNode.doSet(arg1Value_);
}
if ((state_0 & 0b1000000000) != 0 /* is SpecializationActive[PyMappingCheckNode.doPythonObject(Node, PythonObject, GetClassNode, LookupCallableSlotInMRONode)] */ && arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
{
LookupCallableSlotInMRONode lookupGetItem_ = this.lookupGetItem.get(arg0Value);
if (lookupGetItem_ != null) {
if ((!(PyMappingCheckNode.isKnownMapping(arg1Value_))) && (!(PyMappingCheckNode.cannotBeMapping(arg1Value_)))) {
return PyMappingCheckNode.doPythonObject(arg0Value, arg1Value_, this.getClass, lookupGetItem_);
}
}
}
}
if ((state_0 & 0b10000000000) != 0 /* is SpecializationActive[PyMappingCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, InteropLibrary)] */) {
{
LookupCallableSlotInMRONode lookupGetItem_1 = this.lookupGetItem.get(arg0Value);
if (lookupGetItem_1 != null) {
InteropLibrary lib__ = this.generic_lib_.get(arg0Value);
if (lib__ != null) {
if ((!(PyMappingCheckNode.isKnownMapping(arg1Value))) && (!(PyMappingCheckNode.cannotBeMapping(arg1Value)))) {
return PyMappingCheckNode.doGeneric(arg0Value, arg1Value, this.getClass, lookupGetItem_1, lib__);
}
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private boolean executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[PyMappingCheckNode.doDict(PDict)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doDict(arg1Value_);
}
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[PyMappingCheckNode.doString(TruffleString)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doString(arg1Value_);
}
if (arg1Value instanceof PSequence) {
PSequence arg1Value_ = (PSequence) arg1Value;
state_0 = state_0 | 0b100 /* add SpecializationActive[PyMappingCheckNode.doSequence(PSequence)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doSequence(arg1Value_);
}
if (arg1Value instanceof PArray) {
PArray arg1Value_ = (PArray) arg1Value;
state_0 = state_0 | 0b1000 /* add SpecializationActive[PyMappingCheckNode.doArray(PArray)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doArray(arg1Value_);
}
if (arg1Value instanceof PMemoryView) {
PMemoryView arg1Value_ = (PMemoryView) arg1Value;
state_0 = state_0 | 0b10000 /* add SpecializationActive[PyMappingCheckNode.doMemoryView(PMemoryView)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doMemoryView(arg1Value_);
}
if (arg1Value instanceof PMappingproxy) {
PMappingproxy arg1Value_ = (PMappingproxy) arg1Value;
state_0 = state_0 | 0b100000 /* add SpecializationActive[PyMappingCheckNode.doMappingproxy(PMappingproxy)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doMappingproxy(arg1Value_);
}
if (arg1Value instanceof PRange) {
PRange arg1Value_ = (PRange) arg1Value;
state_0 = state_0 | 0b1000000 /* add SpecializationActive[PyMappingCheckNode.doRange(PRange)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doRange(arg1Value_);
}
if (arg1Value instanceof PDeque) {
PDeque arg1Value_ = (PDeque) arg1Value;
state_0 = state_0 | 0b10000000 /* add SpecializationActive[PyMappingCheckNode.doDeque(PDeque)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doDeque(arg1Value_);
}
if (arg1Value instanceof PBaseSet) {
PBaseSet arg1Value_ = (PBaseSet) arg1Value;
state_0 = state_0 | 0b100000000 /* add SpecializationActive[PyMappingCheckNode.doSet(PBaseSet)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doSet(arg1Value_);
}
if (((state_0 & 0b10000000000)) == 0 /* is-not SpecializationActive[PyMappingCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, InteropLibrary)] */ && arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
if ((!(PyMappingCheckNode.isKnownMapping(arg1Value_))) && (!(PyMappingCheckNode.cannotBeMapping(arg1Value_)))) {
LookupCallableSlotInMRONode lookupGetItem_;
LookupCallableSlotInMRONode lookupGetItem__shared = this.lookupGetItem.get(arg0Value);
if (lookupGetItem__shared != null) {
lookupGetItem_ = lookupGetItem__shared;
} else {
lookupGetItem_ = arg0Value.insert((LookupCallableSlotInMRONode.create(SpecialMethodSlot.GetItem)));
if (lookupGetItem_ == null) {
throw new IllegalStateException("Specialization 'doPythonObject(Node, PythonObject, GetClassNode, LookupCallableSlotInMRONode)' contains a shared cache with name 'lookupGetItem' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.lookupGetItem.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.lookupGetItem.set(arg0Value, lookupGetItem_);
}
state_0 = state_0 | 0b1000000000 /* add SpecializationActive[PyMappingCheckNode.doPythonObject(Node, PythonObject, GetClassNode, LookupCallableSlotInMRONode)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doPythonObject(arg0Value, arg1Value_, this.getClass, lookupGetItem_);
}
}
if ((!(PyMappingCheckNode.isKnownMapping(arg1Value))) && (!(PyMappingCheckNode.cannotBeMapping(arg1Value)))) {
LookupCallableSlotInMRONode lookupGetItem_1;
LookupCallableSlotInMRONode lookupGetItem_1_shared = this.lookupGetItem.get(arg0Value);
if (lookupGetItem_1_shared != null) {
lookupGetItem_1 = lookupGetItem_1_shared;
} else {
lookupGetItem_1 = arg0Value.insert((LookupCallableSlotInMRONode.create(SpecialMethodSlot.GetItem)));
if (lookupGetItem_1 == null) {
throw new IllegalStateException("Specialization 'doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, InteropLibrary)' contains a shared cache with name 'lookupGetItem' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.lookupGetItem.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.lookupGetItem.set(arg0Value, lookupGetItem_1);
}
InteropLibrary lib__ = arg0Value.insert((INTEROP_LIBRARY_.createDispatched(3)));
Objects.requireNonNull(lib__, "Specialization 'doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, 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.generic_lib_.set(arg0Value, lib__);
state_0 = state_0 & 0xfffffdff /* remove SpecializationActive[PyMappingCheckNode.doPythonObject(Node, PythonObject, GetClassNode, LookupCallableSlotInMRONode)] */;
state_0 = state_0 | 0b10000000000 /* add SpecializationActive[PyMappingCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, InteropLibrary)] */;
this.state_0_.set(arg0Value, state_0);
return PyMappingCheckNode.doGeneric(arg0Value, arg1Value, this.getClass, lookupGetItem_1, lib__);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PyMappingCheckNode.class)
@DenyReplace
private static final class Uncached extends PyMappingCheckNode {
@TruffleBoundary
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return PyMappingCheckNode.doDict(arg1Value_);
}
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return PyMappingCheckNode.doString(arg1Value_);
}
if (arg1Value instanceof PSequence) {
PSequence arg1Value_ = (PSequence) arg1Value;
return PyMappingCheckNode.doSequence(arg1Value_);
}
if (arg1Value instanceof PArray) {
PArray arg1Value_ = (PArray) arg1Value;
return PyMappingCheckNode.doArray(arg1Value_);
}
if (arg1Value instanceof PMemoryView) {
PMemoryView arg1Value_ = (PMemoryView) arg1Value;
return PyMappingCheckNode.doMemoryView(arg1Value_);
}
if (arg1Value instanceof PMappingproxy) {
PMappingproxy arg1Value_ = (PMappingproxy) arg1Value;
return PyMappingCheckNode.doMappingproxy(arg1Value_);
}
if (arg1Value instanceof PRange) {
PRange arg1Value_ = (PRange) arg1Value;
return PyMappingCheckNode.doRange(arg1Value_);
}
if (arg1Value instanceof PDeque) {
PDeque arg1Value_ = (PDeque) arg1Value;
return PyMappingCheckNode.doDeque(arg1Value_);
}
if (arg1Value instanceof PBaseSet) {
PBaseSet arg1Value_ = (PBaseSet) arg1Value;
return PyMappingCheckNode.doSet(arg1Value_);
}
if ((!(PyMappingCheckNode.isKnownMapping(arg1Value))) && (!(PyMappingCheckNode.cannotBeMapping(arg1Value)))) {
return PyMappingCheckNode.doGeneric(arg0Value, arg1Value, (GetClassNode.getUncached()), (LookupCallableSlotInMRONode.getUncached(SpecialMethodSlot.GetItem)), (INTEROP_LIBRARY_.getUncached()));
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy