com.oracle.graal.python.lib.PyFloatCheckNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.lib;
import com.oracle.graal.python.builtins.objects.cext.PythonAbstractNativeObject;
import com.oracle.graal.python.builtins.objects.floats.PFloat;
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.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 PyFloatCheckNode#doDouble}
* Activation probability: 0.38500
* With/without class size: 8/0 bytes
* Specialization {@link PyFloatCheckNode#doPFloat}
* Activation probability: 0.29500
* With/without class size: 7/0 bytes
* Specialization {@link PyFloatCheckNode#doNative}
* Activation probability: 0.20500
* With/without class size: 8/4 bytes
* Specialization {@link PyFloatCheckNode#doOther}
* Activation probability: 0.11500
* With/without class size: 5/0 bytes
*
*/
@GeneratedBy(PyFloatCheckNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class PyFloatCheckNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static PyFloatCheckNode getUncached() {
return PyFloatCheckNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#native_check_}
*
*/
@NeverDefault
public static PyFloatCheckNode inline(@RequiredField(bits = 4, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new PyFloatCheckNodeGen.Inlined(target);
}
@GeneratedBy(PyFloatCheckNode.class)
@DenyReplace
private static final class Inlined extends PyFloatCheckNode {
/**
* State Info:
* 0: SpecializationActive {@link PyFloatCheckNode#doDouble}
* 1: SpecializationActive {@link PyFloatCheckNode#doPFloat}
* 2: SpecializationActive {@link PyFloatCheckNode#doNative}
* 3: SpecializationActive {@link PyFloatCheckNode#doOther}
*
*/
private final StateField state_0_;
private final ReferenceField native_check_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(PyFloatCheckNode.class);
this.state_0_ = target.getState(0, 4);
this.native_check_ = target.getReference(1, PyObjectTypeCheck.class);
}
@SuppressWarnings("static-method")
private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) {
if (!((state_0 & 0b1) != 0 /* is SpecializationActive[PyFloatCheckNode.doDouble(Double)] */) && arg1Value instanceof Double) {
return false;
}
if (!((state_0 & 0b10) != 0 /* is SpecializationActive[PyFloatCheckNode.doPFloat(PFloat)] */) && arg1Value instanceof PFloat) {
return false;
}
if (!((state_0 & 0b100) != 0 /* is SpecializationActive[PyFloatCheckNode.doNative(PythonAbstractNativeObject, PyObjectTypeCheck)] */) && 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 != 0 /* is SpecializationActive[PyFloatCheckNode.doDouble(Double)] || SpecializationActive[PyFloatCheckNode.doPFloat(PFloat)] || SpecializationActive[PyFloatCheckNode.doNative(PythonAbstractNativeObject, PyObjectTypeCheck)] || SpecializationActive[PyFloatCheckNode.doOther(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyFloatCheckNode.doDouble(Double)] */ && arg1Value instanceof Double) {
Double arg1Value_ = (Double) arg1Value;
return PyFloatCheckNode.doDouble(arg1Value_);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyFloatCheckNode.doPFloat(PFloat)] */ && arg1Value instanceof PFloat) {
PFloat arg1Value_ = (PFloat) arg1Value;
return PyFloatCheckNode.doPFloat(arg1Value_);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[PyFloatCheckNode.doNative(PythonAbstractNativeObject, PyObjectTypeCheck)] */ && arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
{
PyObjectTypeCheck check__ = this.native_check_.get(arg0Value);
if (check__ != null) {
return PyFloatCheckNode.doNative(arg1Value_, check__);
}
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PyFloatCheckNode.doOther(Object)] */) {
if (fallbackGuard_(state_0, arg0Value, arg1Value)) {
return PyFloatCheckNode.doOther(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 Double) {
Double arg1Value_ = (Double) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[PyFloatCheckNode.doDouble(Double)] */;
this.state_0_.set(arg0Value, state_0);
return PyFloatCheckNode.doDouble(arg1Value_);
}
if (arg1Value instanceof PFloat) {
PFloat arg1Value_ = (PFloat) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[PyFloatCheckNode.doPFloat(PFloat)] */;
this.state_0_.set(arg0Value, state_0);
return PyFloatCheckNode.doPFloat(arg1Value_);
}
if (arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
PyObjectTypeCheck check__ = arg0Value.insert((PyObjectTypeCheckNodeGen.create()));
Objects.requireNonNull(check__, "Specialization 'doNative(PythonAbstractNativeObject, PyObjectTypeCheck)' cache 'check' 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.native_check_.set(arg0Value, check__);
state_0 = state_0 | 0b100 /* add SpecializationActive[PyFloatCheckNode.doNative(PythonAbstractNativeObject, PyObjectTypeCheck)] */;
this.state_0_.set(arg0Value, state_0);
return PyFloatCheckNode.doNative(arg1Value_, check__);
}
state_0 = state_0 | 0b1000 /* add SpecializationActive[PyFloatCheckNode.doOther(Object)] */;
this.state_0_.set(arg0Value, state_0);
return PyFloatCheckNode.doOther(arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(PyFloatCheckNode.class)
@DenyReplace
private static final class Uncached extends PyFloatCheckNode {
@TruffleBoundary
@Override
public boolean execute(Node arg0Value, Object arg1Value) {
if (arg1Value instanceof Double) {
Double arg1Value_ = (Double) arg1Value;
return PyFloatCheckNode.doDouble(arg1Value_);
}
if (arg1Value instanceof PFloat) {
PFloat arg1Value_ = (PFloat) arg1Value;
return PyFloatCheckNode.doPFloat(arg1Value_);
}
if (arg1Value instanceof PythonAbstractNativeObject) {
PythonAbstractNativeObject arg1Value_ = (PythonAbstractNativeObject) arg1Value;
return PyFloatCheckNode.doNative(arg1Value_, (PyObjectTypeCheckNodeGen.getUncached()));
}
return PyFloatCheckNode.doOther(arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy