[foreign] RFR 8210757: Add binder support for direct native invocation strategy
Jorn Vernee
jbvernee at xs4all.nl
Sat Sep 15 20:29:29 UTC 2018
Jorn Vernee schreef op 2018-09-15 02:04:
>> The downcall part (java to native) is relative straightforward: the
>> directNativeInvoker.cpp file defines a bunch of native entry points,
>> one per shape, which cast the input address to a function pointer of
>> the desired shape, and then call it:
>>
>> jlong NI_invokeNative_J_JD(JNIEnv *env, jobject _unused, jlong addr,
>> jlong arg0, jdouble arg1) {
>> return ((jlong (*)(jlong, jdouble))addr)(arg0, arg1);
>> }
>
> As an optimization here, I think you should make the function address
> the last argument, since that prevents having to shuffle the other
> arguments between registers before calling the function [2]
Never mind. I totally forgot about the leading JNIEnv and jobject
arguments in my experiment, so there's shuffling either way :) [1]
Jorn
[1] : https://godbolt.org/z/J2td8X
More information about the panama-dev
mailing list