8143296: javac-server/sjavac not compatible with LogFailures on Windows
authorerikj
Tue, 24 Nov 2015 15:36:32 +0100
changeset 34101 a1db3b482137
parent 34100 e3293031f83d
child 34102 c0a98357f847
8143296: javac-server/sjavac not compatible with LogFailures on Windows Reviewed-by: ihse
common/autoconf/basics_windows.m4
common/autoconf/boot-jdk.m4
common/autoconf/build-performance.m4
common/autoconf/generated-configure.sh
common/autoconf/spec.gmk.in
common/src/fixpath.c
make/InitSupport.gmk
make/common/SetupJavaCompilers.gmk
--- a/common/autoconf/basics_windows.m4	Tue Nov 24 11:25:16 2015 +0100
+++ b/common/autoconf/basics_windows.m4	Tue Nov 24 15:36:32 2015 +0100
@@ -423,7 +423,10 @@
       AC_MSG_ERROR([fixpath did not work!])
     fi
     AC_MSG_RESULT([yes])
+
+    FIXPATH_DETACH_FLAG="--detach"
   fi
 
   AC_SUBST(FIXPATH)
+  AC_SUBST(FIXPATH_DETACH_FLAG)
 ])
--- a/common/autoconf/boot-jdk.m4	Tue Nov 24 11:25:16 2015 +0100
+++ b/common/autoconf/boot-jdk.m4	Tue Nov 24 15:36:32 2015 +0100
@@ -375,6 +375,9 @@
   JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
   AC_SUBST(JAVA_FLAGS_BIG)
 
+  # By default, the main javac compilations use big
+  JAVA_FLAGS_JAVAC="$JAVA_FLAGS_BIG"
+  AC_SUBST(JAVA_FLAGS_JAVAC)
 
   AC_MSG_CHECKING([flags for boot jdk java command for small workloads])
 
--- a/common/autoconf/build-performance.m4	Tue Nov 24 11:25:16 2015 +0100
+++ b/common/autoconf/build-performance.m4	Tue Nov 24 15:36:32 2015 +0100
@@ -347,4 +347,10 @@
   AC_MSG_CHECKING([whether to use javac server])
   AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
   AC_SUBST(ENABLE_JAVAC_SERVER)
+
+  if test "x$ENABLE_JAVAC_SERVER" = "xyes" || "x$ENABLE_SJAVAC" = "xyes"; then
+    # When using a server javac, the small client instances do not need much
+    # resources.
+    JAVA_FLAGS_JAVAC="$JAVA_FLAGS_SMALL"
+  fi
 ])
--- a/common/autoconf/generated-configure.sh	Tue Nov 24 11:25:16 2015 +0100
+++ b/common/autoconf/generated-configure.sh	Tue Nov 24 15:36:32 2015 +0100
@@ -638,6 +638,7 @@
 SJAVAC_SERVER_JAVA
 JAVA_TOOL_FLAGS_SMALL
 JAVA_FLAGS_SMALL
+JAVA_FLAGS_JAVAC
 JAVA_FLAGS_BIG
 JAVA_FLAGS
 JOBS
@@ -679,6 +680,7 @@
 MSVCR_DLL
 LIBCXX
 STATIC_CXX_SETTING
+FIXPATH_DETACH_FLAG
 FIXPATH
 GCOV_ENABLED
 ZIP_DEBUGINFO_FILES
@@ -4610,7 +4612,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1446762265
+DATE_WHEN_GENERATED=1448375773
 
 ###############################################################################
 #
@@ -45488,7 +45490,10 @@
     fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-  fi
+
+    FIXPATH_DETACH_FLAG="--detach"
+  fi
+
 
 
 
@@ -54791,6 +54796,9 @@
   JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
 
 
+  # By default, the main javac compilations use big
+  JAVA_FLAGS_JAVAC="$JAVA_FLAGS_BIG"
+
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking flags for boot jdk java command for small workloads" >&5
 $as_echo_n "checking flags for boot jdk java command for small workloads... " >&6; }
@@ -54967,6 +54975,12 @@
 $as_echo "$ENABLE_JAVAC_SERVER" >&6; }
 
 
+  if test "x$ENABLE_JAVAC_SERVER" = "xyes" || "x$ENABLE_SJAVAC" = "xyes"; then
+    # When using a server javac, the small client instances do not need much
+    # resources.
+    JAVA_FLAGS_JAVAC="$JAVA_FLAGS_SMALL"
+  fi
+
 
 # Can the C/C++ compiler use precompiled headers?
 
--- a/common/autoconf/spec.gmk.in	Tue Nov 24 11:25:16 2015 +0100
+++ b/common/autoconf/spec.gmk.in	Tue Nov 24 15:36:32 2015 +0100
@@ -424,6 +424,7 @@
 JAVA_FLAGS:=@JAVA_FLAGS@
 JAVA_FLAGS_BIG:=@JAVA_FLAGS_BIG@
 JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
+JAVA_FLAGS_JAVAC:=@JAVA_FLAGS_JAVAC@
 JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@
 SJAVAC_SERVER_JAVA_FLAGS:=@SJAVAC_SERVER_JAVA_FLAGS@
 
@@ -440,13 +441,15 @@
 # it possible to override only the *_CMD variables.
 JAVA=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
 JAVA_SMALL=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
+JAVA_JAVAC=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_JAVAC) $(JAVA_FLAGS)
 JAVAC=@FIXPATH@ $(JAVAC_CMD)
 JAVAH=@FIXPATH@ $(JAVAH_CMD)
 JAR=@FIXPATH@ $(JAR_CMD)
 JARSIGNER=@FIXPATH@ $(JARSIGNER_CMD)
 # A specific java binary with specific options can be used to run
 # the long running background sjavac servers and other long running tasks.
-SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAGS)
+SJAVAC_SERVER_JAVA=@FIXPATH@ @FIXPATH_DETACH_FLAG@ $(SJAVAC_SERVER_JAVA_CMD) \
+    $(SJAVAC_SERVER_JAVA_FLAGS)
 
 # Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
 # overriding that value by using ?=.
--- a/common/src/fixpath.c	Tue Nov 24 11:25:16 2015 +0100
+++ b/common/src/fixpath.c	Tue Nov 24 15:36:32 2015 +0100
@@ -358,10 +358,13 @@
     char *line;
     char *current;
     int i, cmd;
-    DWORD exitCode;
+    DWORD exitCode = 0;
+    DWORD processFlags = 0;
+    BOOL processInheritHandles = TRUE;
+    BOOL waitForChild = TRUE;
 
     if (argc<2 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm')) {
-        fprintf(stderr, "Usage: fixpath -c|m<path@path@...> /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n");
+        fprintf(stderr, "Usage: fixpath -c|m<path@path@...> [--detach] /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n");
         exit(0);
     }
 
@@ -386,7 +389,22 @@
       exit(-1);
     }
 
-    i = 2;
+    if (argv[2][0] == '-') {
+      if (strcmp(argv[2], "--detach") == 0) {
+        if (getenv("DEBUG_FIXPATH") != NULL) {
+          fprintf(stderr, "fixpath in detached mode\n");
+        }
+        processFlags |= DETACHED_PROCESS;
+        processInheritHandles = FALSE;
+        waitForChild = FALSE;
+      } else {
+        fprintf(stderr, "fixpath Unknown argument: %s\n", argv[2]);
+        exit(-1);
+      }
+      i = 3;
+    } else {
+      i = 2;
+    }
 
     // handle assignments
     while (i < argc) {
@@ -428,6 +446,10 @@
     while (i < argc) {
       char const *replaced = replace_cygdrive(argv[i]);
       if (replaced[0] == '@') {
+        if (waitForChild == FALSE) {
+          fprintf(stderr, "fixpath Cannot use @-files in detached mode: %s\n", replaced);
+          exit(1);
+        }
         // Found at-file! Fix it!
         replaced = fix_at_file(replaced);
       }
@@ -480,8 +502,8 @@
                        line,
                        0,
                        0,
-                       TRUE,
-                       0,
+                       processInheritHandles,
+                       processFlags,
                        NULL,
                        NULL,
                        &si,
@@ -492,24 +514,30 @@
       exit(126);
     }
 
-    WaitForSingleObject(pi.hProcess, INFINITE);
-    GetExitCodeProcess(pi.hProcess, &exitCode);
+    if (waitForChild == TRUE) {
+      WaitForSingleObject(pi.hProcess, INFINITE);
+      GetExitCodeProcess(pi.hProcess, &exitCode);
 
-    if (getenv("DEBUG_FIXPATH") != NULL) {
-      for (i=0; i<num_files_to_delete; ++i) {
-        fprintf(stderr, "fixpath Not deleting temporary file %s\n",
-                files_to_delete[i]);
+      if (getenv("DEBUG_FIXPATH") != NULL) {
+        for (i=0; i<num_files_to_delete; ++i) {
+          fprintf(stderr, "fixpath Not deleting temporary file %s\n",
+                  files_to_delete[i]);
+        }
+      } else {
+        for (i=0; i<num_files_to_delete; ++i) {
+          remove(files_to_delete[i]);
+        }
+      }
+
+      if (exitCode != 0) {
+        if (getenv("DEBUG_FIXPATH") != NULL) {
+          fprintf(stderr, "fixpath exit code %d\n",
+                  exitCode);
+        }
       }
     } else {
-      for (i=0; i<num_files_to_delete; ++i) {
-        remove(files_to_delete[i]);
-      }
-    }
-
-    if (exitCode != 0) {
       if (getenv("DEBUG_FIXPATH") != NULL) {
-        fprintf(stderr, "fixpath exit code %d\n",
-                exitCode);
+        fprintf(stderr, "fixpath Not waiting for child process");
       }
     }
 
--- a/make/InitSupport.gmk	Tue Nov 24 11:25:16 2015 +0100
+++ b/make/InitSupport.gmk	Tue Nov 24 15:36:32 2015 +0100
@@ -287,13 +287,6 @@
 
   BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
 
-  # Disable the build log wrapper on sjavac+windows until
-  # we have solved how to prevent the log wrapper to wait
-  # for the background sjavac server process.
-  ifeq ($(ENABLE_SJAVAC)X$(OPENJDK_BUILD_OS),yesXwindows)
-    LOG_NOFILE := true
-  endif
-
   # Sanity check the spec file, so it matches this source code
   define CheckSpecSanity
     ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR))
--- a/make/common/SetupJavaCompilers.gmk	Tue Nov 24 11:25:16 2015 +0100
+++ b/make/common/SetupJavaCompilers.gmk	Tue Nov 24 15:36:32 2015 +0100
@@ -63,7 +63,7 @@
 # The generate new bytecode javac setup uses the new compiler to compile for the
 # new jdk. This new bytecode might only be possible to run using the new jvm.
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -source 9 -target 9 \
         -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
@@ -73,7 +73,7 @@
 # The generate new bytecode javac setup uses the new compiler to compile for the
 # new jdk. This new bytecode might only be possible to run using the new jvm.
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -source 9 -target 9 \
         -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \