com.oracle.graal.python.nodes.util.CastToJavaIntExactNodeGen 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.graal.python.util.OverflowException;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
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.dsl.InlineSupport.UnsafeAccessedField;
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;
/**
* Debug Info:
* Specialization {@link CastToJavaIntNode#toInt}
* Activation probability: 0.27381
* With/without class size: 7/0 bytes
* Specialization {@link CastToJavaIntExactNode#longToInt}
* Activation probability: 0.23095
* With/without class size: 6/0 bytes
* Specialization {@link CastToJavaIntExactNode#pIntToInt}
* Activation probability: 0.18810
* With/without class size: 6/0 bytes
* Specialization {@link CastToJavaIntExactNode#longToIntOverflow}
* Activation probability: 0.14524
* With/without class size: 6/0 bytes
* Specialization {@link CastToJavaIntExactNode#pIntToIntOverflow}
* Activation probability: 0.10238
* With/without class size: 5/0 bytes
* Specialization {@link CastToJavaIntNode#doUnsupported}
* Activation probability: 0.05952
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(CastToJavaIntExactNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class CastToJavaIntExactNodeGen extends CastToJavaIntExactNode {
private static final StateField STATE_0_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
/**
* Source Info:
* Specialization: {@link CastToJavaIntExactNode#longToIntOverflow}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private static final Lazy INLINED_RAISE = LazyNodeGen.inline(InlineTarget.create(Lazy.class, STATE_0_UPDATER.subUpdater(13, 1), ReferenceField.create(MethodHandles.lookup(), "raise_field1_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link CastToJavaIntNode#toInt}
* 1: SpecializationActive {@link CastToJavaIntExactNode#longToInt}
* 2: SpecializationExcluded {@link CastToJavaIntExactNode#longToInt}
* 3: SpecializationActive {@link CastToJavaIntExactNode#longToIntOverflow}
* 4: SpecializationActive {@link CastToJavaIntExactNode#pIntToInt}
* 5: SpecializationExcluded {@link CastToJavaIntExactNode#pIntToInt}
* 6: SpecializationActive {@link CastToJavaIntExactNode#pIntToIntOverflow}
* 7: SpecializationActive {@link CastToJavaIntNode#doUnsupported}
* 8-9: ImplicitCast[type=int, index=1]
* 10-12: ImplicitCast[type=long, index=1]
* 13: InlinedCache
* Specialization: {@link CastToJavaIntExactNode#longToIntOverflow}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link CastToJavaIntExactNode#longToIntOverflow}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node raise_field1_;
private CastToJavaIntExactNodeGen() {
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) {
if (PythonArithmeticTypesGen.isImplicitLong(arg1Value)) {
return false;
}
if (!((state_0 & 0b1000000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */) && arg1Value instanceof PInt) {
return false;
}
return true;
}
@Override
public int execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b11011011) != 0 /* is SpecializationActive[CastToJavaIntNode.toInt(int)] || SpecializationActive[CastToJavaIntExactNode.longToInt(long)] || SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] || SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] || SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] || SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaIntNode.toInt(int)] */ && PythonArithmeticTypesGen.isImplicitInteger((state_0 & 0b1100000000) >>> 8 /* get-int ImplicitCast[type=int, index=1] */, arg1Value)) {
int arg1Value_ = PythonArithmeticTypesGen.asImplicitInteger((state_0 & 0b1100000000) >>> 8 /* get-int ImplicitCast[type=int, index=1] */, arg1Value);
return CastToJavaIntNode.toInt(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
try {
return CastToJavaIntExactNode.longToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_;
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = state_0 | 0b100 /* add SpecializationExcluded */;
this.state_0_ = state_0;
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
try {
return CastToJavaIntExactNode.pIntToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_;
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_ = state_0;
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
return CastToJavaIntExactNode.longToIntOverflow(this, arg1Value_, INLINED_RAISE);
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaIntExactNode.pIntToIntOverflow(this, arg1Value_, INLINED_RAISE);
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return CastToJavaIntNode.doUnsupported(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
@Override
public int execute(Node arg0Value, long arg1Value) {
int state_0 = this.state_0_;
if ((state_0 & 0b10001010) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] || SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] || SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if ((state_0 & 0b1010) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] || SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */) {
try {
return CastToJavaIntExactNode.longToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_;
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = state_0 | 0b100 /* add SpecializationExcluded */;
this.state_0_ = state_0;
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */) {
return CastToJavaIntExactNode.longToIntOverflow(this, arg1Value_, INLINED_RAISE);
}
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return CastToJavaIntNode.doUnsupported(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private int executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
{
int intCast1;
if ((intCast1 = PythonArithmeticTypesGen.specializeImplicitInteger(arg1Value)) != 0) {
int arg1Value_ = PythonArithmeticTypesGen.asImplicitInteger(intCast1, arg1Value);
state_0 = (state_0 | (intCast1 << 8) /* set-int ImplicitCast[type=int, index=1] */);
state_0 = state_0 | 0b1 /* add SpecializationActive[CastToJavaIntNode.toInt(int)] */;
this.state_0_ = state_0;
return CastToJavaIntNode.toInt(arg1Value_);
}
}
if (((state_0 & 0b1000)) == 0 /* is-not SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */ && ((state_0 & 0b100)) == 0 /* is-not SpecializationExcluded */) {
int longCast1;
if ((longCast1 = PythonArithmeticTypesGen.specializeImplicitLong(arg1Value)) != 0) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(longCast1, arg1Value);
state_0 = (state_0 | (longCast1 << 10) /* set-int ImplicitCast[type=long, index=1] */);
state_0 = state_0 | 0b10 /* add SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
this.state_0_ = state_0;
try {
return CastToJavaIntExactNode.longToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_;
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = state_0 | 0b100 /* add SpecializationExcluded */;
this.state_0_ = state_0;
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
}
if (((state_0 & 0b1000000)) == 0 /* is-not SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */ && ((state_0 & 0b100000)) == 0 /* is-not SpecializationExcluded */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 | 0b10000 /* add SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
this.state_0_ = state_0;
try {
return CastToJavaIntExactNode.pIntToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_;
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_ = state_0;
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
{
int longCast1;
if ((longCast1 = PythonArithmeticTypesGen.specializeImplicitLong(arg1Value)) != 0) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(longCast1, arg1Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = (state_0 | (longCast1 << 10) /* set-int ImplicitCast[type=long, index=1] */);
state_0 = state_0 | 0b1000 /* add SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */;
this.state_0_ = state_0;
return CastToJavaIntExactNode.longToIntOverflow(this, arg1Value_, INLINED_RAISE);
}
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
state_0 = state_0 | 0b1000000 /* add SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */;
this.state_0_ = state_0;
return CastToJavaIntExactNode.pIntToIntOverflow(this, arg1Value_, INLINED_RAISE);
}
state_0 = state_0 | 0b10000000 /* add SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */;
this.state_0_ = state_0;
return CastToJavaIntNode.doUnsupported(arg1Value);
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if ((state_0 & 0b11011011) == 0) {
return NodeCost.UNINITIALIZED;
} else {
if (((state_0 & 0b11011011) & ((state_0 & 0b11011011) - 1)) == 0 /* is-single */) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static CastToJavaIntExactNode create() {
return new CastToJavaIntExactNodeGen();
}
@NeverDefault
public static CastToJavaIntExactNode getUncached() {
return CastToJavaIntExactNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#raise_field1_}
*
*/
@NeverDefault
public static CastToJavaIntExactNode inline(@RequiredField(bits = 14, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new CastToJavaIntExactNodeGen.Inlined(target);
}
@GeneratedBy(CastToJavaIntExactNode.class)
@DenyReplace
private static final class Inlined extends CastToJavaIntExactNode {
/**
* State Info:
* 0: SpecializationActive {@link CastToJavaIntNode#toInt}
* 1: SpecializationActive {@link CastToJavaIntExactNode#longToInt}
* 2: SpecializationExcluded {@link CastToJavaIntExactNode#longToInt}
* 3: SpecializationActive {@link CastToJavaIntExactNode#longToIntOverflow}
* 4: SpecializationActive {@link CastToJavaIntExactNode#pIntToInt}
* 5: SpecializationExcluded {@link CastToJavaIntExactNode#pIntToInt}
* 6: SpecializationActive {@link CastToJavaIntExactNode#pIntToIntOverflow}
* 7: SpecializationActive {@link CastToJavaIntNode#doUnsupported}
* 8-9: ImplicitCast[type=int, index=1]
* 10-12: ImplicitCast[type=long, index=1]
* 13: InlinedCache
* Specialization: {@link CastToJavaIntExactNode#longToIntOverflow}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField raise_field1_;
/**
* Source Info:
* Specialization: {@link CastToJavaIntExactNode#longToIntOverflow}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy raise;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(CastToJavaIntExactNode.class);
this.state_0_ = target.getState(0, 14);
this.raise_field1_ = target.getReference(1, Node.class);
this.raise = LazyNodeGen.inline(InlineTarget.create(Lazy.class, state_0_.subUpdater(13, 1), raise_field1_));
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) {
if (PythonArithmeticTypesGen.isImplicitLong(arg1Value)) {
return false;
}
if (!((state_0 & 0b1000000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */) && arg1Value instanceof PInt) {
return false;
}
return true;
}
@Override
public int execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b11011011) != 0 /* is SpecializationActive[CastToJavaIntNode.toInt(int)] || SpecializationActive[CastToJavaIntExactNode.longToInt(long)] || SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] || SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] || SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] || SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaIntNode.toInt(int)] */ && PythonArithmeticTypesGen.isImplicitInteger((state_0 & 0b1100000000) >>> 8 /* get-int ImplicitCast[type=int, index=1] */, arg1Value)) {
int arg1Value_ = PythonArithmeticTypesGen.asImplicitInteger((state_0 & 0b1100000000) >>> 8 /* get-int ImplicitCast[type=int, index=1] */, arg1Value);
return CastToJavaIntNode.toInt(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
try {
return CastToJavaIntExactNode.longToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = state_0 | 0b100 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
try {
return CastToJavaIntExactNode.pIntToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
return CastToJavaIntExactNode.longToIntOverflow(arg0Value, arg1Value_, this.raise);
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaIntExactNode.pIntToIntOverflow(arg0Value, arg1Value_, this.raise);
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return CastToJavaIntNode.doUnsupported(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
@Override
public int execute(Node arg0Value, long arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b10001010) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] || SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] || SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if ((state_0 & 0b1010) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] || SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */ && PythonArithmeticTypesGen.isImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong((state_0 & 0b1110000000000) >>> 10 /* get-int ImplicitCast[type=long, index=1] */, arg1Value);
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */) {
try {
return CastToJavaIntExactNode.longToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = state_0 | 0b100 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */) {
return CastToJavaIntExactNode.longToIntOverflow(arg0Value, arg1Value_, this.raise);
}
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return CastToJavaIntNode.doUnsupported(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private int executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
{
int intCast1;
if ((intCast1 = PythonArithmeticTypesGen.specializeImplicitInteger(arg1Value)) != 0) {
int arg1Value_ = PythonArithmeticTypesGen.asImplicitInteger(intCast1, arg1Value);
state_0 = (state_0 | (intCast1 << 8) /* set-int ImplicitCast[type=int, index=1] */);
state_0 = state_0 | 0b1 /* add SpecializationActive[CastToJavaIntNode.toInt(int)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaIntNode.toInt(arg1Value_);
}
}
if (((state_0 & 0b1000)) == 0 /* is-not SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */ && ((state_0 & 0b100)) == 0 /* is-not SpecializationExcluded */) {
int longCast1;
if ((longCast1 = PythonArithmeticTypesGen.specializeImplicitLong(arg1Value)) != 0) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(longCast1, arg1Value);
state_0 = (state_0 | (longCast1 << 10) /* set-int ImplicitCast[type=long, index=1] */);
state_0 = state_0 | 0b10 /* add SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
this.state_0_.set(arg0Value, state_0);
try {
return CastToJavaIntExactNode.longToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = state_0 | 0b100 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
}
if (((state_0 & 0b1000000)) == 0 /* is-not SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */ && ((state_0 & 0b100000)) == 0 /* is-not SpecializationExcluded */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 | 0b10000 /* add SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
this.state_0_.set(arg0Value, state_0);
try {
return CastToJavaIntExactNode.pIntToInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
{
int longCast1;
if ((longCast1 = PythonArithmeticTypesGen.specializeImplicitLong(arg1Value)) != 0) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(longCast1, arg1Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaIntExactNode.longToInt(long)] */;
state_0 = (state_0 | (longCast1 << 10) /* set-int ImplicitCast[type=long, index=1] */);
state_0 = state_0 | 0b1000 /* add SpecializationActive[CastToJavaIntExactNode.longToIntOverflow(Node, long, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaIntExactNode.longToIntOverflow(arg0Value, arg1Value_, this.raise);
}
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaIntExactNode.pIntToInt(PInt)] */;
state_0 = state_0 | 0b1000000 /* add SpecializationActive[CastToJavaIntExactNode.pIntToIntOverflow(Node, PInt, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaIntExactNode.pIntToIntOverflow(arg0Value, arg1Value_, this.raise);
}
state_0 = state_0 | 0b10000000 /* add SpecializationActive[CastToJavaIntNode.doUnsupported(Object)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaIntNode.doUnsupported(arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(CastToJavaIntExactNode.class)
@DenyReplace
private static final class Uncached extends CastToJavaIntExactNode {
@TruffleBoundary
@Override
public int execute(Node arg0Value, Object arg1Value) {
if (PythonArithmeticTypesGen.isImplicitInteger(arg1Value)) {
int arg1Value_ = PythonArithmeticTypesGen.asImplicitInteger(arg1Value);
return CastToJavaIntNode.toInt(arg1Value_);
}
if (PythonArithmeticTypesGen.isImplicitLong(arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(arg1Value);
return CastToJavaIntExactNode.longToIntOverflow(arg0Value, arg1Value_, (Lazy.getUncached()));
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaIntExactNode.pIntToIntOverflow(arg0Value, arg1Value_, (Lazy.getUncached()));
}
return CastToJavaIntNode.doUnsupported(arg1Value);
}
@TruffleBoundary
@Override
public int execute(Node arg0Value, long arg1Value) {
if (PythonArithmeticTypesGen.isImplicitLong(arg1Value)) {
long arg1Value_ = PythonArithmeticTypesGen.asImplicitLong(arg1Value);
return CastToJavaIntExactNode.longToIntOverflow(arg0Value, arg1Value_, (Lazy.getUncached()));
}
return CastToJavaIntNode.doUnsupported(arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy