com.oracle.graal.python.nodes.util.CoerceToComplexNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;
import com.oracle.graal.python.builtins.objects.complex.PComplex;
import com.oracle.graal.python.lib.PyFloatAsDoubleNode;
import com.oracle.graal.python.lib.PyFloatAsDoubleNodeGen;
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypesGen;
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.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.VirtualFrame;
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.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
/**
* Debug Info:
* Specialization {@link CoerceToComplexNode#toComplex(long, PythonObjectFactory)}
* Activation probability: 0.48333
* With/without class size: 9/0 bytes
* Specialization {@link CoerceToComplexNode#toComplex(double, PythonObjectFactory)}
* Activation probability: 0.33333
* With/without class size: 8/0 bytes
* Specialization {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Activation probability: 0.18333
* With/without class size: 9/10 bytes
*
*/
@GeneratedBy(CoerceToComplexNode.class)
@SuppressWarnings("javadoc")
public final class CoerceToComplexNodeGen extends CoerceToComplexNode {
private static final StateField TO_COMPLEX2__COERCE_TO_COMPLEX_NODE_TO_COMPLEX2_STATE_0_UPDATER = StateField.create(ToComplex2Data.lookup_(), "toComplex2_state_0_");
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Parameter: {@link InlinedConditionProfile} complexProfile
* Inline method: {@link InlinedConditionProfile#inline}
*/
private static final InlinedConditionProfile INLINED_TO_COMPLEX2_COMPLEX_PROFILE_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, TO_COMPLEX2__COERCE_TO_COMPLEX_NODE_TO_COMPLEX2_STATE_0_UPDATER.subUpdater(0, 2)));
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
*/
private static final PyFloatAsDoubleNode INLINED_TO_COMPLEX2_AS_DOUBLE_NODE_ = PyFloatAsDoubleNodeGen.inline(InlineTarget.create(PyFloatAsDoubleNode.class, TO_COMPLEX2__COERCE_TO_COMPLEX_NODE_TO_COMPLEX2_STATE_0_UPDATER.subUpdater(2, 7), ReferenceField.create(ToComplex2Data.lookup_(), "toComplex2_asDoubleNode__field1_", Node.class), ReferenceField.create(ToComplex2Data.lookup_(), "toComplex2_asDoubleNode__field2_", Node.class)));
/**
* State Info:
* 0: SpecializationActive {@link CoerceToComplexNode#toComplex(long, PythonObjectFactory)}
* 1: SpecializationActive {@link CoerceToComplexNode#toComplex(double, PythonObjectFactory)}
* 2: SpecializationActive {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* 3-5: ImplicitCast[type=long, index=0]
* 6-7: ImplicitCast[type=double, index=0]
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex(long, PythonObjectFactory)}
* Parameter: {@link PythonObjectFactory} factory
*/
@Child private PythonObjectFactory factory;
@Child private ToComplex2Data toComplex2_cache;
private CoerceToComplexNodeGen() {
}
@Override
public PComplex execute(VirtualFrame frameValue, Object arg0Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b111) != 0 /* is SpecializationActive[CoerceToComplexNode.toComplex(long, PythonObjectFactory)] || SpecializationActive[CoerceToComplexNode.toComplex(double, PythonObjectFactory)] || SpecializationActive[CoerceToComplexNode.toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CoerceToComplexNode.toComplex(long, PythonObjectFactory)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b111000) >>> 3 /* get-int ImplicitCast[type=long, index=0] */, arg0Value)) {
long arg0Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b111000) >>> 3 /* get-int ImplicitCast[type=long, index=0] */, arg0Value);
{
PythonObjectFactory factory_ = this.factory;
if (factory_ != null) {
return toComplex(arg0Value_, factory_);
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CoerceToComplexNode.toComplex(double, PythonObjectFactory)] */ && PythonArithmeticTypesGen.isImplicitDouble((state_0 & 0b11000000) >>> 6 /* get-int ImplicitCast[type=double, index=0] */, arg0Value)) {
double arg0Value_ = PythonArithmeticTypesGen.asImplicitDouble((state_0 & 0b11000000) >>> 6 /* get-int ImplicitCast[type=double, index=0] */, arg0Value);
{
PythonObjectFactory factory_1 = this.factory;
if (factory_1 != null) {
return toComplex(arg0Value_, factory_1);
}
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CoerceToComplexNode.toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)] */) {
ToComplex2Data s2_ = this.toComplex2_cache;
if (s2_ != null) {
{
PythonObjectFactory factory_2 = this.factory;
if (factory_2 != null) {
Node inliningTarget__ = (s2_);
return toComplex(frameValue, arg0Value, inliningTarget__, INLINED_TO_COMPLEX2_COMPLEX_PROFILE_, INLINED_TO_COMPLEX2_AS_DOUBLE_NODE_, factory_2);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value);
}
private PComplex executeAndSpecialize(VirtualFrame frameValue, Object arg0Value) {
int state_0 = this.state_0_;
{
int longCast0;
if ((longCast0 = PythonArithmeticTypesGen.specializeImplicitLong(arg0Value)) != 0) {
long arg0Value_ = PythonArithmeticTypesGen.asImplicitLong(longCast0, arg0Value);
PythonObjectFactory factory_;
PythonObjectFactory factory__shared = this.factory;
if (factory__shared != null) {
factory_ = factory__shared;
} else {
factory_ = this.insert((PythonObjectFactory.create()));
if (factory_ == null) {
throw new IllegalStateException("Specialization 'toComplex(long, PythonObjectFactory)' contains a shared cache with name 'factory' 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.factory == null) {
VarHandle.storeStoreFence();
this.factory = factory_;
}
state_0 = (state_0 | (longCast0 << 3) /* set-int ImplicitCast[type=long, index=0] */);
state_0 = state_0 | 0b1 /* add SpecializationActive[CoerceToComplexNode.toComplex(long, PythonObjectFactory)] */;
this.state_0_ = state_0;
return toComplex(arg0Value_, factory_);
}
}
{
int doubleCast0;
if ((doubleCast0 = PythonArithmeticTypesGen.specializeImplicitDouble(arg0Value)) != 0) {
double arg0Value_ = PythonArithmeticTypesGen.asImplicitDouble(doubleCast0, arg0Value);
PythonObjectFactory factory_1;
PythonObjectFactory factory_1_shared = this.factory;
if (factory_1_shared != null) {
factory_1 = factory_1_shared;
} else {
factory_1 = this.insert((PythonObjectFactory.create()));
if (factory_1 == null) {
throw new IllegalStateException("Specialization 'toComplex(double, PythonObjectFactory)' contains a shared cache with name 'factory' 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.factory == null) {
VarHandle.storeStoreFence();
this.factory = factory_1;
}
state_0 = (state_0 | (doubleCast0 << 6) /* set-int ImplicitCast[type=double, index=0] */);
state_0 = state_0 | 0b10 /* add SpecializationActive[CoerceToComplexNode.toComplex(double, PythonObjectFactory)] */;
this.state_0_ = state_0;
return toComplex(arg0Value_, factory_1);
}
}
{
Node inliningTarget__ = null;
ToComplex2Data s2_ = this.insert(new ToComplex2Data());
inliningTarget__ = (s2_);
PythonObjectFactory factory_2;
PythonObjectFactory factory_2_shared = this.factory;
if (factory_2_shared != null) {
factory_2 = factory_2_shared;
} else {
factory_2 = s2_.insert((PythonObjectFactory.create()));
if (factory_2 == null) {
throw new IllegalStateException("Specialization 'toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)' contains a shared cache with name 'factory' 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.factory == null) {
this.factory = factory_2;
}
VarHandle.storeStoreFence();
this.toComplex2_cache = s2_;
state_0 = state_0 | 0b100 /* add SpecializationActive[CoerceToComplexNode.toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)] */;
this.state_0_ = state_0;
return toComplex(frameValue, arg0Value, inliningTarget__, INLINED_TO_COMPLEX2_COMPLEX_PROFILE_, INLINED_TO_COMPLEX2_AS_DOUBLE_NODE_, factory_2);
}
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if ((state_0 & 0b111) == 0) {
return NodeCost.UNINITIALIZED;
} else {
if (((state_0 & 0b111) & ((state_0 & 0b111) - 1)) == 0 /* is-single */) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static CoerceToComplexNode create() {
return new CoerceToComplexNodeGen();
}
@GeneratedBy(CoerceToComplexNode.class)
@DenyReplace
private static final class ToComplex2Data extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-1: InlinedCache
* Specialization: {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Parameter: {@link InlinedConditionProfile} complexProfile
* Inline method: {@link InlinedConditionProfile#inline}
* 2-8: InlinedCache
* Specialization: {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int toComplex2_state_0_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node toComplex2_asDoubleNode__field1_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex(VirtualFrame, Object, Node, InlinedConditionProfile, PyFloatAsDoubleNode, PythonObjectFactory)}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node toComplex2_asDoubleNode__field2_;
ToComplex2Data() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy