<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 12/01/2024 19:34, Pedro Lamarão
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAC8PkgEuv4dRQYNSTyD1crbBys1kYvMWANk8OEUo=ZUDxfPmnA@mail.gmail.com">
<div dir="ltr">
<div>Hello all!</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Em sex., 12 de jan. de 2024 às 14:03, Maurizio
Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">maurizio.cimadamore@oracle.com</a>>
escreveu:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 12/01/2024 16:28, 刘希晨 wrote:<br>
> Hi I want to ask a question about using project-panama,
I implemented <br>
> a network library using JDK21 with panama-foreign and
the performance <br>
> are quite well, since the API will officially release
in JDK22, I <br>
> started to migrating my project to using JDK22-ea, and
I have a <br>
> question about using Linker.Option.isTrivial(), I
noticed that in <br>
> JDK22 it seems to be renamed as
Linker.Option.critical(), the javadoc <br>
> says the function should have an extremely
short running time in all <br>
> cases, and does not callback into Java. I am pretty
sure that it could <br>
> be used on some functions returning constants macro
from C, but in <br>
> some cases, I am not quite sure if this option could be
used, here are <br>
> some examples:<br>
</blockquote>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
It's hard to define a clear boundary - the thing to keep in
mind is that <br>
critical() disables GC while the call is active - so you
don't want to <br>
run it for a very long time. But if you understand the
consequences, you <br>
might be in a better position to judge if that's ok.<br>
</blockquote>
<div><br>
</div>
<div>May I suggest that the following be added to the Javadoc?</div>
<div>It is already stated that it is advised that critical
downcalls be "extremely fast".</div>
<div>I suggest adding that they should run in a predictable,
"constant" amount of time.</div>
</div>
</div>
</blockquote>
I agree that the text could be improved - however we don't say
"fast" - we say this:<br>
<p><br>
</p>
<p>
<blockquote type="cite">
<p> A critical function is a function that has an extremely
short running time in all cases (similar to calling an empty
function), and does not call back into Java (e.g. using an
upcall stub). </p>
</blockquote>
<br>
</p>
<p>I agree that talking about "constant" or "predictable" execution
time would perhaps be a better characterization.</p>
Maurizio<br>
</body>
</html>