<div dir="ltr">Hi,<div><br></div><div>The issue with the maintainability of jdk.internal.misc.Unsafe is that it is too powerful. I imagine getIntUnchecked(int[], int) can be implemented in Java as a simple index access, and C2 will parse it similar to a index operation apart from the bound check.</div><div><br></div><div>Please correct me if I do not comprehend the complexity of this matter. Thanks a lot,</div><div>Quan Anh</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 13 Jan 2024 at 02:40, Remi Forax <<a href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><div>Hello mery kitty,<br></div><div>""Safety"" is half of the problem here.<br></div><div><br></div><div>The other half is the cost of maintaining an official API to do native access and the fact that it will make future features/optimizations harder or impossible (cf the work to support sun.misc.Unsafe in Valhalla).<br></div><div><br></div><div>We already provide command line options to access to jdk.internal.misc.Unsafe (--add-exports/-add-opens) that are already too powerful IMO, but at least the contract is clear, any classes in jdk.internal.blah may change in the next JDK.</div><div><br></div><div>So you can access to the extra 1% if you want, at the cost of having to track the changes of the internal classes of the JDK. That is a fair deal for me.<br></div><div><br></div><div>regards,<br></div><div>Rémi<br></div><div><br></div><hr id="m_8540909955918985541zwchr"><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"Brian Goetz" <<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a>><br><b>To: </b>"Maurizio Cimadamore" <<a href="mailto:maurizio.cimadamore@oracle.com" target="_blank">maurizio.cimadamore@oracle.com</a>><br><b>Cc: </b>"Quân Anh Mai" <<a href="mailto:anhmdq@gmail.com" target="_blank">anhmdq@gmail.com</a>>, "amber-dev" <<a href="mailto:amber-dev@openjdk.org" target="_blank">amber-dev@openjdk.org</a>><br><b>Sent: </b>Friday, January 12, 2024 6:00:58 PM<br><b>Subject: </b>Re: Official support for Unsafe<br></blockquote></div><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt">
Indeed, this is the whole question: how much of *everyone’s* safety are we willing to trade to make the already-pretty-good, 99.999% case run a little faster. <br>
<div><br>
<blockquote>
<div>On Jan 12, 2024, at 11:52 AM, Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" target="_blank">maurizio.cimadamore@oracle.com</a>> wrote:</div>
<br>
<div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">Heck,
looking at the results of the 1brc competition, your pure Java solution (no Unsafe, just FFM) ended up scoring quite high (3rd!) - at some point the question has to become: how much safety I'm willing to sacrifice to get an extra 1% ? I know that's a subjective
decision, of course, but it's one that, as a community, we need to gripple with (as that has deep repercussions on the rest of the ecosystem).</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
</div>
</blockquote>
</div>
<br><br></blockquote></div></div></div></blockquote></div>