org.jruby.truffle.language.loader.RequireNodeGen Maven / Gradle / Ivy
The newest version!
// CheckStyle: start generated
package org.jruby.truffle.language.loader;
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.profiles.BranchProfile;
import com.oracle.truffle.api.profiles.ConditionProfile;
import org.jruby.truffle.language.RubyNode;
@GeneratedBy(RequireNode.class)
public final class RequireNodeGen extends RequireNode implements SpecializedNode {
@Child private RubyNode feature_;
@Child private BaseNode_ specialization_;
private RequireNodeGen(RubyNode feature) {
this.feature_ = feature;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public boolean executeRequire(VirtualFrame frameValue, String featureValue) {
return specialization_.executeBoolean1(frameValue, featureValue);
}
@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());
}
private static String expectString(Object value) throws UnexpectedResultException {
if (value instanceof String) {
return (String) value;
}
throw new UnexpectedResultException(value);
}
public static RequireNode create(RubyNode feature) {
return new RequireNodeGen(feature);
}
@GeneratedBy(RequireNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected RequireNodeGen root;
BaseNode_(RequireNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (RequireNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {root.feature_};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object featureValue) {
return this.executeBoolean_((VirtualFrame) frameValue, featureValue);
}
public abstract boolean executeBoolean_(VirtualFrame frameValue, Object featureValue);
public boolean executeBoolean1(VirtualFrame frameValue, String featureValue) {
return executeBoolean_(frameValue, featureValue);
}
public Object execute(VirtualFrame frameValue) {
Object featureValue_ = root.feature_.execute(frameValue);
return executeBoolean_(frameValue, featureValue_);
}
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 featureValue) {
if (featureValue instanceof String) {
BranchProfile errorProfile1 = (BranchProfile.create());
ConditionProfile isLoadedProfile1 = (ConditionProfile.createBinaryProfile());
return RequireNode_.create(root, errorProfile1, isLoadedProfile1);
}
return null;
}
protected final BaseNode_ getNext() {
return (BaseNode_) this.next;
}
}
@GeneratedBy(RequireNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(RequireNodeGen root) {
super(root, 2147483647);
}
@Override
public boolean executeBoolean_(VirtualFrame frameValue, Object featureValue) {
return (boolean) uninitialized(frameValue, featureValue);
}
static BaseNode_ create(RequireNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(methodName = "require(VirtualFrame, String, BranchProfile, ConditionProfile)", value = RequireNode.class)
private static final class RequireNode_ extends BaseNode_ {
private final BranchProfile errorProfile;
private final ConditionProfile isLoadedProfile;
RequireNode_(RequireNodeGen root, BranchProfile errorProfile, ConditionProfile isLoadedProfile) {
super(root, 1);
this.errorProfile = errorProfile;
this.isLoadedProfile = isLoadedProfile;
}
@Override
public boolean executeBoolean0(VirtualFrame frameValue) {
String featureValue_;
try {
featureValue_ = expectString(root.feature_.execute(frameValue));
} catch (UnexpectedResultException ex) {
return getNext().executeBoolean_(frameValue, ex.getResult());
}
return root.require(frameValue, featureValue_, this.errorProfile, this.isLoadedProfile);
}
@Override
public boolean executeBoolean1(VirtualFrame frameValue, String featureValue) {
return root.require(frameValue, featureValue, this.errorProfile, this.isLoadedProfile);
}
@Override
public boolean executeBoolean_(VirtualFrame frameValue, Object featureValue) {
if (featureValue instanceof String) {
String featureValue_ = (String) featureValue;
return root.require(frameValue, featureValue_, this.errorProfile, this.isLoadedProfile);
}
return getNext().executeBoolean_(frameValue, featureValue);
}
static BaseNode_ create(RequireNodeGen root, BranchProfile errorProfile, ConditionProfile isLoadedProfile) {
return new RequireNode_(root, errorProfile, isLoadedProfile);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy