
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.PGuards;
import com.oracle.graal.python.nodes.SpecialMethodNames;
import com.oracle.graal.python.nodes.PRaiseNode.Lazy;
import com.oracle.graal.python.nodes.PRaiseNodeGen.LazyNodeGen;
import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode;
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.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.frame.VirtualFrame;
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;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link CoerceToComplexNode#doLong}
* Activation probability: 0.38500
* With/without class size: 8/0 bytes
* Specialization {@link CoerceToComplexNode#doDouble}
* Activation probability: 0.29500
* With/without class size: 7/0 bytes
* Specialization {@link CoerceToComplexNode#doComplex}
* Activation probability: 0.20500
* With/without class size: 6/0 bytes
* Specialization {@link CoerceToComplexNode#toComplex}
* Activation probability: 0.11500
* With/without class size: 8/17 bytes
*
*/
@GeneratedBy(CoerceToComplexNode.class)
@SuppressWarnings("javadoc")
public final class CoerceToComplexNodeGen {
private static final StateField TO_COMPLEX__COERCE_TO_COMPLEX_NODE_TO_COMPLEX_STATE_0_UPDATER = StateField.create(ToComplexData.lookup_(), "toComplex_state_0_");
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#factory}
*
- {@link Inlined#toComplex_cache}
*
*/
@NeverDefault
public static CoerceToComplexNode inline(@RequiredField(bits = 9, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new CoerceToComplexNodeGen.Inlined(target);
}
@GeneratedBy(CoerceToComplexNode.class)
@DenyReplace
private static final class Inlined extends CoerceToComplexNode {
/**
* State Info:
* 0: SpecializationActive {@link CoerceToComplexNode#doLong}
* 1: SpecializationActive {@link CoerceToComplexNode#doDouble}
* 2: SpecializationActive {@link CoerceToComplexNode#doComplex}
* 3: SpecializationActive {@link CoerceToComplexNode#toComplex}
* 4-6: ImplicitCast[type=long, index=1]
* 7-8: ImplicitCast[type=double, index=1]
*
*/
private final StateField state_0_;
private final ReferenceField factory;
private final ReferenceField toComplex_cache;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
*/
private final PyFloatAsDoubleNode toComplex_asDoubleNode_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy toComplex_raiseNode_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(CoerceToComplexNode.class);
this.state_0_ = target.getState(0, 9);
this.factory = target.getReference(1, PythonObjectFactory.class);
this.toComplex_cache = target.getReference(2, ToComplexData.class);
this.toComplex_asDoubleNode_ = PyFloatAsDoubleNodeGen.inline(InlineTarget.create(PyFloatAsDoubleNode.class, TO_COMPLEX__COERCE_TO_COMPLEX_NODE_TO_COMPLEX_STATE_0_UPDATER.subUpdater(0, 7), ReferenceField.create(ToComplexData.lookup_(), "toComplex_asDoubleNode__field1_", Node.class), ReferenceField.create(ToComplexData.lookup_(), "toComplex_asDoubleNode__field2_", Node.class)));
this.toComplex_raiseNode_ = LazyNodeGen.inline(InlineTarget.create(Lazy.class, TO_COMPLEX__COERCE_TO_COMPLEX_NODE_TO_COMPLEX_STATE_0_UPDATER.subUpdater(7, 1), ReferenceField.create(ToComplexData.lookup_(), "toComplex_raiseNode__field1_", Node.class)));
}
@Override
public PComplex execute(VirtualFrame frameValue, Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1111) != 0 /* is SpecializationActive[CoerceToComplexNode.doLong(long, PythonObjectFactory)] || SpecializationActive[CoerceToComplexNode.doDouble(double, PythonObjectFactory)] || SpecializationActive[CoerceToComplexNode.doComplex(PComplex)] || SpecializationActive[CoerceToComplexNode.toComplex(VirtualFrame, Node, Object, LookupAndCallUnaryNode, PyFloatAsDoubleNode, PythonObjectFactory, Lazy)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CoerceToComplexNode.doLong(long, PythonObjectFactory)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000) >>> 4 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000) >>> 4 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
{
PythonObjectFactory factory_ = this.factory.get(arg0Value);
if (factory_ != null) {
return CoerceToComplexNode.doLong(arg1Value_, factory_);
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CoerceToComplexNode.doDouble(double, PythonObjectFactory)] */ && PythonArithmeticTypesGen.isImplicitDouble((state_0 & 0b110000000) >>> 7 /* get-int ImplicitCast[type=double, index=1] */, arg1Value)) {
double arg1Value_ = PythonArithmeticTypesGen.asImplicitDouble((state_0 & 0b110000000) >>> 7 /* get-int ImplicitCast[type=double, index=1] */, arg1Value);
{
PythonObjectFactory factory_1 = this.factory.get(arg0Value);
if (factory_1 != null) {
return CoerceToComplexNode.doDouble(arg1Value_, factory_1);
}
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CoerceToComplexNode.doComplex(PComplex)] */ && arg1Value instanceof PComplex) {
PComplex arg1Value_ = (PComplex) arg1Value;
return CoerceToComplexNode.doComplex(arg1Value_);
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CoerceToComplexNode.toComplex(VirtualFrame, Node, Object, LookupAndCallUnaryNode, PyFloatAsDoubleNode, PythonObjectFactory, Lazy)] */) {
ToComplexData s3_ = this.toComplex_cache.get(arg0Value);
if (s3_ != null) {
{
PythonObjectFactory factory_2 = this.factory.get(arg0Value);
if (factory_2 != null) {
if ((!(PGuards.isPComplex(arg1Value)))) {
return CoerceToComplexNode.toComplex(frameValue, s3_, arg1Value, s3_.callComplexFunc_, this.toComplex_asDoubleNode_, factory_2, this.toComplex_raiseNode_);
}
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value, arg1Value);
}
private PComplex executeAndSpecialize(VirtualFrame frameValue, Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
{
int longCast1;
if ((longCast1 = PythonArithmeticTypesGen.specializeImplicitLong(arg1Value)) != 0) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(longCast1, arg1Value);
PythonObjectFactory factory_;
PythonObjectFactory factory__shared = this.factory.get(arg0Value);
if (factory__shared != null) {
factory_ = factory__shared;
} else {
factory_ = arg0Value.insert((PythonObjectFactory.create()));
if (factory_ == null) {
throw new IllegalStateException("Specialization 'doLong(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.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.factory.set(arg0Value, factory_);
}
state_0 = (state_0 | (longCast1 << 4) /* set-int ImplicitCast[type=long, index=1] */);
state_0 = state_0 | 0b1 /* add SpecializationActive[CoerceToComplexNode.doLong(long, PythonObjectFactory)] */;
this.state_0_.set(arg0Value, state_0);
return CoerceToComplexNode.doLong(arg1Value_, factory_);
}
}
{
int doubleCast1;
if ((doubleCast1 = PythonArithmeticTypesGen.specializeImplicitDouble(arg1Value)) != 0) {
double arg1Value_ = PythonArithmeticTypesGen.asImplicitDouble(doubleCast1, arg1Value);
PythonObjectFactory factory_1;
PythonObjectFactory factory_1_shared = this.factory.get(arg0Value);
if (factory_1_shared != null) {
factory_1 = factory_1_shared;
} else {
factory_1 = arg0Value.insert((PythonObjectFactory.create()));
if (factory_1 == null) {
throw new IllegalStateException("Specialization 'doDouble(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.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.factory.set(arg0Value, factory_1);
}
state_0 = (state_0 | (doubleCast1 << 7) /* set-int ImplicitCast[type=double, index=1] */);
state_0 = state_0 | 0b10 /* add SpecializationActive[CoerceToComplexNode.doDouble(double, PythonObjectFactory)] */;
this.state_0_.set(arg0Value, state_0);
return CoerceToComplexNode.doDouble(arg1Value_, factory_1);
}
}
if (arg1Value instanceof PComplex) {
PComplex arg1Value_ = (PComplex) arg1Value;
state_0 = state_0 | 0b100 /* add SpecializationActive[CoerceToComplexNode.doComplex(PComplex)] */;
this.state_0_.set(arg0Value, state_0);
return CoerceToComplexNode.doComplex(arg1Value_);
}
if ((!(PGuards.isPComplex(arg1Value)))) {
ToComplexData s3_ = arg0Value.insert(new ToComplexData());
LookupAndCallUnaryNode callComplexFunc__ = s3_.insert((LookupAndCallUnaryNode.create(SpecialMethodNames.T___COMPLEX__)));
Objects.requireNonNull(callComplexFunc__, "Specialization 'toComplex(VirtualFrame, Node, Object, LookupAndCallUnaryNode, PyFloatAsDoubleNode, PythonObjectFactory, Lazy)' cache 'callComplexFunc' 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'.");
s3_.callComplexFunc_ = callComplexFunc__;
PythonObjectFactory factory_2;
PythonObjectFactory factory_2_shared = this.factory.get(arg0Value);
if (factory_2_shared != null) {
factory_2 = factory_2_shared;
} else {
factory_2 = s3_.insert((PythonObjectFactory.create()));
if (factory_2 == null) {
throw new IllegalStateException("Specialization 'toComplex(VirtualFrame, Node, Object, LookupAndCallUnaryNode, PyFloatAsDoubleNode, PythonObjectFactory, Lazy)' 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.get(arg0Value) == null) {
this.factory.set(arg0Value, factory_2);
}
VarHandle.storeStoreFence();
this.toComplex_cache.set(arg0Value, s3_);
state_0 = state_0 | 0b1000 /* add SpecializationActive[CoerceToComplexNode.toComplex(VirtualFrame, Node, Object, LookupAndCallUnaryNode, PyFloatAsDoubleNode, PythonObjectFactory, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CoerceToComplexNode.toComplex(frameValue, s3_, arg1Value, callComplexFunc__, this.toComplex_asDoubleNode_, factory_2, this.toComplex_raiseNode_);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(CoerceToComplexNode.class)
@DenyReplace
private static final class ToComplexData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-6: InlinedCache
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
* 7: InlinedCache
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int toComplex_state_0_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link LookupAndCallUnaryNode} callComplexFunc
*/
@Child LookupAndCallUnaryNode callComplexFunc_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node toComplex_asDoubleNode__field1_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link PyFloatAsDoubleNode} asDoubleNode
* Inline method: {@link PyFloatAsDoubleNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node toComplex_asDoubleNode__field2_;
/**
* Source Info:
* Specialization: {@link CoerceToComplexNode#toComplex}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node toComplex_raiseNode__field1_;
ToComplexData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy