RFR: JDK-8159047: Disable redundant build steps when creating buildjdk

Erik Joelsson erik.joelsson at oracle.com
Wed Jun 8 12:01:36 UTC 2016


Hello,

When creating the buildjdk (when cross compiling), the idea is to only 
rebuild the parts that actually need to be rebuilt for the build 
platform and reuse as much as possible from the normal build. Currently, 
the interim-langtools step is rebuilt when it shouldn't be.

The reason interim-langtools gets rebuilt is that the gensrc steps for 
those modules get rebuilt. They in turn get rebuilt because the buildjdk 
redefines the support outputdir, so for the buildjdk makefiles, it looks 
like the gensrc steps for those modules have not happened. The 
buildtools outputdir is not redefined however, so when the 
interim-langtools get rebuilt, it overwrites the old build of it.

While this is bad from an efficiency standpoint, it also causes 
intermittent failures due to a race. When building the test lib, the 
compilation of the test lib may happen at the same time as the 
interim-langtools being rebuilt for the buildjdk. This means that the 
class files being run for the interim javac compiler can be overwritten 
while they are running. The failure can look like this:

BuildTestLib.gmk:49: recipe for target '/scratch/opt/jprt/T/P1/220139.ssteuck/s/build/linux-arm64/support/test/lib/test-lib_classes/_the.BUILD_TEST_LIB_JAR_batch' failed
make[3]: Leaving directory '/scratch/opt/jprt/T/P1/220139.ssteuck/s/make/test'
make/Main.gmk:413: recipe for target 'build-test-lib' failed
Exception in thread "main" java.lang.ClassFormatError: Truncated class file
	at com.sun.tools.javac.main.CommandLine.parse(CommandLine.java:58)
	at com.sun.tools.sjavac.options.OptionHelper.traverse(OptionHelper.java:121)
	at com.sun.tools.sjavac.options.Options.parseArgs(Options.java:187)
	at com.sun.tools.sjavac.client.ClientMain.run(ClientMain.java:60)
	at com.sun.tools.sjavac.client.ClientMain.run(ClientMain.java:49)
	at com.sun.tools.sjavac.Main.go(Main.java:56)
	at com.sun.tools.sjavac.Main.main(Main.java:46)
make[3]: *** [/scratch/opt/jprt/T/P1/220139.ssteuck/s/build/linux-arm64/support/test/lib/test-lib_classes/_the.BUILD_TEST_LIB_JAR_batch] Error 1
make[2]: *** [build-test-lib] Error 1


My proposed fix for this problem is to add more guards in make/Main.gmk 
that disables the interim and gensrc targets completely when the 
buildjdk is being built.

Bug: https://bugs.openjdk.java.net/browse/JDK-8159047
Webrev: http://cr.openjdk.java.net/~erikj/8159047/webrev.01/

/Erik



More information about the build-dev mailing list