org.jruby.truffle.language.objects.LogicalClassNodeGen Maven / Gradle / Ivy
The newest version!
// CheckStyle: start generated
package org.jruby.truffle.language.objects;
import com.oracle.truffle.api.Assumption;
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.internal.SpecializationNode;
import com.oracle.truffle.api.dsl.internal.SpecializedNode;
import com.oracle.truffle.api.dsl.internal.SuppressFBWarnings;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.InvalidAssumptionException;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.Shape;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyTypes;
import org.jruby.truffle.language.RubyTypesGen;
@GeneratedBy(LogicalClassNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class LogicalClassNodeGen extends LogicalClassNode implements SpecializedNode {
@Child private RubyNode object_;
@CompilationFinal private Class> objectType_;
@CompilationFinal private boolean excludeLogicalClassCached_;
@CompilationFinal private boolean excludeUpdateShapeAndLogicalClass_;
@Child private BaseNode_ specialization_;
private LogicalClassNodeGen(RubyNode object) {
this.object_ = object;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public DynamicObject executeLogicalClass(Object objectValue) {
return specialization_.executeDynamicObject1(objectValue);
}
@Override
public Object execute(VirtualFrame frameValue) {
return specialization_.execute(frameValue);
}
@Override
public void executeVoid(VirtualFrame frameValue) {
specialization_.executeVoid(frameValue);
return;
}
@Override
public DynamicObject executeDynamicObject(VirtualFrame frameValue) {
return specialization_.executeDynamicObject0(frameValue);
}
@Override
public SpecializationNode getSpecializationNode() {
return specialization_;
}
@Override
public Node deepCopy() {
return SpecializationNode.updateRoot(super.deepCopy());
}
public static LogicalClassNode create(RubyNode object) {
return new LogicalClassNodeGen(object);
}
@GeneratedBy(LogicalClassNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected LogicalClassNodeGen root;
BaseNode_(LogicalClassNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (LogicalClassNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {root.object_};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object objectValue) {
return this.executeDynamicObject1(objectValue);
}
public abstract DynamicObject executeDynamicObject1(Object objectValue);
public Object execute(VirtualFrame frameValue) {
Object objectValue_ = executeObject_(frameValue);
return executeDynamicObject1(objectValue_);
}
public void executeVoid(VirtualFrame frameValue) {
execute(frameValue);
return;
}
public DynamicObject executeDynamicObject0(VirtualFrame frameValue) {
return (DynamicObject) execute(frameValue);
}
@Override
protected final SpecializationNode createNext(Frame frameValue, Object objectValue) {
if (objectValue instanceof Boolean) {
boolean objectValue_ = (boolean) objectValue;
if ((objectValue_)) {
return LogicalClassTrueNode_.create(root);
} else {
return LogicalClassFalseNode_.create(root);
}
}
if (RubyTypesGen.isImplicitInteger(objectValue)) {
return LogicalClassIntNode_.create(root, objectValue);
}
if (RubyTypesGen.isImplicitLong(objectValue)) {
return LogicalClassLongNode_.create(root, objectValue);
}
if (RubyTypesGen.isImplicitDouble(objectValue)) {
return LogicalClassDoubleNode_.create(root, objectValue);
}
if (objectValue instanceof DynamicObject) {
DynamicObject objectValue_ = (DynamicObject) objectValue;
Shape cachedShape6 = (objectValue_.getShape());
if ((objectValue_.getShape() == cachedShape6)) {
if (!root.excludeLogicalClassCached_) {
DynamicObject logicalClass6 = (LogicalClassNode.getLogicalClass(cachedShape6));
Assumption assumption0_6 = (cachedShape6.getValidAssumption());
if (isValid(assumption0_6)) {
SpecializationNode s = LogicalClassCachedNode_.create(root, cachedShape6, logicalClass6, assumption0_6);
if (countSame(s) < (root.getCacheLimit())) {
return s;
}
}
}
}
if ((ShapeCachingGuards.updateShape(objectValue_))) {
if (!root.excludeUpdateShapeAndLogicalClass_) {
return UpdateShapeAndLogicalClassNode_.create(root);
}
}
root.excludeLogicalClassCached_ = true;
root.excludeUpdateShapeAndLogicalClass_ = true;
return LogicalClassUncachedNode_.create(root);
}
return null;
}
@Override
protected final SpecializationNode createFallback() {
return FallbackNode_.create(root);
}
@Override
protected final SpecializationNode createPolymorphic() {
return PolymorphicNode_.create(root);
}
protected final BaseNode_ getNext() {
return (BaseNode_) this.next;
}
protected final Object executeObject_(Frame frameValue) {
Class> objectType_ = root.objectType_;
try {
if (objectType_ == boolean.class) {
return root.object_.executeBoolean((VirtualFrame) frameValue);
} else if (objectType_ == double.class) {
return root.object_.executeDouble((VirtualFrame) frameValue);
} else if (objectType_ == int.class) {
return root.object_.executeInteger((VirtualFrame) frameValue);
} else if (objectType_ == long.class) {
return root.object_.executeLong((VirtualFrame) frameValue);
} else if (objectType_ == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Class> _type = Object.class;
try {
Object _value = root.object_.execute((VirtualFrame) frameValue);
if (_value instanceof Boolean) {
_type = boolean.class;
} else if (_value instanceof Double) {
_type = double.class;
} else if (_value instanceof Integer) {
_type = int.class;
} else if (_value instanceof Long) {
_type = long.class;
} else {
_type = Object.class;
}
return _value;
} finally {
root.objectType_ = _type;
}
} else {
return root.object_.execute((VirtualFrame) frameValue);
}
} catch (UnexpectedResultException ex) {
root.objectType_ = Object.class;
return ex.getResult();
}
}
}
@GeneratedBy(LogicalClassNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(LogicalClassNodeGen root) {
super(root, 2147483647);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
return (DynamicObject) uninitialized(null, objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(LogicalClassNode.class)
private static final class PolymorphicNode_ extends BaseNode_ {
PolymorphicNode_(LogicalClassNodeGen root) {
super(root, 0);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object objectValue) {
return polymorphicMerge(newNode, super.merge(newNode, frameValue, objectValue));
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new PolymorphicNode_(root);
}
}
@GeneratedBy(methodName = "logicalClassTrue(boolean)", value = LogicalClassNode.class)
private static final class LogicalClassTrueNode_ extends BaseNode_ {
LogicalClassTrueNode_(LogicalClassNodeGen root) {
super(root, 1);
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeDynamicObject0(frameValue);
}
@Override
public DynamicObject executeDynamicObject0(VirtualFrame frameValue) {
boolean objectValue_;
try {
objectValue_ = root.object_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
return getNext().executeDynamicObject1(ex.getResult());
}
if ((objectValue_)) {
return root.logicalClassTrue(objectValue_);
}
return getNext().executeDynamicObject1(objectValue_);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (objectValue instanceof Boolean) {
boolean objectValue_ = (boolean) objectValue;
if ((objectValue_)) {
return root.logicalClassTrue(objectValue_);
}
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new LogicalClassTrueNode_(root);
}
}
@GeneratedBy(methodName = "logicalClassFalse(boolean)", value = LogicalClassNode.class)
private static final class LogicalClassFalseNode_ extends BaseNode_ {
LogicalClassFalseNode_(LogicalClassNodeGen root) {
super(root, 2);
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeDynamicObject0(frameValue);
}
@Override
public DynamicObject executeDynamicObject0(VirtualFrame frameValue) {
boolean objectValue_;
try {
objectValue_ = root.object_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
return getNext().executeDynamicObject1(ex.getResult());
}
if ((!(objectValue_))) {
return root.logicalClassFalse(objectValue_);
}
return getNext().executeDynamicObject1(objectValue_);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (objectValue instanceof Boolean) {
boolean objectValue_ = (boolean) objectValue;
if ((!(objectValue_))) {
return root.logicalClassFalse(objectValue_);
}
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new LogicalClassFalseNode_(root);
}
}
@GeneratedBy(methodName = "logicalClassInt(int)", value = LogicalClassNode.class)
private static final class LogicalClassIntNode_ extends BaseNode_ {
private final Class> objectImplicitType;
LogicalClassIntNode_(LogicalClassNodeGen root, Object objectValue) {
super(root, 3);
this.objectImplicitType = RubyTypesGen.getImplicitIntegerClass(objectValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.objectImplicitType == ((LogicalClassIntNode_) other).objectImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeDynamicObject0(frameValue);
}
@Override
public DynamicObject executeDynamicObject0(VirtualFrame frameValue) {
int objectValue_;
try {
if (objectImplicitType == int.class) {
objectValue_ = root.object_.executeInteger(frameValue);
} else {
Object objectValue__ = executeObject_(frameValue);
objectValue_ = RubyTypesGen.expectImplicitInteger(objectValue__, objectImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().executeDynamicObject1(ex.getResult());
}
return root.logicalClassInt(objectValue_);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (RubyTypesGen.isImplicitInteger(objectValue, objectImplicitType)) {
int objectValue_ = RubyTypesGen.asImplicitInteger(objectValue, objectImplicitType);
return root.logicalClassInt(objectValue_);
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root, Object objectValue) {
return new LogicalClassIntNode_(root, objectValue);
}
}
@GeneratedBy(methodName = "logicalClassLong(long)", value = LogicalClassNode.class)
private static final class LogicalClassLongNode_ extends BaseNode_ {
private final Class> objectImplicitType;
LogicalClassLongNode_(LogicalClassNodeGen root, Object objectValue) {
super(root, 4);
this.objectImplicitType = RubyTypesGen.getImplicitLongClass(objectValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.objectImplicitType == ((LogicalClassLongNode_) other).objectImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeDynamicObject0(frameValue);
}
@Override
public DynamicObject executeDynamicObject0(VirtualFrame frameValue) {
long objectValue_;
try {
if (objectImplicitType == long.class) {
objectValue_ = root.object_.executeLong(frameValue);
} else if (objectImplicitType == int.class) {
objectValue_ = RubyTypes.promoteToLong(root.object_.executeInteger(frameValue));
} else {
Object objectValue__ = executeObject_(frameValue);
objectValue_ = RubyTypesGen.expectImplicitLong(objectValue__, objectImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().executeDynamicObject1(ex.getResult());
}
return root.logicalClassLong(objectValue_);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (RubyTypesGen.isImplicitLong(objectValue, objectImplicitType)) {
long objectValue_ = RubyTypesGen.asImplicitLong(objectValue, objectImplicitType);
return root.logicalClassLong(objectValue_);
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root, Object objectValue) {
return new LogicalClassLongNode_(root, objectValue);
}
}
@GeneratedBy(methodName = "logicalClassDouble(double)", value = LogicalClassNode.class)
private static final class LogicalClassDoubleNode_ extends BaseNode_ {
private final Class> objectImplicitType;
LogicalClassDoubleNode_(LogicalClassNodeGen root, Object objectValue) {
super(root, 5);
this.objectImplicitType = RubyTypesGen.getImplicitDoubleClass(objectValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.objectImplicitType == ((LogicalClassDoubleNode_) other).objectImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeDynamicObject0(frameValue);
}
@Override
public DynamicObject executeDynamicObject0(VirtualFrame frameValue) {
double objectValue_;
try {
if (objectImplicitType == double.class) {
objectValue_ = root.object_.executeDouble(frameValue);
} else {
Object objectValue__ = executeObject_(frameValue);
objectValue_ = RubyTypesGen.expectImplicitDouble(objectValue__, objectImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().executeDynamicObject1(ex.getResult());
}
return root.logicalClassDouble(objectValue_);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (RubyTypesGen.isImplicitDouble(objectValue, objectImplicitType)) {
double objectValue_ = RubyTypesGen.asImplicitDouble(objectValue, objectImplicitType);
return root.logicalClassDouble(objectValue_);
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root, Object objectValue) {
return new LogicalClassDoubleNode_(root, objectValue);
}
}
@GeneratedBy(methodName = "logicalClassCached(DynamicObject, Shape, DynamicObject)", value = LogicalClassNode.class)
private static final class LogicalClassCachedNode_ extends BaseNode_ {
private final Shape cachedShape;
private final DynamicObject logicalClass;
@CompilationFinal private final Assumption assumption0_;
LogicalClassCachedNode_(LogicalClassNodeGen root, Shape cachedShape, DynamicObject logicalClass, Assumption assumption0_) {
super(root, 6);
this.cachedShape = cachedShape;
this.logicalClass = logicalClass;
this.assumption0_ = assumption0_;
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object objectValue) {
if (newNode.getClass() == LogicalClassUncachedNode_.class) {
removeSame("Contained by logicalClassUncached(DynamicObject)");
}
return super.merge(newNode, frameValue, objectValue);
}
@Override
public boolean isIdentical(SpecializationNode other, Frame frameValue, Object objectValue) {
if (objectValue instanceof DynamicObject) {
DynamicObject objectValue_ = (DynamicObject) objectValue;
if ((objectValue_.getShape() == this.cachedShape)) {
return true;
}
}
return false;
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
try {
check(this.assumption0_);
} catch (InvalidAssumptionException ae) {
return (DynamicObject) removeThis("Assumption [assumption0] invalidated", null, objectValue);
}
if (objectValue instanceof DynamicObject) {
DynamicObject objectValue_ = (DynamicObject) objectValue;
if ((objectValue_.getShape() == this.cachedShape)) {
return root.logicalClassCached(objectValue_, this.cachedShape, this.logicalClass);
}
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root, Shape cachedShape, DynamicObject logicalClass, Assumption assumption0_) {
return new LogicalClassCachedNode_(root, cachedShape, logicalClass, assumption0_);
}
}
@GeneratedBy(methodName = "updateShapeAndLogicalClass(DynamicObject)", value = LogicalClassNode.class)
private static final class UpdateShapeAndLogicalClassNode_ extends BaseNode_ {
UpdateShapeAndLogicalClassNode_(LogicalClassNodeGen root) {
super(root, 7);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object objectValue) {
if (newNode.getClass() == LogicalClassUncachedNode_.class) {
removeSame("Contained by logicalClassUncached(DynamicObject)");
}
return super.merge(newNode, frameValue, objectValue);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (objectValue instanceof DynamicObject) {
DynamicObject objectValue_ = (DynamicObject) objectValue;
if ((ShapeCachingGuards.updateShape(objectValue_))) {
return root.updateShapeAndLogicalClass(objectValue_);
}
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new UpdateShapeAndLogicalClassNode_(root);
}
}
@GeneratedBy(methodName = "logicalClassUncached(DynamicObject)", value = LogicalClassNode.class)
private static final class LogicalClassUncachedNode_ extends BaseNode_ {
LogicalClassUncachedNode_(LogicalClassNodeGen root) {
super(root, 8);
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (objectValue instanceof DynamicObject) {
DynamicObject objectValue_ = (DynamicObject) objectValue;
return root.logicalClassUncached(objectValue_);
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new LogicalClassUncachedNode_(root);
}
}
@GeneratedBy(methodName = "logicalClassFallback(Object)", value = LogicalClassNode.class)
private static final class FallbackNode_ extends BaseNode_ {
FallbackNode_(LogicalClassNodeGen root) {
super(root, 2147483646);
}
@TruffleBoundary
private boolean guardFallback(Object objectValue) {
return createNext(null, objectValue) == null;
}
@Override
public DynamicObject executeDynamicObject1(Object objectValue) {
if (guardFallback(objectValue)) {
return root.logicalClassFallback(objectValue);
}
return getNext().executeDynamicObject1(objectValue);
}
static BaseNode_ create(LogicalClassNodeGen root) {
return new FallbackNode_(root);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy