org.jruby.truffle.language.objects.FreezeNodeGen Maven / Gradle / Ivy
The newest version!
// 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.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyTypes;
import org.jruby.truffle.language.RubyTypesGen;
@GeneratedBy(FreezeNode.class)
public final class FreezeNodeGen extends FreezeNode implements SpecializedNode {
@Child private RubyNode child_;
@CompilationFinal private Class> childType_;
@Child private BaseNode_ specialization_;
private FreezeNodeGen(RubyNode child) {
this.child_ = child;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public Object executeFreeze(Object childValue) {
return specialization_.execute1(childValue);
}
@Override
public Object execute(VirtualFrame frameValue) {
return specialization_.execute0(frameValue);
}
@Override
public void executeVoid(VirtualFrame frameValue) {
specialization_.executeVoid(frameValue);
return;
}
@Override
public SpecializationNode getSpecializationNode() {
return specialization_;
}
@Override
public Node deepCopy() {
return SpecializationNode.updateRoot(super.deepCopy());
}
public static FreezeNode create(RubyNode child) {
return new FreezeNodeGen(child);
}
@GeneratedBy(FreezeNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected FreezeNodeGen root;
BaseNode_(FreezeNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (FreezeNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {root.child_};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object childValue) {
return this.execute1(childValue);
}
public abstract Object execute1(Object childValue);
public Object execute0(VirtualFrame frameValue) {
Object childValue_ = executeChild_(frameValue);
return execute1(childValue_);
}
public void executeVoid(VirtualFrame frameValue) {
execute0(frameValue);
return;
}
@Override
protected final SpecializationNode createNext(Frame frameValue, Object childValue) {
if (childValue instanceof Boolean) {
return Freeze0Node_.create(root);
}
if (RubyTypesGen.isImplicitInteger(childValue)) {
return Freeze1Node_.create(root, childValue);
}
if (RubyTypesGen.isImplicitLong(childValue)) {
return Freeze2Node_.create(root, childValue);
}
if (RubyTypesGen.isImplicitDouble(childValue)) {
return Freeze3Node_.create(root, childValue);
}
if ((root.isNil(childValue))) {
return Freeze4Node_.create(root);
}
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((RubyGuards.isRubyBignum(childValue_))) {
return FreezeBignumNode_.create(root);
}
if ((RubyGuards.isRubySymbol(childValue_))) {
return FreezeSymbolNode_.create(root);
}
if ((!(root.isNil(childValue_))) && (!(RubyGuards.isRubyBignum(childValue_))) && (!(RubyGuards.isRubySymbol(childValue_)))) {
WriteObjectFieldNode writeFrozenNode8 = (root.createWriteFrozenNode());
return Freeze5Node_.create(root, writeFrozenNode8);
}
}
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(FreezeNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(FreezeNodeGen root) {
super(root, 2147483647);
}
@Override
public Object execute1(Object childValue) {
return uninitialized(null, childValue);
}
static BaseNode_ create(FreezeNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(FreezeNode.class)
private static final class PolymorphicNode_ extends BaseNode_ {
PolymorphicNode_(FreezeNodeGen root) {
super(root, 0);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object childValue) {
return polymorphicMerge(newNode, super.merge(newNode, frameValue, childValue));
}
@Override
public Object execute1(Object childValue) {
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root) {
return new PolymorphicNode_(root);
}
}
@GeneratedBy(methodName = "freeze(boolean)", value = FreezeNode.class)
private static final class Freeze0Node_ extends BaseNode_ {
Freeze0Node_(FreezeNodeGen root) {
super(root, 1);
}
@Override
public Object execute0(VirtualFrame frameValue) {
boolean childValue_;
try {
childValue_ = root.child_.executeBoolean(frameValue);
} catch (UnexpectedResultException ex) {
return getNext().execute1(ex.getResult());
}
return root.freeze(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof Boolean) {
boolean childValue_ = (boolean) childValue;
return root.freeze(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root) {
return new Freeze0Node_(root);
}
}
@GeneratedBy(methodName = "freeze(int)", value = FreezeNode.class)
private static final class Freeze1Node_ extends BaseNode_ {
private final Class> childImplicitType;
Freeze1Node_(FreezeNodeGen root, Object childValue) {
super(root, 2);
this.childImplicitType = RubyTypesGen.getImplicitIntegerClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((Freeze1Node_) other).childImplicitType;
}
@Override
public Object execute0(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().execute1(ex.getResult());
}
return root.freeze(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (RubyTypesGen.isImplicitInteger(childValue, childImplicitType)) {
int childValue_ = RubyTypesGen.asImplicitInteger(childValue, childImplicitType);
return root.freeze(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root, Object childValue) {
return new Freeze1Node_(root, childValue);
}
}
@GeneratedBy(methodName = "freeze(long)", value = FreezeNode.class)
private static final class Freeze2Node_ extends BaseNode_ {
private final Class> childImplicitType;
Freeze2Node_(FreezeNodeGen root, Object childValue) {
super(root, 3);
this.childImplicitType = RubyTypesGen.getImplicitLongClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((Freeze2Node_) other).childImplicitType;
}
@Override
public Object execute0(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().execute1(ex.getResult());
}
return root.freeze(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (RubyTypesGen.isImplicitLong(childValue, childImplicitType)) {
long childValue_ = RubyTypesGen.asImplicitLong(childValue, childImplicitType);
return root.freeze(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root, Object childValue) {
return new Freeze2Node_(root, childValue);
}
}
@GeneratedBy(methodName = "freeze(double)", value = FreezeNode.class)
private static final class Freeze3Node_ extends BaseNode_ {
private final Class> childImplicitType;
Freeze3Node_(FreezeNodeGen root, Object childValue) {
super(root, 4);
this.childImplicitType = RubyTypesGen.getImplicitDoubleClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((Freeze3Node_) other).childImplicitType;
}
@Override
public Object execute0(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().execute1(ex.getResult());
}
return root.freeze(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (RubyTypesGen.isImplicitDouble(childValue, childImplicitType)) {
double childValue_ = RubyTypesGen.asImplicitDouble(childValue, childImplicitType);
return root.freeze(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root, Object childValue) {
return new Freeze3Node_(root, childValue);
}
}
@GeneratedBy(methodName = "freeze(Object)", value = FreezeNode.class)
private static final class Freeze4Node_ extends BaseNode_ {
Freeze4Node_(FreezeNodeGen root) {
super(root, 5);
}
@Override
public Object execute1(Object childValue) {
if ((root.isNil(childValue))) {
return root.freeze(childValue);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root) {
return new Freeze4Node_(root);
}
}
@GeneratedBy(methodName = "freezeBignum(DynamicObject)", value = FreezeNode.class)
private static final class FreezeBignumNode_ extends BaseNode_ {
FreezeBignumNode_(FreezeNodeGen root) {
super(root, 6);
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((RubyGuards.isRubyBignum(childValue_))) {
return root.freezeBignum(childValue_);
}
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root) {
return new FreezeBignumNode_(root);
}
}
@GeneratedBy(methodName = "freezeSymbol(DynamicObject)", value = FreezeNode.class)
private static final class FreezeSymbolNode_ extends BaseNode_ {
FreezeSymbolNode_(FreezeNodeGen root) {
super(root, 7);
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((RubyGuards.isRubySymbol(childValue_))) {
return root.freezeSymbol(childValue_);
}
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root) {
return new FreezeSymbolNode_(root);
}
}
@GeneratedBy(methodName = "freeze(DynamicObject, WriteObjectFieldNode)", value = FreezeNode.class)
private static final class Freeze5Node_ extends BaseNode_ {
@Child private WriteObjectFieldNode writeFrozenNode;
Freeze5Node_(FreezeNodeGen root, WriteObjectFieldNode writeFrozenNode) {
super(root, 8);
this.writeFrozenNode = writeFrozenNode;
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((!(root.isNil(childValue_))) && (!(RubyGuards.isRubyBignum(childValue_))) && (!(RubyGuards.isRubySymbol(childValue_)))) {
return root.freeze(childValue_, this.writeFrozenNode);
}
}
return getNext().execute1(childValue);
}
static BaseNode_ create(FreezeNodeGen root, WriteObjectFieldNode writeFrozenNode) {
return new Freeze5Node_(root, writeFrozenNode);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy