<div dir="ltr">Thanks, Evgeny, these are all good points. </div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2025 at 4:14 PM Astigeevich, Evgeny <<a href="mailto:eastig@amazon.co.uk">eastig@amazon.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg-4352931749549564856">
<div lang="EN-GB" style="overflow-wrap: break-word;">
<div class="m_-4352931749549564856WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif">>
</span>you mean that since the code cache is limited to 2g, it is very unlikely to have that many classes since a significant part of those would not be JIT compiled?<u></u><u></u></p>
<p class="MsoNormal">> But the JVM would not fail, or? It would just continuously throw out old methods from the code cache?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I mean if an application wants to keep in use more than 5-6 million classes, the application should forget about JIT compilation and performance. CodeCache will become a bottleneck.<u></u><u></u></p>
<p class="MsoNormal">It is an interesting question, whether JVM would fail or not. IMO it would crash. I think some data structures would not accommodate such stress situation.
<u></u><u></u></p>
<p class="MsoNormal">It is also interesting how many classes JVM can currently keep alive and have JIT compilation working.<u></u><u></u></p>
<p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"> > It would just continuously throw out old methods from the code cache?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This depends on compilation requests rate. The process of flushing code cache depends on GC.<u></u><u></u></p>
<p class="MsoNormal">If the rate is not high, this will happen. If the rate is high, the compilation will stop.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In any case the performance of an application will be hurt a lot.<span style="font-size:11pt;font-family:Calibri,sans-serif"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif">Evgeny<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
<div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) currentcolor currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-left:36pt"><b><span style="font-family:Calibri,sans-serif;color:black">From:
</span></b><span style="font-family:Calibri,sans-serif;color:black">Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com" target="_blank">thomas.stuefe@gmail.com</a>><br>
<b>Date: </b>Thursday 6 February 2025 at 13:46<br>
<b>To: </b>"Astigeevich, Evgeny" <<a href="mailto:eastig@amazon.co.uk" target="_blank">eastig@amazon.co.uk</a>><br>
<b>Cc: </b>hotspot-dev <<a href="mailto:hotspot-dev@openjdk.org" target="_blank">hotspot-dev@openjdk.org</a>>, "Kennke, Roman" <<a href="mailto:rkennke@amazon.de" target="_blank">rkennke@amazon.de</a>><br>
<b>Subject: </b>RE: [EXTERNAL] Deprecate -UseCompressedClassPointers?<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
</div>
<div>
<table border="0" cellspacing="0" cellpadding="0" width="622" style="width:466.5pt;margin-left:36pt;border-collapse:collapse">
<tbody>
<tr style="height:15.25pt">
<td width="622" valign="top" style="width:466.5pt;border:1.5pt solid rgb(237,125,49);padding:0cm 5.4pt;height:15.25pt">
<p><strong><span style="font-family:Aptos,sans-serif;color:black;background:repeat rgb(255,255,153)">CAUTION</span></strong><span style="color:black;background:repeat rgb(255,255,153)">: This email originated from outside of the organization. Do not click links or open attachments unless
you can confirm the sender and know the content is safe.</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36pt">Hi Evgeny,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt">you mean that since the code cache is limited to 2g, it is very unlikely to have that many classes since a significant part of those would not be JIT compiled? But the JVM would not fail, or? It would just continuously
throw out old methods from the code cache? But our current assumption is that the only cases that are doing this are generator scenarios that create many classes, but that those never get hot enough.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt">But its still a good point. <u></u>
<u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt">Cheers, Thomas<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:36pt">On Thu, Feb 6, 2025 at 2:34<span style="font-family:Arial,sans-serif"> </span>PM Astigeevich, Evgeny <<a href="mailto:eastig@amazon.co.uk" target="_blank">eastig@amazon.co.uk</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36pt">
> Why would we still need `-UseCompressedClassPointers`? Two reasons:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
> …<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
> 2) To load more than ~5-6 million classes….<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif">CodeCache size limit is 2G for all platforms.</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif">If those classes methods get JIT compiled, it is unlikely generated code will fit into CodeCache.
</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif">-Evgeny Astigeevich</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif"> </span><u></u><u></u></p>
<div style="border-width:1pt medium medium;border-style:solid none none;padding:3pt 0cm 0cm;border-color:currentcolor">
<p class="MsoNormal" style="margin-left:72pt">
<b><span style="font-family:Calibri,sans-serif;color:black">From: </span></b><span style="font-family:Calibri,sans-serif;color:black">hotspot-dev <<a href="mailto:hotspot-dev-retn@openjdk.org" target="_blank">hotspot-dev-retn@openjdk.org</a>> on behalf
of Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com" target="_blank">thomas.stuefe@gmail.com</a>><br>
<b>Date: </b>Tuesday 4 February 2025 at 11:52<br>
<b>To: </b>hotspot-dev <<a href="mailto:hotspot-dev@openjdk.org" target="_blank">hotspot-dev@openjdk.org</a>><br>
<b>Cc: </b>"Kennke, Roman" <<a href="mailto:rkennke@amazon.de" target="_blank">rkennke@amazon.de</a>><br>
<b>Subject: </b>[EXTERNAL] Deprecate -UseCompressedClassPointers?</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72pt">
<u></u><u></u></p>
</div>
<div>
<table border="0" cellspacing="0" cellpadding="0" width="622" style="width:466.5pt;margin-left:72pt;border-collapse:collapse">
<tbody>
<tr style="height:15.25pt">
<td width="622" valign="top" style="width:466.5pt;border:1.5pt solid rgb(237,125,49);padding:0cm 5.4pt;height:15.25pt">
<p><strong><span style="font-family:Aptos,sans-serif;color:black;background:repeat rgb(255,255,153)">CAUTION</span></strong><span style="color:black;background:repeat rgb(255,255,153)">: This email originated from outside of the organization. Do not click links or open attachments unless
you can confirm the sender and know the content is safe.</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal" style="margin-left:72pt">
<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:72pt">
<br>
Hi all,<br>
<br>
I would like to get rid of the `-UseCompressedClassPointers` case since it would cut down the number of configurations we need to support and test from three to two (`-UseCompressedClassPointers`, `+UseCompressedClassPointers`, `+UseCompactObjectHeaders`).<br>
<br>
This would leave us with the now default case, `+UseCompressedClassPointers`, as the sole supported CCP case, thereby removing the need for the switch, which we therefore should deprecate and eventually remove.<br>
<br>
Apart from significantly reducing code complexity and testing effort, `-UseCompressedClassPointers` does not seem to be tested that well, especially on 64-bit platforms. See e.g.
<a href="https://github.com/openjdk/jdk/pull/23053" target="_blank">https://github.com/openjdk/jdk/pull/23053</a>, and Roman's suspicion is that there are many more.<br>
<br>
It increases memory usage by quite a bit ("Alias for -XX:WasteMemory" - Erik Österlund), and any historical connection to UseCompresseedOops have long been removed.
<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:72pt">
<br>
Why would we still need `-UseCompressedClassPointers`? Two reasons:<br>
<br>
1) To support 32-bit, where, atm, it is the only implemented mode. But I am confident that I can find some low-effort low-code way to "fake" compressed Klass* pointers, since after all the 32-bit address space could be seen as a 4GB class space. There is also
the bigger question of the future of 32-bit - we discussed this at the FOSDEM OpenJDK workshop, with mixed results, but it seems likely that 32-bit will go away at some point, the only question is when.<br>
<br>
2) To load more than ~5-6 million classes. Class space, when maxed out, allows for about 5-6 million classes, given a typical Klass size distribution. I think that number is ridiculous, though. If you load or generate that many classes, you are a likely very
patient programmer with a leaky or misdesigned application (just consider for a moment that to fill 4GB class space to the brim with Klass instances, would would typically use up about 5-10 times as much in non-class metaspace. That is for metadata alone.
I cannot see a sane application doing that.<br>
<br>
Is anyone using -UseCompressedClassPointers for any valid reason I am not aware of?<br>
<br>
If not, barring any objections, my plan is to deprecate UseCompressedClassPointers for JDK25, find an alternative for 32-bit platforms in JDK26, and remove the uncompressed case in JDK 26 or later.
<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:72pt">
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72pt">
What do people think?<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12pt;margin-left:36pt">
<br>
<br>
<br>
Amazon Development Centre (London) Ltd.Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.<br>
<br>
<u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<br><br><br>Amazon Development Centre (London) Ltd.Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.<br><br><br>
</div>
</div></blockquote></div>