com.oracle.truffle.sl.builtins.SLDefineFunctionBuiltinFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-sl Show documentation
Show all versions of truffle-sl Show documentation
Truffle SL is an example language implemented using the Truffle API.
The newest version!
// CheckStyle: start generated
package com.oracle.truffle.sl.builtins;
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.NeverDefault;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.strings.TruffleString;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import java.util.List;
@GeneratedBy(SLDefineFunctionBuiltin.class)
@SuppressWarnings("javadoc")
public final class SLDefineFunctionBuiltinFactory implements NodeFactory {
private static final SLDefineFunctionBuiltinFactory INSTANCE = new SLDefineFunctionBuiltinFactory();
private SLDefineFunctionBuiltinFactory() {
}
@Override
public Class getNodeClass() {
return SLDefineFunctionBuiltin.class;
}
@Override
public List> getExecutionSignature() {
return List.of(SLExpressionNode.class);
}
@Override
public List>> getNodeSignatures() {
return List.of(List.of(SLExpressionNode[].class));
}
@Override
public SLDefineFunctionBuiltin createNode(Object... arguments) {
if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof SLExpressionNode[])) {
return create((SLExpressionNode[]) arguments[0]);
} else {
throw new IllegalArgumentException("Invalid create signature.");
}
}
public static NodeFactory getInstance() {
return INSTANCE;
}
@NeverDefault
public static SLDefineFunctionBuiltin create(SLExpressionNode[] arguments) {
return new SLDefineFunctionBuiltinNodeGen(arguments);
}
/**
* Debug Info:
* Specialization {@link SLDefineFunctionBuiltin#defineFunction}
* Activation probability: 1.00000
* With/without class size: 16/0 bytes
*
*/
@GeneratedBy(SLDefineFunctionBuiltin.class)
@SuppressWarnings("javadoc")
public static final class SLDefineFunctionBuiltinNodeGen extends SLDefineFunctionBuiltin {
@Child private SLExpressionNode arguments0_;
/**
* State Info:
* 0: SpecializationActive {@link SLDefineFunctionBuiltin#defineFunction}
*
*/
@CompilationFinal private int state_0_;
private SLDefineFunctionBuiltinNodeGen(SLExpressionNode[] arguments) {
this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
}
@Override
protected Object execute(VirtualFrame frameValue) {
int state_0 = this.state_0_;
Object arguments0Value_ = this.arguments0_.executeGeneric(frameValue);
if (state_0 != 0 /* is SpecializationActive[SLDefineFunctionBuiltin.defineFunction(TruffleString)] */ && arguments0Value_ instanceof TruffleString) {
TruffleString arguments0Value__ = (TruffleString) arguments0Value_;
return defineFunction(arguments0Value__);
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arguments0Value_);
}
private TruffleString executeAndSpecialize(Object arguments0Value) {
int state_0 = this.state_0_;
if (arguments0Value instanceof TruffleString) {
TruffleString arguments0Value_ = (TruffleString) arguments0Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[SLDefineFunctionBuiltin.defineFunction(TruffleString)] */;
this.state_0_ = state_0;
return defineFunction(arguments0Value_);
}
throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_}, arguments0Value);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy