RFR: 8349638: Build libjdwp with SIZE optimization

Matthias Baesken mbaesken at openjdk.org
Thu Feb 13 09:11:11 UTC 2025


On Thu, 13 Feb 2025 01:52:05 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> 
> So it's about a 5% footprint increase to go from LOW to HIGH, and about a 10% footprint savings to go from LOW to SIZE. What specific gcc -O flag do each of these map to? I figure SIZE == -Os, HIGH == -O3. Not sure about LOW, but if it is -O1, then -Os will probably give a performance increase since it is -O2 minus some code bloat optimizations and plus some code size optimizations.


Please see 
https://github.com/openjdk/jdk/blob/master/make/autoconf/flags-cflags.m4#L310

On gcc/clang , SIZE is indeed -OS ;  HIGH is -O3;  LOW (=NORM) is -O2 .
'minus some code bloat optimizations'  yes  some alignment (-falign*) options are omitted with -Os (see https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html 

Btw what is also interesting is LTO optimization ;  with gcc this has high optimization and for some libs quite large size reduction because at link time it can remove/rearrange quite a lot of code leading to smaller libs .
But currently we have LTO support only for hotspot.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23563#issuecomment-2655959995


More information about the build-dev mailing list