com.oracle.graal.python.nodes.util.CastToTruffleStringNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;
import com.oracle.graal.python.builtins.objects.cext.PythonNativeObject;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccess.ReadByteNode;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccess.ReadI32Node;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccess.ReadI64Node;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccess.ReadPointerNode;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccessFactory.ReadByteNodeGen;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccessFactory.ReadI32NodeGen;
import com.oracle.graal.python.builtins.objects.cext.structs.CStructAccessFactory.ReadPointerNodeGen;
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.graal.python.nodes.PGuards;
import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
import com.oracle.graal.python.nodes.object.GetClassNode;
import com.oracle.graal.python.nodes.object.GetClassNodeGen;
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.InlineSupport;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
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.interop.InteropLibrary;
import com.oracle.truffle.api.library.LibraryFactory;
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 com.oracle.truffle.api.strings.TruffleString.FromByteArrayNode;
import com.oracle.truffle.api.strings.TruffleString.FromNativePointerNode;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link CastToTruffleStringNode#doTruffleString}
* Activation probability: 0.32000
* With/without class size: 7/0 bytes
* Specialization {@link CastToTruffleStringNode#doPStringMaterialized}
* Activation probability: 0.26000
* With/without class size: 7/0 bytes
* Specialization {@link CastToTruffleStringNode#doPStringGeneric}
* Activation probability: 0.20000
* With/without class size: 9/9 bytes
* Specialization {@link CastToTruffleStringNode#doNativeObject}
* Activation probability: 0.14000
* With/without class size: 8/15 bytes
* Specialization {@link CastToTruffleStringNode#doUnsupported}
* Activation probability: 0.08000
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(CastToTruffleStringNode.class)
@SuppressWarnings("javadoc")
public final class CastToTruffleStringNodeGen extends CastToTruffleStringNode {
private static final StateField STATE_0_CastToTruffleStringNode_UPDATER = StateField.create(MethodHandles.lookup(), "state_0_");
private static final StateField NATIVE_OBJECT__CAST_TO_TRUFFLE_STRING_NODE_NATIVE_OBJECT_STATE_0_UPDATER = StateField.create(NativeObjectData.lookup_(), "nativeObject_state_0_");
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
*/
private static final StringMaterializeNode INLINED_P_STRING_GENERIC_MATERIALIZE_NODE_ = StringMaterializeNodeGen.inline(InlineTarget.create(StringMaterializeNode.class, STATE_0_CastToTruffleStringNode_UPDATER.subUpdater(5, 3), ReferenceField.create(MethodHandles.lookup(), "pStringGeneric_materializeNode__field1_", Node.class), ReferenceField.create(MethodHandles.lookup(), "pStringGeneric_materializeNode__field2_", Node.class)));
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doNativeObject}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private static final GetClassNode INLINED_NATIVE_OBJECT_GET_CLASS_NODE_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, NATIVE_OBJECT__CAST_TO_TRUFFLE_STRING_NODE_NATIVE_OBJECT_STATE_0_UPDATER.subUpdater(0, 17), ReferenceField.create(NativeObjectData.lookup_(), "nativeObject_getClassNode__field1_", Node.class)));
private static final Uncached UNCACHED = new Uncached();
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
/**
* State Info:
* 0: SpecializationActive {@link CastToTruffleStringNode#doTruffleString}
* 1: SpecializationActive {@link CastToTruffleStringNode#doPStringMaterialized}
* 2: SpecializationActive {@link CastToTruffleStringNode#doPStringGeneric}
* 3: SpecializationActive {@link CastToTruffleStringNode#doNativeObject}
* 4: SpecializationActive {@link CastToTruffleStringNode#doUnsupported}
* 5-7: InlinedCache
* Specialization: {@link CastToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int state_0_;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node pStringGeneric_materializeNode__field1_;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
* Inline field: {@link Node} field2
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node pStringGeneric_materializeNode__field2_;
@Child private NativeObjectData nativeObject_cache;
private CastToTruffleStringNodeGen() {
}
@Override
public TruffleString execute(Node arg0Value, Object arg1Value) throws CannotCastException {
int state_0 = this.state_0_;
if ((state_0 & 0b11111) != 0 /* is SpecializationActive[CastToTruffleStringNode.doTruffleString(TruffleString)] || SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] || SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] || SpecializationActive[CastToTruffleStringNode.doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)] || SpecializationActive[CastToTruffleStringNode.doUnsupported(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToTruffleStringNode.doTruffleString(TruffleString)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return CastToTruffleStringNode.doTruffleString(arg1Value_);
}
if ((state_0 & 0b110) != 0 /* is SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] || SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */ && arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] */) {
if ((arg1Value_.isMaterialized())) {
return CastToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */) {
if ((!(arg1Value_.isMaterialized()))) {
return CastToTruffleStringNode.doPStringGeneric(this, arg1Value_, INLINED_P_STRING_GENERIC_MATERIALIZE_NODE_);
}
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToTruffleStringNode.doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)] */ && arg1Value instanceof PythonNativeObject) {
PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value;
NativeObjectData s3_ = this.nativeObject_cache;
if (s3_ != null) {
return CastToTruffleStringNode.doNativeObject(s3_, arg1Value_, INLINED_NATIVE_OBJECT_GET_CLASS_NODE_, s3_.isSubtypeNode_, s3_.read_);
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[CastToTruffleStringNode.doUnsupported(Object)] */) {
if ((!(PGuards.isString(arg1Value))) && (!(PGuards.isNativeObject(arg1Value)))) {
return CastToTruffleStringNode.doUnsupported(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private TruffleString executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_;
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[CastToTruffleStringNode.doTruffleString(TruffleString)] */;
this.state_0_ = state_0;
return CastToTruffleStringNode.doTruffleString(arg1Value_);
}
if (arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((arg1Value_.isMaterialized())) {
state_0 = state_0 | 0b10 /* add SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] */;
this.state_0_ = state_0;
return CastToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
if ((!(arg1Value_.isMaterialized()))) {
state_0 = state_0 | 0b100 /* add SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */;
this.state_0_ = state_0;
return CastToTruffleStringNode.doPStringGeneric(this, arg1Value_, INLINED_P_STRING_GENERIC_MATERIALIZE_NODE_);
}
}
if (arg1Value instanceof PythonNativeObject) {
PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value;
NativeObjectData s3_ = this.insert(new NativeObjectData());
IsSubtypeNode isSubtypeNode__ = s3_.insert((IsSubtypeNode.create()));
Objects.requireNonNull(isSubtypeNode__, "Specialization 'doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)' cache 'isSubtypeNode' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
s3_.isSubtypeNode_ = isSubtypeNode__;
ReadNativeStringNode read__ = s3_.insert((ReadNativeStringNodeGen.create()));
Objects.requireNonNull(read__, "Specialization 'doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)' cache 'read' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
s3_.read_ = read__;
VarHandle.storeStoreFence();
this.nativeObject_cache = s3_;
state_0 = state_0 | 0b1000 /* add SpecializationActive[CastToTruffleStringNode.doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)] */;
this.state_0_ = state_0;
return CastToTruffleStringNode.doNativeObject(s3_, arg1Value_, INLINED_NATIVE_OBJECT_GET_CLASS_NODE_, isSubtypeNode__, read__);
}
if ((!(PGuards.isString(arg1Value))) && (!(PGuards.isNativeObject(arg1Value)))) {
state_0 = state_0 | 0b10000 /* add SpecializationActive[CastToTruffleStringNode.doUnsupported(Object)] */;
this.state_0_ = state_0;
return CastToTruffleStringNode.doUnsupported(arg1Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if ((state_0 & 0b11111) == 0) {
return NodeCost.UNINITIALIZED;
} else {
if (((state_0 & 0b11111) & ((state_0 & 0b11111) - 1)) == 0 /* is-single */) {
return NodeCost.MONOMORPHIC;
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static CastToTruffleStringNode create() {
return new CastToTruffleStringNodeGen();
}
@NeverDefault
public static CastToTruffleStringNode getUncached() {
return CastToTruffleStringNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#pStringGeneric_materializeNode__field1_}
*
- {@link Inlined#pStringGeneric_materializeNode__field2_}
*
- {@link Inlined#nativeObject_cache}
*
*/
@NeverDefault
public static CastToTruffleStringNode inline(@RequiredField(bits = 8, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new CastToTruffleStringNodeGen.Inlined(target);
}
@GeneratedBy(CastToTruffleStringNode.class)
@DenyReplace
private static final class Inlined extends CastToTruffleStringNode {
/**
* State Info:
* 0: SpecializationActive {@link CastToTruffleStringNode#doTruffleString}
* 1: SpecializationActive {@link CastToTruffleStringNode#doPStringMaterialized}
* 2: SpecializationActive {@link CastToTruffleStringNode#doPStringGeneric}
* 3: SpecializationActive {@link CastToTruffleStringNode#doNativeObject}
* 4: SpecializationActive {@link CastToTruffleStringNode#doUnsupported}
* 5-7: InlinedCache
* Specialization: {@link CastToTruffleStringNode#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_;
private final ReferenceField nativeObject_cache;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doPStringGeneric}
* Parameter: {@link StringMaterializeNode} materializeNode
* Inline method: {@link StringMaterializeNodeGen#inline}
*/
private final StringMaterializeNode pStringGeneric_materializeNode_;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doNativeObject}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private final GetClassNode nativeObject_getClassNode_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(CastToTruffleStringNode.class);
this.state_0_ = target.getState(0, 8);
this.pStringGeneric_materializeNode__field1_ = target.getReference(1, Node.class);
this.pStringGeneric_materializeNode__field2_ = target.getReference(2, Node.class);
this.nativeObject_cache = target.getReference(3, NativeObjectData.class);
this.pStringGeneric_materializeNode_ = StringMaterializeNodeGen.inline(InlineTarget.create(StringMaterializeNode.class, state_0_.subUpdater(5, 3), pStringGeneric_materializeNode__field1_, pStringGeneric_materializeNode__field2_));
this.nativeObject_getClassNode_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, NATIVE_OBJECT__CAST_TO_TRUFFLE_STRING_NODE_NATIVE_OBJECT_STATE_0_UPDATER.subUpdater(0, 17), ReferenceField.create(NativeObjectData.lookup_(), "nativeObject_getClassNode__field1_", Node.class)));
}
@Override
public TruffleString execute(Node arg0Value, Object arg1Value) throws CannotCastException {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b11111) != 0 /* is SpecializationActive[CastToTruffleStringNode.doTruffleString(TruffleString)] || SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] || SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] || SpecializationActive[CastToTruffleStringNode.doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)] || SpecializationActive[CastToTruffleStringNode.doUnsupported(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[CastToTruffleStringNode.doTruffleString(TruffleString)] */ && arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return CastToTruffleStringNode.doTruffleString(arg1Value_);
}
if ((state_0 & 0b110) != 0 /* is SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] || SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */ && arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((state_0 & 0b10) != 0 /* is SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] */) {
if ((arg1Value_.isMaterialized())) {
return CastToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[CastToTruffleStringNode.doPStringGeneric(Node, PString, StringMaterializeNode)] */) {
if ((!(arg1Value_.isMaterialized()))) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.pStringGeneric_materializeNode__field1_, this.pStringGeneric_materializeNode__field2_);
return CastToTruffleStringNode.doPStringGeneric(arg0Value, arg1Value_, this.pStringGeneric_materializeNode_);
}
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[CastToTruffleStringNode.doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)] */ && arg1Value instanceof PythonNativeObject) {
PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value;
NativeObjectData s3_ = this.nativeObject_cache.get(arg0Value);
if (s3_ != null) {
return CastToTruffleStringNode.doNativeObject(s3_, arg1Value_, this.nativeObject_getClassNode_, s3_.isSubtypeNode_, s3_.read_);
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[CastToTruffleStringNode.doUnsupported(Object)] */) {
if ((!(PGuards.isString(arg1Value))) && (!(PGuards.isNativeObject(arg1Value)))) {
return CastToTruffleStringNode.doUnsupported(arg1Value);
}
}
}
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[CastToTruffleStringNode.doTruffleString(TruffleString)] */;
this.state_0_.set(arg0Value, state_0);
return CastToTruffleStringNode.doTruffleString(arg1Value_);
}
if (arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((arg1Value_.isMaterialized())) {
state_0 = state_0 | 0b10 /* add SpecializationActive[CastToTruffleStringNode.doPStringMaterialized(PString)] */;
this.state_0_.set(arg0Value, state_0);
return CastToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
if ((!(arg1Value_.isMaterialized()))) {
state_0 = state_0 | 0b100 /* add SpecializationActive[CastToTruffleStringNode.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 CastToTruffleStringNode.doPStringGeneric(arg0Value, arg1Value_, this.pStringGeneric_materializeNode_);
}
}
if (arg1Value instanceof PythonNativeObject) {
PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value;
NativeObjectData s3_ = arg0Value.insert(new NativeObjectData());
IsSubtypeNode isSubtypeNode__ = s3_.insert((IsSubtypeNode.create()));
Objects.requireNonNull(isSubtypeNode__, "Specialization 'doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)' cache 'isSubtypeNode' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
s3_.isSubtypeNode_ = isSubtypeNode__;
ReadNativeStringNode read__ = s3_.insert((ReadNativeStringNodeGen.create()));
Objects.requireNonNull(read__, "Specialization 'doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)' cache 'read' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
s3_.read_ = read__;
VarHandle.storeStoreFence();
this.nativeObject_cache.set(arg0Value, s3_);
state_0 = state_0 | 0b1000 /* add SpecializationActive[CastToTruffleStringNode.doNativeObject(Node, PythonNativeObject, GetClassNode, IsSubtypeNode, ReadNativeStringNode)] */;
this.state_0_.set(arg0Value, state_0);
return CastToTruffleStringNode.doNativeObject(s3_, arg1Value_, this.nativeObject_getClassNode_, isSubtypeNode__, read__);
}
if ((!(PGuards.isString(arg1Value))) && (!(PGuards.isNativeObject(arg1Value)))) {
state_0 = state_0 | 0b10000 /* add SpecializationActive[CastToTruffleStringNode.doUnsupported(Object)] */;
this.state_0_.set(arg0Value, state_0);
return CastToTruffleStringNode.doUnsupported(arg1Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(CastToTruffleStringNode.class)
@DenyReplace
private static final class NativeObjectData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-16: InlinedCache
* Specialization: {@link CastToTruffleStringNode#doNativeObject}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int nativeObject_state_0_;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doNativeObject}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node nativeObject_getClassNode__field1_;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doNativeObject}
* Parameter: {@link IsSubtypeNode} isSubtypeNode
*/
@Child IsSubtypeNode isSubtypeNode_;
/**
* Source Info:
* Specialization: {@link CastToTruffleStringNode#doNativeObject}
* Parameter: {@link ReadNativeStringNode} read
*/
@Child ReadNativeStringNode read_;
NativeObjectData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
@GeneratedBy(CastToTruffleStringNode.class)
@DenyReplace
private static final class Uncached extends CastToTruffleStringNode {
@TruffleBoundary
@Override
public TruffleString execute(Node arg0Value, Object arg1Value) throws CannotCastException {
if (arg1Value instanceof TruffleString) {
TruffleString arg1Value_ = (TruffleString) arg1Value;
return CastToTruffleStringNode.doTruffleString(arg1Value_);
}
if (arg1Value instanceof PString) {
PString arg1Value_ = (PString) arg1Value;
if ((arg1Value_.isMaterialized())) {
return CastToTruffleStringNode.doPStringMaterialized(arg1Value_);
}
if ((!(arg1Value_.isMaterialized()))) {
return CastToTruffleStringNode.doPStringGeneric(arg0Value, arg1Value_, (StringMaterializeNodeGen.getUncached()));
}
}
if (arg1Value instanceof PythonNativeObject) {
PythonNativeObject arg1Value_ = (PythonNativeObject) arg1Value;
return CastToTruffleStringNode.doNativeObject(arg0Value, arg1Value_, (GetClassNode.getUncached()), (IsSubtypeNode.getUncached()), (ReadNativeStringNodeGen.getUncached()));
}
if ((!(PGuards.isString(arg1Value))) && (!(PGuards.isNativeObject(arg1Value)))) {
return CastToTruffleStringNode.doUnsupported(arg1Value);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
/**
* Debug Info:
* Specialization {@link ReadNativeStringNode#read}
* Activation probability: 1.00000
* With/without class size: 48/28 bytes
*
*/
@GeneratedBy(ReadNativeStringNode.class)
@SuppressWarnings("javadoc")
public static final class ReadNativeStringNodeGen extends ReadNativeStringNode {
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link ReadNativeStringNode#read}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link ReadI32Node} readI32
*/
@Child private ReadI32Node readI32_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link ReadI64Node} readI64
*/
@Child private ReadI64Node readI64_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link ReadPointerNode} readPointer
*/
@Child private ReadPointerNode readPointer_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link ReadByteNode} readByte
*/
@Child private ReadByteNode readByte_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link InteropLibrary} lib
*/
@Child private InteropLibrary lib_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link FromNativePointerNode} fromNative
*/
@Child private FromNativePointerNode fromNative_;
/**
* Source Info:
* Specialization: {@link ReadNativeStringNode#read}
* Parameter: {@link FromByteArrayNode} fromBytes
*/
@Child private FromByteArrayNode fromBytes_;
private ReadNativeStringNodeGen() {
}
@Override
public TruffleString execute(Object arg0Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[CastToTruffleStringNode.ReadNativeStringNode.read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)] */) {
{
ReadI32Node readI32__ = this.readI32_;
if (readI32__ != null) {
ReadI64Node readI64__ = this.readI64_;
if (readI64__ != null) {
ReadPointerNode readPointer__ = this.readPointer_;
if (readPointer__ != null) {
ReadByteNode readByte__ = this.readByte_;
if (readByte__ != null) {
InteropLibrary lib__ = this.lib_;
if (lib__ != null) {
FromNativePointerNode fromNative__ = this.fromNative_;
if (fromNative__ != null) {
FromByteArrayNode fromBytes__ = this.fromBytes_;
if (fromBytes__ != null) {
return ReadNativeStringNode.read(arg0Value, readI32__, readI64__, readPointer__, readByte__, lib__, fromNative__, fromBytes__);
}
}
}
}
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
private TruffleString executeAndSpecialize(Object arg0Value) {
int state_0 = this.state_0_;
ReadI32Node readI32__ = this.insert((ReadI32NodeGen.create()));
Objects.requireNonNull(readI32__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'readI32' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.readI32_ = readI32__;
ReadI64Node readI64__ = this.insert((ReadI64Node.create()));
Objects.requireNonNull(readI64__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'readI64' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.readI64_ = readI64__;
ReadPointerNode readPointer__ = this.insert((ReadPointerNodeGen.create()));
Objects.requireNonNull(readPointer__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'readPointer' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.readPointer_ = readPointer__;
ReadByteNode readByte__ = this.insert((ReadByteNodeGen.create()));
Objects.requireNonNull(readByte__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'readByte' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.readByte_ = readByte__;
InteropLibrary lib__ = this.insert((INTEROP_LIBRARY_.createDispatched(3)));
Objects.requireNonNull(lib__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'lib' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.lib_ = lib__;
FromNativePointerNode fromNative__ = this.insert((FromNativePointerNode.create()));
Objects.requireNonNull(fromNative__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'fromNative' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.fromNative_ = fromNative__;
FromByteArrayNode fromBytes__ = this.insert((FromByteArrayNode.create()));
Objects.requireNonNull(fromBytes__, "Specialization 'read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)' cache 'fromBytes' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.fromBytes_ = fromBytes__;
state_0 = state_0 | 0b1 /* add SpecializationActive[CastToTruffleStringNode.ReadNativeStringNode.read(Object, ReadI32Node, ReadI64Node, ReadPointerNode, ReadByteNode, InteropLibrary, FromNativePointerNode, FromByteArrayNode)] */;
this.state_0_ = state_0;
return ReadNativeStringNode.read(arg0Value, readI32__, readI64__, readPointer__, readByte__, lib__, fromNative__, fromBytes__);
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if (state_0 == 0) {
return NodeCost.UNINITIALIZED;
} else {
return NodeCost.MONOMORPHIC;
}
}
@NeverDefault
public static ReadNativeStringNode create() {
return new ReadNativeStringNodeGen();
}
@NeverDefault
public static ReadNativeStringNode getUncached() {
return ReadNativeStringNodeGen.UNCACHED;
}
@GeneratedBy(ReadNativeStringNode.class)
@DenyReplace
private static final class Uncached extends ReadNativeStringNode {
@TruffleBoundary
@Override
public TruffleString execute(Object arg0Value) {
return ReadNativeStringNode.read(arg0Value, (ReadI32NodeGen.getUncached()), (ReadI64Node.getUncached()), (ReadPointerNode.getUncached()), (ReadByteNodeGen.getUncached()), (INTEROP_LIBRARY_.getUncached()), (FromNativePointerNode.getUncached()), (FromByteArrayNode.getUncached()));
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy