com.oracle.graal.python.lib.PyObjectSetItemNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.objects.list.PList;
import com.oracle.graal.python.builtins.objects.list.ListBuiltins.SetItemNode;
import com.oracle.graal.python.builtins.objects.list.ListBuiltinsFactory.SetItemNodeFactory;
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
import com.oracle.graal.python.nodes.PGuards;
import com.oracle.graal.python.nodes.PRaiseNode.Lazy;
import com.oracle.graal.python.nodes.PRaiseNodeGen.LazyNodeGen;
import com.oracle.graal.python.nodes.call.special.CallTernaryMethodNode;
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.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.RequiredField;
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 PyObjectSetItem#doList}
* Activation probability: 0.65000
* With/without class size: 17/4 bytes
* Specialization {@link PyObjectSetItem#doWithFrame}
* Activation probability: 0.35000
* With/without class size: 16/19 bytes
*
*/
@GeneratedBy(PyObjectSetItem.class)
@SuppressWarnings({"javadoc", "unused"})
public final class PyObjectSetItemNodeGen extends PyObjectSetItem {
private static final StateField WITH_FRAME__PY_OBJECT_SET_ITEM_WITH_FRAME_STATE_0_UPDATER = StateField.create(WithFrameData.lookup_(), "withFrame_state_0_");
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private static final GetClassNode INLINED_WITH_FRAME_GET_CLASS_NODE_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, WITH_FRAME__PY_OBJECT_SET_ITEM_WITH_FRAME_STATE_0_UPDATER.subUpdater(0, 17), ReferenceField.create(WithFrameData.lookup_(), "withFrame_getClassNode__field1_", Node.class)));
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link Lazy} raise
* Inline method: {@link LazyNodeGen#inline}
*/
private static final Lazy INLINED_WITH_FRAME_RAISE_ = LazyNodeGen.inline(InlineTarget.create(Lazy.class, WITH_FRAME__PY_OBJECT_SET_ITEM_WITH_FRAME_STATE_0_UPDATER.subUpdater(17, 1), ReferenceField.create(WithFrameData.lookup_(), "withFrame_raise__field1_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link PyObjectSetItem#doList}
* 1: SpecializationActive {@link PyObjectSetItem#doWithFrame}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doList}
* Parameter: {@link SetItemNode} setItemNode
*/
@Child private SetItemNode list_setItemNode_;
@Child private WithFrameData withFrame_cache;
private PyObjectSetItemNodeGen() {
}
@Override
public void execute(Frame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] || SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] */ && arg1Value instanceof PList) {
PList arg1Value_ = (PList) arg1Value;
{
SetItemNode setItemNode__ = this.list_setItemNode_;
if (setItemNode__ != null) {
if ((PGuards.cannotBeOverriddenForImmutableType(arg1Value_))) {
PyObjectSetItem.doList((VirtualFrame) frameValue, arg1Value_, arg2Value, arg3Value, setItemNode__);
return;
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */) {
WithFrameData s1_ = this.withFrame_cache;
if (s1_ != null) {
PyObjectSetItem.doWithFrame(frameValue, s1_, arg1Value, arg2Value, arg3Value, INLINED_WITH_FRAME_GET_CLASS_NODE_, s1_.lookupSetitem_, INLINED_WITH_FRAME_RAISE_, s1_.callSetitem_);
return;
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
executeAndSpecialize(frameValue, arg0Value, arg1Value, arg2Value, arg3Value);
return;
}
private void executeAndSpecialize(Frame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state_0 = this.state_0_;
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */ && arg1Value instanceof PList) {
PList arg1Value_ = (PList) arg1Value;
if ((PGuards.cannotBeOverriddenForImmutableType(arg1Value_))) {
SetItemNode setItemNode__ = this.insert((SetItemNodeFactory.create()));
Objects.requireNonNull(setItemNode__, "Specialization 'doList(VirtualFrame, PList, Object, Object, SetItemNode)' cache 'setItemNode' 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.list_setItemNode_ = setItemNode__;
state_0 = state_0 | 0b1 /* add SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] */;
this.state_0_ = state_0;
PyObjectSetItem.doList((VirtualFrame) frameValue, arg1Value_, arg2Value, arg3Value, setItemNode__);
return;
}
}
WithFrameData s1_ = this.insert(new WithFrameData());
LookupSpecialMethodSlotNode lookupSetitem__ = s1_.insert((LookupSpecialMethodSlotNode.create(SpecialMethodSlot.SetItem)));
Objects.requireNonNull(lookupSetitem__, "Specialization 'doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)' cache 'lookupSetitem' 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'.");
s1_.lookupSetitem_ = lookupSetitem__;
CallTernaryMethodNode callSetitem__ = s1_.insert((CallTernaryMethodNode.create()));
Objects.requireNonNull(callSetitem__, "Specialization 'doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)' cache 'callSetitem' 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'.");
s1_.callSetitem_ = callSetitem__;
VarHandle.storeStoreFence();
this.withFrame_cache = s1_;
this.list_setItemNode_ = null;
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */;
this.state_0_ = state_0;
PyObjectSetItem.doWithFrame(frameValue, s1_, arg1Value, arg2Value, arg3Value, INLINED_WITH_FRAME_GET_CLASS_NODE_, lookupSetitem__, INLINED_WITH_FRAME_RAISE_, callSetitem__);
return;
}
@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 PyObjectSetItem create() {
return new PyObjectSetItemNodeGen();
}
@NeverDefault
public static PyObjectSetItem getUncached() {
return PyObjectSetItemNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#list_setItemNode_}
*
- {@link Inlined#withFrame_cache}
*
*/
@NeverDefault
public static PyObjectSetItem inline(@RequiredField(bits = 2, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PyObjectSetItemNodeGen.Inlined(target);
}
@GeneratedBy(PyObjectSetItem.class)
@DenyReplace
private static final class Inlined extends PyObjectSetItem {
/**
* State Info:
* 0: SpecializationActive {@link PyObjectSetItem#doList}
* 1: SpecializationActive {@link PyObjectSetItem#doWithFrame}
*
*/
private final StateField state_0_;
private final ReferenceField list_setItemNode_;
private final ReferenceField withFrame_cache;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private final GetClassNode withFrame_getClassNode_;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link Lazy} raise
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy withFrame_raise_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PyObjectSetItem.class);
this.state_0_ = target.getState(0, 2);
this.list_setItemNode_ = target.getReference(1, SetItemNode.class);
this.withFrame_cache = target.getReference(2, WithFrameData.class);
this.withFrame_getClassNode_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, WITH_FRAME__PY_OBJECT_SET_ITEM_WITH_FRAME_STATE_0_UPDATER.subUpdater(0, 17), ReferenceField.create(WithFrameData.lookup_(), "withFrame_getClassNode__field1_", Node.class)));
this.withFrame_raise_ = LazyNodeGen.inline(InlineTarget.create(Lazy.class, WITH_FRAME__PY_OBJECT_SET_ITEM_WITH_FRAME_STATE_0_UPDATER.subUpdater(17, 1), ReferenceField.create(WithFrameData.lookup_(), "withFrame_raise__field1_", Node.class)));
}
@Override
public void execute(Frame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] || SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] */ && arg1Value instanceof PList) {
PList arg1Value_ = (PList) arg1Value;
{
SetItemNode setItemNode__ = this.list_setItemNode_.get(arg0Value);
if (setItemNode__ != null) {
if ((PGuards.cannotBeOverriddenForImmutableType(arg1Value_))) {
PyObjectSetItem.doList((VirtualFrame) frameValue, arg1Value_, arg2Value, arg3Value, setItemNode__);
return;
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */) {
WithFrameData s1_ = this.withFrame_cache.get(arg0Value);
if (s1_ != null) {
PyObjectSetItem.doWithFrame(frameValue, s1_, arg1Value, arg2Value, arg3Value, this.withFrame_getClassNode_, s1_.lookupSetitem_, this.withFrame_raise_, s1_.callSetitem_);
return;
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
executeAndSpecialize(frameValue, arg0Value, arg1Value, arg2Value, arg3Value);
return;
}
private void executeAndSpecialize(Frame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */ && arg1Value instanceof PList) {
PList arg1Value_ = (PList) arg1Value;
if ((PGuards.cannotBeOverriddenForImmutableType(arg1Value_))) {
SetItemNode setItemNode__ = arg0Value.insert((SetItemNodeFactory.create()));
Objects.requireNonNull(setItemNode__, "Specialization 'doList(VirtualFrame, PList, Object, Object, SetItemNode)' cache 'setItemNode' 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.list_setItemNode_.set(arg0Value, setItemNode__);
state_0 = state_0 | 0b1 /* add SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] */;
this.state_0_.set(arg0Value, state_0);
PyObjectSetItem.doList((VirtualFrame) frameValue, arg1Value_, arg2Value, arg3Value, setItemNode__);
return;
}
}
WithFrameData s1_ = arg0Value.insert(new WithFrameData());
LookupSpecialMethodSlotNode lookupSetitem__ = s1_.insert((LookupSpecialMethodSlotNode.create(SpecialMethodSlot.SetItem)));
Objects.requireNonNull(lookupSetitem__, "Specialization 'doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)' cache 'lookupSetitem' 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'.");
s1_.lookupSetitem_ = lookupSetitem__;
CallTernaryMethodNode callSetitem__ = s1_.insert((CallTernaryMethodNode.create()));
Objects.requireNonNull(callSetitem__, "Specialization 'doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)' cache 'callSetitem' 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'.");
s1_.callSetitem_ = callSetitem__;
VarHandle.storeStoreFence();
this.withFrame_cache.set(arg0Value, s1_);
this.list_setItemNode_.set(arg0Value, null);
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[PyObjectSetItem.doList(VirtualFrame, PList, Object, Object, SetItemNode)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[PyObjectSetItem.doWithFrame(Frame, Node, Object, Object, Object, GetClassNode, LookupSpecialMethodSlotNode, Lazy, CallTernaryMethodNode)] */;
this.state_0_.set(arg0Value, state_0);
PyObjectSetItem.doWithFrame(frameValue, s1_, arg1Value, arg2Value, arg3Value, this.withFrame_getClassNode_, lookupSetitem__, this.withFrame_raise_, callSetitem__);
return;
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PyObjectSetItem.class)
@DenyReplace
private static final class WithFrameData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-16: InlinedCache
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* 17: InlinedCache
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link Lazy} raise
* Inline method: {@link LazyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int withFrame_state_0_;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node withFrame_getClassNode__field1_;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link LookupSpecialMethodSlotNode} lookupSetitem
*/
@Child LookupSpecialMethodSlotNode lookupSetitem_;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link Lazy} raise
* Inline method: {@link LazyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node withFrame_raise__field1_;
/**
* Source Info:
* Specialization: {@link PyObjectSetItem#doWithFrame}
* Parameter: {@link CallTernaryMethodNode} callSetitem
*/
@Child CallTernaryMethodNode callSetitem_;
WithFrameData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(PyObjectSetItem.class)
@DenyReplace
private static final class Uncached extends PyObjectSetItem {
@Override
public void execute(Frame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
PyObjectSetItem.doWithFrame(frameValue, arg0Value, arg1Value, arg2Value, arg3Value, (GetClassNode.getUncached()), (LookupSpecialMethodSlotNode.getUncached(SpecialMethodSlot.SetItem)), (Lazy.getUncached()), (CallTernaryMethodNode.getUncached()));
return;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy