com.oracle.graal.python.nodes.util.CastToJavaUnsignedLongNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;
import com.oracle.graal.python.builtins.objects.ints.PInt;
import com.oracle.graal.python.nodes.PRaiseNode.Lazy;
import com.oracle.graal.python.nodes.PRaiseNodeGen.LazyNodeGen;
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypesGen;
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;
/**
* Debug Info:
* Specialization {@link CastToJavaUnsignedLongNode#toUnsignedLong(Node, long, Lazy)}
* Activation probability: 0.48333
* With/without class size: 11/0 bytes
* Specialization {@link CastToJavaUnsignedLongNode#toUnsignedLong(Node, PInt, Lazy)}
* Activation probability: 0.33333
* With/without class size: 9/0 bytes
* Specialization {@link CastToJavaUnsignedLongNode#doUnsupported}
* Activation probability: 0.18333
* With/without class size: 6/0 bytes
*
*/
@GeneratedBy(CastToJavaUnsignedLongNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class CastToJavaUnsignedLongNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static CastToJavaUnsignedLongNode getUncached() {
return CastToJavaUnsignedLongNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#raiseNode_field1_}
*
*/
@NeverDefault
public static CastToJavaUnsignedLongNode inline(@RequiredField(bits = 7, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new CastToJavaUnsignedLongNodeGen.Inlined(target);
}
@GeneratedBy(CastToJavaUnsignedLongNode.class)
@DenyReplace
private static final class Inlined extends CastToJavaUnsignedLongNode {
/**
* State Info:
* 0: SpecializationActive {@link CastToJavaUnsignedLongNode#toUnsignedLong(Node, long, Lazy)}
* 1: SpecializationActive {@link CastToJavaUnsignedLongNode#toUnsignedLong(Node, PInt, Lazy)}
* 2: SpecializationActive {@link CastToJavaUnsignedLongNode#doUnsupported}
* 3-5: ImplicitCast[type=long, index=1]
* 6: InlinedCache
* Specialization: {@link CastToJavaUnsignedLongNode#toUnsignedLong(Node, long, Lazy)}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField raiseNode_field1_;
/**
* Source Info:
* Specialization: {@link CastToJavaUnsignedLongNode#toUnsignedLong(Node, long, Lazy)}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy raiseNode;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(CastToJavaUnsignedLongNode.class);
this.state_0_ = target.getState(0, 7);
this.raiseNode_field1_ = target.getReference(1, Node.class);
this.raiseNode = LazyNodeGen.inline(InlineTarget.create(Lazy.class, state_0_.subUpdater(6, 1), raiseNode_field1_));
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) {
if (PythonArithmeticTypesGen.isImplicitLong(arg1Value)) {
return false;
}
if (!((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, PInt, Lazy)] */) && arg1Value instanceof PInt) {
return false;
}
return true;
}
@Override
public long execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b111) != 0 /* is SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, long, Lazy)] || SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, PInt, Lazy)] || SpecializationActive[CastToJavaUnsignedLongNode.doUnsupported(Node, Object, Lazy)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, long, Lazy)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b111000) >>> 3 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b111000) >>> 3 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
return CastToJavaUnsignedLongNode.toUnsignedLong(arg0Value, arg1Value_, this.raiseNode);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, PInt, Lazy)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaUnsignedLongNode.toUnsignedLong(arg0Value, arg1Value_, this.raiseNode);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CastToJavaUnsignedLongNode.doUnsupported(Node, Object, Lazy)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return CastToJavaUnsignedLongNode.doUnsupported(arg0Value, arg1Value, this.raiseNode);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private long executeAndSpecialize(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);
state_0 = (state_0 | (longCast1 << 3) /* set-int ImplicitCast[type=long, index=1] */);
state_0 = state_0 | 0b1 /* add SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, long, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaUnsignedLongNode.toUnsignedLong(arg0Value, arg1Value_, this.raiseNode);
}
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[CastToJavaUnsignedLongNode.toUnsignedLong(Node, PInt, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaUnsignedLongNode.toUnsignedLong(arg0Value, arg1Value_, this.raiseNode);
}
state_0 = state_0 | 0b100 /* add SpecializationActive[CastToJavaUnsignedLongNode.doUnsupported(Node, Object, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaUnsignedLongNode.doUnsupported(arg0Value, arg1Value, this.raiseNode);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(CastToJavaUnsignedLongNode.class)
@DenyReplace
private static final class Uncached extends CastToJavaUnsignedLongNode {
@TruffleBoundary
@Override
public long execute(Node arg0Value, Object arg1Value) {
if (PythonArithmeticTypesGen.isImplicitLong(arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(arg1Value);
return CastToJavaUnsignedLongNode.toUnsignedLong(arg0Value, arg1Value_, (Lazy.getUncached()));
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaUnsignedLongNode.toUnsignedLong(arg0Value, arg1Value_, (Lazy.getUncached()));
}
return CastToJavaUnsignedLongNode.doUnsupported(arg0Value, arg1Value, (Lazy.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy