Search in sources :

Example 1 with NativeType

use of com.oracle.truffle.espresso.ffi.NativeType in project graal by oracle.

the class Method method buildJniNativeSignature.

public static NativeSignature buildJniNativeSignature(Symbol<Type>[] signature) {
    NativeType returnType = NativeAccess.kindToNativeType(Signatures.returnKind(signature));
    int argCount = Signatures.parameterCount(signature, false);
    // Prepend JNIEnv* and class|receiver.
    NativeType[] parameterTypes = new NativeType[argCount + 2];
    // Prepend JNIEnv*.
    parameterTypes[0] = NativeType.POINTER;
    // Receiver for instance methods, class for static methods.
    parameterTypes[1] = NativeType.OBJECT;
    for (int i = 0; i < argCount; ++i) {
        parameterTypes[i + 2] = NativeAccess.kindToNativeType(Signatures.parameterKind(signature, i));
    }
    return NativeSignature.create(returnType, parameterTypes);
}
Also used : NativeType(com.oracle.truffle.espresso.ffi.NativeType)

Aggregations

NativeType (com.oracle.truffle.espresso.ffi.NativeType)1