com.oracle.graal.python.nodes.util.NarrowBigIntegerNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
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.UnsupportedSpecializationException;
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 com.oracle.truffle.api.profiles.InlinedConditionProfile;
import java.lang.invoke.VarHandle;
import java.math.BigInteger;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link NarrowBigIntegerNode#narrowBigInteger0}
* Activation probability: 0.65000
* With/without class size: 11/0 bytes
* Specialization {@link NarrowBigIntegerNode#narrowBigInteger}
* Activation probability: 0.35000
* With/without class size: 12/5 bytes
*
*/
@GeneratedBy(NarrowBigIntegerNode.class)
@SuppressWarnings("javadoc")
public final class NarrowBigIntegerNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static NarrowBigIntegerNode getUncached() {
return NarrowBigIntegerNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#narrowBigInteger_factory_}
*
*/
@NeverDefault
public static NarrowBigIntegerNode inline(@RequiredField(bits = 6, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new NarrowBigIntegerNodeGen.Inlined(target);
}
@GeneratedBy(NarrowBigIntegerNode.class)
@DenyReplace
private static final class Inlined extends NarrowBigIntegerNode {
/**
* State Info:
* 0: SpecializationActive {@link NarrowBigIntegerNode#narrowBigInteger0}
* 1: SpecializationActive {@link NarrowBigIntegerNode#narrowBigInteger}
* 2-3: InlinedCache
* Specialization: {@link NarrowBigIntegerNode#narrowBigInteger}
* Parameter: {@link InlinedConditionProfile} fitsIntProfile
* Inline method: {@link InlinedConditionProfile#inline}
* 4-5: InlinedCache
* Specialization: {@link NarrowBigIntegerNode#narrowBigInteger}
* Parameter: {@link InlinedConditionProfile} fitsLongProfile
* Inline method: {@link InlinedConditionProfile#inline}
*
*/
private final StateField state_0_;
private final ReferenceField narrowBigInteger_factory_;
/**
* Source Info:
* Specialization: {@link NarrowBigIntegerNode#narrowBigInteger}
* Parameter: {@link InlinedConditionProfile} fitsIntProfile
* Inline method: {@link InlinedConditionProfile#inline}
*/
private final InlinedConditionProfile narrowBigInteger_fitsIntProfile_;
/**
* Source Info:
* Specialization: {@link NarrowBigIntegerNode#narrowBigInteger}
* Parameter: {@link InlinedConditionProfile} fitsLongProfile
* Inline method: {@link InlinedConditionProfile#inline}
*/
private final InlinedConditionProfile narrowBigInteger_fitsLongProfile_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(NarrowBigIntegerNode.class);
this.state_0_ = target.getState(0, 6);
this.narrowBigInteger_factory_ = target.getReference(1, PythonObjectFactory.class);
this.narrowBigInteger_fitsIntProfile_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, state_0_.subUpdater(2, 2)));
this.narrowBigInteger_fitsLongProfile_ = InlinedConditionProfile.inline(InlineTarget.create(InlinedConditionProfile.class, state_0_.subUpdater(4, 2)));
}
@Override
public Object execute(Node arg0Value, BigInteger arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((state_0 & 0b11) != 0 /* is SpecializationActive[NarrowBigIntegerNode.narrowBigInteger0(BigInteger)] || SpecializationActive[NarrowBigIntegerNode.narrowBigInteger(Node, BigInteger, InlinedConditionProfile, InlinedConditionProfile, PythonObjectFactory)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[NarrowBigIntegerNode.narrowBigInteger0(BigInteger)] */) {
if ((arg1Value.signum() == 0)) {
return NarrowBigIntegerNode.narrowBigInteger0(arg1Value);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[NarrowBigIntegerNode.narrowBigInteger(Node, BigInteger, InlinedConditionProfile, InlinedConditionProfile, PythonObjectFactory)] */) {
{
PythonObjectFactory factory__ = this.narrowBigInteger_factory_.get(arg0Value);
if (factory__ != null) {
if ((arg1Value.signum() != 0)) {
assert InlineSupport.validate(arg0Value, this.state_0_, this.state_0_);
return NarrowBigIntegerNode.narrowBigInteger(arg0Value, arg1Value, this.narrowBigInteger_fitsIntProfile_, this.narrowBigInteger_fitsLongProfile_, factory__);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private Object executeAndSpecialize(Node arg0Value, BigInteger arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((arg1Value.signum() == 0)) {
state_0 = state_0 | 0b1 /* add SpecializationActive[NarrowBigIntegerNode.narrowBigInteger0(BigInteger)] */;
this.state_0_.set(arg0Value, state_0);
return NarrowBigIntegerNode.narrowBigInteger0(arg1Value);
}
if ((arg1Value.signum() != 0)) {
PythonObjectFactory factory__ = arg0Value.insert((PythonObjectFactory.create()));
Objects.requireNonNull(factory__, "Specialization 'narrowBigInteger(Node, BigInteger, InlinedConditionProfile, InlinedConditionProfile, PythonObjectFactory)' cache 'factory' 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.narrowBigInteger_factory_.set(arg0Value, factory__);
state_0 = state_0 | 0b10 /* add SpecializationActive[NarrowBigIntegerNode.narrowBigInteger(Node, BigInteger, InlinedConditionProfile, InlinedConditionProfile, PythonObjectFactory)] */;
this.state_0_.set(arg0Value, state_0);
assert InlineSupport.validate(arg0Value, this.state_0_, this.state_0_);
return NarrowBigIntegerNode.narrowBigInteger(arg0Value, arg1Value, this.narrowBigInteger_fitsIntProfile_, this.narrowBigInteger_fitsLongProfile_, factory__);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(NarrowBigIntegerNode.class)
@DenyReplace
private static final class Uncached extends NarrowBigIntegerNode {
@TruffleBoundary
@Override
public Object execute(Node arg0Value, BigInteger arg1Value) {
if ((arg1Value.signum() == 0)) {
return NarrowBigIntegerNode.narrowBigInteger0(arg1Value);
}
if ((arg1Value.signum() != 0)) {
return NarrowBigIntegerNode.narrowBigInteger(arg0Value, arg1Value, (InlinedConditionProfile.getUncached()), (InlinedConditionProfile.getUncached()), (PythonObjectFactory.getUncached()));
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null}, arg0Value, arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy