<div dir="ltr"><div>Hello:</div><div><br>I'm trying to use JVMTI's IterateOverInstancesOfClass function to get all instances of a specified class. The code can be found here: <a href="https://github.com/GGGGGHT/ffitest/blob/main/IterateInstance.java">https://github.com/GGGGGHT/ffitest/blob/main/IterateInstance.java</a><br><br></div><div>When I call the IterateOverInstancesOfClass method, the JVM crashes. The crash log is available here: <a href="https://github.com/GGGGGHT/ffitest/blob/main/hs_err_pid20038.log">https://github.com/GGGGGHT/ffitest/blob/main/hs_err_pid20038.log</a></div><div><br>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?</div><div><br>I look forward to your response.</div><div><pre class="gmail-notranslate" style="color:rgb(0,0,0)"><br></pre><pre class="gmail-notranslate" style="color:rgb(0,0,0)">Thanks!</pre><pre class="gmail-notranslate" style="color:rgb(0,0,0)">GGGGGHT</pre></div></div>