<div dir="ltr"><div>Hi Evgeny,</div><div><br></div><div>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.</div><div><br></div><div>But its still a good point. <br></div><div><br></div><div>Cheers, Thomas<br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2025 at 2:34 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:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg8315108261806069786">





<div lang="EN-GB" style="overflow-wrap: break-word;">
<div class="m_8315108261806069786WordSection1">
<p class="MsoNormal">> Why would we still need `-UseCompressedClassPointers`? Two reasons:<u></u><u></u></p>
<p class="MsoNormal">> …<u></u><u></u></p>
<p class="MsoNormal">> 2) To load more than ~5-6 million classes….<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">CodeCache size limit is 2G for all platforms.<u></u><u></u></span></p>
<p class="MsoNormal"><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.
<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">-Evgeny Astigeevich<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">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?<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:rgb(255,255,153)">CAUTION</span></strong><span style="color:black;background: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>
<p class="MsoNormal" style="margin-left:36pt"><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:36pt"><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:36pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36pt">What do people think?<u></u><u></u></p>
</div>
</div>
</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>