com.oracle.truffle.js.nodes.unary.JSIsArrayNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.nodes.unary;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.DSLSupport;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
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.interop.InteropLibrary;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link JSIsArrayNode#doIsArrayClass}
* Activation probability: 0.27381
* With/without class size: 8/6 bytes
* Specialization {@link JSIsArrayNode#doJSArray}
* Activation probability: 0.23095
* With/without class size: 6/0 bytes
* Specialization {@link JSIsArrayNode#doJSProxy}
* Activation probability: 0.18810
* With/without class size: 6/0 bytes
* Specialization {@link JSIsArrayNode#doJSObject}
* Activation probability: 0.14524
* With/without class size: 5/0 bytes
* Specialization {@link JSIsArrayNode#doNotObject}
* Activation probability: 0.10238
* With/without class size: 5/0 bytes
* Specialization {@link JSIsArrayNode#doPrimitiveOrForeign}
* Activation probability: 0.05952
* With/without class size: 5/4 bytes
*
*/
@GeneratedBy(JSIsArrayNode.class)
@SuppressWarnings("javadoc")
public final class JSIsArrayNodeGen extends JSIsArrayNode {
static final ReferenceField IS_ARRAY_CLASS_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "isArrayClass_cache", IsArrayClassData.class);
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
/**
* State Info:
* 0: SpecializationActive {@link JSIsArrayNode#doIsArrayClass}
* 1: SpecializationActive {@link JSIsArrayNode#doJSArray}
* 2: SpecializationActive {@link JSIsArrayNode#doJSObject}
* 3: SpecializationActive {@link JSIsArrayNode#doJSProxy}
* 4: SpecializationActive {@link JSIsArrayNode#doNotObject}
* 5: SpecializationActive {@link JSIsArrayNode#doPrimitiveOrForeign}
*
*/
@CompilationFinal private int state_0_;
@UnsafeAccessedField @CompilationFinal private IsArrayClassData isArrayClass_cache;
/**
* Source Info:
* Specialization: {@link JSIsArrayNode#doPrimitiveOrForeign}
* Parameter: {@link InteropLibrary} interop
*/
@Child private InteropLibrary primitiveOrForeign_interop_;
private JSIsArrayNodeGen(boolean jsType) {
super(jsType);
}
@Override
public boolean execute(Object arg0Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[JSIsArrayNode.doIsArrayClass(Object, Class<>, boolean, boolean)] || SpecializationActive[JSIsArrayNode.doJSArray(Object)] || SpecializationActive[JSIsArrayNode.doJSProxy(JSDynamicObject)] || SpecializationActive[JSIsArrayNode.doJSObject(Object)] || SpecializationActive[JSIsArrayNode.doNotObject(Object)] || SpecializationActive[JSIsArrayNode.doPrimitiveOrForeign(Object, InteropLibrary)] */) {
if ((state_0 & 0b11) != 0 /* is SpecializationActive[JSIsArrayNode.doIsArrayClass(Object, Class<>, boolean, boolean)] || SpecializationActive[JSIsArrayNode.doJSArray(Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[JSIsArrayNode.doIsArrayClass(Object, Class<>, boolean, boolean)] */) {
IsArrayClassData s0_ = this.isArrayClass_cache;
if (s0_ != null) {
assert DSLSupport.assertIdempotence((!(s0_.cachedIsProxy_)));
assert DSLSupport.assertIdempotence((s0_.cachedClass_ != null));
if ((CompilerDirectives.isExact(arg0Value, s0_.cachedClass_))) {
return JSIsArrayNode.doIsArrayClass(arg0Value, s0_.cachedClass_, s0_.cachedIsArray_, s0_.cachedIsProxy_);
}
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[JSIsArrayNode.doJSArray(Object)] */) {
if ((JSGuards.isJSArray(arg0Value))) {
return doJSArray(arg0Value);
}
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[JSIsArrayNode.doJSProxy(JSDynamicObject)] */ && arg0Value instanceof JSDynamicObject) {
JSDynamicObject arg0Value_ = (JSDynamicObject) arg0Value;
if ((JSGuards.isJSProxy(arg0Value_))) {
return doJSProxy(arg0Value_);
}
}
if ((state_0 & 0b110100) != 0 /* is SpecializationActive[JSIsArrayNode.doJSObject(Object)] || SpecializationActive[JSIsArrayNode.doNotObject(Object)] || SpecializationActive[JSIsArrayNode.doPrimitiveOrForeign(Object, InteropLibrary)] */) {
if ((state_0 & 0b100) != 0 /* is SpecializationActive[JSIsArrayNode.doJSObject(Object)] */) {
if ((!(JSGuards.isJSArray(arg0Value))) && (!(JSGuards.isJSProxy(arg0Value))) && (JSGuards.isJSDynamicObject(arg0Value))) {
return doJSObject(arg0Value);
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[JSIsArrayNode.doNotObject(Object)] */) {
if ((!(JSGuards.isJSDynamicObject(arg0Value)))) {
assert DSLSupport.assertIdempotence((jsType));
return doNotObject(arg0Value);
}
}
if ((state_0 & 0b100000) != 0 /* is SpecializationActive[JSIsArrayNode.doPrimitiveOrForeign(Object, InteropLibrary)] */) {
{
InteropLibrary interop__ = this.primitiveOrForeign_interop_;
if (interop__ != null) {
if ((!(JSGuards.isJSDynamicObject(arg0Value)))) {
assert DSLSupport.assertIdempotence((!(jsType)));
return doPrimitiveOrForeign(arg0Value, interop__);
}
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
private boolean executeAndSpecialize(Object arg0Value) {
int state_0 = this.state_0_;
if (((state_0 & 0b110)) == 0 /* is-not SpecializationActive[JSIsArrayNode.doJSArray(Object)] && SpecializationActive[JSIsArrayNode.doJSObject(Object)] */) {
while (true) {
int count0_ = 0;
IsArrayClassData s0_ = IS_ARRAY_CLASS_CACHE_UPDATER.getVolatile(this);
IsArrayClassData s0_original = s0_;
while (s0_ != null) {
assert DSLSupport.assertIdempotence((!(s0_.cachedIsProxy_)));
assert DSLSupport.assertIdempotence((s0_.cachedClass_ != null));
if ((CompilerDirectives.isExact(arg0Value, s0_.cachedClass_))) {
break;
}
count0_++;
s0_ = null;
break;
}
if (s0_ == null && count0_ < 1) {
{
boolean cachedIsProxy__ = (JSGuards.isJSProxy(arg0Value));
if ((!(cachedIsProxy__))) {
Class> cachedClass__ = (JSGuards.getClassIfJSDynamicObject(arg0Value));
if ((cachedClass__ != null) && (CompilerDirectives.isExact(arg0Value, cachedClass__))) {
s0_ = new IsArrayClassData();
s0_.cachedClass_ = cachedClass__;
s0_.cachedIsArray_ = (JSGuards.isJSArray(arg0Value));
s0_.cachedIsProxy_ = cachedIsProxy__;
if (!IS_ARRAY_CLASS_CACHE_UPDATER.compareAndSet(this, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[JSIsArrayNode.doIsArrayClass(Object, Class<>, boolean, boolean)] */;
this.state_0_ = state_0;
}
}
}
}
if (s0_ != null) {
return JSIsArrayNode.doIsArrayClass(arg0Value, s0_.cachedClass_, s0_.cachedIsArray_, s0_.cachedIsProxy_);
}
break;
}
}
if ((JSGuards.isJSArray(arg0Value))) {
this.isArrayClass_cache = null;
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[JSIsArrayNode.doIsArrayClass(Object, Class<>, boolean, boolean)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[JSIsArrayNode.doJSArray(Object)] */;
this.state_0_ = state_0;
return doJSArray(arg0Value);
}
if (arg0Value instanceof JSDynamicObject) {
JSDynamicObject arg0Value_ = (JSDynamicObject) arg0Value;
if ((JSGuards.isJSProxy(arg0Value_))) {
state_0 = state_0 | 0b1000 /* add SpecializationActive[JSIsArrayNode.doJSProxy(JSDynamicObject)] */;
this.state_0_ = state_0;
return doJSProxy(arg0Value_);
}
}
if ((!(JSGuards.isJSArray(arg0Value))) && (!(JSGuards.isJSProxy(arg0Value))) && (JSGuards.isJSDynamicObject(arg0Value))) {
this.isArrayClass_cache = null;
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[JSIsArrayNode.doIsArrayClass(Object, Class<>, boolean, boolean)] */;
state_0 = state_0 | 0b100 /* add SpecializationActive[JSIsArrayNode.doJSObject(Object)] */;
this.state_0_ = state_0;
return doJSObject(arg0Value);
}
if ((!(JSGuards.isJSDynamicObject(arg0Value))) && (jsType)) {
state_0 = state_0 | 0b10000 /* add SpecializationActive[JSIsArrayNode.doNotObject(Object)] */;
this.state_0_ = state_0;
return doNotObject(arg0Value);
}
if ((!(JSGuards.isJSDynamicObject(arg0Value))) && (!(jsType))) {
InteropLibrary interop__ = this.insert((INTEROP_LIBRARY_.createDispatched(6)));
Objects.requireNonNull(interop__, "A specialization cache returned a 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 the default value.");
VarHandle.storeStoreFence();
this.primitiveOrForeign_interop_ = interop__;
state_0 = state_0 | 0b100000 /* add SpecializationActive[JSIsArrayNode.doPrimitiveOrForeign(Object, InteropLibrary)] */;
this.state_0_ = state_0;
return doPrimitiveOrForeign(arg0Value, interop__);
}
throw new UnsupportedSpecializationException(this, null, arg0Value);
}
@NeverDefault
public static JSIsArrayNode create(boolean jsType) {
return new JSIsArrayNodeGen(jsType);
}
@GeneratedBy(JSIsArrayNode.class)
@DenyReplace
private static final class IsArrayClassData implements SpecializationDataNode {
/**
* Source Info:
* Specialization: {@link JSIsArrayNode#doIsArrayClass}
* Parameter: {@link Class} cachedClass
*/
@CompilationFinal Class> cachedClass_;
/**
* Source Info:
* Specialization: {@link JSIsArrayNode#doIsArrayClass}
* Parameter: boolean cachedIsArray
*/
@CompilationFinal boolean cachedIsArray_;
/**
* Source Info:
* Specialization: {@link JSIsArrayNode#doIsArrayClass}
* Parameter: boolean cachedIsProxy
*/
@CompilationFinal boolean cachedIsProxy_;
IsArrayClassData() {
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy