<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hi,<br>
      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.</p>
    <p>So, no, a trivial downcall cannot trigger upcalls (I don't think
      we detect this, I believe the JVM just crashes if you do).</p>
    <p>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?).</p>
    <p>Maurizio<br>
    </p>
    <div class="moz-cite-prefix">On 26/07/2023 22:23, Cheng Jin wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:BN8PR15MB2577D1EF4EC51FEF11DC41B8F500A@BN8PR15MB2577.namprd15.prod.outlook.com">
      
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hi there,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I’ve got a couple of questions about the
          behavior of a trivial downcall (with
          <b>isTrivial</b> specified).<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Is a FFI downcall able to trigger a JNI
          upcall ?<o:p></o:p></p>
        <p class="MsoNormal">If so, should a JNI upcall should be
          captured in this trivial downcall?<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Best Regards<o:p></o:p></p>
        <p class="MsoNormal">Cheng Jin<o:p></o:p></p>
      </div>
    </blockquote>
  </body>
</html>