com.oracle.graal.python.nodes.util.SplitArgsNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.graal.python.nodes.util;
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.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import java.lang.invoke.MethodHandles;
/**
* Debug Info:
* Specialization {@link SplitArgsNode#doEmpty}
* Activation probability: 0.48333
* With/without class size: 9/0 bytes
* Specialization {@link SplitArgsNode#doCached}
* Activation probability: 0.33333
* With/without class size: 10/4 bytes
* Specialization {@link SplitArgsNode#doGeneric}
* Activation probability: 0.18333
* With/without class size: 6/0 bytes
*
*/
@GeneratedBy(SplitArgsNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class SplitArgsNodeGen extends SplitArgsNode {
static final ReferenceField CACHED_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "cached_cache", CachedData.class);
private static final Uncached UNCACHED = new Uncached();
/**
* State Info:
* 0: SpecializationActive {@link SplitArgsNode#doEmpty}
* 1: SpecializationActive {@link SplitArgsNode#doCached}
* 2: SpecializationActive {@link SplitArgsNode#doGeneric}
*
*/
@CompilationFinal private int state_0_;
@UnsafeAccessedField @CompilationFinal private CachedData cached_cache;
private SplitArgsNodeGen() {
}
@ExplodeLoop
@Override
public Object[] execute(Node arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[SplitArgsNode.doEmpty(Object[])] || SpecializationActive[SplitArgsNode.doCached(Object[], int)] || SpecializationActive[SplitArgsNode.doGeneric(Object[])] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[SplitArgsNode.doEmpty(Object[])] */) {
if ((arg1Value.length == 1)) {
return SplitArgsNode.doEmpty(arg1Value);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[SplitArgsNode.doCached(Object[], int)] */) {
CachedData s1_ = this.cached_cache;
while (s1_ != null) {
if ((arg1Value.length == s1_.cachedLen_) && (arg1Value.length < 32)) {
return SplitArgsNode.doCached(arg1Value, s1_.cachedLen_);
}
s1_ = s1_.next_;
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[SplitArgsNode.doGeneric(Object[])] */) {
return SplitArgsNode.doGeneric(arg1Value);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private Object[] executeAndSpecialize(Node arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_;
if ((arg1Value.length == 1)) {
state_0 = state_0 | 0b1 /* add SpecializationActive[SplitArgsNode.doEmpty(Object[])] */;
this.state_0_ = state_0;
return SplitArgsNode.doEmpty(arg1Value);
}
if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[SplitArgsNode.doGeneric(Object[])] */) {
while (true) {
int count1_ = 0;
CachedData s1_ = CACHED_CACHE_UPDATER.getVolatile(this);
CachedData s1_original = s1_;
while (s1_ != null) {
if ((arg1Value.length == s1_.cachedLen_) && (arg1Value.length < 32)) {
break;
}
count1_++;
s1_ = s1_.next_;
}
if (s1_ == null) {
if ((arg1Value.length < 32) && count1_ < (3)) {
// assert (arg1Value.length == s1_.cachedLen_);
s1_ = new CachedData(s1_original);
s1_.cachedLen_ = (arg1Value.length);
if (!CACHED_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) {
continue;
}
state_0 = state_0 | 0b10 /* add SpecializationActive[SplitArgsNode.doCached(Object[], int)] */;
this.state_0_ = state_0;
}
}
if (s1_ != null) {
return SplitArgsNode.doCached(arg1Value, s1_.cachedLen_);
}
break;
}
}
this.cached_cache = null;
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[SplitArgsNode.doCached(Object[], int)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[SplitArgsNode.doGeneric(Object[])] */;
this.state_0_ = state_0;
return SplitArgsNode.doGeneric(arg1Value);
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if (state_0 == 0) {
return NodeCost.UNINITIALIZED;
} else {
if ((state_0 & (state_0 - 1)) == 0 /* is-single */) {
CachedData s1_ = this.cached_cache;
if ((s1_ == null || s1_.next_ == null)) {
return NodeCost.MONOMORPHIC;
}
}
}
return NodeCost.POLYMORPHIC;
}
@NeverDefault
public static SplitArgsNode create() {
return new SplitArgsNodeGen();
}
@NeverDefault
public static SplitArgsNode getUncached() {
return SplitArgsNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#cached_cache}
*
*/
@NeverDefault
public static SplitArgsNode inline(@RequiredField(bits = 3, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class) InlineTarget target) {
return new SplitArgsNodeGen.Inlined(target);
}
@GeneratedBy(SplitArgsNode.class)
@DenyReplace
private static final class Inlined extends SplitArgsNode {
/**
* State Info:
* 0: SpecializationActive {@link SplitArgsNode#doEmpty}
* 1: SpecializationActive {@link SplitArgsNode#doCached}
* 2: SpecializationActive {@link SplitArgsNode#doGeneric}
*
*/
private final StateField state_0_;
private final ReferenceField cached_cache;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(SplitArgsNode.class);
this.state_0_ = target.getState(0, 3);
this.cached_cache = target.getReference(1, CachedData.class);
}
@ExplodeLoop
@Override
public Object[] execute(Node arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[SplitArgsNode.doEmpty(Object[])] || SpecializationActive[SplitArgsNode.doCached(Object[], int)] || SpecializationActive[SplitArgsNode.doGeneric(Object[])] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[SplitArgsNode.doEmpty(Object[])] */) {
if ((arg1Value.length == 1)) {
return SplitArgsNode.doEmpty(arg1Value);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[SplitArgsNode.doCached(Object[], int)] */) {
CachedData s1_ = this.cached_cache.get(arg0Value);
while (s1_ != null) {
if ((arg1Value.length == s1_.cachedLen_) && (arg1Value.length < 32)) {
return SplitArgsNode.doCached(arg1Value, s1_.cachedLen_);
}
s1_ = s1_.next_;
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[SplitArgsNode.doGeneric(Object[])] */) {
return SplitArgsNode.doGeneric(arg1Value);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private Object[] executeAndSpecialize(Node arg0Value, Object[] arg1Value) {
int state_0 = this.state_0_.get(arg0Value);
if ((arg1Value.length == 1)) {
state_0 = state_0 | 0b1 /* add SpecializationActive[SplitArgsNode.doEmpty(Object[])] */;
this.state_0_.set(arg0Value, state_0);
return SplitArgsNode.doEmpty(arg1Value);
}
if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[SplitArgsNode.doGeneric(Object[])] */) {
while (true) {
int count1_ = 0;
CachedData s1_ = this.cached_cache.getVolatile(arg0Value);
CachedData s1_original = s1_;
while (s1_ != null) {
if ((arg1Value.length == s1_.cachedLen_) && (arg1Value.length < 32)) {
break;
}
count1_++;
s1_ = s1_.next_;
}
if (s1_ == null) {
if ((arg1Value.length < 32) && count1_ < (3)) {
// assert (arg1Value.length == s1_.cachedLen_);
s1_ = new CachedData(s1_original);
s1_.cachedLen_ = (arg1Value.length);
if (!this.cached_cache.compareAndSet(arg0Value, s1_original, s1_)) {
continue;
}
state_0 = state_0 | 0b10 /* add SpecializationActive[SplitArgsNode.doCached(Object[], int)] */;
this.state_0_.set(arg0Value, state_0);
}
}
if (s1_ != null) {
return SplitArgsNode.doCached(arg1Value, s1_.cachedLen_);
}
break;
}
}
this.cached_cache.set(arg0Value, null);
state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[SplitArgsNode.doCached(Object[], int)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[SplitArgsNode.doGeneric(Object[])] */;
this.state_0_.set(arg0Value, state_0);
return SplitArgsNode.doGeneric(arg1Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(SplitArgsNode.class)
@DenyReplace
private static final class CachedData implements SpecializationDataNode {
@CompilationFinal final CachedData next_;
/**
* Source Info:
* Specialization: {@link SplitArgsNode#doCached}
* Parameter: int cachedLen
*/
@CompilationFinal int cachedLen_;
CachedData(CachedData next_) {
this.next_ = next_;
}
}
@GeneratedBy(SplitArgsNode.class)
@DenyReplace
private static final class Uncached extends SplitArgsNode {
@TruffleBoundary
@Override
public Object[] execute(Node arg0Value, Object[] arg1Value) {
if ((arg1Value.length == 1)) {
return SplitArgsNode.doEmpty(arg1Value);
}
return SplitArgsNode.doGeneric(arg1Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy