com.oracle.graal.python.nodes.util.CastBuiltinStringToTruffleStringNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;
import com.oracle.graal.python.builtins.objects.str.PString;
import com.oracle.graal.python.builtins.objects.str.StringNodes.StringMaterializeNode;
import com.oracle.graal.python.builtins.objects.str.StringNodesFactory.StringMaterializeNodeGen;
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.InlineSupport;
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;
import com.oracle.truffle.api.strings.TruffleString;
/**
* Debug Info:
* Specialization {@link CastBuiltinStringToTruffleStringNode#doTruffleString}
* Activation probability: 0.48333
* With/without class size: 9/0 bytes
* Specialization {@link CastBuiltinStringToTruffleStringNode#doPStringMaterialized}
* Activation probability: 0.33333
* With/without class size: 8/0 bytes
* Specialization {@link CastBuiltinStringToTruffleStringNode#doPStringGeneric}
* Activation probability: 0.18333
* With/without class size: 9/9 bytes
*
*/
@GeneratedBy(CastBuiltinStringToTruffleStringNode.class)
@SuppressWarnings("javadoc")
public final class CastBuiltinStringToTruffleStringNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static CastBuiltinStringToTruffleStringNode getUncached() {
return CastBuiltinStringToTruffleStringNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#pStringGeneric_materializeNode__field1_}
*
- {@link Inlined#pStringGeneric_materializeNode__field2_}
*
*/
@NeverDefault
public static CastBuiltinStringToTruffleStringNode inline(@RequiredField(bits = 6, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new CastBuiltinStringToTruffleStringNodeGen.Inlined(target);
}
@GeneratedBy(CastBuiltinStringToTruffleStringNode.class)
@DenyReplace
private static final class Inlined extends CastBuiltinStringToTruffleStringNode {
/**
* State Info:
* 0: SpecializationActive {@link CastBuiltinStringToTruffleStringNode#doTruffleString}
* 1: SpecializationActive {@link CastBuiltinStringToTruffleStringNode#doPStringMaterialized}
* 2: SpecializationActive {@link CastBuiltinStringToTruffleStringNode#doPStringGeneric}
* 3-5: InlinedCache
* Specialization: {@link CastBuiltinStringToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField pStringGeneric_materializeNode__field1_;
private final ReferenceField pStringGeneric_materializeNode__field2_;
/**
* Source Info:
* Specialization: {@link CastBuiltinStringToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
*/
private final StringMaterializeNode pStringGeneric_materializeNode_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(CastBuiltinStringToTruffleStringNode.class);
this.state_0_ = target.getState(0, 6);
this.pStringGeneric_materializeNode__field1_ = target.getReference(1, Node.class);
this.pStringGeneric_materializeNode__field2_ = target.getReference(2, Node.class);
this.pStringGeneric_materializeNode_ = StringMaterializeNodeGen.inline(InlineTarget.create(StringMaterializeNode.class, state_0_.subUpdater(3, 3), pStringGeneric_materializeNode__field1_, pStringGeneric_materializeNode__field2_));
}
@Override
public TruffleString execute(Node arg0Value, Object arg1Value) throws CannotCastException {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b111) != 0 /* is SpecializationActive[CastBuiltinStringToTruffleStringNode.doTruffleString(TruffleString)] || SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringMaterialized(PString)] || SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastBuiltinStringToTruffleStringNode.doTruffleString(TruffleString)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return CastBuiltinStringToTruffleStringNode.doTruffleString(arg1Value_);
}
if ((state_0 & 0b110) != 0 /* is SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringMaterialized(PString)] || SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */ && arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringMaterialized(PString)] */) {
if ((arg1Value_.isMaterialized())) {
return CastBuiltinStringToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */) {
if ((!(arg1Value_.isMaterialized()))) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.pStringGeneric_materializeNode__field1_, this.pStringGeneric_materializeNode__field2_);
return CastBuiltinStringToTruffleStringNode.doPStringGeneric(arg0Value, arg1Value_, this.pStringGeneric_materializeNode_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private TruffleString executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[CastBuiltinStringToTruffleStringNode.doTruffleString(TruffleString)] */;
this.state_0_.set(arg0Value, state_0);
return CastBuiltinStringToTruffleStringNode.doTruffleString(arg1Value_);
}
if (arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((arg1Value_.isMaterialized())) {
state_0 = state_0 | 0b10 /* add SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringMaterialized(PString)] */;
this.state_0_.set(arg0Value, state_0);
return CastBuiltinStringToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
if ((!(arg1Value_.isMaterialized()))) {
state_0 = state_0 | 0b100 /* add SpecializationActive[CastBuiltinStringToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */;
this.state_0_.set(arg0Value, state_0);
assert InlineSupport.validate(arg0Value, this.state_0_, this.pStringGeneric_materializeNode__field1_, this.pStringGeneric_materializeNode__field2_);
return CastBuiltinStringToTruffleStringNode.doPStringGeneric(arg0Value, arg1Value_, this.pStringGeneric_materializeNode_);
}
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(CastBuiltinStringToTruffleStringNode.class)
@DenyReplace
private static final class Uncached extends CastBuiltinStringToTruffleStringNode {
@TruffleBoundary
@Override
public TruffleString execute(Node arg0Value, Object arg1Value) throws CannotCastException {
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return CastBuiltinStringToTruffleStringNode.doTruffleString(arg1Value_);
}
if (arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((arg1Value_.isMaterialized())) {
return CastBuiltinStringToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
if ((!(arg1Value_.isMaterialized()))) {
return CastBuiltinStringToTruffleStringNode.doPStringGeneric(arg0Value, arg1Value_, (StringMaterializeNodeGen.getUncached()));
}
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy