com.oracle.graal.python.lib.PySequenceCheckNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.objects.cext.PythonAbstractNativeObject;
import com.oracle.graal.python.builtins.objects.cext.capi.CExtNodes.PCallCapiFunction;
import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitions.PythonToNativeNode;
import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitionsFactory.PythonToNativeNodeGen;
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.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.nodes.util.LazyInteropLibrary;
import com.oracle.graal.python.nodes.util.LazyInteropLibraryNodeGen;
import com.oracle.graal.python.runtime.sequence.PSequence;
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.NeverDefault;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
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.dsl.InlineSupport.UnsafeAccessedField;
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.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link PySequenceCheckNode#doSequence}
* Activation probability: 0.27381
* With/without class size: 7/0 bytes
* Specialization {@link PySequenceCheckNode#doString}
* Activation probability: 0.23095
* With/without class size: 6/0 bytes
* Specialization {@link PySequenceCheckNode#doDict}
* Activation probability: 0.18810
* With/without class size: 6/0 bytes
* Specialization {@link PySequenceCheckNode#doMappingproxy}
* Activation probability: 0.14524
* With/without class size: 5/0 bytes
* Specialization {@link PySequenceCheckNode#doNative}
* Activation probability: 0.10238
* With/without class size: 6/8 bytes
* Specialization {@link PySequenceCheckNode#doGeneric}
* Activation probability: 0.05952
* With/without class size: 5/15 bytes
*
*/
@GeneratedBy(PySequenceCheckNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class PySequenceCheckNodeGen {
private static final StateField FALLBACK__PY_SEQUENCE_CHECK_NODE_FALLBACK_STATE_0_UPDATER = StateField.create(FallbackData.lookup_(), "fallback_state_0_");
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static PySequenceCheckNode getUncached() {
return PySequenceCheckNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#native_cache}
*
- {@link Inlined#fallback_cache}
*
*/
@NeverDefault
public static PySequenceCheckNode inline(@RequiredField(bits = 6, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PySequenceCheckNodeGen.Inlined(target);
}
@GeneratedBy(PySequenceCheckNode.class)
@DenyReplace
private static final class Inlined extends PySequenceCheckNode {
/**
* State Info:
* 0: SpecializationActive {@link PySequenceCheckNode#doSequence}
* 1: SpecializationActive {@link PySequenceCheckNode#doString}
* 2: SpecializationActive {@link PySequenceCheckNode#doDict}
* 3: SpecializationActive {@link PySequenceCheckNode#doMappingproxy}
* 4: SpecializationActive {@link PySequenceCheckNode#doNative}
* 5: SpecializationActive {@link PySequenceCheckNode#doGeneric}
*
*/
private final StateField state_0_;
private final ReferenceField native_cache;
private final ReferenceField fallback_cache;
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private final GetClassNode fallback_getClassNode_;
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link LazyInteropLibrary} lazyLib
* Inline method: {@link LazyInteropLibraryNodeGen#inline}
*/
private final LazyInteropLibrary fallback_lazyLib_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PySequenceCheckNode.class);
this.state_0_ = target.getState(0, 6);
this.native_cache = target.getReference(1, NativeData.class);
this.fallback_cache = target.getReference(2, FallbackData.class);
this.fallback_getClassNode_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, FALLBACK__PY_SEQUENCE_CHECK_NODE_FALLBACK_STATE_0_UPDATER.subUpdater(0, 17), ReferenceField.create(FallbackData.lookup_(), "fallback_getClassNode__field1_", Node.class)));
this.fallback_lazyLib_ = LazyInteropLibraryNodeGen.inline(InlineTarget.create(LazyInteropLibrary.class, FALLBACK__PY_SEQUENCE_CHECK_NODE_FALLBACK_STATE_0_UPDATER.subUpdater(17, 1), ReferenceField.create(FallbackData.lookup_(), "fallback_lazyLib__field1_", Node.class)));
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) {
if (!((state_0 & 0b1) != 0 /* is SpecializationActive[PySequenceCheckNode.doSequence(PSequence)] */) && arg1Value instanceof PSequence) {
return false;
}
if (!((state_0 & 0b10) != 0 /* is SpecializationActive[PySequenceCheckNode.doString(TruffleString)] */) && arg1Value instanceof TruffleString) {
return false;
}
if (!((state_0 & 0b100) != 0 /* is SpecializationActive[PySequenceCheckNode.doDict(PDict)] */) && arg1Value instanceof PDict) {
return false;
}
if (!((state_0 & 0b1000) != 0 /* is SpecializationActive[PySequenceCheckNode.doMappingproxy(PMappingproxy)] */) && arg1Value instanceof PMappingproxy) {
return false;
}
if (!((state_0 & 0b10000) != 0 /* is SpecializationActive[PySequenceCheckNode.doNative(PythonAbstractNativeObject, PythonToNativeNode, PCallCapiFunction)] */) && arg1Value instanceof PythonAbstractNativeObject) {
return false;
}
return true;
}
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[PySequenceCheckNode.doSequence(PSequence)] || SpecializationActive[PySequenceCheckNode.doString(TruffleString)] || SpecializationActive[PySequenceCheckNode.doDict(PDict)] || SpecializationActive[PySequenceCheckNode.doMappingproxy(PMappingproxy)] || SpecializationActive[PySequenceCheckNode.doNative(PythonAbstractNativeObject, PythonToNativeNode, PCallCapiFunction)] || SpecializationActive[PySequenceCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, LazyInteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PySequenceCheckNode.doSequence(PSequence)] */ && arg1Value instanceof PSequence) {
PSequence arg1Value_ = (PSequence) arg1Value;
return PySequenceCheckNode.doSequence(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PySequenceCheckNode.doString(TruffleString)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return PySequenceCheckNode.doString(arg1Value_);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PySequenceCheckNode.doDict(PDict)] */ && arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return PySequenceCheckNode.doDict(arg1Value_);
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PySequenceCheckNode.doMappingproxy(PMappingproxy)] */ && arg1Value instanceof PMappingproxy) {
PMappingproxy arg1Value_ = (PMappingproxy) arg1Value;
return PySequenceCheckNode.doMappingproxy(arg1Value_);
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[PySequenceCheckNode.doNative(PythonAbstractNativeObject, PythonToNativeNode, PCallCapiFunction)] */ && arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
NativeData s4_ = this.native_cache.get(arg0Value);
if (s4_ != null) {
return PySequenceCheckNode.doNative(arg1Value_, s4_.toSulongNode_, s4_.callCapiFunction_);
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[PySequenceCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, LazyInteropLibrary)] */) {
FallbackData s5_ = this.fallback_cache.get(arg0Value);
if (s5_ != null) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return PySequenceCheckNode.doGeneric(s5_, arg1Value, this.fallback_getClassNode_, s5_.lookupGetItem_, this.fallback_lazyLib_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private boolean executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof PSequence) {
PSequence arg1Value_ = (PSequence) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[PySequenceCheckNode.doSequence(PSequence)] */;
this.state_0_.set(arg0Value, state_0);
return PySequenceCheckNode.doSequence(arg1Value_);
}
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[PySequenceCheckNode.doString(TruffleString)] */;
this.state_0_.set(arg0Value, state_0);
return PySequenceCheckNode.doString(arg1Value_);
}
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
state_0 = state_0 | 0b100 /* add SpecializationActive[PySequenceCheckNode.doDict(PDict)] */;
this.state_0_.set(arg0Value, state_0);
return PySequenceCheckNode.doDict(arg1Value_);
}
if (arg1Value instanceof PMappingproxy) {
PMappingproxy arg1Value_ = (PMappingproxy) arg1Value;
state_0 = state_0 | 0b1000 /* add SpecializationActive[PySequenceCheckNode.doMappingproxy(PMappingproxy)] */;
this.state_0_.set(arg0Value, state_0);
return PySequenceCheckNode.doMappingproxy(arg1Value_);
}
if (arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
NativeData s4_ = arg0Value.insert(new NativeData());
PythonToNativeNode toSulongNode__ = s4_.insert((PythonToNativeNodeGen.create()));
Objects.requireNonNull(toSulongNode__, "Specialization 'doNative(PythonAbstractNativeObject, PythonToNativeNode, PCallCapiFunction)' cache 'toSulongNode' 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'.");
s4_.toSulongNode_ = toSulongNode__;
PCallCapiFunction callCapiFunction__ = s4_.insert((PCallCapiFunction.create()));
Objects.requireNonNull(callCapiFunction__, "Specialization 'doNative(PythonAbstractNativeObject, PythonToNativeNode, PCallCapiFunction)' cache 'callCapiFunction' 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'.");
s4_.callCapiFunction_ = callCapiFunction__;
VarHandle.storeStoreFence();
this.native_cache.set(arg0Value, s4_);
state_0 = state_0 | 0b10000 /* add SpecializationActive[PySequenceCheckNode.doNative(PythonAbstractNativeObject, PythonToNativeNode, PCallCapiFunction)] */;
this.state_0_.set(arg0Value, state_0);
return PySequenceCheckNode.doNative(arg1Value_, toSulongNode__, callCapiFunction__);
}
FallbackData s5_ = arg0Value.insert(new FallbackData());
LookupCallableSlotInMRONode lookupGetItem__ = s5_.insert((LookupCallableSlotInMRONode.create(SpecialMethodSlot.GetItem)));
Objects.requireNonNull(lookupGetItem__, "Specialization 'doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, LazyInteropLibrary)' cache 'lookupGetItem' 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'.");
s5_.lookupGetItem_ = lookupGetItem__;
VarHandle.storeStoreFence();
this.fallback_cache.set(arg0Value, s5_);
state_0 = state_0 | 0b100000 /* add SpecializationActive[PySequenceCheckNode.doGeneric(Node, Object, GetClassNode, LookupCallableSlotInMRONode, LazyInteropLibrary)] */;
this.state_0_.set(arg0Value, state_0);
return PySequenceCheckNode.doGeneric(s5_, arg1Value, this.fallback_getClassNode_, lookupGetItem__, this.fallback_lazyLib_);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PySequenceCheckNode.class)
@DenyReplace
private static final class NativeData extends Node implements SpecializationDataNode {
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doNative}
* Parameter: {@link PythonToNativeNode} toSulongNode
*/
@Child PythonToNativeNode toSulongNode_;
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doNative}
* Parameter: {@link PCallCapiFunction} callCapiFunction
*/
@Child PCallCapiFunction callCapiFunction_;
NativeData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(PySequenceCheckNode.class)
@DenyReplace
private static final class FallbackData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-16: InlinedCache
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* 17: InlinedCache
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link LazyInteropLibrary} lazyLib
* Inline method: {@link LazyInteropLibraryNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int fallback_state_0_;
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node fallback_getClassNode__field1_;
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link LookupCallableSlotInMRONode} lookupGetItem
*/
@Child LookupCallableSlotInMRONode lookupGetItem_;
/**
* Source Info:
* Specialization: {@link PySequenceCheckNode#doGeneric}
* Parameter: {@link LazyInteropLibrary} lazyLib
* Inline method: {@link LazyInteropLibraryNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node fallback_lazyLib__field1_;
FallbackData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(PySequenceCheckNode.class)
@DenyReplace
private static final class Uncached extends PySequenceCheckNode {
@TruffleBoundary
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof PSequence) {
PSequence arg1Value_ = (PSequence) arg1Value;
return PySequenceCheckNode.doSequence(arg1Value_);
}
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return PySequenceCheckNode.doString(arg1Value_);
}
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return PySequenceCheckNode.doDict(arg1Value_);
}
if (arg1Value instanceof PMappingproxy) {
PMappingproxy arg1Value_ = (PMappingproxy) arg1Value;
return PySequenceCheckNode.doMappingproxy(arg1Value_);
}
if (arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
return PySequenceCheckNode.doNative(arg1Value_, (PythonToNativeNodeGen.getUncached()), (PCallCapiFunction.getUncached()));
}
return PySequenceCheckNode.doGeneric(arg0Value, arg1Value, (GetClassNode.getUncached()), (LookupCallableSlotInMRONode.getUncached(SpecialMethodSlot.GetItem)), (LazyInteropLibraryNodeGen.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy