All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.graal.python.lib.PyNumberCheckNodeGen Maven / Gradle / Ivy

There is a newer version: 24.1.1
Show newest version
// CheckStyle: start generated
package com.oracle.graal.python.lib;

import com.oracle.graal.python.builtins.objects.PNone;
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
import com.oracle.graal.python.nodes.attributes.LookupCallableSlotInMRONode;
import com.oracle.graal.python.nodes.object.GetClassNode;
import com.oracle.graal.python.nodes.object.GetClassNodeGen;
import com.oracle.graal.python.nodes.util.LazyInteropLibrary;
import com.oracle.graal.python.nodes.util.LazyInteropLibraryNodeGen;
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.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.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;
import java.util.Objects;

/**
 * Debug Info: 
 *   Specialization {@link PyNumberCheckNode#doString}
 *     Activation probability: 0.23929
 *     With/without class size: 6/0 bytes
 *   Specialization {@link PyNumberCheckNode#doDouble}
 *     Activation probability: 0.20714
 *     With/without class size: 6/0 bytes
 *   Specialization {@link PyNumberCheckNode#doInt}
 *     Activation probability: 0.17500
 *     With/without class size: 6/0 bytes
 *   Specialization {@link PyNumberCheckNode#doLong}
 *     Activation probability: 0.14286
 *     With/without class size: 5/0 bytes
 *   Specialization {@link PyNumberCheckNode#doBoolean}
 *     Activation probability: 0.11071
 *     With/without class size: 5/0 bytes
 *   Specialization {@link PyNumberCheckNode#doNone}
 *     Activation probability: 0.07857
 *     With/without class size: 4/0 bytes
 *   Specialization {@link PyNumberCheckNode#doOthers}
 *     Activation probability: 0.04643
 *     With/without class size: 6/33 bytes
 * 
*/ @GeneratedBy(PyNumberCheckNode.class) @SuppressWarnings({"javadoc", "unused"}) public final class PyNumberCheckNodeGen { private static final StateField FALLBACK__PY_NUMBER_CHECK_NODE_FALLBACK_STATE_0_UPDATER = StateField.create(FallbackData.lookup_(), "fallback_state_0_"); private static final StateField FALLBACK__PY_NUMBER_CHECK_NODE_FALLBACK_STATE_1_UPDATER = StateField.create(FallbackData.lookup_(), "fallback_state_1_"); private static final Uncached UNCACHED = new Uncached(); @NeverDefault public static PyNumberCheckNode getUncached() { return PyNumberCheckNodeGen.UNCACHED; } /** * Required Fields:
    *
  • {@link Inlined#state_0_} *
  • {@link Inlined#fallback_cache} *
*/ @NeverDefault public static PyNumberCheckNode inline(@RequiredField(bits = 7, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) { return new PyNumberCheckNodeGen.Inlined(target); } @GeneratedBy(PyNumberCheckNode.class) @DenyReplace private static final class Inlined extends PyNumberCheckNode { /** * State Info:
         *   0: SpecializationActive {@link PyNumberCheckNode#doString}
         *   1: SpecializationActive {@link PyNumberCheckNode#doDouble}
         *   2: SpecializationActive {@link PyNumberCheckNode#doInt}
         *   3: SpecializationActive {@link PyNumberCheckNode#doLong}
         *   4: SpecializationActive {@link PyNumberCheckNode#doBoolean}
         *   5: SpecializationActive {@link PyNumberCheckNode#doNone}
         *   6: SpecializationActive {@link PyNumberCheckNode#doOthers}
         * 
*/ private final StateField state_0_; private final ReferenceField fallback_cache; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link LazyInteropLibrary} interopLibrary
         *   Inline method: {@link LazyInteropLibraryNodeGen#inline}
*/ private final LazyInteropLibrary fallback_interopLibrary_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link GetClassNode} getClassNode
         *   Inline method: {@link GetClassNodeGen#inline}
*/ private final GetClassNode fallback_getClassNode_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link PyComplexCheckNode} checkComplex
         *   Inline method: {@link PyComplexCheckNodeGen#inline}
*/ private final PyComplexCheckNode fallback_checkComplex_; @SuppressWarnings("unchecked") private Inlined(InlineTarget target) { assert target.getTargetClass().isAssignableFrom(PyNumberCheckNode.class); this.state_0_ = target.getState(0, 7); this.fallback_cache = target.getReference(1, FallbackData.class); this.fallback_interopLibrary_ = LazyInteropLibraryNodeGen.inline(InlineTarget.create(LazyInteropLibrary.class, FALLBACK__PY_NUMBER_CHECK_NODE_FALLBACK_STATE_0_UPDATER.subUpdater(0, 1), ReferenceField.create(FallbackData.lookup_(), "fallback_interopLibrary__field1_", Node.class))); this.fallback_getClassNode_ = GetClassNodeGen.inline(InlineTarget.create(GetClassNode.class, FALLBACK__PY_NUMBER_CHECK_NODE_FALLBACK_STATE_0_UPDATER.subUpdater(1, 17), ReferenceField.create(FallbackData.lookup_(), "fallback_getClassNode__field1_", Node.class))); this.fallback_checkComplex_ = PyComplexCheckNodeGen.inline(InlineTarget.create(PyComplexCheckNode.class, FALLBACK__PY_NUMBER_CHECK_NODE_FALLBACK_STATE_1_UPDATER.subUpdater(0, 19), ReferenceField.create(FallbackData.lookup_(), "fallback_checkComplex__field1_", Node.class), ReferenceField.create(FallbackData.lookup_(), "fallback_checkComplex__field2_", Node.class))); } @SuppressWarnings("static-method") private boolean fallbackGuard_(int state_0, Node arg0Value, Object arg1Value) { if (!((state_0 & 0b1) != 0 /* is SpecializationActive[PyNumberCheckNode.doString(TruffleString)] */) && arg1Value instanceof TruffleString) { return false; } if (!((state_0 & 0b10) != 0 /* is SpecializationActive[PyNumberCheckNode.doDouble(Double)] */) && arg1Value instanceof Double) { return false; } if (!((state_0 & 0b100) != 0 /* is SpecializationActive[PyNumberCheckNode.doInt(Integer)] */) && arg1Value instanceof Integer) { return false; } if (!((state_0 & 0b1000) != 0 /* is SpecializationActive[PyNumberCheckNode.doLong(Long)] */) && arg1Value instanceof Long) { return false; } if (!((state_0 & 0b10000) != 0 /* is SpecializationActive[PyNumberCheckNode.doBoolean(Boolean)] */) && arg1Value instanceof Boolean) { return false; } if (!((state_0 & 0b100000) != 0 /* is SpecializationActive[PyNumberCheckNode.doNone(PNone)] */) && arg1Value instanceof PNone) { 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[PyNumberCheckNode.doString(TruffleString)] || SpecializationActive[PyNumberCheckNode.doDouble(Double)] || SpecializationActive[PyNumberCheckNode.doInt(Integer)] || SpecializationActive[PyNumberCheckNode.doLong(Long)] || SpecializationActive[PyNumberCheckNode.doBoolean(Boolean)] || SpecializationActive[PyNumberCheckNode.doNone(PNone)] || SpecializationActive[PyNumberCheckNode.doOthers(Node, Object, LazyInteropLibrary, GetClassNode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, PyComplexCheckNode)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[PyNumberCheckNode.doString(TruffleString)] */ && arg1Value instanceof TruffleString) { TruffleString arg1Value_ = (TruffleString) arg1Value; return PyNumberCheckNode.doString(arg1Value_); } if ((state_0 & 0b10) != 0 /* is SpecializationActive[PyNumberCheckNode.doDouble(Double)] */ && arg1Value instanceof Double) { Double arg1Value_ = (Double) arg1Value; return PyNumberCheckNode.doDouble(arg1Value_); } if ((state_0 & 0b100) != 0 /* is SpecializationActive[PyNumberCheckNode.doInt(Integer)] */ && arg1Value instanceof Integer) { Integer arg1Value_ = (Integer) arg1Value; return PyNumberCheckNode.doInt(arg1Value_); } if ((state_0 & 0b1000) != 0 /* is SpecializationActive[PyNumberCheckNode.doLong(Long)] */ && arg1Value instanceof Long) { Long arg1Value_ = (Long) arg1Value; return PyNumberCheckNode.doLong(arg1Value_); } if ((state_0 & 0b10000) != 0 /* is SpecializationActive[PyNumberCheckNode.doBoolean(Boolean)] */ && arg1Value instanceof Boolean) { Boolean arg1Value_ = (Boolean) arg1Value; return PyNumberCheckNode.doBoolean(arg1Value_); } if ((state_0 & 0b100000) != 0 /* is SpecializationActive[PyNumberCheckNode.doNone(PNone)] */ && arg1Value instanceof PNone) { PNone arg1Value_ = (PNone) arg1Value; return PyNumberCheckNode.doNone(arg1Value_); } if ((state_0 & 0b1000000) != 0 /* is SpecializationActive[PyNumberCheckNode.doOthers(Node, Object, LazyInteropLibrary, GetClassNode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, PyComplexCheckNode)] */) { FallbackData s6_ = this.fallback_cache.get(arg0Value); if (s6_ != null) { if (fallbackGuard_(state_0, arg0Value, arg1Value)) { return PyNumberCheckNode.doOthers(s6_, arg1Value, this.fallback_interopLibrary_, this.fallback_getClassNode_, s6_.lookupIndex_, s6_.lookupFloat_, s6_.lookupInt_, this.fallback_checkComplex_); } } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); } private boolean 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[PyNumberCheckNode.doString(TruffleString)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doString(arg1Value_); } if (arg1Value instanceof Double) { Double arg1Value_ = (Double) arg1Value; state_0 = state_0 | 0b10 /* add SpecializationActive[PyNumberCheckNode.doDouble(Double)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doDouble(arg1Value_); } if (arg1Value instanceof Integer) { Integer arg1Value_ = (Integer) arg1Value; state_0 = state_0 | 0b100 /* add SpecializationActive[PyNumberCheckNode.doInt(Integer)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doInt(arg1Value_); } if (arg1Value instanceof Long) { Long arg1Value_ = (Long) arg1Value; state_0 = state_0 | 0b1000 /* add SpecializationActive[PyNumberCheckNode.doLong(Long)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doLong(arg1Value_); } if (arg1Value instanceof Boolean) { Boolean arg1Value_ = (Boolean) arg1Value; state_0 = state_0 | 0b10000 /* add SpecializationActive[PyNumberCheckNode.doBoolean(Boolean)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doBoolean(arg1Value_); } if (arg1Value instanceof PNone) { PNone arg1Value_ = (PNone) arg1Value; state_0 = state_0 | 0b100000 /* add SpecializationActive[PyNumberCheckNode.doNone(PNone)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doNone(arg1Value_); } FallbackData s6_ = arg0Value.insert(new FallbackData()); LookupCallableSlotInMRONode lookupIndex__ = s6_.insert((LookupCallableSlotInMRONode.create(SpecialMethodSlot.Index))); Objects.requireNonNull(lookupIndex__, "Specialization 'doOthers(Node, Object, LazyInteropLibrary, GetClassNode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, PyComplexCheckNode)' cache 'lookupIndex' 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'."); s6_.lookupIndex_ = lookupIndex__; LookupCallableSlotInMRONode lookupFloat__ = s6_.insert((LookupCallableSlotInMRONode.create(SpecialMethodSlot.Float))); Objects.requireNonNull(lookupFloat__, "Specialization 'doOthers(Node, Object, LazyInteropLibrary, GetClassNode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, PyComplexCheckNode)' cache 'lookupFloat' 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'."); s6_.lookupFloat_ = lookupFloat__; LookupCallableSlotInMRONode lookupInt__ = s6_.insert((LookupCallableSlotInMRONode.create(SpecialMethodSlot.Int))); Objects.requireNonNull(lookupInt__, "Specialization 'doOthers(Node, Object, LazyInteropLibrary, GetClassNode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, PyComplexCheckNode)' cache 'lookupInt' 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'."); s6_.lookupInt_ = lookupInt__; VarHandle.storeStoreFence(); this.fallback_cache.set(arg0Value, s6_); state_0 = state_0 | 0b1000000 /* add SpecializationActive[PyNumberCheckNode.doOthers(Node, Object, LazyInteropLibrary, GetClassNode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, LookupCallableSlotInMRONode, PyComplexCheckNode)] */; this.state_0_.set(arg0Value, state_0); return PyNumberCheckNode.doOthers(s6_, arg1Value, this.fallback_interopLibrary_, this.fallback_getClassNode_, lookupIndex__, lookupFloat__, lookupInt__, this.fallback_checkComplex_); } @Override public boolean isAdoptable() { return false; } } @GeneratedBy(PyNumberCheckNode.class) @DenyReplace private static final class FallbackData extends Node implements SpecializationDataNode { /** * State Info:
         *   0: InlinedCache
         *        Specialization: {@link PyNumberCheckNode#doOthers}
         *        Parameter: {@link LazyInteropLibrary} interopLibrary
         *        Inline method: {@link LazyInteropLibraryNodeGen#inline}
         *   1-17: InlinedCache
         *        Specialization: {@link PyNumberCheckNode#doOthers}
         *        Parameter: {@link GetClassNode} getClassNode
         *        Inline method: {@link GetClassNodeGen#inline}
         * 
*/ @CompilationFinal @UnsafeAccessedField private int fallback_state_0_; /** * State Info:
         *   0-18: InlinedCache
         *        Specialization: {@link PyNumberCheckNode#doOthers}
         *        Parameter: {@link PyComplexCheckNode} checkComplex
         *        Inline method: {@link PyComplexCheckNodeGen#inline}
         * 
*/ @CompilationFinal @UnsafeAccessedField private int fallback_state_1_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link LazyInteropLibrary} interopLibrary
         *   Inline method: {@link LazyInteropLibraryNodeGen#inline}
         *   Inline field: {@link Node} field1
*/ @Child @UnsafeAccessedField @SuppressWarnings("unused") private Node fallback_interopLibrary__field1_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link GetClassNode} getClassNode
         *   Inline method: {@link GetClassNodeGen#inline}
         *   Inline field: {@link Node} field1
*/ @Child @UnsafeAccessedField @SuppressWarnings("unused") private Node fallback_getClassNode__field1_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link LookupCallableSlotInMRONode} lookupIndex
*/ @Child LookupCallableSlotInMRONode lookupIndex_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link LookupCallableSlotInMRONode} lookupFloat
*/ @Child LookupCallableSlotInMRONode lookupFloat_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link LookupCallableSlotInMRONode} lookupInt
*/ @Child LookupCallableSlotInMRONode lookupInt_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link PyComplexCheckNode} checkComplex
         *   Inline method: {@link PyComplexCheckNodeGen#inline}
         *   Inline field: {@link Node} field1
*/ @Child @UnsafeAccessedField @SuppressWarnings("unused") private Node fallback_checkComplex__field1_; /** * Source Info:
         *   Specialization: {@link PyNumberCheckNode#doOthers}
         *   Parameter: {@link PyComplexCheckNode} checkComplex
         *   Inline method: {@link PyComplexCheckNodeGen#inline}
         *   Inline field: {@link Node} field2
*/ @Child @UnsafeAccessedField @SuppressWarnings("unused") private Node fallback_checkComplex__field2_; FallbackData() { } @Override public NodeCost getCost() { return NodeCost.NONE; } private static Lookup lookup_() { return MethodHandles.lookup(); } } @GeneratedBy(PyNumberCheckNode.class) @DenyReplace private static final class Uncached extends PyNumberCheckNode { @TruffleBoundary @Override public boolean execute(Node arg0Value, Object arg1Value) { if (arg1Value instanceof TruffleString) { TruffleString arg1Value_ = (TruffleString) arg1Value; return PyNumberCheckNode.doString(arg1Value_); } if (arg1Value instanceof Double) { Double arg1Value_ = (Double) arg1Value; return PyNumberCheckNode.doDouble(arg1Value_); } if (arg1Value instanceof Integer) { Integer arg1Value_ = (Integer) arg1Value; return PyNumberCheckNode.doInt(arg1Value_); } if (arg1Value instanceof Long) { Long arg1Value_ = (Long) arg1Value; return PyNumberCheckNode.doLong(arg1Value_); } if (arg1Value instanceof Boolean) { Boolean arg1Value_ = (Boolean) arg1Value; return PyNumberCheckNode.doBoolean(arg1Value_); } if (arg1Value instanceof PNone) { PNone arg1Value_ = (PNone) arg1Value; return PyNumberCheckNode.doNone(arg1Value_); } return PyNumberCheckNode.doOthers(arg0Value, arg1Value, (LazyInteropLibraryNodeGen.getUncached()), (GetClassNode.getUncached()), (LookupCallableSlotInMRONode.getUncached(SpecialMethodSlot.Index)), (LookupCallableSlotInMRONode.getUncached(SpecialMethodSlot.Float)), (LookupCallableSlotInMRONode.getUncached(SpecialMethodSlot.Int)), (PyComplexCheckNodeGen.getUncached())); } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @Override public boolean isAdoptable() { return false; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy