8140312: Enable new sjavac server only mode in jdk build
authorerikj
Tue, 27 Oct 2015 17:51:36 +0100
changeset 33055 3676b99f33cf
parent 33054 bcb9f5ea5761
child 33059 6de465484e43
8140312: Enable new sjavac server only mode in jdk build Reviewed-by: ihse, tbell
common/autoconf/build-performance.m4
common/autoconf/generated-configure.sh
common/autoconf/spec.gmk.in
make/common/JavaCompilation.gmk
make/common/SetupJavaCompilers.gmk
make/test/BuildTestLib.gmk
--- a/common/autoconf/build-performance.m4	Tue Oct 27 13:48:21 2015 +0100
+++ b/common/autoconf/build-performance.m4	Tue Oct 27 17:51:36 2015 +0100
@@ -328,12 +328,23 @@
 
   AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
       [use sjavac to do fast incremental compiles @<:@disabled@:>@])],
-      [ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC='no'])
+      [ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC="no"])
   if test "x$JVM_ARG_OK" = "xfalse"; then
     AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling sjavac])
-    ENABLE_SJAVAC=no;
+    ENABLE_SJAVAC="no"
   fi
   AC_MSG_CHECKING([whether to use sjavac])
   AC_MSG_RESULT([$ENABLE_SJAVAC])
   AC_SUBST(ENABLE_SJAVAC)
+
+  AC_ARG_ENABLE([javac-server], [AS_HELP_STRING([--enable-javac-server],
+      [use only the server part of sjavac for faster javac compiles @<:@disabled@:>@])],
+      [ENABLE_JAVAC_SERVER="${enableval}"], [ENABLE_JAVAC_SERVER="no"])
+  if test "x$JVM_ARG_OK" = "xfalse"; then
+    AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling javac server])
+    ENABLE_JAVAC_SERVER="no"
+  fi
+  AC_MSG_CHECKING([whether to use javac server])
+  AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
+  AC_SUBST(ENABLE_JAVAC_SERVER)
 ])
--- a/common/autoconf/generated-configure.sh	Tue Oct 27 13:48:21 2015 +0100
+++ b/common/autoconf/generated-configure.sh	Tue Oct 27 17:51:36 2015 +0100
@@ -632,6 +632,7 @@
 CFLAGS_CCACHE
 CCACHE
 USE_PRECOMPILED_HEADER
+ENABLE_JAVAC_SERVER
 ENABLE_SJAVAC
 SJAVAC_SERVER_JAVA_FLAGS
 SJAVAC_SERVER_JAVA
@@ -1117,6 +1118,7 @@
 with_boot_jdk_jvmargs
 with_sjavac_server_java
 enable_sjavac
+enable_javac_server
 enable_precompiled_headers
 enable_ccache
 with_ccache_dir
@@ -1867,6 +1869,8 @@
                           --with-freetype, disabled otherwise]
   --enable-sjavac         use sjavac to do fast incremental compiles
                           [disabled]
+  --enable-javac-server   use only the server part of sjavac for faster javac
+                          compiles [disabled]
   --disable-precompiled-headers
                           disable using precompiled headers when compiling C++
                           [enabled]
@@ -4591,7 +4595,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1445524829
+DATE_WHEN_GENERATED=1445964676
 
 ###############################################################################
 #
@@ -53515,13 +53519,13 @@
 if test "${enable_sjavac+set}" = set; then :
   enableval=$enable_sjavac; ENABLE_SJAVAC="${enableval}"
 else
-  ENABLE_SJAVAC='no'
+  ENABLE_SJAVAC="no"
 fi
 
   if test "x$JVM_ARG_OK" = "xfalse"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling sjavac" >&5
 $as_echo "$as_me: WARNING: Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling sjavac" >&2;}
-    ENABLE_SJAVAC=no;
+    ENABLE_SJAVAC="no"
   fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use sjavac" >&5
 $as_echo_n "checking whether to use sjavac... " >&6; }
@@ -53529,6 +53533,24 @@
 $as_echo "$ENABLE_SJAVAC" >&6; }
 
 
+  # Check whether --enable-javac-server was given.
+if test "${enable_javac_server+set}" = set; then :
+  enableval=$enable_javac_server; ENABLE_JAVAC_SERVER="${enableval}"
+else
+  ENABLE_JAVAC_SERVER="no"
+fi
+
+  if test "x$JVM_ARG_OK" = "xfalse"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling javac server" >&5
+$as_echo "$as_me: WARNING: Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling javac server" >&2;}
+    ENABLE_JAVAC_SERVER="no"
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use javac server" >&5
+$as_echo_n "checking whether to use javac server... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENABLE_JAVAC_SERVER" >&5
+$as_echo "$ENABLE_JAVAC_SERVER" >&6; }
+
+
 
 # Can the C/C++ compiler use precompiled headers?
 
--- a/common/autoconf/spec.gmk.in	Tue Oct 27 13:48:21 2015 +0100
+++ b/common/autoconf/spec.gmk.in	Tue Oct 27 17:51:36 2015 +0100
@@ -245,6 +245,7 @@
 # Enable sjavac support = use a javac server,
 # multi core javac compilation and dependency tracking.
 ENABLE_SJAVAC:=@ENABLE_SJAVAC@
+ENABLE_JAVAC_SERVER:=@ENABLE_JAVAC_SERVER@
 # Store sjavac server synchronization files here, and
 # the sjavac server log files.
 SJAVAC_SERVER_DIR=$(MAKESUPPORT_OUTPUTDIR)/javacservers
--- a/make/common/JavaCompilation.gmk	Tue Oct 27 13:48:21 2015 +0100
+++ b/make/common/JavaCompilation.gmk	Tue Oct 27 17:51:36 2015 +0100
@@ -59,6 +59,7 @@
 #   FLAGS:=Flags to be supplied to javac
 #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
 #   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
+#   DISABLE_SJAVAC:=Set to true if this setup does not support sjavac
 SetupJavaCompiler = $(NamedParamsMacroTemplate)
 define SetupJavaCompilerBody
   # The port file contains the tcp/ip on which the server listens
@@ -439,6 +440,7 @@
   endif
   $1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
   $1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
+  $1_DISABLE_SJAVAC := $$($$($1_SETUP)_DISABLE_SJAVAC)
 
   # Handle addons and overrides.
   $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
@@ -552,6 +554,15 @@
   # and remove .java at the end.
   $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
 
+  # Create SJAVAC variable from JAVAC variable. Expects $1_JAVAC to be
+  # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
+  # and javac is simply replaced with sjavac.
+  $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
+
+  # Set the $1_REMOTE to spawn a background javac server.
+  $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \
+      $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
+
   ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
     ifneq (,$$($1_HEADERS))
       $1_HEADERS_ARG := -h $$($1_HEADERS)
@@ -560,15 +571,6 @@
     # Using sjavac to compile.
     $1_COMPILE_TARGETS := $$($1_BIN)/_the.$1_batch
 
-    # Create SJAVAC variable form JAVAC variable. Expects $1_JAVAC to be
-    # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
-    # and javac is simply replaced with sjavac.
-    $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
-
-    # Set the $1_REMOTE to spawn a background javac server.
-    $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \
-        $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
-
     $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS) $$($1_FLAGS) \
         $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
         $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
@@ -632,13 +634,19 @@
         $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
     $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps)
 
+    ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
+      $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
+    else
+      $1_JAVAC_CMD := $$($1_JAVAC)
+    endif
+
     # When not using sjavac, pass along all sources to javac using an @file.
     $$($1_BIN)/_the.$1_batch: $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
 	$(MKDIR) -p $$(@D)
 	$$(eval $$(call ListPathsSafely,$1_SRCS, $$($1_BIN)/_the.$1_batch.tmp))
 	$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.$1_batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1
 	$(call LogFailures, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch.log, $$($1_SAFE_NAME), \
-	    $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \
+	    $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
 	        -implicit:none \
 	        -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.$1_batch.tmp) && \
 	$(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch
--- a/make/common/SetupJavaCompilers.gmk	Tue Oct 27 13:48:21 2015 +0100
+++ b/make/common/SetupJavaCompilers.gmk	Tue Oct 27 17:51:36 2015 +0100
@@ -38,7 +38,9 @@
 # and the interim javac, to be run by the boot jdk.
 $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
     JAVAC := $(JAVAC), \
-    FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror))
+    FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror, \
+    DISABLE_SJAVAC := true, \
+))
 
 # Any java code executed during a JDK build to build other parts of the JDK must be
 # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this
--- a/make/test/BuildTestLib.gmk	Tue Oct 27 13:48:21 2015 +0100
+++ b/make/test/BuildTestLib.gmk	Tue Oct 27 17:51:36 2015 +0100
@@ -39,6 +39,7 @@
 $(eval $(call SetupJavaCompiler, BOOT_JAVAC_NOWARNINGS, \
     JAVAC := $(JAVAC), \
     FLAGS := -XDignore.symbol.file=true -g, \
+    DISABLE_SJAVAC := true, \
 ))
 
 $(eval $(call SetupJavaCompilation, BUILD_WB_JAR, \