Using FFI to call JVMTI functions

ght ggg wz9712203617 at gmail.com
Tue Nov 26 10:59:34 UTC 2024


Hello:

I'm trying to use JVMTI's IterateOverInstancesOfClass function to get all
instances of a specified class. The code can be found here:
https://github.com/GGGGGHT/ffitest/blob/main/IterateInstance.java

When I call the IterateOverInstancesOfClass method, the JVM crashes. The
crash log is available here:
https://github.com/GGGGGHT/ffitest/blob/main/hs_err_pid20038.log

After examining the code in the UpcallLinker::on_entry method, I found that
this method needs to run on a JavaThread, but the current thread is a
VMThread, which leads to the JVM crash. I'm not entirely sure if my
analysis is correct. If it is correct, does this mean that using FFI to
call functions requiring UPCALL is not feasible? Or are there alternative
approaches to achieve my desired functionality?

I look forward to your response.


Thanks!

GGGGGHT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20241126/322e348d/attachment.htm>


More information about the panama-dev mailing list