com.oracle.graal.python.lib.PyBytesCheckNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.objects.bytes.PBytes;
import com.oracle.graal.python.builtins.objects.cext.PythonAbstractNativeObject;
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.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.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 java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link PyBytesCheckNode#check(PBytes)}
* Activation probability: 0.48333
* With/without class size: 9/0 bytes
* Specialization {@link PyBytesCheckNode#check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)}
* Activation probability: 0.33333
* With/without class size: 13/11 bytes
* Specialization {@link PyBytesCheckNode#check(Object)}
* Activation probability: 0.18333
* With/without class size: 6/0 bytes
*
*/
@GeneratedBy(PyBytesCheckNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class PyBytesCheckNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static PyBytesCheckNode getUncached() {
return PyBytesCheckNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#check1_getClassNode__field1_}
*
- {@link Inlined#check1_isSubtypeNode_}
*
*/
@NeverDefault
public static PyBytesCheckNode inline(@RequiredField(bits = 20, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PyBytesCheckNodeGen.Inlined(target);
}
@GeneratedBy(PyBytesCheckNode.class)
@DenyReplace
private static final class Inlined extends PyBytesCheckNode {
/**
* State Info:
* 0: SpecializationActive {@link PyBytesCheckNode#check(PBytes)}
* 1: SpecializationActive {@link PyBytesCheckNode#check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)}
* 2: SpecializationActive {@link PyBytesCheckNode#check(Object)}
* 3-19: InlinedCache
* Specialization: {@link PyBytesCheckNode#check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*
*/
private final StateField state_0_;
private final ReferenceField check1_getClassNode__field1_;
private final ReferenceField check1_isSubtypeNode_;
/**
* Source Info:
* Specialization: {@link PyBytesCheckNode#check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)}
* Parameter: {@link GetClassNode} getClassNode
* Inline method: {@link GetClassNodeGen#inline}
*/
private final GetClassNode check1_getClassNode_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PyBytesCheckNode.class);
this.state_0_ = target.getState(0, 20);
this.check1_getClassNode__field1_ = target.getReference(1, Node.class);
this.check1_isSubtypeNode_ = target.getReference(2, IsSubtypeNode.class);
this.check1_getClassNode_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, state_0_.subUpdater(3, 17), check1_getClassNode__field1_));
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) {
if (!((state_0 & 0b1) != 0 /* is SpecializationActive[PyBytesCheckNode.check(PBytes)] */) && arg1Value instanceof PBytes) {
return false;
}
if (!((state_0 & 0b10) != 0 /* is SpecializationActive[PyBytesCheckNode.check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)] */) && arg1Value instanceof PythonAbstractNativeObject) {
return false;
}
return true;
}
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b111) != 0 /* is SpecializationActive[PyBytesCheckNode.check(PBytes)] || SpecializationActive[PyBytesCheckNode.check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)] || SpecializationActive[PyBytesCheckNode.check(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyBytesCheckNode.check(PBytes)] */ && arg1Value instanceof PBytes) {
PBytes arg1Value_ = (PBytes) arg1Value;
return PyBytesCheckNode.check(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyBytesCheckNode.check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)] */ && arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
{
IsSubtypeNode isSubtypeNode__ = this.check1_isSubtypeNode_.get(arg0Value);
if (isSubtypeNode__ != null) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.check1_getClassNode__field1_);
return PyBytesCheckNode.check(arg0Value, arg1Value_, this.check1_getClassNode_, isSubtypeNode__);
}
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PyBytesCheckNode.check(Object)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return PyBytesCheckNode.check(arg1Value);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private boolean executeAndSpecialize(Node arg0Value, Object arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof PBytes) {
PBytes arg1Value_ = (PBytes) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[PyBytesCheckNode.check(PBytes)] */;
this.state_0_.set(arg0Value, state_0);
return PyBytesCheckNode.check(arg1Value_);
}
if (arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
IsSubtypeNode isSubtypeNode__ = arg0Value.insert((IsSubtypeNode.create()));
Objects.requireNonNull(isSubtypeNode__, "Specialization 'check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)' 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'.");
VarHandle.storeStoreFence();
this.check1_isSubtypeNode_.set(arg0Value, isSubtypeNode__);
state_0 = state_0 | 0b10 /* add SpecializationActive[PyBytesCheckNode.check(Node, PythonAbstractNativeObject, GetClassNode, IsSubtypeNode)] */;
this.state_0_.set(arg0Value, state_0);
assert InlineSupport.validate(arg0Value, this.state_0_, this.check1_getClassNode__field1_);
return PyBytesCheckNode.check(arg0Value, arg1Value_, this.check1_getClassNode_, isSubtypeNode__);
}
state_0 = state_0 | 0b100 /* add SpecializationActive[PyBytesCheckNode.check(Object)] */;
this.state_0_.set(arg0Value, state_0);
return PyBytesCheckNode.check(arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PyBytesCheckNode.class)
@DenyReplace
private static final class Uncached extends PyBytesCheckNode {
@TruffleBoundary
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof PBytes) {
PBytes arg1Value_ = (PBytes) arg1Value;
return PyBytesCheckNode.check(arg1Value_);
}
if (arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
return PyBytesCheckNode.check(arg0Value, arg1Value_, (GetClassNode.getUncached()), (IsSubtypeNode.getUncached()));
}
return PyBytesCheckNode.check(arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy