com.oracle.graal.python.nodes.util.CastToJavaByteNodeGen 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.util.OverflowException;
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.UnsupportedSpecializationException;
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 CastToJavaByteNode#fromByte}
* Activation probability: 0.23929
* With/without class size: 6/0 bytes
* Specialization {@link CastToJavaByteNode#fromInt}
* Activation probability: 0.20714
* With/without class size: 6/0 bytes
* Specialization {@link CastToJavaByteNode#fromLong}
* Activation probability: 0.17500
* With/without class size: 6/0 bytes
* Specialization {@link CastToJavaByteNode#fromPInt}
* Activation probability: 0.14286
* With/without class size: 5/0 bytes
* Specialization {@link CastToJavaByteNode#fromIntErr}
* Activation probability: 0.11071
* With/without class size: 5/0 bytes
* Specialization {@link CastToJavaByteNode#fromLongErr}
* Activation probability: 0.07857
* With/without class size: 5/0 bytes
* Specialization {@link CastToJavaByteNode#fromPIntErr}
* Activation probability: 0.04643
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(CastToJavaByteNode.class)
@SuppressWarnings("javadoc")
public final class CastToJavaByteNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static CastToJavaByteNode getUncached() {
return CastToJavaByteNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#raiseNode_field1_}
*
*/
@NeverDefault
public static CastToJavaByteNode inline(@RequiredField(bits = 11, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new CastToJavaByteNodeGen.Inlined(target);
}
@GeneratedBy(CastToJavaByteNode.class)
@DenyReplace
private static final class Inlined extends CastToJavaByteNode {
/**
* State Info:
* 0: SpecializationActive {@link CastToJavaByteNode#fromByte}
* 1: SpecializationActive {@link CastToJavaByteNode#fromInt}
* 2: SpecializationExcluded {@link CastToJavaByteNode#fromInt}
* 3: SpecializationActive {@link CastToJavaByteNode#fromIntErr}
* 4: SpecializationActive {@link CastToJavaByteNode#fromLong}
* 5: SpecializationExcluded {@link CastToJavaByteNode#fromLong}
* 6: SpecializationActive {@link CastToJavaByteNode#fromLongErr}
* 7: SpecializationActive {@link CastToJavaByteNode#fromPInt}
* 8: SpecializationExcluded {@link CastToJavaByteNode#fromPInt}
* 9: SpecializationActive {@link CastToJavaByteNode#fromPIntErr}
* 10: InlinedCache
* Specialization: {@link CastToJavaByteNode#fromIntErr}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField raiseNode_field1_;
/**
* Source Info:
* Specialization: {@link CastToJavaByteNode#fromIntErr}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy raiseNode;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(CastToJavaByteNode.class);
this.state_0_ = target.getState(0, 11);
this.raiseNode_field1_ = target.getReference(1, Node.class);
this.raiseNode = LazyNodeGen.inline(InlineTarget.create(Lazy.class, state_0_.subUpdater(10, 1), raiseNode_field1_));
}
@Override
public byte execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1011011011) != 0 /* is SpecializationActive[CastToJavaByteNode.fromByte(byte)] || SpecializationActive[CastToJavaByteNode.fromInt(int)] || SpecializationActive[CastToJavaByteNode.fromLong(long)] || SpecializationActive[CastToJavaByteNode.fromPInt(PInt)] || SpecializationActive[CastToJavaByteNode.fromIntErr(Node, int, Lazy)] || SpecializationActive[CastToJavaByteNode.fromLongErr(Node, long, Lazy)] || SpecializationActive[CastToJavaByteNode.fromPIntErr(Node, PInt, Lazy)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaByteNode.fromByte(byte)] */ && arg1Value instanceof Byte) {
byte arg1Value_ = (byte) arg1Value;
return CastToJavaByteNode.fromByte(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaByteNode.fromInt(int)] */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
try {
return CastToJavaByteNode.fromInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaByteNode.fromInt(int)] */;
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[CastToJavaByteNode.fromLong(long)] */ && arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
try {
return CastToJavaByteNode.fromLong(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaByteNode.fromLong(long)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b10000000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromPInt(PInt)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
try {
return CastToJavaByteNode.fromPInt(arg1Value_);
} catch (ArithmeticException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffff7f /* remove SpecializationActive[CastToJavaByteNode.fromPInt(PInt)] */;
state_0 = state_0 | 0b100000000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromIntErr(Node, int, Lazy)] */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
return CastToJavaByteNode.fromIntErr(arg0Value, arg1Value_, this.raiseNode);
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromLongErr(Node, long, Lazy)] */ && arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
return CastToJavaByteNode.fromLongErr(arg0Value, arg1Value_, this.raiseNode);
}
if ((state_0 & 0b1000000000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromPIntErr(Node, PInt, Lazy)] */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaByteNode.fromPIntErr(arg0Value, arg1Value_, this.raiseNode);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
@Override
public byte execute(Node arg0Value, byte arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToJavaByteNode.fromByte(byte)] */) {
return CastToJavaByteNode.fromByte(arg1Value);
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
@Override
public byte execute(Node arg0Value, int arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1010) != 0 /* is SpecializationActive[CastToJavaByteNode.fromInt(int)] || SpecializationActive[CastToJavaByteNode.fromIntErr(Node, int, Lazy)] */) {
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToJavaByteNode.fromInt(int)] */) {
try {
return CastToJavaByteNode.fromInt(arg1Value);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaByteNode.fromInt(int)] */;
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[CastToJavaByteNode.fromIntErr(Node, int, Lazy)] */) {
return CastToJavaByteNode.fromIntErr(arg0Value, arg1Value, this.raiseNode);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
@Override
public byte execute(Node arg0Value, long arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1010000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromLong(long)] || SpecializationActive[CastToJavaByteNode.fromLongErr(Node, long, Lazy)] */) {
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromLong(long)] */) {
try {
return CastToJavaByteNode.fromLong(arg1Value);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaByteNode.fromLong(long)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value);
}
}
if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[CastToJavaByteNode.fromLongErr(Node, long, Lazy)] */) {
return CastToJavaByteNode.fromLongErr(arg0Value, arg1Value, this.raiseNode);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private byte executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof Byte) {
byte arg1Value_ = (byte) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[CastToJavaByteNode.fromByte(byte)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaByteNode.fromByte(arg1Value_);
}
if (((state_0 & 0b1000)) == 0 /* is-not SpecializationActive[CastToJavaByteNode.fromIntErr(Node, int, Lazy)] */ && ((state_0 & 0b100)) == 0 /* is-not SpecializationExcluded */ && arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[CastToJavaByteNode.fromInt(int)] */;
this.state_0_.set(arg0Value, state_0);
try {
return CastToJavaByteNode.fromInt(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaByteNode.fromInt(int)] */;
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[CastToJavaByteNode.fromLongErr(Node, long, Lazy)] */ && ((state_0 & 0b100000)) == 0 /* is-not SpecializationExcluded */ && arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
state_0 = state_0 | 0b10000 /* add SpecializationActive[CastToJavaByteNode.fromLong(long)] */;
this.state_0_.set(arg0Value, state_0);
try {
return CastToJavaByteNode.fromLong(arg1Value_);
} catch (OverflowException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaByteNode.fromLong(long)] */;
state_0 = state_0 | 0b100000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if (((state_0 & 0b1000000000)) == 0 /* is-not SpecializationActive[CastToJavaByteNode.fromPIntErr(Node, PInt, Lazy)] */ && ((state_0 & 0b100000000)) == 0 /* is-not SpecializationExcluded */ && arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 | 0b10000000 /* add SpecializationActive[CastToJavaByteNode.fromPInt(PInt)] */;
this.state_0_.set(arg0Value, state_0);
try {
return CastToJavaByteNode.fromPInt(arg1Value_);
} catch (ArithmeticException ex) {
CompilerDirectives.transferToInterpreterAndInvalidate();
state_0 = this.state_0_.get(arg0Value);
state_0 = state_0 & 0xffffff7f /* remove SpecializationActive[CastToJavaByteNode.fromPInt(PInt)] */;
state_0 = state_0 | 0b100000000 /* add SpecializationExcluded */;
this.state_0_.set(arg0Value, state_0);
return executeAndSpecialize(arg0Value, arg1Value_);
}
}
if (arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[CastToJavaByteNode.fromInt(int)] */;
state_0 = state_0 | 0b1000 /* add SpecializationActive[CastToJavaByteNode.fromIntErr(Node, int, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaByteNode.fromIntErr(arg0Value, arg1Value_, this.raiseNode);
}
if (arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
state_0 = state_0 & 0xffffffef /* remove SpecializationActive[CastToJavaByteNode.fromLong(long)] */;
state_0 = state_0 | 0b1000000 /* add SpecializationActive[CastToJavaByteNode.fromLongErr(Node, long, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaByteNode.fromLongErr(arg0Value, arg1Value_, this.raiseNode);
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
state_0 = state_0 & 0xffffff7f /* remove SpecializationActive[CastToJavaByteNode.fromPInt(PInt)] */;
state_0 = state_0 | 0b1000000000 /* add SpecializationActive[CastToJavaByteNode.fromPIntErr(Node, PInt, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
return CastToJavaByteNode.fromPIntErr(arg0Value, arg1Value_, this.raiseNode);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(CastToJavaByteNode.class)
@DenyReplace
private static final class Uncached extends CastToJavaByteNode {
@TruffleBoundary
@Override
public byte execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof Byte) {
byte arg1Value_ = (byte) arg1Value;
return CastToJavaByteNode.fromByte(arg1Value_);
}
if (arg1Value instanceof Integer) {
int arg1Value_ = (int) arg1Value;
return CastToJavaByteNode.fromIntErr(arg0Value, arg1Value_, (Lazy.getUncached()));
}
if (arg1Value instanceof Long) {
long arg1Value_ = (long) arg1Value;
return CastToJavaByteNode.fromLongErr(arg0Value, arg1Value_, (Lazy.getUncached()));
}
if (arg1Value instanceof PInt) {
PInt arg1Value_ = (PInt) arg1Value;
return CastToJavaByteNode.fromPIntErr(arg0Value, arg1Value_, (Lazy.getUncached()));
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@TruffleBoundary
@Override
public byte execute(Node arg0Value, byte arg1Value) {
return CastToJavaByteNode.fromByte(arg1Value);
}
@TruffleBoundary
@Override
public byte execute(Node arg0Value, int arg1Value) {
return CastToJavaByteNode.fromIntErr(arg0Value, arg1Value, (Lazy.getUncached()));
}
@TruffleBoundary
@Override
public byte execute(Node arg0Value, long arg1Value) {
return CastToJavaByteNode.fromLongErr(arg0Value, arg1Value, (Lazy.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy