org.jruby.truffle.gem.bcrypt.BCryptNodesFactory Maven / Gradle / Ivy
The newest version!
// CheckStyle: start generated
package org.jruby.truffle.gem.bcrypt;
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.NodeFactory;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
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 java.util.Arrays;
import java.util.List;
import org.jruby.truffle.builtins.CoreMethodArrayArgumentsNode;
import org.jruby.truffle.gem.bcrypt.BCryptNodes.GenerateSalt;
import org.jruby.truffle.gem.bcrypt.BCryptNodes.HashPassword;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyTypesGen;
@GeneratedBy(BCryptNodes.class)
public final class BCryptNodesFactory {
public static List> getFactories() {
return Arrays.asList(HashPasswordFactory.getInstance(), GenerateSaltFactory.getInstance());
}
@GeneratedBy(HashPassword.class)
@SuppressWarnings({"unchecked", "rawtypes"})
public static final class HashPasswordFactory implements NodeFactory {
private static HashPasswordFactory hashPasswordFactoryInstance;
private HashPasswordFactory() {
}
@Override
public Class getNodeClass() {
return HashPassword.class;
}
@Override
public List getExecutionSignature() {
return Arrays.asList(RubyNode.class, RubyNode.class);
}
@Override
public List getNodeSignatures() {
return Arrays.asList(Arrays.asList(RubyNode[].class));
}
@Override
public HashPassword createNode(Object... arguments) {
if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
return create((RubyNode[]) arguments[0]);
} else {
throw new IllegalArgumentException("Invalid create signature.");
}
}
public static NodeFactory getInstance() {
if (hashPasswordFactoryInstance == null) {
hashPasswordFactoryInstance = new HashPasswordFactory();
}
return hashPasswordFactoryInstance;
}
public static HashPassword create(RubyNode[] arguments) {
return new HashPasswordNodeGen(arguments);
}
@GeneratedBy(HashPassword.class)
public static final class HashPasswordNodeGen extends HashPassword {
@Child private RubyNode arguments0_;
@Child private RubyNode arguments1_;
@CompilationFinal private boolean seenUnsupported0;
private HashPasswordNodeGen(RubyNode[] arguments) {
this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
this.arguments1_ = arguments != null && 1 < arguments.length ? arguments[1] : null;
}
@Override
public NodeCost getCost() {
return NodeCost.MONOMORPHIC;
}
@Override
public Object execute(VirtualFrame frameValue) {
DynamicObject arguments0Value_;
try {
arguments0Value_ = arguments0_.executeDynamicObject(frameValue);
} catch (UnexpectedResultException ex) {
Object arguments1Value = arguments1_.execute(frameValue);
throw unsupported(ex.getResult(), arguments1Value);
}
DynamicObject arguments1Value_;
try {
arguments1Value_ = arguments1_.executeDynamicObject(frameValue);
} catch (UnexpectedResultException ex) {
throw unsupported(arguments0Value_, ex.getResult());
}
if ((RubyGuards.isRubyString(arguments0Value_)) && (RubyGuards.isRubyString(arguments1Value_))) {
return this.hashpw(arguments0Value_, arguments1Value_);
}
throw unsupported(arguments0Value_, arguments1Value_);
}
@Override
public void executeVoid(VirtualFrame frameValue) {
execute(frameValue);
return;
}
private UnsupportedSpecializationException unsupported(Object arguments0Value, Object arguments1Value) {
if (!seenUnsupported0) {
CompilerDirectives.transferToInterpreterAndInvalidate();
seenUnsupported0 = true;
}
return new UnsupportedSpecializationException(this, new Node[] {arguments0_, arguments1_}, arguments0Value, arguments1Value);
}
}
}
@GeneratedBy(GenerateSalt.class)
@SuppressWarnings({"unchecked", "rawtypes"})
public static final class GenerateSaltFactory implements NodeFactory {
private static GenerateSaltFactory generateSaltFactoryInstance;
private GenerateSaltFactory() {
}
@Override
public Class getNodeClass() {
return GenerateSalt.class;
}
@Override
public List getExecutionSignature() {
return Arrays.asList(RubyNode.class);
}
@Override
public List getNodeSignatures() {
return Arrays.asList(Arrays.asList(RubyNode[].class));
}
@Override
public GenerateSalt createNode(Object... arguments) {
if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
return create((RubyNode[]) arguments[0]);
} else {
throw new IllegalArgumentException("Invalid create signature.");
}
}
public static NodeFactory getInstance() {
if (generateSaltFactoryInstance == null) {
generateSaltFactoryInstance = new GenerateSaltFactory();
}
return generateSaltFactoryInstance;
}
public static GenerateSalt create(RubyNode[] arguments) {
return new GenerateSaltNodeGen(arguments);
}
@GeneratedBy(GenerateSalt.class)
public static final class GenerateSaltNodeGen extends GenerateSalt implements SpecializedNode {
@Child private RubyNode arguments0_;
@CompilationFinal private Class> arguments0Type_;
@Child private BaseNode_ specialization_;
private GenerateSaltNodeGen(RubyNode[] arguments) {
this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public Object execute(VirtualFrame frameValue) {
return specialization_.execute(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());
}
@GeneratedBy(GenerateSalt.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected GenerateSaltNodeGen root;
BaseNode_(GenerateSaltNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (GenerateSaltNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {root.arguments0_};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object arguments0Value) {
return this.execute_((VirtualFrame) frameValue, arguments0Value);
}
public abstract Object execute_(VirtualFrame frameValue, Object arguments0Value);
public Object execute(VirtualFrame frameValue) {
Object arguments0Value_ = executeArguments0_(frameValue);
return execute_(frameValue, arguments0Value_);
}
public void executeVoid(VirtualFrame frameValue) {
execute(frameValue);
return;
}
@Override
protected final SpecializationNode createNext(Frame frameValue, Object arguments0Value) {
if (RubyTypesGen.isImplicitInteger(arguments0Value)) {
return GensaltNode_.create(root, arguments0Value);
}
return null;
}
@Override
protected final SpecializationNode createPolymorphic() {
return PolymorphicNode_.create(root);
}
protected final BaseNode_ getNext() {
return (BaseNode_) this.next;
}
protected final Object executeArguments0_(Frame frameValue) {
Class> arguments0Type_ = root.arguments0Type_;
try {
if (arguments0Type_ == int.class) {
return root.arguments0_.executeInteger((VirtualFrame) frameValue);
} else if (arguments0Type_ == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Class> _type = Object.class;
try {
Object _value = root.arguments0_.execute((VirtualFrame) frameValue);
if (_value instanceof Integer) {
_type = int.class;
} else {
_type = Object.class;
}
return _value;
} finally {
root.arguments0Type_ = _type;
}
} else {
return root.arguments0_.execute((VirtualFrame) frameValue);
}
} catch (UnexpectedResultException ex) {
root.arguments0Type_ = Object.class;
return ex.getResult();
}
}
}
@GeneratedBy(GenerateSalt.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(GenerateSaltNodeGen root) {
super(root, 2147483647);
}
@Override
public Object execute_(VirtualFrame frameValue, Object arguments0Value) {
return uninitialized(frameValue, arguments0Value);
}
static BaseNode_ create(GenerateSaltNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(GenerateSalt.class)
private static final class PolymorphicNode_ extends BaseNode_ {
PolymorphicNode_(GenerateSaltNodeGen root) {
super(root, 0);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arguments0Value) {
return polymorphicMerge(newNode, super.merge(newNode, frameValue, arguments0Value));
}
@Override
public Object execute_(VirtualFrame frameValue, Object arguments0Value) {
return getNext().execute_(frameValue, arguments0Value);
}
static BaseNode_ create(GenerateSaltNodeGen root) {
return new PolymorphicNode_(root);
}
}
@GeneratedBy(methodName = "gensalt(int)", value = GenerateSalt.class)
private static final class GensaltNode_ extends BaseNode_ {
private final Class> arguments0ImplicitType;
GensaltNode_(GenerateSaltNodeGen root, Object arguments0Value) {
super(root, 1);
this.arguments0ImplicitType = RubyTypesGen.getImplicitIntegerClass(arguments0Value);
}
@Override
public boolean isSame(SpecializationNode other) {
return super.isSame(other) && this.arguments0ImplicitType == ((GensaltNode_) other).arguments0ImplicitType;
}
@Override
public Object execute(VirtualFrame frameValue) {
int arguments0Value_;
try {
if (arguments0ImplicitType == int.class) {
arguments0Value_ = root.arguments0_.executeInteger(frameValue);
} else {
Object arguments0Value__ = executeArguments0_(frameValue);
arguments0Value_ = RubyTypesGen.expectImplicitInteger(arguments0Value__, arguments0ImplicitType);
}
} catch (UnexpectedResultException ex) {
return getNext().execute_(frameValue, ex.getResult());
}
return root.gensalt(arguments0Value_);
}
@Override
public Object execute_(VirtualFrame frameValue, Object arguments0Value) {
if (RubyTypesGen.isImplicitInteger(arguments0Value, arguments0ImplicitType)) {
int arguments0Value_ = RubyTypesGen.asImplicitInteger(arguments0Value, arguments0ImplicitType);
return root.gensalt(arguments0Value_);
}
return getNext().execute_(frameValue, arguments0Value);
}
static BaseNode_ create(GenerateSaltNodeGen root, Object arguments0Value) {
return new GensaltNode_(root, arguments0Value);
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy