com.oracle.graal.python.nodes.object.GetDictFromGlobalsNodeGen 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.module.PythonModule;
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.UnsupportedSpecializationException;
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 java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
/**
* Debug Info:
* Specialization {@link GetDictFromGlobalsNode#dict(PDict)}
* Activation probability: 0.65000
* With/without class size: 11/0 bytes
* Specialization {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Activation probability: 0.35000
* With/without class size: 16/17 bytes
*
*/
@GeneratedBy(GetDictFromGlobalsNode.class)
@SuppressWarnings("javadoc")
public final class GetDictFromGlobalsNodeGen extends GetDictFromGlobalsNode {
private static final StateField DICT1__GET_DICT_FROM_GLOBALS_NODE_DICT1_STATE_0_UPDATER = StateField.create(Dict1Data.lookup_(), "dict1_state_0_");
/**
* Source Info:
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
*/
private static final GetOrCreateDictNode INLINED_DICT1_GET_DICT_ = GetOrCreateDictNodeGen.inline(InlineTarget.create(GetOrCreateDictNode.class, DICT1__GET_DICT_FROM_GLOBALS_NODE_DICT1_STATE_0_UPDATER.subUpdater(0, 7), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field1_", Node.class), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field2_", Node.class), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field3_", Node.class), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field4_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link GetDictFromGlobalsNode#dict(PDict)}
* 1: SpecializationActive {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
*
*/
@CompilationFinal private int state_0_;
@Child private Dict1Data dict1_cache;
private GetDictFromGlobalsNodeGen() {
}
@Override
public PDict execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[GetDictFromGlobalsNode.dict(PDict)] || SpecializationActive[GetDictFromGlobalsNode.dict(Node, PythonModule, GetOrCreateDictNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetDictFromGlobalsNode.dict(PDict)] */ && arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return GetDictFromGlobalsNode.dict(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetDictFromGlobalsNode.dict(Node, PythonModule, GetOrCreateDictNode)] */ && arg1Value instanceof PythonModule) {
PythonModule arg1Value_ = (PythonModule) arg1Value;
Dict1Data s1_ = this.dict1_cache;
if (s1_ != null) {
return GetDictFromGlobalsNode.dict(s1_, arg1Value_, INLINED_DICT1_GET_DICT_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private PDict executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[GetDictFromGlobalsNode.dict(PDict)] */;
this.state_0_ = state_0;
return GetDictFromGlobalsNode.dict(arg1Value_);
}
if (arg1Value instanceof PythonModule) {
PythonModule arg1Value_ = (PythonModule) arg1Value;
Dict1Data s1_ = this.insert(new Dict1Data());
VarHandle.storeStoreFence();
this.dict1_cache = s1_;
state_0 = state_0 | 0b10 /* add SpecializationActive[GetDictFromGlobalsNode.dict(Node, PythonModule, GetOrCreateDictNode)] */;
this.state_0_ = state_0;
return GetDictFromGlobalsNode.dict(s1_, arg1Value_, INLINED_DICT1_GET_DICT_);
}
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 GetDictFromGlobalsNode create() {
return new GetDictFromGlobalsNodeGen();
}
@NeverDefault
public static GetDictFromGlobalsNode getUncached() {
return GetDictFromGlobalsNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#dict1_cache}
*
*/
@NeverDefault
public static GetDictFromGlobalsNode inline(@RequiredField(bits = 2, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new GetDictFromGlobalsNodeGen.Inlined(target);
}
@GeneratedBy(GetDictFromGlobalsNode.class)
@DenyReplace
private static final class Inlined extends GetDictFromGlobalsNode {
/**
* State Info:
* 0: SpecializationActive {@link GetDictFromGlobalsNode#dict(PDict)}
* 1: SpecializationActive {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
*
*/
private final StateField state_0_;
private final ReferenceField dict1_cache;
/**
* Source Info:
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
*/
private final GetOrCreateDictNode dict1_getDict_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(GetDictFromGlobalsNode.class);
this.state_0_ = target.getState(0, 2);
this.dict1_cache = target.getReference(1, Dict1Data.class);
this.dict1_getDict_ = GetOrCreateDictNodeGen.inline(InlineTarget.create(GetOrCreateDictNode.class, DICT1__GET_DICT_FROM_GLOBALS_NODE_DICT1_STATE_0_UPDATER.subUpdater(0, 7), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field1_", Node.class), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field2_", Node.class), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field3_", Node.class), ReferenceField.create(Dict1Data.lookup_(), "dict1_getDict__field4_", Node.class)));
}
@Override
public PDict execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[GetDictFromGlobalsNode.dict(PDict)] || SpecializationActive[GetDictFromGlobalsNode.dict(Node, PythonModule, GetOrCreateDictNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[GetDictFromGlobalsNode.dict(PDict)] */ && arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return GetDictFromGlobalsNode.dict(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[GetDictFromGlobalsNode.dict(Node, PythonModule, GetOrCreateDictNode)] */ && arg1Value instanceof PythonModule) {
PythonModule arg1Value_ = (PythonModule) arg1Value;
Dict1Data s1_ = this.dict1_cache.get(arg0Value);
if (s1_ != null) {
return GetDictFromGlobalsNode.dict(s1_, arg1Value_, this.dict1_getDict_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private PDict executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[GetDictFromGlobalsNode.dict(PDict)] */;
this.state_0_.set(arg0Value, state_0);
return GetDictFromGlobalsNode.dict(arg1Value_);
}
if (arg1Value instanceof PythonModule) {
PythonModule arg1Value_ = (PythonModule) arg1Value;
Dict1Data s1_ = arg0Value.insert(new Dict1Data());
VarHandle.storeStoreFence();
this.dict1_cache.set(arg0Value, s1_);
state_0 = state_0 | 0b10 /* add SpecializationActive[GetDictFromGlobalsNode.dict(Node, PythonModule, GetOrCreateDictNode)] */;
this.state_0_.set(arg0Value, state_0);
return GetDictFromGlobalsNode.dict(s1_, arg1Value_, this.dict1_getDict_);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(GetDictFromGlobalsNode.class)
@DenyReplace
private static final class Dict1Data extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-6: InlinedCache
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int dict1_state_0_;
/**
* Source Info:
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node dict1_getDict__field1_;
/**
* Source Info:
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node dict1_getDict__field2_;
/**
* Source Info:
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
* Inline field: {@link Node} field3
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node dict1_getDict__field3_;
/**
* Source Info:
* Specialization: {@link GetDictFromGlobalsNode#dict(Node, PythonModule, GetOrCreateDictNode)}
* Parameter: {@link GetOrCreateDictNode} getDict
* Inline method: {@link GetOrCreateDictNodeGen#inline}
* Inline field: {@link Node} field4
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node dict1_getDict__field4_;
Dict1Data() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(GetDictFromGlobalsNode.class)
@DenyReplace
private static final class Uncached extends GetDictFromGlobalsNode {
@TruffleBoundary
@Override
public PDict execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof PDict) {
PDict arg1Value_ = (PDict) arg1Value;
return GetDictFromGlobalsNode.dict(arg1Value_);
}
if (arg1Value instanceof PythonModule) {
PythonModule arg1Value_ = (PythonModule) arg1Value;
return GetDictFromGlobalsNode.dict(arg0Value, arg1Value_, (GetOrCreateDictNodeGen.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