com.oracle.truffle.js.nodes.array.TestArrayNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.nodes.array;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
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.ReferenceField;
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.js.runtime.array.ScriptArray;
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
import java.lang.invoke.MethodHandles;
/**
* Debug Info:
* Specialization {@link TestArrayNode#doCached}
* Activation probability: 0.65000
* With/without class size: 17/4 bytes
* Specialization {@link TestArrayNode#doUncached}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(TestArrayNode.class)
@SuppressWarnings("javadoc")
public final class TestArrayNodeGen extends TestArrayNode {
static final ReferenceField CACHED_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "cached_cache", CachedData.class);
/**
* State Info:
* 0: SpecializationActive {@link TestArrayNode#doCached}
* 1: SpecializationActive {@link TestArrayNode#doUncached}
*
*/
@CompilationFinal private int state_0_;
@UnsafeAccessedField @CompilationFinal private CachedData cached_cache;
private TestArrayNodeGen(Test test) {
super(test);
}
@ExplodeLoop
@Override
public boolean executeBoolean(JSDynamicObject arg0Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[TestArrayNode.doCached(JSDynamicObject, ScriptArray)] || SpecializationActive[TestArrayNode.doUncached(JSDynamicObject)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[TestArrayNode.doCached(JSDynamicObject, ScriptArray)] */) {
CachedData s0_ = this.cached_cache;
while (s0_ != null) {
if ((s0_.arrayType_.isInstance(TestArrayNode.getArrayType(arg0Value)))) {
return doCached(arg0Value, s0_.arrayType_);
}
s0_ = s0_.next_;
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[TestArrayNode.doUncached(JSDynamicObject)] */) {
return doUncached(arg0Value);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
private boolean executeAndSpecialize(JSDynamicObject arg0Value) {
int state_0 = this.state_0_;
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[TestArrayNode.doUncached(JSDynamicObject)] */) {
while (true) {
int count0_ = 0;
CachedData s0_ = CACHED_CACHE_UPDATER.getVolatile(this);
CachedData s0_original = s0_;
while (s0_ != null) {
if ((s0_.arrayType_.isInstance(TestArrayNode.getArrayType(arg0Value)))) {
break;
}
count0_++;
s0_ = s0_.next_;
}
if (s0_ == null) {
{
ScriptArray arrayType__ = (TestArrayNode.getArrayType(arg0Value));
if ((arrayType__.isInstance(TestArrayNode.getArrayType(arg0Value))) && count0_ < (TestArrayNode.MAX_TYPE_COUNT)) {
s0_ = new CachedData(s0_original);
s0_.arrayType_ = arrayType__;
if (!CACHED_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[TestArrayNode.doCached(JSDynamicObject, ScriptArray)] */;
this.state_0_ = state_0;
}
}
}
if (s0_ != null) {
return doCached(arg0Value, s0_.arrayType_);
}
break;
}
}
this.cached_cache = null;
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[TestArrayNode.doCached(JSDynamicObject, ScriptArray)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[TestArrayNode.doUncached(JSDynamicObject)] */;
this.state_0_ = state_0;
return doUncached(arg0Value);
}
@NeverDefault
public static TestArrayNode create(Test test) {
return new TestArrayNodeGen(test);
}
@GeneratedBy(TestArrayNode.class)
@DenyReplace
private static final class CachedData implements SpecializationDataNode {
@CompilationFinal final CachedData next_;
/**
* Source Info:
* Specialization: {@link TestArrayNode#doCached}
* Parameter: {@link ScriptArray} arrayType
*/
@CompilationFinal ScriptArray arrayType_;
CachedData(CachedData next_) {
this.next_ = next_;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy