From 49c8a97fbc55478f9f3087d04fd3f9467cef7f0e Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 24 Nov 2015 15:36:32 +0100 Subject: [PATCH] 8143296: javac-server/sjavac not compatible with LogFailures on Windows Reviewed-by: ihse --- common/autoconf/basics_windows.m4 | 3 ++ common/autoconf/boot-jdk.m4 | 3 ++ common/autoconf/build-performance.m4 | 6 +++ common/autoconf/generated-configure.sh | 16 ++++++- common/autoconf/spec.gmk.in | 5 +- common/src/fixpath.c | 66 ++++++++++++++++++-------- make/InitSupport.gmk | 7 --- make/common/SetupJavaCompilers.gmk | 4 +- 8 files changed, 80 insertions(+), 30 deletions(-) diff --git a/common/autoconf/basics_windows.m4 b/common/autoconf/basics_windows.m4 index 1233c168d74..9bb7a805b3c 100644 --- a/common/autoconf/basics_windows.m4 +++ b/common/autoconf/basics_windows.m4 @@ -423,7 +423,10 @@ AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH], 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) ]) diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4 index 524103eb013..6d08223e589 100644 --- a/common/autoconf/boot-jdk.m4 +++ b/common/autoconf/boot-jdk.m4 @@ -375,6 +375,9 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], 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]) diff --git a/common/autoconf/build-performance.m4 b/common/autoconf/build-performance.m4 index e2fa4f566cf..08ab2a02b5c 100644 --- a/common/autoconf/build-performance.m4 +++ b/common/autoconf/build-performance.m4 @@ -347,4 +347,10 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC], 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 ]) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 1b278126644..4499c84f9af 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -638,6 +638,7 @@ SJAVAC_SERVER_JAVA_FLAGS SJAVAC_SERVER_JAVA JAVA_TOOL_FLAGS_SMALL JAVA_FLAGS_SMALL +JAVA_FLAGS_JAVAC JAVA_FLAGS_BIG JAVA_FLAGS JOBS @@ -679,6 +680,7 @@ MSVCP_DLL MSVCR_DLL LIBCXX STATIC_CXX_SETTING +FIXPATH_DETACH_FLAG FIXPATH GCOV_ENABLED ZIP_DEBUGINFO_FILES @@ -4610,7 +4612,7 @@ VS_SDK_PLATFORM_NAME_2013= #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,12 +45490,15 @@ $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + + FIXPATH_DETACH_FLAG="--detach" fi + # Check if X11 is needed if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then # No X11 support on windows or macosx @@ -54791,6 +54796,9 @@ $as_echo "$boot_jdk_jvmargs_big" >&6; } 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_n "checking whether to use javac server... " >&6; } $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? diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 0be7456fa2c..f6ddb488d28 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -424,6 +424,7 @@ STRIPFLAGS:=@STRIPFLAGS@ 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 @@ SJAVAC_SERVER_JAVA_CMD:=@SJAVAC_SERVER_JAVA@ # 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 ?=. diff --git a/common/src/fixpath.c b/common/src/fixpath.c index 9e8d352121a..d9dec6d74c6 100644 --- a/common/src/fixpath.c +++ b/common/src/fixpath.c @@ -358,10 +358,13 @@ int main(int argc, char const ** argv) 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 /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n"); + fprintf(stderr, "Usage: fixpath -c|m [--detach] /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n"); exit(0); } @@ -386,7 +389,22 @@ int main(int argc, char const ** argv) 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 @@ int main(int argc, char const ** argv) 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 @@ int main(int argc, char const ** argv) line, 0, 0, - TRUE, - 0, + processInheritHandles, + processFlags, NULL, NULL, &si, @@ -492,24 +514,30 @@ int main(int argc, char const ** argv) 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