提交 1751ccf4 编写于 作者: E erikj

8014514: Fix jvm args for sjavac

Reviewed-by: tbell
上级 5b01d750
......@@ -23,14 +23,23 @@
# questions.
#
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
# If so, then append $1 to $2\
# Also set JVM_ARG_OK to true/false depending on outcome.
AC_DEFUN([ADD_JVM_ARG_IF_OK],
[
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
# If so, then append $1 to $2
FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
$ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD
$ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD
OUTPUT=`$3 $1 -version 2>&1`
FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
$2="[$]$2 $1"
JVM_ARG_OK=true
else
$ECHO "Arg failed:" >&AS_MESSAGE_LOG_FD
$ECHO "$OUTPUT" >&AS_MESSAGE_LOG_FD
JVM_ARG_OK=false
fi
])
......
......@@ -278,60 +278,37 @@ else
fi
AC_SUBST(SJAVAC_SERVER_JAVA)
AC_ARG_WITH(sjavac-server-cores, [AS_HELP_STRING([--with-sjavac-server-cores],
[use at most this number of concurrent threads on the sjavac server @<:@probed@:>@])])
if test "x$with_sjavac_server_cores" != x; then
SJAVAC_SERVER_CORES="$with_sjavac_server_cores"
else
if test "$NUM_CORES" -gt 16; then
# We set this arbitrary limit because we want to limit the heap
# size of the javac server.
# In the future we will make the javac compilers in the server
# share more and more state, thus enabling us to use more and
# more concurrent threads in the server.
SJAVAC_SERVER_CORES="16"
else
SJAVAC_SERVER_CORES="$NUM_CORES"
if test "$MEMORY_SIZE" -gt "2500"; then
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
if test "$JVM_ARG_OK" = true; then
JVM_64BIT=true
JVM_ARG_OK=false
fi
fi
if test "$JVM_64BIT" = true; then
if test "$MEMORY_SIZE" -gt "17000"; then
MAX_HEAP_MEM=10000
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
ADD_JVM_ARG_IF_OK([-Xms10G -Xmx10G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
elif test "$MEMORY_SIZE" -gt "10000"; then
MAX_HEAP_MEM=6000
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
if test "$MEMORY_SIZE" -gt "10000" && test "$JVM_ARG_OK" = false; then
ADD_JVM_ARG_IF_OK([-Xms6G -Xmx6G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
elif test "$MEMORY_SIZE" -gt "5000"; then
MAX_HEAP_MEM=3000
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
if test "$MEMORY_SIZE" -gt "5000" && test "$JVM_ARG_OK" = false; then
ADD_JVM_ARG_IF_OK([-Xms1G -Xmx3G],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
elif test "$MEMORY_SIZE" -gt "3800"; then
MAX_HEAP_MEM=2500
ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
elif test "$MEMORY_SIZE" -gt "1900"; then
MAX_HEAP_MEM=1200
ADD_JVM_ARG_IF_OK([-Xms700M -Xmx1400M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
elif test "$MEMORY_SIZE" -gt "1000"; then
MAX_HEAP_MEM=900
ADD_JVM_ARG_IF_OK([-Xms400M -Xmx1100M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
else
MAX_HEAP_MEM=512
ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
MAX_COMPILERS_IN_HEAP=`expr $MAX_HEAP_MEM / 501`
if test "$SJAVAC_SERVER_CORES" -gt "$MAX_COMPILERS_IN_HEAP"; then
AC_MSG_CHECKING([if number of server cores must be reduced])
SJAVAC_SERVER_CORES="$MAX_COMPILERS_IN_HEAP"
AC_MSG_RESULT([yes, to $SJAVAC_SERVER_CORES with max heap size $MAX_HEAP_MEM MB])
if test "$MEMORY_SIZE" -gt "3800" && test "$JVM_ARG_OK" = false; then
ADD_JVM_ARG_IF_OK([-Xms1G -Xmx2500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
fi
AC_SUBST(SJAVAC_SERVER_CORES)
fi
if test "$MEMORY_SIZE" -gt "2500" && test "$JVM_ARG_OK" = false; then
ADD_JVM_ARG_IF_OK([-Xms1000M -Xmx1500M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
if test "$MEMORY_SIZE" -gt "1000" && test "$JVM_ARG_OK" = false; then
ADD_JVM_ARG_IF_OK([-Xms400M -Xmx1100M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
if test "$JVM_ARG_OK" = false; then
ADD_JVM_ARG_IF_OK([-Xms256M -Xmx512M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
fi
AC_MSG_CHECKING([whether to use sjavac])
AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册