com.oracle.graal.python.lib.PyObjectStrAsTruffleStringNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.nodes.util.CastToTruffleStringNode;
import com.oracle.graal.python.nodes.util.CastToTruffleStringNodeGen;
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.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.Frame;
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 com.oracle.truffle.api.strings.TruffleString;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
/**
* Debug Info:
* Specialization {@link PyObjectStrAsTruffleStringNode#doString}
* Activation probability: 0.65000
* With/without class size: 11/0 bytes
* Specialization {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Activation probability: 0.35000
* With/without class size: 18/22 bytes
*
*/
@GeneratedBy(PyObjectStrAsTruffleStringNode.class)
@SuppressWarnings("javadoc")
public final class PyObjectStrAsTruffleStringNodeGen {
private static final StateField GENERIC__PY_OBJECT_STR_AS_TRUFFLE_STRING_NODE_GENERIC_STATE_0_UPDATER = StateField.create(GenericData.lookup_(), "generic_state_0_");
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static PyObjectStrAsTruffleStringNode getUncached() {
return PyObjectStrAsTruffleStringNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#generic_cache}
*
*/
@NeverDefault
public static PyObjectStrAsTruffleStringNode inline(@RequiredField(bits = 2, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PyObjectStrAsTruffleStringNodeGen.Inlined(target);
}
@GeneratedBy(PyObjectStrAsTruffleStringNode.class)
@DenyReplace
private static final class Inlined extends PyObjectStrAsTruffleStringNode {
/**
* State Info:
* 0: SpecializationActive {@link PyObjectStrAsTruffleStringNode#doString}
* 1: SpecializationActive {@link PyObjectStrAsTruffleStringNode#doGeneric}
*
*/
private final StateField state_0_;
private final ReferenceField generic_cache;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link PyObjectStrAsObjectNode} strNode
* Inline method: {@link PyObjectStrAsObjectNodeGen#inline}
*/
private final PyObjectStrAsObjectNode generic_strNode_;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link CastToTruffleStringNode} castToString
* Inline method: {@link CastToTruffleStringNodeGen#inline}
*/
private final CastToTruffleStringNode generic_castToString_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PyObjectStrAsTruffleStringNode.class);
this.state_0_ = target.getState(0, 2);
this.generic_cache = target.getReference(1, GenericData.class);
this.generic_strNode_ = PyObjectStrAsObjectNodeGen.inline(InlineTarget.create(PyObjectStrAsObjectNode.class, GENERIC__PY_OBJECT_STR_AS_TRUFFLE_STRING_NODE_GENERIC_STATE_0_UPDATER.subUpdater(0, 4), ReferenceField.create(GenericData.lookup_(), "generic_strNode__field1_", Node.class), ReferenceField.create(GenericData.lookup_(), "generic_strNode__field2_", Node.class)));
this.generic_castToString_ = CastToTruffleStringNodeGen.inline(InlineTarget.create(CastToTruffleStringNode.class, GENERIC__PY_OBJECT_STR_AS_TRUFFLE_STRING_NODE_GENERIC_STATE_0_UPDATER.subUpdater(4, 8), ReferenceField.create(GenericData.lookup_(), "generic_castToString__field1_", Node.class), ReferenceField.create(GenericData.lookup_(), "generic_castToString__field2_", Node.class), ReferenceField.create(GenericData.lookup_(), "generic_castToString__field3_", Node.class)));
}
@Override
public TruffleString execute(Frame frameValue, Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[PyObjectStrAsTruffleStringNode.doString(TruffleString)] || SpecializationActive[PyObjectStrAsTruffleStringNode.doGeneric(VirtualFrame, Node, Object, PyObjectStrAsObjectNode, CastToTruffleStringNode)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyObjectStrAsTruffleStringNode.doString(TruffleString)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return PyObjectStrAsTruffleStringNode.doString(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyObjectStrAsTruffleStringNode.doGeneric(VirtualFrame, Node, Object, PyObjectStrAsObjectNode, CastToTruffleStringNode)] */) {
GenericData s1_ = this.generic_cache.get(arg0Value);
if (s1_ != null) {
return PyObjectStrAsTruffleStringNode.doGeneric((VirtualFrame) frameValue, s1_, arg1Value, this.generic_strNode_, this.generic_castToString_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value, arg1Value);
}
private TruffleString executeAndSpecialize(Frame frameValue, 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[PyObjectStrAsTruffleStringNode.doString(TruffleString)] */;
this.state_0_.set(arg0Value, state_0);
return PyObjectStrAsTruffleStringNode.doString(arg1Value_);
}
GenericData s1_ = arg0Value.insert(new GenericData());
VarHandle.storeStoreFence();
this.generic_cache.set(arg0Value, s1_);
state_0 = state_0 | 0b10 /* add SpecializationActive[PyObjectStrAsTruffleStringNode.doGeneric(VirtualFrame, Node, Object, PyObjectStrAsObjectNode, CastToTruffleStringNode)] */;
this.state_0_.set(arg0Value, state_0);
return PyObjectStrAsTruffleStringNode.doGeneric((VirtualFrame) frameValue, s1_, arg1Value, this.generic_strNode_, this.generic_castToString_);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PyObjectStrAsTruffleStringNode.class)
@DenyReplace
private static final class GenericData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-3: InlinedCache
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link PyObjectStrAsObjectNode} strNode
* Inline method: {@link PyObjectStrAsObjectNodeGen#inline}
* 4-11: InlinedCache
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link CastToTruffleStringNode} castToString
* Inline method: {@link CastToTruffleStringNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int generic_state_0_;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link PyObjectStrAsObjectNode} strNode
* Inline method: {@link PyObjectStrAsObjectNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_strNode__field1_;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link PyObjectStrAsObjectNode} strNode
* Inline method: {@link PyObjectStrAsObjectNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_strNode__field2_;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link CastToTruffleStringNode} castToString
* Inline method: {@link CastToTruffleStringNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_castToString__field1_;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link CastToTruffleStringNode} castToString
* Inline method: {@link CastToTruffleStringNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_castToString__field2_;
/**
* Source Info:
* Specialization: {@link PyObjectStrAsTruffleStringNode#doGeneric}
* Parameter: {@link CastToTruffleStringNode} castToString
* Inline method: {@link CastToTruffleStringNodeGen#inline}
* Inline field: {@link Node} field3
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node generic_castToString__field3_;
GenericData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(PyObjectStrAsTruffleStringNode.class)
@DenyReplace
private static final class Uncached extends PyObjectStrAsTruffleStringNode {
@Override
public TruffleString execute(Frame frameValue, Node arg0Value, Object arg1Value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return PyObjectStrAsTruffleStringNode.doString(arg1Value_);
}
return PyObjectStrAsTruffleStringNode.doGeneric((VirtualFrame) frameValue, arg0Value, arg1Value, (PyObjectStrAsObjectNode.getUncached()), (CastToTruffleStringNode.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy