All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.graal.python.nodes.util.CastToJavaBooleanNodeGen Maven / Gradle / Ivy

There is a newer version: 24.1.1
Show newest version
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;

import com.oracle.graal.python.builtins.objects.cext.PythonNativeObject;
import com.oracle.graal.python.builtins.objects.ints.PInt;
import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
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.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
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.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
import java.lang.invoke.VarHandle;

/**
 * Debug Info: 
 *   Specialization {@link CastToJavaBooleanNode#doBoolean}
 *     Activation probability: 0.38500
 *     With/without class size: 8/0 bytes
 *   Specialization {@link CastToJavaBooleanNode#doPInt}
 *     Activation probability: 0.29500
 *     With/without class size: 8/0 bytes
 *   Specialization {@link CastToJavaBooleanNode#doNativeObject}
 *     Activation probability: 0.20500
 *     With/without class size: 7/0 bytes
 *   Specialization {@link CastToJavaBooleanNode#doUnsupported}
 *     Activation probability: 0.11500
 *     With/without class size: 5/0 bytes
 * 
*/ @GeneratedBy(CastToJavaBooleanNode.class) @SuppressWarnings({"javadoc", "unused"}) public final class CastToJavaBooleanNodeGen { private static final Uncached UNCACHED = new Uncached(); @NeverDefault public static CastToJavaBooleanNode getUncached() { return CastToJavaBooleanNodeGen.UNCACHED; } /** * Required Fields:
    *
  • {@link Inlined#state_0_} *
  • {@link Inlined#isSubtypeNode} *
  • {@link Inlined#getClassNode_field1_} *
*/ @NeverDefault public static CastToJavaBooleanNode inline(@RequiredField(bits = 23, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) { return new CastToJavaBooleanNodeGen.Inlined(target); } @GeneratedBy(CastToJavaBooleanNode.class) @DenyReplace private static final class Inlined extends CastToJavaBooleanNode { /** * State Info:
         *   0: SpecializationActive {@link CastToJavaBooleanNode#doBoolean}
         *   1: SpecializationActive {@link CastToJavaBooleanNode#doPInt}
         *   2: SpecializationActive {@link CastToJavaBooleanNode#doNativeObject}
         *   3: SpecializationActive {@link CastToJavaBooleanNode#doUnsupported}
         *   4-5: InlinedCache
         *        Specialization: {@link CastToJavaBooleanNode#doPInt}
         *        Parameter: {@link InlinedConditionProfile} isBoolean
         *        Inline method: {@link InlinedConditionProfile#inline}
         *   6-22: InlinedCache
         *        Specialization: {@link CastToJavaBooleanNode#doPInt}
         *        Parameter: {@link GetClassNode} getClassNode
         *        Inline method: {@link GetClassNodeGen#inline}
         * 
*/ private final StateField state_0_; private final ReferenceField isSubtypeNode; private final ReferenceField getClassNode_field1_; /** * Source Info:
         *   Specialization: {@link CastToJavaBooleanNode#doPInt}
         *   Parameter: {@link InlinedConditionProfile} isBoolean
         *   Inline method: {@link InlinedConditionProfile#inline}
*/ private final InlinedConditionProfile dummy; /** * Source Info:
         *   Specialization: {@link CastToJavaBooleanNode#doPInt}
         *   Parameter: {@link GetClassNode} getClassNode
         *   Inline method: {@link GetClassNodeGen#inline}
*/ private final GetClassNode getClassNode; @SuppressWarnings("unchecked") private Inlined(InlineTarget target) { assert target.getTargetClass().isAssignableFrom(CastToJavaBooleanNode.class); this.state_0_ = target.getState(0, 23); this.isSubtypeNode = target.getReference(1, IsSubtypeNode.class); this.getClassNode_field1_ = target.getReference(2, Node.class); this.dummy = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, state_0_.subUpdater(4, 2))); this.getClassNode = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, state_0_.subUpdater(6, 17), getClassNode_field1_)); } @SuppressWarnings("static-method") private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) { if (!((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doBoolean(boolean)] */) && arg1Value instanceof Boolean) { return false; } if (!((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doPInt(Node, PInt, InlinedConditionProfile, IsSubtypeNode, GetClassNode)] */) && arg1Value instanceof PInt) { return false; } if (!((state_0 & 0b100) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doNativeObject(Node, PythonNativeObject, InlinedConditionProfile, GetClassNode, IsSubtypeNode)] */) && arg1Value instanceof PythonNativeObject) { return false; } return true; } @Override public boolean execute(Node arg0Value, Object arg1Value) throws CannotCastException { int state_0 = this.state_0_.get(arg0Value); if ((state_0 & 0b1111) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doBoolean(boolean)] || SpecializationActive[CastToJavaBooleanNode.doPInt(Node, PInt, InlinedConditionProfile, IsSubtypeNode, GetClassNode)] || SpecializationActive[CastToJavaBooleanNode.doNativeObject(Node, PythonNativeObject, InlinedConditionProfile, GetClassNode, IsSubtypeNode)] || SpecializationActive[CastToJavaBooleanNode.doUnsupported(Object)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doBoolean(boolean)] */ && arg1Value instanceof Boolean) { boolean arg1Value_ = (boolean) arg1Value; return CastToJavaBooleanNode.doBoolean(arg1Value_); } if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doPInt(Node, PInt, InlinedConditionProfile, IsSubtypeNode, GetClassNode)] */ && arg1Value instanceof PInt) { PInt arg1Value_ = (PInt) arg1Value; { IsSubtypeNode isSubtypeNode_ = this.isSubtypeNode.get(arg0Value); if (isSubtypeNode_ != null) { return CastToJavaBooleanNode.doPInt(arg0Value, arg1Value_, this.dummy, isSubtypeNode_, this.getClassNode); } } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doNativeObject(Node, PythonNativeObject, InlinedConditionProfile, GetClassNode, IsSubtypeNode)] */ && arg1Value instanceof PythonNativeObject) { PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value; { IsSubtypeNode isSubtypeNode_1 = this.isSubtypeNode.get(arg0Value); if (isSubtypeNode_1 != null) { return CastToJavaBooleanNode.doNativeObject(arg0Value, arg1Value_, this.dummy, this.getClassNode, isSubtypeNode_1); } } } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToJavaBooleanNode.doUnsupported(Object)] */) { if (fallbackGuard_(state_0, arg0Value, arg1Value)) { return CastToJavaBooleanNode.doUnsupported(arg1Value); } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } private boolean executeAndSpecialize(Node arg0Value, Object arg1Value) { int state_0 = this.state_0_.get(arg0Value); if (arg1Value instanceof Boolean) { boolean arg1Value_ = (boolean) arg1Value; state_0 = state_0 | 0b1 /* add SpecializationActive[CastToJavaBooleanNode.doBoolean(boolean)] */; this.state_0_.set(arg0Value, state_0); return CastToJavaBooleanNode.doBoolean(arg1Value_); } if (arg1Value instanceof PInt) { PInt arg1Value_ = (PInt) arg1Value; IsSubtypeNode isSubtypeNode_; IsSubtypeNode isSubtypeNode__shared = this.isSubtypeNode.get(arg0Value); if (isSubtypeNode__shared != null) { isSubtypeNode_ = isSubtypeNode__shared; } else { isSubtypeNode_ = arg0Value.insert((IsSubtypeNode.create())); if (isSubtypeNode_ == null) { throw new IllegalStateException("Specialization 'doPInt(Node, PInt, InlinedConditionProfile, IsSubtypeNode, GetClassNode)' contains a shared cache with name 'isSubtypeNode' 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.isSubtypeNode.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.isSubtypeNode.set(arg0Value, isSubtypeNode_); } state_0 = state_0 | 0b10 /* add SpecializationActive[CastToJavaBooleanNode.doPInt(Node, PInt, InlinedConditionProfile, IsSubtypeNode, GetClassNode)] */; this.state_0_.set(arg0Value, state_0); return CastToJavaBooleanNode.doPInt(arg0Value, arg1Value_, this.dummy, isSubtypeNode_, this.getClassNode); } if (arg1Value instanceof PythonNativeObject) { PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value; IsSubtypeNode isSubtypeNode_1; IsSubtypeNode isSubtypeNode_1_shared = this.isSubtypeNode.get(arg0Value); if (isSubtypeNode_1_shared != null) { isSubtypeNode_1 = isSubtypeNode_1_shared; } else { isSubtypeNode_1 = arg0Value.insert((IsSubtypeNode.create())); if (isSubtypeNode_1 == null) { throw new IllegalStateException("Specialization 'doNativeObject(Node, PythonNativeObject, InlinedConditionProfile, GetClassNode, IsSubtypeNode)' contains a shared cache with name 'isSubtypeNode' 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.isSubtypeNode.get(arg0Value) == null) { VarHandle.storeStoreFence(); this.isSubtypeNode.set(arg0Value, isSubtypeNode_1); } state_0 = state_0 | 0b100 /* add SpecializationActive[CastToJavaBooleanNode.doNativeObject(Node, PythonNativeObject, InlinedConditionProfile, GetClassNode, IsSubtypeNode)] */; this.state_0_.set(arg0Value, state_0); return CastToJavaBooleanNode.doNativeObject(arg0Value, arg1Value_, this.dummy, this.getClassNode, isSubtypeNode_1); } state_0 = state_0 | 0b1000 /* add SpecializationActive[CastToJavaBooleanNode.doUnsupported(Object)] */; this.state_0_.set(arg0Value, state_0); return CastToJavaBooleanNode.doUnsupported(arg1Value); } @Override public boolean isAdoptable() { return false; } } @GeneratedBy(CastToJavaBooleanNode.class) @DenyReplace private static final class Uncached extends CastToJavaBooleanNode { @TruffleBoundary @Override public boolean execute(Node arg0Value, Object arg1Value) throws CannotCastException { if (arg1Value instanceof Boolean) { boolean arg1Value_ = (boolean) arg1Value; return CastToJavaBooleanNode.doBoolean(arg1Value_); } if (arg1Value instanceof PInt) { PInt arg1Value_ = (PInt) arg1Value; return CastToJavaBooleanNode.doPInt(arg0Value, arg1Value_, (InlinedConditionProfile.getUncached()), (IsSubtypeNode.getUncached()), (GetClassNode.getUncached())); } if (arg1Value instanceof PythonNativeObject) { PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value; return CastToJavaBooleanNode.doNativeObject(arg0Value, arg1Value_, (InlinedConditionProfile.getUncached()), (GetClassNode.getUncached()), (IsSubtypeNode.getUncached())); } return CastToJavaBooleanNode.doUnsupported(arg1Value); } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @Override public boolean isAdoptable() { return false; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy