Search in sources :

Example 1 with IntrinsifiedNativeMethodNode

use of com.oracle.truffle.espresso.nodes.IntrinsifiedNativeMethodNode in project graal by oracle.

the class JniEnv method lookupKnownVmMethods.

private Substitutions.EspressoRootNodeFactory lookupKnownVmMethods(@Pointer TruffleObject closure, Method targetMethod) {
    try {
        long jvmMethodAddress = InteropLibrary.getUncached().asPointer(closure);
        CallableFromNative.Factory knownVmMethod = getVM().lookupKnownVmMethod(jvmMethodAddress);
        if (knownVmMethod != null) {
            if (!IntrinsifiedNativeMethodNode.validParameterCount(knownVmMethod, targetMethod)) {
                getLogger().warning("Implicit intrinsification of VM method does not have matching parameter counts:");
                getLogger().warning("VM method " + knownVmMethod.methodName() + " has " + knownVmMethod.parameterCount() + " parameters,");
                getLogger().warning("Bound to " + (targetMethod.isStatic() ? "static" : "instance") + " method " + targetMethod.getNameAsString() + " which has " + targetMethod.getParameterCount() + " parameters");
                return null;
            }
            return createJniRootNodeFactory(() -> new IntrinsifiedNativeMethodNode(knownVmMethod, targetMethod, getVM()), targetMethod);
        }
    } catch (UnsupportedMessageException e) {
    // ignore
    }
    return null;
}
Also used : IntrinsifiedNativeMethodNode(com.oracle.truffle.espresso.nodes.IntrinsifiedNativeMethodNode) UnsupportedMessageException(com.oracle.truffle.api.interop.UnsupportedMessageException) CallableFromNative(com.oracle.truffle.espresso.substitutions.CallableFromNative)

Aggregations

UnsupportedMessageException (com.oracle.truffle.api.interop.UnsupportedMessageException)1 IntrinsifiedNativeMethodNode (com.oracle.truffle.espresso.nodes.IntrinsifiedNativeMethodNode)1 CallableFromNative (com.oracle.truffle.espresso.substitutions.CallableFromNative)1