RFR: JDK-8239794 Move -Os from JVM feature 'minimal' to new feature 'opt-size'

Erik Joelsson erik.joelsson at oracle.com
Fri Feb 21 16:29:56 UTC 2020


Looks good to me.

/Erik

On 2020-02-21 08:13, Magnus Ihse Bursie wrote:
> Prior to JDK-8239450, it was possible to explicitly set the JVM 
> feature 'minimal', even when building variant server. The reason for 
> doing this was to get the code in JvmFeatures.gmk that sets 
> JVM_OPTIMIZATION := SIZE (except for a handful of files).
>
> Since this functionality is important in itself (and it has been 
> requested by users in the community), it should be controlled by a 
> separate feature, instead of just as a part of the 'minimal' feature, 
> which signals that the minimal JVM variant is being built.
>
> However, when looking into it, I noticed several aspects of the old 
> code that I wanted to address.
>
> First of all, the old code had the size optimization silently ignored, 
> if also 'link-time-opt' was enabled. This does not make any sense, 
> since it is completely possible to do both. This code was written in 
> the new Hotspot build system as a way to mimick the old Hotspot build 
> system. I'm guessing that this was initially introduced as a way to 
> enable the size optimization when building minimal, except for arm-32 
> systems, which were the only system to have link-time-opt enabled.
>
> After some head scratching, I implemented the logic in the following way:
>  * If opt-size is enabled, the JVM_OPTIMIZATION := SIZE is always 
> performed, regardless of any other features.
>  * And contrary, link-time-opt can be enabled/disabled independent on 
> opt-size
>  * When building minimal on arm-32, opt-size is not enabled by 
> default, but link-time-opt is (as it was before)
>  * When building minimal on any other platform, opt-size is enabled by 
> default, but link-time-opt is not (as it was before)
> * When building any other variant, opt-size is disabled by default
>
> This makes standard builds of minimal with no extra features 
> enabled/disabled behave the same as before, while giving the maximum 
> of flexibility to change this. But I'd like to get input from someone 
> in the Hotspot team that this is a sound approach.
>
> Also, this has apparently never been tested by any other compiler than 
> gcc and/or clang, since we explicitly add the compiler flag 
> -fno-optimize-sibling-calls. I wrapped this in a compiler check.
>
> Note that this patch is based on JDK-8239789 (Follow-up on JVM feature 
> rewrite).
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8239794
> WebRev: 
> http://cr.openjdk.java.net/~ihse/JDK-8239794-create-opt-size-jvm-feature/webrev.01
>
> /Magnus



More information about the build-dev mailing list