com.oracle.graal.python.nodes.frame.GetFrameLocalsNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.frame;
import com.oracle.graal.python.builtins.objects.dict.PDict;
import com.oracle.graal.python.builtins.objects.frame.PFrame;
import com.oracle.graal.python.lib.PyDictDelItem;
import com.oracle.graal.python.lib.PyDictDelItemNodeGen;
import com.oracle.graal.python.lib.PyDictSetItem;
import com.oracle.graal.python.lib.PyDictSetItemNodeGen;
import com.oracle.graal.python.nodes.bytecode.FrameInfo;
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.DSLSupport;
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.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.IntField;
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.FrameDescriptor;
import com.oracle.truffle.api.frame.MaterializedFrame;
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.util.Objects;
/**
* Debug Info:
* Specialization {@link GetFrameLocalsNode#doLoop}
* Activation probability: 0.65000
* With/without class size: 19/8 bytes
* Specialization {@link GetFrameLocalsNode#doCustomLocals}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(GetFrameLocalsNode.class)
@SuppressWarnings("javadoc")
public final class GetFrameLocalsNodeGen extends GetFrameLocalsNode {
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link GetFrameLocalsNode#doLoop}
* 1: SpecializationActive {@link GetFrameLocalsNode#doCustomLocals}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link GetFrameLocalsNode#doLoop}
* Parameter: {@link PythonObjectFactory} factory
*/
@Child private PythonObjectFactory loop_factory_;
/**
* Source Info:
* Specialization: {@link GetFrameLocalsNode#doLoop}
* Parameter: {@link CopyLocalsToDict} copyLocalsToDict
*/
@Child private CopyLocalsToDict loop_copyLocalsToDict_;
private GetFrameLocalsNodeGen() {
}
@Override
public Object execute(Node arg0Value, PFrame arg1Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[GetFrameLocalsNode.doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)] || SpecializationActive[GetFrameLocalsNode.doCustomLocals(PFrame)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetFrameLocalsNode.doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)] */) {
{
PythonObjectFactory factory__ = this.loop_factory_;
if (factory__ != null) {
CopyLocalsToDict copyLocalsToDict__ = this.loop_copyLocalsToDict_;
if (copyLocalsToDict__ != null) {
if ((!(arg1Value.hasCustomLocals()))) {
return GetFrameLocalsNode.doLoop(arg1Value, factory__, copyLocalsToDict__);
}
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetFrameLocalsNode.doCustomLocals(PFrame)] */) {
if ((arg1Value.hasCustomLocals())) {
return GetFrameLocalsNode.doCustomLocals(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private Object executeAndSpecialize(Node arg0Value, PFrame arg1Value) {
int state_0 = this.state_0_;
if ((!(arg1Value.hasCustomLocals()))) {
PythonObjectFactory factory__ = this.insert((PythonObjectFactory.create()));
Objects.requireNonNull(factory__, "Specialization 'doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)' 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.loop_factory_ = factory__;
CopyLocalsToDict copyLocalsToDict__ = this.insert((CopyLocalsToDictNodeGen.create()));
Objects.requireNonNull(copyLocalsToDict__, "Specialization 'doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)' cache 'copyLocalsToDict' 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.loop_copyLocalsToDict_ = copyLocalsToDict__;
state_0 = state_0 | 0b1 /* add SpecializationActive[GetFrameLocalsNode.doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)] */;
this.state_0_ = state_0;
return GetFrameLocalsNode.doLoop(arg1Value, factory__, copyLocalsToDict__);
}
if ((arg1Value.hasCustomLocals())) {
state_0 = state_0 | 0b10 /* add SpecializationActive[GetFrameLocalsNode.doCustomLocals(PFrame)] */;
this.state_0_ = state_0;
return GetFrameLocalsNode.doCustomLocals(arg1Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@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 GetFrameLocalsNode create() {
return new GetFrameLocalsNodeGen();
}
@NeverDefault
public static GetFrameLocalsNode getUncached() {
return GetFrameLocalsNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#loop_factory_}
*
- {@link Inlined#loop_copyLocalsToDict_}
*
*/
@NeverDefault
public static GetFrameLocalsNode 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 GetFrameLocalsNodeGen.Inlined(target);
}
@GeneratedBy(GetFrameLocalsNode.class)
@DenyReplace
private static final class Inlined extends GetFrameLocalsNode {
/**
* State Info:
* 0: SpecializationActive {@link GetFrameLocalsNode#doLoop}
* 1: SpecializationActive {@link GetFrameLocalsNode#doCustomLocals}
*
*/
private final StateField state_0_;
private final ReferenceField loop_factory_;
private final ReferenceField loop_copyLocalsToDict_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(GetFrameLocalsNode.class);
this.state_0_ = target.getState(0, 2);
this.loop_factory_ = target.getReference(1, PythonObjectFactory.class);
this.loop_copyLocalsToDict_ = target.getReference(2, CopyLocalsToDict.class);
}
@Override
public Object execute(Node arg0Value, PFrame arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[GetFrameLocalsNode.doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)] || SpecializationActive[GetFrameLocalsNode.doCustomLocals(PFrame)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetFrameLocalsNode.doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)] */) {
{
PythonObjectFactory factory__ = this.loop_factory_.get(arg0Value);
if (factory__ != null) {
CopyLocalsToDict copyLocalsToDict__ = this.loop_copyLocalsToDict_.get(arg0Value);
if (copyLocalsToDict__ != null) {
if ((!(arg1Value.hasCustomLocals()))) {
return GetFrameLocalsNode.doLoop(arg1Value, factory__, copyLocalsToDict__);
}
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetFrameLocalsNode.doCustomLocals(PFrame)] */) {
if ((arg1Value.hasCustomLocals())) {
return GetFrameLocalsNode.doCustomLocals(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private Object executeAndSpecialize(Node arg0Value, PFrame arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((!(arg1Value.hasCustomLocals()))) {
PythonObjectFactory factory__ = arg0Value.insert((PythonObjectFactory.create()));
Objects.requireNonNull(factory__, "Specialization 'doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)' 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.loop_factory_.set(arg0Value, factory__);
CopyLocalsToDict copyLocalsToDict__ = arg0Value.insert((CopyLocalsToDictNodeGen.create()));
Objects.requireNonNull(copyLocalsToDict__, "Specialization 'doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)' cache 'copyLocalsToDict' 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.loop_copyLocalsToDict_.set(arg0Value, copyLocalsToDict__);
state_0 = state_0 | 0b1 /* add SpecializationActive[GetFrameLocalsNode.doLoop(PFrame, PythonObjectFactory, CopyLocalsToDict)] */;
this.state_0_.set(arg0Value, state_0);
return GetFrameLocalsNode.doLoop(arg1Value, factory__, copyLocalsToDict__);
}
if ((arg1Value.hasCustomLocals())) {
state_0 = state_0 | 0b10 /* add SpecializationActive[GetFrameLocalsNode.doCustomLocals(PFrame)] */;
this.state_0_.set(arg0Value, state_0);
return GetFrameLocalsNode.doCustomLocals(arg1Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(GetFrameLocalsNode.class)
@DenyReplace
private static final class Uncached extends GetFrameLocalsNode {
@TruffleBoundary
@Override
public Object execute(Node arg0Value, PFrame arg1Value) {
if ((!(arg1Value.hasCustomLocals()))) {
return GetFrameLocalsNode.doLoop(arg1Value, (PythonObjectFactory.getUncached()), (CopyLocalsToDictNodeGen.getUncached()));
}
if ((arg1Value.hasCustomLocals())) {
return GetFrameLocalsNode.doCustomLocals(arg1Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
/**
* Debug Info:
* Specialization {@link CopyLocalsToDict#doCachedFd}
* Activation probability: 0.65000
* With/without class size: 17/4 bytes
* Specialization {@link CopyLocalsToDict#doGeneric}
* Activation probability: 0.35000
* With/without class size: 9/0 bytes
*
*/
@GeneratedBy(CopyLocalsToDict.class)
@SuppressWarnings("javadoc")
static final class CopyLocalsToDictNodeGen extends CopyLocalsToDict {
private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
static final ReferenceField CACHED_FD_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "cachedFd_cache", CachedFdData.class);
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictSetItem} setItem
* Inline method: {@link PyDictSetItemNodeGen#inline}
*/
private static final PyDictSetItem INLINED_SET_ITEM = PyDictSetItemNodeGen.inline(InlineTarget.create(PyDictSetItem.class, STATE_0_UPDATER.subUpdater(2, 3), ReferenceField.create(MethodHandles.lookup(), "setItem_field1_", Node.class), IntField.create(MethodHandles.lookup(), "setItem_field2_"), IntField.create(MethodHandles.lookup(), "setItem_field3_")));
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictDelItem} delItem
* Inline method: {@link PyDictDelItemNodeGen#inline}
*/
private static final PyDictDelItem INLINED_DEL_ITEM = PyDictDelItemNodeGen.inline(InlineTarget.create(PyDictDelItem.class, STATE_0_UPDATER.subUpdater(5, 6), ReferenceField.create(MethodHandles.lookup(), "delItem_field1_", Node.class), ReferenceField.create(MethodHandles.lookup(), "delItem_field2_", Node.class), ReferenceField.create(MethodHandles.lookup(), "delItem_field3_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link CopyLocalsToDict#doCachedFd}
* 1: SpecializationActive {@link CopyLocalsToDict#doGeneric}
* 2-4: InlinedCache
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictSetItem} setItem
* Inline method: {@link PyDictSetItemNodeGen#inline}
* 5-10: InlinedCache
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictDelItem} delItem
* Inline method: {@link PyDictDelItemNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictSetItem} setItem
* Inline method: {@link PyDictSetItemNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node setItem_field1_;
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictSetItem} setItem
* Inline method: {@link PyDictSetItemNodeGen#inline}
* Inline field: int field2
*/
@CompilationFinal @UnsafeAccessedField @SuppressWarnings("unused") private int setItem_field2_;
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictSetItem} setItem
* Inline method: {@link PyDictSetItemNodeGen#inline}
* Inline field: int field3
*/
@CompilationFinal @UnsafeAccessedField @SuppressWarnings("unused") private int setItem_field3_;
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictDelItem} delItem
* Inline method: {@link PyDictDelItemNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node delItem_field1_;
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictDelItem} delItem
* Inline method: {@link PyDictDelItemNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node delItem_field2_;
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link PyDictDelItem} delItem
* Inline method: {@link PyDictDelItemNodeGen#inline}
* Inline field: {@link Node} field3
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node delItem_field3_;
@UnsafeAccessedField @Child private CachedFdData cachedFd_cache;
private CopyLocalsToDictNodeGen() {
}
@Override
void execute(MaterializedFrame frameValue, PDict arg0Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b11) != 0 /* is SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doCachedFd(MaterializedFrame, PDict, Node, FrameDescriptor, FrameInfo, int, PyDictSetItem, PyDictDelItem)] || SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doGeneric(MaterializedFrame, PDict, Node, PyDictSetItem, PyDictDelItem)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doCachedFd(MaterializedFrame, PDict, Node, FrameDescriptor, FrameInfo, int, PyDictSetItem, PyDictDelItem)] */) {
CachedFdData s0_ = this.cachedFd_cache;
if (s0_ != null) {
if ((s0_.cachedFd_ == frameValue.getFrameDescriptor())) {
FrameInfo info__ = (CopyLocalsToDict.getInfo(s0_.cachedFd_));
int count__ = (info__.getVariableCount());
Node inliningTarget__ = (this);
assert DSLSupport.assertIdempotence((count__ < 32));
doCachedFd(frameValue, arg0Value, inliningTarget__, s0_.cachedFd_, info__, count__, INLINED_SET_ITEM, INLINED_DEL_ITEM);
return;
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doGeneric(MaterializedFrame, PDict, Node, PyDictSetItem, PyDictDelItem)] */) {
{
Node inliningTarget__1 = (this);
doGeneric(frameValue, arg0Value, inliningTarget__1, INLINED_SET_ITEM, INLINED_DEL_ITEM);
return;
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
executeAndSpecialize(frameValue, arg0Value);
return;
}
private void executeAndSpecialize(MaterializedFrame frameValue, PDict arg0Value) {
int state_0 = this.state_0_;
{
int count__ = 0;
FrameInfo info__ = null;
Node inliningTarget__ = null;
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doGeneric(MaterializedFrame, PDict, Node, PyDictSetItem, PyDictDelItem)] */) {
while (true) {
int count0_ = 0;
CachedFdData s0_ = CACHED_FD_CACHE_UPDATER.getVolatile(this);
CachedFdData s0_original = s0_;
while (s0_ != null) {
if ((s0_.cachedFd_ == frameValue.getFrameDescriptor())) {
info__ = (CopyLocalsToDict.getInfo(s0_.cachedFd_));
count__ = (info__.getVariableCount());
assert DSLSupport.assertIdempotence((count__ < 32));
inliningTarget__ = (this);
break;
}
count0_++;
s0_ = null;
break;
}
if (s0_ == null && count0_ < 1) {
{
FrameDescriptor cachedFd__ = (frameValue.getFrameDescriptor());
if ((cachedFd__ == frameValue.getFrameDescriptor())) {
info__ = (CopyLocalsToDict.getInfo(cachedFd__));
count__ = (info__.getVariableCount());
if ((count__ < 32)) {
s0_ = this.insert(new CachedFdData());
inliningTarget__ = (this);
s0_.cachedFd_ = cachedFd__;
if (!CACHED_FD_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doCachedFd(MaterializedFrame, PDict, Node, FrameDescriptor, FrameInfo, int, PyDictSetItem, PyDictDelItem)] */;
this.state_0_ = state_0;
}
}
}
}
if (s0_ != null) {
doCachedFd(frameValue, arg0Value, inliningTarget__, s0_.cachedFd_, info__, count__, INLINED_SET_ITEM, INLINED_DEL_ITEM);
return;
}
break;
}
}
}
{
Node inliningTarget__1 = null;
inliningTarget__1 = (this);
this.cachedFd_cache = null;
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doCachedFd(MaterializedFrame, PDict, Node, FrameDescriptor, FrameInfo, int, PyDictSetItem, PyDictDelItem)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[GetFrameLocalsNode.CopyLocalsToDict.doGeneric(MaterializedFrame, PDict, Node, PyDictSetItem, PyDictDelItem)] */;
this.state_0_ = state_0;
doGeneric(frameValue, arg0Value, inliningTarget__1, INLINED_SET_ITEM, INLINED_DEL_ITEM);
return;
}
}
@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 CopyLocalsToDict create() {
return new CopyLocalsToDictNodeGen();
}
@NeverDefault
public static CopyLocalsToDict getUncached() {
return CopyLocalsToDictNodeGen.UNCACHED;
}
@GeneratedBy(CopyLocalsToDict.class)
@DenyReplace
private static final class CachedFdData extends Node implements SpecializationDataNode {
/**
* Source Info:
* Specialization: {@link CopyLocalsToDict#doCachedFd}
* Parameter: {@link FrameDescriptor} cachedFd
*/
@CompilationFinal FrameDescriptor cachedFd_;
CachedFdData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(CopyLocalsToDict.class)
@DenyReplace
private static final class Uncached extends CopyLocalsToDict {
@TruffleBoundary
@Override
void execute(MaterializedFrame frameValue, PDict arg0Value) {
doGeneric(frameValue, arg0Value, (this), (PyDictSetItem.getUncached()), (PyDictDelItemNodeGen.getUncached()));
return;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy