com.oracle.graal.python.lib.PyUnicodeAsEncodedStringNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.modules.CodecsModuleBuiltins.CodecsEncodeNode;
import com.oracle.graal.python.builtins.modules.CodecsModuleBuiltins.EncodeNode;
import com.oracle.graal.python.builtins.modules.CodecsModuleBuiltinsFactory.CodecsEncodeNodeFactory;
import com.oracle.graal.python.builtins.modules.CodecsModuleBuiltinsFactory.EncodeNodeFactory;
import com.oracle.graal.python.builtins.modules.WarningsModuleBuiltins.WarnNode;
import com.oracle.graal.python.builtins.objects.PNone;
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes.CopyNode;
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.CopyNodeGen;
import com.oracle.graal.python.nodes.PGuards;
import com.oracle.graal.python.nodes.PRaiseNode.Lazy;
import com.oracle.graal.python.nodes.PRaiseNodeGen.LazyNodeGen;
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.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.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.profiles.InlinedConditionProfile;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.api.strings.TruffleString.ToJavaStringNode;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link PyUnicodeAsEncodedString#doCommon}
* Activation probability: 0.38500
* With/without class size: 8/0 bytes
* Specialization {@link PyUnicodeAsEncodedString#doRegistry}
* Activation probability: 0.29500
* With/without class size: 15/22 bytes
* Specialization {@link PyUnicodeAsEncodedString#doNoEncoding}
* Activation probability: 0.20500
* With/without class size: 6/0 bytes
* Specialization {@link PyUnicodeAsEncodedString#doGeneric}
* Activation probability: 0.11500
* With/without class size: 6/5 bytes
*
*/
@GeneratedBy(PyUnicodeAsEncodedString.class)
@SuppressWarnings("javadoc")
public final class PyUnicodeAsEncodedStringNodeGen {
private static final StateField REGISTRY__PY_UNICODE_AS_ENCODED_STRING_REGISTRY_STATE_0_UPDATER = StateField.create(RegistryData.lookup_(), "registry_state_0_");
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#encodeNode}
*
- {@link Inlined#ts2js}
*
- {@link Inlined#registry_cache}
*
- {@link Inlined#generic_raiseNode__field1_}
*
*/
@NeverDefault
public static PyUnicodeAsEncodedString inline(@RequiredField(bits = 5, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.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 PyUnicodeAsEncodedStringNodeGen.Inlined(target);
}
@GeneratedBy(PyUnicodeAsEncodedString.class)
@DenyReplace
private static final class Inlined extends PyUnicodeAsEncodedString {
/**
* State Info:
* 0: SpecializationActive {@link PyUnicodeAsEncodedString#doCommon}
* 1: SpecializationActive {@link PyUnicodeAsEncodedString#doRegistry}
* 2: SpecializationActive {@link PyUnicodeAsEncodedString#doNoEncoding}
* 3: SpecializationActive {@link PyUnicodeAsEncodedString#doGeneric}
* 4: InlinedCache
* Specialization: {@link PyUnicodeAsEncodedString#doGeneric}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField encodeNode;
private final ReferenceField ts2js;
private final ReferenceField registry_cache;
private final ReferenceField generic_raiseNode__field1_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link InlinedConditionProfile} isBytesProfile
* Inline method: {@link InlinedConditionProfile#inline}
*/
private final InlinedConditionProfile registry_isBytesProfile_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link InlinedConditionProfile} isByteArrayProfile
* Inline method: {@link InlinedConditionProfile#inline}
*/
private final InlinedConditionProfile registry_isByteArrayProfile_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link CopyNode} copyNode
* Inline method: {@link CopyNodeGen#inline}
*/
private final CopyNode registry_copyNode_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy registry_raiseNode_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doGeneric}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*/
private final Lazy generic_raiseNode_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PyUnicodeAsEncodedString.class);
this.state_0_ = target.getState(0, 5);
this.encodeNode = target.getReference(1, CodecsEncodeNode.class);
this.ts2js = target.getReference(2, ToJavaStringNode.class);
this.registry_cache = target.getReference(3, RegistryData.class);
this.generic_raiseNode__field1_ = target.getReference(4, Node.class);
this.registry_isBytesProfile_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, REGISTRY__PY_UNICODE_AS_ENCODED_STRING_REGISTRY_STATE_0_UPDATER.subUpdater(0, 2)));
this.registry_isByteArrayProfile_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, REGISTRY__PY_UNICODE_AS_ENCODED_STRING_REGISTRY_STATE_0_UPDATER.subUpdater(2, 2)));
this.registry_copyNode_ = CopyNodeGen.inline(InlineTarget.create(CopyNode.class, REGISTRY__PY_UNICODE_AS_ENCODED_STRING_REGISTRY_STATE_0_UPDATER.subUpdater(4, 4), ReferenceField.create(RegistryData.lookup_(), "registry_copyNode__field1_", Node.class), ReferenceField.create(RegistryData.lookup_(), "registry_copyNode__field2_", Object.class)));
this.registry_raiseNode_ = LazyNodeGen.inline(InlineTarget.create(Lazy.class, REGISTRY__PY_UNICODE_AS_ENCODED_STRING_REGISTRY_STATE_0_UPDATER.subUpdater(8, 1), ReferenceField.create(RegistryData.lookup_(), "registry_raiseNode__field1_", Node.class)));
this.generic_raiseNode_ = LazyNodeGen.inline(InlineTarget.create(Lazy.class, state_0_.subUpdater(4, 1), generic_raiseNode__field1_));
}
@Override
public Object execute(VirtualFrame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b1111) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doCommon(VirtualFrame, Object, TruffleString, TruffleString, CodecsEncodeNode, ToJavaStringNode)] || SpecializationActive[PyUnicodeAsEncodedString.doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)] || SpecializationActive[PyUnicodeAsEncodedString.doNoEncoding(VirtualFrame, Object, PNone, Object, CodecsEncodeNode)] || SpecializationActive[PyUnicodeAsEncodedString.doGeneric(VirtualFrame, Node, Object, Object, Object, Lazy)] */) {
if ((state_0 & 0b11) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doCommon(VirtualFrame, Object, TruffleString, TruffleString, CodecsEncodeNode, ToJavaStringNode)] || SpecializationActive[PyUnicodeAsEncodedString.doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)] */ && arg2Value instanceof TruffleString) {
TruffleString arg2Value_ = (TruffleString) arg2Value;
if (arg3Value instanceof TruffleString) {
TruffleString arg3Value_ = (TruffleString) arg3Value;
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doCommon(VirtualFrame, Object, TruffleString, TruffleString, CodecsEncodeNode, ToJavaStringNode)] */) {
{
CodecsEncodeNode encodeNode_ = this.encodeNode.get(arg0Value);
if (encodeNode_ != null) {
ToJavaStringNode ts2js_ = this.ts2js.get(arg0Value);
if (ts2js_ != null) {
if ((PGuards.isString(arg1Value)) && (PyUnicodeAsEncodedString.isCommon(arg2Value_, ts2js_))) {
return PyUnicodeAsEncodedString.doCommon(frameValue, arg1Value, arg2Value_, arg3Value_, encodeNode_, ts2js_);
}
}
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)] */) {
RegistryData s1_ = this.registry_cache.get(arg0Value);
if (s1_ != null) {
{
ToJavaStringNode ts2js_1 = this.ts2js.get(arg0Value);
if (ts2js_1 != null) {
if ((PGuards.isString(arg1Value)) && (!(PyUnicodeAsEncodedString.isCommon(arg2Value_, ts2js_1)))) {
return PyUnicodeAsEncodedString.doRegistry(frameValue, s1_, arg1Value, arg2Value_, arg3Value_, s1_.encodeNode_, this.registry_isBytesProfile_, this.registry_isByteArrayProfile_, this.registry_copyNode_, s1_.warnNode_, this.registry_raiseNode_, ts2js_1);
}
}
}
}
}
}
}
if ((state_0 & 0b1100) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doNoEncoding(VirtualFrame, Object, PNone, Object, CodecsEncodeNode)] || SpecializationActive[PyUnicodeAsEncodedString.doGeneric(VirtualFrame, Node, Object, Object, Object, Lazy)] */) {
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doNoEncoding(VirtualFrame, Object, PNone, Object, CodecsEncodeNode)] */ && arg2Value instanceof PNone) {
PNone arg2Value_ = (PNone) arg2Value;
{
CodecsEncodeNode encodeNode_1 = this.encodeNode.get(arg0Value);
if (encodeNode_1 != null) {
if ((PGuards.isString(arg1Value)) && (PGuards.isNoValue(arg2Value_))) {
return PyUnicodeAsEncodedString.doNoEncoding(frameValue, arg1Value, arg2Value_, arg3Value, encodeNode_1);
}
}
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PyUnicodeAsEncodedString.doGeneric(VirtualFrame, Node, Object, Object, Object, Lazy)] */) {
if ((!(PGuards.isString(arg1Value)))) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.generic_raiseNode__field1_);
return PyUnicodeAsEncodedString.doGeneric(frameValue, arg0Value, arg1Value, arg2Value, arg3Value, this.generic_raiseNode_);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(frameValue, arg0Value, arg1Value, arg2Value, arg3Value);
}
private Object executeAndSpecialize(VirtualFrame frameValue, Node arg0Value, Object arg1Value, Object arg2Value, Object arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg2Value instanceof TruffleString) {
TruffleString arg2Value_ = (TruffleString) arg2Value;
if (arg3Value instanceof TruffleString) {
TruffleString arg3Value_ = (TruffleString) arg3Value;
if ((PGuards.isString(arg1Value))) {
ToJavaStringNode ts2js_;
ToJavaStringNode ts2js__shared = this.ts2js.get(arg0Value);
if (ts2js__shared != null) {
ts2js_ = ts2js__shared;
} else {
ts2js_ = arg0Value.insert((ToJavaStringNode.create()));
if (ts2js_ == null) {
throw new IllegalStateException("Specialization 'doCommon(VirtualFrame, Object, TruffleString, TruffleString, CodecsEncodeNode, ToJavaStringNode)' contains a shared cache with name 'toJavaStringNode' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if ((PyUnicodeAsEncodedString.isCommon(arg2Value_, ts2js_))) {
CodecsEncodeNode encodeNode_;
CodecsEncodeNode encodeNode__shared = this.encodeNode.get(arg0Value);
if (encodeNode__shared != null) {
encodeNode_ = encodeNode__shared;
} else {
encodeNode_ = arg0Value.insert((CodecsEncodeNodeFactory.create()));
if (encodeNode_ == null) {
throw new IllegalStateException("Specialization 'doCommon(VirtualFrame, Object, TruffleString, TruffleString, CodecsEncodeNode, ToJavaStringNode)' contains a shared cache with name 'encodeNode' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.encodeNode.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.encodeNode.set(arg0Value, encodeNode_);
}
if (this.ts2js.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.ts2js.set(arg0Value, ts2js_);
}
state_0 = state_0 | 0b1 /* add SpecializationActive[PyUnicodeAsEncodedString.doCommon(VirtualFrame, Object, TruffleString, TruffleString, CodecsEncodeNode, ToJavaStringNode)] */;
this.state_0_.set(arg0Value, state_0);
return PyUnicodeAsEncodedString.doCommon(frameValue, arg1Value, arg2Value_, arg3Value_, encodeNode_, ts2js_);
}
}
if ((PGuards.isString(arg1Value))) {
ToJavaStringNode ts2js_1;
ToJavaStringNode ts2js_1_shared = this.ts2js.get(arg0Value);
if (ts2js_1_shared != null) {
ts2js_1 = ts2js_1_shared;
} else {
ts2js_1 = arg0Value.insert((ToJavaStringNode.create()));
if (ts2js_1 == null) {
throw new IllegalStateException("Specialization 'doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)' contains a shared cache with name 'toJavaStringNode' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if ((!(PyUnicodeAsEncodedString.isCommon(arg2Value_, ts2js_1)))) {
RegistryData s1_ = arg0Value.insert(new RegistryData());
EncodeNode encodeNode__ = s1_.insert((EncodeNodeFactory.create()));
Objects.requireNonNull(encodeNode__, "Specialization 'doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)' cache 'encodeNode' 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'.");
s1_.encodeNode_ = encodeNode__;
WarnNode warnNode__ = s1_.insert((WarnNode.create()));
Objects.requireNonNull(warnNode__, "Specialization 'doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)' cache 'warnNode' 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'.");
s1_.warnNode_ = warnNode__;
if (this.ts2js.get(arg0Value) == null) {
this.ts2js.set(arg0Value, ts2js_1);
}
VarHandle.storeStoreFence();
this.registry_cache.set(arg0Value, s1_);
state_0 = state_0 | 0b10 /* add SpecializationActive[PyUnicodeAsEncodedString.doRegistry(VirtualFrame, Node, Object, TruffleString, TruffleString, EncodeNode, InlinedConditionProfile, InlinedConditionProfile, CopyNode, WarnNode, Lazy, ToJavaStringNode)] */;
this.state_0_.set(arg0Value, state_0);
return PyUnicodeAsEncodedString.doRegistry(frameValue, s1_, arg1Value, arg2Value_, arg3Value_, encodeNode__, this.registry_isBytesProfile_, this.registry_isByteArrayProfile_, this.registry_copyNode_, warnNode__, this.registry_raiseNode_, ts2js_1);
}
}
}
}
if (arg2Value instanceof PNone) {
PNone arg2Value_ = (PNone) arg2Value;
if ((PGuards.isString(arg1Value)) && (PGuards.isNoValue(arg2Value_))) {
CodecsEncodeNode encodeNode_1;
CodecsEncodeNode encodeNode_1_shared = this.encodeNode.get(arg0Value);
if (encodeNode_1_shared != null) {
encodeNode_1 = encodeNode_1_shared;
} else {
encodeNode_1 = arg0Value.insert((CodecsEncodeNodeFactory.create()));
if (encodeNode_1 == null) {
throw new IllegalStateException("Specialization 'doNoEncoding(VirtualFrame, Object, PNone, Object, CodecsEncodeNode)' contains a shared cache with name 'encodeNode' that returned a default value for the cached initializer. Default values are not supported for shared cached initializers because the default value is reserved for the uninitialized state.");
}
}
if (this.encodeNode.get(arg0Value) == null) {
VarHandle.storeStoreFence();
this.encodeNode.set(arg0Value, encodeNode_1);
}
state_0 = state_0 | 0b100 /* add SpecializationActive[PyUnicodeAsEncodedString.doNoEncoding(VirtualFrame, Object, PNone, Object, CodecsEncodeNode)] */;
this.state_0_.set(arg0Value, state_0);
return PyUnicodeAsEncodedString.doNoEncoding(frameValue, arg1Value, arg2Value_, arg3Value, encodeNode_1);
}
}
if ((!(PGuards.isString(arg1Value)))) {
state_0 = state_0 | 0b1000 /* add SpecializationActive[PyUnicodeAsEncodedString.doGeneric(VirtualFrame, Node, Object, Object, Object, Lazy)] */;
this.state_0_.set(arg0Value, state_0);
assert InlineSupport.validate(arg0Value, this.state_0_, this.generic_raiseNode__field1_);
return PyUnicodeAsEncodedString.doGeneric(frameValue, arg0Value, arg1Value, arg2Value, arg3Value, this.generic_raiseNode_);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null, null, null}, arg0Value, arg1Value, arg2Value, arg3Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PyUnicodeAsEncodedString.class)
@DenyReplace
private static final class RegistryData extends Node implements SpecializationDataNode {
/**
* State Info:
* 0-1: InlinedCache
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link InlinedConditionProfile} isBytesProfile
* Inline method: {@link InlinedConditionProfile#inline}
* 2-3: InlinedCache
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link InlinedConditionProfile} isByteArrayProfile
* Inline method: {@link InlinedConditionProfile#inline}
* 4-7: InlinedCache
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link CopyNode} copyNode
* Inline method: {@link CopyNodeGen#inline}
* 8: InlinedCache
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
*
*/
@CompilationFinal @UnsafeAccessedField private int registry_state_0_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link EncodeNode} encodeNode
*/
@Child EncodeNode encodeNode_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link CopyNode} copyNode
* Inline method: {@link CopyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node registry_copyNode__field1_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link CopyNode} copyNode
* Inline method: {@link CopyNodeGen#inline}
* Inline field: {@link Object} field2
*/
@CompilationFinal @UnsafeAccessedField @SuppressWarnings("unused") private Object registry_copyNode__field2_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link WarnNode} warnNode
*/
@Child WarnNode warnNode_;
/**
* Source Info:
* Specialization: {@link PyUnicodeAsEncodedString#doRegistry}
* Parameter: {@link Lazy} raiseNode
* Inline method: {@link LazyNodeGen#inline}
* Inline field: {@link Node} field1
*/
@Child @UnsafeAccessedField @SuppressWarnings("unused") private Node registry_raiseNode__field1_;
RegistryData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
private static Lookup lookup_() {
return MethodHandles.lookup();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy