com.oracle.truffle.js.nodes.unary.IsNullNodeGen 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.CompilerDirectives.TruffleBoundary;
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.frame.VirtualFrame;
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.api.nodes.EncapsulatingNodeReference;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.js.nodes.JSGuards;
import com.oracle.truffle.js.nodes.JavaScriptNode;
import com.oracle.truffle.js.runtime.JSConfig;
import java.lang.invoke.MethodHandles;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link IsNullNode#doNull}
* Activation probability: 0.32000
* With/without class size: 7/0 bytes
* Specialization {@link IsNullNode#doUndefined}
* Activation probability: 0.26000
* With/without class size: 7/0 bytes
* Specialization {@link IsNullNode#doObject}
* Activation probability: 0.20000
* With/without class size: 6/0 bytes
* Specialization {@link IsNullNode#doCached}
* Activation probability: 0.14000
* With/without class size: 7/4 bytes
* Specialization {@link IsNullNode#doCached}
* Activation probability: 0.08000
* With/without class size: 4/0 bytes
*
*/
@GeneratedBy(IsNullNode.class)
@SuppressWarnings({"javadoc", "unused"})
public final class IsNullNodeGen extends IsNullNode {
static final ReferenceField CACHED0_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "cached0_cache", Cached0Data.class);
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
/**
* State Info:
* 0: SpecializationActive {@link IsNullNode#doNull}
* 1: SpecializationActive {@link IsNullNode#doUndefined}
* 2: SpecializationActive {@link IsNullNode#doObject}
* 3: SpecializationActive {@link IsNullNode#doCached}
* 4: SpecializationActive {@link IsNullNode#doCached}
*
*/
@CompilationFinal private int state_0_;
@UnsafeAccessedField @Child private Cached0Data cached0_cache;
private IsNullNodeGen(JavaScriptNode operand, boolean leftConstant) {
super(operand, leftConstant);
}
@ExplodeLoop
@Override
public Object execute(VirtualFrame frameValue) {
int state_0 = this.state_0_;
Object operandNodeValue_ = super.operandNode.execute(frameValue);
if (state_0 != 0 /* is SpecializationActive[IsNullNode.doNull(Object)] || SpecializationActive[IsNullNode.doUndefined(Object)] || SpecializationActive[IsNullNode.doObject(Object)] || SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] || SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[IsNullNode.doNull(Object)] */) {
if ((JSGuards.isJSNull(operandNodeValue_))) {
return IsNullNode.doNull(operandNodeValue_);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[IsNullNode.doUndefined(Object)] */) {
if ((JSGuards.isUndefined(operandNodeValue_))) {
return IsNullNode.doUndefined(operandNodeValue_);
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[IsNullNode.doObject(Object)] */) {
if ((JSGuards.isJSObject(operandNodeValue_))) {
return IsNullNode.doObject(operandNodeValue_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
Cached0Data s3_ = this.cached0_cache;
while (s3_ != null) {
if ((s3_.interop_.accepts(operandNodeValue_)) && (!(JSGuards.isJSDynamicObject(operandNodeValue_)))) {
return IsNullNode.doCached(operandNodeValue_, s3_.interop_);
}
s3_ = s3_.next_;
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
if ((!(JSGuards.isJSDynamicObject(operandNodeValue_)))) {
return this.cached1Boundary(state_0, operandNodeValue_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(operandNodeValue_);
}
@SuppressWarnings("static-method")
@TruffleBoundary
private Object cached1Boundary(int state_0, Object operandNodeValue_) {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
{
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached(operandNodeValue_));
return IsNullNode.doCached(operandNodeValue_, interop__);
}
} finally {
encapsulating_.set(prev_);
}
}
@ExplodeLoop
@Override
public boolean executeBoolean(VirtualFrame frameValue) {
int state_0 = this.state_0_;
Object operandNodeValue_ = super.operandNode.execute(frameValue);
if (state_0 != 0 /* is SpecializationActive[IsNullNode.doNull(Object)] || SpecializationActive[IsNullNode.doUndefined(Object)] || SpecializationActive[IsNullNode.doObject(Object)] || SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] || SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[IsNullNode.doNull(Object)] */) {
if ((JSGuards.isJSNull(operandNodeValue_))) {
return IsNullNode.doNull(operandNodeValue_);
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[IsNullNode.doUndefined(Object)] */) {
if ((JSGuards.isUndefined(operandNodeValue_))) {
return IsNullNode.doUndefined(operandNodeValue_);
}
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[IsNullNode.doObject(Object)] */) {
if ((JSGuards.isJSObject(operandNodeValue_))) {
return IsNullNode.doObject(operandNodeValue_);
}
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
Cached0Data s3_ = this.cached0_cache;
while (s3_ != null) {
if ((s3_.interop_.accepts(operandNodeValue_)) && (!(JSGuards.isJSDynamicObject(operandNodeValue_)))) {
return IsNullNode.doCached(operandNodeValue_, s3_.interop_);
}
s3_ = s3_.next_;
}
}
if ((state_0 & 0b10000) != 0 /* is SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
if ((!(JSGuards.isJSDynamicObject(operandNodeValue_)))) {
return this.cached1Boundary0(state_0, operandNodeValue_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(operandNodeValue_);
}
@SuppressWarnings("static-method")
@TruffleBoundary
private boolean cached1Boundary0(int state_0, Object operandNodeValue_) {
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
{
InteropLibrary interop__ = (INTEROP_LIBRARY_.getUncached(operandNodeValue_));
return IsNullNode.doCached(operandNodeValue_, interop__);
}
} finally {
encapsulating_.set(prev_);
}
}
@Override
public void executeVoid(VirtualFrame frameValue) {
executeBoolean(frameValue);
return;
}
private boolean executeAndSpecialize(Object operandNodeValue) {
int state_0 = this.state_0_;
if ((JSGuards.isJSNull(operandNodeValue))) {
state_0 = state_0 | 0b1 /* add SpecializationActive[IsNullNode.doNull(Object)] */;
this.state_0_ = state_0;
return IsNullNode.doNull(operandNodeValue);
}
if ((JSGuards.isUndefined(operandNodeValue))) {
state_0 = state_0 | 0b10 /* add SpecializationActive[IsNullNode.doUndefined(Object)] */;
this.state_0_ = state_0;
return IsNullNode.doUndefined(operandNodeValue);
}
if ((JSGuards.isJSObject(operandNodeValue))) {
state_0 = state_0 | 0b100 /* add SpecializationActive[IsNullNode.doObject(Object)] */;
this.state_0_ = state_0;
return IsNullNode.doObject(operandNodeValue);
}
if (((state_0 & 0b10000)) == 0 /* is-not SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */) {
while (true) {
int count3_ = 0;
Cached0Data s3_ = CACHED0_CACHE_UPDATER.getVolatile(this);
Cached0Data s3_original = s3_;
while (s3_ != null) {
if ((s3_.interop_.accepts(operandNodeValue)) && (!(JSGuards.isJSDynamicObject(operandNodeValue)))) {
break;
}
count3_++;
s3_ = s3_.next_;
}
if (s3_ == null) {
if ((!(JSGuards.isJSDynamicObject(operandNodeValue))) && count3_ < (JSConfig.InteropLibraryLimit)) {
// assert (s3_.interop_.accepts(operandNodeValue));
s3_ = this.insert(new Cached0Data(s3_original));
InteropLibrary interop__ = s3_.insert((INTEROP_LIBRARY_.create(operandNodeValue)));
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.");
s3_.interop_ = interop__;
if (!CACHED0_CACHE_UPDATER.compareAndSet(this, s3_original, s3_)) {
continue;
}
state_0 = state_0 | 0b1000 /* add SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */;
this.state_0_ = state_0;
}
}
if (s3_ != null) {
return IsNullNode.doCached(operandNodeValue, s3_.interop_);
}
break;
}
}
{
InteropLibrary interop__ = null;
{
EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent();
Node prev_ = encapsulating_.set(this);
try {
if ((!(JSGuards.isJSDynamicObject(operandNodeValue)))) {
interop__ = (INTEROP_LIBRARY_.getUncached(operandNodeValue));
this.cached0_cache = null;
state_0 = state_0 & 0xfffffff7 /* remove SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */;
state_0 = state_0 | 0b10000 /* add SpecializationActive[IsNullNode.doCached(Object, InteropLibrary)] */;
this.state_0_ = state_0;
return IsNullNode.doCached(operandNodeValue, interop__);
}
} finally {
encapsulating_.set(prev_);
}
}
}
throw new UnsupportedSpecializationException(this, new Node[] {super.operandNode}, operandNodeValue);
}
@NeverDefault
public static IsNullNode create(JavaScriptNode operand, boolean leftConstant) {
return new IsNullNodeGen(operand, leftConstant);
}
@GeneratedBy(IsNullNode.class)
@DenyReplace
private static final class Cached0Data extends Node implements SpecializationDataNode {
@Child Cached0Data next_;
/**
* Source Info:
* Specialization: {@link IsNullNode#doCached}
* Parameter: {@link InteropLibrary} interop
*/
@Child InteropLibrary interop_;
Cached0Data(Cached0Data next_) {
this.next_ = next_;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy