com.oracle.graal.python.nodes.object.GetOrCreateDictNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.object;
import com.oracle.graal.python.builtins.objects.dict.PDict;
import com.oracle.graal.python.builtins.objects.object.PythonObject;
import com.oracle.graal.python.nodes.PGuards;
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.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.InlineSupport;
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.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.profiles.InlinedBranchProfile;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link GetOrCreateDictNode#doPythonObject}
* Activation probability: 0.65000
* With/without class size: 24/13 bytes
* Specialization {@link GetOrCreateDictNode#doOther}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(GetOrCreateDictNode.class)
@SuppressWarnings("javadoc")
public final class GetOrCreateDictNodeGen extends GetOrCreateDictNode {
private static final StateField STATE_0_GetOrCreateDictNode_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link SetDictNode} setDictNode
* Inline method: {@link SetDictNodeGen#inline}
*/
private static final SetDictNode INLINED_PYTHON_OBJECT_SET_DICT_NODE_ = SetDictNodeGen.inline(InlineTarget.create(SetDictNode.class, STATE_0_GetOrCreateDictNode_UPDATER.subUpdater(2, 4), ReferenceField.create(MethodHandles.lookup(), "pythonObject_setDictNode__field1_", Node.class), ReferenceField.create(MethodHandles.lookup(), "pythonObject_setDictNode__field2_", Node.class)));
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link InlinedBranchProfile} createDict
* Inline method: {@link InlinedBranchProfile#inline}
*/
private static final InlinedBranchProfile INLINED_PYTHON_OBJECT_CREATE_DICT_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, STATE_0_GetOrCreateDictNode_UPDATER.subUpdater(6, 1)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link GetOrCreateDictNode#doPythonObject}
* 1: SpecializationActive {@link GetOrCreateDictNode#doOther}
* 2-5: InlinedCache
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link SetDictNode} setDictNode
* Inline method: {@link SetDictNodeGen#inline}
* 6: InlinedCache
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link InlinedBranchProfile} createDict
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link GetDictIfExistsNode} getDictIfExistsNode
*/
@Child private GetDictIfExistsNode getDict;
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link SetDictNode} setDictNode
* Inline method: {@link SetDictNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node pythonObject_setDictNode__field1_;
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link SetDictNode} setDictNode
* Inline method: {@link SetDictNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node pythonObject_setDictNode__field2_;
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link PythonObjectFactory} factory
*/
@Child private PythonObjectFactory pythonObject_factory_;
private GetOrCreateDictNodeGen() {
}
@Override
public PDict execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b11) != 0 /* is SpecializationActive[GetOrCreateDictNode.doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)] || SpecializationActive[GetOrCreateDictNode.doOther(Node, Object, GetDictIfExistsNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetOrCreateDictNode.doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)] */ && arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
{
GetDictIfExistsNode getDict_ = this.getDict;
if (getDict_ != null) {
PythonObjectFactory factory__ = this.pythonObject_factory_;
if (factory__ != null) {
return GetOrCreateDictNode.doPythonObject(this, arg1Value_, getDict_, INLINED_PYTHON_OBJECT_SET_DICT_NODE_, INLINED_PYTHON_OBJECT_CREATE_DICT_, factory__);
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetOrCreateDictNode.doOther(Node, Object, GetDictIfExistsNode)] */) {
{
GetDictIfExistsNode getDict_1 = this.getDict;
if (getDict_1 != null) {
if ((!(PGuards.isPythonObject(arg1Value)))) {
return GetOrCreateDictNode.doOther(this, arg1Value, getDict_1);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private PDict executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if (arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
GetDictIfExistsNode getDict_;
GetDictIfExistsNode getDict__shared = this.getDict;
if (getDict__shared != null) {
getDict_ = getDict__shared;
} else {
getDict_ = this.insert((GetDictIfExistsNodeGen.create()));
if (getDict_ == null) {
throw new IllegalStateException("Specialization 'doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)' contains a shared cache with name 'getDictIfExistsNode' 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.getDict == null) {
VarHandle.storeStoreFence();
this.getDict = getDict_;
}
PythonObjectFactory factory__ = this.insert((PythonObjectFactory.create()));
Objects.requireNonNull(factory__, "Specialization 'doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, 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.pythonObject_factory_ = factory__;
state_0 = state_0 | 0b1 /* add SpecializationActive[GetOrCreateDictNode.doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)] */;
this.state_0_ = state_0;
return GetOrCreateDictNode.doPythonObject(this, arg1Value_, getDict_, INLINED_PYTHON_OBJECT_SET_DICT_NODE_, INLINED_PYTHON_OBJECT_CREATE_DICT_, factory__);
}
if ((!(PGuards.isPythonObject(arg1Value)))) {
GetDictIfExistsNode getDict_1;
GetDictIfExistsNode getDict_1_shared = this.getDict;
if (getDict_1_shared != null) {
getDict_1 = getDict_1_shared;
} else {
getDict_1 = this.insert((GetDictIfExistsNodeGen.create()));
if (getDict_1 == null) {
throw new IllegalStateException("Specialization 'doOther(Node, Object, GetDictIfExistsNode)' contains a shared cache with name 'getDict' 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.getDict == null) {
VarHandle.storeStoreFence();
this.getDict = getDict_1;
}
state_0 = state_0 | 0b10 /* add SpecializationActive[GetOrCreateDictNode.doOther(Node, Object, GetDictIfExistsNode)] */;
this.state_0_ = state_0;
return GetOrCreateDictNode.doOther(this, arg1Value, getDict_1);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if ((state_0 & 0b11) == 0) {
return NodeCost.UNINITIALIZED;
} else {
if (((state_0 & 0b11) & ((state_0 & 0b11) - 1)) == 0 /* is-single */) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static GetOrCreateDictNode create() {
return new GetOrCreateDictNodeGen();
}
@NeverDefault
public static GetOrCreateDictNode getUncached() {
return GetOrCreateDictNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#getDict}
*
- {@link Inlined#pythonObject_setDictNode__field1_}
*
- {@link Inlined#pythonObject_setDictNode__field2_}
*
- {@link Inlined#pythonObject_factory_}
*
*/
@NeverDefault
public static GetOrCreateDictNode inline(@RequiredField(bits = 7, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.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 GetOrCreateDictNodeGen.Inlined(target);
}
@GeneratedBy(GetOrCreateDictNode.class)
@DenyReplace
private static final class Inlined extends GetOrCreateDictNode {
/**
* State Info:
* 0: SpecializationActive {@link GetOrCreateDictNode#doPythonObject}
* 1: SpecializationActive {@link GetOrCreateDictNode#doOther}
* 2-5: InlinedCache
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link SetDictNode} setDictNode
* Inline method: {@link SetDictNodeGen#inline}
* 6: InlinedCache
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link InlinedBranchProfile} createDict
* Inline method: {@link InlinedBranchProfile#inline}
*
*/
private final StateField state_0_;
private final ReferenceField getDict;
private final ReferenceField pythonObject_setDictNode__field1_;
private final ReferenceField pythonObject_setDictNode__field2_;
private final ReferenceField pythonObject_factory_;
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link SetDictNode} setDictNode
* Inline method: {@link SetDictNodeGen#inline}
*/
private final SetDictNode pythonObject_setDictNode_;
/**
* Source Info:
* Specialization: {@link GetOrCreateDictNode#doPythonObject}
* Parameter: {@link InlinedBranchProfile} createDict
* Inline method: {@link InlinedBranchProfile#inline}
*/
private final InlinedBranchProfile pythonObject_createDict_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(GetOrCreateDictNode.class);
this.state_0_ = target.getState(0, 7);
this.getDict = target.getReference(1, GetDictIfExistsNode.class);
this.pythonObject_setDictNode__field1_ = target.getReference(2, Node.class);
this.pythonObject_setDictNode__field2_ = target.getReference(3, Node.class);
this.pythonObject_factory_ = target.getReference(4, PythonObjectFactory.class);
this.pythonObject_setDictNode_ = SetDictNodeGen.inline(InlineTarget.create(SetDictNode.class, state_0_.subUpdater(2, 4), pythonObject_setDictNode__field1_, pythonObject_setDictNode__field2_));
this.pythonObject_createDict_ = InlinedBranchProfile.inline(InlineTarget.create(InlinedBranchProfile.class, state_0_.subUpdater(6, 1)));
}
@Override
public PDict execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b11) != 0 /* is SpecializationActive[GetOrCreateDictNode.doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)] || SpecializationActive[GetOrCreateDictNode.doOther(Node, Object, GetDictIfExistsNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetOrCreateDictNode.doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)] */ && arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
{
GetDictIfExistsNode getDict_ = this.getDict.get(arg0Value);
if (getDict_ != null) {
PythonObjectFactory factory__ = this.pythonObject_factory_.get(arg0Value);
if (factory__ != null) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.pythonObject_setDictNode__field1_, this.pythonObject_setDictNode__field2_, this.state_0_);
return GetOrCreateDictNode.doPythonObject(arg0Value, arg1Value_, getDict_, this.pythonObject_setDictNode_, this.pythonObject_createDict_, factory__);
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetOrCreateDictNode.doOther(Node, Object, GetDictIfExistsNode)] */) {
{
GetDictIfExistsNode getDict_1 = this.getDict.get(arg0Value);
if (getDict_1 != null) {
if ((!(PGuards.isPythonObject(arg1Value)))) {
return GetOrCreateDictNode.doOther(arg0Value, arg1Value, getDict_1);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private PDict executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
GetDictIfExistsNode getDict_;
GetDictIfExistsNode getDict__shared = this.getDict.get(arg0Value);
if (getDict__shared != null) {
getDict_ = getDict__shared;
} else {
getDict_ = arg0Value.insert((GetDictIfExistsNodeGen.create()));
if (getDict_ == null) {
throw new IllegalStateException("Specialization 'doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)' contains a shared cache with name 'getDictIfExistsNode' 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.getDict.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.getDict.set(arg0Value, getDict_);
}
PythonObjectFactory factory__ = arg0Value.insert((PythonObjectFactory.create()));
Objects.requireNonNull(factory__, "Specialization 'doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, 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.pythonObject_factory_.set(arg0Value, factory__);
state_0 = state_0 | 0b1 /* add SpecializationActive[GetOrCreateDictNode.doPythonObject(Node, PythonObject, GetDictIfExistsNode, SetDictNode, InlinedBranchProfile, PythonObjectFactory)] */;
this.state_0_.set(arg0Value, state_0);
assert InlineSupport.validate(arg0Value, this.state_0_, this.pythonObject_setDictNode__field1_, this.pythonObject_setDictNode__field2_, this.state_0_);
return GetOrCreateDictNode.doPythonObject(arg0Value, arg1Value_, getDict_, this.pythonObject_setDictNode_, this.pythonObject_createDict_, factory__);
}
if ((!(PGuards.isPythonObject(arg1Value)))) {
GetDictIfExistsNode getDict_1;
GetDictIfExistsNode getDict_1_shared = this.getDict.get(arg0Value);
if (getDict_1_shared != null) {
getDict_1 = getDict_1_shared;
} else {
getDict_1 = arg0Value.insert((GetDictIfExistsNodeGen.create()));
if (getDict_1 == null) {
throw new IllegalStateException("Specialization 'doOther(Node, Object, GetDictIfExistsNode)' contains a shared cache with name 'getDict' 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.getDict.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.getDict.set(arg0Value, getDict_1);
}
state_0 = state_0 | 0b10 /* add SpecializationActive[GetOrCreateDictNode.doOther(Node, Object, GetDictIfExistsNode)] */;
this.state_0_.set(arg0Value, state_0);
return GetOrCreateDictNode.doOther(arg0Value, arg1Value, getDict_1);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(GetOrCreateDictNode.class)
@DenyReplace
private static final class Uncached extends GetOrCreateDictNode {
@TruffleBoundary
@Override
public PDict execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof PythonObject) {
PythonObject arg1Value_ = (PythonObject) arg1Value;
return GetOrCreateDictNode.doPythonObject(arg0Value, arg1Value_, (GetDictIfExistsNode.getUncached()), (SetDictNodeGen.getUncached()), (InlinedBranchProfile.getUncached()), (PythonObjectFactory.getUncached()));
}
if ((!(PGuards.isPythonObject(arg1Value)))) {
return GetOrCreateDictNode.doOther(arg0Value, arg1Value, (GetDictIfExistsNode.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