org.jruby.truffle.language.objects.TaintNodeGen 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.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyTypes;
import org.jruby.truffle.language.RubyTypesGen;
@GeneratedBy(TaintNode.class)
public final class TaintNodeGen extends TaintNode implements SpecializedNode {
@Child private RubyNode child_;
@CompilationFinal private Class> childType_;
@Child private BaseNode_ specialization_;
private TaintNodeGen(RubyNode child) {
this.child_ = child;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public Object executeTaint(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 TaintNode create(RubyNode child) {
return new TaintNodeGen(child);
}
@GeneratedBy(TaintNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected TaintNodeGen root;
BaseNode_(TaintNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (TaintNodeGen) 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 Taint0Node_.create(root);
}
if (RubyTypesGen.isImplicitInteger(childValue)) {
return Taint1Node_.create(root, childValue);
}
if (RubyTypesGen.isImplicitLong(childValue)) {
return Taint2Node_.create(root, childValue);
}
if (RubyTypesGen.isImplicitDouble(childValue)) {
return Taint3Node_.create(root, childValue);
}
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((RubyGuards.isRubySymbol(childValue_) || root.isNil(childValue_))) {
return TaintNilOrSymbolNode_.create(root);
}
if ((!(RubyGuards.isRubySymbol(childValue_))) && (!(root.isNil(childValue_)))) {
WriteObjectFieldNode writeTaintNode6 = (root.createWriteTaintNode());
return Taint4Node_.create(root, writeTaintNode6);
}
}
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(TaintNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(TaintNodeGen root) {
super(root, 2147483647);
}
@Override
public Object execute1(Object childValue) {
return uninitialized(null, childValue);
}
static BaseNode_ create(TaintNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(TaintNode.class)
private static final class PolymorphicNode_ extends BaseNode_ {
PolymorphicNode_(TaintNodeGen 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(TaintNodeGen root) {
return new PolymorphicNode_(root);
}
}
@GeneratedBy(methodName = "taint(boolean)", value = TaintNode.class)
private static final class Taint0Node_ extends BaseNode_ {
Taint0Node_(TaintNodeGen 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.taint(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof Boolean) {
boolean childValue_ = (boolean) childValue;
return root.taint(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(TaintNodeGen root) {
return new Taint0Node_(root);
}
}
@GeneratedBy(methodName = "taint(int)", value = TaintNode.class)
private static final class Taint1Node_ extends BaseNode_ {
private final Class> childImplicitType;
Taint1Node_(TaintNodeGen root, Object childValue) {
super(root, 2);
this.childImplicitType = RubyTypesGen.getImplicitIntegerClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((Taint1Node_) 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.taint(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (RubyTypesGen.isImplicitInteger(childValue, childImplicitType)) {
int childValue_ = RubyTypesGen.asImplicitInteger(childValue, childImplicitType);
return root.taint(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(TaintNodeGen root, Object childValue) {
return new Taint1Node_(root, childValue);
}
}
@GeneratedBy(methodName = "taint(long)", value = TaintNode.class)
private static final class Taint2Node_ extends BaseNode_ {
private final Class> childImplicitType;
Taint2Node_(TaintNodeGen root, Object childValue) {
super(root, 3);
this.childImplicitType = RubyTypesGen.getImplicitLongClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((Taint2Node_) 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.taint(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (RubyTypesGen.isImplicitLong(childValue, childImplicitType)) {
long childValue_ = RubyTypesGen.asImplicitLong(childValue, childImplicitType);
return root.taint(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(TaintNodeGen root, Object childValue) {
return new Taint2Node_(root, childValue);
}
}
@GeneratedBy(methodName = "taint(double)", value = TaintNode.class)
private static final class Taint3Node_ extends BaseNode_ {
private final Class> childImplicitType;
Taint3Node_(TaintNodeGen root, Object childValue) {
super(root, 4);
this.childImplicitType = RubyTypesGen.getImplicitDoubleClass(childValue);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.childImplicitType == ((Taint3Node_) 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.taint(childValue_);
}
@Override
public Object execute1(Object childValue) {
if (RubyTypesGen.isImplicitDouble(childValue, childImplicitType)) {
double childValue_ = RubyTypesGen.asImplicitDouble(childValue, childImplicitType);
return root.taint(childValue_);
}
return getNext().execute1(childValue);
}
static BaseNode_ create(TaintNodeGen root, Object childValue) {
return new Taint3Node_(root, childValue);
}
}
@GeneratedBy(methodName = "taintNilOrSymbol(DynamicObject)", value = TaintNode.class)
private static final class TaintNilOrSymbolNode_ extends BaseNode_ {
TaintNilOrSymbolNode_(TaintNodeGen root) {
super(root, 5);
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((RubyGuards.isRubySymbol(childValue_) || root.isNil(childValue_))) {
return root.taintNilOrSymbol(childValue_);
}
}
return getNext().execute1(childValue);
}
static BaseNode_ create(TaintNodeGen root) {
return new TaintNilOrSymbolNode_(root);
}
}
@GeneratedBy(methodName = "taint(DynamicObject, WriteObjectFieldNode)", value = TaintNode.class)
private static final class Taint4Node_ extends BaseNode_ {
@Child private WriteObjectFieldNode writeTaintNode;
Taint4Node_(TaintNodeGen root, WriteObjectFieldNode writeTaintNode) {
super(root, 6);
this.writeTaintNode = writeTaintNode;
}
@Override
public Object execute1(Object childValue) {
if (childValue instanceof DynamicObject) {
DynamicObject childValue_ = (DynamicObject) childValue;
if ((!(RubyGuards.isRubySymbol(childValue_))) && (!(root.isNil(childValue_)))) {
return root.taint(childValue_, this.writeTaintNode);
}
}
return getNext().execute1(childValue);
}
static BaseNode_ create(TaintNodeGen root, WriteObjectFieldNode writeTaintNode) {
return new Taint4Node_(root, writeTaintNode);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy