org.jruby.truffle.interop.ForeignToRubyNodeGen Maven / Gradle / Ivy
The newest version!
// CheckStyle: start generated
package org.jruby.truffle.interop;
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 org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
@GeneratedBy(ForeignToRubyNode.class)
public final class ForeignToRubyNodeGen extends ForeignToRubyNode implements SpecializedNode {
@Child private RubyNode value_;
@CompilationFinal private boolean excludeConvertStringCached_;
@Child private BaseNode_ specialization_;
private ForeignToRubyNodeGen(RubyNode value) {
this.value_ = value;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public Object executeConvert(VirtualFrame frameValue, Object valueValue) {
return specialization_.execute1(frameValue, valueValue);
}
@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 ForeignToRubyNode create(RubyNode value) {
return new ForeignToRubyNodeGen(value);
}
@GeneratedBy(ForeignToRubyNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected ForeignToRubyNodeGen root;
BaseNode_(ForeignToRubyNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (ForeignToRubyNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {root.value_};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object valueValue) {
return this.execute1((VirtualFrame) frameValue, valueValue);
}
public abstract Object execute1(VirtualFrame frameValue, Object valueValue);
public Object execute0(VirtualFrame frameValue) {
Object valueValue_ = root.value_.execute(frameValue);
return execute1(frameValue, valueValue_);
}
public void executeVoid(VirtualFrame frameValue) {
execute0(frameValue);
return;
}
@Override
protected final SpecializationNode createNext(Frame frameValue, Object valueValue) {
if (valueValue instanceof String) {
String valueValue_ = (String) valueValue;
String cachedValue1 = (valueValue_);
if ((root.stringsEquals(cachedValue1, valueValue_))) {
if (!root.excludeConvertStringCached_) {
Rope cachedRope1 = (root.getRope(valueValue_));
SpecializationNode s = ConvertStringCachedNode_.create(root, cachedValue1, cachedRope1);
if (countSame(s) < (root.getLimit())) {
return s;
}
}
}
root.excludeConvertStringCached_ = true;
return ConvertStringUncachedNode_.create(root);
}
if ((!(RubyGuards.isString(valueValue)))) {
return ConvertNode_.create(root);
}
return null;
}
@Override
protected final SpecializationNode createPolymorphic() {
return PolymorphicNode_.create(root);
}
protected final BaseNode_ getNext() {
return (BaseNode_) this.next;
}
}
@GeneratedBy(ForeignToRubyNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(ForeignToRubyNodeGen root) {
super(root, 2147483647);
}
@Override
public Object execute1(VirtualFrame frameValue, Object valueValue) {
return uninitialized(frameValue, valueValue);
}
static BaseNode_ create(ForeignToRubyNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(ForeignToRubyNode.class)
private static final class PolymorphicNode_ extends BaseNode_ {
PolymorphicNode_(ForeignToRubyNodeGen root) {
super(root, 0);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object valueValue) {
return polymorphicMerge(newNode, super.merge(newNode, frameValue, valueValue));
}
@Override
public Object execute1(VirtualFrame frameValue, Object valueValue) {
return getNext().execute1(frameValue, valueValue);
}
static BaseNode_ create(ForeignToRubyNodeGen root) {
return new PolymorphicNode_(root);
}
}
@GeneratedBy(methodName = "convertStringCached(String, String, Rope)", value = ForeignToRubyNode.class)
private static final class ConvertStringCachedNode_ extends BaseNode_ {
private final String cachedValue;
private final Rope cachedRope;
ConvertStringCachedNode_(ForeignToRubyNodeGen root, String cachedValue, Rope cachedRope) {
super(root, 1);
this.cachedValue = cachedValue;
this.cachedRope = cachedRope;
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object valueValue) {
if (newNode.getClass() == ConvertStringUncachedNode_.class) {
removeSame("Contained by convertStringUncached(String)");
}
return super.merge(newNode, frameValue, valueValue);
}
@Override
public boolean isIdentical(SpecializationNode other, Frame frameValue, Object valueValue) {
if (valueValue instanceof String) {
String valueValue_ = (String) valueValue;
if ((root.stringsEquals(this.cachedValue, valueValue_))) {
return true;
}
}
return false;
}
@Override
public Object execute1(VirtualFrame frameValue, Object valueValue) {
if (valueValue instanceof String) {
String valueValue_ = (String) valueValue;
if ((root.stringsEquals(this.cachedValue, valueValue_))) {
return root.convertStringCached(valueValue_, this.cachedValue, this.cachedRope);
}
}
return getNext().execute1(frameValue, valueValue);
}
static BaseNode_ create(ForeignToRubyNodeGen root, String cachedValue, Rope cachedRope) {
return new ConvertStringCachedNode_(root, cachedValue, cachedRope);
}
}
@GeneratedBy(methodName = "convertStringUncached(String)", value = ForeignToRubyNode.class)
private static final class ConvertStringUncachedNode_ extends BaseNode_ {
ConvertStringUncachedNode_(ForeignToRubyNodeGen root) {
super(root, 2);
}
@Override
public Object execute1(VirtualFrame frameValue, Object valueValue) {
if (valueValue instanceof String) {
String valueValue_ = (String) valueValue;
return root.convertStringUncached(valueValue_);
}
return getNext().execute1(frameValue, valueValue);
}
static BaseNode_ create(ForeignToRubyNodeGen root) {
return new ConvertStringUncachedNode_(root);
}
}
@GeneratedBy(methodName = "convert(Object)", value = ForeignToRubyNode.class)
private static final class ConvertNode_ extends BaseNode_ {
ConvertNode_(ForeignToRubyNodeGen root) {
super(root, 3);
}
@Override
public Object execute1(VirtualFrame frameValue, Object valueValue) {
if ((!(RubyGuards.isString(valueValue)))) {
return root.convert(valueValue);
}
return getNext().execute1(frameValue, valueValue);
}
static BaseNode_ create(ForeignToRubyNodeGen root) {
return new ConvertNode_(root);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy