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