com.oracle.graal.python.lib.PyIterNextNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.objects.iterator.PBigRangeIterator;
import com.oracle.graal.python.builtins.objects.iterator.PIntRangeIterator;
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
import com.oracle.graal.python.nodes.PRaiseNode.Lazy;
import com.oracle.graal.python.nodes.PRaiseNodeGen.LazyNodeGen;
import com.oracle.graal.python.nodes.call.special.CallUnaryMethodNode;
import com.oracle.graal.python.nodes.call.special.LookupSpecialMethodSlotNode;
import com.oracle.graal.python.nodes.object.GetClassNode;
import com.oracle.graal.python.nodes.object.GetClassNodeGen;
import com.oracle.graal.python.nodes.object.BuiltinClassProfiles.IsBuiltinObjectProfile;
import com.oracle.graal.python.nodes.object.BuiltinClassProfilesFactory.IsBuiltinObjectProfileNodeGen;
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
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.StateField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link PyIterNextNode#doIntRange}
* Activation probability: 0.48333
* With/without class size: 9/0 bytes
* Specialization {@link PyIterNextNode#doBigIntRange}
* Activation probability: 0.33333
* With/without class size: 10/4 bytes
* Specialization {@link PyIterNextNode#doGeneric}
* Activation probability: 0.18333
* With/without class size: 12/25 bytes
*
*/
@GeneratedBy(PyIterNextNode.class)
@SuppressWarnings("javadoc")
public final class PyIterNextNodeGen extends PyIterNextNode {
private static final StateField GENERIC__PY_ITER_NEXT_NODE_GENERIC_STATE_0_UPDATER = StateField.create(GenericData.lookup_(), "generic_state_0_");
private static final StateField GENERIC__PY_ITER_NEXT_NODE_GENERIC_STATE_1_UPDATER = StateField.create(GenericData.lookup_(), "generic_state_1_");
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private static final GetClassNode INLINED_GENERIC_GET_CLASS_NODE_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, GENERIC__PY_ITER_NEXT_NODE_GENERIC_STATE_0_UPDATER.subUpdater(0, 17), ReferenceField.create(GenericData.lookup_(), "generic_getClassNode__field1_", Node.class)));
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link IsBuiltinObjectProfile} stopIterationProfile
* Inline method: {@link IsBuiltinObjectProfileNodeGen#inline}
*/
private static final IsBuiltinObjectProfile INLINED_GENERIC_STOP_ITERATION_PROFILE_ = IsBuiltinObjectProfileNodeGen.inline(InlineTarget.create(IsBuiltinObjectProfile.class, GENERIC__PY_ITER_NEXT_NODE_GENERIC_STATE_1_UPDATER.subUpdater(0, 20), ReferenceField.create(GenericData.lookup_(), "generic_stopIterationProfile__field1_", Node.class)));
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private static final Lazy INLINED_GENERIC_RAISE_NODE_ = LazyNodeGen.inline(InlineTarget.create(Lazy.class, GENERIC__PY_ITER_NEXT_NODE_GENERIC_STATE_0_UPDATER.subUpdater(17, 1), ReferenceField.create(GenericData.lookup_(), "generic_raiseNode__field1_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link PyIterNextNode#doIntRange}
* 1: SpecializationActive {@link PyIterNextNode#doBigIntRange}
* 2: SpecializationActive {@link PyIterNextNode#doGeneric}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doBigIntRange}
* Parameter: {@link PythonObjectFactory} factory
*/
@Child private PythonObjectFactory bigIntRange_factory_;
@Child private GenericData generic_cache;
private PyIterNextNodeGen() {
}
@Override
public Object execute(Frame frameValue, Object arg0Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[PyIterNextNode.doIntRange(PIntRangeIterator)] || SpecializationActive[PyIterNextNode.doBigIntRange(PBigRangeIterator, PythonObjectFactory)] || SpecializationActive[PyIterNextNode.doGeneric(VirtualFrame, Object, Node, GetClassNode, LookupSpecialMethodSlotNode, CallUnaryMethodNode, IsBuiltinObjectProfile, Lazy)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyIterNextNode.doIntRange(PIntRangeIterator)] */ && arg0Value instanceof PIntRangeIterator) {
PIntRangeIterator arg0Value_ = (PIntRangeIterator) arg0Value;
return doIntRange(arg0Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyIterNextNode.doBigIntRange(PBigRangeIterator, PythonObjectFactory)] */ && arg0Value instanceof PBigRangeIterator) {
PBigRangeIterator arg0Value_ = (PBigRangeIterator) arg0Value;
{
PythonObjectFactory factory__ = this.bigIntRange_factory_;
if (factory__ != null) {
return doBigIntRange(arg0Value_, factory__);
}
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PyIterNextNode.doGeneric(VirtualFrame, Object, Node, GetClassNode, LookupSpecialMethodSlotNode, CallUnaryMethodNode, IsBuiltinObjectProfile, Lazy)] */) {
GenericData s2_ = this.generic_cache;
if (s2_ != null) {
{
Node inliningTarget__ = (s2_);
return PyIterNextNode.doGeneric((VirtualFrame) frameValue, arg0Value, inliningTarget__, INLINED_GENERIC_GET_CLASS_NODE_, s2_.lookupNext_, s2_.callNext_, INLINED_GENERIC_STOP_ITERATION_PROFILE_, INLINED_GENERIC_RAISE_NODE_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value);
}
private Object executeAndSpecialize(Frame frameValue, Object arg0Value) {
int state_0 = this.state_0_;
if (arg0Value instanceof PIntRangeIterator) {
PIntRangeIterator arg0Value_ = (PIntRangeIterator) arg0Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[PyIterNextNode.doIntRange(PIntRangeIterator)] */;
this.state_0_ = state_0;
return doIntRange(arg0Value_);
}
if (arg0Value instanceof PBigRangeIterator) {
PBigRangeIterator arg0Value_ = (PBigRangeIterator) arg0Value;
PythonObjectFactory factory__ = this.insert((PythonObjectFactory.create()));
Objects.requireNonNull(factory__, "Specialization 'doBigIntRange(PBigRangeIterator, PythonObjectFactory)' cache 'factory' 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.bigIntRange_factory_ = factory__;
state_0 = state_0 | 0b10 /* add SpecializationActive[PyIterNextNode.doBigIntRange(PBigRangeIterator, PythonObjectFactory)] */;
this.state_0_ = state_0;
return doBigIntRange(arg0Value_, factory__);
}
{
Node inliningTarget__ = null;
GenericData s2_ = this.insert(new GenericData());
inliningTarget__ = (s2_);
LookupSpecialMethodSlotNode lookupNext__ = s2_.insert((LookupSpecialMethodSlotNode.create(SpecialMethodSlot.Next)));
Objects.requireNonNull(lookupNext__, "Specialization 'doGeneric(VirtualFrame, Object, Node, GetClassNode, LookupSpecialMethodSlotNode, CallUnaryMethodNode, IsBuiltinObjectProfile, Lazy)' cache 'lookupNext' 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'.");
s2_.lookupNext_ = lookupNext__;
CallUnaryMethodNode callNext__ = s2_.insert((CallUnaryMethodNode.create()));
Objects.requireNonNull(callNext__, "Specialization 'doGeneric(VirtualFrame, Object, Node, GetClassNode, LookupSpecialMethodSlotNode, CallUnaryMethodNode, IsBuiltinObjectProfile, Lazy)' cache 'callNext' 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'.");
s2_.callNext_ = callNext__;
VarHandle.storeStoreFence();
this.generic_cache = s2_;
state_0 = state_0 | 0b100 /* add SpecializationActive[PyIterNextNode.doGeneric(VirtualFrame, Object, Node, GetClassNode, LookupSpecialMethodSlotNode, CallUnaryMethodNode, IsBuiltinObjectProfile, Lazy)] */;
this.state_0_ = state_0;
return PyIterNextNode.doGeneric((VirtualFrame) frameValue, arg0Value, inliningTarget__, INLINED_GENERIC_GET_CLASS_NODE_, lookupNext__, callNext__, INLINED_GENERIC_STOP_ITERATION_PROFILE_, INLINED_GENERIC_RAISE_NODE_);
}
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if (state_0 == 0) {
return NodeCost.UNINITIALIZED;
} else {
if ((state_0 & (state_0 - 1)) == 0 /* is-single */) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static PyIterNextNode create() {
return new PyIterNextNodeGen();
}
@NeverDefault
public static PyIterNextNode getUncached() {
return PyIterNextNodeGen.UNCACHED;
}
@GeneratedBy(PyIterNextNode.class)
@DenyReplace
private static final class GenericData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-16: InlinedCache
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* 17: InlinedCache
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int generic_state_0_;
/**
* State Info:
* 0-19: InlinedCache
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link IsBuiltinObjectProfile} stopIterationProfile
* Inline method: {@link IsBuiltinObjectProfileNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int generic_state_1_;
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_getClassNode__field1_;
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link LookupSpecialMethodSlotNode} lookupNext
*/
@Child LookupSpecialMethodSlotNode lookupNext_;
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link CallUnaryMethodNode} callNext
*/
@Child CallUnaryMethodNode callNext_;
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link IsBuiltinObjectProfile} stopIterationProfile
* Inline method: {@link IsBuiltinObjectProfileNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_stopIterationProfile__field1_;
/**
* Source Info:
* Specialization: {@link PyIterNextNode#doGeneric}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_raiseNode__field1_;
GenericData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(PyIterNextNode.class)
@DenyReplace
private static final class Uncached extends PyIterNextNode {
@Override
public Object execute(Frame frameValue, Object arg0Value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
if (arg0Value instanceof PIntRangeIterator) {
PIntRangeIterator arg0Value_ = (PIntRangeIterator) arg0Value;
return doIntRange(arg0Value_);
}
if (arg0Value instanceof PBigRangeIterator) {
PBigRangeIterator arg0Value_ = (PBigRangeIterator) arg0Value;
return doBigIntRange(arg0Value_, (PythonObjectFactory.getUncached()));
}
return PyIterNextNode.doGeneric((VirtualFrame) frameValue, arg0Value, (this), (GetClassNode.getUncached()), (LookupSpecialMethodSlotNode.getUncached(SpecialMethodSlot.Next)), (CallUnaryMethodNode.getUncached()), (IsBuiltinObjectProfile.getUncached()), (Lazy.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy