org.jruby.truffle.language.objects.IsFrozenNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package org.jruby.truffle.language.objects;
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.dsl.internal.SpecializationNode;
import com.oracle.truffle.api.dsl.internal.SpecializedNode;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.VirtualFrame;
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 org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyTypes;
import org.jruby.truffle.language.RubyTypesGen;
@GeneratedBy(IsFrozenNode.class)
public final class IsFrozenNodeGen extends IsFrozenNode implements SpecializedNode {
@Child private RubyNode child_;
@CompilationFinal private Class> childType_;
@Child private BaseNode_ specialization_;
private IsFrozenNodeGen(RubyNode child) {
this.child_ = child;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public boolean executeIsFrozen(Object childValue) {
return specialization_.executeBoolean1(childValue);
}
@Override
public Object execute(VirtualFrame frameValue) {
return specialization_.execute(frameValue);
}
@Override
public void executeVoid(VirtualFrame frameValue) {
specialization_.executeVoid(frameValue);
return;
}
@Override
public boolean executeBoolean(VirtualFrame frameValue) {
return specialization_.executeBoolean0(frameValue);
}
@Override
public SpecializationNode getSpecializationNode() {
return specialization_;
}
@Override
public Node deepCopy() {
return SpecializationNode.updateRoot(super.deepCopy());
}
public static IsFrozenNode create(RubyNode child) {
return new IsFrozenNodeGen(child);
}
@GeneratedBy(IsFrozenNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected IsFrozenNodeGen root;
BaseNode_(IsFrozenNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (IsFrozenNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {root.child_};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object childValue) {
return this.executeBoolean1(childValue);
}
public abstract boolean executeBoolean1(Object childValue);
public Object execute(VirtualFrame frameValue) {
Object childValue_ = executeChild_(frameValue);
return executeBoolean1(childValue_);
}
public void executeVoid(VirtualFrame frameValue) {
execute(frameValue);
return;
}
public boolean executeBoolean0(VirtualFrame frameValue) {
return (boolean) execute(frameValue);
}
@Override
protected final SpecializationNode createNext(Frame frameValue, Object childValue) {
if (childValue instanceof Boolean) {
return IsFrozen0Node_.create(root);
}
if (RubyTypesGen.isImplicitInteger(childValue)) {
return IsFrozen1Node_.create(root, childValue);
}
if (RubyTypesGen.isImplicitLong(childValue)) {
return IsFrozen2Node_.create(root, childValue);
}
if (RubyTypesGen.isImplicitDouble(childValue)) {
return IsFrozen3Node_.create(root, childValue);
}
if (childValue instanceof DynamicObject) {
ReadObjectFieldNode readFrozenNode5 = (root.createReadFrozenNode());
return IsFrozen4Node_.create(root, readFrozenNode5);
}
return null;
}
@Override
protected final SpecializationNode createPolymorphic() {
return PolymorphicNode_.create(root);
}
protected final BaseNode_ getNext() {
return (BaseNode_) this.next;
}
protected final Object executeChild_(Frame frameValue) {
Class> childType_ = root.childType_;
try {
if (childType_ == boolean.class) {
return root.child_.executeBoolean((VirtualFrame) frameValue);
} else if (childType_ == double.class) {
return root.child_.executeDouble((VirtualFrame) frameValue);
} else if (childType_ == int.class) {
return root.child_.executeInteger((VirtualFrame) frameValue);
} else if (childType_ == long.class) {
return root.child_.executeLong((VirtualFrame) frameValue);
} else if (childType_ == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Class> _type = Object.class;
try {
Object _value = root.child_.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.childType_ = _type;
}
} else {
return root.child_.execute((VirtualFrame) frameValue);
}
} catch (UnexpectedResultException ex) {
root.childType_ = Object.class;
return ex.getResult();
}
}
}
@GeneratedBy(IsFrozenNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(IsFrozenNodeGen root) {
super(root, 2147483647);
}
@Override
public boolean executeBoolean1(Object childValue) {
return (boolean) uninitialized(null, childValue);
}
static BaseNode_ create(IsFrozenNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(IsFrozenNode.class)
private static final class PolymorphicNode_ extends BaseNode_ {
PolymorphicNode_(IsFrozenNodeGen root) {
super(root, 0);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object childValue) {
return polymorphicMerge(newNode, super.merge(newNode, frameValue, childValue));
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
Object childValue_ = executeChild_(frameValue);
return getNext().executeBoolean1(childValue_);
}
@Override
public boolean executeBoolean1(Object childValue) {
return getNext().executeBoolean1(childValue);
}
static BaseNode_ create(IsFrozenNodeGen root) {
return new PolymorphicNode_(root);
}
}
@GeneratedBy(methodName = "isFrozen(boolean)", value = IsFrozenNode.class)
private static final class IsFrozen0Node_ extends BaseNode_ {
IsFrozen0Node_(IsFrozenNodeGen root) {
super(root, 1);
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeBoolean0(frameValue);
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
boolean childValue_;
try {
childValue_ = root.child_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
return getNext().executeBoolean1(ex.getResult());
}
return root.isFrozen(childValue_);
}
@Override
public boolean executeBoolean1(Object childValue) {
if (childValue instanceof Boolean) {
boolean childValue_ = (boolean) childValue;
return root.isFrozen(childValue_);
}
return getNext().executeBoolean1(childValue);
}
static BaseNode_ create(IsFrozenNodeGen root) {
return new IsFrozen0Node_(root);
}
}
@GeneratedBy(methodName = "isFrozen(int)", value = IsFrozenNode.class)
private static final class IsFrozen1Node_ extends BaseNode_ {
private final Class> childImplicitType;
IsFrozen1Node_(IsFrozenNodeGen root, Object childValue) {
super(root, 2);
this.childImplicitType = RubyTypesGen.getImplicitIntegerClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((IsFrozen1Node_) other).childImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeBoolean0(frameValue);
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
int childValue_;
try {
if (childImplicitType == int.class) {
childValue_ = root.child_.executeInteger(frameValue);
} else {
Object childValue__ = executeChild_(frameValue);
childValue_ = RubyTypesGen.expectImplicitInteger(childValue__, childImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().executeBoolean1(ex.getResult());
}
return root.isFrozen(childValue_);
}
@Override
public boolean executeBoolean1(Object childValue) {
if (RubyTypesGen.isImplicitInteger(childValue, childImplicitType)) {
int childValue_ = RubyTypesGen.asImplicitInteger(childValue, childImplicitType);
return root.isFrozen(childValue_);
}
return getNext().executeBoolean1(childValue);
}
static BaseNode_ create(IsFrozenNodeGen root, Object childValue) {
return new IsFrozen1Node_(root, childValue);
}
}
@GeneratedBy(methodName = "isFrozen(long)", value = IsFrozenNode.class)
private static final class IsFrozen2Node_ extends BaseNode_ {
private final Class> childImplicitType;
IsFrozen2Node_(IsFrozenNodeGen root, Object childValue) {
super(root, 3);
this.childImplicitType = RubyTypesGen.getImplicitLongClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((IsFrozen2Node_) other).childImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeBoolean0(frameValue);
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
long childValue_;
try {
if (childImplicitType == long.class) {
childValue_ = root.child_.executeLong(frameValue);
} else if (childImplicitType == int.class) {
childValue_ = RubyTypes.promoteToLong(root.child_.executeInteger(frameValue));
} else {
Object childValue__ = executeChild_(frameValue);
childValue_ = RubyTypesGen.expectImplicitLong(childValue__, childImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().executeBoolean1(ex.getResult());
}
return root.isFrozen(childValue_);
}
@Override
public boolean executeBoolean1(Object childValue) {
if (RubyTypesGen.isImplicitLong(childValue, childImplicitType)) {
long childValue_ = RubyTypesGen.asImplicitLong(childValue, childImplicitType);
return root.isFrozen(childValue_);
}
return getNext().executeBoolean1(childValue);
}
static BaseNode_ create(IsFrozenNodeGen root, Object childValue) {
return new IsFrozen2Node_(root, childValue);
}
}
@GeneratedBy(methodName = "isFrozen(double)", value = IsFrozenNode.class)
private static final class IsFrozen3Node_ extends BaseNode_ {
private final Class> childImplicitType;
IsFrozen3Node_(IsFrozenNodeGen root, Object childValue) {
super(root, 4);
this.childImplicitType = RubyTypesGen.getImplicitDoubleClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((IsFrozen3Node_) other).childImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
return executeBoolean0(frameValue);
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
double childValue_;
try {
if (childImplicitType == double.class) {
childValue_ = root.child_.executeDouble(frameValue);
} else {
Object childValue__ = executeChild_(frameValue);
childValue_ = RubyTypesGen.expectImplicitDouble(childValue__, childImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().executeBoolean1(ex.getResult());
}
return root.isFrozen(childValue_);
}
@Override
public boolean executeBoolean1(Object childValue) {
if (RubyTypesGen.isImplicitDouble(childValue, childImplicitType)) {
double childValue_ = RubyTypesGen.asImplicitDouble(childValue, childImplicitType);
return root.isFrozen(childValue_);
}
return getNext().executeBoolean1(childValue);
}
static BaseNode_ create(IsFrozenNodeGen root, Object childValue) {
return new IsFrozen3Node_(root, childValue);
}
}
@GeneratedBy(methodName = "isFrozen(DynamicObject, ReadObjectFieldNode)", value = IsFrozenNode.class)
private static final class IsFrozen4Node_ extends BaseNode_ {
@Child private ReadObjectFieldNode readFrozenNode;
IsFrozen4Node_(IsFrozenNodeGen root, ReadObjectFieldNode readFrozenNode) {
super(root, 5);
this.readFrozenNode = readFrozenNode;
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
DynamicObject childValue_;
try {
childValue_ = root.child_.executeDynamicObject(frameValue);
} catch (UnexpectedResultException ex) {
return getNext().executeBoolean1(ex.getResult());
}
return root.isFrozen(childValue_, this.readFrozenNode);
}
@Override
public boolean executeBoolean1(Object childValue) {
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
return root.isFrozen(childValue_, this.readFrozenNode);
}
return getNext().executeBoolean1(childValue);
}
static BaseNode_ create(IsFrozenNodeGen root, ReadObjectFieldNode readFrozenNode) {
return new IsFrozen4Node_(root, readFrozenNode);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy