org.pkl.thirdparty.truffle.polyglot.PolyglotFunctionProxyHandlerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkl-tools Show documentation
Show all versions of pkl-tools Show documentation
Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.
// CheckStyle: start generated
package org.pkl.thirdparty.truffle.polyglot;
import org.pkl.thirdparty.truffle.api.CompilerDirectives;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.CompilationFinal;
import org.pkl.thirdparty.truffle.api.dsl.GeneratedBy;
import org.pkl.thirdparty.truffle.api.dsl.NeverDefault;
import org.pkl.thirdparty.truffle.api.dsl.UnsupportedSpecializationException;
import org.pkl.thirdparty.truffle.api.interop.TruffleObject;
import org.pkl.thirdparty.truffle.api.nodes.Node;
import org.pkl.thirdparty.truffle.api.nodes.NodeCost;
import org.pkl.thirdparty.truffle.polyglot.PolyglotFunctionProxyHandler.FunctionProxyNode;
import org.pkl.thirdparty.truffle.polyglot.PolyglotObjectProxyHandler.ProxyInvokeNode;
import java.lang.invoke.VarHandle;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Objects;
@GeneratedBy(PolyglotFunctionProxyHandler.class)
@SuppressWarnings("javadoc")
final class PolyglotFunctionProxyHandlerFactory {
/**
* Debug Info:
* Specialization {@link FunctionProxyNode#doCached}
* Activation probability: 1.00000
* With/without class size: 32/12 bytes
*
*/
@GeneratedBy(FunctionProxyNode.class)
@SuppressWarnings("javadoc")
static final class FunctionProxyNodeGen extends FunctionProxyNode {
/**
* State Info:
* 0: SpecializationActive {@link FunctionProxyNode#doCached}
*
*/
@CompilationFinal private int state_0_;
/**
* Source Info:
* Specialization: {@link FunctionProxyNode#doCached}
* Parameter: {@link Class} returnClass
*/
@CompilationFinal private Class> returnClass_;
/**
* Source Info:
* Specialization: {@link FunctionProxyNode#doCached}
* Parameter: {@link Type} returnType
*/
@CompilationFinal private Type returnType_;
/**
* Source Info:
* Specialization: {@link FunctionProxyNode#doCached}
* Parameter: {@link PolyglotExecuteNode} executeNode
*/
@Child private PolyglotExecuteNode executeNode_;
private FunctionProxyNodeGen(PolyglotLanguageInstance languageInstance, Class> receiverType, Method method) {
super(languageInstance, receiverType, method);
}
@Override
protected Object executeImpl(PolyglotLanguageContext arg0Value, Object arg1Value, Object[] arg2Value) {
int state_0 = this.state_0_;
if (state_0 != 0 /* is SpecializationActive[PolyglotFunctionProxyHandler.FunctionProxyNode.doCached(PolyglotLanguageContext, TruffleObject, Object[], Class<>, Type, PolyglotExecuteNode)] */ && arg1Value instanceof TruffleObject) {
TruffleObject arg1Value_ = (TruffleObject) arg1Value;
{
Class> returnClass__ = this.returnClass_;
if (returnClass__ != null) {
Type returnType__ = this.returnType_;
if (returnType__ != null) {
PolyglotExecuteNode executeNode__ = this.executeNode_;
if (executeNode__ != null) {
return doCached(arg0Value, arg1Value_, arg2Value, returnClass__, returnType__, executeNode__);
}
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value);
}
private Object executeAndSpecialize(PolyglotLanguageContext arg0Value, Object arg1Value, Object[] arg2Value) {
int state_0 = this.state_0_;
if (arg1Value instanceof TruffleObject) {
TruffleObject arg1Value_ = (TruffleObject) arg1Value;
Class> returnClass__ = (ProxyInvokeNode.getMethodReturnType(method));
Objects.requireNonNull(returnClass__, "Specialization 'doCached(PolyglotLanguageContext, TruffleObject, Object[], Class<>, Type, PolyglotExecuteNode)' cache 'returnClass' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.returnClass_ = returnClass__;
Type returnType__ = (ProxyInvokeNode.getMethodGenericReturnType(method));
Objects.requireNonNull(returnType__, "Specialization 'doCached(PolyglotLanguageContext, TruffleObject, Object[], Class<>, Type, PolyglotExecuteNode)' cache 'returnType' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.returnType_ = returnType__;
PolyglotExecuteNode executeNode__ = this.insert((PolyglotExecuteNodeGen.create()));
Objects.requireNonNull(executeNode__, "Specialization 'doCached(PolyglotLanguageContext, TruffleObject, Object[], Class<>, Type, PolyglotExecuteNode)' cache 'executeNode' returned a 'null' default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns 'null'.");
VarHandle.storeStoreFence();
this.executeNode_ = executeNode__;
state_0 = state_0 | 0b1 /* add SpecializationActive[PolyglotFunctionProxyHandler.FunctionProxyNode.doCached(PolyglotLanguageContext, TruffleObject, Object[], Class<>, Type, PolyglotExecuteNode)] */;
this.state_0_ = state_0;
return doCached(arg0Value, arg1Value_, arg2Value, returnClass__, returnType__, executeNode__);
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null, null}, arg0Value, arg1Value, arg2Value);
}
@Override
public NodeCost getCost() {
int state_0 = this.state_0_;
if (state_0 == 0) {
return NodeCost.UNINITIALIZED;
} else {
return NodeCost.MONOMORPHIC;
}
}
@NeverDefault
public static FunctionProxyNode create(PolyglotLanguageInstance languageInstance, Class> receiverType, Method method) {
return new FunctionProxyNodeGen(languageInstance, receiverType, method);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy