[8u] Request for enhancement backport approval for 8210352: [hotspot] --with-extra-cxx-flags should not lower optimization

Severin Gehwolf sgehwolf at redhat.com
Wed Sep 5 08:54:54 UTC 2018


Hi,

I've been asked to proceed with the enhancement request process[1] for
this proposed JDK 8u fix.

Bug: https://bugs.openjdk.java.net/browse/JDK-8210352

Currently JDK 8 and JDK 9+ behave differently in terms of hotspot
libjvm optimization flags. In JDK 8 they can be overridden by
--with-extra-c{,xx}-flags configure options. In JDK 9+ this cannot be
done as libjvm optimization flags come after any extra C flags from
configure. This enhancement request for JDK 8 asks for the build of the
JVM to behave the same as JDK 9+.

The rationale why we'd wanted such behaviour is as follows. In Fedora
distribution wide config exists which sets C flags. Hooks are in place
so that all natives get compiled with these C flags. One goal is to
ensure all distro libraries and programs are being optimized at at
least a certain threshold, say >= -O2. This includes OpenJDK.

While there is a way to fix the build system to compile each and every
library with some optimization level the risk is that there might not
be a one-size-fits-all downstream distribution consumers. The easier
and more flexible case is to allow for this via extra C flags which can
be passed to the build. This is currently possible.

The exception to this rule should be libjvm. Optimization levels for
the JVM have been thoroughly tested and to some extent been lowered via
a by-object overrides. Example case is 
sharedRuntimeTrans.o and sharedRuntimeTrig.o which have -O0
settings[2]. The point is that for the JVM optimization flags have been
thoroughly crafted to a point where they are today. Letting the user
override this to some other value, like -O2, via a simple configure
option seems dangerous. Currently in JDK 8 it's possible to override
JVM optimization flags via --with-extra-c{,xx}-flags configure option.

OK to move ahead with this enhancement for JDK 8u?

Thanks,
Severin

[1] http://mail.openjdk.java.net/pipermail/build-dev/2018-September/023064.html
[2] http://hg.openjdk.java.net/jdk8u/jdk8u-dev/hotspot/file/80ee2541504e/make/linux/makefiles/amd64.make#l25



More information about the jdk8u-dev mailing list