com.oracle.graal.python.nodes.classes.AbstractObjectIsSubclassNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.classes;
import com.oracle.graal.python.builtins.objects.common.SequenceNodes.GetObjectArrayNode;
import com.oracle.graal.python.builtins.objects.common.SequenceNodesFactory.GetObjectArrayNodeGen;
import com.oracle.graal.python.builtins.objects.type.TypeNodes.IsSameTypeNode;
import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.IsSameTypeNodeGen;
import com.oracle.graal.python.runtime.PythonOptions;
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.ExplodeLoop;
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 AbstractObjectIsSubclassNode#doSameClass}
* Activation probability: 0.48333
* With/without class size: 11/0 bytes
* Specialization {@link AbstractObjectIsSubclassNode#doSubclass}
* Activation probability: 0.33333
* With/without class size: 16/16 bytes
* Specialization {@link AbstractObjectIsSubclassNode#doGeneric}
* Activation probability: 0.18333
* With/without class size: 7/4 bytes
*
*/
@GeneratedBy(AbstractObjectIsSubclassNode.class)
@SuppressWarnings("javadoc")
public final class AbstractObjectIsSubclassNodeGen extends AbstractObjectIsSubclassNode {
private static final StateField STATE_1_UPDATER = StateField.create(MethodHandles.lookup(), "state_1_");
private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
static final ReferenceField SUBCLASS_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "subclass_cache", SubclassData.class);
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSameClass}
* Parameter: {@link IsSameTypeNode} isSameTypeNode
* Inline method: {@link IsSameTypeNodeGen#inline}
*/
private static final IsSameTypeNode INLINED_IS_SAME_TYPE = IsSameTypeNodeGen.inline(InlineTarget.create(IsSameTypeNode.class, STATE_1_UPDATER.subUpdater(0, 6), ReferenceField.create(MethodHandles.lookup(), "isSameType_field1_", Node.class)));
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link GetObjectArrayNode} getObjectArrayNode
* Inline method: {@link GetObjectArrayNodeGen#inline}
*/
private static final GetObjectArrayNode INLINED_GET_OBJECT_ARRAY_NODE = GetObjectArrayNodeGen.inline(InlineTarget.create(GetObjectArrayNode.class, STATE_0_UPDATER.subUpdater(3, 7), ReferenceField.create(MethodHandles.lookup(), "getObjectArrayNode_field1_", Object.class), ReferenceField.create(MethodHandles.lookup(), "getObjectArrayNode_field2_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link AbstractObjectIsSubclassNode#doSameClass}
* 1: SpecializationActive {@link AbstractObjectIsSubclassNode#doSubclass}
* 2: SpecializationActive {@link AbstractObjectIsSubclassNode#doGeneric}
* 3-9: InlinedCache
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link GetObjectArrayNode} getObjectArrayNode
* Inline method: {@link GetObjectArrayNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* State Info:
* 0-5: InlinedCache
* Specialization: {@link AbstractObjectIsSubclassNode#doSameClass}
* Parameter: {@link IsSameTypeNode} isSameTypeNode
* Inline method: {@link IsSameTypeNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_1_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSameClass}
* Parameter: {@link IsSameTypeNode} isSameTypeNode
* Inline method: {@link IsSameTypeNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node isSameType_field1_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link AbstractObjectGetBasesNode} getBasesNode
*/
@Child private AbstractObjectGetBasesNode getBasesNode;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link GetObjectArrayNode} getObjectArrayNode
* Inline method: {@link GetObjectArrayNodeGen#inline}
* Inline field: {@link Object} field1
*/
@CompilationFinal @UnsafeAccessedField @SuppressWarnings("unused") private Object getObjectArrayNode_field1_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link GetObjectArrayNode} getObjectArrayNode
* Inline method: {@link GetObjectArrayNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node getObjectArrayNode_field2_;
@UnsafeAccessedField @Child private SubclassData subclass_cache;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doGeneric}
* Parameter: {@link AbstractObjectIsSubclassNode} isSubclassNode
*/
@Child private AbstractObjectIsSubclassNode generic_isSubclassNode_;
private AbstractObjectIsSubclassNodeGen() {
}
@ExplodeLoop
@Override
protected boolean executeInternal(Frame frameValue, Object arg0Value, Object arg1Value, int arg2Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b111) != 0 /* is SpecializationActive[AbstractObjectIsSubclassNode.doSameClass(Object, Object, int, Node, IsSameTypeNode)] || SpecializationActive[AbstractObjectIsSubclassNode.doSubclass(VirtualFrame, Object, Object, int, Node, int[], Object, Object, IsSameTypeNode, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, GetObjectArrayNode)] || SpecializationActive[AbstractObjectIsSubclassNode.doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[AbstractObjectIsSubclassNode.doSameClass(Object, Object, int, Node, IsSameTypeNode)] */) {
{
Node inliningTarget__ = (this);
if ((AbstractObjectIsSubclassNode.isSameMetaObject(inliningTarget__, INLINED_IS_SAME_TYPE, arg0Value, arg1Value))) {
return AbstractObjectIsSubclassNode.doSameClass(arg0Value, arg1Value, arg2Value, inliningTarget__, INLINED_IS_SAME_TYPE);
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[AbstractObjectIsSubclassNode.doSubclass(VirtualFrame, Object, Object, int, Node, int[], Object, Object, IsSameTypeNode, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, GetObjectArrayNode)] */ && (arg2Value < AbstractObjectIsSubclassNode.MAX_RECURSION)) {
SubclassData s1_ = this.subclass_cache;
while (s1_ != null) {
{
AbstractObjectGetBasesNode getBasesNode_ = this.getBasesNode;
if (getBasesNode_ != null) {
Node inliningTarget__1 = (this);
if ((!(AbstractObjectIsSubclassNode.isSameMetaObject(inliningTarget__1, INLINED_IS_SAME_TYPE, arg0Value, arg1Value))) && (arg0Value == s1_.cachedDerived_) && (arg1Value == s1_.cachedCls_)) {
return AbstractObjectIsSubclassNode.doSubclass((VirtualFrame) frameValue, arg0Value, arg1Value, arg2Value, inliningTarget__1, s1_.observedSizeArray_, s1_.cachedDerived_, s1_.cachedCls_, INLINED_IS_SAME_TYPE, getBasesNode_, s1_.isSubclassNode_, INLINED_GET_OBJECT_ARRAY_NODE);
}
}
}
s1_ = s1_.next_;
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[AbstractObjectIsSubclassNode.doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)] */) {
{
AbstractObjectGetBasesNode getBasesNode_1 = this.getBasesNode;
if (getBasesNode_1 != null) {
AbstractObjectIsSubclassNode isSubclassNode__ = this.generic_isSubclassNode_;
if (isSubclassNode__ != null) {
Node inliningTarget__2 = (this);
return AbstractObjectIsSubclassNode.doGeneric((VirtualFrame) frameValue, arg0Value, arg1Value, arg2Value, inliningTarget__2, getBasesNode_1, isSubclassNode__, INLINED_IS_SAME_TYPE, INLINED_GET_OBJECT_ARRAY_NODE);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value, arg1Value, arg2Value);
}
private boolean executeAndSpecialize(Frame frameValue, Object arg0Value, Object arg1Value, int arg2Value) {
int state_0 = this.state_0_;
{
Node inliningTarget__ = null;
if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[AbstractObjectIsSubclassNode.doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)] */) {
{
inliningTarget__ = (this);
if ((AbstractObjectIsSubclassNode.isSameMetaObject(inliningTarget__, INLINED_IS_SAME_TYPE, arg0Value, arg1Value))) {
state_0 = state_0 | 0b1 /* add SpecializationActive[AbstractObjectIsSubclassNode.doSameClass(Object, Object, int, Node, IsSameTypeNode)] */;
this.state_0_ = state_0;
return AbstractObjectIsSubclassNode.doSameClass(arg0Value, arg1Value, arg2Value, inliningTarget__, INLINED_IS_SAME_TYPE);
}
}
}
}
{
Node inliningTarget__1 = null;
if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[AbstractObjectIsSubclassNode.doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)] */ && (arg2Value < AbstractObjectIsSubclassNode.MAX_RECURSION)) {
while (true) {
int count1_ = 0;
SubclassData s1_ = SUBCLASS_CACHE_UPDATER.getVolatile(this);
SubclassData s1_original = s1_;
while (s1_ != null) {
{
AbstractObjectGetBasesNode getBasesNode_ = this.getBasesNode;
if (getBasesNode_ != null) {
inliningTarget__1 = (this);
if ((!(AbstractObjectIsSubclassNode.isSameMetaObject(inliningTarget__1, INLINED_IS_SAME_TYPE, arg0Value, arg1Value))) && (arg0Value == s1_.cachedDerived_) && (arg1Value == s1_.cachedCls_)) {
break;
}
}
}
count1_++;
s1_ = s1_.next_;
}
if (s1_ == null) {
{
inliningTarget__1 = (this);
if ((!(AbstractObjectIsSubclassNode.isSameMetaObject(inliningTarget__1, INLINED_IS_SAME_TYPE, arg0Value, arg1Value)))) {
// assert (arg0Value == s1_.cachedDerived_);
// assert (arg1Value == s1_.cachedCls_);
if (count1_ < (PythonOptions.getCallSiteInlineCacheMaxDepth())) {
s1_ = this.insert(new SubclassData(s1_original));
s1_.observedSizeArray_ = (AbstractObjectIsSubclassNode.observedSize());
s1_.cachedDerived_ = (arg0Value);
s1_.cachedCls_ = (arg1Value);
AbstractObjectGetBasesNode getBasesNode_;
AbstractObjectGetBasesNode getBasesNode__shared = this.getBasesNode;
if (getBasesNode__shared != null) {
getBasesNode_ = getBasesNode__shared;
} else {
getBasesNode_ = s1_.insert((AbstractObjectGetBasesNode.create()));
if (getBasesNode_ == null) {
throw new IllegalStateException("Specialization 'doSubclass(VirtualFrame, Object, Object, int, Node, int[], Object, Object, IsSameTypeNode, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, GetObjectArrayNode)' contains a shared cache with name 'getBasesNode' 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.getBasesNode == null) {
this.getBasesNode = getBasesNode_;
}
AbstractObjectIsSubclassNode isSubclassNode__1 = s1_.insert((AbstractObjectIsSubclassNode.create()));
Objects.requireNonNull(isSubclassNode__1, "Specialization 'doSubclass(VirtualFrame, Object, Object, int, Node, int[], Object, Object, IsSameTypeNode, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, GetObjectArrayNode)' cache 'isSubclassNode' 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_.isSubclassNode_ = isSubclassNode__1;
if (!SUBCLASS_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) {
continue;
}
state_0 = state_0 | 0b10 /* add SpecializationActive[AbstractObjectIsSubclassNode.doSubclass(VirtualFrame, Object, Object, int, Node, int[], Object, Object, IsSameTypeNode, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, GetObjectArrayNode)] */;
this.state_0_ = state_0;
}
}
}
}
if (s1_ != null) {
return AbstractObjectIsSubclassNode.doSubclass((VirtualFrame) frameValue, arg0Value, arg1Value, arg2Value, inliningTarget__1, s1_.observedSizeArray_, s1_.cachedDerived_, s1_.cachedCls_, INLINED_IS_SAME_TYPE, this.getBasesNode, s1_.isSubclassNode_, INLINED_GET_OBJECT_ARRAY_NODE);
}
break;
}
}
}
{
Node inliningTarget__2 = null;
inliningTarget__2 = (this);
AbstractObjectGetBasesNode getBasesNode_1;
AbstractObjectGetBasesNode getBasesNode_1_shared = this.getBasesNode;
if (getBasesNode_1_shared != null) {
getBasesNode_1 = getBasesNode_1_shared;
} else {
getBasesNode_1 = this.insert((AbstractObjectGetBasesNode.create()));
if (getBasesNode_1 == null) {
throw new IllegalStateException("Specialization 'doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)' contains a shared cache with name 'getBasesNode' 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.getBasesNode == null) {
VarHandle.storeStoreFence();
this.getBasesNode = getBasesNode_1;
}
AbstractObjectIsSubclassNode isSubclassNode__ = this.insert((createRecursive(arg2Value)));
Objects.requireNonNull(isSubclassNode__, "Specialization 'doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)' cache 'isSubclassNode' 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.generic_isSubclassNode_ = isSubclassNode__;
this.subclass_cache = null;
state_0 = state_0 & 0xfffffffc /* remove SpecializationActive[AbstractObjectIsSubclassNode.doSameClass(Object, Object, int, Node, IsSameTypeNode)], SpecializationActive[AbstractObjectIsSubclassNode.doSubclass(VirtualFrame, Object, Object, int, Node, int[], Object, Object, IsSameTypeNode, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, GetObjectArrayNode)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[AbstractObjectIsSubclassNode.doGeneric(VirtualFrame, Object, Object, int, Node, AbstractObjectGetBasesNode, AbstractObjectIsSubclassNode, IsSameTypeNode, GetObjectArrayNode)] */;
this.state_0_ = state_0;
return AbstractObjectIsSubclassNode.doGeneric((VirtualFrame) frameValue, arg0Value, arg1Value, arg2Value, inliningTarget__2, getBasesNode_1, isSubclassNode__, INLINED_IS_SAME_TYPE, INLINED_GET_OBJECT_ARRAY_NODE);
}
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if ((state_0 & 0b111) == 0) {
return NodeCost.UNINITIALIZED;
} else {
int counter = 0;
counter += Integer.bitCount((state_0 & 0b111));
if (counter == 1) {
SubclassData s1_ = this.subclass_cache;
if ((s1_ == null || s1_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static AbstractObjectIsSubclassNode create() {
return new AbstractObjectIsSubclassNodeGen();
}
@NeverDefault
public static AbstractObjectIsSubclassNode getUncached() {
return AbstractObjectIsSubclassNodeGen.UNCACHED;
}
@GeneratedBy(AbstractObjectIsSubclassNode.class)
@DenyReplace
private static final class SubclassData extends Node implements SpecializationDataNode {
@Child SubclassData next_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: int[] observedSizeArray
*/
@CompilationFinal(dimensions = 1) int[] observedSizeArray_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link Object} cachedDerived
*/
@CompilationFinal Object cachedDerived_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link Object} cachedCls
*/
@CompilationFinal Object cachedCls_;
/**
* Source Info:
* Specialization: {@link AbstractObjectIsSubclassNode#doSubclass}
* Parameter: {@link AbstractObjectIsSubclassNode} isSubclassNode
*/
@Child AbstractObjectIsSubclassNode isSubclassNode_;
SubclassData(SubclassData next_) {
this.next_ = next_;
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
}
@GeneratedBy(AbstractObjectIsSubclassNode.class)
@DenyReplace
private static final class Uncached extends AbstractObjectIsSubclassNode {
@Override
protected boolean executeInternal(Frame frameValue, Object arg0Value, Object arg1Value, int arg2Value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
return AbstractObjectIsSubclassNode.doGeneric((VirtualFrame) frameValue, arg0Value, arg1Value, arg2Value, (this), (AbstractObjectGetBasesNodeGen.getUncached()), (AbstractObjectIsSubclassNodeGen.getUncached()), (IsSameTypeNodeGen.getUncached()), (GetObjectArrayNodeGen.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy