Questions about the trivial downcall
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jul 26 23:44:09 UTC 2023
Hi,
a trivial downcall is supposed to target a native function that (a)
terminates quickly (so as not to block the GC for too long) and (b) does
not upcall into Java.
So, no, a trivial downcall cannot trigger upcalls (I don't think we
detect this, I believe the JVM just crashes if you do).
Also I notice that you speak of "JNI" upcall. Is that what you really
mean - e.g. a trivial FFM downcall making an upcall using JNI? In
general, I think it's a bit hard for downcalls to do anything that has
to do with JNI because the invoked native function is not passed a
JNIEnv - FFM really just bridges the Java code with the native library
function you want to call, nothing more. (I suppose that function could
get its hands on the VM using the JNI attach API, but I feel that's a
different question from what you were asking?).
Maurizio
On 26/07/2023 22:23, Cheng Jin wrote:
>
> Hi there,
>
> I’ve got a couple of questions about the behavior of a trivial
> downcall (with *isTrivial* specified).
>
> Is a FFI downcall able to trigger a JNI upcall ?
>
> If so, should a JNI upcall should be captured in this trivial downcall?
>
> Best Regards
>
> Cheng Jin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230727/38db9c88/attachment-0001.htm>
More information about the panama-dev
mailing list