com.oracle.truffle.sl.nodes.expression.SLEqualNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.sl.nodes.expression;
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.frame.VirtualFrame;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import com.oracle.truffle.sl.nodes.SLTypes;
import com.oracle.truffle.sl.nodes.SLTypesGen;
import com.oracle.truffle.sl.runtime.SLFunction;
import com.oracle.truffle.sl.runtime.SLNull;
import java.math.BigInteger;
import java.util.concurrent.locks.Lock;
@GeneratedBy(SLEqualNode.class)
public final class SLEqualNodeGen extends SLEqualNode {
@Child private SLExpressionNode leftNode_;
@Child private SLExpressionNode rightNode_;
@CompilationFinal private int state_ = 1;
private SLEqualNodeGen(SLExpressionNode leftNode, SLExpressionNode rightNode) {
this.leftNode_ = leftNode;
this.rightNode_ = rightNode;
}
@Override
public Object executeGeneric(VirtualFrame frameValue) {
int state = state_;
if ((state & 0b1111111101) == 0 /* only-active equal(long, long) */) {
return executeGeneric_long_long0(frameValue, state);
} else if ((state & 0b1111110111) == 0 /* only-active equal(boolean, boolean) */) {
return executeGeneric_boolean_boolean1(frameValue, state);
} else {
return executeGeneric_generic2(frameValue, state);
}
}
private Object executeGeneric_long_long0(VirtualFrame frameValue, int state) {
long leftNodeValue_;
try {
leftNodeValue_ = leftNode_.executeLong(frameValue);
} catch (UnexpectedResultException ex) {
Object rightNodeValue = rightNode_.executeGeneric(frameValue);
return executeAndSpecialize(ex.getResult(), rightNodeValue);
}
long rightNodeValue_;
try {
rightNodeValue_ = rightNode_.executeLong(frameValue);
} catch (UnexpectedResultException ex) {
return executeAndSpecialize(leftNodeValue_, ex.getResult());
}
assert (state & 0b10) != 0 /* is-active equal(long, long) */;
return equal(leftNodeValue_, rightNodeValue_);
}
private Object executeGeneric_boolean_boolean1(VirtualFrame frameValue, int state) {
boolean leftNodeValue_;
try {
leftNodeValue_ = leftNode_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
Object rightNodeValue = rightNode_.executeGeneric(frameValue);
return executeAndSpecialize(ex.getResult(), rightNodeValue);
}
boolean rightNodeValue_;
try {
rightNodeValue_ = rightNode_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
return executeAndSpecialize(leftNodeValue_, ex.getResult());
}
assert (state & 0b1000) != 0 /* is-active equal(boolean, boolean) */;
return equal(leftNodeValue_, rightNodeValue_);
}
private Object executeGeneric_generic2(VirtualFrame frameValue, int state) {
Object leftNodeValue_ = leftNode_.executeGeneric(frameValue);
Object rightNodeValue_ = rightNode_.executeGeneric(frameValue);
if ((state & 0b10) != 0 /* is-active equal(long, long) */ && leftNodeValue_ instanceof Long) {
long leftNodeValue__ = (long) leftNodeValue_;
if (rightNodeValue_ instanceof Long) {
long rightNodeValue__ = (long) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b100) != 0 /* is-active equal(BigInteger, BigInteger) */ && SLTypesGen.isImplicitBigInteger((state & 0b110000000000) >>> 10 /* extract-implicit-active 0:BigInteger */, leftNodeValue_)) {
BigInteger leftNodeValue__ = SLTypesGen.asImplicitBigInteger((state & 0b110000000000) >>> 10 /* extract-implicit-active 0:BigInteger */, leftNodeValue_);
if (SLTypesGen.isImplicitBigInteger((state & 0b11000000000000) >>> 12 /* extract-implicit-active 1:BigInteger */, rightNodeValue_)) {
BigInteger rightNodeValue__ = SLTypesGen.asImplicitBigInteger((state & 0b11000000000000) >>> 12 /* extract-implicit-active 1:BigInteger */, rightNodeValue_);
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b1000) != 0 /* is-active equal(boolean, boolean) */ && leftNodeValue_ instanceof Boolean) {
boolean leftNodeValue__ = (boolean) leftNodeValue_;
if (rightNodeValue_ instanceof Boolean) {
boolean rightNodeValue__ = (boolean) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b10000) != 0 /* is-active equal(String, String) */ && leftNodeValue_ instanceof String) {
String leftNodeValue__ = (String) leftNodeValue_;
if (rightNodeValue_ instanceof String) {
String rightNodeValue__ = (String) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b100000) != 0 /* is-active equal(SLFunction, SLFunction) */ && leftNodeValue_ instanceof SLFunction) {
SLFunction leftNodeValue__ = (SLFunction) leftNodeValue_;
if (rightNodeValue_ instanceof SLFunction) {
SLFunction rightNodeValue__ = (SLFunction) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b1000000) != 0 /* is-active equal(SLNull, SLNull) */ && SLTypes.isSLNull(leftNodeValue_)) {
SLNull leftNodeValue__ = SLTypes.asSLNull(leftNodeValue_);
if (SLTypes.isSLNull(rightNodeValue_)) {
SLNull rightNodeValue__ = SLTypes.asSLNull(rightNodeValue_);
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b10000000) != 0 /* is-active equal(TruffleObject, TruffleObject) */ && leftNodeValue_ instanceof TruffleObject) {
TruffleObject leftNodeValue__ = (TruffleObject) leftNodeValue_;
if (rightNodeValue_ instanceof TruffleObject) {
TruffleObject rightNodeValue__ = (TruffleObject) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b1100000000) != 0 /* is-active equal(Object, Object) || typeError(Object, Object) */) {
if ((state & 0b100000000) != 0 /* is-active equal(Object, Object) */) {
if ((SLEqualNode.differentClasses(leftNodeValue_, rightNodeValue_))) {
return equal(leftNodeValue_, rightNodeValue_);
}
}
if ((state & 0b1000000000) != 0 /* is-active typeError(Object, Object) */) {
if (fallbackGuard_(state, leftNodeValue_, rightNodeValue_)) {
return typeError(leftNodeValue_, rightNodeValue_);
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(leftNodeValue_, rightNodeValue_);
}
@Override
public boolean executeBoolean(VirtualFrame frameValue) throws UnexpectedResultException {
int state = state_;
if ((state & 0b1000000000) != 0 /* is-active typeError(Object, Object) */) {
return SLTypesGen.expectBoolean(executeGeneric(frameValue));
}
if ((state & 0b1111111101) == 0 /* only-active equal(long, long) */) {
return executeBoolean_long_long3(frameValue, state);
} else if ((state & 0b1111110111) == 0 /* only-active equal(boolean, boolean) */) {
return executeBoolean_boolean_boolean4(frameValue, state);
} else {
return executeBoolean_generic5(frameValue, state);
}
}
private boolean executeBoolean_long_long3(VirtualFrame frameValue, int state) throws UnexpectedResultException {
long leftNodeValue_;
try {
leftNodeValue_ = leftNode_.executeLong(frameValue);
} catch (UnexpectedResultException ex) {
Object rightNodeValue = rightNode_.executeGeneric(frameValue);
return SLTypesGen.expectBoolean(executeAndSpecialize(ex.getResult(), rightNodeValue));
}
long rightNodeValue_;
try {
rightNodeValue_ = rightNode_.executeLong(frameValue);
} catch (UnexpectedResultException ex) {
return SLTypesGen.expectBoolean(executeAndSpecialize(leftNodeValue_, ex.getResult()));
}
assert (state & 0b10) != 0 /* is-active equal(long, long) */;
return equal(leftNodeValue_, rightNodeValue_);
}
private boolean executeBoolean_boolean_boolean4(VirtualFrame frameValue, int state) throws UnexpectedResultException {
boolean leftNodeValue_;
try {
leftNodeValue_ = leftNode_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
Object rightNodeValue = rightNode_.executeGeneric(frameValue);
return SLTypesGen.expectBoolean(executeAndSpecialize(ex.getResult(), rightNodeValue));
}
boolean rightNodeValue_;
try {
rightNodeValue_ = rightNode_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
return SLTypesGen.expectBoolean(executeAndSpecialize(leftNodeValue_, ex.getResult()));
}
assert (state & 0b1000) != 0 /* is-active equal(boolean, boolean) */;
return equal(leftNodeValue_, rightNodeValue_);
}
private boolean executeBoolean_generic5(VirtualFrame frameValue, int state) throws UnexpectedResultException {
Object leftNodeValue_ = leftNode_.executeGeneric(frameValue);
Object rightNodeValue_ = rightNode_.executeGeneric(frameValue);
if ((state & 0b10) != 0 /* is-active equal(long, long) */ && leftNodeValue_ instanceof Long) {
long leftNodeValue__ = (long) leftNodeValue_;
if (rightNodeValue_ instanceof Long) {
long rightNodeValue__ = (long) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b100) != 0 /* is-active equal(BigInteger, BigInteger) */ && SLTypesGen.isImplicitBigInteger((state & 0b110000000000) >>> 10 /* extract-implicit-active 0:BigInteger */, leftNodeValue_)) {
BigInteger leftNodeValue__ = SLTypesGen.asImplicitBigInteger((state & 0b110000000000) >>> 10 /* extract-implicit-active 0:BigInteger */, leftNodeValue_);
if (SLTypesGen.isImplicitBigInteger((state & 0b11000000000000) >>> 12 /* extract-implicit-active 1:BigInteger */, rightNodeValue_)) {
BigInteger rightNodeValue__ = SLTypesGen.asImplicitBigInteger((state & 0b11000000000000) >>> 12 /* extract-implicit-active 1:BigInteger */, rightNodeValue_);
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b1000) != 0 /* is-active equal(boolean, boolean) */ && leftNodeValue_ instanceof Boolean) {
boolean leftNodeValue__ = (boolean) leftNodeValue_;
if (rightNodeValue_ instanceof Boolean) {
boolean rightNodeValue__ = (boolean) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b10000) != 0 /* is-active equal(String, String) */ && leftNodeValue_ instanceof String) {
String leftNodeValue__ = (String) leftNodeValue_;
if (rightNodeValue_ instanceof String) {
String rightNodeValue__ = (String) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b100000) != 0 /* is-active equal(SLFunction, SLFunction) */ && leftNodeValue_ instanceof SLFunction) {
SLFunction leftNodeValue__ = (SLFunction) leftNodeValue_;
if (rightNodeValue_ instanceof SLFunction) {
SLFunction rightNodeValue__ = (SLFunction) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b1000000) != 0 /* is-active equal(SLNull, SLNull) */ && SLTypes.isSLNull(leftNodeValue_)) {
SLNull leftNodeValue__ = SLTypes.asSLNull(leftNodeValue_);
if (SLTypes.isSLNull(rightNodeValue_)) {
SLNull rightNodeValue__ = SLTypes.asSLNull(rightNodeValue_);
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b10000000) != 0 /* is-active equal(TruffleObject, TruffleObject) */ && leftNodeValue_ instanceof TruffleObject) {
TruffleObject leftNodeValue__ = (TruffleObject) leftNodeValue_;
if (rightNodeValue_ instanceof TruffleObject) {
TruffleObject rightNodeValue__ = (TruffleObject) rightNodeValue_;
return equal(leftNodeValue__, rightNodeValue__);
}
}
if ((state & 0b100000000) != 0 /* is-active equal(Object, Object) */) {
if ((SLEqualNode.differentClasses(leftNodeValue_, rightNodeValue_))) {
return equal(leftNodeValue_, rightNodeValue_);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return SLTypesGen.expectBoolean(executeAndSpecialize(leftNodeValue_, rightNodeValue_));
}
@Override
public void executeVoid(VirtualFrame frameValue) {
int state = state_;
try {
if ((state & 0b1000000001) == 0 /* only-active equal(long, long) && equal(BigInteger, BigInteger) && equal(boolean, boolean) && equal(String, String) && equal(SLFunction, SLFunction) && equal(SLNull, SLNull) && equal(TruffleObject, TruffleObject) && equal(Object, Object) */) {
executeBoolean(frameValue);
return;
}
executeGeneric(frameValue);
return;
} catch (UnexpectedResultException ex) {
return;
}
}
private Object executeAndSpecialize(Object leftNodeValue, Object rightNodeValue) {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
try {
int state = state_ & 0xfffffffe/* mask-active uninitialized*/;
if (leftNodeValue instanceof Long) {
long leftNodeValue_ = (long) leftNodeValue;
if (rightNodeValue instanceof Long) {
long rightNodeValue_ = (long) rightNodeValue;
this.state_ = state = state | 0b10 /* add-active equal(long, long) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
{
int bigIntegerCast0;
if ((bigIntegerCast0 = SLTypesGen.specializeImplicitBigInteger(leftNodeValue)) != 0) {
BigInteger leftNodeValue_ = SLTypesGen.asImplicitBigInteger(bigIntegerCast0, leftNodeValue);
int bigIntegerCast1;
if ((bigIntegerCast1 = SLTypesGen.specializeImplicitBigInteger(rightNodeValue)) != 0) {
BigInteger rightNodeValue_ = SLTypesGen.asImplicitBigInteger(bigIntegerCast1, rightNodeValue);
state = (state | (bigIntegerCast0 << 10) /* set-implicit-active 0:BigInteger */);
state = (state | (bigIntegerCast1 << 12) /* set-implicit-active 1:BigInteger */);
this.state_ = state = state | 0b100 /* add-active equal(BigInteger, BigInteger) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
}
if (leftNodeValue instanceof Boolean) {
boolean leftNodeValue_ = (boolean) leftNodeValue;
if (rightNodeValue instanceof Boolean) {
boolean rightNodeValue_ = (boolean) rightNodeValue;
this.state_ = state = state | 0b1000 /* add-active equal(boolean, boolean) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
if (leftNodeValue instanceof String) {
String leftNodeValue_ = (String) leftNodeValue;
if (rightNodeValue instanceof String) {
String rightNodeValue_ = (String) rightNodeValue;
this.state_ = state = state | 0b10000 /* add-active equal(String, String) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
if (leftNodeValue instanceof SLFunction) {
SLFunction leftNodeValue_ = (SLFunction) leftNodeValue;
if (rightNodeValue instanceof SLFunction) {
SLFunction rightNodeValue_ = (SLFunction) rightNodeValue;
this.state_ = state = state | 0b100000 /* add-active equal(SLFunction, SLFunction) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
if (SLTypes.isSLNull(leftNodeValue)) {
SLNull leftNodeValue_ = SLTypes.asSLNull(leftNodeValue);
if (SLTypes.isSLNull(rightNodeValue)) {
SLNull rightNodeValue_ = SLTypes.asSLNull(rightNodeValue);
this.state_ = state = state | 0b1000000 /* add-active equal(SLNull, SLNull) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
if (leftNodeValue instanceof TruffleObject) {
TruffleObject leftNodeValue_ = (TruffleObject) leftNodeValue;
if (rightNodeValue instanceof TruffleObject) {
TruffleObject rightNodeValue_ = (TruffleObject) rightNodeValue;
this.state_ = state = state | 0b10000000 /* add-active equal(TruffleObject, TruffleObject) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue_, rightNodeValue_);
}
}
if ((SLEqualNode.differentClasses(leftNodeValue, rightNodeValue))) {
this.state_ = state = state | 0b100000000 /* add-active equal(Object, Object) */;
lock.unlock();
hasLock = false;
return equal(leftNodeValue, rightNodeValue);
}
this.state_ = state = state | 0b1000000000 /* add-active typeError(Object, Object) */;
lock.unlock();
hasLock = false;
return typeError(leftNodeValue, rightNodeValue);
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public NodeCost getCost() {
int state = state_ & 0xfffffffe/* mask-active uninitialized*/;
if (state == 0b0) {
return NodeCost.UNINITIALIZED;
} else if (((state & 0b1111111110) & ((state & 0b1111111110) - 1)) == 0 /* is-single-active */) {
return NodeCost.MONOMORPHIC;
}
return NodeCost.POLYMORPHIC;
}
private static boolean fallbackGuard_(int state, Object leftNodeValue, Object rightNodeValue) {
if (SLTypesGen.isImplicitBigInteger(0b11, leftNodeValue) && SLTypesGen.isImplicitBigInteger(0b11, rightNodeValue)) {
return false;
}
if ((state & 0b1000) == 0 /* is-not-active equal(boolean, boolean) */ && leftNodeValue instanceof Boolean && rightNodeValue instanceof Boolean) {
return false;
}
if ((state & 0b10000) == 0 /* is-not-active equal(String, String) */ && leftNodeValue instanceof String && rightNodeValue instanceof String) {
return false;
}
if ((state & 0b10000000) == 0 /* is-not-active equal(TruffleObject, TruffleObject) */ && leftNodeValue instanceof TruffleObject && rightNodeValue instanceof TruffleObject) {
return false;
}
if ((state & 0b100000000) == 0 /* is-not-active equal(Object, Object) */ && (SLEqualNode.differentClasses(leftNodeValue, rightNodeValue))) {
return false;
}
return true;
}
public static SLEqualNode create(SLExpressionNode leftNode, SLExpressionNode rightNode) {
return new SLEqualNodeGen(leftNode, rightNode);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy