This commit is contained in:
Zhengyu Gu 2012-11-05 13:55:31 -08:00
commit 61a5a58cb1
3450 changed files with 117392 additions and 70392 deletions

View File

@ -183,3 +183,5 @@ ffe6bce5a521be40146af2ac03c509b7bac30595 jdk8-b56
3bd874584fc01aae92fbc8827e2bd04d8b6ace04 jdk8-b59
5e3adc681779037a2d33b7be6f75680619085492 jdk8-b60
cdaa6122185f9bf512dcd6600f56bfccc4824e8c jdk8-b61
8d9d430b4244b95f5cf1ebe719f834a1ac5d6cd5 jdk8-b62
21ee1dd7b809639284900a128b9b656a592ebc7a jdk8-b63

View File

@ -183,3 +183,5 @@ b85b44cced2406792cfb9baab1377ff03e7001d8 jdk8-b55
dae9821589ccd2611bdf7084269b98e819091770 jdk8-b59
e07f499b9dccb529ecf74172cf6ac11a195ec57a jdk8-b60
20ff117b509075c3aec4ee3a57990ecd5db5df9c jdk8-b61
8a3fe0ae06a8cc21347da5a18384b0aa6c2349f5 jdk8-b62
3229597524cab4239325bc3602df6c486397a511 jdk8-b63

View File

@ -31,8 +31,9 @@ CMP=cmp
CP=cp
ECHO=echo
MKDIR=mkdir
PRINTF=printf
PWD=pwd
SH=sh
TAR=tar
ifeq ($(PLATFORM),windows)
ZIP=zip
else
@ -63,10 +64,48 @@ all images clean: checks
$(ECHO) "ERROR: No configurations to build"; exit 1; \
fi
@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
$(ECHO) "$(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@" ; \
$(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@ ; \
$(ECHO) "$(CD) $${bdir} && $(MAKE) $@" ; \
$(CD) $${bdir} && $(MAKE) $@ ; \
done
# TBD: Deploy input
$(BUILD_DIR_ROOT)/.deploy_input:
@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
$(ECHO) "ERROR: No configurations to build"; exit 1; \
fi
@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
if [ deploy/make/Makefile ] ; then \
echo "Attempting deploy build." ; \
( \
$(RM) -r $${bdir}/deploy_input ; \
$(MKDIR) -p $${bdir}/deploy_input ; \
( $(CD) $${bdir}/images && $(TAR) -cf - j2sdk-image j2re-image ) \
| ( $(CD) $${bdir}/deploy_input && $(TAR) -xf - ) ; \
) ; \
fi; \
done
touch $@
# TBD: Deploy images
deploy: $(BUILD_DIR_ROOT)/.deploy_input
@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
$(ECHO) "ERROR: No configurations to build"; exit 1; \
fi
@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
if [ deploy/make/Makefile ] ; then \
echo "Attempting deploy build." ; \
( \
$(CD) deploy/make && \
$(MAKE) \
ABS_OUTPUTDIR=$${bdir}/deploy_input \
OUTPUTDIR=$${bdir}/deploy_input \
) ; \
fi; \
done
# TBD: Install bundles
install:
# Bundle creation
bundles:
@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
@ -91,8 +130,8 @@ clobber::
checks:
@$(ECHO) "No checks yet"
# Keep track of phony targets
PHONY_LIST += all images clean clobber checks
# Keep track of user targets
USER_TARGETS += all deploy install images clean clobber checks
###########################################################################
# To help in adoption of the new configure&&make build process, a bridge
@ -102,32 +141,18 @@ PHONY_LIST += all images clean clobber checks
bridgeBuild: bridge2configure images
# Bridge from old Makefile ALT settings to configure options
bridge2configure: .bridge2configureOpts
$(CD) common/makefiles && sh ../autoconf/configure $(strip $(shell $(CAT) $<))
bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
bash ./configure $(strip $(shell $(CAT) $<))
# Create a file with configure options created from old Makefile mechanisms.
.bridge2configureOpts: .bridge2configureOptsLatest
$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
$(RM) $@
$(CP) $< $@
# In case make was invoked from a specific path
_MAKE_COMMAND_PATH:=$(firstword $(MAKE))
ifneq ($(dir $(_MAKE_COMMAND_PATH)),./)
# This could be removed someday if JPRT was fixed and we could assume that
# the path to make was always in PATH.
MAKE_BINDIR:=$(call UnixPath,$(dir $(_MAKE_COMMAND_PATH)))
NEWPATH:=$(MAKE_BINDIR):${PATH}
PATH:=$(NEWPATH)
export PATH
MAKE_COMMAND=$(MAKE_BINDIR)/$(notdir $(_MAKE_COMMAND_PATH))
else
MAKE_COMMAND=$(_MAKE_COMMAND_PATH)
endif
# Use this file to only change when obvious things have changed
.bridge2configureOptsLatest: FRC
$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
$(RM) $@.tmp
@$(ECHO) " MAKE=$(MAKE_COMMAND) " >> $@.tmp
$(MKDIR) -p $(BUILD_DIR_ROOT)
@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
ifdef ARCH_DATA_MODEL
@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
@ -156,11 +181,21 @@ endif
# Clobber all the built files
clobber:: bridge2clobber
bridge2clobber::
$(RM) .bridge2*
$(RM) $(BUILD_DIR_ROOT)/.bridge2*
$(RM) $(BUILD_DIR_ROOT)/.deploy_input
# Keep track of phony targets
PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
###########################################################################
# Sanity checks (history target)
#
sanity: checks
# Keep track of user targets
USER_TARGETS += sanity
###########################################################################
# Javadocs
#
@ -168,8 +203,8 @@ PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
javadocs:
cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
# Keep track of phony targets
PHONY_LIST += javadocs
# Keep track of user targets
USER_TARGETS += javadocs
###########################################################################
# JPRT targets
@ -190,7 +225,6 @@ jprt_build_debug: DEBUG_LEVEL=slowdebug
jprt_build_debug: BUILD_DIRNAME=*-debug
jprt_build_debug: jprt_build_generic
jprt_build_generic: EXTRA_MAKE_ARGS=LOG=nofile,info
jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
$(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
@ -202,10 +236,60 @@ $(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
jprt_build_generic
###########################################################################
# Help target
HELP_FORMAT=%12s%s\n
help:
@$(PRINTF) "# JDK Makefile\n"
@$(PRINTF) "#\n"
@$(PRINTF) "# Usage: make [Target]\n"
@$(PRINTF) "#\n"
@$(PRINTF) "# $(HELP_FORMAT)" "Target " "Description"
@$(PRINTF) "# $(HELP_FORMAT)" "------ " "-----------"
@for i in $(USER_TARGETS) ; do \
$(MAKE) help_$${i} ; \
done
@$(PRINTF) "#\n"
help_all:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Build the entire jdk but not the images"
help_images:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Create the jdk images for the builds"
help_deploy:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Create the jdk deploy images from the jdk images"
help_install:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Create the jdk install bundles from the deploy images"
help_clean:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Clean and prepare for a fresh build from scratch"
help_clobber:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Clean and also purge any hidden derived data"
help_checks:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Perform various checks to make sure we can build"
help_sanity:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Same as 'make checks'"
help_javadocs:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Build the javadocs"
help_help:
@$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
"Print out the help messages"
# Keep track of user targets
USER_TARGETS += help
###########################################################################
# Phony targets
.PHONY: $(PHONY_LIST)
.PHONY: $(PHONY_LIST) $(USER_TARGETS)
# Force target
FRC:

View File

@ -21,6 +21,7 @@
# questions.
#
# Generated Makefile @DATE_WHEN_CONFIGURED@
# This Makefile was generated by configure @DATE_WHEN_CONFIGURED@
# GENERATED FILE, DO NOT EDIT
SPEC:=@OUTPUT_ROOT@/spec.gmk
include @SRC_ROOT@/common/makefiles/Makefile

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -29,14 +29,11 @@ if test "x`uname -s`" = "xSunOS"; then
# date +%s is not available on Solaris, use this workaround
# from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 | nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
# On Solaris /bin/sh doesn't support test -e but /usr/bin/test does.
TEST=`which test`
else
TIMESTAMP=`date +%s`
TEST="test"
fi
if $TEST "$CUSTOM_CONFIG_DIR" = ""; then
if test "x$CUSTOM_CONFIG_DIR" = "x"; then
custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
else
custom_script_dir=$CUSTOM_CONFIG_DIR
@ -44,16 +41,22 @@ fi
custom_hook=$custom_script_dir/custom-hook.m4
if test "x`which autoconf 2> /dev/null`" = x; then
echo You need autoconf installed to be able to regenerate the configure script
echo Error: Cannot find autoconf 1>&2
exit 1
fi
echo Generating generated-configure.sh
cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | autoconf -W all -I$script_dir - > $script_dir/generated-configure.sh
rm -rf autom4te.cache
if $TEST -e $custom_hook; then
if test -e $custom_hook; then
echo Generating custom generated-configure.sh
# We have custom sources available; also generate configure script
# with custom hooks compiled in.
cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
sed -e "s|AC_DEFUN_ONCE(\[CUSTOM_HOOK\])|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | autoconf -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
rm -rf autom4te.cache
else
echo No custom hook found: $custom_hook

View File

@ -34,84 +34,102 @@ AC_DEFUN([ADD_JVM_ARG_IF_OK],
fi
])
AC_DEFUN([SET_FULL_PATH],
# This will make sure the given variable points to a full and proper
# path. This means:
# 1) There will be no spaces in the path. On posix platforms,
# spaces in the path will result in an error. On Windows,
# the path will be rewritten using short-style to be space-free.
# 2) The path will be absolute, and it will be in unix-style (on
# cygwin).
# $1: The name of the variable to fix
AC_DEFUN([BASIC_FIXUP_PATH],
[
# Translate "gcc -E" into "`which gcc` -E" ie
# extract the full path to the binary and at the
# same time maintain any arguments passed to it.
# The command MUST exist in the path, or else!
tmp="[$]$1"
car="${tmp%% *}"
tmp="[$]$1 EOL"
cdr="${tmp#* }"
# On windows we want paths without spaces.
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
SET_FULL_PATH_SPACESAFE(car)
else
# "which" is not portable, but is used here
# because we know that the command exists!
car=`which $car`
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_PATH_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_PATH_MSYS($1)
else
# We're on a posix platform. Hooray! :)
path="[$]$1"
if test ! -f "$path" && test ! -d "$path"; then
AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
fi
if test "x$cdr" != xEOL; then
$1="$car ${cdr% *}"
else
$1="$car"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
AC_MSG_ERROR([Spaces are not allowed in this path.])
fi
fi
])
AC_DEFUN([SPACESAFE],
# This will make sure the given variable points to a executable
# with a full and proper path. This means:
# 1) There will be no spaces in the path. On posix platforms,
# spaces in the path will result in an error. On Windows,
# the path will be rewritten using short-style to be space-free.
# 2) The path will be absolute, and it will be in unix-style (on
# cygwin).
# Any arguments given to the executable is preserved.
# If the input variable does not have a directory specification, then
# it need to be in the PATH.
# $1: The name of the variable to fix
AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
[
# Fail with message $2 if var $1 contains a path with no spaces in it.
# Unless on Windows, where we can rewrite the path.
HAS_SPACE=`echo "[$]$1" | grep " "`
if test "x$HAS_SPACE" != x; then
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
# First convert it to DOS-style, short mode (no spaces)
$1=`$CYGPATH -s -m -a "[$]$1"`
# Now it's case insensitive; let's make it lowercase to improve readability
$1=`$ECHO "[$]$1" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
# Now convert it back to Unix-stile (cygpath)
$1=`$CYGPATH -u "[$]$1"`
else
AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_EXECUTABLE_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_EXECUTABLE_MSYS($1)
else
# We're on a posix platform. Hooray! :)
# First separate the path from the arguments. This will split at the first
# space.
complete="[$]$1"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
new_path=`$WHICH $path 2> /dev/null`
if test "x$new_path" = x; then
is_absolute_path=`$ECHO "$path" | $GREP ^/`
if test "x$is_absolute_path" != x; then
AC_MSG_NOTICE([Resolving $1 (as $path) with 'which' failed, using $path directly.])
new_path="$path"
else
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.])
fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
fi
fi
# Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}"
else
new_complete="$new_path"
fi
if test "x$complete" != "x$new_complete"; then
$1="$new_complete"
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
fi
])
AC_DEFUN([SET_FULL_PATH_SPACESAFE],
[
# Translate long cygdrive or C:\sdfsf path
# into a short mixed mode path that has no
# spaces in it.
tmp="[$]$1"
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
tmp=`$CYGPATH -u "[$]$1"`
tmp=`which "$tmp"`
# If file exists with .exe appended, that's the real filename
# and cygpath needs that to convert to short style path.
if test -f "${tmp}.exe"; then
tmp="${tmp}.exe"
elif test -f "${tmp}.cmd"; then
tmp="${tmp}.cmd"
fi
# Convert to C:/ mixed style path without spaces.
tmp=`$CYGPATH -s -m "$tmp"`
fi
$1="$tmp"
])
AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],
[
if test "x$OPENJDK_BUILD_OS" != xwindows; then
# Follow a chain of symbolic links. Use readlink
# where it exists, else fall back to horribly
# complicated shell code.
AC_PATH_PROG(READLINK, readlink)
if test "x$READLINK_TESTED" != yes; then
# On MacOSX there is a readlink tool with a different
# purpose than the GNU readlink tool. Check the found readlink.
ISGNU=`$READLINK --help 2>&1 | grep GNU`
ISGNU=`$READLINK --help 2>&1 | $GREP GNU`
if test "x$ISGNU" = x; then
# A readlink that we do not know how to use.
# Are there other non-GNU readlinks out there?
@ -125,23 +143,25 @@ AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
else
STARTDIR=$PWD
COUNTER=0
DIR=`dirname [$]$1`
FIL=`basename [$]$1`
sym_link_dir=`$DIRNAME [$]$1`
sym_link_file=`$BASENAME [$]$1`
while test $COUNTER -lt 20; do
ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
if test "x$ISLINK" == x; then
# This is not a symbolic link! We are done!
break
fi
# The link might be relative! We have to use cd to travel safely.
cd $DIR
cd `dirname $ISLINK`
DIR=`pwd`
FIL=`basename $ISLINK`
cd $sym_link_dir
# ... and we must get the to the absolute path, not one using symbolic links.
cd `pwd -P`
cd `$DIRNAME $ISLINK`
sym_link_dir=`$THEPWDCMD`
sym_link_file=`$BASENAME $ISLINK`
let COUNTER=COUNTER+1
done
cd $STARTDIR
$1=$DIR/$FIL
$1=$sym_link_dir/$sym_link_file
fi
fi
])
@ -152,6 +172,107 @@ AC_DEFUN_ONCE([BASIC_INIT],
AC_SUBST(CONFIGURE_COMMAND_LINE)
DATE_WHEN_CONFIGURED=`LANG=C date`
AC_SUBST(DATE_WHEN_CONFIGURED)
AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
AC_MSG_NOTICE([configure script generated at timestamp $DATE_WHEN_GENERATED.])
])
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
# $1: variable to check
# $2: executable name to print in warning (optional)
AC_DEFUN([BASIC_CHECK_NONEMPTY],
[
if test "x[$]$1" = x; then
if test "x$2" = x; then
PROG_NAME=translit($1,A-Z,a-z)
else
PROG_NAME=$2
fi
AC_MSG_NOTICE([Could not find $PROG_NAME!])
AC_MSG_ERROR([Cannot continue])
fi
])
# Does AC_PATH_PROG followed by BASIC_CHECK_NONEMPTY.
# Arguments as AC_PATH_PROG:
# $1: variable to set
# $2: executable name to look for
AC_DEFUN([BASIC_REQUIRE_PROG],
[
AC_PATH_PROGS($1, $2)
BASIC_CHECK_NONEMPTY($1, $2)
])
# Setup the most fundamental tools that relies on not much else to set up,
# but is used by much of the early bootstrap code.
AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
[
# Start with tools that do not need have cross compilation support
# and can be expected to be found in the default PATH. These tools are
# used by configure. Nor are these tools expected to be found in the
# devkit from the builddeps server either, since they are
# needed to download the devkit.
# First are all the simple required tools.
BASIC_REQUIRE_PROG(BASENAME, basename)
BASIC_REQUIRE_PROG(BASH, bash)
BASIC_REQUIRE_PROG(CAT, cat)
BASIC_REQUIRE_PROG(CHMOD, chmod)
BASIC_REQUIRE_PROG(CMP, cmp)
BASIC_REQUIRE_PROG(CP, cp)
BASIC_REQUIRE_PROG(CUT, cut)
BASIC_REQUIRE_PROG(DATE, date)
BASIC_REQUIRE_PROG(DIFF, [gdiff diff])
BASIC_REQUIRE_PROG(DIRNAME, dirname)
BASIC_REQUIRE_PROG(ECHO, echo)
BASIC_REQUIRE_PROG(EXPR, expr)
BASIC_REQUIRE_PROG(FILE, file)
BASIC_REQUIRE_PROG(FIND, find)
BASIC_REQUIRE_PROG(HEAD, head)
BASIC_REQUIRE_PROG(LN, ln)
BASIC_REQUIRE_PROG(LS, ls)
BASIC_REQUIRE_PROG(MKDIR, mkdir)
BASIC_REQUIRE_PROG(MKTEMP, mktemp)
BASIC_REQUIRE_PROG(MV, mv)
BASIC_REQUIRE_PROG(PRINTF, printf)
BASIC_REQUIRE_PROG(THEPWDCMD, pwd)
BASIC_REQUIRE_PROG(RM, rm)
BASIC_REQUIRE_PROG(SH, sh)
BASIC_REQUIRE_PROG(SORT, sort)
BASIC_REQUIRE_PROG(TAIL, tail)
BASIC_REQUIRE_PROG(TAR, tar)
BASIC_REQUIRE_PROG(TEE, tee)
BASIC_REQUIRE_PROG(TOUCH, touch)
BASIC_REQUIRE_PROG(TR, tr)
BASIC_REQUIRE_PROG(UNAME, uname)
BASIC_REQUIRE_PROG(UNIQ, uniq)
BASIC_REQUIRE_PROG(WC, wc)
BASIC_REQUIRE_PROG(WHICH, which)
BASIC_REQUIRE_PROG(XARGS, xargs)
# Then required tools that require some special treatment.
AC_PROG_AWK
BASIC_CHECK_NONEMPTY(AWK)
AC_PROG_GREP
BASIC_CHECK_NONEMPTY(GREP)
AC_PROG_EGREP
BASIC_CHECK_NONEMPTY(EGREP)
AC_PROG_FGREP
BASIC_CHECK_NONEMPTY(FGREP)
AC_PROG_SED
BASIC_CHECK_NONEMPTY(SED)
AC_PATH_PROGS(NAWK, [nawk gawk awk])
BASIC_CHECK_NONEMPTY(NAWK)
# Always force rm.
RM="$RM -f"
# These are not required on all platforms
AC_PATH_PROG(CYGPATH, cygpath)
AC_PATH_PROG(READLINK, readlink)
AC_PATH_PROG(DF, df)
AC_PATH_PROG(SETFILE, SetFile)
])
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
@ -159,46 +280,37 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
[
# Locate the directory of this script.
SCRIPT="[$]0"
REMOVE_SYMBOLIC_LINKS(SCRIPT)
AUTOCONF_DIR=`dirname [$]0`
BASIC_REMOVE_SYMBOLIC_LINKS(SCRIPT)
AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD`
# Where is the source? It is located two levels above the configure script.
CURDIR="$PWD"
cd "$AUTOCONF_DIR/../.."
SRC_ROOT="`pwd`"
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
SRC_ROOT_LENGTH=`pwd|wc -m`
if test $SRC_ROOT_LENGTH -gt 100; then
AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
fi
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
PATH_SEP=";"
BASIC_CHECK_PATHS_WINDOWS
else
PATH_SEP=":"
fi
AC_SUBST(SRC_ROOT)
AC_SUBST(PATH_SEP)
cd "$CURDIR"
SPACESAFE(SRC_ROOT,[the path to the source root])
SPACESAFE(CURDIR,[the path to the current directory])
BASIC_FIXUP_PATH(SRC_ROOT)
BASIC_FIXUP_PATH(CURDIR)
if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
# Add extra search paths on solaris for utilities like ar and as etc...
PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
fi
# For cygwin we need cygpath first, since it is used everywhere.
AC_PATH_PROG(CYGPATH, cygpath)
PATH_SEP=":"
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
if test "x$CYGPATH" = x; then
AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
fi
PATH_SEP=";"
fi
AC_SUBST(PATH_SEP)
# You can force the sys-root if the sys-root encoded into the cross compiler tools
# is not correct.
AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
[pass this sys-root to the compilers and linker (useful if the sys-root encoded in
the cross compiler tools is incorrect)])])
[pass this sys-root to the compilers and tools (for cross-compiling)])])
if test "x$with_sys_root" != x; then
SYS_ROOT=$with_sys_root
@ -208,7 +320,7 @@ fi
AC_SUBST(SYS_ROOT)
AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
[search this directory for (cross-compiling) compilers and tools])], [TOOLS_DIR=$with_tools_dir])
[search this directory for compilers and tools (for cross-compiling)])], [TOOLS_DIR=$with_tools_dir])
AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
[use this directory as base for tools-dir and sys-root (for cross-compiling)])],
@ -229,7 +341,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
[
AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
[use this as the name of the configuration, overriding the generated default])],
[use this as the name of the configuration @<:@generated from important configuration options@:>@])],
[ CONF_NAME=${with_conf_name} ])
# Test from where we are running configure, in or outside of src root.
@ -240,7 +352,7 @@ if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || te
CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
fi
OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
mkdir -p "$OUTPUT_ROOT"
$MKDIR -p "$OUTPUT_ROOT"
if test ! -d "$OUTPUT_ROOT"; then
AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
fi
@ -253,9 +365,34 @@ else
CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
fi
OUTPUT_ROOT="$CURDIR"
fi
SPACESAFE(OUTPUT_ROOT,[the path to the output root])
# WARNING: This might be a bad thing to do. You need to be sure you want to
# have a configuration in this directory. Do some sanity checks!
if test ! -e "$OUTPUT_ROOT/spec.gmk"; then
# If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
# other files
files_present=`$LS $OUTPUT_ROOT`
# Configure has already touched config.log and confdefs.h in the current dir when this check
# is performed.
filtered_files=`$ECHO "$files_present" | $SED -e 's/config.log//g' -e 's/confdefs.h//g' -e 's/ //g' \
| $TR -d '\n'`
if test "x$filtered_files" != x; then
AC_MSG_NOTICE([Current directory is $CURDIR.])
AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could])
AC_MSG_NOTICE([seriously mess up just about everything.])
AC_MSG_NOTICE([Try 'cd $SRC_ROOT' and restart configure])
AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
AC_MSG_ERROR([Will not continue creating configuration in $CURDIR])
fi
fi
fi
AC_MSG_CHECKING([what configuration name to use])
AC_MSG_RESULT([$CONF_NAME])
BASIC_FIXUP_PATH(OUTPUT_ROOT)
AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
AC_SUBST(CONF_NAME, $CONF_NAME)
@ -287,7 +424,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_LOGGING],
# Setup default logging of stdout and stderr to build.log in the output root.
BUILD_LOG='$(OUTPUT_ROOT)/build.log'
BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old'
BUILD_LOG_WRAPPER='$(SH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
BUILD_LOG_WRAPPER='$(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
AC_SUBST(BUILD_LOG)
AC_SUBST(BUILD_LOG_PREVIOUS)
AC_SUBST(BUILD_LOG_WRAPPER)
@ -305,7 +442,6 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
DESCRIPTION="$2"
if test "x$MAKE_CANDIDATE" != x; then
AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION])
SET_FULL_PATH(MAKE_CANDIDATE)
MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
if test "x$IS_GNU_MAKE" = x; then
@ -315,7 +451,26 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
if test "x$IS_MODERN_MAKE" = x; then
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
else
FOUND_MAKE=$MAKE_CANDIDATE
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
MAKE_EXPECTED_ENV='cygwin'
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
MAKE_EXPECTED_ENV='msys'
else
AC_MSG_ERROR([Unknown Windows environment])
fi
MAKE_BUILT_FOR=`$MAKE_CANDIDATE --version | $GREP -i 'built for'`
IS_MAKE_CORRECT_ENV=`$ECHO $MAKE_BUILT_FOR | $GREP $MAKE_EXPECTED_ENV`
else
# Not relevant for non-Windows
IS_MAKE_CORRECT_ENV=true
fi
if test "x$IS_MAKE_CORRECT_ENV" = x; then
AC_MSG_NOTICE([Found GNU make version $MAKE_VERSION_STRING at $MAKE_CANDIDATE, but it is not for $MAKE_EXPECTED_ENV (it says: $MAKE_BUILT_FOR). Ignoring.])
else
FOUND_MAKE=$MAKE_CANDIDATE
BASIC_FIXUP_EXECUTABLE(FOUND_MAKE)
fi
fi
fi
fi
@ -330,7 +485,7 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE],
if test ! -f "$MAKE"; then
AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not found.])
fi
BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=])
BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE])
if test "x$FOUND_MAKE" = x; then
AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make 3.81 or newer.])
fi
@ -375,7 +530,7 @@ AC_DEFUN([BASIC_CHECK_FIND_DELETE],
AC_MSG_CHECKING([if find supports -delete])
FIND_DELETE="-delete"
DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
DELETEDIR=`$MKTEMP -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
@ -389,102 +544,22 @@ AC_DEFUN([BASIC_CHECK_FIND_DELETE],
AC_MSG_RESULT([yes])
fi
rmdir $DELETEDIR
AC_SUBST(FIND_DELETE)
])
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
# $1: variable to check
# $2: executable name to print in warning (optional)
AC_DEFUN([CHECK_NONEMPTY],
AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
[
if test "x[$]$1" = x; then
if test "x$2" = x; then
PROG_NAME=translit($1,A-Z,a-z)
else
PROG_NAME=$2
fi
AC_MSG_NOTICE([Could not find $PROG_NAME!])
AC_MSG_ERROR([Cannot continue])
fi
])
# Does AC_PATH_PROG followed by CHECK_NONEMPTY.
# Arguments as AC_PATH_PROG:
# $1: variable to set
# $2: executable name to look for
AC_DEFUN([BASIC_REQUIRE_PROG],
[
AC_PATH_PROGS($1, $2)
CHECK_NONEMPTY($1, $2)
])
AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
[
# Start with tools that do not need have cross compilation support
# and can be expected to be found in the default PATH. These tools are
# used by configure. Nor are these tools expected to be found in the
# devkit from the builddeps server either, since they are
# needed to download the devkit.
# First are all the simple required tools.
BASIC_REQUIRE_PROG(BASENAME, basename)
BASIC_REQUIRE_PROG(CAT, cat)
BASIC_REQUIRE_PROG(CHMOD, chmod)
BASIC_REQUIRE_PROG(CMP, cmp)
BASIC_REQUIRE_PROG(CP, cp)
BASIC_REQUIRE_PROG(CPIO, cpio)
BASIC_REQUIRE_PROG(CUT, cut)
BASIC_REQUIRE_PROG(DATE, date)
BASIC_REQUIRE_PROG(DF, df)
BASIC_REQUIRE_PROG(DIFF, [gdiff diff])
BASIC_REQUIRE_PROG(ECHO, echo)
BASIC_REQUIRE_PROG(EXPR, expr)
BASIC_REQUIRE_PROG(FILE, file)
BASIC_REQUIRE_PROG(FIND, find)
BASIC_REQUIRE_PROG(HEAD, head)
BASIC_REQUIRE_PROG(LN, ln)
BASIC_REQUIRE_PROG(LS, ls)
BASIC_REQUIRE_PROG(MKDIR, mkdir)
BASIC_REQUIRE_PROG(MV, mv)
BASIC_REQUIRE_PROG(PRINTF, printf)
BASIC_REQUIRE_PROG(SH, sh)
BASIC_REQUIRE_PROG(SORT, sort)
BASIC_REQUIRE_PROG(TAIL, tail)
BASIC_REQUIRE_PROG(TAR, tar)
BASIC_REQUIRE_PROG(TEE, tee)
BASIC_REQUIRE_PROG(TOUCH, touch)
BASIC_REQUIRE_PROG(TR, tr)
BASIC_REQUIRE_PROG(UNIQ, uniq)
BASIC_REQUIRE_PROG(UNZIP, unzip)
BASIC_REQUIRE_PROG(WC, wc)
BASIC_REQUIRE_PROG(XARGS, xargs)
BASIC_REQUIRE_PROG(ZIP, zip)
# Then required tools that require some special treatment.
AC_PROG_AWK
CHECK_NONEMPTY(AWK)
AC_PROG_GREP
CHECK_NONEMPTY(GREP)
AC_PROG_EGREP
CHECK_NONEMPTY(EGREP)
AC_PROG_FGREP
CHECK_NONEMPTY(FGREP)
AC_PROG_SED
CHECK_NONEMPTY(SED)
AC_PATH_PROGS(NAWK, [nawk gawk awk])
CHECK_NONEMPTY(NAWK)
BASIC_CHECK_GNU_MAKE
BASIC_REQUIRE_PROG(RM, rm)
RM="$RM -f"
BASIC_CHECK_FIND_DELETE
AC_SUBST(FIND_DELETE)
# These tools might not be installed by default,
# need hint on how to install them.
BASIC_REQUIRE_PROG(UNZIP, unzip)
BASIC_REQUIRE_PROG(ZIP, zip)
# Non-required basic tools
AC_PATH_PROG(THEPWDCMD, pwd)
AC_PATH_PROG(LDD, ldd)
if test "x$LDD" = "x"; then
# List shared lib dependencies is used for
@ -497,52 +572,17 @@ if test "x$OTOOL" = "x"; then
OTOOL="true"
fi
AC_PATH_PROGS(READELF, [readelf greadelf])
AC_PATH_PROGS(OBJDUMP, [objdump gobjdump])
AC_PATH_PROG(HG, hg)
])
AC_PATH_PROG(STAT, stat)
AC_PATH_PROG(TIME, time)
AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE],
[
# When using cygwin, we need a wrapper binary that renames
# /cygdrive/c/ arguments into c:/ arguments and peeks into
# @files and rewrites these too! This wrapper binary is
# called uncygdrive.exe.
UNCYGDRIVE=
if test "x$OPENJDK_BUILD_OS" = xwindows; then
AC_MSG_CHECKING([if uncygdrive can be created])
UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c`
rm -f $OUTPUT_ROOT/uncygdrive*
UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe`
cd $OUTPUT_ROOT
$CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1
cd $CURDIR
if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then
AC_MSG_RESULT([no])
cat $OUTPUT_ROOT/uncygdrive1.log
AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
fi
AC_MSG_RESULT([$UNCYGDRIVE])
AC_MSG_CHECKING([if uncygdrive.exe works])
cd $OUTPUT_ROOT
$UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1
cd $CURDIR
if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then
AC_MSG_RESULT([no])
cat $OUTPUT_ROOT/uncygdrive2.log
AC_MSG_ERROR([Uncygdrive did not work!])
fi
AC_MSG_RESULT([yes])
rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
# The path to uncygdrive to use should be Unix-style
UNCYGDRIVE="$OUTPUT_ROOT/uncygdrive.exe"
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
BASIC_REQUIRE_PROG(COMM, comm)
fi
AC_SUBST(UNCYGDRIVE)
])
# Check if build directory is on local disk.
# Check if build directory is on local disk. If not possible to determine,
# we prefer to claim it's local.
# Argument 1: directory to test
# Argument 2: what to do if it is on local disk
# Argument 3: what to do otherwise (remote disk or failure)
@ -550,11 +590,26 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
[
# df -l lists only local disks; if the given directory is not found then
# a non-zero exit code is given
if $DF -l $1 > /dev/null 2>&1; then
$2
else
$3
fi
if test "x$DF" = x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
# msys does not have df; use Windows "net use" instead.
IS_NETWORK_DISK=`net use | grep \`pwd -W | cut -d ":" -f 1 | tr a-z A-Z\`:`
if test "x$IS_NETWORK_DISK" = x; then
$2
else
$3
fi
else
# No df here, say it's local
$2
fi
else
if $DF -l $1 > /dev/null 2>&1; then
$2
else
$3
fi
fi
])
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],

View File

@ -0,0 +1,420 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_UNIX_PATH],
[
windows_path="[$]$1"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
$1="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
$1="$unix_path"
fi
])
AC_DEFUN([BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH],
[
unix_path="[$]$1"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
windows_path=`$CYGPATH -m "$unix_path"`
$1="$windows_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
windows_path=`cmd //c echo $unix_path`
$1="$windows_path"
fi
])
# Helper function which possibly converts a path using DOS-style short mode.
# If so, the updated path is stored in $new_path.
# $1: The path to check
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN],
[
input_path="$1"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
shortmode_path=`$CYGPATH -s -m -a "$input_path"`
path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
# Going to short mode and back again did indeed matter. Since short mode is
# case insensitive, let's make it lowercase to improve readability.
shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Now convert it back to Unix-stile (cygpath)
input_path=`$CYGPATH -u "$shortmode_path"`
new_path="$input_path"
fi
fi
test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
if test "x$test_cygdrive_prefix" = x; then
# As a simple fix, exclude /usr/bin since it's not a real path.
if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then
# The path is in a Cygwin special directory (e.g. /home). We need this converted to
# a path prefixed by /cygdrive for fixpath to work.
new_path="$CYGWIN_ROOT_PATH$input_path"
fi
fi
])
# Helper function which possibly converts a path using DOS-style short mode.
# If so, the updated path is stored in $new_path.
# $1: The path to check
AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS],
[
input_path="$1"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-_/:a-zA-Z0-9@:>@`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
fi
])
# FIXME: The BASIC_FIXUP_*_CYGWIN/MSYS is most likely too convoluted
# and could probably be heavily simplified. However, all changes in this
# area tend to need lot of testing in different scenarios, and in lack of
# proper unit testing, cleaning this up has not been deemed worth the effort
# at the moment.
AC_DEFUN([BASIC_FIXUP_PATH_CYGWIN],
[
# Input might be given as Windows format, start by converting to
# unix format.
path="[$]$1"
new_path=`$CYGPATH -u "$path"`
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
# "foo.exe" is OK but "foo" is an error.
#
# This test is therefore slightly more accurate than "test -f" to check for file precense.
# It is also a way to make sure we got the proper file name for the real test later on.
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
if test "x$test_shortpath" = x; then
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
# Call helper function which possibly converts this using DOS-style short mode.
# If so, the updated path is stored in $new_path.
BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$new_path])
if test "x$path" != "x$new_path"; then
$1="$new_path"
AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
fi
])
AC_DEFUN([BASIC_FIXUP_PATH_MSYS],
[
path="[$]$1"
has_colon=`$ECHO $path | $GREP ^.:`
new_path="$path"
if test "x$has_colon" = x; then
# Not in mixed or Windows style, start by that.
new_path=`cmd //c echo $path`
fi
BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
if test "x$path" != "x$new_path"; then
$1="$new_path"
AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
fi
# Save the first 10 bytes of this path to the storage, so fixpath can work.
all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
])
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_CYGWIN],
[
# First separate the path from the arguments. This will split at the first
# space.
complete="[$]$1"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
# Input might be given as Windows format, start by converting to
# unix format.
new_path=`$CYGPATH -u "$path"`
# Now try to locate executable using which
new_path=`$WHICH "$new_path" 2> /dev/null`
# bat and cmd files are not always considered executable in cygwin causing which
# to not find them
if test "x$new_path" = x \
&& test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
new_path=`$CYGPATH -u "$path"`
fi
if test "x$new_path" = x; then
# Oops. Which didn't find the executable.
# The splitting of arguments from the executable at a space might have been incorrect,
# since paths with space are more likely in Windows. Give it another try with the whole
# argument.
path="$complete"
arguments="EOL"
new_path=`$CYGPATH -u "$path"`
new_path=`$WHICH "$new_path" 2> /dev/null`
# bat and cmd files are not always considered executable in cygwin causing which
# to not find them
if test "x$new_path" = x \
&& test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
new_path=`$CYGPATH -u "$path"`
fi
if test "x$new_path" = x; then
# It's still not found. Now this is an unrecoverable error.
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
fi
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
# "foo.exe" is OK but "foo" is an error.
#
# This test is therefore slightly more accurate than "test -f" to check for file precense.
# It is also a way to make sure we got the proper file name for the real test later on.
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
if test "x$test_shortpath" = x; then
# Short path failed, file does not exist as specified.
# Try adding .exe or .cmd
if test -f "${new_path}.exe"; then
input_to_shortpath="${new_path}.exe"
elif test -f "${new_path}.cmd"; then
input_to_shortpath="${new_path}.cmd"
else
AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.])
AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found])
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
else
input_to_shortpath="$new_path"
fi
# Call helper function which possibly converts this using DOS-style short mode.
# If so, the updated path is stored in $new_path.
new_path="$input_to_shortpath"
BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$input_to_shortpath])
# remove trailing .exe if any
new_path="${new_path/%.exe/}"
])
AC_DEFUN([BASIC_FIXUP_EXECUTABLE_MSYS],
[
# First separate the path from the arguments. This will split at the first
# space.
complete="[$]$1"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
# Input might be given as Windows format, start by converting to
# unix format.
new_path="$path"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
# Now try to locate executable using which
new_path=`$WHICH "$new_path" 2> /dev/null`
if test "x$new_path" = x; then
# Oops. Which didn't find the executable.
# The splitting of arguments from the executable at a space might have been incorrect,
# since paths with space are more likely in Windows. Give it another try with the whole
# argument.
path="$complete"
arguments="EOL"
new_path="$path"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
new_path=`$WHICH "$new_path" 2> /dev/null`
if test "x$new_path" = x; then
# It's still not found. Now this is an unrecoverable error.
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
fi
# Now new_path has a complete unix path to the binary
if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
# Keep paths in /bin as-is, but remove trailing .exe if any
new_path="${new_path/%.exe/}"
# Do not save /bin paths to all_fixpath_prefixes!
else
# Not in mixed or Windows style, start by that.
new_path=`cmd //c echo $new_path`
BASIC_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
# Output is in $new_path
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(new_path)
# remove trailing .exe if any
new_path="${new_path/%.exe/}"
# Save the first 10 bytes of this path to the storage, so fixpath can work.
all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
fi
])
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
[
SRC_ROOT_LENGTH=`$THEPWDCMD|$WC -m`
if test $SRC_ROOT_LENGTH -gt 100; then
AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
fi
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
AC_MSG_CHECKING([cygwin release])
CYGWIN_VERSION=`$UNAME -r`
AC_MSG_RESULT([$CYGWIN_VERSION])
WINDOWS_ENV_VENDOR='cygwin'
WINDOWS_ENV_VERSION="$CYGWIN_VERSION"
CYGWIN_VERSION_OK=`$ECHO $CYGWIN_VERSION | $GREP ^1.7.`
if test "x$CYGWIN_VERSION_OK" = x; then
AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_VERSION, but at least cygwin 1.7 is required. Please upgrade.])
AC_MSG_ERROR([Cannot continue])
fi
if test "x$CYGPATH" = x; then
AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
fi
AC_MSG_CHECKING([cygwin root directory as unix-style path])
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
# Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH"
test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/`
if test "x$test_cygdrive_prefix" = x; then
AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.])
fi
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
AC_MSG_CHECKING([msys release])
MSYS_VERSION=`$UNAME -r`
AC_MSG_RESULT([$MSYS_VERSION])
WINDOWS_ENV_VENDOR='msys'
WINDOWS_ENV_VERSION="$MSYS_VERSION"
AC_MSG_CHECKING([msys root directory as unix-style path])
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
AC_MSG_RESULT([$MSYS_ROOT_PATH])
WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
else
AC_MSG_ERROR([Unknown Windows environment. Neither cygwin nor msys was detected.])
fi
# Test if windows or unix (cygwin/msys) find is first in path.
AC_MSG_CHECKING([what kind of 'find' is first on the PATH])
FIND_BINARY_OUTPUT=`find --version 2>&1`
if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then
AC_MSG_RESULT([unix style])
elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then
AC_MSG_RESULT([Windows])
AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools.])
AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.])
AC_MSG_ERROR([Cannot continue])
else
AC_MSG_RESULT([unknown])
AC_MSG_WARN([It seems that your find utility is non-standard.])
fi
])
AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
[
# When using cygwin or msys, we need a wrapper binary that renames
# /cygdrive/c/ arguments into c:/ arguments and peeks into
# @files and rewrites these too! This wrapper binary is
# called fixpath.
FIXPATH=
if test "x$OPENJDK_BUILD_OS" = xwindows; then
AC_MSG_CHECKING([if fixpath can be created])
FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
# Important to keep the .exe suffix on Cygwin for Hotspot makefiles
FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
# Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
# @ was chosen as separator to minimize risk of other tools messing around with it
all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
fi
rm -f $OUTPUT_ROOT/fixpath*
cd $OUTPUT_ROOT
$CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
cd $CURDIR
if test ! -x $OUTPUT_ROOT/fixpath.exe; then
AC_MSG_RESULT([no])
cat $OUTPUT_ROOT/fixpath1.log
AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe])
fi
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if fixpath.exe works])
cd $OUTPUT_ROOT
$FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
cd $CURDIR
if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
AC_MSG_RESULT([no])
cat $OUTPUT_ROOT/fixpath2.log
AC_MSG_ERROR([fixpath did not work!])
fi
AC_MSG_RESULT([yes])
rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
fi
AC_SUBST(FIXPATH)
])

View File

@ -62,9 +62,12 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
else
# We're done! :-)
BOOT_JDK_FOUND=yes
SPACESAFE(BOOT_JDK,[the path to the Boot JDK])
BASIC_FIXUP_PATH(BOOT_JDK)
AC_MSG_CHECKING([for Boot JDK])
AC_MSG_RESULT([$BOOT_JDK ($BOOT_JDK_VERSION)])
AC_MSG_RESULT([$BOOT_JDK])
AC_MSG_CHECKING([Boot JDK version])
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
AC_MSG_RESULT([$BOOT_JDK_VERSION])
fi # end check jdk version
fi # end check rt.jar
fi # end check javac
@ -93,12 +96,8 @@ AC_DEFUN([BOOTJDK_CHECK_BUILDDEPS],
AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
[
if test "x$JAVA_HOME" != x; then
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# On Windows, JAVA_HOME is likely in DOS-style
JAVA_HOME_PROCESSED="`$CYGPATH -u "$JAVA_HOME"`"
else
JAVA_HOME_PROCESSED="$JAVA_HOME"
fi
JAVA_HOME_PROCESSED="$JAVA_HOME"
BASIC_FIXUP_PATH(JAVA_HOME_PROCESSED)
if test ! -d "$JAVA_HOME_PROCESSED"; then
AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
else
@ -125,8 +124,7 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
# Lets find the JDK/JRE directory by following symbolic links.
# Linux/GNU systems often have links from /usr/bin/java to
# /etc/alternatives/java to the real JDK binary.
SET_FULL_PATH_SPACESAFE(BINARY)
REMOVE_SYMBOLIC_LINKS(BINARY)
BASIC_REMOVE_SYMBOLIC_LINKS(BINARY)
BOOT_JDK=`dirname "$BINARY"`
BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
@ -155,13 +153,17 @@ AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
[
BOOT_JDK_PREFIX="$1"
BOOT_JDK_SUFFIX="$2"
BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
if test "x$BEST_JDK_FOUND" != x; then
BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
if test -d "$BOOT_JDK"; then
BOOT_JDK_FOUND=maybe
AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)])
fi
ALL_JDKS_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $SORT -r`
if test "x$ALL_JDKS_FOUND" != x; then
for JDK_TO_TRY in $ALL_JDKS_FOUND ; do
BOOTJDK_DO_CHECK([
BOOT_JDK="${BOOT_JDK_PREFIX}/${JDK_TO_TRY}${BOOT_JDK_SUFFIX}"
if test -d "$BOOT_JDK"; then
BOOT_JDK_FOUND=maybe
AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX/$JDK_TO_TRY)])
fi
])
done
fi
])
@ -171,7 +173,9 @@ AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
[
if test "x[$]$1" != x; then
BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([`$CYGPATH -u "[$]$1"`/Java])
VIRTUAL_DIR="[$]$1/Java"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VIRTUAL_DIR)
BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR)
fi
])
@ -187,6 +191,8 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])])
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])])
elif test "x$OPENJDK_TARGET_OS" = xlinux; then
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/usr/lib/jvm])])
fi
])

View File

@ -48,6 +48,9 @@ fi
# Test and fix cygwin on x86_64
echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null
if test $? != 0; then
echo $OUT | grep 86-pc-mingw > /dev/null 2> /dev/null
fi
if test $? = 0; then
case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in
intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)

View File

@ -41,6 +41,10 @@ AC_DEFUN([BPERF_CHECK_CORES],
# Looks like a MacOSX system
NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print [$]5}'`
FOUND_CORES=yes
elif test -n "$NUMBER_OF_PROCESSORS"; then
# On windows, look in the env
NUM_CORES=$NUMBER_OF_PROCESSORS
FOUND_CORES=yes
fi
# For c/c++ code we run twice as many concurrent build
@ -50,7 +54,8 @@ AC_DEFUN([BPERF_CHECK_CORES],
if test "x$FOUND_CORES" = xyes; then
AC_MSG_RESULT([$NUM_CORES])
else
AC_MSG_RESULT([could not detect number of cores, defaulting to 1!])
AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
AC_MSG_WARN([This will disable all parallelism from build!])
fi
])
@ -76,16 +81,18 @@ AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print [$]2}'`
MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
FOUND_MEM=yes
elif test "x$build_os" = xwindows; then
elif test "x$OPENJDK_BUILD_OS" = xwindows; then
# Windows, but without cygwin
MEMORY_SIZE=`systeminfo | grep 'Total Physical Memory:' | awk '{ print [$]4 }' | sed 's/,//'`
MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
FOUND_MEM=yes
fi
if test "x$FOUND_MEM" = xyes; then
AC_MSG_RESULT([$MEMORY_SIZE MB])
else
AC_MSG_RESULT([could not detect memory size defaulting to 1024 MB!])
AC_MSG_RESULT([could not detect memory size, defaulting to 1024 MB])
AC_MSG_WARN([This might seriously impact build performance!])
fi
])
@ -123,7 +130,7 @@ AC_DEFUN([BPERF_SETUP_CCACHE],
[
AC_ARG_ENABLE([ccache],
[AS_HELP_STRING([--disable-ccache],
[use ccache to speed up recompilations @<:@enabled@:>@])],
[disable using ccache to speed up recompilations @<:@enabled@:>@])],
[ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
if test "x$ENABLE_CCACHE" = xyes; then
AC_PATH_PROG(CCACHE, ccache)
@ -196,7 +203,7 @@ AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
# Can the C/C++ compiler use precompiled headers?
#
AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
[use precompiled headers when compiling C++ @<:@enabled@:>@])],
[disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
[ENABLE_PRECOMPH=${enable_precompiled-headers}], [ENABLE_PRECOMPH=yes])
USE_PRECOMPILED_HEADER=1
@ -228,8 +235,7 @@ AC_SUBST(USE_PRECOMPILED_HEADER)
AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
[
AC_ARG_WITH(sjavac-server-java, [AS_HELP_STRING([--with-sjavac-server-java],
[use this java binary for running the sjavac background server and other long running java tasks in the build process,
e.g. ---with-sjavac-server-java="/opt/jrockit/bin/java -server"])])
[use this java binary for running the sjavac background server @<:@Boot JDK java@:>@])])
if test "x$with_sjavac_server_java" != x; then
SJAVAC_SERVER_JAVA="$with_sjavac_server_java"

View File

@ -235,26 +235,13 @@ AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf],
[use this configuration file for the builddeps])])
AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server],
[download and use build dependencies from this server url, e.g. --with-builddeps-server=ftp://example.com/dir])])
[download and use build dependencies from this server url])])
AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir],
[store downloaded build dependencies here @<:@d/localhome/builddeps@:>@])],
[store downloaded build dependencies here @<:@/localhome/builddeps@:>@])],
[],
[with_builddeps_dir=/localhome/builddeps])
AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group],
[chgrp the downloaded build dependencies to this group])])
AC_ARG_ENABLE([list-builddeps], [AS_HELP_STRING([--enable-list-builddeps],
[list all build dependencies known to the configure script])],
[LIST_BUILDDEPS="${enableval}"], [LIST_BUILDDEPS='no'])
if test "x$LIST_BUILDDEPS" = xyes; then
echo
echo List of build dependencies known to the configure script,
echo that can be used in builddeps.conf files:
cat $AUTOCONF_DIR/*.ac $AUTOCONF_DIR/*.m4 | grep BDEPS_CHECK_MODUL[E]\( | cut -f 2 -d ',' | tr -d ' ' | sort
echo
exit 1
fi
])

View File

@ -26,3 +26,7 @@ PRODUCT_NAME="Java(TM)"
PRODUCT_SUFFIX="SE Runtime Environment"
JDK_RC_PLATFORM_NAME="Platform SE"
COMPANY_NAME="Oracle Corporation"
# Might need better names for these
MACOSX_BUNDLE_NAME_BASE="Java SE"
MACOSX_BUNDLE_ID_BASE="com.oracle.java"

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,32 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
if test "x$BASH_VERSION" = x; then
echo This script needs bash to run.
echo It is recommended to use the configure script in the source tree root instead.
exit 1
fi
CONFIGURE_COMMAND_LINE="$@"
conf_script_dir=`dirname $0`
@ -13,58 +41,81 @@ fi
### Test that the generated configure is up-to-date
###
# On Solaris /bin/sh doesn't support test -nt but /usr/bin/test does.
TEST=`which test`
print_error_not_up_to_date() {
echo "Error: The configure source files is newer than the generated files."
echo "Please run 'sh autogen.sh' to update the generated files."
echo "Note that this test might trigger incorrectly sometimes due to hg timestamps".
run_autogen_or_fail() {
if test "x`which autoconf 2> /dev/null`" = x; then
echo "Cannot locate autoconf, unable to correct situation."
echo "Please install autoconf and run 'bash autogen.sh' to update the generated files."
echo "Error: Cannot continue" 1>&2
exit 1
else
echo "Running autogen.sh to correct the situation"
bash $conf_script_dir/autogen.sh
fi
}
# NOTE: This test can occasionally go wrong due to the way mercurial handles
# timestamps. It it supposed to aid during development of build-infra, but should
# go away before making this the default build system.
for file in configure.ac *.m4 ; do
if $TEST $file -nt generated-configure.sh; then
print_error_not_up_to_date
exit 1
fi
done
if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
# If custom source configure is available, make sure it is up-to-date as well.
for file in configure.ac *.m4 $conf_custom_script_dir/*.m4; do
if $TEST $file -nt $conf_custom_script_dir/generated-configure.sh; then
print_error_not_up_to_date
exit 1
check_autoconf_timestamps() {
for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 ; do
if test $file -nt $conf_script_dir/generated-configure.sh; then
echo "Warning: The configure source files is newer than the generated files."
run_autogen_or_fail
fi
done
if test -e $conf_custom_script_dir/generated-configure.sh; then
# If custom source configure is available, make sure it is up-to-date as well.
for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $conf_custom_script_dir/*.m4; do
if test $file -nt $conf_custom_script_dir/generated-configure.sh; then
echo "Warning: The configure source files is newer than the custom generated files."
run_autogen_or_fail
fi
done
fi
}
check_hg_updates() {
if test "x`which hg 2> /dev/null`" != x; then
conf_updated_autoconf_files=`cd $conf_script_dir && hg status -mard 2> /dev/null | grep autoconf`
if test "x$conf_updated_autoconf_files" != x; then
echo "Configure source code has been updated, checking time stamps"
check_autoconf_timestamps
fi
if test -e $conf_custom_script_dir; then
# If custom source configure is available, make sure it is up-to-date as well.
conf_custom_updated_autoconf_files=`cd $conf_custom_script_dir && hg status -mard 2> /dev/null | grep autoconf`
if test "x$conf_custom_updated_autoconf_files" != x; then
echo "Configure custom source code has been updated, checking time stamps"
check_autoconf_timestamps
fi
fi
fi
}
# Check for local changes
check_hg_updates
if test -e $conf_custom_script_dir/generated-configure.sh; then
# Test if open configure is newer than custom configure, if so, custom needs to
# be regenerated. This test is required to ensure consistency with custom source.
conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh | cut -d" " -f 3`
conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_custom_script_dir/generated-configure.sh | cut -d" " -f 3`
if $TEST $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
echo "Error: The generated configure file contains changes not present in the custom generated file."
echo "Please run 'sh autogen.sh' to update the generated files."
exit 1
conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_script_dir/generated-configure.sh | cut -d"=" -f 2`
conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_custom_script_dir/generated-configure.sh | cut -d"=" -f 2`
if test $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
echo "Warning: The generated configure file contains changes not present in the custom generated file."
run_autogen_or_fail
fi
fi
# Autoconf calls the configure script recursively sometimes.
# Don't start logging twice in that case
if $TEST "x$conf_debug_configure" = xtrue; then
if test "x$conf_debug_configure" = xtrue; then
conf_debug_configure=recursive
fi
###
### Process command-line arguments
###
conf_processed_arguments=
conf_processed_arguments=()
conf_openjdk_target=
conf_extra_cflags=
conf_extra_cxxflags=
for conf_option
do
@ -72,20 +123,14 @@ do
--openjdk-target=*)
conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
continue ;;
--with-extra-cflags=*)
conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
continue ;;
--with-extra-cxxflags=*)
conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
continue ;;
--debug-configure)
if $TEST "x$conf_debug_configure" != xrecursive; then
if test "x$conf_debug_configure" != xrecursive; then
conf_debug_configure=true
export conf_debug_configure
fi
continue ;;
*)
conf_processed_arguments="$conf_processed_arguments $conf_option" ;;
conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option") ;;
esac
case $conf_option in
@ -95,11 +140,13 @@ do
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
-host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*)
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
-help | --help | --hel | --he | -h)
conf_print_help=true ;;
esac
done
if $TEST "x$conf_legacy_crosscompile" != "x"; then
if $TEST "x$conf_openjdk_target" != "x"; then
if test "x$conf_legacy_crosscompile" != "x"; then
if test "x$conf_openjdk_target" != "x"; then
echo "Error: Specifying --openjdk-target together with autoconf"
echo "legacy cross-compilation flags is not supported."
echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile."
@ -112,20 +159,20 @@ if $TEST "x$conf_legacy_crosscompile" != "x"; then
fi
fi
if $TEST "x$conf_openjdk_target" != "x"; then
if test "x$conf_openjdk_target" != "x"; then
conf_build_platform=`sh $conf_script_dir/build-aux/config.guess`
conf_processed_arguments="--build=$conf_build_platform --host=$conf_openjdk_target --target=$conf_openjdk_target $conf_processed_arguments"
conf_processed_arguments=("--build=$conf_build_platform" "--host=$conf_openjdk_target" "--target=$conf_openjdk_target" "${conf_processed_arguments[@]}")
fi
# Make configure exit with error on invalid options as default.
# Can be overridden by --disable-option-checking, since we prepend our argument
# and later options override earlier.
conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments"
conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arguments[@]}")
###
### Call the configure script
###
if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
if test -e $conf_custom_script_dir/generated-configure.sh; then
# Custom source configure available; run that instead
echo Running custom generated-configure.sh
conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
@ -134,17 +181,17 @@ else
conf_script_to_run=$conf_script_dir/generated-configure.sh
fi
if $TEST "x$conf_debug_configure" != x; then
if test "x$conf_debug_configure" != x; then
# Turn on shell debug output if requested (initial or recursive)
set -x
fi
if $TEST "x$conf_debug_configure" = xtrue; then
if test "x$conf_debug_configure" = xtrue; then
# Turn on logging, but don't turn on twice when called recursive
conf_debug_logfile=./debug-configure.log
(exec 3>&1 ; (. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile
(exec 3>&1 ; (. $conf_script_to_run "${conf_processed_arguments[@]}" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile
else
. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
( . $conf_script_to_run "${conf_processed_arguments[@]}" )
fi
conf_result_code=$?
@ -152,8 +199,28 @@ conf_result_code=$?
### Post-processing
###
if test $conf_result_code -eq 0; then
if test "x$conf_print_help" = xtrue; then
cat <<EOT
Additional (non-autoconf) OpenJDK Options:
--openjdk-target=TARGET cross-compile with TARGET as target platform
(i.e. the one you will run the resulting binary on).
Equivalent to --host=TARGET --target=TARGET
--build=<current platform>
--debug-configure Run the configure script with additional debug
logging enabled.
Please be aware that, when cross-compiling, the OpenJDK configure script will
generally use 'target' where autoconf traditionally uses 'host'.
EOT
fi
else
echo configure exiting with result code $conf_result_code
fi
# Move the log file to the output root, if this was successfully created
if $TEST -d "$OUTPUT_ROOT"; then
if test -d "$OUTPUT_ROOT"; then
mv -f config.log "$OUTPUT_ROOT" 2> /dev/null
fi

View File

@ -31,16 +31,14 @@
AC_PREREQ([2.61])
AC_INIT(openjdk, jdk8, build-dev@openjdk.java.net)
# Do not change or remove the following line, it is needed for consistency checks:
# DATE_WHEN_GENERATED: @DATE_WHEN_GENERATED@
AC_INIT(OpenJDK, jdk8, build-dev@openjdk.java.net,,http://openjdk.java.net)
AC_CONFIG_AUX_DIR([build-aux])
m4_include([build-aux/pkg.m4])
# Include these first...
m4_include([basics.m4])
m4_include([basics_windows.m4])
m4_include([builddeps.m4])
# ... then the rest
m4_include([boot-jdk.m4])
@ -51,35 +49,57 @@ m4_include([libraries.m4])
m4_include([platform.m4])
m4_include([source-dirs.m4])
m4_include([toolchain.m4])
m4_include([toolchain_windows.m4])
# This line needs to be here, verbatim, after all includes.
# It is replaced with custom functionality when building
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK])
AC_DEFUN_ONCE([CUSTOM_LATE_HOOK])
# This line needs to be here, verbatim, after all includes and the dummy hook
# definitions. It is replaced with custom functionality when building
# custom sources.
AC_DEFUN_ONCE([CUSTOM_HOOK])
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=@DATE_WHEN_GENERATED@
###############################################################################
#
# Initialization
# Initialization / Boot-strapping
#
# The bootstrapping process needs to solve the "chicken or the egg" problem,
# thus it jumps back and forth, each time gaining something needed later on.
#
###############################################################################
# Basic initialization that must happen first of all
BASIC_INIT
BASIC_SETUP_FUNDAMENTAL_TOOLS
# Now we can determine OpenJDK build and target platforms. This is required to
# have early on.
PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET
# Continue setting up basic stuff.
# Continue setting up basic stuff. Most remaining code require fundamental tools.
BASIC_SETUP_PATHS
BASIC_SETUP_LOGGING
# These are needed to be able to create a configuration name (and thus the output directory)
JDKOPT_SETUP_JDK_VARIANT
JDKOPT_SETUP_JVM_VARIANTS
JDKOPT_SETUP_DEBUG_LEVEL
# With basic setup done, call the custom early hook.
CUSTOM_EARLY_HOOK
# To properly create a configuration name, we need to have the OpenJDK target
# and options (variants and debug level) parsed.
BASIC_SETUP_OUTPUT_DIR
# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
HELP_SETUP_DEPENDENCY_HELP
# Setup simple tools, that do not need have cross compilation support.
# Without these, we can't properly run the rest of the configure script.
BASIC_SETUP_TOOLS
# Setup tools that requires more complex handling, or that is not needed by the configure script.
BASIC_SETUP_COMPLEX_TOOLS
# Check if pkg-config is available.
PKG_PROG_PKG_CONFIG
@ -100,16 +120,9 @@ BDEPS_SCAN_FOR_BUILDDEPS
###############################################################################
# We need build & target for this.
JDKOPT_SETUP_JDK_VARIANT
JDKOPT_SETUP_JVM_VARIANTS
JDKOPT_SETUP_DEBUG_LEVEL
JDKOPT_SETUP_JDK_OPTIONS
JDKOPT_SETUP_JDK_VERSION_NUMBERS
# To properly create a configuration name, we need to have the OpenJDK target
# and options (variants and debug level) parsed.
BASIC_SETUP_OUTPUT_DIR
###############################################################################
#
# Setup BootJDK, used to bootstrap the build.
@ -137,7 +150,6 @@ SRCDIRS_SETUP_OUTPUT_DIRS
###############################################################################
TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
# Locate the actual tools
TOOLCHAIN_SETUP_PATHS
@ -152,10 +164,6 @@ TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS
TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION
TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK
# After we have toolchain, we can compile the uncygdrive helper
BASIC_COMPILE_UNCYGDRIVE
# Setup debug symbols (need objcopy from the toolchain for that)
JDKOPT_SETUP_DEBUG_SYMBOLS
@ -173,6 +181,9 @@ LIB_SETUP_ALSA
LIB_SETUP_MISC_LIBS
LIB_SETUP_STATIC_LINK_LIBSTDCPP
# After we have toolchain and the paths to all libraries (needed by msys), we can compile the fixpath helper
BASIC_COMPILE_FIXPATH
###############################################################################
#
# We need to do some final tweaking, when everything else is done.
@ -210,7 +221,7 @@ BPERF_SETUP_CCACHE
BASIC_TEST_USABILITY_ISSUES
# At the end, call the custom hook. (Dummy macro if no custom sources available)
CUSTOM_HOOK
CUSTOM_LATE_HOOK
# We're messing a bit with internal autoconf variables to put the config.status
# in the output directory instead of the current directory.

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,19 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
fi
])
cygwin_help() {
case $1 in
unzip)
PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip" ;;
zip)
PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P zip" ;;
make)
PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P make" ;;
* )
break ;;
esac
}
apt_help() {
case $1 in
devkit)
@ -149,7 +162,15 @@ printf "* Debug level: $DEBUG_LEVEL\n"
printf "* JDK variant: $JDK_VARIANT\n"
printf "* JVM variants: $with_jvm_variants\n"
printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n"
printf "* Boot JDK: $BOOT_JDK\n"
printf "\n"
printf "Tools summary:\n"
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
printf "* Environment: $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
fi
printf "* Boot JDK: $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
printf "* C Compiler: $CC_VENDOR version $CC_VERSION (at $CC)\n"
printf "* C++ Compiler: $CXX_VENDOR version $CXX_VERSION (at $CXX)\n"
printf "\n"
printf "Build performance summary:\n"

View File

@ -48,8 +48,8 @@ ALT_CUPS_HEADERS_PATH:=$(patsubst -I%,%,$(filter -I%,@CUPS_CFLAGS@))
# The HOSTCC/HOSTCXX is Hotspot terminology for the BUILD_CC/BUILD_CXX, i.e. the
# compiler that produces code that can be run on the build platform.
HOSTCC:=@UNCYGDRIVE@ @BUILD_CC@
HOSTCXX:=@UNCYGDRIVE@ @BUILD_CXX@
HOSTCC:=@FIXPATH@ @BUILD_CC@
HOSTCXX:=@FIXPATH@ @BUILD_CXX@
####################################################
#
@ -78,13 +78,23 @@ ARCH=$(OPENJDK_TARGET_CPU_LEGACY)
ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR)
ALT_EXPORT_PATH=$(HOTSPOT_DIST)
HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@
HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@ @STATIC_CXX_SETTING@
# This is used from the libjvm build for C/C++ code.
HOTSPOT_BUILD_JOBS:=@CONCURRENT_BUILD_JOBS@
# Control wether Hotspot runs Queens test after building
TEST_IN_BUILD=@TEST_IN_BUILD@
# For hotspot, override compiler/tools definition to not include FIXPATH prefix.
# Hotspot has its own handling on the Windows path situation.
CXX:=@CCACHE@ @HOTSPOT_CXX@
LD:=@HOTSPOT_LD@
MT:=@HOTSPOT_MT@
RC:=@HOTSPOT_RC@
EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@
EXTRA_CXXFLAGS=@LEGACY_EXTRA_CXXFLAGS@
EXTRA_LDFLAGS=@LEGACY_EXTRA_LDFLAGS@
# Sneak this in via the spec.gmk file, since we don't want to mess around too much with the Hotspot make files.
# This is needed to get the LOG setting to work properly.
include $(SRC_ROOT)/common/makefiles/MakeBase.gmk

View File

@ -64,7 +64,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
# ie normal interpreter and C1, only the serial GC, kernel jvmti etc
# zero: no machine code interpreter, no compiler
# zeroshark: zero interpreter and shark/llvm compiler backend
AC_MSG_CHECKING([which variants of the JVM that should be built])
AC_MSG_CHECKING([which variants of the JVM to build])
AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
[JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])])
@ -241,40 +241,39 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
# Should we build only OpenJDK even if closed sources are present?
#
AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
[build OpenJDK regardless of the presence of closed repositories @<:@disabled@:>@])],,)
[supress building closed source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"])
if test "x$enable_openjdk_only" = "xyes"; then
OPENJDK=true
elif test "x$enable_openjdk_only" = "xno"; then
OPENJDK=false
elif test -d "$SRC_ROOT/jdk/src/closed"; then
OPENJDK=false
AC_MSG_CHECKING([for presence of closed sources])
if test -d "$SRC_ROOT/jdk/src/closed"; then
CLOSED_SOURCE_PRESENT=yes
else
CLOSED_SOURCE_PRESENT=no
fi
AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT])
AC_MSG_CHECKING([if closed source is supressed (openjdk-only)])
SUPRESS_CLOSED_SOURCE="$enable_openjdk_only"
AC_MSG_RESULT([$SUPRESS_CLOSED_SOURCE])
if test "x$CLOSED_SOURCE_PRESENT" = xno; then
OPENJDK=true
if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
AC_MSG_WARN([No closed source present, --enable-openjdk-only makes no sense])
fi
else
if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
OPENJDK=true
else
OPENJDK=false
fi
fi
if test "x$OPENJDK" = "xtrue"; then
SET_OPENJDK=OPENJDK=true
SET_OPENJDK="OPENJDK=true"
fi
AC_SUBST(SET_OPENJDK)
###############################################################################
#
# JIGSAW or not. The JIGSAW variable is used during the intermediate
# stage when we are building both the old style JDK and the new style modularized JDK.
# When the modularized JDK is finalized, this option will go away.
#
AC_ARG_ENABLE([jigsaw], [AS_HELP_STRING([--enable-jigsaw],
[build Jigsaw images (not yet available) @<:@disabled@:>@])],,)
if test "x$enable_jigsaw" = "xyes"; then
JIGSAW=true
else
JIGSAW=false
fi
AC_SUBST(JIGSAW)
###############################################################################
#
# Should we build a JDK/JVM with headful support (ie a graphical ui)?
@ -282,7 +281,7 @@ AC_SUBST(JIGSAW)
#
AC_MSG_CHECKING([headful support])
AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
[build headful support (graphical UI support) @<:@enabled@:>@])],
[disable building headful support (graphical UI support) @<:@enabled@:>@])],
[SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
SUPPORT_HEADLESS=yes
@ -305,25 +304,9 @@ AC_SUBST(SUPPORT_HEADLESS)
AC_SUBST(SUPPORT_HEADFUL)
AC_SUBST(BUILD_HEADLESS)
###############################################################################
#
# Should we compile nimbus swing L&F? We can probably remove this option
# since nimbus is officially part of javax now.
#
AC_MSG_CHECKING([whether to build nimbus L&F])
AC_ARG_ENABLE([nimbus], [AS_HELP_STRING([--disable-nimbus],
[disable Nimbus L&F @<:@enabled@:>@])],
[ENABLE_NIMBUS="${enableval}"], [ENABLE_NIMBUS='yes'])
AC_MSG_RESULT([$ENABLE_NIMBUS])
DISABLE_NIMBUS=
if test "x$ENABLE_NIMBUS" = xno; then
DISABLE_NIMBUS=true
fi
AC_SUBST(DISABLE_NIMBUS)
# Control wether Hotspot runs Queens test after build.
AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
[enable running of Queens test after Hotspot build (not yet available) @<:@disabled@:>@])],,
[run the Queens test after Hotspot build @<:@disabled@:>@])],,
[enable_hotspot_test_in_build=no])
if test "x$enable_hotspot_test_in_build" = "xyes"; then
TEST_IN_BUILD=true
@ -349,6 +332,20 @@ else
fi
AC_SUBST(CACERTS_FILE)
###############################################################################
#
# Enable or disable unlimited crypto
#
AC_ARG_ENABLE(unlimited-crypto, [AS_HELP_STRING([--enable-unlimited-crypto],
[Enable unlimited crypto policy @<:@disabled@:>@])],,
[enable_unlimited_crypto=no])
if test "x$enable_unlimited_crypto" = "xyes"; then
UNLIMITED_CRYPTO=true
else
UNLIMITED_CRYPTO=false
fi
AC_SUBST(UNLIMITED_CRYPTO)
###############################################################################
#
# Compress jars
@ -356,38 +353,6 @@ AC_SUBST(CACERTS_FILE)
COMPRESS_JARS=false
AC_SUBST(COMPRESS_JARS)
###############################################################################
#
# Should we compile JFR
# default no, except for on closed-jdk
#
ENABLE_JFR=no
# Is the JFR source present
#
# For closed default is yes
#
if test "x${OPENJDK}" != "xtrue"; then
ENABLE_JFR=yes
fi
AC_MSG_CHECKING([whether to build jfr])
AC_ARG_ENABLE([jfr], [AS_HELP_STRING([--enable-jfr],
[enable jfr (default is no)])]
[ENABLE_JFR="${enableval}"])
AC_MSG_RESULT([${ENABLE_JFR}])
if test "x$ENABLE_JFR" = "xyes"; then
ENABLE_JFR=true
elif test "x$ENABLE_JFR" = "xno"; then
ENABLE_JFR=false
else
AC_MSG_ERROR([Invalid argument to --enable-jfr])
fi
AC_SUBST(ENABLE_JFR)
])
AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS],
@ -409,6 +374,8 @@ AC_SUBST(PRODUCT_NAME)
AC_SUBST(PRODUCT_SUFFIX)
AC_SUBST(JDK_RC_PLATFORM_NAME)
AC_SUBST(COMPANY_NAME)
AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
AC_SUBST(MACOSX_BUNDLE_ID_BASE)
COPYRIGHT_YEAR=`date +'%Y'`
AC_SUBST(COPYRIGHT_YEAR)
@ -437,7 +404,7 @@ else
BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
# Avoid [:alnum:] since it depends on the locale.
CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}"
fi
AC_SUBST(FULL_VERSION)
@ -473,7 +440,7 @@ if test "x$OPENJDK_TARGET_OS" = xmacosx; then
fi
AC_ARG_ENABLE([debug-symbols],
[AS_HELP_STRING([--disable-debug-symbols],[disable generation of debug symbols (@<:@enabled@:>@)])],
[AS_HELP_STRING([--disable-debug-symbols],[disable generation of debug symbols @<:@enabled@:>@])],
[ENABLE_DEBUG_SYMBOLS=${enable_debug_symbols}],
)
@ -487,7 +454,7 @@ fi
if test "x$ENABLE_DEBUG_SYMBOLS" = "xdefault"; then
# Default is on if objcopy is found, otherwise off
if test "x$OBJCOPY" != x; then
if test "x$OBJCOPY" != x || test "x$OPENJDK_TARGET_OS" = xwindows; then
ENABLE_DEBUG_SYMBOLS=yes
else
ENABLE_DEBUG_SYMBOLS=no
@ -502,7 +469,7 @@ AC_MSG_RESULT([$ENABLE_DEBUG_SYMBOLS])
ZIP_DEBUGINFO_FILES=yes
AC_ARG_ENABLE([zip-debug-info],
[AS_HELP_STRING([--disable-zip-debug-info],[don't zip debug-info files (@<:@enabled@:@)])],
[AS_HELP_STRING([--disable-zip-debug-info],[disable zipping of debug-info files @<:@enabled@:>@])],
[ZIP_DEBUGINFO_FILES=${enable_zip_debug_info}],
)
@ -528,5 +495,5 @@ AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
# for a degree of customization of the build targets and the rules/recipes
# to create them
AC_ARG_WITH([custom-make-dir], [AS_HELP_STRING([--with-custom-make-dir],
[directory containing custom build/make files])], [CUSTOM_MAKE_DIR=$with_custom_make_dir])
[use this directory for custom build/make files])], [CUSTOM_MAKE_DIR=$with_custom_make_dir])
AC_SUBST(CUSTOM_MAKE_DIR)

View File

@ -172,9 +172,15 @@ fi
AC_LANG_PUSH(C)
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
# Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h],
[X11_A_OK=yes],
[X11_A_OK=no])
[X11_A_OK=yes],
[X11_A_OK=no],
[ # include <X11/Xlib.h>
# include <X11/Xutil.h>
])
CFLAGS="$OLD_CFLAGS"
AC_LANG_POP(C)
@ -196,27 +202,23 @@ AC_DEFUN_ONCE([LIB_SETUP_CUPS],
#
AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
[specify prefix directory for the cups package
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
(expecting the headers under PATH/include)])])
AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
[specify directory for the cups include files])])
AC_ARG_WITH(cups-lib, [AS_HELP_STRING([--with-cups-lib],
[specify directory for the cups library])])
if test "x$CUPS_NOT_NEEDED" = xyes; then
if test "x${with_cups}" != x || test "x${with_cups_include}" != x || test "x${with_cups_lib}" != x; then
if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
AC_MSG_WARN([cups not used, so --with-cups is ignored])
fi
CUPS_CFLAGS=
CUPS_LIBS=
else
CUPS_FOUND=no
if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno || test "x${with_cups_lib}" = xno; then
if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
fi
if test "x${with_cups}" != x; then
CUPS_LIBS="-L${with_cups}/lib -lcups"
CUPS_CFLAGS="-I${with_cups}/include"
CUPS_FOUND=yes
fi
@ -224,10 +226,6 @@ else
CUPS_CFLAGS="-I${with_cups_include}"
CUPS_FOUND=yes
fi
if test "x${with_cups_lib}" != x; then
CUPS_LIBS="-L${with_cups_lib} -lcups"
CUPS_FOUND=yes
fi
if test "x$CUPS_FOUND" = xno; then
BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
fi
@ -236,23 +234,20 @@ else
AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
[CUPS_FOUND=yes
CUPS_CFLAGS=
CUPS_LIBS="-lcups"
DEFAULT_CUPS=yes])
fi
if test "x$CUPS_FOUND" = xno; then
# Getting nervous now? Lets poke around for standard Solaris third-party
# package installation locations.
AC_MSG_CHECKING([for cups headers and libs])
AC_MSG_CHECKING([for cups headers])
if test -s /opt/sfw/cups/include/cups/cups.h; then
# An SFW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I/opt/sfw/cups/include"
CUPS_LIBS="-L/opt/sfw/cups/lib -lcups"
elif test -s /opt/csw/include/cups/cups.h; then
# A CSW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I/opt/csw/include"
CUPS_LIBS="-L/opt/csw/lib -lcups"
fi
AC_MSG_RESULT([$CUPS_FOUND])
fi
@ -263,7 +258,6 @@ else
fi
AC_SUBST(CUPS_CFLAGS)
AC_SUBST(CUPS_LIBS)
])
@ -292,17 +286,21 @@ else
FREETYPE2_FOUND=no
if test "x$with_freetype" != x; then
SPACESAFE(with_freetype,[the path to freetype])
BASIC_FIXUP_PATH(with_freetype)
FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
FREETYPE2_LIB_PATH="$with_freetype/lib"
if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
fi
if test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
fi
FREETYPE2_LIB_PATH="$with_freetype/lib"
FREETYPE2_CFLAGS="-I$with_freetype/include"
if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
fi
FREETYPE2_FOUND=yes
FREETYPE2_FOUND=yes
if test "x$FREETYPE2_FOUND" = xyes; then
# Verify that the directories exist
if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
@ -311,7 +309,7 @@ else
# List the contents of the lib.
FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
if test "x$FREETYPELIB" = x; then
AC_MSG_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib])
AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib])
fi
# Check one h-file
if ! test -s "$with_freetype/include/ft2build.h"; then
@ -323,9 +321,34 @@ else
BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
USING_SYSTEM_FT_LIB=true
fi
if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
BASIC_FIXUP_PATH(FREETYPELOCATION)
AC_MSG_CHECKING([for freetype in some standard windows locations])
if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
if ! test -s "$FREETYPE2_LIBS"; then
AC_MSG_ERROR([Could not find $FREETYPE2_LIBS])
fi
if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll])
fi
USING_SYSTEM_FT_LIB=true
FREETYPE2_FOUND=yes
fi
AC_MSG_RESULT([$FREETYPE2_FOUND])
fi
if test "x$FREETYPE2_FOUND" = xno; then
PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
# On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
USING_SYSTEM_FT_LIB=true
# 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
fi
fi
if test "x$FREETYPE2_FOUND" = xno; then
AC_MSG_CHECKING([for freetype in some standard locations])
@ -365,6 +388,16 @@ else
HELP_MSG_MISSING_DEPENDENCY([freetype2])
AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
fi
if test "x$OPENJDK_TARGET_OS" != xwindows; then
# AC_CHECK_LIB does not support use of cl.exe
PREV_LDFLAGS="$LDFLAGS"
LDFLAGS="$FREETYPE2_LIBS"
AC_CHECK_LIB(freetype, FT_Init_FreeType,
FREETYPE2_FOUND=true,
AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
LDFLAGS="$PREV_LDFLAGS"
fi
fi
AC_SUBST(USING_SYSTEM_FT_LIB)
@ -621,13 +654,16 @@ if test "x$OPENJDK_TARGET_OS" = xlinux; then
if test "x$enable_static_link_stdc__" = xyes; then
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
LDCXX="$CC"
STATIC_CXX_SETTING="STATIC_CXX=true"
AC_MSG_RESULT([static])
else
LIBCXX="$LIBCXX -lstdc++"
LDCXX="$CXX"
STATIC_CXX_SETTING="STATIC_CXX=false"
AC_MSG_RESULT([dynamic])
fi
fi
AC_SUBST(STATIC_CXX_SETTING)
# libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then

View File

@ -87,22 +87,32 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
*linux*)
VAR_OS=linux
VAR_OS_API=posix
VAR_OS_ENV=linux
;;
*solaris*)
VAR_OS=solaris
VAR_OS_API=posix
VAR_OS_ENV=solaris
;;
*darwin*)
VAR_OS=macosx
VAR_OS_API=posix
VAR_OS_ENV=macosx
;;
*bsd*)
VAR_OS=bsd
VAR_OS_API=posix
VAR_OS_ENV=bsd
;;
*cygwin*|*windows*)
*cygwin*)
VAR_OS=windows
VAR_OS_API=winapi
VAR_OS_ENV=windows.cygwin
;;
*mingw*)
VAR_OS=windows
VAR_OS_API=winapi
VAR_OS_ENV=windows.msys
;;
*)
AC_MSG_ERROR([unsupported operating system $1])
@ -127,12 +137,34 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
# ..and setup our own variables. (Do this explicitely to facilitate searching)
OPENJDK_BUILD_OS="$VAR_OS"
OPENJDK_BUILD_OS_API="$VAR_OS_API"
OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
OPENJDK_BUILD_CPU="$VAR_CPU"
OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
AC_SUBST(OPENJDK_BUILD_OS)
AC_SUBST(OPENJDK_BUILD_OS_API)
AC_SUBST(OPENJDK_BUILD_CPU)
AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
AC_SUBST(OPENJDK_BUILD_CPU_BITS)
AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
AC_MSG_CHECKING([openjdk-build os-cpu])
AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
# ... and setup our own variables. (Do this explicitely to facilitate searching)
OPENJDK_TARGET_OS="$VAR_OS"
OPENJDK_TARGET_OS_API="$VAR_OS_API"
OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
OPENJDK_TARGET_CPU="$VAR_CPU"
OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
@ -144,22 +176,8 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
AC_SUBST(OPENJDK_TARGET_CPU_BITS)
AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
# ..and setup our own variables. (Do this explicitely to facilitate searching)
OPENJDK_BUILD_OS="$VAR_OS"
OPENJDK_BUILD_OS_API="$VAR_OS_API"
OPENJDK_BUILD_CPU="$VAR_CPU"
OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
AC_SUBST(OPENJDK_BUILD_OS)
AC_SUBST(OPENJDK_BUILD_OS_API)
AC_SUBST(OPENJDK_BUILD_CPU)
AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
AC_SUBST(OPENJDK_BUILD_CPU_BITS)
AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
AC_MSG_CHECKING([openjdk-target os-cpu])
AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
])
# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
@ -208,7 +226,7 @@ AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
fi
AC_SUBST(COMPILE_TYPE)
AC_MSG_CHECKING([for compilation type])
AC_MSG_CHECKING([compilation type])
AC_MSG_RESULT([$COMPILE_TYPE])
])
@ -299,7 +317,11 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
A_LP64="LP64:="
ADD_LP64="-D_LP64=1"
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
# unpack200.exe
if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then
ADD_LP64="-D_LP64=1"
fi
fi
AC_SUBST(LP64,$A_LP64)

View File

@ -41,7 +41,9 @@ SQUOTE:='
#'
DQUOTE:="
#"
define NEWLINE:=
define NEWLINE
endef
# A self-referential reference to this file.
@ -50,11 +52,7 @@ SPEC:=@SPEC@
# Specify where the spec file is.
MAKE_ARGS="SPEC=$(SPEC)"
# TODO The logic for finding and setting MAKE is currently not working
# well on windows. Disable it TEMPORARILY there for now.
ifneq (@OPENJDK_TARGET_OS@,windows)
MAKE:=@MAKE@
endif
MAKE:=@MAKE@
# Pass along the verbosity setting.
ifeq (,$(findstring VERBOSE=,$(MAKE)))
@ -77,6 +75,7 @@ CONF_NAME:=@CONF_NAME@
# The built jdk will run in this target system.
OPENJDK_TARGET_OS:=@OPENJDK_TARGET_OS@
OPENJDK_TARGET_OS_API:=@OPENJDK_TARGET_OS_API@
OPENJDK_TARGET_OS_ENV:=@OPENJDK_TARGET_OS_ENV@
OPENJDK_TARGET_CPU:=@OPENJDK_TARGET_CPU@
OPENJDK_TARGET_CPU_ARCH:=@OPENJDK_TARGET_CPU_ARCH@
@ -109,16 +108,21 @@ REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@
REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@
@SET_OPENJDK@
JIGSAW:=@JIGSAW@
LIBM:=-lm
LIBDL:=@LIBDL@
# colon or semicolon
PATH_SEP:=@PATH_SEP@
# Set special env variables, to be passed to external tools.
# Used for cygwin setups.
@SETUPDEVENV@
ifeq ($(OPENJDK_TARGET_OS), windows)
# On Windows, the Visual Studio toolchain needs the LIB and INCLUDE
# environment variables (in Windows path style), and the PATH needs to
# be adjusted to include Visual Studio tools (but this needs to be in
# cygwin/msys style).
export PATH:=@VS_PATH@
export INCLUDE:=@VS_INCLUDE@
export LIB:=@VS_LIB@
endif
# The sys root where standard headers and libraries are found.
# Usually not needed since the configure script should have
@ -131,7 +135,6 @@ ADD_SRC_ROOT:=@ADD_SRC_ROOT@
OVERRIDE_SRC_ROOT:=@OVERRIDE_SRC_ROOT@
TOPDIR:=@SRC_ROOT@
OUTPUT_ROOT:=@OUTPUT_ROOT@
JDK_MAKE_SHARED_DIR:=@JDK_TOPDIR@/makefiles/common/shared
JDK_TOPDIR:=@JDK_TOPDIR@
LANGTOOLS_TOPDIR:=@LANGTOOLS_TOPDIR@
CORBA_TOPDIR:=@CORBA_TOPDIR@
@ -155,6 +158,8 @@ PRODUCT_NAME:=@PRODUCT_NAME@
PRODUCT_SUFFIX:=@PRODUCT_SUFFIX@
JDK_RC_PLATFORM_NAME:=@JDK_RC_PLATFORM_NAME@
COMPANY_NAME:=@COMPANY_NAME@
MACOSX_BUNDLE_NAME_BASE=@MACOSX_BUNDLE_NAME_BASE@
MACOSX_BUNDLE_ID_BASE=@MACOSX_BUNDLE_ID_BASE@
# Different version strings generated from the above information.
JDK_VERSION:=@JDK_VERSION@
@ -260,6 +265,9 @@ PACKAGE_PATH=@PACKAGE_PATH@
# Source file for cacerts
CACERTS_FILE=@CACERTS_FILE@
# Enable unlimited crypto policy
UNLIMITED_CRYPTO=@UNLIMITED_CRYPTO@
# Necessary additional compiler flags to compile X11
X_CFLAGS:=@X_CFLAGS@
X_LIBS:=@X_LIBS@
@ -289,7 +297,7 @@ C_FLAG_DEPS:=@C_FLAG_DEPS@
CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
# Tools that potentially need to be cross compilation aware.
CC:=@UNCYGDRIVE@ @CCACHE@ @CC@
CC:=@FIXPATH@ @CCACHE@ @CC@
# CFLAGS used to compile the jdk native libraries (C-code)
CFLAGS_JDKLIB:=@CFLAGS_JDKLIB@
@ -299,17 +307,17 @@ CXXFLAGS_JDKLIB:=@CXXFLAGS_JDKLIB@
CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@
CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
CXX:=@UNCYGDRIVE@ @CCACHE@ @CXX@
CXX:=@FIXPATH@ @CCACHE@ @CXX@
#CXXFLAGS:=@CXXFLAGS@
OBJC:=@CCACHE@ @OBJC@
#OBJCFLAGS:=@OBJCFLAGS@
CPP:=@UNCYGDRIVE@ @CPP@
CPP:=@FIXPATH@ @CPP@
#CPPFLAGS:=@CPPFLAGS@
# The linker can be gcc or ld on posix systems, or link.exe on windows systems.
LD:=@UNCYGDRIVE@ @LD@
LD:=@FIXPATH@ @LD@
# LDFLAGS used to link the jdk native libraries (C-code)
LDFLAGS_JDKLIB:=@LDFLAGS_JDKLIB@
@ -317,7 +325,7 @@ LDFLAGS_JDKLIB_SUFFIX:=@LDFLAGS_JDKLIB_SUFFIX@
# On some platforms the linker cannot be used to create executables, thus
# the need for a separate LDEXE command.
LDEXE:=@UNCYGDRIVE@ @LDEXE@
LDEXE:=@FIXPATH@ @LDEXE@
# LDFLAGS used to link the jdk native launchers (C-code)
LDFLAGS_JDKEXE:=@LDFLAGS_JDKEXE@
@ -327,22 +335,22 @@ LDFLAGS_JDKEXE_SUFFIX:=@LDFLAGS_JDKEXE_SUFFIX@
LDFLAGS_CXX_JDK:=@LDFLAGS_CXX_JDK@
# Sometimes a different linker is needed for c++ libs
LDCXX:=@UNCYGDRIVE@ @LDCXX@
LDCXX:=@FIXPATH@ @LDCXX@
# The flags for linking libstdc++ linker.
LIBCXX:=@LIBCXX@
# Sometimes a different linker is needed for c++ executables
LDEXECXX:=@UNCYGDRIVE@ @LDEXECXX@
LDEXECXX:=@FIXPATH@ @LDEXECXX@
# BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the
# build platform.
BUILD_CC:=@UNCYGDRIVE@ @BUILD_CC@
BUILD_LD:=@UNCYGDRIVE@ @BUILD_LD@
BUILD_CC:=@FIXPATH@ @BUILD_CC@
BUILD_LD:=@FIXPATH@ @BUILD_LD@
AS:=@UNCYGDRIVE@ @AS@
AS:=@FIXPATH@ @AS@
# AR is used to create a static library (is ar in posix, lib.exe in windows)
AR:=@UNCYGDRIVE@ @AR@
AR:=@FIXPATH@ @AR@
ARFLAGS:=@ARFLAGS@
NM:=@NM@
@ -400,20 +408,20 @@ POST_MCS_CMD:=@POST_MCS_CMD@
JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
JAVA=@UNCYGDRIVE@ $(BOOT_JDK)/bin/java $(JAVA_FLAGS)
JAVA=@FIXPATH@ $(BOOT_JDK)/bin/java $(JAVA_FLAGS)
JAVAC=@UNCYGDRIVE@ $(BOOT_JDK)/bin/javac
JAVAC=@FIXPATH@ $(BOOT_JDK)/bin/javac
# Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
# overriding that value by using ?=.
JAVAC_FLAGS?=@JAVAC_FLAGS@
JAVAH=@UNCYGDRIVE@ $(BOOT_JDK)/bin/javah
JAVAH=@FIXPATH@ $(BOOT_JDK)/bin/javah
JAR=@UNCYGDRIVE@ $(BOOT_JDK)/bin/jar
JAR=@FIXPATH@ $(BOOT_JDK)/bin/jar
RMIC=@UNCYGDRIVE@ $(BOOT_JDK)/bin/rmic
RMIC=@FIXPATH@ $(BOOT_JDK)/bin/rmic
NATIVE2ASCII=@UNCYGDRIVE@ $(BOOT_JDK)/bin/native2ascii
NATIVE2ASCII=@FIXPATH@ $(BOOT_JDK)/bin/native2ascii
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
@ -424,21 +432,20 @@ endif
# 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:=@UNCYGDRIVE@ @SJAVAC_SERVER_JAVA@
SJAVAC_SERVER_JAVA:=@FIXPATH@ @SJAVAC_SERVER_JAVA@
# Tools adhering to a minimal and common standard of posix compliance.
AWK:=@AWK@
BASENAME:=@BASENAME@
BASH:=@BASH@
CAT:=@CAT@
CCACHE:=@CCACHE@
# CD is going away, but remains to cater for legacy makefiles.
CD:=cd
CHMOD:=@CHMOD@
CP:=@CP@
CPIO:=@CPIO@
CUT:=@CUT@
DATE:=@DATE@
DF:=@DF@
DIFF:=@DIFF@
FIND:=@FIND@
FIND_DELETE:=@FIND_DELETE@
@ -461,6 +468,7 @@ SORT:=@SORT@
TAR:=@TAR@
TAIL:=@TAIL@
TEE:=@TEE@
TIME:=@TIME@
TR:=@TR@
TOUCH:=@TOUCH@
WC:=@WC@
@ -468,9 +476,9 @@ XARGS:=@XARGS@
ZIPEXE:=@ZIP@
ZIP:=@ZIP@
UNZIP:=@UNZIP@
MT:=@UNCYGDRIVE@ @MT@
RC:=@UNCYGDRIVE@ @RC@
DUMPBIN:=@UNCYGDRIVE@ @DUMPBIN@
MT:=@FIXPATH@ @MT@
RC:=@FIXPATH@ @RC@
DUMPBIN:=@FIXPATH@ @DUMPBIN@
CYGPATH:=@CYGPATH@
LDD:=@LDD@
OTOOL:=@OTOOL@
@ -479,8 +487,9 @@ EXPR:=@EXPR@
FILE:=@FILE@
HG:=@HG@
OBJCOPY:=@OBJCOPY@
SETFILE:=@SETFILE@
UNCYGDRIVE:=@UNCYGDRIVE@
FIXPATH:=@FIXPATH@
# Where the build output is stored for your convenience.
BUILD_LOG:=@BUILD_LOG@
@ -488,14 +497,12 @@ BUILD_LOG_PREVIOUS:=@BUILD_LOG_PREVIOUS@
BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@
# Build setup
DISABLE_NIMBUS:=@DISABLE_NIMBUS@
ENABLE_JFR=@ENABLE_JFR@
USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
CHECK_FOR_VCINSTALLDIR=@CHECK_FOR_VCINSTALLDIR@
MSVCRNN_DLL:=@MSVCR100DLL@
MSVCR_DLL:=@MSVCR_DLL@
# ADD_SRCS takes a single argument with source roots

View File

@ -23,111 +23,67 @@
# questions.
#
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
# $1 = compiler to test (CC or CXX)
# $2 = human readable name of compiler (C or C++)
AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
[
COMPILER=[$]$1
COMPILER_NAME=$2
# Check if the VS env variables were setup prior to running configure.
# If not, then find vcvarsall.bat and run it automatically, and integrate
# the set env variables into the spec file.
SETUPDEVENV="# No special vars"
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
# Store path to cygwin link.exe to help excluding it when searching for
# VS linker.
AC_PATH_PROG(CYGWIN_LINK, link)
AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
"$CYGWIN_LINK" --version > /dev/null
if test $? -eq 0 ; then
AC_MSG_RESULT([yes])
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
# Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
$ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
if test $? -ne 0; then
GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
else
AC_MSG_RESULT([no])
# This might be the VS linker. Don't exclude it later on.
CYGWIN_LINK=""
COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
COMPILER_VENDOR="Sun Studio"
fi
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
# First line typically looks something like:
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1`
COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
COMPILER_VENDOR="Microsoft CL.EXE"
COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
if test "x$COMPILER_CPU_TEST" != "x80x86"; then
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
fi
elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
if test "x$COMPILER_CPU_TEST" != "xx64"; then
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
fi
fi
else
COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
# Check that this is likely to be GCC.
$COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null
if test $? -ne 0; then
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.])
AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
fi
# If vcvarsall.bat has been run, then VCINSTALLDIR is set.
if test "x$VCINSTALLDIR" != x; then
# No further setup is needed. The build will happen from this kind
# of shell.
SETUPDEVENV="# This spec file expects that you are running bash from within a VS command prompt."
# Make sure to remind you, if you forget to run make from a cygwin bash shell
# that is spawned "bash -l" from a VS command prompt.
CHECK_FOR_VCINSTALLDIR=yes
AC_MSG_CHECKING([if you are running from within a VS command prompt])
AC_MSG_RESULT([yes])
else
# Ah, we have not yet run vcvarsall.bat/vsvars32.bat/vsvars64.bat. Lets do that. First find it.
if test "x$VS100COMNTOOLS" != x; then
VARSBAT=`find "$VS100COMNTOOLS/../.." -name vcvarsall.bat`
SEARCH_ROOT="$VS100COMNTOOLS"
else
VARSBAT=`find "$PROGRAMFILES" -name vcvarsall.bat`
SEARCH_ROOT="$PROGRAMFILES"
fi
VCPATH=`dirname "$VARSBAT"`
VCPATH=`cygpath -w "$VCPATH"`
if test "x$VARSBAT" = x || test ! -d "$VCPATH"; then
AC_MSG_CHECKING([if we can find the VS installation])
AC_MSG_RESULT([no])
AC_MSG_ERROR([Tried to find a VS installation using both $SEARCH_ROOT but failed. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
fi
case "$OPENJDK_TARGET_CPU" in
x86)
VARSBAT_ARCH=x86
;;
x86_64)
VARSBAT_ARCH=amd64
;;
esac
# Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
cd $OUTPUT_ROOT
bash $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
cd $CURDIR
if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then
AC_MSG_CHECKING([if we can extract the needed env variables])
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not succesfully extract the env variables needed for the VS setup. Please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
fi
# Now set all paths and other env variables. This will allow the rest of
# the configure script to find and run the compiler in the proper way.
. $OUTPUT_ROOT/localdevenv.sh
AC_MSG_CHECKING([if we can find the VS installation])
if test "x$VCINSTALLDIR" != x; then
AC_MSG_RESULT([$VCINSTALLDIR])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find VS installation. Please install. If you are sure you have installed VS, then please run "c:\\cygwin\\bin\\bash.exe -l" from a VS command prompt and then run configure/make from there.])
fi
CHECK_FOR_VCINSTALLDIR=no
SETUPDEVENV="include $OUTPUT_ROOT/localdevenv.gmk"
# First line typically looks something like:
# gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
fi
# This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
$1_VERSION="$COMPILER_VERSION"
# This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
$1_VENDOR="$COMPILER_VENDOR"
AC_MSG_CHECKING([for msvcr100.dll])
AC_ARG_WITH(msvcr100dll, [AS_HELP_STRING([--with-msvcr100dll],
[copy this msvcr100.dll into the built JDK])])
if test "x$with_msvcr100dll" != x; then
MSVCR100DLL="$with_msvcr100dll"
else
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x64 | head --lines 1`
else
MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
if test "x$MSVCR100DLL" = x; then
MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | head --lines 1`
fi
fi
fi
if test "x$MSVCR100DLL" = x; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find msvcr100.dll !])
fi
AC_MSG_RESULT([$MSVCR100DLL])
SPACESAFE(MSVCR100DLL,[the path to msvcr100.dll])
fi
fi
AC_SUBST(SETUPDEVENV)
AC_SUBST(CHECK_FOR_VCINSTALLDIR)
AC_SUBST(MSVCR100DLL)
AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)])
])
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
[
###############################################################################
@ -151,8 +107,67 @@ AC_SUBST(LD_OUT_OPTION)
AC_SUBST(AR_OUT_OPTION)
])
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_PATHS],
# $1 = compiler to test (CC or CXX)
# $2 = human readable name of compiler (C or C++)
# $3 = list of compiler names to search for
AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
[
COMPILER_NAME=$2
# Do a first initial attempt at searching the list of compiler names.
# AC_PATH_PROGS can't be run multiple times with the same variable,
# so create a new name for this run.
AC_PATH_PROGS(POTENTIAL_$1, $3)
$1=$POTENTIAL_$1
if test "x$[$]$1" = x; then
HELP_MSG_MISSING_DEPENDENCY([devkit])
AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
fi
BASIC_FIXUP_EXECUTABLE($1)
AC_MSG_CHECKING([resolved symbolic links for $1])
TEST_COMPILER="[$]$1"
BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
AC_MSG_RESULT([$TEST_COMPILER])
AC_MSG_CHECKING([if $1 is disguised ccache])
COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
if test "x$COMPILER_BASENAME" = "xccache"; then
AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
# We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
# We want to control ccache invocation ourselves, so ignore this cc and try
# searching again.
# Remove the path to the fake ccache cc from the PATH
RETRY_COMPILER_SAVED_PATH="$PATH"
COMPILER_DIRNAME=`$DIRNAME [$]$1`
PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
# Try again looking for our compiler
AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
PATH="$RETRY_COMPILER_SAVED_PATH"
AC_MSG_CHECKING([for resolved symbolic links for $1])
BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
AC_MSG_RESULT([$PROPER_COMPILER_$1])
$1="$PROPER_COMPILER_$1"
else
AC_MSG_RESULT([no, keeping $1])
$1="$TEST_COMPILER"
fi
TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
])
AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
[
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
fi
AC_SUBST(MSVCR_DLL)
# If --build AND --host is set, then the configure script will find any
# cross compilation tools in the PATH. Cross compilation tools
# follows the cross compilation standard where they are prefixed with ${host}.
@ -171,11 +186,11 @@ if test "x$COMPILE_TYPE" = "xcross"; then
# Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
# to wait until they are properly discovered.
AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
SET_FULL_PATH(BUILD_CC)
BASIC_FIXUP_EXECUTABLE(BUILD_CC)
AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
SET_FULL_PATH(BUILD_CXX)
BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
AC_PATH_PROG(BUILD_LD, ld)
SET_FULL_PATH(BUILD_LD)
BASIC_FIXUP_EXECUTABLE(BUILD_LD)
fi
AC_SUBST(BUILD_CC)
AC_SUBST(BUILD_CXX)
@ -218,36 +233,40 @@ if test "x$TOOLS_DIR" != x; then
PATH=$TOOLS_DIR:$PATH
fi
### Locate C compiler (CC)
# gcc is almost always present, but on Windows we
# prefer cl.exe and on Solaris we prefer CC.
# Thus test for them in this order.
AC_PROG_CC([cl cc gcc])
if test "x$CC" = x; then
HELP_MSG_MISSING_DEPENDENCY([devkit])
AC_MSG_ERROR([Could not find a compiler. $HELP_MSG])
fi
if test "x$CC" = xcc && test "x$OPENJDK_BUILD_OS" = xmacosx; then
# Do not use cc on MacOSX use gcc instead.
CC="gcc"
fi
SET_FULL_PATH(CC)
AC_PROG_CXX([cl CC g++])
if test "x$CXX" = xCC && test "x$OPENJDK_BUILD_OS" = xmacosx; then
# The found CC, even though it seems to be a g++ derivate, cannot compile
# c++ code. Override.
CXX="g++"
fi
SET_FULL_PATH(CXX)
if test "x$CXX" = x || test "x$CC" = x; then
HELP_MSG_MISSING_DEPENDENCY([devkit])
AC_MSG_ERROR([Could not find the needed compilers! $HELP_MSG ])
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Do not probe for cc on MacOSX.
COMPILER_CHECK_LIST="cl gcc"
else
COMPILER_CHECK_LIST="cl cc gcc"
fi
if test "x$OPENJDK_BUILD_OS" != xwindows; then
TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST])
# Now that we have resolved CC ourself, let autoconf have it's go at it
AC_PROG_CC([$CC])
### Locate C++ compiler (CXX)
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Do not probe for CC on MacOSX.
COMPILER_CHECK_LIST="cl g++"
else
COMPILER_CHECK_LIST="cl CC g++"
fi
TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST])
# Now that we have resolved CXX ourself, let autoconf have it's go at it
AC_PROG_CXX([$CXX])
### Locate other tools
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
AC_PROG_OBJC
SET_FULL_PATH(OBJC)
BASIC_FIXUP_EXECUTABLE(OBJC)
else
OBJC=
fi
@ -270,20 +289,26 @@ AC_SUBST(LDCXX)
# Linking C++ executables.
AC_SUBST(LDEXECXX)
if test "x$OPENJDK_BUILD_OS" != xwindows; then
if test "x$OPENJDK_TARGET_OS" != xwindows; then
AC_CHECK_TOOL(AR, ar)
SET_FULL_PATH(AR)
BASIC_FIXUP_EXECUTABLE(AR)
fi
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ARFLAGS="-r"
else
ARFLAGS=""
fi
AC_SUBST(ARFLAGS)
# For hotspot, we need these in Windows mixed path; other platforms keep them the same
HOTSPOT_CXX="$CXX"
HOTSPOT_LD="$LD"
AC_SUBST(HOTSPOT_CXX)
AC_SUBST(HOTSPOT_LD)
COMPILER_NAME=gcc
COMPILER_TYPE=CC
AS_IF([test "x$OPENJDK_BUILD_OS" = xwindows], [
AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
# For now, assume that we are always compiling using cl.exe.
CC_OUT_OPTION=-Fo
EXE_OUT_OPTION=-out:
@ -294,7 +319,7 @@ AS_IF([test "x$OPENJDK_BUILD_OS" = xwindows], [
AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
# Since we must ignore the first found link, WINLD will contain
# the full path to the link.exe program.
SET_FULL_PATH_SPACESAFE([WINLD])
BASIC_FIXUP_EXECUTABLE(WINLD)
printf "Windows linker was found at $WINLD\n"
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
"$WINLD" --version > /dev/null
@ -310,12 +335,25 @@ AS_IF([test "x$OPENJDK_BUILD_OS" = xwindows], [
LDEXECXX="$WINLD"
AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
SET_FULL_PATH_SPACESAFE([MT])
BASIC_FIXUP_EXECUTABLE(MT)
# The resource compiler
AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
SET_FULL_PATH_SPACESAFE([RC])
BASIC_FIXUP_EXECUTABLE(RC)
RC_FLAGS="-nologo /l 0x409 /r"
# For hotspot, we need these in Windows mixed path,
# so rewrite them all. Need added .exe suffix.
HOTSPOT_CXX="$CXX.exe"
HOTSPOT_LD="$LD.exe"
HOTSPOT_MT="$MT.exe"
HOTSPOT_RC="$RC.exe"
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
AC_SUBST(HOTSPOT_MT)
AC_SUBST(HOTSPOT_RC)
RC_FLAGS="-nologo -l 0x409 -r"
AS_IF([test "x$VARIANT" = xOPT], [
RC_FLAGS="$RC_FLAGS -d NDEBUG"
])
@ -333,12 +371,12 @@ AS_IF([test "x$OPENJDK_BUILD_OS" = xwindows], [
# lib.exe is used to create static libraries.
AC_CHECK_PROG([WINAR], [lib],[lib],,,)
SET_FULL_PATH_SPACESAFE([WINAR])
BASIC_FIXUP_EXECUTABLE(WINAR)
AR="$WINAR"
ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
SET_FULL_PATH_SPACESAFE([DUMPBIN])
BASIC_FIXUP_EXECUTABLE(DUMPBIN)
COMPILER_TYPE=CL
CCXXFLAGS="$CCXXFLAGS -nologo"
@ -347,10 +385,10 @@ AC_SUBST(RC_FLAGS)
AC_SUBST(COMPILER_TYPE)
AC_PROG_CPP
SET_FULL_PATH(CPP)
BASIC_FIXUP_EXECUTABLE(CPP)
AC_PROG_CXXCPP
SET_FULL_PATH(CXXCPP)
BASIC_FIXUP_EXECUTABLE(CXXCPP)
if test "x$COMPILE_TYPE" != "xcross"; then
# If we are not cross compiling, use the same compilers for
@ -373,43 +411,44 @@ if test "x$OPENJDK_BUILD_OS" = xsolaris; then
fi
# Find the right assembler.
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
AC_PATH_PROG(AS, as)
SET_FULL_PATH(AS)
BASIC_FIXUP_EXECUTABLE(AS)
else
AS="$CC -c"
fi
AC_SUBST(AS)
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
AC_PATH_PROGS(NM, [gnm nm])
SET_FULL_PATH(NM)
BASIC_FIXUP_EXECUTABLE(NM)
AC_PATH_PROG(STRIP, strip)
SET_FULL_PATH(STRIP)
BASIC_FIXUP_EXECUTABLE(STRIP)
AC_PATH_PROG(MCS, mcs)
SET_FULL_PATH(MCS)
elif test "x$OPENJDK_BUILD_OS" != xwindows; then
BASIC_FIXUP_EXECUTABLE(MCS)
elif test "x$OPENJDK_TARGET_OS" != xwindows; then
AC_CHECK_TOOL(NM, nm)
SET_FULL_PATH(NM)
BASIC_FIXUP_EXECUTABLE(NM)
AC_CHECK_TOOL(STRIP, strip)
SET_FULL_PATH(STRIP)
BASIC_FIXUP_EXECUTABLE(STRIP)
fi
###
#
# Check for objcopy
#
# but search for gobjcopy first...
# since I on solaris found a broken objcopy...buhh
#
AC_PATH_TOOL(OBJCOPY, gobjcopy)
if test "x$OBJCOPY" = x; then
AC_PATH_TOOL(OBJCOPY, objcopy)
# objcopy is used for moving debug symbols to separate files when
# full debug symbols are enabled.
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
fi
AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
if test "x$OBJDUMP" != x; then
# Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
BASIC_FIXUP_EXECUTABLE(OBJDUMP)
fi
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
AC_PATH_PROG(LIPO, lipo)
SET_FULL_PATH(LIPO)
BASIC_FIXUP_EXECUTABLE(LIPO)
fi
# Restore old path without tools dir
@ -449,7 +488,7 @@ if test "x$GCC" = xyes; then
POST_STRIP_CMD="$STRIP -g"
# Linking is different on MacOSX
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Might change in the future to clang.
COMPILER_NAME=gcc
SHARED_LIBRARY='lib[$]1.dylib'
@ -463,7 +502,7 @@ if test "x$GCC" = xyes; then
POST_STRIP_CMD="$STRIP -S"
fi
else
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
# If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
COMPILER_NAME=ossc
PICFLAG="-KPIC"
@ -487,7 +526,7 @@ else
POST_STRIP_CMD="$STRIP -x"
POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
fi
if test "x$OPENJDK_BUILD_OS" = xwindows; then
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# If it is not gcc, then assume it is the MS Visual Studio compiler
COMPILER_NAME=cl
PICFLAG=""
@ -626,6 +665,11 @@ case $COMPILER_TYPE in
# Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
#CC_HIGHEST="$CC_HIGHEST -xlibmopt"
if test "x$OPENJDK_TARGET_CPU" = xsparc; then
CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
fi
case $OPENJDK_TARGET_CPU_ARCH in
x86)
C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
@ -642,8 +686,6 @@ case $COMPILER_TYPE in
fi
;;
sparc)
CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
@ -759,7 +801,7 @@ case $COMPILER_NAME in
CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
case $OPENJDK_TARGET_CPU_ARCH in
x86 )
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -Di386"
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
;;
esac
@ -859,7 +901,7 @@ CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
# libraries will link to whatever is in memory. Yuck.
#
# Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
if test "x$COMPILER_TYPE" = xCL; then
if test "x$COMPILER_NAME" = xcl; then
LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
if test "x$OPENJDK_TARGET_CPU" = xx86; then
LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
@ -875,19 +917,23 @@ if test "x$COMPILER_TYPE" = xCL; then
fi
LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
else
# If this is a --hash-style=gnu system, use --hash-style=both, why?
HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
if test -n "$HAS_GNU_HASH"; then
# And since we now know that the linker is gnu, then add -z defs, to forbid
# undefined symbols in object files.
LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both -Xlinker -z -Xlinker defs"
if test "x$DEBUG_LEVEL" == "xrelease"; then
# When building release libraries, tell the linker optimize them.
# Should this be supplied to the OSS linker as well?
LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
if test "x$COMPILER_NAME" = xgcc; then
# If this is a --hash-style=gnu system, use --hash-style=both, why?
HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
if test -n "$HAS_GNU_HASH"; then
LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
fi
if test "x$OPENJDK_TARGET_OS" = xlinux; then
# And since we now know that the linker is gnu, then add -z defs, to forbid
# undefined symbols in object files.
LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
if test "x$DEBUG_LEVEL" = "xrelease"; then
# When building release libraries, tell the linker optimize them.
# Should this be supplied to the OSS linker as well?
LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
fi
fi
fi
LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \

View File

@ -0,0 +1,258 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
[
if test "x$VS_ENV_CMD" = x; then
VS100BASE="$1"
METHOD="$2"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
if test -d "$VS100BASE"; then
if test -f "$VS100BASE/$VCVARSFILE"; then
AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
else
AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
fi
fi
fi
])
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
[
if test "x$VS_ENV_CMD" = x; then
WIN_SDK_BASE="$1"
METHOD="$2"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
if test -d "$WIN_SDK_BASE"; then
if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VS_ENV_ARGS="/x86"
else
VS_ENV_ARGS="/x64"
fi
else
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
fi
fi
fi
])
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
[
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILE="vc/bin/vcvars32.bat"
else
VCVARSFILE="vc/bin/amd64/vcvars64.bat"
fi
VS_ENV_CMD=""
VS_ENV_ARGS=""
if test "x$with_toolsdir" != x; then
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
fi
if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
# Having specified an argument which is incorrect will produce an instant failure;
# we should not go on looking
AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
fi
if test "x$ProgramW6432" != x; then
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
fi
if test "x$PROGRAMW6432" != x; then
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
fi
if test "x$PROGRAMFILES" != x; then
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
fi
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
if test "x$VS100COMNTOOLS" != x; then
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
fi
if test "x$PROGRAMFILES" != x; then
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
fi
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
])
# Check if the VS env variables were setup prior to running configure.
# If not, then find vcvarsall.bat and run it automatically, and integrate
# the set env variables into the spec file.
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
[
# Store path to cygwin link.exe to help excluding it when searching for
# VS linker. This must be done before changing the PATH when looking for VS.
AC_PATH_PROG(CYGWIN_LINK, link)
if test "x$CYGWIN_LINK" != x; then
AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
"$CYGWIN_LINK" --version > /dev/null
if test $? -eq 0 ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
# This might be the VS linker. Don't exclude it later on.
CYGWIN_LINK=""
fi
fi
# First-hand choice is to locate and run the vsvars bat file.
TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
if test "x$VS_ENV_CMD" != x; then
# We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
# Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
cd $OUTPUT_ROOT
# FIXME: The code betweeen ---- was inlined from a separate script and is not properly adapted
# to autoconf standards.
#----
# Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment)
# but calculate the difference in Cygwin environment before/after running it and then
# apply the diff.
if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
_vs10varsall=`cygpath -a -m -s "$VS_ENV_CMD"`
_dosvs10varsall=`cygpath -a -w -s $_vs10varsall`
_dosbash=`cygpath -a -w -s \`which bash\`.*`
else
_dosvs10varsall=`cmd //c echo $VS_ENV_CMD`
_dosbash=`cmd //c echo \`which bash\``
fi
# generate the set of exported vars before/after the vs10 setup
$ECHO "@echo off" > localdevenvtmp.bat
$ECHO "$_dosbash -c \"export -p\" > localdevenvtmp.export0" >> localdevenvtmp.bat
$ECHO "call $_dosvs10varsall $VS_ENV_ARGS" >> localdevenvtmp.bat
$ECHO "$_dosbash -c \"export -p\" > localdevenvtmp.export1" >> localdevenvtmp.bat
# Now execute the newly created bat file.
# The | cat is to stop SetEnv.Cmd to mess with system colors on msys
cmd /c localdevenvtmp.bat | cat
# apply the diff (less some non-vs10 vars named by "!")
$SORT localdevenvtmp.export0 | $GREP -v "!" > localdevenvtmp.export0.sort
$SORT localdevenvtmp.export1 | $GREP -v "!" > localdevenvtmp.export1.sort
$COMM -1 -3 localdevenvtmp.export0.sort localdevenvtmp.export1.sort > localdevenv.sh
# cleanup
$RM localdevenvtmp*
#----
cd $CURDIR
if test ! -s $OUTPUT_ROOT/localdevenv.sh; then
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
AC_MSG_ERROR([Cannot continue])
fi
# Now set all paths and other env variables. This will allow the rest of
# the configure script to find and run the compiler in the proper way.
AC_MSG_NOTICE([Setting extracted environment variables])
. $OUTPUT_ROOT/localdevenv.sh
else
# We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
fi
# At this point, we should have corrent variables in the environment, or we can't continue.
AC_MSG_CHECKING([for Visual Studio variables])
if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then
if test "x$INCLUDE" = x || test "x$LIB" = x; then
AC_MSG_RESULT([present but broken])
AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
else
AC_MSG_RESULT([ok])
VS_INCLUDE="$INCLUDE"
VS_LIB="$LIB"
VS_PATH="$PATH"
AC_SUBST(VS_INCLUDE)
AC_SUBST(VS_LIB)
AC_SUBST(VS_PATH)
fi
else
AC_MSG_RESULT([not found])
if test "x$VS_ENV_CMD" = x; then
AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
else
AC_MSG_NOTICE([Running the extraction script failed.])
fi
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
AC_MSG_ERROR([Cannot continue])
fi
AC_MSG_CHECKING([for msvcr100.dll])
AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
[copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
if test "x$with_msvcr_dll" != x; then
MSVCR_DLL="$with_msvcr_dll"
else
if test "x$VCINSTALLDIR" != x; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1`
else
MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
if test "x$MSVCR_DLL" = x; then
MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1`
fi
fi
if test "x$MSVCR_DLL" != x; then
AC_MSG_NOTICE([msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR])
else
AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR])
fi
fi
if test "x$MSVCR_DLL" = x; then
if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
fi
fi
fi
if test "x$MSVCR_DLL" = x; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find msvcr100.dll !])
fi
AC_MSG_RESULT([$MSVCR_DLL])
BASIC_FIXUP_PATH(MSVCR_DLL)
])

View File

@ -34,3 +34,7 @@ PRODUCT_NAME=OpenJDK
PRODUCT_SUFFIX="Runtime Environment"
JDK_RC_PLATFORM_NAME=Platform
COMPANY_NAME=N/A
# Might need better names for these
MACOSX_BUNDLE_NAME_BASE="OpenJDK"
MACOSX_BUNDLE_ID_BASE="net.java.openjdk"

1249
common/bin/compare.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,957 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This script is not to be run as stand-alone, it should be included from
# compare.sh.
##########################################################################################
# Check that we are run via inclusion from compare.sh and not as stand-alone.
if [ -z "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
echo "Error: This script should not be run as stand-alone. It is included by compare.sh"
exit 1
fi
##########################################################################################
# Diff exceptions
if [ "$OPENJDK_TARGET_OS" = "linux" ] && [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
STRIP_BEFORE_COMPARE="
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
"
ACCEPTED_BIN_DIFF="
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/i386/client/libjvm.so
./jre/lib/i386/libattach.so
./jre/lib/i386/libdt_socket.so
./jre/lib/i386/libhprof.so
./jre/lib/i386/libinstrument.so
./jre/lib/i386/libjava_crw_demo.so
./jre/lib/i386/libjsdt.so
./jre/lib/i386/libmanagement.so
./jre/lib/i386/libnpt.so
./jre/lib/i386/libverify.so
./jre/lib/i386/server/libjvm.so
./bin/appletviewer
./bin/extcheck
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jinfo
./bin/jmap
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/wsgen
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
"
fi
if [ "$OPENJDK_TARGET_OS" = "linux" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
STRIP_BEFORE_COMPARE="
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
"
ACCEPTED_BIN_DIFF="
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/amd64/libattach.so
./jre/lib/amd64/libdt_socket.so
./jre/lib/amd64/libhprof.so
./jre/lib/amd64/libinstrument.so
./jre/lib/amd64/libjava_crw_demo.so
./jre/lib/amd64/libjsdt.so
./jre/lib/amd64/libjsig.so
./jre/lib/amd64/libmanagement.so
./jre/lib/amd64/libnpt.so
./jre/lib/amd64/libsaproc.so
./jre/lib/amd64/libverify.so
./jre/lib/amd64/server/libjsig.so
./jre/lib/amd64/server/libjvm.so
./bin/appletviewer
./bin/extcheck
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jinfo
./bin/jmap
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/wsgen
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
"
fi
if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
STRIP_BEFORE_COMPARE="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/i386/jexec
"
SORT_SYMBOLS="
./jre/lib/i386/client/libjvm.so
./jre/lib/i386/libsaproc.so
./jre/lib/i386/server/libjvm.so
"
SKIP_BIN_DIFF="true"
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/i386/client/libjvm.so
./jre/lib/i386/jli/libjli.so
./jre/lib/i386/libJdbcOdbc.so
./jre/lib/i386/libattach.so
./jre/lib/i386/libawt.so
./jre/lib/i386/libawt_headless.so
./jre/lib/i386/libawt_xawt.so
./jre/lib/i386/libdcpr.so
./jre/lib/i386/libdt_socket.so
./jre/lib/i386/libfontmanager.so
./jre/lib/i386/libhprof.so
./jre/lib/i386/libinstrument.so
./jre/lib/i386/libj2gss.so
./jre/lib/i386/libj2pcsc.so
./jre/lib/i386/libj2pkcs11.so
./jre/lib/i386/libj2ucrypto.so
./jre/lib/i386/libjaas_unix.so
./jre/lib/i386/libjava.so
./jre/lib/i386/libjava_crw_demo.so
./jre/lib/i386/libjawt.so
./jre/lib/i386/libjdwp.so
./jre/lib/i386/libjfr.so
./jre/lib/i386/libjpeg.so
./jre/lib/i386/libjsdt.so
./jre/lib/i386/libjsound.so
./jre/lib/i386/libkcms.so
./jre/lib/i386/liblcms.so
./jre/lib/i386/libmanagement.so
./jre/lib/i386/libmlib_image.so
./jre/lib/i386/libnet.so
./jre/lib/i386/libnio.so
./jre/lib/i386/libnpt.so
./jre/lib/i386/libsctp.so
./jre/lib/i386/libsplashscreen.so
./jre/lib/i386/libsunec.so
./jre/lib/i386/libsunwjdga.so
./jre/lib/i386/libt2k.so
./jre/lib/i386/libunpack.so
./jre/lib/i386/libverify.so
./jre/lib/i386/libzip.so
./jre/lib/i386/libdeploy.so
./jre/lib/i386/libjavaplugin.so
./jre/lib/i386/libjavaplugin_jni.so
./jre/lib/i386/libjavaplugin_nscp.so
./jre/lib/i386/libjavaplugin_oji.so
./jre/lib/i386/libnpjp2.so
./jre/plugin/i386/ns4/libjavaplugin.so
./jre/plugin/i386/ns7/libjavaplugin_oji.so
./jre/lib/i386/server/libjvm.so
./bin/appletviewer
./bin/extcheck
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/javaws
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jinfo
./bin/jmap
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/unpack200
./bin/wsgen
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/java_vm
./jre/bin/javaws
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
./jre/bin/unpack200
./jre/lib/i386/jexec
"
SKIP_FULLDUMP_DIFF="true"
# Filter random C++ symbol strings.
DIS_DIFF_FILTER="$SED -e s/\.[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g"
fi
if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
STRIP_BEFORE_COMPARE="
./demo/jni/Poller/lib/amd64/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/amd64/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/amd64/libgctest.so
./demo/jvmti/heapTracker/lib/amd64/libheapTracker.so
./demo/jvmti/heapViewer/lib/amd64/libheapViewer.so
./demo/jvmti/hprof/lib/amd64/libhprof.so
./demo/jvmti/minst/lib/amd64/libminst.so
./demo/jvmti/mtrace/lib/amd64/libmtrace.so
./demo/jvmti/versionCheck/lib/amd64/libversionCheck.so
./demo/jvmti/waiters/lib/amd64/libwaiters.so
"
SORT_SYMBOLS="
./jre/lib/amd64/server/libjvm.so
./jre/lib/amd64/libsaproc.so
"
SKIP_BIN_DIFF="true"
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jni/Poller/lib/amd64/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/amd64/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/amd64/libgctest.so
./demo/jvmti/heapTracker/lib/amd64/libheapTracker.so
./demo/jvmti/heapViewer/lib/amd64/libheapViewer.so
./demo/jvmti/hprof/lib/amd64/libhprof.so
./demo/jvmti/minst/lib/amd64/libminst.so
./demo/jvmti/mtrace/lib/amd64/libmtrace.so
./demo/jvmti/versionCheck/lib/amd64/libversionCheck.so
./demo/jvmti/waiters/lib/amd64/libwaiters.so
./jre/lib/amd64/jli/libjli.so
./jre/lib/amd64/libJdbcOdbc.so
./jre/lib/amd64/libattach.so
./jre/lib/amd64/libawt.so
./jre/lib/amd64/libawt_headless.so
./jre/lib/amd64/libawt_xawt.so
./jre/lib/amd64/libdcpr.so
./jre/lib/amd64/libdt_socket.so
./jre/lib/amd64/libfontmanager.so
./jre/lib/amd64/libhprof.so
./jre/lib/amd64/libinstrument.so
./jre/lib/amd64/libj2gss.so
./jre/lib/amd64/libj2pcsc.so
./jre/lib/amd64/libj2pkcs11.so
./jre/lib/amd64/libj2ucrypto.so
./jre/lib/amd64/libjaas_unix.so
./jre/lib/amd64/libjava.so
./jre/lib/amd64/libjava_crw_demo.so
./jre/lib/amd64/libjawt.so
./jre/lib/amd64/libjdwp.so
./jre/lib/amd64/libjfr.so
./jre/lib/amd64/libjpeg.so
./jre/lib/amd64/libjsdt.so
./jre/lib/amd64/libjsound.so
./jre/lib/amd64/libkcms.so
./jre/lib/amd64/liblcms.so
./jre/lib/amd64/libmanagement.so
./jre/lib/amd64/libmlib_image.so
./jre/lib/amd64/libnet.so
./jre/lib/amd64/libnio.so
./jre/lib/amd64/libnpt.so
./jre/lib/amd64/libsctp.so
./jre/lib/amd64/libsplashscreen.so
./jre/lib/amd64/libsunec.so
./jre/lib/amd64/libsunwjdga.so
./jre/lib/amd64/libt2k.so
./jre/lib/amd64/libunpack.so
./jre/lib/amd64/libverify.so
./jre/lib/amd64/libzip.so
./jre/lib/amd64/server/64/libjvm_db.so
./jre/lib/amd64/server/64/libjvm_dtrace.so
./bin/amd64/appletviewer
./bin/amd64/extcheck
./bin/amd64/idlj
./bin/amd64/jar
./bin/amd64/jarsigner
./bin/amd64/java
./bin/amd64/javac
./bin/amd64/javadoc
./bin/amd64/javah
./bin/amd64/javap
./bin/amd64/jcmd
./bin/amd64/jconsole
./bin/amd64/jdb
./bin/amd64/jhat
./bin/amd64/jinfo
./bin/amd64/jmap
./bin/amd64/jps
./bin/amd64/jrunscript
./bin/amd64/jsadebugd
./bin/amd64/jstack
./bin/amd64/jstat
./bin/amd64/jstatd
./bin/amd64/keytool
./bin/amd64/native2ascii
./bin/amd64/orbd
./bin/amd64/pack200
./bin/amd64/policytool
./bin/amd64/rmic
./bin/amd64/rmid
./bin/amd64/rmiregistry
./bin/amd64/schemagen
./bin/amd64/serialver
./bin/amd64/servertool
./bin/amd64/tnameserv
./bin/amd64/unpack200
./bin/amd64/wsgen
./bin/amd64/wsimport
./bin/amd64/xjc
./jre/bin/amd64/java
./jre/bin/amd64/keytool
./jre/bin/amd64/orbd
./jre/bin/amd64/pack200
./jre/bin/amd64/policytool
./jre/bin/amd64/rmid
./jre/bin/amd64/rmiregistry
./jre/bin/amd64/servertool
./jre/bin/amd64/tnameserv
./jre/bin/amd64/unpack200
./jre/lib/amd64/jexec
"
SKIP_FULLDUMP_DIFF="true"
# Filter random C++ symbol strings.
DIS_DIFF_FILTER="$SED -e s/\.[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g"
fi
if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparc" ]; then
STRIP_BEFORE_COMPARE="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/sparc/jexec
"
SORT_SYMBOLS="
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/sparc/client/64/libjvm_db.so
./jre/lib/sparc/client/64/libjvm_dtrace.so
./jre/lib/sparc/client/libjsig.so
./jre/lib/sparc/client/libjvm.so
./jre/lib/sparc/client/libjvm_db.so
./jre/lib/sparc/client/libjvm_dtrace.so
./jre/lib/sparc/libjsig.so
./jre/lib/sparc/libsaproc.so
./jre/lib/sparc/server/64/libjvm_db.so
./jre/lib/sparc/server/64/libjvm_dtrace.so
./jre/lib/sparc/server/libjsig.so
./jre/lib/sparc/server/libjvm.so
./jre/lib/sparc/server/libjvm_db.so
./jre/lib/sparc/server/libjvm_dtrace.so
"
SKIP_BIN_DIFF="true"
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/hprof/lib/libhprof.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./jre/lib/sparc/client/libjvm.so
./jre/lib/sparc/jli/libjli.so
./jre/lib/sparc/libJdbcOdbc.so
./jre/lib/sparc/libattach.so
./jre/lib/sparc/libawt.so
./jre/lib/sparc/libawt_headless.so
./jre/lib/sparc/libawt_xawt.so
./jre/lib/sparc/libdcpr.so
./jre/lib/sparc/libdt_socket.so
./jre/lib/sparc/libfontmanager.so
./jre/lib/sparc/libhprof.so
./jre/lib/sparc/libinstrument.so
./jre/lib/sparc/libj2gss.so
./jre/lib/sparc/libj2pcsc.so
./jre/lib/sparc/libj2pkcs11.so
./jre/lib/sparc/libj2ucrypto.so
./jre/lib/sparc/libjaas_unix.so
./jre/lib/sparc/libjava.so
./jre/lib/sparc/libjava_crw_demo.so
./jre/lib/sparc/libjawt.so
./jre/lib/sparc/libjdwp.so
./jre/lib/sparc/libjfr.so
./jre/lib/sparc/libjpeg.so
./jre/lib/sparc/libjsdt.so
./jre/lib/sparc/libjsound.so
./jre/lib/sparc/libkcms.so
./jre/lib/sparc/liblcms.so
./jre/lib/sparc/libmanagement.so
./jre/lib/sparc/libmlib_image.so
./jre/lib/sparc/libmlib_image_v.so
./jre/lib/sparc/libnet.so
./jre/lib/sparc/libnio.so
./jre/lib/sparc/libnpt.so
./jre/lib/sparc/libsctp.so
./jre/lib/sparc/libsplashscreen.so
./jre/lib/sparc/libsunec.so
./jre/lib/sparc/libsunwjdga.so
./jre/lib/sparc/libt2k.so
./jre/lib/sparc/libunpack.so
./jre/lib/sparc/libverify.so
./jre/lib/sparc/libzip.so
./jre/lib/sparc/libdeploy.so
./jre/lib/sparc/libjavaplugin.so
./jre/lib/sparc/libjavaplugin_jni.so
./jre/lib/sparc/libjavaplugin_nscp.so
./jre/lib/sparc/libjavaplugin_oji.so
./jre/lib/sparc/libnpjp2.so
./jre/plugin/sparc/ns4/libjavaplugin.so
./jre/plugin/sparc/ns7/libjavaplugin_oji.so
./jre/lib/sparc/server/libjvm.so
./bin/appletviewer
./bin/extcheck
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/javaws
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jinfo
./bin/jmap
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/unpack200
./bin/wsgen
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/java_vm
./jre/bin/javaws
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
./jre/bin/unpack200
./jre/lib/sparc/jexec
"
# Filter random C++ symbol strings.
# Some numbers differ randomly.
DIS_DIFF_FILTER="$SED -e s/\$[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g -e s/\([0-9a-f][0-9a-f].[0-9a-f][0-9a-f].[0-9a-f][0-9a-f].\)[0-9a-f][0-9a-f]/\1<NUM>/g -e s/\(%g1,.0x\)[0-9a-f]*\(,.%g1\)/\1<HEX>\2/g -e s/\(!.\)[0-9a-f]*\(.<SUNWprivate_1.1+0x\)[0-9a-f]*/\1<NUM>\2<HEX>/g"
# Some xor instructions end up with different args in the lib but not in the object files.
ACCEPTED_DIS_DIFF="
./demo/jvmti/waiters/lib/libwaiters.so
"
SKIP_FULLDUMP_DIFF="true"
fi
if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then
STRIP_BEFORE_COMPARE="
./demo/jni/Poller/lib/sparcv9/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/sparcv9/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/sparcv9/libgctest.so
./demo/jvmti/heapTracker/lib/sparcv9/libheapTracker.so
./demo/jvmti/heapViewer/lib/sparcv9/libheapViewer.so
./demo/jvmti/hprof/lib/sparcv9/libhprof.so
./demo/jvmti/minst/lib/sparcv9/libminst.so
./demo/jvmti/mtrace/lib/sparcv9/libmtrace.so
./demo/jvmti/versionCheck/lib/sparcv9/libversionCheck.so
./demo/jvmti/waiters/lib/sparcv9/libwaiters.so
"
SORT_SYMBOLS="
./demo/jvmti/waiters/lib/sparcv9/libwaiters.so
./jre/lib/sparcv9/libjsig.so
./jre/lib/sparcv9/libsaproc.so
./jre/lib/sparcv9/server/libjvm.so
./jre/lib/sparcv9/server/libjvm_dtrace.so
"
SKIP_BIN_DIFF="true"
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jni/Poller/lib/sparcv9/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/sparcv9/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/sparcv9/libgctest.so
./demo/jvmti/heapTracker/lib/sparcv9/libheapTracker.so
./demo/jvmti/heapViewer/lib/sparcv9/libheapViewer.so
./demo/jvmti/hprof/lib/sparcv9/libhprof.so
./demo/jvmti/minst/lib/sparcv9/libminst.so
./demo/jvmti/mtrace/lib/sparcv9/libmtrace.so
./demo/jvmti/versionCheck/lib/sparcv9/libversionCheck.so
./demo/jvmti/waiters/lib/sparcv9/libwaiters.so
./jre/lib/sparcv9/client/libjvm.so
./jre/lib/sparcv9/jli/libjli.so
./jre/lib/sparcv9/libJdbcOdbc.so
./jre/lib/sparcv9/libattach.so
./jre/lib/sparcv9/libawt.so
./jre/lib/sparcv9/libawt_headless.so
./jre/lib/sparcv9/libawt_xawt.so
./jre/lib/sparcv9/libdcpr.so
./jre/lib/sparcv9/libdt_socket.so
./jre/lib/sparcv9/libfontmanager.so
./jre/lib/sparcv9/libhprof.so
./jre/lib/sparcv9/libinstrument.so
./jre/lib/sparcv9/libj2gss.so
./jre/lib/sparcv9/libj2pcsc.so
./jre/lib/sparcv9/libj2pkcs11.so
./jre/lib/sparcv9/libj2ucrypto.so
./jre/lib/sparcv9/libjaas_unix.so
./jre/lib/sparcv9/libjava.so
./jre/lib/sparcv9/libjava_crw_demo.so
./jre/lib/sparcv9/libjawt.so
./jre/lib/sparcv9/libjdwp.so
./jre/lib/sparcv9/libjfr.so
./jre/lib/sparcv9/libjpeg.so
./jre/lib/sparcv9/libjsdt.so
./jre/lib/sparcv9/libjsound.so
./jre/lib/sparcv9/libkcms.so
./jre/lib/sparcv9/liblcms.so
./jre/lib/sparcv9/libmanagement.so
./jre/lib/sparcv9/libmlib_image.so
./jre/lib/sparcv9/libmlib_image_v.so
./jre/lib/sparcv9/libnet.so
./jre/lib/sparcv9/libnio.so
./jre/lib/sparcv9/libnpt.so
./jre/lib/sparcv9/libsctp.so
./jre/lib/sparcv9/libsplashscreen.so
./jre/lib/sparcv9/libsunec.so
./jre/lib/sparcv9/libsunwjdga.so
./jre/lib/sparcv9/libt2k.so
./jre/lib/sparcv9/libunpack.so
./jre/lib/sparcv9/libverify.so
./jre/lib/sparcv9/libzip.so
./jre/lib/sparcv9/server/libjvm.so
./bin/sparcv9/appletviewer
./bin/sparcv9/extcheck
./bin/sparcv9/idlj
./bin/sparcv9/jar
./bin/sparcv9/jarsigner
./bin/sparcv9/java
./bin/sparcv9/javac
./bin/sparcv9/javadoc
./bin/sparcv9/javah
./bin/sparcv9/javap
./bin/sparcv9/jcmd
./bin/sparcv9/jconsole
./bin/sparcv9/jdb
./bin/sparcv9/jhat
./bin/sparcv9/jinfo
./bin/sparcv9/jmap
./bin/sparcv9/jps
./bin/sparcv9/jrunscript
./bin/sparcv9/jsadebugd
./bin/sparcv9/jstack
./bin/sparcv9/jstat
./bin/sparcv9/jstatd
./bin/sparcv9/keytool
./bin/sparcv9/native2ascii
./bin/sparcv9/orbd
./bin/sparcv9/pack200
./bin/sparcv9/policytool
./bin/sparcv9/rmic
./bin/sparcv9/rmid
./bin/sparcv9/rmiregistry
./bin/sparcv9/schemagen
./bin/sparcv9/serialver
./bin/sparcv9/servertool
./bin/sparcv9/tnameserv
./bin/sparcv9/unpack200
./bin/sparcv9/wsgen
./bin/sparcv9/wsimport
./bin/sparcv9/xjc
./jre/bin/sparcv9/java
./jre/bin/sparcv9/keytool
./jre/bin/sparcv9/orbd
./jre/bin/sparcv9/pack200
./jre/bin/sparcv9/policytool
./jre/bin/sparcv9/rmid
./jre/bin/sparcv9/rmiregistry
./jre/bin/sparcv9/servertool
./jre/bin/sparcv9/tnameserv
./jre/bin/sparcv9/unpack200
"
# Filter random C++ symbol strings.
# Some numbers differ randomly.
DIS_DIFF_FILTER="$SED -e s/\$[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g -e s/[0-9a-f][0-9a-f].[0-9a-f][0-9a-f].[0-9a-f][0-9a-f].[0-9a-f][0-9a-f]/<NUMS>/g -e s/\(%g1,.0x\)[0-9a-f]*\(,.%g1\)/\1<HEX>\2/g -e s/\(!.\)[0-9a-f]*\(.<SUNWprivate_1.1+0x\)[0-9a-f]*/\1<NUM>\2<HEX>/g"
# Some xor instructions end up with different args in the lib but not in the object files.
ACCEPTED_DIS_DIFF="
./demo/jvmti/waiters/lib/sparcv9/libwaiters.so
"
SKIP_FULLDUMP_DIFF="true"
fi
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
# Probably should add all libs here
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jvmti/gctest/lib/gctest.dll
./demo/jvmti/heapTracker/lib/heapTracker.dll
./demo/jvmti/minst/lib/minst.dll
./jre/bin/attach.dll
./jre/bin/java_crw_demo.dll
./jre/bin/jsoundds.dll
./bin/appletviewer.exe
./bin/extcheck.exe
./bin/idlj.exe
./bin/jar.exe
./bin/jarsigner.exe
./bin/java-rmi.exe
./bin/java.exe
./bin/javac.exe
./bin/javadoc.exe
./bin/javah.exe
./bin/javap.exe
./bin/javaw.exe
./bin/jcmd.exe
./bin/jconsole.exe
./bin/jdb.exe
./bin/jhat.exe
./bin/jinfo.exe
./bin/jmap.exe
./bin/jps.exe
./bin/jrunscript.exe
./bin/jsadebugd.exe
./bin/jstack.exe
./bin/jstat.exe
./bin/jstatd.exe
./bin/keytool.exe
./bin/kinit.exe
./bin/klist.exe
./bin/ktab.exe
./bin/native2ascii.exe
./bin/orbd.exe
./bin/pack200.exe
./bin/policytool.exe
./bin/rmic.exe
./bin/rmid.exe
./bin/rmiregistry.exe
./bin/schemagen.exe
./bin/serialver.exe
./bin/servertool.exe
./bin/tnameserv.exe
./bin/unpack200.exe
./bin/wsgen.exe
./bin/wsimport.exe
./bin/xjc.exe
./jre/bin/java-rmi.exe
./jre/bin/java.exe
./jre/bin/javaw.exe
./jre/bin/keytool.exe
./jre/bin/kinit.exe
./jre/bin/klist.exe
./jre/bin/ktab.exe
./jre/bin/orbd.exe
./jre/bin/pack200.exe
./jre/bin/policytool.exe
./jre/bin/rmid.exe
./jre/bin/rmiregistry.exe
./jre/bin/servertool.exe
./jre/bin/tnameserv.exe
./jre/bin/unpack200.exe
"
# On windows, there are unavoidable allignment issues making
# a perfect disasm diff impossible. Filter out the following:
# * Random parts of C++ symbols (this is a bit greedy, but does the trick)
# @XXXXX
# * Hexadecimal addresses that are sometimes alligned differently.
# * Dates in version strings XXXX_XX_XX.
DIS_DIFF_FILTER="$SED -e s/[@?][A-Z0-9_]\{1,25\}/<SYM>/g -e s/^.\{2,2\}[0-9A-F]\{16,16\}.\{2,2\}//g -e s/[0-9A-F]\{4,16\}h/<HEXSTR>/g -e s/_[0-9]\{4,4\}_[0-9][0-9]_[0-9][0-9]/<DATE>/g"
SKIP_BIN_DIFF="true"
SKIP_FULLDUMP_DIFF="true"
fi
if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
ACCEPTED_JARZIP_CONTENTS="
/META-INF/INDEX.LIST
"
KNOWN_BIN_DIFF="
./jre/lib/libJObjC.dylib
"
ACCEPTED_BIN_DIFF="
./bin/appletviewer
./bin/extcheck
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jinfo
./bin/jmap
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/wsgen
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
./jre/lib/libsaproc.dylib
./jre/lib/server/libjvm.dylib
"
KNOWN_SIZE_DIFF="
./jre/lib/libJObjC.dylib
"
SORT_SYMBOLS="
./jre/lib/libJObjC.dylib
"
KNOWN_SYM_DIFF="
./jre/lib/libJObjC.dylib
"
KNOWN_ELF_DIFF="
./jre/lib/libJObjC.dylib
"
KNOWN_DIS_DIFF="
./jre/lib/libJObjC.dylib
"
fi

View File

@ -1,335 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# MANUAL
#
# ./common/bin/compareimages.sh old_jdk_image new_jdk_image
#
# Compare the directory structure.
# Compare the filenames in the directories.
# Compare the contents of the zip archives
# Compare the contents of the jar archives
# Compare the native libraries
# Compare the native executables
# Compare the remaining files
#
# ./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]
#
# Compare only the selected subset of the images.
#
# ./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar
#
# Compare only the CodePointIM.jar file
# Can be used to compare zips, libraries and executables.
#
if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image"
echo ""
echo "Compare the directory structure."
echo "Compare the filenames in the directories."
echo "Compare the contents of the zip archives"
echo "Compare the contents of the jar archives"
echo "Compare the native libraries"
echo "Compare the native executables"
echo "Compare the remaining files"
echo ""
echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]"
echo ""
echo "Compare only the selected subset of the images."
echo ""
echo "bash ./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar"
echo ""
echo "Compare only the CodePointIM.jar file"
echo "Can be used to compare zips, libraries and executables."
exit 10
fi
OLD="$1"
NEW="$2"
CMD="$3"
DIFF_RESULT=0
CMP_ZIPS=false
CMP_JARS=false
CMP_LIBS=false
CMP_EXECS=false
CMP_OTHER=false
FILTER="cat"
if [ -n "$CMD" ]; then
case "$CMD" in
zips)
CMP_ZIPS=true
;;
jars)
CMP_JARS=true
;;
libs)
CMP_LIBS=true
;;
execs)
CMP_EXECS=true
;;
other)
CMP_OTHER=true
;;
*)
CMP_ZIPS=true
CMP_JARS=true
CMP_LIBS=true
CMP_EXECS=true
CMP_OTHER=true
FILTER="grep $3"
;;
esac
else
CMP_ZIPS=true
CMP_JARS=true
CMP_LIBS=true
CMP_EXECS=true
CMP_OTHER=true
fi
DIFFJARZIP="/bin/bash `dirname $0`/diffjarzip.sh"
DIFFLIB="/bin/bash `dirname $0`/difflib.sh"
DIFFEXEC="/bin/bash `dirname $0`/diffexec.sh"
export COMPARE_ROOT=/tmp/cimages.$USER
mkdir -p $COMPARE_ROOT
# Load the correct exception list.
case "`uname -s`" in
Linux)
. `dirname $0`/exception_list_linux
;;
esac
echo
echo Comparing $OLD to $NEW
echo
(cd $OLD && find . -type d | sort > $COMPARE_ROOT/from_dirs)
(cd $NEW && find . -type d | sort > $COMPARE_ROOT/to_dirs)
echo -n Directory structure...
if diff $COMPARE_ROOT/from_dirs $COMPARE_ROOT/to_dirs > /dev/null; then
echo Identical!
else
echo Differences found.
DIFF_RESULT=1
# Differences in directories found.
ONLY_OLD=$(diff $COMPARE_ROOT/from_dirs $COMPARE_ROOT/to_dirs | grep '<')
if [ "$ONLY_OLD" ]; then
echo Only in $OLD
echo $ONLY_OLD | sed 's|< ./|\t|g' | sed 's/ /\n/g'
fi
# Differences in directories found.
ONLY_NEW=$(diff $COMPARE_ROOT/from_dirs $COMPARE_ROOT/to_dirs | grep '>')
if [ "$ONLY_NEW" ]; then
echo Only in $NEW
echo $ONLY_NEW | sed 's|> ./|\t|g' | sed 's/ /\n/g'
fi
fi
(cd $OLD && find . -type f | sort > $COMPARE_ROOT/from_files)
(cd $NEW && find . -type f | sort > $COMPARE_ROOT/to_files)
echo -n File names...
if diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files > /dev/null; then
echo Identical!
else
echo Differences found.
DIFF_RESULT=1
# Differences in directories found.
ONLY_OLD=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '<')
if [ "$ONLY_OLD" ]; then
echo Only in $OLD
echo "$ONLY_OLD" | sed 's|< ./| |g'
fi
# Differences in directories found.
ONLY_NEW=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '>')
if [ "$ONLY_NEW" ]; then
echo Only in $NEW
echo "$ONLY_NEW" | sed 's|> ./| |g'
fi
fi
echo -n Permissions...
found=""
for f in `cd $OLD && find . -type f`
do
if [ ! -f ${OLD}/$f ]; then continue; fi
if [ ! -f ${NEW}/$f ]; then continue; fi
OP=`ls -l ${OLD}/$f | awk '{printf("%.10s\n", $1);}'`
NP=`ls -l ${NEW}/$f | awk '{printf("%.10s\n", $1);}'`
if [ "$OP" != "$NP" ]
then
if [ -z "$found" ]; then echo ; found="yes"; fi
printf "\told: ${OP} new: ${NP}\t$f\n"
fi
OF=`cd ${OLD} && file $f`
NF=`cd ${NEW} && file $f`
if [ "$f" = "./src.zip" ]
then
if [ "`echo $OF | grep -ic zip`" -gt 0 -a "`echo $NF | grep -ic zip`" -gt 0 ]
then
# the way we produces zip-files make it so that directories are stored in old file
# but not in new (only files with full-path)
# this makes file-5.09 report them as different
continue;
fi
fi
if [ "$OF" != "$NF" ]
then
if [ -z "$found" ]; then echo ; found="yes"; fi
printf "\tFILE: old: ${OF} new: ${NF}\t$f\n"
fi
done
if [ -z "$found" ]; then echo ; found="yes"; fi
GENERAL_FILES=$(cd $OLD && find . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
! -name "ct.sym" ! -name "*.diz" \
| grep -v "./bin/" | sort | $FILTER)
echo General files...
for f in $GENERAL_FILES
do
if [ -e $NEW/$f ]; then
DIFF_OUT=$(diff $OLD/$f $NEW/$f 2>&1)
if [ -n "$DIFF_OUT" ]; then
echo $f
echo "$DIFF_OUT"
fi
fi
done
if [ "x$CMP_ZIPS" == "xtrue" ]; then
ZIPS=$(cd $OLD && find . -type f -name "*.zip" | sort | $FILTER)
if [ -n "$ZIPS" ]; then
echo Zip files...
for f in $ZIPS
do
$DIFFJARZIP $OLD/$f $NEW/$f $OLD $NEW
if [ "$?" != "0" ]; then
DIFF_RESULT=1
fi
done
fi
fi
if [ "x$CMP_JARS" == "xtrue" ]; then
JARS=$(cd $OLD && find . -type f -name "*.jar" -o -name "ct.sym" | sort | $FILTER)
if [ -n "$JARS" ]; then
echo Jar files...
for f in $JARS
do
DIFFJAR_OUTPUT=`$DIFFJARZIP $OLD/$f $NEW/$f $OLD $NEW`
DIFFJAR_RESULT=$?
if [ "$DIFFJAR_RESULT" != "0" ]; then
for diff in $LIST_DIFF_JAR; do
DIFFJAR_OUTPUT=`echo "$DIFFJAR_OUTPUT" | grep -v "$diff"`
done
if [ "`echo "$DIFFJAR_OUTPUT" | grep -v "Differing files in"`" != "" ]; then
DIFF_RESULT=1
echo "$DIFFJAR_OUTPUT"
fi
fi
done
fi
fi
if [ "x$FILTER" != "xcat" ]; then
VIEW=view
else
VIEW=
fi
if [ "x$CMP_LIBS" == "xtrue" ]; then
LIBS=$(cd $OLD && find . -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' | sort | $FILTER)
if [ -n "$LIBS" ]; then
echo Libraries...
for f in $LIBS
do
DIFFLIB_OUTPUT=`$DIFFLIB $OLD/$f $NEW/$f $OLD $NEW $VIEW`
DIFFLIB_RESULT=$?
if [ "$DIFFLIB_RESULT" = "0" ]; then
:
#echo "OK: $DIFFLIB_OUTPUT"
elif [ "$DIFFLIB_RESULT" = "2" ] && [[ "$LIST_DIFF_SIZE $LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFLIB_OUTPUT"
elif [ "$DIFFLIB_RESULT" = "1" ] && [[ "$LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFLIB_OUTPUT"
else
echo "$DIFFLIB_OUTPUT"
DIFF_RESULT=1
fi
done
fi
fi
if [ "x$CMP_EXECS" == "xtrue" ]; then
if [ $OSTYPE == "cygwin" ]; then
EXECS=$(cd $OLD && find . -type f -name '*.exe' | sort | $FILTER)
else
EXECS=$(cd $OLD && find . -type f -perm -100 \! \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' \) | sort | $FILTER)
fi
if [ -n "$EXECS" ]; then
echo Executables...
for f in $EXECS
do
DIFFEXEC_OUTPUT=`$DIFFEXEC $OLD/$f $NEW/$f $OLD $NEW $VIEW`
DIFFEXEC_RESULT=$?
if [ "$DIFFEXEC_RESULT" = "0" ]; then
:
#echo "OK: $DIFFEXEC_OUTPUT"
elif [ "$DIFFEXEC_RESULT" = "2" ] && [[ "$LIST_DIFF_SIZE $LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFEXEC_OUTPUT"
elif [ "$DIFFEXEC_RESULT" = "1" ] && [[ "$LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFEXEC_OUTPUT"
else
echo "$DIFFEXEC_OUTPUT"
DIFF_RESULT=1
fi
done
fi
fi
exit $DIFF_RESULT

View File

@ -1,186 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
if [ $# -lt 2 ]
then
echo "Diff two executables. Return codes:"
echo "0 - no diff"
echo "1 - Identical symbols AND size, BUT not bytewise identical"
echo "2 - Identical symbols BUT NEW size"
echo "3 - Differences, content BUT SAME size"
echo "4 - Differences, content AND size"
echo "10 - Could not perform diff"
echo "Use 'quiet' to disable any output."
echo "Syntax: $0 file1 file2 [quiet]"
exit 10
fi
if [ ! -f $1 ]
then
echo $1 does not exist
exit 10
fi
if [ ! -f $2 ]
then
echo $2 does not exist
exit 10
fi
if [ "`uname`" == "SunOS" ]; then
if [ -f "`which nm`" ]; then
NM=nm
elif [ -f "`which gnm`" ]; then
NM=gnm
else
echo "No nm command found"
exit 10
fi
LDD=ldd
elif [ $OSTYPE == "cygwin" ]; then
NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
NM_ARGS=/exports
LDD=
elif [ "`uname`" == "Darwin" ]; then
NM=nm
LDD="otool -L"
else
NM=nm
LDD=ldd
fi
# Should the differences be viewed?
VIEW=
# You can do export DIFF=meld to view
# any differences using meld instead.
if [ -n "$DIFF" ]; then
DIFF="$DIFF"
else
DIFF=diff
fi
OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
OLD_SIZE=$(ls -l "$OLD" | awk '{ print $5 }')
NEW_SIZE=$(ls -l "$NEW" | awk '{ print $5 }')
if [ $# -gt 3 ]
then
ROOT1=$(cd $3 && pwd)
ROOT2=$(cd $4 && pwd)
OLD_NAME=$(echo $OLD | sed "s|$ROOT1/||")
NEW_NAME=$(echo $NEW | sed "s|$ROOT2/||")
if [ "x$5" == "xview" ]; then VIEW=view; fi
else
ROOT1=$(dirname $OLD)/
ROOT2=$(dirname $NEW)/
OLD_NAME=$OLD
NEW_NAME=$NEW
if [ "x$3" == "xview" ]; then VIEW=view; fi
fi
if cmp $OLD $NEW > /dev/null
then
# The files were bytewise identical.
echo Identical: $OLD_NAME
exit 0
fi
OLD_SYMBOLS=$COMPARE_ROOT/$OLD_NAME.old
NEW_SYMBOLS=$COMPARE_ROOT/$NEW_NAME.new
mkdir -p $(dirname $OLD_SYMBOLS)
mkdir -p $(dirname $NEW_SYMBOLS)
if [ $OSTYPE == "cygwin" ]; then
"$NM" $NM_ARGS $OLD | grep " = " > $OLD_SYMBOLS
"$NM" $NM_ARGS $NEW | grep " = " > $NEW_SYMBOLS
"$NM" $NM_ARGS $OLD > $OLD_SYMBOLS.full
"$NM" $NM_ARGS $NEW > $NEW_SYMBOLS.full
else
# Strip the addresses, just compare the ordering of the symbols.
$NM $OLD | cut -f 2- -d ' ' > $OLD_SYMBOLS
$NM $NEW | cut -f 2- -d ' ' > $NEW_SYMBOLS
# But store the full information for easy diff access.
$NM $OLD > $OLD_SYMBOLS.full
$NM $NEW > $NEW_SYMBOLS.full
fi
DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
if [ "${LDD}" ]
then
NAME=`basename $OLD`
TMP=$COMPARE_ROOT/ldd/ldd.${NAME}
rm -rf "${TMP}"
mkdir -p "${TMP}"
(cd "${TMP}" && cp $OLD . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.old | uniq > dep.uniq.old)
(cd "${TMP}" && cp $NEW . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.new | uniq > dep.uniq.new)
(cd "${TMP}" && rm -f ${NAME})
DIFFS_DEP=$(LANG=C diff "${TMP}/dep.old" "${TMP}/dep.new")
DIFFS_UNIQ_DEP=$(LANG=C diff "${TMP}/dep.uniq.old" "${TMP}/dep.uniq.new")
DEP_MSG=
if [ -z "${DIFFS_UNIQ_DEP}" -a -z "${DIFFS_DEP}" ]; then
DEP_MSG="Identical dependencies"
elif [ -z "${DIFFS_UNIQ_DEP}" ]; then
DEP_MSG="Redundant duplicate dependencies added"
RES=1
else
DEP_MSG="DIFFERENT dependencies"
RES=1
fi
fi
RESULT=0
if [ -n "$DIFFS" ]; then
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Differences, content AND size : $DEP_MSG : $OLD_NAME
RESULT=4
else
echo Differences, content BUT SAME size: $DEP_MSG : $OLD_NAME
RESULT=3
fi
if [ "x$VIEW" == "xview" ]; then
LANG=C $DIFF $OLD_SYMBOLS $NEW_SYMBOLS
fi
else
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Identical symbols BUT NEW size : $DEP_MSG : $OLD_NAME
RESULT=2
else
echo Identical symbols AND size, BUT not bytewise identical: $DEP_MSG : $OLD_NAME
RESULT=1
fi
fi
exit $RESULT

View File

@ -1,155 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Simple tool to diff two jar or zip files. It unpacks the jar/zip files and
# reports if files differs and if files are new or missing.
# Assumes gnu diff.
# There are a few source files that have DOS line endings in the
# jaxp/jaxws source drops, when the sources were added to the repository
# the source files were converted to UNIX line endings.
# For now we ignore these differences.
DIFF_FLAGS="--strip-trailing-cr"
#set -x
if [ $# -lt 2 ]
then
echo "Diff two jar/zip files. Return codes: 0 - no diff, 1 - diff, 2 - couldn't perform diff"
echo "Syntax: $0 old_archive new_archive [old_root new_root]"
exit 2
fi
if [ ! -f $1 ]
then
echo $1 does not exist
exit 2
fi
if [ ! -f $2 ]
then
echo $2 does not exist
exit 2
fi
IGNORES="cat"
OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
if [ $# -gt 3 ]
then
ROOT1=$(cd $3 && pwd)
ROOT2=$(cd $4 && pwd)
OLD_NAME=$(echo $OLD | sed "s|$ROOT1/||")
NEW_NAME=$(echo $NEW | sed "s|$ROOT2/||")
if [ $# == 5 ]; then IGNORES="$5"; fi
else
ROOT1=$(dirname $OLD)/
ROOT2=$(dirname $NEW)/
OLD_NAME=$OLD
NEW_NAME=$NEW
if [ $# == 3 ]; then IGNORES="$3"; fi
fi
if [ "`uname`" == "SunOS" ]; then
if [ -f "`which gdiff`" ]; then
DIFF=gdiff
else
DIFF=diff
fi
else
DIFF=diff
fi
OLD_SUFFIX="${OLD##*.}"
NEW_SUFFIX="${NEW##*.}"
if [ "$OLD_SUFFIX" != "$NEW_SUFFIX" ]; then
echo The files do not have the same suffix type!
exit 2
fi
if [ "$OLD_SUFFIX" != "zip" ] && [ "$OLD_SUFFIX" != "jar" ] && [ "$OLD_SUFFIX" != "sym" ]; then
echo The files have to be zip, jar or sym! They are $OLD_SUFFIX
exit 2
fi
UNARCHIVE="unzip -q"
TYPE="$OLD_SUFFIX"
if cmp $OLD $NEW > /dev/null
then
# The files were bytewise identical.
exit 0
fi
# Not quite identical, the might still contain the same data.
# Unpack the jar/zip files in temp dirs
if test "x$COMPARE_ROOT" == "x"; then
COMPARE_ROOT=/tmp/compare_root.$$
REMOVE_COMPARE_ROOT=true
fi
OLD_TEMPDIR=$COMPARE_ROOT/$OLD_NAME.old
NEW_TEMPDIR=$COMPARE_ROOT/$NEW_NAME.new
mkdir -p $OLD_TEMPDIR
mkdir -p $NEW_TEMPDIR
(cd $OLD_TEMPDIR && rm -rf * ; $UNARCHIVE $OLD)
(cd $NEW_TEMPDIR && rm -rf * ; $UNARCHIVE $NEW)
ONLY1=$(LANG=C $DIFF -rq $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $OLD_TEMPDIR")
if [ -n "$ONLY1" ]; then
echo " Only the OLD $OLD_NAME contains:"
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $OLD_TEMPDIR" \
| sed "s|Only in $OLD_TEMPDIR| |"g | sed 's|: |/|g'
fi
ONLY2=$(LANG=C $DIFF -rq $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $NEW_TEMPDIR")
if [ -n "$ONLY2" ]; then
echo " Only the NEW $NEW_NAME contains:"
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $NEW_TEMPDIR" \
| sed "s|Only in $NEW_TEMPDIR| |"g | sed 's|: |/|g'
fi
DIFFTEXT="/bin/bash `dirname $0`/difftext.sh"
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep differ | cut -f 2,4 -d ' ' | \
awk "{ print \"$DIFFTEXT \"\$1\" \"\$2 }" > $COMPARE_ROOT/diffing
/bin/bash $COMPARE_ROOT/diffing > $COMPARE_ROOT/diffs
if [ -s "$COMPARE_ROOT/diffs" ]; then
echo " Differing files in $OLD_NAME"
cat $COMPARE_ROOT/diffs | grep differ | $IGNORES | cut -f 2 -d ' ' | \
sed "s|$OLD_TEMPDIR| |g"
fi
# Clean up
if [ "x$REMOVE_COMPARE_ROOT" == xtrue ]; then
rm -rf $REMOVE_COMPARE_ROOT
fi
exit 1

View File

@ -1,207 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Simple tool to diff two shared libraries.
# Criterias: two shared libraries are considered equal if:
# the file sizes are the same AND the symbols outputs from the nm command are equal
if [ $# -lt 2 ]
then
echo "Diff two shared libs. Return codes:"
echo "0 - no diff"
echo "1 - Identical symbols AND size, BUT not bytewise identical"
echo "2 - Identical symbols BUT NEW size"
echo "3 - Differences, content BUT SAME size"
echo "4 - Differences, content AND size"
echo "10 - Could not perform diff"
echo "Use 'quiet' to disable any output."
echo "Syntax: $0 file1 file2 [quiet]"
exit 10
fi
if [ ! -f $1 ]
then
echo $1 does not exist
exit 10
fi
if [ ! -f $2 ]
then
echo $2 does not exist
exit 10
fi
if [ "`uname`" == "SunOS" ]; then
if [ -f "`which gnm`" ]; then
NM=gnm
# Jonas 2012-05-29: solaris native nm produces radically different output than gnm
# so if using that...we need different filter than "cut -f 2-"
#
elif [ -f "`which nm`" ]; then
NM=nm
else
echo "No nm command found"
exit 10
fi
LDD=ldd
elif [ $OSTYPE == "cygwin" ]; then
NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
NM_ARGS=/exports
LDD=
elif [ "`uname`" == "Darwin" ]; then
NM=nm
LDD="otool -L"
else
NM=nm
LDD=ldd
fi
# Should the differences be viewed?
VIEW=
# You can do export DIFF=meld to view
# any differences using meld instead.
if [ -n "$DIFF" ]; then
DIFF="$DIFF"
else
DIFF=diff
fi
OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
OLD_SIZE=$(ls -l "$OLD" | awk '{ print $5 }')
NEW_SIZE=$(ls -l "$NEW" | awk '{ print $5 }')
if [ $# -gt 3 ]
then
ROOT1=$(cd $3 && pwd)
ROOT2=$(cd $4 && pwd)
OLD_NAME=$(echo $OLD | sed "s|$ROOT1/||")
NEW_NAME=$(echo $NEW | sed "s|$ROOT2/||")
if [ "x$5" == "xview" ]; then VIEW=view; fi
else
ROOT1=$(dirname $OLD)/
ROOT2=$(dirname $NEW)/
OLD_NAME=$OLD
NEW_NAME=$NEW
if [ "x$3" == "xview" ]; then VIEW=view; fi
fi
OLD_SUFFIX="${OLD##*.}"
NEW_SUFFIX="${NEW##*.}"
if [ "$OLD_SUFFIX" != "$NEW_SUFFIX" ]; then
echo The files do not have the same suffix type!
exit 10
fi
if [ "$OLD_SUFFIX" != "so" ] && [ "$OLD_SUFFIX" != "dylib" ] && [ "$OLD_SUFFIX" != "dll" ]; then
echo The files have to be .so, .dylib or .dll! They are $OLD_SUFFIX
exit 10
fi
TYPE="$OLD_SUFFIX"
if cmp $OLD $NEW > /dev/null
then
# The files were bytewise identical.
echo Identical: $OLD_NAME
exit 0
fi
OLD_SYMBOLS=$COMPARE_ROOT/nm.$OLD_NAME.old
NEW_SYMBOLS=$COMPARE_ROOT/nm.$NEW_NAME.new
mkdir -p $(dirname $OLD_SYMBOLS)
mkdir -p $(dirname $NEW_SYMBOLS)
if [ $OSTYPE == "cygwin" ]; then
"$NM" $NM_ARGS $OLD | grep " = " > $OLD_SYMBOLS
"$NM" $NM_ARGS $NEW | grep " = " > $NEW_SYMBOLS
"$NM" $NM_ARGS $OLD > $OLD_SYMBOLS.full
"$NM" $NM_ARGS $NEW > $NEW_SYMBOLS.full
else
# Strip the addresses, just compare the ordering of the symbols.
$NM $OLD | cut -f 2- -d ' ' > $OLD_SYMBOLS
$NM $NEW | cut -f 2- -d ' ' > $NEW_SYMBOLS
# But store the full information for easy diff access.
$NM $OLD > $OLD_SYMBOLS.full
$NM $NEW > $NEW_SYMBOLS.full
fi
DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
RESULT=0
if [ "${LDD}" ]
then
NAME=`basename $OLD`
TMP=$COMPARE_ROOT/ldd/ldd.${NAME}
rm -rf "${TMP}"
mkdir -p "${TMP}"
(cd "${TMP}" && cp $OLD . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.old | uniq > dep.uniq.old)
(cd "${TMP}" && cp $NEW . && ${LDD} ${NAME} | awk '{ print $1;}' | sort | tee dep.new | uniq > dep.uniq.new)
(cd "${TMP}" && rm -f ${NAME})
DIFFS_DEP=$(LANG=C diff "${TMP}/dep.old" "${TMP}/dep.new")
DIFFS_UNIQ_DEP=$(LANG=C diff "${TMP}/dep.uniq.old" "${TMP}/dep.uniq.new")
DEP_MSG=
if [ -z "${DIFFS_UNIQ_DEP}" -a -z "${DIFFS_DEP}" ]; then
DEP_MSG="Identical dependencies"
elif [ -z "${DIFFS_UNIQ_DEP}" ]; then
DEP_MSG="Redundant duplicate dependencies added"
RES=1
else
DEP_MSG="DIFFERENT dependencies"
RES=1
fi
fi
if [ -n "$DIFFS" ]; then
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Differences, content AND size : $DEP_MSG : $OLD_NAME
RESULT=4
else
echo Differences, content BUT SAME size: $DEP_MSG : $OLD_NAME
RESULT=3
fi
if [ "x$VIEW" == "xview" ]; then
LANG=C $DIFF $OLD_SYMBOLS $NEW_SYMBOLS
fi
else
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Identical symbols BUT NEW size : $DEP_MSG : $OLD_NAME
RESULT=2
else
echo Identical symbols AND size, BUT not bytewise identical: $DEP_MSG : $OLD_NAME
RESULT=1
fi
fi
exit $RESULT

View File

@ -1,157 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# The difftext.sh knows how to compare text files and
# ignore some specific differences.
# When difftext.sh is called, we already know that the
# files differ. But if the tests below trigger, then
# we ignore differences caused by:
#
# Timestamps in Java sources generated by idl2java
# Sorting order and cleanup style in .properties files.
OLD="$1"
NEW="$2"
SUF="${OLD##*.}"
TMP=1
if test "x$SUF" == "xjava"; then
TMP=$(LANG=C diff $OLD $NEW | \
grep '^[<>]' | \
sed '/[<>] \* from.*\.idl/d' | \
sed '/[<>] \*.*201[12].*/d' | \
sed '/\/\/ Generated from input file.*/d' | \
sed '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' | \
sed '/\/\/ java GenerateCharacter.*/d')
fi
if test "x$SUF" == "xproperties"; then
cat $OLD | sed -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
-e 's/\\u0020/\x20/g' \
-e 's/\\u003A/\x3A/g' \
-e 's/\\u006B/\x6B/g' \
-e 's/\\u0075/\x75/g' \
-e 's/\\u00A0/\xA0/g' \
-e 's/\\u00A3/\xA3/g' \
-e 's/\\u00B0/\xB0/g' \
-e 's/\\u00B7/\xB7/g' \
-e 's/\\u00BA/\xBA/g' \
-e 's/\\u00BF/\xBF/g' \
-e 's/\\u00C0/\xC0/g' \
-e 's/\\u00C1/\xC1/g' \
-e 's/\\u00C2/\xC2/g' \
-e 's/\\u00C4/\xC4/g' \
-e 's/\\u00C5/\xC5/g' \
-e 's/\\u00C8/\xC8/g' \
-e 's/\\u00C9/\xC9/g' \
-e 's/\\u00CA/\xCA/g' \
-e 's/\\u00CD/\xCD/g' \
-e 's/\\u00CE/\xCE/g' \
-e 's/\\u00D3/\xD3/g' \
-e 's/\\u00D4/\xD4/g' \
-e 's/\\u00D6/\xD6/g' \
-e 's/\\u00DA/\xDA/g' \
-e 's/\\u00DC/\xDC/g' \
-e 's/\\u00DD/\xDD/g' \
-e 's/\\u00DF/\xDF/g' \
-e 's/\\u00E0/\xE0/g' \
-e 's/\\u00E1/\xE1/g' \
-e 's/\\u00E2/\xE2/g' \
-e 's/\\u00E3/\xE3/g' \
-e 's/\\u00E4/\xE4/g' \
-e 's/\\u00E5/\xE5/g' \
-e 's/\\u00E6/\xE6/g' \
-e 's/\\u00E7/\xE7/g' \
-e 's/\\u00E8/\xE8/g' \
-e 's/\\u00E9/\xE9/g' \
-e 's/\\u00EA/\xEA/g' \
-e 's/\\u00EB/\xEB/g' \
-e 's/\\u00EC/\xEC/g' \
-e 's/\\u00ED/\xED/g' \
-e 's/\\u00EE/\xEE/g' \
-e 's/\\u00EF/\xEF/g' \
-e 's/\\u00F1/\xF1/g' \
-e 's/\\u00F2/\xF2/g' \
-e 's/\\u00F3/\xF3/g' \
-e 's/\\u00F4/\xF4/g' \
-e 's/\\u00F5/\xF5/g' \
-e 's/\\u00F6/\xF6/g' \
-e 's/\\u00F9/\xF9/g' \
-e 's/\\u00FA/\xFA/g' \
-e 's/\\u00FC/\xFC/g' \
-e 's/\\u0020/\x20/g' \
-e 's/\\u003f/\x3f/g' \
-e 's/\\u006f/\x6f/g' \
-e 's/\\u0075/\x75/g' \
-e 's/\\u00a0/\xa0/g' \
-e 's/\\u00a3/\xa3/g' \
-e 's/\\u00b0/\xb0/g' \
-e 's/\\u00ba/\xba/g' \
-e 's/\\u00bf/\xbf/g' \
-e 's/\\u00c1/\xc1/g' \
-e 's/\\u00c4/\xc4/g' \
-e 's/\\u00c5/\xc5/g' \
-e 's/\\u00c8/\xc8/g' \
-e 's/\\u00c9/\xc9/g' \
-e 's/\\u00ca/\xca/g' \
-e 's/\\u00cd/\xcd/g' \
-e 's/\\u00d6/\xd6/g' \
-e 's/\\u00dc/\xdc/g' \
-e 's/\\u00dd/\xdd/g' \
-e 's/\\u00df/\xdf/g' \
-e 's/\\u00e0/\xe0/g' \
-e 's/\\u00e1/\xe1/g' \
-e 's/\\u00e2/\xe2/g' \
-e 's/\\u00e3/\xe3/g' \
-e 's/\\u00e4/\xe4/g' \
-e 's/\\u00e5/\xe5/g' \
-e 's/\\u00e7/\xe7/g' \
-e 's/\\u00e8/\xe8/g' \
-e 's/\\u00e9/\xe9/g' \
-e 's/\\u00ea/\xea/g' \
-e 's/\\u00eb/\xeb/g' \
-e 's/\\u00ec/\xec/g' \
-e 's/\\u00ed/\xed/g' \
-e 's/\\u00ee/\xee/g' \
-e 's/\\u00ef/\xef/g' \
-e 's/\\u00f0/\xf0/g' \
-e 's/\\u00f1/\xf1/g' \
-e 's/\\u00f2/\xf2/g' \
-e 's/\\u00f3/\xf3/g' \
-e 's/\\u00f4/\xf4/g' \
-e 's/\\u00f5/\xf5/g' \
-e 's/\\u00f6/\xf6/g' \
-e 's/\\u00f7/\xf7/g' \
-e 's/\\u00f8/\xf8/g' \
-e 's/\\u00f9/\xf9/g' \
-e 's/\\u00fa/\xfa/g' \
-e 's/\\u00fc/\xfc/g' \
-e 's/\\u00ff/\xff/g' \
| sed -e '/^#/d' -e '/^$/d' \
-e :a -e '/\\$/N; s/\\\n//; ta' \
-e 's/^[ \t]*//;s/[ \t]*$//' \
-e 's/\\=/=/' | LANG=C sort > $OLD.cleaned
TMP=$(LANG=C diff $OLD.cleaned $NEW)
fi
if test -n "$TMP"; then
echo Files $OLD and $NEW differ
fi

View File

@ -1,114 +0,0 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# List of files inside jar archives that are ok if they differ.
LIST_DIFF_JAR="
/sun/misc/Version.class
/sun/tools/jconsole/Version.class
/com/sun/tools/javac/resources/version.class
/com/sun/tools/javah/resources/version.class
/com/sun/tools/javap/resources/version.class
"
# List of binaries that only need to match symbols
LIST_DIFF_SIZE="
jre/lib/amd64/libfontmanager.so
jre/lib/amd64/libjdwp.so
jre/lib/amd64/libt2k.so
bin/unpack200
jre/bin/unpack200
jre/lib/amd64/libjsig.debuginfo
jre/lib/amd64/libsaproc.debuginfo
jre/lib/amd64/server/libjvm.debuginfo
"
# List of binares that need to match both symbols and size
LIST_DIFF_BYTE="
jre/lib/amd64/libdt_socket.so
jre/lib/amd64/libattach.so
jre/lib/amd64/libjaas_unix.so
jre/lib/amd64/libjawt.so
jre/lib/amd64/libjpeg.so
jre/lib/amd64/libjsdt.so
jre/lib/amd64/libjsig.so
jre/lib/amd64/libsaproc.so
jre/lib/amd64/libsctp.so
jre/lib/amd64/libsunec.so
jre/lib/amd64/libunpack.so
jre/lib/amd64/libverify.so
jre/lib/amd64/libzip.so
jre/lib/amd64/server/libjsig.so
jre/lib/amd64/server/libjvm.so
jre/lib/amd64/liblcms.so
demo/jvmti/heapTracker/lib/libheapTracker.so
demo/jvmti/hprof/lib/libhprof.so
demo/jvmti/minst/lib/libminst.so
demo/jvmti/mtrace/lib/libmtrace.so
demo/jvmti/waiters/lib/libwaiters.so
bin/appletviewer
bin/extcheck
bin/idlj
bin/jar
bin/jarsigner
bin/java
bin/javac
bin/javadoc
bin/javah
bin/javap
bin/jcmd
bin/jconsole
bin/jdb
bin/jhat
bin/jinfo
bin/jmap
bin/jps
bin/jrunscript
bin/jsadebugd
bin/jstack
bin/jstat
bin/jstatd
bin/keytool
bin/native2ascii
bin/orbd
bin/pack200
bin/policytool
bin/rmic
bin/rmid
bin/rmiregistry
bin/schemagen
bin/serialver
bin/servertool
bin/tnameserv
bin/wsgen
bin/wsimport
bin/xjc
jre/bin/java
jre/bin/keytool
jre/bin/orbd
jre/bin/pack200
jre/bin/policytool
jre/bin/rmid
jre/bin/rmiregistry
jre/bin/servertool
jre/bin/tnameserv
"

View File

@ -1,53 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Must be bash, but that is ok since we are running from cygwin.
# The first argument is the vcvarsall.bat file to run.
# The second argument is the arch arg to give to vcvars.
VCVARSALL="$1"
ARCH_ARG="$2"
# Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment)
# but calculate the difference in Cygwin environment before/after running it and then
# apply the diff.
_vs10varsall=`cygpath -a -m -s "$VCVARSALL"`
_dosvs10varsall=`cygpath -a -w -s $_vs10varsall`
_dosbash=`cygpath -a -w -s \`which bash\`.*`
# generate the set of exported vars before/after the vs10 setup
echo "@echo off" > localdevenvtmp.bat
echo "$_dosbash -c \"export -p\" > localdevenvtmp.export0" >> localdevenvtmp.bat
echo "call $_dosvs10varsall $ARCH_ARG" >> localdevenvtmp.bat
echo "$_dosbash -c \"export -p\" > localdevenvtmp.export1" >> localdevenvtmp.bat
cmd /c localdevenvtmp.bat
# apply the diff (less some non-vs10 vars named by "!")
sort localdevenvtmp.export0 |grep -v "!" > localdevenvtmp.export0.sort
sort localdevenvtmp.export1 |grep -v "!" > localdevenvtmp.export1.sort
comm -1 -3 localdevenvtmp.export0.sort localdevenvtmp.export1.sort > localdevenv.sh
cat localdevenv.sh | sed 's/declare -x /export /g' | sed 's/="/:="/g' | sed 's/\\\\/\\/g' | sed 's/"//g' | \
sed 's/#/\$\(HASH\)/g' > localdevenv.gmk
# cleanup
rm -f localdevenvtmp*

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

View File

@ -0,0 +1,47 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Usage: sh shell-tracer.sh <TIME_CMD> <OUTPUT_FILE> <OLD_SHELL> <shell command line>
#
# This shell script is supposed to be set as a replacement for SHELL in make,
# causing it to be called whenever make wants to execute shell commands.
# The <shell command line> is suitable for passing on to the old shell,
# typically beginning with -c.
#
# This script will make sure the shell command line is executed with
# OLD_SHELL -x, and it will also store a simple log of the the time it takes to
# execute the command in the OUTPUT_FILE, using the "time" utility as pointed
# to by TIME_CMD. If TIME_CMD is "-", no timestamp will be stored.
TIME_CMD="$1"
OUTPUT_FILE="$2"
OLD_SHELL="$3"
shift
shift
shift
if [ "$TIME_CMD" != "-" ]; then
"$TIME_CMD" -f "[TIME:%E] $*" -a -o "$OUTPUT_FILE" "$OLD_SHELL" -x "$@"
else
"$OLD_SHELL" -x "$@"
fi

View File

@ -36,9 +36,12 @@ include MakeBase.gmk
default: all
# Get all files except .hg in the hotspot directory.
HOTSPOT_FILES := $(shell $(FIND) $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
HOTSPOT_FILES := $(shell $(FIND) -L $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
# The old build creates hotspot output dir before calling hotspot and
# not doing it breaks builds on msys.
$(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
$(TOUCH) $@

View File

@ -59,7 +59,7 @@ define add_idl_package
$(MKDIR) -p $3/$$($4_TMPDIR)
$(RM) -rf $3/$$($4_TMPDIR)
$(MKDIR) -p $(dir $5)
$(ECHO) Compiling IDL $(patsubst $2/%,%,$4)
$(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4)
$8 -td $3/$$($4_TMPDIR) \
-i $2/org/omg/CORBA \
-i $2/org/omg/PortableInterceptor \
@ -79,15 +79,9 @@ define SetupIdlCompilation
# param 1 is for example BUILD_IDLS
# param 2,3,4,5,6,7,8 are named args.
# IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
# Remove any relative addressing in the paths.
$1_SRC := $$(abspath $$($1_SRC))

View File

@ -50,27 +50,17 @@ define SetupJavaCompiler
# 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.
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
ifeq ($$(ENABLE_SJAVAC),yes)
# The port file contains the tcp/ip on which the server listens
# and the cookie necessary to talk to the server.
$1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
# You can use a different JVM to run the background javac server.
ifeq ($$($1_SERVER_JVM),)
# It defaults to the same JVM that is used to start the javac command.
$1_SERVER_JVM:=$$($1_JVM)
endif
# Set the $1_REMOTE to spawn a background javac server.
$1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(SJAVAC_SERVER_CORES),id=$1,javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC))))
# The port file contains the tcp/ip on which the server listens
# and the cookie necessary to talk to the server.
$1_SJAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
# You can use a different JVM to run the background javac server.
ifeq ($$($1_SERVER_JVM),)
# It defaults to the same JVM that is used to start the javac command.
$1_SERVER_JVM:=$$($1_JVM)
endif
endef
@ -92,19 +82,11 @@ define SetupArchive
# added to the archive.
# EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
# CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$1_$(strip $(10)))
$(if $(11),$1_$(strip $(11)))
$(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14)))
$(if $(15),$1_$(strip $(15)))
# NOTE: $2 is dependencies, not a named argument!
$(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(findstring $(LOG),debug trace), $(info *[2] <dependencies> = $(strip $2)))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
$1_JARMAIN:=$(strip $$($1_JARMAIN))
@ -125,16 +107,28 @@ define SetupArchive
ifneq (,$$($1_INCLUDES))
$1_GREP_INCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),\
$$(addprefix $$(src)/,$$($1_INCLUDES)))
$$(eval $$(call ListPathsSafelyNow,$1_GREP_INCLUDE_PATTERNS,\n, \
# If there are a lot of include patterns, output to file to shorten command lines
ifeq ($$(word 20,$$($1_GREP_INCLUDE_PATTERNS)),)
$1_GREP_INCLUDES:=| $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS))
else
$$(shell $(RM) $$($1_BIN)/_the.$$($1_JARNAME)_include)
$$(eval $$(call ListPathsSafelyNow,$1_GREP_INCLUDE_PATTERNS,\n, \
>> $$($1_BIN)/_the.$$($1_JARNAME)_include))
$1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include
$1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include
endif
endif
ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES))
$1_GREP_EXCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,\
$$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
$$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \
# If there are a lot of include patterns, output to file to shorten command lines
ifeq ($$(word 20,$$($1_GREP_EXCLUDE_PATTERNS)),)
$1_GREP_EXCLUDES:=| $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS))
else
$$(shell $(RM) $$($1_BIN)/_the.$$($1_JARNAME)_exclude)
$$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \
>> $$($1_BIN)/_the.$$($1_JARNAME)_exclude))
$1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
$1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
endif
endif
# Check if this jar needs to have its index generated.
@ -149,11 +143,13 @@ define SetupArchive
ifneq (,$2)
$1_DEPS:=$2
else
$1_DEPS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \
-a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) && $(ECHO) $$(addprefix $$(src)/,$$($1_EXTRA_FILES)))))
# The subst of \ is needed because $ has to be escaped with \ in EXTRA_FILES for the command
# lines, but not here for use in make dependencies.
$1_DEPS:=$$(shell $(FIND) $$($1_SRCS) -type f -a \( $$($1_FIND_PATTERNS) \) \
$$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES)) \
$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
ifeq (,$$($1_SKIP_METAINF))
$1_DEPS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null))
$1_DEPS+=$$(shell $(FIND) $$(addsuffix /META-INF,$$($1_SRCS)) -type f 2> /dev/null))
endif
endif
@ -161,34 +157,39 @@ define SetupArchive
# The capture contents macro finds all files (matching the patterns, typically
# .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
$1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > $$(src)/_the.$$($1_JARNAME)_contents) && )
$1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' &&\
$(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES))) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
# The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
ifeq (,$$($1_SKIP_METAINF))
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) && )
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE))
endif
# The capture deletes macro finds all deleted files and concatenates them. The resulting file
# tells us what to remove from the jar-file.
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) &&)
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
# The update contents macro updates the jar file with the previously capture contents.
$1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && \
if [ -s _the.$$($1_JARNAME)_contents ]; then \
$(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
fi) &&)
fi) $$(NEWLINE))
# The s-variants of the above macros are used when the jar is created from scratch.
$1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > \
$$(src)/_the.$$($1_JARNAME)_contents) && )
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' &&\
$$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES))) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
ifeq (,$$($1_SKIP_METAINF))
$1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\
($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
$$(src)/_the.$$($1_JARNAME)_contents) && )
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
endif
$1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
(cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
# Use a slightly shorter name for logging, but with enough path to identify this jar.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
@ -208,38 +209,32 @@ define SetupArchive
# Here is the rule that creates/updates the jar file.
$$($1_JAR) : $$($1_DEPS)
$(MKDIR) -p $$($1_BIN)
if [ -n "$$($1_MANIFEST)" ]; then \
$$(if $$($1_MANIFEST),\
$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE); \
else \
$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE); \
fi
if [ -n "$$(strip $$($1_JARMAIN))" ]; then \
$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE); \
fi
if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \
$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \
fi
+if [ -s $$@ ]; then \
$(ECHO) Modifying $$($1_NAME) && \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE) \
,\
$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE))
$$(if $$($1_JARMAIN),$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE))
$$(if $$($1_EXTRA_MANIFEST_ATTR),$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE))
$$(if $$(wildcard $$@),\
$(ECHO) Modifying $$($1_NAME) $$(NEWLINE)\
$$($1_CAPTURE_CONTENTS) \
$$($1_CAPTURE_METAINF) \
$(RM) $$($1_DELETES_FILE) && \
$(RM) $$($1_DELETES_FILE) $$(NEWLINE)\
$$($1_CAPTURE_DELETES) \
$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \
$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) $$(NEWLINE)\
if [ -s $$($1_DELETESS_FILE) ]; then \
$(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
$(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
fi && \
$$($1_UPDATE_CONTENTS) true && \
$$($1_JARINDEX) && true ; \
else \
$(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) && \
fi $$(NEWLINE) \
$$($1_UPDATE_CONTENTS) true $$(NEWLINE) \
$$($1_JARINDEX) && true \
,\
$(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
$$($1_SCAPTURE_CONTENTS) \
$$($1_SCAPTURE_METAINF) \
$$($1_SUPDATE_CONTENTS) \
$$($1_JARINDEX) && true ; \
fi;
$$($1_JARINDEX) && true )
endef
@ -247,15 +242,9 @@ define SetupZipArchive
# param 1 is for example ZIP_MYSOURCE
# param 2,3,4,5,6,7,8,9 are named args.
# SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
# Find all files in the source tree.
$1_SUFFIX_FILTER := $$(patsubst %,-o -name $(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
@ -274,7 +263,7 @@ define SetupZipArchive
ifneq ($$($1_EXCLUDES),)
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRC))
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
@ -288,7 +277,7 @@ define SetupZipArchive
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$(MKDIR) -p $$(@D)
$(ECHO) Updating $$($1_NAME)
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES)))) ;) true
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))))$$(NEWLINE)) true
$(TOUCH) $$@
endef
@ -324,7 +313,7 @@ define add_file_to_copy_and_clean
$$($1_BIN)$$($2_TARGET) : $2
$(MKDIR) -p $$(@D)
$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
| $(SED) -f "$(SRC_ROOT)/common/bin/unicode2x.sed" \
| $(SED) -f "$(SRC_ROOT)/common/makefiles/support/unicode2x.sed" \
| $(SED) -e '/^#/d' -e '/^$$$$/d' \
-e :a -e '/\\$$$$/N; s/\\\n//; ta' \
-e 's/^[ \t]*//;s/[ \t]*$$$$//' \
@ -364,36 +353,27 @@ define SetupJavaCompilation
# Its only here until we cleanup some nasty source code pasta in the jdk.
# HEADERS:=path to directory where all generated c-headers are written.
# DEPENDS:=Extra dependecy
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$1_$(strip $(10)))
$(if $(11),$1_$(strip $(11)))
$(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14)))
$(if $(15),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
# Extract the info from the java compiler setup.
$1_REMOTE := $$($$($1_SETUP)_REMOTE)
$1_JVM := $$($$($1_SETUP)_JVM)
$1_JAVAC := $$($$($1_SETUP)_JAVAC)
$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
ifeq ($$($1_JAVAC),)
$$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
endif
$1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
$1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
# Handle addons and overrides.
$1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
# Make sure the dirs exist.
$$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN))
$$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d)))
$$(eval $$(call MakeDir,$$($1_BIN)))
# Find all files in the source trees.
$1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f)))
$1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(shell $(FIND) $$($1_SRC) -type f))
# Extract the java files.
ifneq ($$($1_EXCLUDE_FILES),)
$1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
@ -428,7 +408,7 @@ define SetupJavaCompilation
# Rewrite list of patterns into a find statement.
$1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY))
# Search for all files to be copied.
$1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f))
$1_ALL_COPIES := $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
# Copy these explicitly
$1_ALL_COPIES += $$($1_COPY_FILES)
# Copy must also respect filters.
@ -442,7 +422,7 @@ define SetupJavaCompilation
$1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
endif
# All files below META-INF are always copied.
$1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null))
$1_ALL_COPIES += $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
ifneq (,$$($1_ALL_COPIES))
# Yep, there are files to be copied!
$1_ALL_COPY_TARGETS:=
@ -456,7 +436,7 @@ define SetupJavaCompilation
# Rewrite list of patterns into a find statement.
$1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
# Search for all files to be copied.
$1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f))
$1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
# Copy and clean must also respect filters.
ifneq (,$$($1_INCLUDES))
$1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
@ -482,30 +462,64 @@ define SetupJavaCompilation
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
endif
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS)
endif
# Create a sed expression to remove the source roots and to replace / with .
# 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'
ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS)
endif
# Using sjavac to compile.
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state
# Create SJAVAC variable,
# expects $1_JAVAC to be "bootclasspathprepend -jar ...javac.jar"
# and it is rewritten into "bootclasspathprepend com.sun.tools.sjavac.Main"
$1_SJAVAC:=$$(word 1,$$($1_JAVAC)) -cp $$(word 3,$$($1_JAVAC)) com.sun.tools.sjavac.Main
# 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_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)
$(MKDIR) -p $$(@D)
$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
$(ECHO) Compiling $1
$$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.sjavac.Main \
$$($1_REMOTE) $$($1_SJAVAC_ARGS) --permit-unidentified-artifacts -mfl $$($1_BIN)/_the.batch.tmp \
($$($1_JVM) $$($1_SJAVAC) \
$$($1_REMOTE) \
-j $(NUM_CORES) \
--permit-unidentified-artifacts \
--permit-sources-without-package \
--compare-found-sources $$($1_BIN)/_the.batch.tmp \
--log=$(LOG) \
$$($1_SJAVAC_ARGS) \
$$($1_FLAGS) \
-implicit:none -d $$($1_BIN) $$($1_HEADERS_ARG)
$$($1_HEADERS_ARG) \
-d $$($1_BIN) && \
$(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
else
# Using plain javac to batch compile everything.
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
# When buliding in batch, put headers in a temp dir to filter out those that actually
# changed before copying them to the real header dir.
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS).tmp
$$($1_HEADERS)/_the.headers: $$($1_BIN)/_the.batch
$(MKDIR) -p $$(@D)
for f in `ls $$($1_HEADERS).tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).tmp/$$$$f`" != "" ]; then \
$(CP) -f $$($1_HEADERS).tmp/$$$$f $$($1_HEADERS)/$$$$f; \
fi; \
done
$(RM) -r $$($1_HEADERS).tmp
$(TOUCH) $$@
$1 += $$($1_HEADERS)/_the.headers
endif
# When not using sjavac, pass along all sources to javac using an @file.
$$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
$(MKDIR) -p $$(@D)
@ -516,6 +530,7 @@ define SetupJavaCompilation
-implicit:none -sourcepath "$$($1_SRCROOTSC)" \
-d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
$(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
endif
# Check if a jar file was specified, then setup the rules for the jar.

208
common/makefiles/Main.gmk Normal file
View File

@ -0,0 +1,208 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
# Now load the spec
include $(SPEC)
# Load the vital tools for all the makefiles.
include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
# Include the corresponding custom file, if present.
-include $(CUSTOM_MAKE_DIR)/Main.gmk
### Clean up from previous run
# Remove any build.log from a previous run, if they exist
ifneq (,$(BUILD_LOG))
ifneq (,$(BUILD_LOG_PREVIOUS))
# Rotate old log
$(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
$(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
else
$(shell $(RM) $(BUILD_LOG) 2> /dev/null)
endif
$(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
endif
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
ifneq (,$(SJAVAC_SERVER_DIR))
$(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
endif
# Reset the build timers.
$(eval $(call ResetAllTimers))
# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
# hence this workaround.
ifeq ($(JOBS),)
JOBS=$(NUM_CORES)
endif
MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
### Main targets
all: jdk
start-make:
@$(call AtMakeStart)
langtools: langtools-only
langtools-only: start-make
@$(call TargetEnter)
@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
@$(call TargetExit)
corba: langtools corba-only
corba-only: start-make
@$(call TargetEnter)
@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
@$(call TargetExit)
jaxp: langtools jaxp-only
jaxp-only: start-make
@$(call TargetEnter)
@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
@$(call TargetExit)
jaxws: langtools jaxp jaxws-only
jaxws-only: start-make
@$(call TargetEnter)
@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
@$(call TargetExit)
hotspot: hotspot-only
hotspot-only: start-make
@$(call TargetEnter)
@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
@$(call TargetExit)
jdk: langtools hotspot corba jaxp jaxws jdk-only
jdk-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
@$(call TargetExit)
demos: jdk demos-only
demos-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
@$(call TargetExit)
images: source-tips demos images-only
images-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
@$(call TargetExit)
overlay-images: source-tips demos overlay-images-only
overlay-images-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
@$(call TargetExit)
bundles: images bundles-only
bundles-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk bundles)
@$(call TargetExit)
install: images install-only
install-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
@$(call TargetExit)
docs: jdk docs-only
docs-only: start-make
@$(call TargetEnter)
@($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
@$(call TargetExit)
bootcycle-images:
@$(ECHO) Boot cycle build step 1: Building the JDK image normally
@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images)
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
test: start-make
@$(call TargetEnter)
@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
@$(call TargetExit)
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
source-tips: $(OUTPUT_ROOT)/source_tips
$(OUTPUT_ROOT)/source_tips: FRC
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(if $(HG),$(call GetSourceTips),$(ECHO) "hg not installed" > $@)
# Remove everything, except the output from configure.
clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
@$(ECHO) Cleaned all build artifacts.
# Remove everything, including configure configuration.
# If the output directory was created by configure and now becomes empty, remove it as well.
# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
dist-clean: clean
@($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp)
@$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
$(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ;\
else \
($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
fi \
)
@$(ECHO) Cleaned everything, you will have to re-run configure.
clean-langtools:
$(call CleanComponent,langtools)
clean-corba:
$(call CleanComponent,corba)
clean-jaxp:
$(call CleanComponent,jaxp)
clean-jaxws:
$(call CleanComponent,jaxws)
clean-hotspot:
$(call CleanComponent,hotspot)
clean-jdk:
$(call CleanComponent,jdk)
clean-images:
$(call CleanComponent,images)
clean-overlay-images:
$(call CleanComponent,overlay-images)
clean-bootcycle-build:
$(call CleanComponent,bootcycle-build)
.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
.PHONY: all test clean dist-clean bootcycle-images start-make
.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
FRC: # Force target

View File

@ -33,129 +33,13 @@
ifndef _MAKEBASE_GMK
_MAKEBASE_GMK := 1
ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
$(error This version of GNU Make is too low ($(MAKE_VERSION)). Please upgrade to 3.81 or newer.)
endif
endif
ifneq (,$(CYGPATH))
# Cygwin styff, if needed but most is going to be
# done in configure!
ifeq (yes,$(CHECK_FOR_VCINSTALLDIR))
ifeq (,$(VCINSTALLDIR))
$(info Could not find compiler paths!)
$(info You probably configured the build from within a)
$(info VS command prompt, but you are not using such a)
$(info prompt right now.)
$(info If you instead run configure from a plain cygwin shell, it)
$(info will attempt to setup VS for you! Please try that.)
$(error Giving up for now.)
endif
endif
endif
# The build times report is turned off by setting REPORT_BUILD_TIMES to nothing.
# This is necessary for the target clean which will erase the
# directories where the buildtimes are stored.
REPORT_BUILD_TIMES=1
# Store the build times in this directory.
BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
# Record starting time for build of a sub repository.
define RecordStartTime
$(MKDIR) -p $(BUILDTIMESDIR)
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
endef
# Indicate that we started to build a sub repository and record starting time.
define MakeStart
$(call RecordStartTime,$1)
$(BUILD_LOG_WRAPPER) $(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n\n" \
"########################################################################" \
"########################################################################" \
"Entering $1 for target(s) $2" \
"########################################################################"
endef
# Record ending time and calculate the difference and store it in a
# easy to read format. Handles builds that cross midnight. Expects
# that a build will never take 24 hours or more.
define RecordEndTime
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
$(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
> $(BUILDTIMESDIR)/build_time_diff_$1
endef
# Check if the current target is the final target, as specified by
# the user on the command line. If so, call PrintEndMessage.
define CheckIfFinished
$(if $(filter $@,$(MAKECMDGOALS)),$(call PrintEndMessage))
# If no taget is given, "all" is default. Check for that, too.
# At most one of the tests can be true.
$(if $(MAKECMDGOALS),,$(if $(filter $@,all),$(call PrintEndMessage)))
endef
# Indicate that we are done.
# Record ending time and print out the total time it took to build.
define MakeFinish
$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,$1),)
$(BUILD_LOG_WRAPPER) $(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s #####\n%s\n\n" \
"########################################################################" \
"Leaving $1 for target(s) $2" \
"########################################################################" \
$(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \
"########################################################################"
$(call CheckIfFinished)
endef
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
$(BUILD_LOG_WRAPPER) $(PRINTF) -- "-- Build times ----------\nTarget %s\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"$1" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
endef
define ResetTimers
$$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*)
endef
define StartTimer
$(call RecordStartTime,TOTAL)
endef
define StopTimer
$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
endef
# Hook to be called as the very first thing when running a normal build
define AtRootMakeStart
$(if $(findstring --jobserver,$(MAKEFLAGS)), $(error make -j is not supported, use make JOBS=n))
$(call PrintStartMessage)
$(call StartTimer)
endef
# Hook to be called as the very last thing for targets that are "top level" targets
define AtRootMakeEnd
$(call StopTimer)
$(call CheckIfFinished)
endef
# If the variable that you want to send to stdout for piping into a file or otherwise,
# is potentially long, for example the a list of file paths, eg a list of all package directories.
# Then you need to use ListPathsSafely, which optimistically splits the output into several shell
# calls as well as use compression on recurrent file paths segments, to get around the potential
# command line length problem that exists in cygwin and other shells.
compress_pre:=$(strip $(shell cat $(SRC_ROOT)/common/makefiles/compress.pre))
compress_post:=$(strip $(shell cat $(SRC_ROOT)/common/makefiles/compress.post))
compress_pre:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-pre-compress.incl))
compress_post:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-post-compress.incl))
compress_paths=$(compress_pre)\
$(subst $(SRC_ROOT),X97,\
$(subst $(OUTPUT_ROOT),X98,\
@ -163,7 +47,7 @@ $(subst X,X00,\
$(subst $(SPACE),\n,$(strip $1)))))\
$(compress_post)
decompress_paths=sed -f $(SRC_ROOT)/common/makefiles/uncompress.sed -e 's|X99|\\n|g' \
decompress_paths=$(SED) -f $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-uncompress.sed -e 's|X99|\\n|g' \
-e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \
-e 's|X00|X|g' | tr '\n' '$2'
@ -181,7 +65,7 @@ endef
# The \n argument means translate spaces into \n
# if instead , , (a space) is supplied, then spaces remain spaces.
define ListPathsSafely
$(if $(word 10001,$($1)),$(error Cannot list safely more than 10000 paths. $1 has $(words $($1)) paths!))
$(if $(word 16001,$($1)),$(error Cannot list safely more than 16000 paths. $1 has $(words $($1)) paths!))
$(call ListPathsSafely_If,$1,$2,1,250)
$(call ListPathsSafely_If,$1,$2,251,500)
$(call ListPathsSafely_If,$1,$2,501,750)
@ -232,6 +116,36 @@ define ListPathsSafely
$(call ListPathsSafely_If,$1,$2,9501,9750)
$(call ListPathsSafely_If,$1,$2,9751,10000)
$(call ListPathsSafely_If,$1,$2,10001,10250)
$(call ListPathsSafely_If,$1,$2,10251,10500)
$(call ListPathsSafely_If,$1,$2,10501,10750)
$(call ListPathsSafely_If,$1,$2,10751,11000)
$(call ListPathsSafely_If,$1,$2,11001,11250)
$(call ListPathsSafely_If,$1,$2,11251,11500)
$(call ListPathsSafely_If,$1,$2,11501,11750)
$(call ListPathsSafely_If,$1,$2,11751,12000)
$(call ListPathsSafely_If,$1,$2,12001,12250)
$(call ListPathsSafely_If,$1,$2,12251,12500)
$(call ListPathsSafely_If,$1,$2,12501,12750)
$(call ListPathsSafely_If,$1,$2,12751,13000)
$(call ListPathsSafely_If,$1,$2,13001,13250)
$(call ListPathsSafely_If,$1,$2,13251,13500)
$(call ListPathsSafely_If,$1,$2,13501,13750)
$(call ListPathsSafely_If,$1,$2,13751,14000)
$(call ListPathsSafely_If,$1,$2,14001,14250)
$(call ListPathsSafely_If,$1,$2,14251,14500)
$(call ListPathsSafely_If,$1,$2,14501,14750)
$(call ListPathsSafely_If,$1,$2,14751,15000)
$(call ListPathsSafely_If,$1,$2,15001,15250)
$(call ListPathsSafely_If,$1,$2,15251,15500)
$(call ListPathsSafely_If,$1,$2,15501,15750)
$(call ListPathsSafely_If,$1,$2,15751,16000)
$(call ListPathsSafely_Printf,$1,$2,$3,1)
$(call ListPathsSafely_Printf,$1,$2,$3,251)
$(call ListPathsSafely_Printf,$1,$2,$3,501)
@ -281,6 +195,36 @@ define ListPathsSafely
$(call ListPathsSafely_Printf,$1,$2,$3,9251)
$(call ListPathsSafely_Printf,$1,$2,$3,9501)
$(call ListPathsSafely_Printf,$1,$2,$3,9751)
$(call ListPathsSafely_Printf,$1,$2,$3,10001)
$(call ListPathsSafely_Printf,$1,$2,$3,10251)
$(call ListPathsSafely_Printf,$1,$2,$3,10501)
$(call ListPathsSafely_Printf,$1,$2,$3,10751)
$(call ListPathsSafely_Printf,$1,$2,$3,11001)
$(call ListPathsSafely_Printf,$1,$2,$3,11251)
$(call ListPathsSafely_Printf,$1,$2,$3,11501)
$(call ListPathsSafely_Printf,$1,$2,$3,11751)
$(call ListPathsSafely_Printf,$1,$2,$3,12001)
$(call ListPathsSafely_Printf,$1,$2,$3,12251)
$(call ListPathsSafely_Printf,$1,$2,$3,12501)
$(call ListPathsSafely_Printf,$1,$2,$3,12751)
$(call ListPathsSafely_Printf,$1,$2,$3,13001)
$(call ListPathsSafely_Printf,$1,$2,$3,13251)
$(call ListPathsSafely_Printf,$1,$2,$3,13501)
$(call ListPathsSafely_Printf,$1,$2,$3,13751)
$(call ListPathsSafely_Printf,$1,$2,$3,14001)
$(call ListPathsSafely_Printf,$1,$2,$3,14251)
$(call ListPathsSafely_Printf,$1,$2,$3,14501)
$(call ListPathsSafely_Printf,$1,$2,$3,14751)
$(call ListPathsSafely_Printf,$1,$2,$3,15001)
$(call ListPathsSafely_Printf,$1,$2,$3,15251)
$(call ListPathsSafely_Printf,$1,$2,$3,15501)
$(call ListPathsSafely_Printf,$1,$2,$3,15751)
endef
define ListPathsSafelyNow_IfPrintf
@ -384,14 +328,67 @@ $(ECHO) $1/$(HGTIP_FILENAME)
endef
define SetupLogging
ifneq ($(findstring $(LOG),debug trace),)
ifeq ($$(LOG), trace)
# Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
# For each target executed, will print
# Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
# but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin).
OLD_SHELL:=$$(SHELL)
SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL)
SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
endif
# Never remove warning messages; this is just for completeness
LOG_WARN=
ifneq ($$(findstring $$(LOG),info debug trace),)
LOG_INFO=
else
LOG_INFO=> /dev/null
endif
ifneq ($$(findstring $$(LOG),debug trace),)
LOG_DEBUG=
else
LOG_DEBUG=> /dev/null
endif
ifneq ($$(findstring $$(LOG),trace),)
LOG_TRACE=
else
LOG_TRACE=> /dev/null
endif
endef
# Make sure logging is setup for everyone that includes MakeBase.gmk.
$(eval $(call SetupLogging))
# This is to be called by all SetupFoo macros
define LogSetupMacroEntry
$(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
$(if $(findstring $(LOG),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
endef
# Make directory without forking mkdir if not needed
define MakeDir
ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9))
$$(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)
endif
endef
ifeq ($(OPENJDK_TARGET_OS),solaris)
# On Solaris, if the target is a symlink and exists, cp won't overwrite.
define install-file
$(MKDIR) -p $(@D)
$(RM) '$@'
$(CP) -f -r -P '$<' '$(@D)'
endef
else ifeq ($(OPENJDK_TARGET_OS),macosx)
define install-file
$(MKDIR) -p $(@D)
$(CP) -fpRP '$<' '$@'
endef
else
define install-file
$(MKDIR) -p $(@D)
$(CP) -fP '$<' '$@'
endef
endif
endif # _MAKEBASE_GMK

View File

@ -45,13 +45,130 @@ MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VA
list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
# Store the build times in this directory.
BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
# Global targets are possible to run either with or without a SPEC. The prototypical
# global target is "help".
global_targets=help configure
##############################
# Functions
##############################
define fatal-error
define CheckEnvironment
# Find all environment or command line variables that begin with ALT.
$(if $(list_alt_overrides),
@$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
@$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
@$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n\n"
)
endef
### Functions for timers
# Record starting time for build of a sub repository.
define RecordStartTime
$(MKDIR) -p $(BUILDTIMESDIR)
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
endef
# Record ending time and calculate the difference and store it in a
# easy to read format. Handles builds that cross midnight. Expects
# that a build will never take 24 hours or more.
define RecordEndTime
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
$(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
> $(BUILDTIMESDIR)/build_time_diff_$1
endef
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
$(BUILD_LOG_WRAPPER) $(PRINTF) -- "----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
endef
define ResetAllTimers
$$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*)
endef
define StartGlobalTimer
$(call RecordStartTime,TOTAL)
endef
define StopGlobalTimer
$(call RecordEndTime,TOTAL)
endef
### Functions for managing makefile structure (start/end of makefile and individual targets)
# Do not indent this function, this will add whitespace at the start which the caller won't handle
define GetRealTarget
$(strip $(if $(MAKECMDGOALS),$(MAKECMDGOALS),all))
endef
# Do not indent this function, this will add whitespace at the start which the caller won't handle
define LastGoal
$(strip $(lastword $(call GetRealTarget)))
endef
# Check if the current target is the final target, as specified by
# the user on the command line. If so, call AtRootMakeEnd.
define CheckIfMakeAtEnd
# Check if the current target is the last goal
$(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd))
# If the target is 'foo-only', check if our goal was stated as 'foo'
$(if $(filter $(patsubst %-only,%,$@),$(call LastGoal)),$(call AtMakeEnd))
# If no goal is given, 'all' is default, but the last target executed for all is 'jdk-only'. Check for that, too.
# At most one of the tests can be true.
$(if $(subst all,,$(call LastGoal)),,$(if $(filter $@,jdk-only),$(call AtMakeEnd)))
endef
# Hook to be called when starting to execute a top-level target
define TargetEnter
$(BUILD_LOG_WRAPPER) $(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
$(call RecordStartTime,$(patsubst %-only,%,$@))
endef
# Hook to be called when finish executing a top-level target
define TargetExit
$(call RecordEndTime,$(patsubst %-only,%,$@))
$(BUILD_LOG_WRAPPER) $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d " "`"
$(call CheckIfMakeAtEnd)
endef
# Hook to be called as the very first thing when running a normal build
define AtMakeStart
$(if $(findstring --jobserver,$(MAKEFLAGS)),$(error make -j is not supported, use make JOBS=n))
$(call CheckEnvironment)
@$(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n"
@$(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n"
$(call StartGlobalTimer)
endef
# Hook to be called as the very last thing for targets that are "top level" targets
define AtMakeEnd
$(if $(SJAVAC_SERVER_DIR),@$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
$(call StopGlobalTimer)
$(call ReportBuildTimes)
@$(PRINTF) "Finished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n"
$(call CheckEnvironment)
endef
### Functions for parsing and setting up make options from command-line
define FatalError
# If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
$$(if $$(findstring help,$$(MAKECMDGOALS)),,$$(error Cannot continue))
$$(if $$(filter-out $(global_targets),$$(call GetRealTarget)),$$(error Cannot continue))
endef
define ParseLogLevel
@ -80,14 +197,14 @@ define ParseLogLevel
ifeq ($$(LOG),warn)
VERBOSE=-s
else ifeq ($$(LOG),info)
VERBOSE=
VERBOSE=-s
else ifeq ($$(LOG),debug)
VERBOSE=
else ifeq ($$(LOG),trace)
VERBOSE=-d -p
VERBOSE=
else
$$(info Error: LOG must be one of: warn, info, debug or trace.)
$$(eval $$(call fatal-error))
$$(eval $$(call FatalError))
endif
else
ifneq ($$(LOG),)
@ -95,108 +212,84 @@ define ParseLogLevel
# but complain if this is the top-level make call.
ifeq ($$(MAKELEVEL),0)
$$(info Cannot use LOG=$$(LOG) and VERBOSE=$$(VERBOSE) at the same time. Choose one.)
$$(eval $$(call fatal-error))
$$(eval $$(call FatalError))
endif
endif
endif
endef
# TODO: Fix duplication in MakeBase.gmk
define SetupLogging
ifneq ($(findstring $(LOG),debug trace),)
# Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
OLD_SHELL:=$$(SHELL)
SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
endif
endef
define ParseConfAndSpec
ifneq ($$(origin SPEC),undefined)
# We have been given a SPEC, check that it works out properly
ifeq ($$(wildcard $$(SPEC)),)
$$(info Cannot locate spec.gmk, given by SPEC=$$(SPEC))
$$(eval $$(call fatal-error))
endif
ifneq ($$(origin CONF),undefined)
# We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
# but complain if this is the top-level make call.
ifeq ($$(MAKELEVEL),0)
$$(info Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
$$(eval $$(call fatal-error))
ifneq ($$(filter-out $(global_targets),$$(call GetRealTarget)),)
# If we only have global targets, no need to bother with SPEC or CONF
ifneq ($$(origin SPEC),undefined)
# We have been given a SPEC, check that it works out properly
ifeq ($$(wildcard $$(SPEC)),)
$$(info Cannot locate spec.gmk, given by SPEC=$$(SPEC))
$$(eval $$(call FatalError))
endif
endif
# ... OK, we're satisfied, we'll use this SPEC later on
else
# Find all spec.gmk files in the build output directory
output_dir=$$(root_dir)/build
all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk)
ifeq ($$(all_spec_files),)
$$(info No configurations found for $$(root_dir)! Please run configure to create a configuration.)
$$(eval $$(call fatal-error))
endif
# Extract the configuration names from the path
all_confs=$$(patsubst %/spec.gmk,%,$$(patsubst $$(output_dir)/%,%,$$(all_spec_files)))
ifneq ($$(origin CONF),undefined)
# User have given a CONF= argument.
ifeq ($$(CONF),)
# If given CONF=, match all configurations
matching_confs=$$(strip $$(all_confs))
else
# Otherwise select those that contain the given CONF string
matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var))))
endif
ifeq ($$(matching_confs),)
$$(info No configurations found matching CONF=$$(CONF))
$$(info Available configurations:)
$$(foreach var,$$(all_confs),$$(info * $$(var)))
$$(eval $$(call fatal-error))
else
ifeq ($$(words $$(matching_confs)),1)
$$(info Building '$$(matching_confs)' (matching CONF=$$(CONF)))
else
$$(info Building the following configurations (matching CONF=$$(CONF)):)
$$(foreach var,$$(matching_confs),$$(info * $$(var)))
ifneq ($$(origin CONF),undefined)
# We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
# but complain if this is the top-level make call.
ifeq ($$(MAKELEVEL),0)
$$(info Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
$$(eval $$(call FatalError))
endif
endif
# Create a SPEC definition. This will contain the path to one or more spec.gmk files.
SPEC=$$(addsuffix /spec.gmk,$$(addprefix $$(output_dir)/,$$(matching_confs)))
# ... OK, we're satisfied, we'll use this SPEC later on
else
# No CONF or SPEC given, check the available configurations
ifneq ($$(words $$(all_spec_files)),1)
$$(info No CONF or SPEC given, but more than one spec.gmk found in $$(output_dir).)
$$(info Available configurations:)
$$(foreach var,$$(all_confs),$$(info * $$(var)))
$$(info Please retry building with CONF=<config> or SPEC=<specfile>)
$$(eval $$(call fatal-error))
# Find all spec.gmk files in the build output directory
output_dir=$$(root_dir)/build
all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk)
ifeq ($$(all_spec_files),)
$$(info No configurations found for $$(root_dir)! Please run configure to create a configuration.)
$$(eval $$(call FatalError))
endif
# Extract the configuration names from the path
all_confs=$$(patsubst %/spec.gmk,%,$$(patsubst $$(output_dir)/%,%,$$(all_spec_files)))
# We found exactly one configuration, use it
SPEC=$$(strip $$(all_spec_files))
ifneq ($$(origin CONF),undefined)
# User have given a CONF= argument.
ifeq ($$(CONF),)
# If given CONF=, match all configurations
matching_confs=$$(strip $$(all_confs))
else
# Otherwise select those that contain the given CONF string
matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var))))
endif
ifeq ($$(matching_confs),)
$$(info No configurations found matching CONF=$$(CONF))
$$(info Available configurations:)
$$(foreach var,$$(all_confs),$$(info * $$(var)))
$$(eval $$(call FatalError))
else
ifeq ($$(words $$(matching_confs)),1)
$$(info Building '$$(matching_confs)' (matching CONF=$$(CONF)))
else
$$(info Building target '$(call GetRealTarget)' in the following configurations (matching CONF=$$(CONF)):)
$$(foreach var,$$(matching_confs),$$(info * $$(var)))
endif
endif
# Create a SPEC definition. This will contain the path to one or more spec.gmk files.
SPEC=$$(addsuffix /spec.gmk,$$(addprefix $$(output_dir)/,$$(matching_confs)))
else
# No CONF or SPEC given, check the available configurations
ifneq ($$(words $$(all_spec_files)),1)
$$(info No CONF given, but more than one configuration found in $$(output_dir).)
$$(info Available configurations:)
$$(foreach var,$$(all_confs),$$(info * $$(var)))
$$(info Please retry building with CONF=<config pattern> (or SPEC=<specfile>))
$$(eval $$(call FatalError))
endif
# We found exactly one configuration, use it
SPEC=$$(strip $$(all_spec_files))
endif
endif
endif
endef
define CheckEnvironment
# Find all environment or command line variables that begin with ALT.
$(if $(list_alt_overrides),
@$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
@$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
@$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n\n"
)
endef
define PrintStartMessage
$(if $(VERBOSE),,@$(ECHO) Running make as $(MAKE) $(MFLAGS) $(MAKE_ARGS))
$(call CheckEnvironment)
@$(ECHO) "Building OpenJDK for target $(if $(MAKECMDGOALS),'$(MAKECMDGOALS)','all') in configuration '$(CONF_NAME)'"
endef
define PrintEndMessage
@$(ECHO) "Finished building OpenJDK for target '$@'"
$(call CheckEnvironment)
endef
### Convenience functions from Main.gmk
# Cleans the component given as $1
define CleanComponent

View File

@ -24,13 +24,24 @@
#
# This must be the first rule
default: all
all:
# Inclusion of this pseudo-target will cause make to execute this file
# serially, regardless of -j. Recursively called makefiles will not be
# affected, however. This is required for correct dependency management.
.NOTPARALLEL:
# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
# /usr/ccs/bin/make lacks basically every other flow control mechanism.
TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
# Assume we have GNU make, but check version.
ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
$(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
endif
endif
# Locate this Makefile
ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
@ -43,202 +54,32 @@ root_dir:=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
include $(dir $(makefile_path))/MakeHelpers.gmk
$(eval $(call ParseLogLevel))
$(eval $(call SetupLogging))
$(eval $(call ParseConfAndSpec))
ifneq ($(words $(SPEC)),1)
### We have multiple configurations to build, call make repeatedly
all clean dist-clean:
langtools corba jaxp jaxws hotspot jdk images overlay-images install:
langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only:
clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images:
# Now determine if we have zero, one or several configurations to build.
ifeq ($(SPEC),)
# Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
else
ifeq ($(words $(SPEC)),1)
# We are building a single configuration. This is the normal case. Execute the Main.gmk file.
include $(dir $(makefile_path))/Main.gmk
else
# We are building multiple configurations.
# First, find out the valid targets
# Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
# available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
$(MAKE) -p -q -f $(makefile_path) SPEC=$(firstword $(SPEC)) | \
grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
$(all_phony_targets):
@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
.PHONY: all clean dist-clean
.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images
else
### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
# Now load the spec
include $(SPEC)
# Load the vital tools for all the makefiles.
include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
### Clean up from previous run
# Remove any build.log from a previous run, if they exist
ifneq (,$(BUILD_LOG))
ifneq (,$(BUILD_LOG_PREVIOUS))
# Rotate old log
$(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
$(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
else
$(shell $(RM) $(BUILD_LOG) 2> /dev/null)
endif
endif
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
ifneq (,$(SJAVAC_SERVER_DIR))
$(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
endif
# Clean out any notifications from the previous build.
$(shell $(FIND) $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
# Reset the build timers.
$(eval $(call ResetTimers))
# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
# hence this workaround.
ifeq ($(JOBS),)
JOBS=$(NUM_CORES)
endif
MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
### Main targets
all: jdk
@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
@$(call AtRootMakeEnd)
.PHONY: all
langtools: start-make langtools-only
langtools-only:
@$(call MakeStart,langtools,all)
@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
@$(call MakeFinish,langtools,all)
corba: langtools corba-only
corba-only:
@$(call MakeStart,corba,all)
@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
@$(call MakeFinish,corba,all)
jaxp: langtools jaxp-only
jaxp-only:
@$(call MakeStart,jaxp,all)
@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
@$(call MakeFinish,jaxp,all)
jaxws: langtools jaxp jaxws-only
jaxws-only:
@$(call MakeStart,jaxws,all)
@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS))
@$(call MakeFinish,jaxws,all)
hotspot: langtools hotspot-only
hotspot-only:
@$(call MakeStart,hotspot,all)
@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
@$(call MakeFinish,hotspot,all)
jdk: langtools corba jaxp jaxws hotspot jdk-only
jdk-only:
@$(call MakeStart,jdk,all)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(JDK_TARGET))
@$(call MakeFinish,jdk,all)
images: source-tips start-make jdk langtools corba jaxp jaxws hotspot images-only
images-only:
@$(call MakeStart,jdk-images,$@)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) images)
@$(call MakeFinish,jdk-images,$@)
@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
@$(call AtRootMakeEnd)
overlay-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot overlay-images-only
overlay-images-only:
@$(call MakeStart,jdk-overlay-images,$@)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) overlay-images)
@$(call MakeFinish,jdk-overlay-images,$@)
@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
@$(call AtRootMakeEnd)
install: source-tips start-make jdk langtools corba jaxp jaxws hotspot install-only
install-only:
@$(call MakeStart,jdk-images,$@)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) install)
@$(call MakeFinish,jdk-images,$@)
@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
@$(call AtRootMakeEnd)
docs: start-make jdk docs-only
docs-only:
@$(call MakeStart,docs,$@)
@($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
@$(call MakeFinish,docs,$@)
@$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port)
@$(call AtRootMakeEnd)
.PHONY: langtools corba jaxp jaxws hotspot jdk images install
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only install-only
start-make:
@$(call AtRootMakeStart)
.PHONY: start-make
bootcycle-images:
@$(ECHO) Boot cycle build step 1: Building the JDK image normally
@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images)
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
test: start-make
@$(call MakeStart,test,$(if $(TEST),$(TEST),all))
@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
@$(call MakeFinish,test,$(if $(TEST),$(TEST),all))
@$(call AtRootMakeEnd)
.PHONY: test
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
source-tips: $(OUTPUT_ROOT)/source_tips
$(OUTPUT_ROOT)/source_tips: FRC
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(call GetSourceTips)
# Remove everything, except the output from configure.
clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-bootcycle-build
@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log*)
@$(ECHO) Cleaned everything except the build configuration.
.PHONY: clean
# Remove everything, you have to rerun configure.
dist-clean:
@$(RM) -r $(OUTPUT_ROOT)
@$(ECHO) Cleaned everything, you will have to re-run configure.
.PHONY: dist-clean
clean-langtools:
$(call CleanComponent,langtools)
clean-corba:
$(call CleanComponent,corba)
clean-jaxp:
$(call CleanComponent,jaxp)
clean-jaxws:
$(call CleanComponent,jaxws)
clean-hotspot:
$(call CleanComponent,hotspot)
clean-jdk:
$(call CleanComponent,jdk)
clean-images:
$(call CleanComponent,images)
clean-bootcycle-build:
$(call CleanComponent,bootcycle-build)
.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images
endif
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
# If you addd more global targets, please update the fatal-error macro.
# If you addd more global targets, please update the variable global_targets in MakeHelpers.
help:
$(info )
@ -258,7 +99,7 @@ help:
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
$(info Targets for specific components)
$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk or images))
$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
$(info . make <component> # Build <component> and everything it depends on. )
$(info . make <component>-only # Build <component> only, without dependencies. This)
$(info . # is faster but can result in incorrect build results!)
@ -272,7 +113,7 @@ help:
$(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>)
$(info . # Available log levels are:)
$(info . # 'warn' (default), 'info', 'debug' and 'trace')
$(info . # To see executed command lines, use LOG=info)
$(info . # To see executed command lines, use LOG=debug)
$(info )
$(info . make JOBS=<n> # Run <n> parallel make jobs)
$(info . # Note that -jN does not work as expected!)
@ -280,5 +121,11 @@ help:
$(info . make test TEST=<test> # Only run the given test or tests, e.g.)
$(info . # make test TEST="jdk_lang jdk_net")
$(info )
.PHONY: help
FRC: # Force target
configure:
@$(SHELL) $(root_dir)/configure $(CONFIGURE_ARGS)
@echo ====================================================
@echo "Note: This is a non-recommended way of running configure."
@echo "Instead, run 'sh configure' in the top-level directory"
.PHONY: help configure

View File

@ -32,10 +32,10 @@ ifeq (,$(_MAKEBASE_GMK))
endif
ifeq ($(COMPILER_TYPE),CC)
COMPILING_MSG=echo Compiling $1
LINKING_MSG=echo Linking $1
LINKING_EXE_MSG=echo Linking executable $1
ARCHIVING_MSG=echo Archiving $1
COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))"
LINKING_MSG=echo $(LOG_INFO) "Linking $1"
LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1"
ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1"
else
COMPILING_MSG=
LINKING_MSG=
@ -94,7 +94,7 @@ define add_native_source
$$($1_$2_OBJ) : $2
ifeq ($(COMPILER_TYPE),CC)
$$(call COMPILING_MSG,$$(notdir $2))
$$(call COMPILING_MSG,$2,$$($1_TARGET))
$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
endif
ifeq ($(COMPILER_TYPE),CL)
@ -129,30 +129,8 @@ define SetupNativeCompilation
# CC the compiler to use, default is $(CC)
# LDEXE the linker to use for linking executables, default is $(LDEXE)
# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$1_$(strip $(10)))
$(if $(11),$1_$(strip $(11)))
$(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14)))
$(if $(15),$1_$(strip $(15)))
$(if $(16),$1_$(strip $(16)))
$(if $(17),$1_$(strip $(17)))
$(if $(18),$1_$(strip $(18)))
$(if $(19),$1_$(strip $(19)))
$(if $(20),$1_$(strip $(20)))
$(if $(21),$1_$(strip $(21)))
$(if $(22),$1_$(strip $(22)))
$(if $(23),$1_$(strip $(23)))
$(if $(24),$1_$(strip $(24)))
$(if $(25),$1_$(strip $(25)))
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25))
$(if $(26),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
ifneq (,$$($1_BIN))
@ -236,9 +214,9 @@ define SetupNativeCompilation
$$(error You have to specify LANG for native compilation $1)
endif
ifeq (C,$$($1_LANG))
ifeq ($$($1_LDEXE),)
ifeq ($$($1_LDEXE),)
$1_LDEXE:=$(LDEXE)
endif
endif
$1_LD:=$(LD)
else
ifeq (C++,$$($1_LANG))
@ -254,9 +232,11 @@ define SetupNativeCompilation
endif
# Make sure the dirs exist.
$$(shell $(MKDIR) -p $$($1_SRC) $$($1_OBJECT_DIR) $$($1_OUTPUT_DIR))
$$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)))
$$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
# Find all files in the source trees. Sort to remove duplicates.
$1_ALL_SRCS := $$(sort $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f)))
$1_ALL_SRCS := $$(sort $$(shell $(FIND) $$($1_SRC) -type f))
# Extract the C/C++ files.
$1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
$1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
@ -291,7 +271,9 @@ define SetupNativeCompilation
# Are there too many object files on disk? Perhaps because some source file was removed?
$1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
# Clean out the superfluous object files.
$$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
ifneq ($$($1_SUPERFLUOUS_OBJS),)
$$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
endif
# Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CFLAGS.
$1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS))
@ -358,11 +340,6 @@ define SetupNativeCompilation
$$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
endif
# Now create a list of the packages that are about to compile. Used when sending source
# in a batch to the compiler.
$$(shell $(RM) $$($1_OBJECT_DIR)/_the.list_of_sources)
$$(eval $$(call ListPathsSafelyNow,$1_SRCS,\n, >> $$($1_OBJECT_DIR)/_the.list_of_sources))
# Now call add_native_source for each source file we are going to compile.
$$(foreach p,$$($1_SRCS),\
$$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR),\
@ -385,8 +362,6 @@ define SetupNativeCompilation
endif
# mapfile doesnt seem to be implemented on macosx (yet??)
ifneq ($(OPENJDK_TARGET_CPU),ppc)
ifneq ($(OPENJDK_TARGET_CPU),arm)
ifneq ($(OPENJDK_TARGET_OS),macosx)
ifneq ($(OPENJDK_TARGET_OS),windows)
$1_REAL_MAPFILE:=$$($1_MAPFILE)
@ -401,8 +376,6 @@ define SetupNativeCompilation
endif
endif
endif
endif
endif
# Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables
# for LDFLAGS and LDFLAGS_SUFFIX
@ -445,9 +418,9 @@ define SetupNativeCompilation
$$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $$<
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $$(@F) $$<
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
else # not solaris
$$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
$(RM) $$@
@ -523,9 +496,9 @@ define SetupNativeCompilation
$$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $$<
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $$(@F) $$<
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
else # not solaris
$$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
$(RM) $$@
@ -564,7 +537,7 @@ define SetupNativeCompilation
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
$$($1_EXTRA_LDFLAGS_SUFFIX)
ifneq (,$$($1_GEN_MANIFEST))
$(MT) -nologo /manifest $$($1_GEN_MANIFEST) /outputresource:$$@;#1
$(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
endif
endif

View File

@ -34,16 +34,9 @@ define SetupRMICompilation
# RUN_IIOP:=Set to run rmic with -iiop
# RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
# KEEP_GENERATED:=Set to keep generated sources around
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
$1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/$1_rmic
@ -86,12 +79,12 @@ define SetupRMICompilation
$$($1_DEP_FILE): $$($1_CLASS_FILES)
$(MKDIR) -p $$($1_STUB_CLASSES_DIR)
if [ "x$$($1_ARGS)" != "x" ]; then \
$(ECHO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) &&\
$(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) &&\
$(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES);\
fi;
if [ "x$$($1_ARGS2)" != "x" ]; then \
$(ECHO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) &&\
$(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) &&\
$(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES);\
fi;

View File

@ -58,7 +58,7 @@ int is_cygdrive_here(int pos, char *in, int len)
* Works in place since drive letter is always
* shorter than /cygdrive/
*/
char *replace_cygdrive(char *in)
char *replace_cygdrive_cygwin(char *in)
{
int len = strlen(in);
char *out = malloc(len+1);
@ -119,6 +119,61 @@ char *replace_substring(char *in, char *sub, char *rep)
return out;
}
char* msys_path_list; // @-separated list of paths prefix to look for
char* msys_path_list_end; // Points to last \0 in msys_path_list.
void setup_msys_path_list(char* argument)
{
char* p;
char* drive_letter_pos;
msys_path_list = strdup(&argument[2]);
msys_path_list_end = &msys_path_list[strlen(msys_path_list)];
// Convert all at-sign (@) in path list to \0.
// @ was chosen as separator to minimize risk of other tools messing around with it
p = msys_path_list;
do {
if (p[1] == ':') {
// msys has mangled our path list, restore it from c:/... to /c/...
drive_letter_pos = p+1;
*drive_letter_pos = *p;
*p = '/';
}
// Look for an @ in the list
p = strchr(p, '@');
if (p != NULL) {
*p = '\0';
p++;
}
} while (p != NULL);
}
char *replace_cygdrive_msys(char *in)
{
char* str;
char* prefix;
char* p;
str = strdup(in);
// For each prefix in the path list, search for it and replace /c/... with c:/...
for (prefix = msys_path_list; prefix < msys_path_list_end && prefix != NULL; prefix += strlen(prefix)+1) {
p=str;
while ((p = strstr(p, prefix))) {
char* drive_letter = p+1;
*p = *drive_letter;
*drive_letter = ':';
p++;
}
}
return str;
}
char*(*replace_cygdrive)(char *in) = NULL;
char *files_to_delete[1024];
int num_files_to_delete = 0;
@ -158,7 +213,7 @@ char *fix_at_file(char *in)
atout = fopen(name, "w");
if (atout == NULL) {
fprintf(stderr, "Could open temporary file for writing! %s\n", name);
fprintf(stderr, "Could not open temporary file for writing! %s\n", name);
exit(-1);
}
@ -167,7 +222,13 @@ char *fix_at_file(char *in)
append(&buffer, &buflen, &used, block, blocklen);
}
buffer[used] = 0;
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "fixpath input from @-file %s: %s\n", &in[1], buffer);
}
fixed = replace_cygdrive(buffer);
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "fixpath converted to @-file %s is: %s\n", name, fixed);
}
fwrite(fixed, strlen(fixed), 1, atout);
fclose(atin);
fclose(atout);
@ -194,12 +255,31 @@ int main(int argc, char **argv)
int i;
DWORD exitCode;
if (argc<2) {
fprintf(stderr, "Usage: uncygdrive.exe /cygdrive/c/WINDOWS/notepad.exe /cygdrive/c/x/test.txt");
if (argc<3 || 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");
exit(0);
}
line = replace_cygdrive(strstr(GetCommandLine(), argv[1]));
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "fixpath input line >%s<\n", strstr(GetCommandLine(), argv[1]));
}
if (argv[1][1] == 'c' && argv[1][2] == '\0') {
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "using cygwin mode\n");
}
replace_cygdrive = replace_cygdrive_cygwin;
} else if (argv[1][1] == 'm') {
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "using msys mode, with path list: %s\n", &argv[1][2]);
}
setup_msys_path_list(argv[1]);
replace_cygdrive = replace_cygdrive_msys;
} else {
fprintf(stderr, "Unknown mode: %s\n", argv[1]);
exit(-1);
}
line = replace_cygdrive(strstr(GetCommandLine(), argv[2]));
for (i=1; i<argc; ++i) {
if (argv[i][0] == '@') {
@ -210,8 +290,8 @@ int main(int argc, char **argv)
}
}
if (getenv("DEBUG_UNCYGDRIVE") != NULL) {
fprintf(stderr, "uncygdrive >%s<\n", line);
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "fixpath converted line >%s<\n", line);
}
ZeroMemory(&si,sizeof(si));
@ -238,9 +318,9 @@ int main(int argc, char **argv)
WaitForSingleObject(pi.hProcess,INFINITE);
GetExitCodeProcess(pi.hProcess,&exitCode);
if (getenv("DEBUG_UNCYGDRIVE") != NULL) {
if (getenv("DEBUG_FIXPATH") != NULL) {
for (i=0; i<num_files_to_delete; ++i) {
fprintf(stderr, "Not deleting temporary uncygdrive file %s\n",
fprintf(stderr, "Not deleting temporary fixpath file %s\n",
files_to_delete[i]);
}
}

29
configure vendored Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This is a thin wrapper which will call the real configure script, and
# make sure that is called using bash.
this_script_dir=`dirname $0`
bash $this_script_dir/common/autoconf/configure "$@"

View File

@ -183,3 +183,5 @@ f3ab4163ae012965fc8acdfc25ce0fece8d6906d jdk8-b57
d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
207ef43ba69ead6cbbab415d81834545e4d46747 jdk8-b60
0e08ba7648fb3faa0986cb217887d7c4990977f3 jdk8-b61
08afb9c6f44f11c3595b01fd0985db64b29834dd jdk8-b62
6ccbf67b68bfed1ab9c44ab8748a5bdc7df33506 jdk8-b63

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,16 +42,6 @@ import java.util.NoSuchElementException;
* instead, it uses the System.identityHashcode() method and pointer comparison.
* In addition, all synchronization has been removed.
*/
/**
* IdentityHashtable collision list.
*/
class IdentityHashtableEntry {
int hash;
Object key;
Object value;
IdentityHashtableEntry next;
}
public final class IdentityHashtable extends Dictionary {
/**
* The hash table data.

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Licensed Materials - Property of IBM
* RMI-IIOP v1.0
* Copyright IBM Corp. 1998 1999 All Rights Reserved
*
*/
package com.sun.corba.se.impl.util;
/**
* IdentityHashtable collision list.
*/
class IdentityHashtableEntry {
int hash;
Object key;
Object value;
IdentityHashtableEntry next;
}

View File

@ -287,3 +287,7 @@ f2e12eb74117c917c0bb264694c02de4a6a15a10 hs25-b03
b261523fe66c40a02968f0aa7e73602491bb3386 hs25-b05
4547dc71db765276e027b0c2780b724bae0a07d3 jdk8-b61
d0337c31c8be7716369b4e7c3bd5f352983c6a06 hs25-b06
dccd40de8db1fa96f186e6179907818d75320440 jdk8-b62
dc16fe422c535ecd4e9f80fb814a1bb9704da6f5 hs25-b07
acabb5c282f59be7e3238920b2ea06b684ab68f7 jdk8-b63
8cb93eadfb6dcab88d91b8e2cd3e0e07d0ac4048 hs25-b08

View File

@ -453,14 +453,30 @@ ifneq ($(OSNAME),windows)
ifeq ($(JVM_VARIANT_ZEROSHARK), true)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_DIR)/%.debuginfo
$(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_DIR)/%.diz
$(install-file)
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file)
$(EXPORT_SERVER_DIR)/%.debuginfo: $(SHARK_DIR)/%.debuginfo
$(install-file)
$(EXPORT_SERVER_DIR)/%.diz: $(SHARK_DIR)/%.diz
$(install-file)
endif
ifeq ($(JVM_VARIANT_ZERO), true)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(ZERO_DIR)/%.debuginfo
$(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(ZERO_DIR)/%.diz
$(install-file)
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file)
$(EXPORT_SERVER_DIR)/%.debuginfo: $(ZERO_DIR)/%.debuginfo
$(install-file)
$(EXPORT_SERVER_DIR)/%.diz: $(ZERO_DIR)/%.diz
$(install-file)
endif
ifeq ($(JVM_VARIANT_MINIMAL1), true)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX)

View File

@ -79,10 +79,10 @@ ifeq ($(INCLUDE_ALTERNATE_GCS), false)
CXXFLAGS += -DSERIALGC
CFLAGS += -DSERIALGC
Src_Files_EXCLUDE += \
binaryTreeDictionary.cpp cmsAdaptiveSizePolicy.cpp cmsCollectorPolicy.cpp \
cmsAdaptiveSizePolicy.cpp cmsCollectorPolicy.cpp \
cmsGCAdaptivePolicyCounters.cpp cmsLockVerifier.cpp cmsPermGen.cpp compactibleFreeListSpace.cpp \
concurrentMarkSweepGeneration.cpp concurrentMarkSweepThread.cpp freeBlockDictionary.cpp \
freeChunk.cpp freeList.cpp promotionInfo.cpp vmCMSOperations.cpp collectionSetChooser.cpp \
concurrentMarkSweepGeneration.cpp concurrentMarkSweepThread.cpp \
freeChunk.cpp adaptiveFreeList.cpp promotionInfo.cpp vmCMSOperations.cpp collectionSetChooser.cpp \
concurrentG1Refine.cpp concurrentG1RefineThread.cpp concurrentMark.cpp concurrentMarkThread.cpp \
dirtyCardQueue.cpp g1AllocRegion.cpp g1BlockOffsetTable.cpp g1CollectedHeap.cpp g1GCPhaseTimes.cpp \
g1CollectorPolicy.cpp g1ErgoVerbose.cpp g1_globals.cpp g1HRPrinter.cpp g1MarkSweep.cpp \

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012
HS_MAJOR_VER=25
HS_MINOR_VER=0
HS_BUILD_NUMBER=07
HS_BUILD_NUMBER=09
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -1007,6 +1007,67 @@ void Assembler::addss(XMMRegister dst, Address src) {
emit_simd_arith(0x58, dst, src, VEX_SIMD_F3);
}
void Assembler::aesdec(XMMRegister dst, Address src) {
assert(VM_Version::supports_aes(), "");
InstructionMark im(this);
simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xde);
emit_operand(dst, src);
}
void Assembler::aesdec(XMMRegister dst, XMMRegister src) {
assert(VM_Version::supports_aes(), "");
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xde);
emit_byte(0xC0 | encode);
}
void Assembler::aesdeclast(XMMRegister dst, Address src) {
assert(VM_Version::supports_aes(), "");
InstructionMark im(this);
simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xdf);
emit_operand(dst, src);
}
void Assembler::aesdeclast(XMMRegister dst, XMMRegister src) {
assert(VM_Version::supports_aes(), "");
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xdf);
emit_byte(0xC0 | encode);
}
void Assembler::aesenc(XMMRegister dst, Address src) {
assert(VM_Version::supports_aes(), "");
InstructionMark im(this);
simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xdc);
emit_operand(dst, src);
}
void Assembler::aesenc(XMMRegister dst, XMMRegister src) {
assert(VM_Version::supports_aes(), "");
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xdc);
emit_byte(0xC0 | encode);
}
void Assembler::aesenclast(XMMRegister dst, Address src) {
assert(VM_Version::supports_aes(), "");
InstructionMark im(this);
simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xdd);
emit_operand(dst, src);
}
void Assembler::aesenclast(XMMRegister dst, XMMRegister src) {
assert(VM_Version::supports_aes(), "");
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0xdd);
emit_byte(0xC0 | encode);
}
void Assembler::andl(Address dst, int32_t imm32) {
InstructionMark im(this);
prefix(dst);
@ -2307,6 +2368,22 @@ void Assembler::prefix(Prefix p) {
a_byte(p);
}
void Assembler::pshufb(XMMRegister dst, XMMRegister src) {
assert(VM_Version::supports_ssse3(), "");
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0x00);
emit_byte(0xC0 | encode);
}
void Assembler::pshufb(XMMRegister dst, Address src) {
assert(VM_Version::supports_ssse3(), "");
assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
InstructionMark im(this);
simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
emit_byte(0x00);
emit_operand(dst, src);
}
void Assembler::pshufd(XMMRegister dst, XMMRegister src, int mode) {
assert(isByte(mode), "invalid value");
NOT_LP64(assert(VM_Version::supports_sse2(), ""));
@ -8067,6 +8144,15 @@ void MacroAssembler::movptr(Address dst, Register src) {
LP64_ONLY(movq(dst, src)) NOT_LP64(movl(dst, src));
}
void MacroAssembler::movdqu(XMMRegister dst, AddressLiteral src) {
if (reachable(src)) {
Assembler::movdqu(dst, as_Address(src));
} else {
lea(rscratch1, src);
Assembler::movdqu(dst, Address(rscratch1, 0));
}
}
void MacroAssembler::movsd(XMMRegister dst, AddressLiteral src) {
if (reachable(src)) {
Assembler::movsd(dst, as_Address(src));
@ -8357,6 +8443,17 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src) {
}
}
void MacroAssembler::pshufb(XMMRegister dst, AddressLiteral src) {
// Used in sign-bit flipping with aligned address.
assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes");
if (reachable(src)) {
Assembler::pshufb(dst, as_Address(src));
} else {
lea(rscratch1, src);
Assembler::pshufb(dst, Address(rscratch1, 0));
}
}
// AVX 3-operands instructions
void MacroAssembler::vaddsd(XMMRegister dst, XMMRegister nds, AddressLiteral src) {

View File

@ -875,6 +875,17 @@ private:
void addss(XMMRegister dst, Address src);
void addss(XMMRegister dst, XMMRegister src);
// AES instructions
void aesdec(XMMRegister dst, Address src);
void aesdec(XMMRegister dst, XMMRegister src);
void aesdeclast(XMMRegister dst, Address src);
void aesdeclast(XMMRegister dst, XMMRegister src);
void aesenc(XMMRegister dst, Address src);
void aesenc(XMMRegister dst, XMMRegister src);
void aesenclast(XMMRegister dst, Address src);
void aesenclast(XMMRegister dst, XMMRegister src);
void andl(Address dst, int32_t imm32);
void andl(Register dst, int32_t imm32);
void andl(Register dst, Address src);
@ -1424,6 +1435,10 @@ private:
void prefetcht2(Address src);
void prefetchw(Address src);
// Shuffle Bytes
void pshufb(XMMRegister dst, XMMRegister src);
void pshufb(XMMRegister dst, Address src);
// Shuffle Packed Doublewords
void pshufd(XMMRegister dst, XMMRegister src, int mode);
void pshufd(XMMRegister dst, Address src, int mode);
@ -2611,6 +2626,12 @@ public:
void divss(XMMRegister dst, Address src) { Assembler::divss(dst, src); }
void divss(XMMRegister dst, AddressLiteral src);
// Move Unaligned Double Quadword
void movdqu(Address dst, XMMRegister src) { Assembler::movdqu(dst, src); }
void movdqu(XMMRegister dst, Address src) { Assembler::movdqu(dst, src); }
void movdqu(XMMRegister dst, XMMRegister src) { Assembler::movdqu(dst, src); }
void movdqu(XMMRegister dst, AddressLiteral src);
void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); }
void movsd(Address dst, XMMRegister src) { Assembler::movsd(dst, src); }
void movsd(XMMRegister dst, Address src) { Assembler::movsd(dst, src); }
@ -2658,6 +2679,10 @@ public:
void xorps(XMMRegister dst, Address src) { Assembler::xorps(dst, src); }
void xorps(XMMRegister dst, AddressLiteral src);
// Shuffle Bytes
void pshufb(XMMRegister dst, XMMRegister src) { Assembler::pshufb(dst, src); }
void pshufb(XMMRegister dst, Address src) { Assembler::pshufb(dst, src); }
void pshufb(XMMRegister dst, AddressLiteral src);
// AVX 3-operands instructions
void vaddsd(XMMRegister dst, XMMRegister nds, XMMRegister src) { Assembler::vaddsd(dst, nds, src); }

View File

@ -2137,6 +2137,529 @@ class StubGenerator: public StubCodeGenerator {
}
}
// AES intrinsic stubs
enum {AESBlockSize = 16};
address generate_key_shuffle_mask() {
__ align(16);
StubCodeMark mark(this, "StubRoutines", "key_shuffle_mask");
address start = __ pc();
__ emit_data(0x00010203, relocInfo::none, 0 );
__ emit_data(0x04050607, relocInfo::none, 0 );
__ emit_data(0x08090a0b, relocInfo::none, 0 );
__ emit_data(0x0c0d0e0f, relocInfo::none, 0 );
return start;
}
// Utility routine for loading a 128-bit key word in little endian format
// can optionally specify that the shuffle mask is already in an xmmregister
void load_key(XMMRegister xmmdst, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
__ movdqu(xmmdst, Address(key, offset));
if (xmm_shuf_mask != NULL) {
__ pshufb(xmmdst, xmm_shuf_mask);
} else {
__ pshufb(xmmdst, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
}
}
// aesenc using specified key+offset
// can optionally specify that the shuffle mask is already in an xmmregister
void aes_enc_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
load_key(xmmtmp, key, offset, xmm_shuf_mask);
__ aesenc(xmmdst, xmmtmp);
}
// aesdec using specified key+offset
// can optionally specify that the shuffle mask is already in an xmmregister
void aes_dec_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
load_key(xmmtmp, key, offset, xmm_shuf_mask);
__ aesdec(xmmdst, xmmtmp);
}
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
//
address generate_aescrypt_encryptBlock() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
Label L_doLast;
address start = __ pc();
const Register from = rsi; // source array address
const Register to = rdx; // destination array address
const Register key = rcx; // key array address
const Register keylen = rax;
const Address from_param(rbp, 8+0);
const Address to_param (rbp, 8+4);
const Address key_param (rbp, 8+8);
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
const XMMRegister xmm_key_shuf_mask = xmm2;
__ enter(); // required for proper stackwalking of RuntimeStub frame
__ push(rsi);
__ movptr(from , from_param);
__ movptr(to , to_param);
__ movptr(key , key_param);
__ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
// keylen = # of 32-bit words, convert to 128-bit words
__ shrl(keylen, 2);
__ subl(keylen, 11); // every key has at least 11 128-bit words, some have more
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
__ movdqu(xmm_result, Address(from, 0)); // get 16 bytes of input
// For encryption, the java expanded key ordering is just what we need
load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
__ pxor(xmm_result, xmm_temp);
for (int offset = 0x10; offset <= 0x90; offset += 0x10) {
aes_enc_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
}
load_key (xmm_temp, key, 0xa0, xmm_key_shuf_mask);
__ cmpl(keylen, 0);
__ jcc(Assembler::equal, L_doLast);
__ aesenc(xmm_result, xmm_temp); // only in 192 and 256 bit keys
aes_enc_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
load_key(xmm_temp, key, 0xc0, xmm_key_shuf_mask);
__ subl(keylen, 2);
__ jcc(Assembler::equal, L_doLast);
__ aesenc(xmm_result, xmm_temp); // only in 256 bit keys
aes_enc_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
load_key(xmm_temp, key, 0xe0, xmm_key_shuf_mask);
__ BIND(L_doLast);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, 0), xmm_result); // store the result
__ xorptr(rax, rax); // return 0
__ pop(rsi);
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
return start;
}
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
//
address generate_aescrypt_decryptBlock() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
Label L_doLast;
address start = __ pc();
const Register from = rsi; // source array address
const Register to = rdx; // destination array address
const Register key = rcx; // key array address
const Register keylen = rax;
const Address from_param(rbp, 8+0);
const Address to_param (rbp, 8+4);
const Address key_param (rbp, 8+8);
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
const XMMRegister xmm_key_shuf_mask = xmm2;
__ enter(); // required for proper stackwalking of RuntimeStub frame
__ push(rsi);
__ movptr(from , from_param);
__ movptr(to , to_param);
__ movptr(key , key_param);
__ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
// keylen = # of 32-bit words, convert to 128-bit words
__ shrl(keylen, 2);
__ subl(keylen, 11); // every key has at least 11 128-bit words, some have more
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
__ movdqu(xmm_result, Address(from, 0));
// for decryption java expanded key ordering is rotated one position from what we want
// so we start from 0x10 here and hit 0x00 last
// we don't know if the key is aligned, hence not using load-execute form
load_key(xmm_temp, key, 0x10, xmm_key_shuf_mask);
__ pxor (xmm_result, xmm_temp);
for (int offset = 0x20; offset <= 0xa0; offset += 0x10) {
aes_dec_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
}
__ cmpl(keylen, 0);
__ jcc(Assembler::equal, L_doLast);
// only in 192 and 256 bit keys
aes_dec_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
aes_dec_key(xmm_result, xmm_temp, key, 0xc0, xmm_key_shuf_mask);
__ subl(keylen, 2);
__ jcc(Assembler::equal, L_doLast);
// only in 256 bit keys
aes_dec_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
aes_dec_key(xmm_result, xmm_temp, key, 0xe0, xmm_key_shuf_mask);
__ BIND(L_doLast);
// for decryption the aesdeclast operation is always on key+0x00
load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
__ aesdeclast(xmm_result, xmm_temp);
__ movdqu(Address(to, 0), xmm_result); // store the result
__ xorptr(rax, rax); // return 0
__ pop(rsi);
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
return start;
}
void handleSOERegisters(bool saving) {
const int saveFrameSizeInBytes = 4 * wordSize;
const Address saved_rbx (rbp, -3 * wordSize);
const Address saved_rsi (rbp, -2 * wordSize);
const Address saved_rdi (rbp, -1 * wordSize);
if (saving) {
__ subptr(rsp, saveFrameSizeInBytes);
__ movptr(saved_rsi, rsi);
__ movptr(saved_rdi, rdi);
__ movptr(saved_rbx, rbx);
} else {
// restoring
__ movptr(rsi, saved_rsi);
__ movptr(rdi, saved_rdi);
__ movptr(rbx, saved_rbx);
}
}
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
// c_rarg3 - r vector byte array address
// c_rarg4 - input length
//
address generate_cipherBlockChaining_encryptAESCrypt() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
address start = __ pc();
Label L_exit, L_key_192_256, L_key_256, L_loopTop_128, L_loopTop_192, L_loopTop_256;
const Register from = rsi; // source array address
const Register to = rdx; // destination array address
const Register key = rcx; // key array address
const Register rvec = rdi; // r byte array initialized from initvector array address
// and left with the results of the last encryption block
const Register len_reg = rbx; // src len (must be multiple of blocksize 16)
const Register pos = rax;
// xmm register assignments for the loops below
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
// first 6 keys preloaded into xmm2-xmm7
const int XMM_REG_NUM_KEY_FIRST = 2;
const int XMM_REG_NUM_KEY_LAST = 7;
const XMMRegister xmm_key0 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
__ enter(); // required for proper stackwalking of RuntimeStub frame
handleSOERegisters(true /*saving*/);
// load registers from incoming parameters
const Address from_param(rbp, 8+0);
const Address to_param (rbp, 8+4);
const Address key_param (rbp, 8+8);
const Address rvec_param (rbp, 8+12);
const Address len_param (rbp, 8+16);
__ movptr(from , from_param);
__ movptr(to , to_param);
__ movptr(key , key_param);
__ movptr(rvec , rvec_param);
__ movptr(len_reg , len_param);
const XMMRegister xmm_key_shuf_mask = xmm_temp; // used temporarily to swap key bytes up front
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
// load up xmm regs 2 thru 7 with keys 0-5
for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x00; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask);
offset += 0x10;
}
__ movdqu(xmm_result, Address(rvec, 0x00)); // initialize xmm_result with r vec
// now split to different paths depending on the keylen (len in ints of AESCrypt.KLE array (52=192, or 60=256))
__ movl(rax, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
__ cmpl(rax, 44);
__ jcc(Assembler::notEqual, L_key_192_256);
// 128 bit code follows here
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_loopTop_128);
__ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ pxor (xmm_result, xmm_key0); // do the aes rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesenc(xmm_result, as_XMMRegister(rnum));
}
for (int key_offset = 0x60; key_offset <= 0x90; key_offset += 0x10) {
aes_enc_key(xmm_result, xmm_temp, key, key_offset);
}
load_key(xmm_temp, key, 0xa0);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual, L_loopTop_128);
__ BIND(L_exit);
__ movdqu(Address(rvec, 0), xmm_result); // final value of r stored in rvec of CipherBlockChaining object
handleSOERegisters(false /*restoring*/);
__ movl(rax, 0); // return 0 (why?)
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
__ BIND(L_key_192_256);
// here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
__ cmpl(rax, 52);
__ jcc(Assembler::notEqual, L_key_256);
// 192-bit code follows here (could be changed to use more xmm registers)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_loopTop_192);
__ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ pxor (xmm_result, xmm_key0); // do the aes rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesenc(xmm_result, as_XMMRegister(rnum));
}
for (int key_offset = 0x60; key_offset <= 0xb0; key_offset += 0x10) {
aes_enc_key(xmm_result, xmm_temp, key, key_offset);
}
load_key(xmm_temp, key, 0xc0);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual, L_loopTop_192);
__ jmp(L_exit);
__ BIND(L_key_256);
// 256-bit code follows here (could be changed to use more xmm registers)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_loopTop_256);
__ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ pxor (xmm_result, xmm_key0); // do the aes rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesenc(xmm_result, as_XMMRegister(rnum));
}
for (int key_offset = 0x60; key_offset <= 0xd0; key_offset += 0x10) {
aes_enc_key(xmm_result, xmm_temp, key, key_offset);
}
load_key(xmm_temp, key, 0xe0);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual, L_loopTop_256);
__ jmp(L_exit);
return start;
}
// CBC AES Decryption.
// In 32-bit stub, because of lack of registers we do not try to parallelize 4 blocks at a time.
//
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
// c_rarg3 - r vector byte array address
// c_rarg4 - input length
//
address generate_cipherBlockChaining_decryptAESCrypt() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
address start = __ pc();
Label L_exit, L_key_192_256, L_key_256;
Label L_singleBlock_loopTop_128;
Label L_singleBlock_loopTop_192, L_singleBlock_loopTop_256;
const Register from = rsi; // source array address
const Register to = rdx; // destination array address
const Register key = rcx; // key array address
const Register rvec = rdi; // r byte array initialized from initvector array address
// and left with the results of the last encryption block
const Register len_reg = rbx; // src len (must be multiple of blocksize 16)
const Register pos = rax;
// xmm register assignments for the loops below
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
// first 6 keys preloaded into xmm2-xmm7
const int XMM_REG_NUM_KEY_FIRST = 2;
const int XMM_REG_NUM_KEY_LAST = 7;
const int FIRST_NON_REG_KEY_offset = 0x70;
const XMMRegister xmm_key_first = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
__ enter(); // required for proper stackwalking of RuntimeStub frame
handleSOERegisters(true /*saving*/);
// load registers from incoming parameters
const Address from_param(rbp, 8+0);
const Address to_param (rbp, 8+4);
const Address key_param (rbp, 8+8);
const Address rvec_param (rbp, 8+12);
const Address len_param (rbp, 8+16);
__ movptr(from , from_param);
__ movptr(to , to_param);
__ movptr(key , key_param);
__ movptr(rvec , rvec_param);
__ movptr(len_reg , len_param);
// the java expanded key ordering is rotated one position from what we want
// so we start from 0x10 here and hit 0x00 last
const XMMRegister xmm_key_shuf_mask = xmm1; // used temporarily to swap key bytes up front
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
// load up xmm regs 2 thru 6 with first 5 keys
for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x10; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask);
offset += 0x10;
}
// inside here, use the rvec register to point to previous block cipher
// with which we xor at the end of each newly decrypted block
const Register prev_block_cipher_ptr = rvec;
// now split to different paths depending on the keylen (len in ints of AESCrypt.KLE array (52=192, or 60=256))
__ movl(rax, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
__ cmpl(rax, 44);
__ jcc(Assembler::notEqual, L_key_192_256);
// 128-bit code follows here, parallelized
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_singleBlock_loopTop_128);
__ cmpptr(len_reg, 0); // any blocks left??
__ jcc(Assembler::equal, L_exit);
__ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
__ pxor (xmm_result, xmm_key_first); // do the aes dec rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesdec(xmm_result, as_XMMRegister(rnum));
}
for (int key_offset = FIRST_NON_REG_KEY_offset; key_offset <= 0xa0; key_offset += 0x10) { // 128-bit runs up to key offset a0
aes_dec_key(xmm_result, xmm_temp, key, key_offset);
}
load_key(xmm_temp, key, 0x00); // final key is stored in java expanded array at offset 0
__ aesdeclast(xmm_result, xmm_temp);
__ movdqu(xmm_temp, Address(prev_block_cipher_ptr, 0x00));
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ lea(prev_block_cipher_ptr, Address(from, pos, Address::times_1, 0)); // set up new ptr
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jmp(L_singleBlock_loopTop_128);
__ BIND(L_exit);
__ movdqu(xmm_temp, Address(prev_block_cipher_ptr, 0x00));
__ movptr(rvec , rvec_param); // restore this since used in loop
__ movdqu(Address(rvec, 0), xmm_temp); // final value of r stored in rvec of CipherBlockChaining object
handleSOERegisters(false /*restoring*/);
__ movl(rax, 0); // return 0 (why?)
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
__ BIND(L_key_192_256);
// here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
__ cmpl(rax, 52);
__ jcc(Assembler::notEqual, L_key_256);
// 192-bit code follows here (could be optimized to use parallelism)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_singleBlock_loopTop_192);
__ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
__ pxor (xmm_result, xmm_key_first); // do the aes dec rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesdec(xmm_result, as_XMMRegister(rnum));
}
for (int key_offset = FIRST_NON_REG_KEY_offset; key_offset <= 0xc0; key_offset += 0x10) { // 192-bit runs up to key offset c0
aes_dec_key(xmm_result, xmm_temp, key, key_offset);
}
load_key(xmm_temp, key, 0x00); // final key is stored in java expanded array at offset 0
__ aesdeclast(xmm_result, xmm_temp);
__ movdqu(xmm_temp, Address(prev_block_cipher_ptr, 0x00));
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ lea(prev_block_cipher_ptr, Address(from, pos, Address::times_1, 0)); // set up new ptr
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual,L_singleBlock_loopTop_192);
__ jmp(L_exit);
__ BIND(L_key_256);
// 256-bit code follows here (could be optimized to use parallelism)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_singleBlock_loopTop_256);
__ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
__ pxor (xmm_result, xmm_key_first); // do the aes dec rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesdec(xmm_result, as_XMMRegister(rnum));
}
for (int key_offset = FIRST_NON_REG_KEY_offset; key_offset <= 0xe0; key_offset += 0x10) { // 256-bit runs up to key offset e0
aes_dec_key(xmm_result, xmm_temp, key, key_offset);
}
load_key(xmm_temp, key, 0x00); // final key is stored in java expanded array at offset 0
__ aesdeclast(xmm_result, xmm_temp);
__ movdqu(xmm_temp, Address(prev_block_cipher_ptr, 0x00));
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ lea(prev_block_cipher_ptr, Address(from, pos, Address::times_1, 0)); // set up new ptr
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual,L_singleBlock_loopTop_256);
__ jmp(L_exit);
return start;
}
public:
// Information about frame layout at time of blocking runtime call.
// Note that we only have to preserve callee-saved registers since
@ -2332,6 +2855,16 @@ class StubGenerator: public StubCodeGenerator {
generate_arraycopy_stubs();
generate_math_stubs();
// don't bother generating these AES intrinsic stubs unless global flag is set
if (UseAESIntrinsics) {
StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask(); // might be needed by the others
StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt();
}
}

View File

@ -2941,6 +2941,548 @@ class StubGenerator: public StubCodeGenerator {
}
}
// AES intrinsic stubs
enum {AESBlockSize = 16};
address generate_key_shuffle_mask() {
__ align(16);
StubCodeMark mark(this, "StubRoutines", "key_shuffle_mask");
address start = __ pc();
__ emit_data64( 0x0405060700010203, relocInfo::none );
__ emit_data64( 0x0c0d0e0f08090a0b, relocInfo::none );
return start;
}
// Utility routine for loading a 128-bit key word in little endian format
// can optionally specify that the shuffle mask is already in an xmmregister
void load_key(XMMRegister xmmdst, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
__ movdqu(xmmdst, Address(key, offset));
if (xmm_shuf_mask != NULL) {
__ pshufb(xmmdst, xmm_shuf_mask);
} else {
__ pshufb(xmmdst, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
}
}
// aesenc using specified key+offset
// can optionally specify that the shuffle mask is already in an xmmregister
void aes_enc_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
load_key(xmmtmp, key, offset, xmm_shuf_mask);
__ aesenc(xmmdst, xmmtmp);
}
// aesdec using specified key+offset
// can optionally specify that the shuffle mask is already in an xmmregister
void aes_dec_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
load_key(xmmtmp, key, offset, xmm_shuf_mask);
__ aesdec(xmmdst, xmmtmp);
}
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
//
address generate_aescrypt_encryptBlock() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
Label L_doLast;
address start = __ pc();
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
const Register key = c_rarg2; // key array address
const Register keylen = rax;
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
const XMMRegister xmm_key_shuf_mask = xmm2;
__ enter(); // required for proper stackwalking of RuntimeStub frame
__ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
// keylen = # of 32-bit words, convert to 128-bit words
__ shrl(keylen, 2);
__ subl(keylen, 11); // every key has at least 11 128-bit words, some have more
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
__ movdqu(xmm_result, Address(from, 0)); // get 16 bytes of input
// For encryption, the java expanded key ordering is just what we need
// we don't know if the key is aligned, hence not using load-execute form
load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
__ pxor(xmm_result, xmm_temp);
for (int offset = 0x10; offset <= 0x90; offset += 0x10) {
aes_enc_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
}
load_key (xmm_temp, key, 0xa0, xmm_key_shuf_mask);
__ cmpl(keylen, 0);
__ jcc(Assembler::equal, L_doLast);
__ aesenc(xmm_result, xmm_temp); // only in 192 and 256 bit keys
aes_enc_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
load_key(xmm_temp, key, 0xc0, xmm_key_shuf_mask);
__ subl(keylen, 2);
__ jcc(Assembler::equal, L_doLast);
__ aesenc(xmm_result, xmm_temp); // only in 256 bit keys
aes_enc_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
load_key(xmm_temp, key, 0xe0, xmm_key_shuf_mask);
__ BIND(L_doLast);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, 0), xmm_result); // store the result
__ xorptr(rax, rax); // return 0
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
return start;
}
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
//
address generate_aescrypt_decryptBlock() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
Label L_doLast;
address start = __ pc();
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
const Register key = c_rarg2; // key array address
const Register keylen = rax;
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
const XMMRegister xmm_key_shuf_mask = xmm2;
__ enter(); // required for proper stackwalking of RuntimeStub frame
__ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
// keylen = # of 32-bit words, convert to 128-bit words
__ shrl(keylen, 2);
__ subl(keylen, 11); // every key has at least 11 128-bit words, some have more
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
__ movdqu(xmm_result, Address(from, 0));
// for decryption java expanded key ordering is rotated one position from what we want
// so we start from 0x10 here and hit 0x00 last
// we don't know if the key is aligned, hence not using load-execute form
load_key(xmm_temp, key, 0x10, xmm_key_shuf_mask);
__ pxor (xmm_result, xmm_temp);
for (int offset = 0x20; offset <= 0xa0; offset += 0x10) {
aes_dec_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
}
__ cmpl(keylen, 0);
__ jcc(Assembler::equal, L_doLast);
// only in 192 and 256 bit keys
aes_dec_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
aes_dec_key(xmm_result, xmm_temp, key, 0xc0, xmm_key_shuf_mask);
__ subl(keylen, 2);
__ jcc(Assembler::equal, L_doLast);
// only in 256 bit keys
aes_dec_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
aes_dec_key(xmm_result, xmm_temp, key, 0xe0, xmm_key_shuf_mask);
__ BIND(L_doLast);
// for decryption the aesdeclast operation is always on key+0x00
load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
__ aesdeclast(xmm_result, xmm_temp);
__ movdqu(Address(to, 0), xmm_result); // store the result
__ xorptr(rax, rax); // return 0
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
return start;
}
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
// c_rarg3 - r vector byte array address
// c_rarg4 - input length
//
address generate_cipherBlockChaining_encryptAESCrypt() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
address start = __ pc();
Label L_exit, L_key_192_256, L_key_256, L_loopTop_128, L_loopTop_192, L_loopTop_256;
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
const Register key = c_rarg2; // key array address
const Register rvec = c_rarg3; // r byte array initialized from initvector array address
// and left with the results of the last encryption block
#ifndef _WIN64
const Register len_reg = c_rarg4; // src len (must be multiple of blocksize 16)
#else
const Address len_mem(rsp, 6 * wordSize); // length is on stack on Win64
const Register len_reg = r10; // pick the first volatile windows register
#endif
const Register pos = rax;
// xmm register assignments for the loops below
const XMMRegister xmm_result = xmm0;
const XMMRegister xmm_temp = xmm1;
// keys 0-10 preloaded into xmm2-xmm12
const int XMM_REG_NUM_KEY_FIRST = 2;
const int XMM_REG_NUM_KEY_LAST = 12;
const XMMRegister xmm_key0 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
const XMMRegister xmm_key10 = as_XMMRegister(XMM_REG_NUM_KEY_LAST);
__ enter(); // required for proper stackwalking of RuntimeStub frame
#ifdef _WIN64
// on win64, fill len_reg from stack position
__ movl(len_reg, len_mem);
// save the xmm registers which must be preserved 6-12
__ subptr(rsp, -rsp_after_call_off * wordSize);
for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
__ movdqu(xmm_save(i), as_XMMRegister(i));
}
#endif
const XMMRegister xmm_key_shuf_mask = xmm_temp; // used temporarily to swap key bytes up front
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
// load up xmm regs 2 thru 12 with key 0x00 - 0xa0
for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x00; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask);
offset += 0x10;
}
__ movdqu(xmm_result, Address(rvec, 0x00)); // initialize xmm_result with r vec
// now split to different paths depending on the keylen (len in ints of AESCrypt.KLE array (52=192, or 60=256))
__ movl(rax, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
__ cmpl(rax, 44);
__ jcc(Assembler::notEqual, L_key_192_256);
// 128 bit code follows here
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_loopTop_128);
__ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ pxor (xmm_result, xmm_key0); // do the aes rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
__ aesenc(xmm_result, as_XMMRegister(rnum));
}
__ aesenclast(xmm_result, xmm_key10);
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual, L_loopTop_128);
__ BIND(L_exit);
__ movdqu(Address(rvec, 0), xmm_result); // final value of r stored in rvec of CipherBlockChaining object
#ifdef _WIN64
// restore xmm regs belonging to calling function
for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
__ movdqu(as_XMMRegister(i), xmm_save(i));
}
#endif
__ movl(rax, 0); // return 0 (why?)
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
__ BIND(L_key_192_256);
// here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
__ cmpl(rax, 52);
__ jcc(Assembler::notEqual, L_key_256);
// 192-bit code follows here (could be changed to use more xmm registers)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_loopTop_192);
__ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ pxor (xmm_result, xmm_key0); // do the aes rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesenc(xmm_result, as_XMMRegister(rnum));
}
aes_enc_key(xmm_result, xmm_temp, key, 0xb0);
load_key(xmm_temp, key, 0xc0);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual, L_loopTop_192);
__ jmp(L_exit);
__ BIND(L_key_256);
// 256-bit code follows here (could be changed to use more xmm registers)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_loopTop_256);
__ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input
__ pxor (xmm_result, xmm_temp); // xor with the current r vector
__ pxor (xmm_result, xmm_key0); // do the aes rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
__ aesenc(xmm_result, as_XMMRegister(rnum));
}
aes_enc_key(xmm_result, xmm_temp, key, 0xb0);
aes_enc_key(xmm_result, xmm_temp, key, 0xc0);
aes_enc_key(xmm_result, xmm_temp, key, 0xd0);
load_key(xmm_temp, key, 0xe0);
__ aesenclast(xmm_result, xmm_temp);
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual, L_loopTop_256);
__ jmp(L_exit);
return start;
}
// This is a version of CBC/AES Decrypt which does 4 blocks in a loop at a time
// to hide instruction latency
//
// Arguments:
//
// Inputs:
// c_rarg0 - source byte array address
// c_rarg1 - destination byte array address
// c_rarg2 - K (key) in little endian int array
// c_rarg3 - r vector byte array address
// c_rarg4 - input length
//
address generate_cipherBlockChaining_decryptAESCrypt_Parallel() {
assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
address start = __ pc();
Label L_exit, L_key_192_256, L_key_256;
Label L_singleBlock_loopTop_128, L_multiBlock_loopTop_128;
Label L_singleBlock_loopTop_192, L_singleBlock_loopTop_256;
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
const Register key = c_rarg2; // key array address
const Register rvec = c_rarg3; // r byte array initialized from initvector array address
// and left with the results of the last encryption block
#ifndef _WIN64
const Register len_reg = c_rarg4; // src len (must be multiple of blocksize 16)
#else
const Address len_mem(rsp, 6 * wordSize); // length is on stack on Win64
const Register len_reg = r10; // pick the first volatile windows register
#endif
const Register pos = rax;
// xmm register assignments for the loops below
const XMMRegister xmm_result = xmm0;
// keys 0-10 preloaded into xmm2-xmm12
const int XMM_REG_NUM_KEY_FIRST = 5;
const int XMM_REG_NUM_KEY_LAST = 15;
const XMMRegister xmm_key_first = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
const XMMRegister xmm_key_last = as_XMMRegister(XMM_REG_NUM_KEY_LAST);
__ enter(); // required for proper stackwalking of RuntimeStub frame
#ifdef _WIN64
// on win64, fill len_reg from stack position
__ movl(len_reg, len_mem);
// save the xmm registers which must be preserved 6-15
__ subptr(rsp, -rsp_after_call_off * wordSize);
for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
__ movdqu(xmm_save(i), as_XMMRegister(i));
}
#endif
// the java expanded key ordering is rotated one position from what we want
// so we start from 0x10 here and hit 0x00 last
const XMMRegister xmm_key_shuf_mask = xmm1; // used temporarily to swap key bytes up front
__ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
// load up xmm regs 5 thru 15 with key 0x10 - 0xa0 - 0x00
for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x10; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
if (rnum == XMM_REG_NUM_KEY_LAST) offset = 0x00;
load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask);
offset += 0x10;
}
const XMMRegister xmm_prev_block_cipher = xmm1; // holds cipher of previous block
// registers holding the four results in the parallelized loop
const XMMRegister xmm_result0 = xmm0;
const XMMRegister xmm_result1 = xmm2;
const XMMRegister xmm_result2 = xmm3;
const XMMRegister xmm_result3 = xmm4;
__ movdqu(xmm_prev_block_cipher, Address(rvec, 0x00)); // initialize with initial rvec
// now split to different paths depending on the keylen (len in ints of AESCrypt.KLE array (52=192, or 60=256))
__ movl(rax, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
__ cmpl(rax, 44);
__ jcc(Assembler::notEqual, L_key_192_256);
// 128-bit code follows here, parallelized
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_multiBlock_loopTop_128);
__ cmpptr(len_reg, 4*AESBlockSize); // see if at least 4 blocks left
__ jcc(Assembler::less, L_singleBlock_loopTop_128);
__ movdqu(xmm_result0, Address(from, pos, Address::times_1, 0*AESBlockSize)); // get next 4 blocks into xmmresult registers
__ movdqu(xmm_result1, Address(from, pos, Address::times_1, 1*AESBlockSize));
__ movdqu(xmm_result2, Address(from, pos, Address::times_1, 2*AESBlockSize));
__ movdqu(xmm_result3, Address(from, pos, Address::times_1, 3*AESBlockSize));
#define DoFour(opc, src_reg) \
__ opc(xmm_result0, src_reg); \
__ opc(xmm_result1, src_reg); \
__ opc(xmm_result2, src_reg); \
__ opc(xmm_result3, src_reg);
DoFour(pxor, xmm_key_first);
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
DoFour(aesdec, as_XMMRegister(rnum));
}
DoFour(aesdeclast, xmm_key_last);
// for each result, xor with the r vector of previous cipher block
__ pxor(xmm_result0, xmm_prev_block_cipher);
__ movdqu(xmm_prev_block_cipher, Address(from, pos, Address::times_1, 0*AESBlockSize));
__ pxor(xmm_result1, xmm_prev_block_cipher);
__ movdqu(xmm_prev_block_cipher, Address(from, pos, Address::times_1, 1*AESBlockSize));
__ pxor(xmm_result2, xmm_prev_block_cipher);
__ movdqu(xmm_prev_block_cipher, Address(from, pos, Address::times_1, 2*AESBlockSize));
__ pxor(xmm_result3, xmm_prev_block_cipher);
__ movdqu(xmm_prev_block_cipher, Address(from, pos, Address::times_1, 3*AESBlockSize)); // this will carry over to next set of blocks
__ movdqu(Address(to, pos, Address::times_1, 0*AESBlockSize), xmm_result0); // store 4 results into the next 64 bytes of output
__ movdqu(Address(to, pos, Address::times_1, 1*AESBlockSize), xmm_result1);
__ movdqu(Address(to, pos, Address::times_1, 2*AESBlockSize), xmm_result2);
__ movdqu(Address(to, pos, Address::times_1, 3*AESBlockSize), xmm_result3);
__ addptr(pos, 4*AESBlockSize);
__ subptr(len_reg, 4*AESBlockSize);
__ jmp(L_multiBlock_loopTop_128);
// registers used in the non-parallelized loops
const XMMRegister xmm_prev_block_cipher_save = xmm2;
const XMMRegister xmm_temp = xmm3;
__ align(OptoLoopAlignment);
__ BIND(L_singleBlock_loopTop_128);
__ cmpptr(len_reg, 0); // any blocks left??
__ jcc(Assembler::equal, L_exit);
__ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
__ movdqa(xmm_prev_block_cipher_save, xmm_result); // save for next r vector
__ pxor (xmm_result, xmm_key_first); // do the aes dec rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
__ aesdec(xmm_result, as_XMMRegister(rnum));
}
__ aesdeclast(xmm_result, xmm_key_last);
__ pxor (xmm_result, xmm_prev_block_cipher); // xor with the current r vector
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jmp(L_singleBlock_loopTop_128);
__ BIND(L_exit);
__ movdqu(Address(rvec, 0), xmm_prev_block_cipher); // final value of r stored in rvec of CipherBlockChaining object
#ifdef _WIN64
// restore regs belonging to calling function
for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
__ movdqu(as_XMMRegister(i), xmm_save(i));
}
#endif
__ movl(rax, 0); // return 0 (why?)
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(0);
__ BIND(L_key_192_256);
// here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
__ cmpl(rax, 52);
__ jcc(Assembler::notEqual, L_key_256);
// 192-bit code follows here (could be optimized to use parallelism)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_singleBlock_loopTop_192);
__ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
__ movdqa(xmm_prev_block_cipher_save, xmm_result); // save for next r vector
__ pxor (xmm_result, xmm_key_first); // do the aes dec rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
__ aesdec(xmm_result, as_XMMRegister(rnum));
}
aes_dec_key(xmm_result, xmm_temp, key, 0xb0); // 192-bit key goes up to c0
aes_dec_key(xmm_result, xmm_temp, key, 0xc0);
__ aesdeclast(xmm_result, xmm_key_last); // xmm15 always came from key+0
__ pxor (xmm_result, xmm_prev_block_cipher); // xor with the current r vector
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual,L_singleBlock_loopTop_192);
__ jmp(L_exit);
__ BIND(L_key_256);
// 256-bit code follows here (could be optimized to use parallelism)
__ movptr(pos, 0);
__ align(OptoLoopAlignment);
__ BIND(L_singleBlock_loopTop_256);
__ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
__ movdqa(xmm_prev_block_cipher_save, xmm_result); // save for next r vector
__ pxor (xmm_result, xmm_key_first); // do the aes dec rounds
for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
__ aesdec(xmm_result, as_XMMRegister(rnum));
}
aes_dec_key(xmm_result, xmm_temp, key, 0xb0); // 256-bit key goes up to e0
aes_dec_key(xmm_result, xmm_temp, key, 0xc0);
aes_dec_key(xmm_result, xmm_temp, key, 0xd0);
aes_dec_key(xmm_result, xmm_temp, key, 0xe0);
__ aesdeclast(xmm_result, xmm_key_last); // xmm15 came from key+0
__ pxor (xmm_result, xmm_prev_block_cipher); // xor with the current r vector
__ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output
// no need to store r to memory until we exit
__ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block
__ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize);
__ jcc(Assembler::notEqual,L_singleBlock_loopTop_256);
__ jmp(L_exit);
return start;
}
#undef __
#define __ masm->
@ -3135,6 +3677,16 @@ class StubGenerator: public StubCodeGenerator {
generate_arraycopy_stubs();
generate_math_stubs();
// don't bother generating these AES intrinsic stubs unless global flag is set
if (UseAESIntrinsics) {
StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask(); // needed by the others
StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
}
}
public:

View File

@ -44,3 +44,4 @@
address StubRoutines::x86::_verify_mxcsr_entry = NULL;
address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = NULL;
address StubRoutines::x86::_key_shuffle_mask_addr = NULL;

View File

@ -41,10 +41,14 @@ class x86 {
private:
static address _verify_mxcsr_entry;
static address _verify_fpu_cntrl_wrd_entry;
// shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
static address _key_shuffle_mask_addr;
public:
static address verify_mxcsr_entry() { return _verify_mxcsr_entry; }
static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
};
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }

View File

@ -56,3 +56,4 @@ address StubRoutines::x86::_float_sign_flip = NULL;
address StubRoutines::x86::_double_sign_mask = NULL;
address StubRoutines::x86::_double_sign_flip = NULL;
address StubRoutines::x86::_mxcsr_std = NULL;
address StubRoutines::x86::_key_shuffle_mask_addr = NULL;

View File

@ -54,6 +54,8 @@ class x86 {
static address _double_sign_mask;
static address _double_sign_flip;
static address _mxcsr_std;
// shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
static address _key_shuffle_mask_addr;
public:
@ -116,6 +118,9 @@ class x86 {
{
return _mxcsr_std;
}
static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
};
#endif // CPU_X86_VM_STUBROUTINES_X86_64_HPP

View File

@ -419,13 +419,16 @@ void VM_Version::get_processor_features() {
if (UseAVX < 1)
_cpuFeatures &= ~CPU_AVX;
if (!UseAES && !FLAG_IS_DEFAULT(UseAES))
_cpuFeatures &= ~CPU_AES;
if (logical_processors_per_package() == 1) {
// HT processor could be installed on a system which doesn't support HT.
_cpuFeatures &= ~CPU_HT;
}
char buf[256];
jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
cores_per_cpu(), threads_per_core(),
cpu_family(), _model, _stepping,
(supports_cmov() ? ", cmov" : ""),
@ -441,6 +444,7 @@ void VM_Version::get_processor_features() {
(supports_popcnt() ? ", popcnt" : ""),
(supports_avx() ? ", avx" : ""),
(supports_avx2() ? ", avx2" : ""),
(supports_aes() ? ", aes" : ""),
(supports_mmx_ext() ? ", mmxext" : ""),
(supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
(supports_lzcnt() ? ", lzcnt": ""),
@ -472,6 +476,29 @@ void VM_Version::get_processor_features() {
if (!supports_avx ()) // Drop to 0 if no AVX support
UseAVX = 0;
// Use AES instructions if available.
if (supports_aes()) {
if (FLAG_IS_DEFAULT(UseAES)) {
UseAES = true;
}
} else if (UseAES) {
if (!FLAG_IS_DEFAULT(UseAES))
warning("AES instructions not available on this CPU");
FLAG_SET_DEFAULT(UseAES, false);
}
// The AES intrinsic stubs require AES instruction support (of course)
// but also require AVX mode for misaligned SSE access
if (UseAES && (UseAVX > 0)) {
if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
UseAESIntrinsics = true;
}
} else if (UseAESIntrinsics) {
if (!FLAG_IS_DEFAULT(UseAESIntrinsics))
warning("AES intrinsics not available on this CPU");
FLAG_SET_DEFAULT(UseAESIntrinsics, false);
}
#ifdef COMPILER2
if (UseFPUForSpilling) {
if (UseSSE < 2) {
@ -714,6 +741,9 @@ void VM_Version::get_processor_features() {
if (UseAVX > 0) {
tty->print(" UseAVX=%d",UseAVX);
}
if (UseAES) {
tty->print(" UseAES=1");
}
tty->cr();
tty->print("Allocation");
if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow_prefetch()) {

View File

@ -78,7 +78,9 @@ public:
sse4_2 : 1,
: 2,
popcnt : 1,
: 3,
: 1,
aes : 1,
: 1,
osxsave : 1,
avx : 1,
: 3;
@ -244,7 +246,8 @@ protected:
CPU_TSC = (1 << 15),
CPU_TSCINV = (1 << 16),
CPU_AVX = (1 << 17),
CPU_AVX2 = (1 << 18)
CPU_AVX2 = (1 << 18),
CPU_AES = (1 << 19)
} cpuFeatureFlags;
enum {
@ -420,6 +423,8 @@ protected:
result |= CPU_TSC;
if (_cpuid_info.ext_cpuid7_edx.bits.tsc_invariance != 0)
result |= CPU_TSCINV;
if (_cpuid_info.std_cpuid1_ecx.bits.aes != 0)
result |= CPU_AES;
// AMD features.
if (is_amd()) {
@ -544,6 +549,7 @@ public:
static bool supports_avx() { return (_cpuFeatures & CPU_AVX) != 0; }
static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; }
static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; }
static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; }
// Intel features
static bool is_intel_family_core() { return is_intel() &&

View File

@ -4102,9 +4102,158 @@ instruct vsll4L_reg_imm(vecY dst, vecY src, immI8 shift) %{
// ----------------------- LogicalRightShift -----------------------------------
// Shorts/Chars vector logical right shift produces incorrect Java result
// Shorts vector logical right shift produces incorrect Java result
// for negative data because java code convert short value into int with
// sign extension before a shift.
// sign extension before a shift. But char vectors are fine since chars are
// unsigned values.
instruct vsrl2S(vecS dst, vecS shift) %{
predicate(n->as_Vector()->length() == 2);
match(Set dst (URShiftVS dst shift));
format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %}
ins_encode %{
__ psrlw($dst$$XMMRegister, $shift$$XMMRegister);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl2S_imm(vecS dst, immI8 shift) %{
predicate(n->as_Vector()->length() == 2);
match(Set dst (URShiftVS dst shift));
format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %}
ins_encode %{
__ psrlw($dst$$XMMRegister, (int)$shift$$constant);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl2S_reg(vecS dst, vecS src, vecS shift) %{
predicate(UseAVX > 0 && n->as_Vector()->length() == 2);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %}
ins_encode %{
bool vector256 = false;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl2S_reg_imm(vecS dst, vecS src, immI8 shift) %{
predicate(UseAVX > 0 && n->as_Vector()->length() == 2);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %}
ins_encode %{
bool vector256 = false;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl4S(vecD dst, vecS shift) %{
predicate(n->as_Vector()->length() == 4);
match(Set dst (URShiftVS dst shift));
format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %}
ins_encode %{
__ psrlw($dst$$XMMRegister, $shift$$XMMRegister);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl4S_imm(vecD dst, immI8 shift) %{
predicate(n->as_Vector()->length() == 4);
match(Set dst (URShiftVS dst shift));
format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %}
ins_encode %{
__ psrlw($dst$$XMMRegister, (int)$shift$$constant);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl4S_reg(vecD dst, vecD src, vecS shift) %{
predicate(UseAVX > 0 && n->as_Vector()->length() == 4);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %}
ins_encode %{
bool vector256 = false;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl4S_reg_imm(vecD dst, vecD src, immI8 shift) %{
predicate(UseAVX > 0 && n->as_Vector()->length() == 4);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %}
ins_encode %{
bool vector256 = false;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl8S(vecX dst, vecS shift) %{
predicate(n->as_Vector()->length() == 8);
match(Set dst (URShiftVS dst shift));
format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %}
ins_encode %{
__ psrlw($dst$$XMMRegister, $shift$$XMMRegister);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl8S_imm(vecX dst, immI8 shift) %{
predicate(n->as_Vector()->length() == 8);
match(Set dst (URShiftVS dst shift));
format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %}
ins_encode %{
__ psrlw($dst$$XMMRegister, (int)$shift$$constant);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl8S_reg(vecX dst, vecX src, vecS shift) %{
predicate(UseAVX > 0 && n->as_Vector()->length() == 8);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %}
ins_encode %{
bool vector256 = false;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl8S_reg_imm(vecX dst, vecX src, immI8 shift) %{
predicate(UseAVX > 0 && n->as_Vector()->length() == 8);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %}
ins_encode %{
bool vector256 = false;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl16S_reg(vecY dst, vecY src, vecS shift) %{
predicate(UseAVX > 1 && n->as_Vector()->length() == 16);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %}
ins_encode %{
bool vector256 = true;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector256);
%}
ins_pipe( pipe_slow );
%}
instruct vsrl16S_reg_imm(vecY dst, vecY src, immI8 shift) %{
predicate(UseAVX > 1 && n->as_Vector()->length() == 16);
match(Set dst (URShiftVS src shift));
format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %}
ins_encode %{
bool vector256 = true;
__ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector256);
%}
ins_pipe( pipe_slow );
%}
// Integers vector logical right shift
instruct vsrl2I(vecD dst, vecS shift) %{

View File

@ -31,12 +31,17 @@
return _masm;
}
protected:
address generate_entry(address entry_point) {
ZeroEntry *entry = (ZeroEntry *) assembler()->pc();
assembler()->advance(sizeof(ZeroEntry));
public:
static address generate_entry_impl(MacroAssembler* masm, address entry_point) {
ZeroEntry *entry = (ZeroEntry *) masm->pc();
masm->advance(sizeof(ZeroEntry));
entry->set_entry_point(entry_point);
return (address) entry;
}
protected:
address generate_entry(address entry_point) {
return generate_entry_impl(assembler(), entry_point);
}
#endif // CPU_ZERO_VM_CPPINTERPRETERGENERATOR_ZERO_HPP

View File

@ -180,25 +180,6 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
method, istate->osr_entry(), istate->osr_buf(), THREAD);
return;
}
else if (istate->msg() == BytecodeInterpreter::call_method_handle) {
oop method_handle = istate->callee();
// Trim back the stack to put the parameters at the top
stack->set_sp(istate->stack() + 1);
// Make the call
process_method_handle(method_handle, THREAD);
fixup_after_potential_safepoint();
// Convert the result
istate->set_stack(stack->sp() - 1);
// Restore the stack
stack->set_sp(istate->stack_limit() + 1);
// Resume the interpreter
istate->set_msg(BytecodeInterpreter::method_resume);
}
else {
ShouldNotReachHere();
}
@ -535,35 +516,35 @@ int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
if (entry->is_volatile()) {
switch (entry->flag_state()) {
case ctos:
SET_LOCALS_INT(object->char_field_acquire(entry->f2()), 0);
SET_LOCALS_INT(object->char_field_acquire(entry->f2_as_index()), 0);
break;
case btos:
SET_LOCALS_INT(object->byte_field_acquire(entry->f2()), 0);
SET_LOCALS_INT(object->byte_field_acquire(entry->f2_as_index()), 0);
break;
case stos:
SET_LOCALS_INT(object->short_field_acquire(entry->f2()), 0);
SET_LOCALS_INT(object->short_field_acquire(entry->f2_as_index()), 0);
break;
case itos:
SET_LOCALS_INT(object->int_field_acquire(entry->f2()), 0);
SET_LOCALS_INT(object->int_field_acquire(entry->f2_as_index()), 0);
break;
case ltos:
SET_LOCALS_LONG(object->long_field_acquire(entry->f2()), 0);
SET_LOCALS_LONG(object->long_field_acquire(entry->f2_as_index()), 0);
break;
case ftos:
SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2()), 0);
SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2_as_index()), 0);
break;
case dtos:
SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2()), 0);
SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2_as_index()), 0);
break;
case atos:
SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2()), 0);
SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2_as_index()), 0);
break;
default:
@ -573,35 +554,35 @@ int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
else {
switch (entry->flag_state()) {
case ctos:
SET_LOCALS_INT(object->char_field(entry->f2()), 0);
SET_LOCALS_INT(object->char_field(entry->f2_as_index()), 0);
break;
case btos:
SET_LOCALS_INT(object->byte_field(entry->f2()), 0);
SET_LOCALS_INT(object->byte_field(entry->f2_as_index()), 0);
break;
case stos:
SET_LOCALS_INT(object->short_field(entry->f2()), 0);
SET_LOCALS_INT(object->short_field(entry->f2_as_index()), 0);
break;
case itos:
SET_LOCALS_INT(object->int_field(entry->f2()), 0);
SET_LOCALS_INT(object->int_field(entry->f2_as_index()), 0);
break;
case ltos:
SET_LOCALS_LONG(object->long_field(entry->f2()), 0);
SET_LOCALS_LONG(object->long_field(entry->f2_as_index()), 0);
break;
case ftos:
SET_LOCALS_FLOAT(object->float_field(entry->f2()), 0);
SET_LOCALS_FLOAT(object->float_field(entry->f2_as_index()), 0);
break;
case dtos:
SET_LOCALS_DOUBLE(object->double_field(entry->f2()), 0);
SET_LOCALS_DOUBLE(object->double_field(entry->f2_as_index()), 0);
break;
case atos:
SET_LOCALS_OBJECT(object->obj_field(entry->f2()), 0);
SET_LOCALS_OBJECT(object->obj_field(entry->f2_as_index()), 0);
break;
default:
@ -629,516 +610,6 @@ int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
return 0;
}
int CppInterpreter::method_handle_entry(Method* method,
intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
int argument_slots = method->size_of_parameters();
int result_slots = type2size[result_type_of(method)];
intptr_t *vmslots = stack->sp();
intptr_t *unwind_sp = vmslots + argument_slots;
// Find the MethodType
address p = (address) method;
for (jint* pc = method->method_type_offsets_chain(); (*pc) != -1; pc++) {
p = *(address*)(p + (*pc));
}
oop method_type = (oop) p;
// The MethodHandle is in the slot after the arguments
int num_vmslots = argument_slots - 1;
oop method_handle = VMSLOTS_OBJECT(num_vmslots);
// InvokeGeneric requires some extra shuffling
oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
bool is_exact = mhtype == method_type;
if (!is_exact) {
if (true || // FIXME
method->intrinsic_id() == vmIntrinsics::_invokeExact) {
CALL_VM_NOCHECK_NOFIX(
SharedRuntime::throw_WrongMethodTypeException(
thread, method_type, mhtype));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
stack->set_sp(unwind_sp);
return 0;
}
assert(method->intrinsic_id() == vmIntrinsics::_invokeGeneric, "should be");
// Load up an adapter from the calling type
// NB the x86 code for this (in methodHandles_x86.cpp, search for
// "genericInvoker") is really really odd. I'm hoping it's trying
// to accomodate odd VM/class library combinations I can ignore.
oop adapter = NULL; //FIXME: load the adapter from the CP cache
IF (adapter == NULL) {
CALL_VM_NOCHECK_NOFIX(
SharedRuntime::throw_WrongMethodTypeException(
thread, method_type, mhtype));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
stack->set_sp(unwind_sp);
return 0;
}
// Adapters are shared among form-families of method-type. The
// type being called is passed as a trusted first argument so that
// the adapter knows the actual types of its arguments and return
// values.
insert_vmslots(num_vmslots + 1, 1, THREAD);
if (HAS_PENDING_EXCEPTION) {
// NB all oops trashed!
stack->set_sp(unwind_sp);
return 0;
}
vmslots = stack->sp();
num_vmslots++;
SET_VMSLOTS_OBJECT(method_type, num_vmslots);
method_handle = adapter;
}
// Start processing
process_method_handle(method_handle, THREAD);
if (HAS_PENDING_EXCEPTION)
result_slots = 0;
// If this is an invokeExact then the eventual callee will not
// have unwound the method handle argument so we have to do it.
// If a result is being returned the it will be above the method
// handle argument we're unwinding.
if (is_exact) {
intptr_t result[2];
for (int i = 0; i < result_slots; i++)
result[i] = stack->pop();
stack->pop();
for (int i = result_slots - 1; i >= 0; i--)
stack->push(result[i]);
}
// Check
assert(stack->sp() == unwind_sp - result_slots, "should be");
// No deoptimized frames on the stack
return 0;
}
void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
intptr_t *vmslots = stack->sp();
bool direct_to_method = false;
BasicType src_rtype = T_ILLEGAL;
BasicType dst_rtype = T_ILLEGAL;
MethodHandleEntry *entry =
java_lang_invoke_MethodHandle::vmentry(method_handle);
MethodHandles::EntryKind entry_kind =
(MethodHandles::EntryKind) (((intptr_t) entry) & 0xffffffff);
Method* method = NULL;
switch (entry_kind) {
case MethodHandles::_invokestatic_mh:
direct_to_method = true;
break;
case MethodHandles::_invokespecial_mh:
case MethodHandles::_invokevirtual_mh:
case MethodHandles::_invokeinterface_mh:
{
oop receiver =
VMSLOTS_OBJECT(
java_lang_invoke_MethodHandle::vmslots(method_handle) - 1);
if (receiver == NULL) {
stack->set_sp(calculate_unwind_sp(stack, method_handle));
CALL_VM_NOCHECK_NOFIX(
throw_exception(
thread, vmSymbols::java_lang_NullPointerException()));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
return;
}
if (entry_kind != MethodHandles::_invokespecial_mh) {
intptr_t index = java_lang_invoke_DirectMethodHandle::vmindex(method_handle);
InstanceKlass* rcvrKlass =
(InstanceKlass *) receiver->klass();
if (entry_kind == MethodHandles::_invokevirtual_mh) {
method = (Method*) rcvrKlass->start_of_vtable()[index];
}
else {
oop iclass = java_lang_invoke_MethodHandle::next_target(method_handle);
itableOffsetEntry* ki =
(itableOffsetEntry *) rcvrKlass->start_of_itable();
int i, length = rcvrKlass->itable_length();
for (i = 0; i < length; i++, ki++ ) {
if (ki->interface_klass() == iclass)
break;
}
if (i == length) {
stack->set_sp(calculate_unwind_sp(stack, method_handle));
CALL_VM_NOCHECK_NOFIX(
throw_exception(
thread, vmSymbols::java_lang_IncompatibleClassChangeError()));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
return;
}
itableMethodEntry* im = ki->first_method_entry(receiver->klass());
method = im[index].method();
if (method == NULL) {
stack->set_sp(calculate_unwind_sp(stack, method_handle));
CALL_VM_NOCHECK_NOFIX(
throw_exception(
thread, vmSymbols::java_lang_AbstractMethodError()));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
return;
}
}
}
}
direct_to_method = true;
break;
case MethodHandles::_bound_ref_direct_mh:
case MethodHandles::_bound_int_direct_mh:
case MethodHandles::_bound_long_direct_mh:
direct_to_method = true;
// fall through
case MethodHandles::_bound_ref_mh:
case MethodHandles::_bound_int_mh:
case MethodHandles::_bound_long_mh:
{
BasicType arg_type = T_ILLEGAL;
int arg_mask = -1;
int arg_slots = -1;
MethodHandles::get_ek_bound_mh_info(
entry_kind, arg_type, arg_mask, arg_slots);
int arg_slot =
java_lang_invoke_BoundMethodHandle::vmargslot(method_handle);
// Create the new slot(s)
intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
insert_vmslots(arg_slot, arg_slots, THREAD);
if (HAS_PENDING_EXCEPTION) {
// all oops trashed
stack->set_sp(unwind_sp);
return;
}
vmslots = stack->sp();
// Store bound argument into new stack slot
oop arg = java_lang_invoke_BoundMethodHandle::argument(method_handle);
if (arg_type == T_OBJECT) {
assert(arg_slots == 1, "should be");
SET_VMSLOTS_OBJECT(arg, arg_slot);
}
else {
jvalue arg_value;
arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
switch (arg_type) {
case T_BOOLEAN:
SET_VMSLOTS_INT(arg_value.z, arg_slot);
break;
case T_CHAR:
SET_VMSLOTS_INT(arg_value.c, arg_slot);
break;
case T_BYTE:
SET_VMSLOTS_INT(arg_value.b, arg_slot);
break;
case T_SHORT:
SET_VMSLOTS_INT(arg_value.s, arg_slot);
break;
case T_INT:
SET_VMSLOTS_INT(arg_value.i, arg_slot);
break;
case T_FLOAT:
SET_VMSLOTS_FLOAT(arg_value.f, arg_slot);
break;
case T_LONG:
SET_VMSLOTS_LONG(arg_value.j, arg_slot + 1);
break;
case T_DOUBLE:
SET_VMSLOTS_DOUBLE(arg_value.d, arg_slot + 1);
break;
default:
tty->print_cr("unhandled type %s", type2name(arg_type));
ShouldNotReachHere();
}
}
}
break;
case MethodHandles::_adapter_retype_only:
case MethodHandles::_adapter_retype_raw:
src_rtype = result_type_of_handle(
java_lang_invoke_MethodHandle::next_target(method_handle));
dst_rtype = result_type_of_handle(method_handle);
break;
case MethodHandles::_adapter_check_cast:
{
int arg_slot =
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
oop arg = VMSLOTS_OBJECT(arg_slot);
if (arg != NULL) {
Klass* objKlassOop = arg->klass();
Klass* klassOf = java_lang_Class::as_Klass(
java_lang_invoke_AdapterMethodHandle::argument(method_handle));
if (objKlassOop != klassOf &&
!objKlassOop->is_subtype_of(klassOf)) {
ResourceMark rm(THREAD);
const char* objName = Klass::cast(objKlassOop)->external_name();
const char* klassName = Klass::cast(klassOf)->external_name();
char* message = SharedRuntime::generate_class_cast_message(
objName, klassName);
stack->set_sp(calculate_unwind_sp(stack, method_handle));
CALL_VM_NOCHECK_NOFIX(
throw_exception(
thread, vmSymbols::java_lang_ClassCastException(), message));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
return;
}
}
}
break;
case MethodHandles::_adapter_dup_args:
{
int arg_slot =
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
int conv =
java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
int num_slots = -MethodHandles::adapter_conversion_stack_move(conv);
assert(num_slots > 0, "should be");
// Create the new slot(s)
intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
stack->overflow_check(num_slots, THREAD);
if (HAS_PENDING_EXCEPTION) {
// all oops trashed
stack->set_sp(unwind_sp);
return;
}
// Duplicate the arguments
for (int i = num_slots - 1; i >= 0; i--)
stack->push(*VMSLOTS_SLOT(arg_slot + i));
vmslots = stack->sp(); // unused, but let the compiler figure that out
}
break;
case MethodHandles::_adapter_drop_args:
{
int arg_slot =
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
int conv =
java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
int num_slots = MethodHandles::adapter_conversion_stack_move(conv);
assert(num_slots > 0, "should be");
remove_vmslots(arg_slot, num_slots, THREAD); // doesn't trap
vmslots = stack->sp(); // unused, but let the compiler figure that out
}
break;
case MethodHandles::_adapter_opt_swap_1:
case MethodHandles::_adapter_opt_swap_2:
case MethodHandles::_adapter_opt_rot_1_up:
case MethodHandles::_adapter_opt_rot_1_down:
case MethodHandles::_adapter_opt_rot_2_up:
case MethodHandles::_adapter_opt_rot_2_down:
{
int arg1 =
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
int conv =
java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
int arg2 = MethodHandles::adapter_conversion_vminfo(conv);
int swap_bytes = 0, rotate = 0;
MethodHandles::get_ek_adapter_opt_swap_rot_info(
entry_kind, swap_bytes, rotate);
int swap_slots = swap_bytes >> LogBytesPerWord;
intptr_t tmp;
switch (rotate) {
case 0: // swap
for (int i = 0; i < swap_slots; i++) {
tmp = *VMSLOTS_SLOT(arg1 + i);
SET_VMSLOTS_SLOT(VMSLOTS_SLOT(arg2 + i), arg1 + i);
SET_VMSLOTS_SLOT(&tmp, arg2 + i);
}
break;
case 1: // up
assert(arg1 - swap_slots > arg2, "should be");
tmp = *VMSLOTS_SLOT(arg1);
for (int i = arg1 - swap_slots; i >= arg2; i--)
SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i + swap_slots);
SET_VMSLOTS_SLOT(&tmp, arg2);
break;
case -1: // down
assert(arg2 - swap_slots > arg1, "should be");
tmp = *VMSLOTS_SLOT(arg1);
for (int i = arg1 + swap_slots; i <= arg2; i++)
SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i - swap_slots);
SET_VMSLOTS_SLOT(&tmp, arg2);
break;
default:
ShouldNotReachHere();
}
}
break;
case MethodHandles::_adapter_opt_i2l:
{
int arg_slot =
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
int arg = VMSLOTS_INT(arg_slot);
intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
insert_vmslots(arg_slot, 1, THREAD);
if (HAS_PENDING_EXCEPTION) {
// all oops trashed
stack->set_sp(unwind_sp);
return;
}
vmslots = stack->sp();
arg_slot++;
SET_VMSLOTS_LONG(arg, arg_slot);
}
break;
case MethodHandles::_adapter_opt_unboxi:
case MethodHandles::_adapter_opt_unboxl:
{
int arg_slot =
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
oop arg = VMSLOTS_OBJECT(arg_slot);
jvalue arg_value;
if (arg == NULL) {
// queue a nullpointer exception for the caller
stack->set_sp(calculate_unwind_sp(stack, method_handle));
CALL_VM_NOCHECK_NOFIX(
throw_exception(
thread, vmSymbols::java_lang_NullPointerException()));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
return;
}
BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
if (arg_type == T_LONG || arg_type == T_DOUBLE) {
intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
insert_vmslots(arg_slot, 1, THREAD);
if (HAS_PENDING_EXCEPTION) {
// all oops trashed
stack->set_sp(unwind_sp);
return;
}
vmslots = stack->sp();
arg_slot++;
}
switch (arg_type) {
case T_BOOLEAN:
SET_VMSLOTS_INT(arg_value.z, arg_slot);
break;
case T_CHAR:
SET_VMSLOTS_INT(arg_value.c, arg_slot);
break;
case T_BYTE:
SET_VMSLOTS_INT(arg_value.b, arg_slot);
break;
case T_SHORT:
SET_VMSLOTS_INT(arg_value.s, arg_slot);
break;
case T_INT:
SET_VMSLOTS_INT(arg_value.i, arg_slot);
break;
case T_FLOAT:
SET_VMSLOTS_FLOAT(arg_value.f, arg_slot);
break;
case T_LONG:
SET_VMSLOTS_LONG(arg_value.j, arg_slot);
break;
case T_DOUBLE:
SET_VMSLOTS_DOUBLE(arg_value.d, arg_slot);
break;
default:
tty->print_cr("unhandled type %s", type2name(arg_type));
ShouldNotReachHere();
}
}
break;
default:
tty->print_cr("unhandled entry_kind %s",
MethodHandles::entry_name(entry_kind));
ShouldNotReachHere();
}
// Continue along the chain
if (direct_to_method) {
if (method == NULL) {
method =
(Method*) java_lang_invoke_MethodHandle::vmtarget(method_handle);
}
address entry_point = method->from_interpreted_entry();
Interpreter::invoke_method(method, entry_point, THREAD);
}
else {
process_method_handle(
java_lang_invoke_MethodHandle::next_target(method_handle), THREAD);
}
// NB all oops now trashed
// Adapt the result type, if necessary
if (src_rtype != dst_rtype && !HAS_PENDING_EXCEPTION) {
switch (dst_rtype) {
case T_VOID:
for (int i = 0; i < type2size[src_rtype]; i++)
stack->pop();
return;
case T_INT:
switch (src_rtype) {
case T_VOID:
stack->overflow_check(1, CHECK);
stack->push(0);
return;
case T_BOOLEAN:
case T_CHAR:
case T_BYTE:
case T_SHORT:
return;
}
// INT results sometimes need narrowing
case T_BOOLEAN:
case T_CHAR:
case T_BYTE:
case T_SHORT:
switch (src_rtype) {
case T_INT:
return;
}
}
tty->print_cr("unhandled conversion:");
tty->print_cr("src_rtype = %s", type2name(src_rtype));
tty->print_cr("dst_rtype = %s", type2name(dst_rtype));
ShouldNotReachHere();
}
}
// The new slots will be inserted before slot insert_before.
// Slots < insert_before will have the same slot number after the insert.
// Slots >= insert_before will become old_slot + num_slots.
@ -1380,10 +851,6 @@ address AbstractInterpreterGenerator::generate_method_entry(
entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry();
break;
case Interpreter::method_handle:
entry_point = ((InterpreterGenerator*) this)->generate_method_handle_entry();
break;
case Interpreter::java_lang_math_sin:
case Interpreter::java_lang_math_cos:
case Interpreter::java_lang_math_tan:
@ -1391,6 +858,8 @@ address AbstractInterpreterGenerator::generate_method_entry(
case Interpreter::java_lang_math_log:
case Interpreter::java_lang_math_log10:
case Interpreter::java_lang_math_sqrt:
case Interpreter::java_lang_math_pow:
case Interpreter::java_lang_math_exp:
entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);
break;

View File

@ -36,7 +36,6 @@
static int native_entry(Method* method, intptr_t UNUSED, TRAPS);
static int accessor_entry(Method* method, intptr_t UNUSED, TRAPS);
static int empty_entry(Method* method, intptr_t UNUSED, TRAPS);
static int method_handle_entry(Method* method, intptr_t UNUSED, TRAPS);
public:
// Main loop of normal_entry
@ -44,7 +43,6 @@
private:
// Helpers for method_handle_entry
static void process_method_handle(oop method_handle, TRAPS);
static void insert_vmslots(int insert_before, int num_slots, TRAPS);
static void remove_vmslots(int first_slot, int num_slots, TRAPS);
static BasicType result_type_of_handle(oop method_handle);

View File

@ -351,7 +351,7 @@ void SharkFrame::identify_word(int frame_index,
switch (offset) {
case pc_off:
strncpy(fieldbuf, "pc", buflen);
if (method()->is_oop()) {
if (method()->is_method()) {
nmethod *code = method()->code();
if (code && code->pc_desc_at(pc())) {
SimpleScopeDesc ssd(code, pc());
@ -367,7 +367,7 @@ void SharkFrame::identify_word(int frame_index,
case method_off:
strncpy(fieldbuf, "method", buflen);
if (method()->is_oop()) {
if (method()->is_method()) {
method()->name_and_sig_as_C_string(valuebuf, buflen);
}
return;
@ -378,7 +378,7 @@ void SharkFrame::identify_word(int frame_index,
}
// Variable part
if (method()->is_oop()) {
if (method()->is_method()) {
identify_vp_word(frame_index, addr_of_word(offset),
addr_of_word(header_words + 1),
unextended_sp() + method()->max_stack(),
@ -430,4 +430,3 @@ intptr_t *frame::initial_deoptimization_info() {
// unused... but returns fp() to minimize changes introduced by 7087445
return fp();
}

View File

@ -36,6 +36,8 @@ inline frame::frame() {
_deopt_state = unknown;
}
inline address frame::sender_pc() const { ShouldNotCallThis(); }
inline frame::frame(ZeroFrame* zf, intptr_t* sp) {
_zeroframe = zf;
_sp = sp;

View File

@ -40,7 +40,7 @@ int InlineCacheBuffer::ic_stub_code_size() {
}
void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin,
Metadata* cached_oop,
void* cached_oop,
address entry_point) {
// NB ic_stub_code_size() must return the size of the code we generate
ShouldNotCallThis();
@ -51,7 +51,6 @@ address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) {
ShouldNotCallThis();
}
Metadata* InlineCacheBuffer::ic_buffer_cached_oop(address code_begin) {
// NB ic_stub_code_size() must return the size of the code we generate
void* InlineCacheBuffer::ic_buffer_cached_value(address code_begin) {
ShouldNotCallThis();
}

View File

@ -24,26 +24,159 @@
*/
#include "precompiled.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/allocation.inline.hpp"
#include "prims/methodHandles.hpp"
int MethodHandles::adapter_conversion_ops_supported_mask() {
return ((1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
//|(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
);
// FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
void MethodHandles::invoke_target(Method* method, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
// Trim back the stack to put the parameters at the top
stack->set_sp(istate->stack() + 1);
Interpreter::invoke_method(method, method->from_interpreted_entry(), THREAD);
// Convert the result
istate->set_stack(stack->sp() - 1);
}
void MethodHandles::generate_method_handle_stub(MacroAssembler* masm,
MethodHandles::EntryKind ek) {
init_entry(ek, (MethodHandleEntry *) ek);
oop MethodHandles::popFromStack(TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
intptr_t* topOfStack = istate->stack();
oop top = STACK_OBJECT(-1);
MORE_STACK(-1);
istate->set_stack(topOfStack);
return top;
}
int MethodHandles::method_handle_entry_invokeBasic(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
intptr_t* topOfStack = istate->stack();
// 'this' is a MethodHandle. We resolve the target method by accessing this.form.vmentry.vmtarget.
int numArgs = method->size_of_parameters();
oop lform1 = java_lang_invoke_MethodHandle::form(STACK_OBJECT(-numArgs)); // this.form
oop vmEntry1 = java_lang_invoke_LambdaForm::vmentry(lform1);
Method* vmtarget = (Method*) java_lang_invoke_MemberName::vmtarget(vmEntry1);
invoke_target(vmtarget, THREAD);
// No deoptimized frames on the stack
return 0;
}
int MethodHandles::method_handle_entry_linkToStaticOrSpecial(Method* method, intptr_t UNUSED, TRAPS) {
// Pop appendix argument from stack. This is a MemberName which we resolve to the
// target method.
oop vmentry = popFromStack(THREAD);
Method* vmtarget = (Method*) java_lang_invoke_MemberName::vmtarget(vmentry);
invoke_target(vmtarget, THREAD);
return 0;
}
int MethodHandles::method_handle_entry_linkToInterface(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
// Pop appendix argument from stack. This is a MemberName which we resolve to the
// target method.
oop vmentry = popFromStack(THREAD);
intptr_t* topOfStack = istate->stack();
// Resolve target method by looking up in the receiver object's itable.
Klass* clazz = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(vmentry));
intptr_t vmindex = java_lang_invoke_MemberName::vmindex(vmentry);
Method* target = (Method*) java_lang_invoke_MemberName::vmtarget(vmentry);
int numArgs = target->size_of_parameters();
oop recv = STACK_OBJECT(-numArgs);
InstanceKlass* klass_part = InstanceKlass::cast(recv->klass());
itableOffsetEntry* ki = (itableOffsetEntry*) klass_part->start_of_itable();
int i;
for ( i = 0 ; i < klass_part->itable_length() ; i++, ki++ ) {
if (ki->interface_klass() == clazz) break;
}
itableMethodEntry* im = ki->first_method_entry(recv->klass());
Method* vmtarget = im[vmindex].method();
invoke_target(vmtarget, THREAD);
return 0;
}
int MethodHandles::method_handle_entry_linkToVirtual(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
// Pop appendix argument from stack. This is a MemberName which we resolve to the
// target method.
oop vmentry = popFromStack(THREAD);
intptr_t* topOfStack = istate->stack();
// Resolve target method by looking up in the receiver object's vtable.
intptr_t vmindex = java_lang_invoke_MemberName::vmindex(vmentry);
Method* target = (Method*) java_lang_invoke_MemberName::vmtarget(vmentry);
int numArgs = target->size_of_parameters();
oop recv = STACK_OBJECT(-numArgs);
Klass* clazz = recv->klass();
Klass* klass_part = InstanceKlass::cast(clazz);
klassVtable* vtable = klass_part->vtable();
Method* vmtarget = vtable->method_at(vmindex);
invoke_target(vmtarget, THREAD);
return 0;
}
int MethodHandles::method_handle_entry_invalid(Method* method, intptr_t UNUSED, TRAPS) {
ShouldNotReachHere();
return 0;
}
address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* masm,
vmIntrinsics::ID iid) {
switch (iid) {
case vmIntrinsics::_invokeGeneric:
case vmIntrinsics::_compiledLambdaForm:
// Perhaps surprisingly, the symbolic references visible to Java are not directly used.
// They are linked to Java-generated adapters via MethodHandleNatives.linkMethod.
// They all allow an appendix argument.
return InterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invalid);
case vmIntrinsics::_invokeBasic:
return InterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invokeBasic);
case vmIntrinsics::_linkToStatic:
case vmIntrinsics::_linkToSpecial:
return InterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToStaticOrSpecial);
case vmIntrinsics::_linkToInterface:
return InterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToInterface);
case vmIntrinsics::_linkToVirtual:
return InterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToVirtual);
default:
ShouldNotReachHere();
return NULL;
}
}

View File

@ -26,6 +26,14 @@
// Adapters
enum /* platform_dependent_constants */ {
adapter_code_size = 0
adapter_code_size = sizeof(ZeroEntry) * (Interpreter::method_handle_invoke_LAST - Interpreter::method_handle_invoke_FIRST + 1)
};
private:
static oop popFromStack(TRAPS);
static void invoke_target(Method* method, TRAPS);
static int method_handle_entry_invokeBasic(Method* method, intptr_t UNUSED, TRAPS);
static int method_handle_entry_linkToStaticOrSpecial(Method* method, intptr_t UNUSED, TRAPS);
static int method_handle_entry_linkToVirtual(Method* method, intptr_t UNUSED, TRAPS);
static int method_handle_entry_linkToInterface(Method* method, intptr_t UNUSED, TRAPS);
static int method_handle_entry_invalid(Method* method, intptr_t UNUSED, TRAPS);

View File

@ -114,5 +114,8 @@ class ConcreteRegisterImpl : public AbstractRegisterImpl {
};
CONSTANT_REGISTER_DECLARATION(Register, noreg, (-1));
#ifndef DONT_USE_REGISTER_DEFINES
#define noreg ((Register)(noreg_RegisterEnumValue))
#endif
#endif // CPU_ZERO_VM_REGISTER_ZERO_HPP

View File

@ -77,3 +77,7 @@ void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src,
CodeBuffer* dst) {
ShouldNotCallThis();
}
void metadata_Relocation::pd_fix_value(address x) {
ShouldNotCallThis();
}

View File

@ -35,6 +35,7 @@
#include "runtime/sharedRuntime.hpp"
#include "runtime/vframeArray.hpp"
#include "vmreg_zero.inline.hpp"
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#endif
@ -47,6 +48,12 @@
#endif
static address zero_null_code_stub() {
address start = ShouldNotCallThisStub();
return start;
}
int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
int total_args_passed,
@ -63,16 +70,14 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(
AdapterFingerPrint *fingerprint) {
return AdapterHandlerLibrary::new_entry(
fingerprint,
ShouldNotCallThisStub(),
ShouldNotCallThisStub(),
ShouldNotCallThisStub());
CAST_FROM_FN_PTR(address,zero_null_code_stub),
CAST_FROM_FN_PTR(address,zero_null_code_stub),
CAST_FROM_FN_PTR(address,zero_null_code_stub));
}
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
methodHandle method,
int compile_id,
int total_args_passed,
int max_arg,
BasicType *sig_bt,
VMRegPair *regs,
BasicType ret_type) {
@ -96,19 +101,20 @@ uint SharedRuntime::out_preserve_stack_slots() {
ShouldNotCallThis();
}
JRT_LEAF(void, zero_stub())
ShouldNotCallThis();
JRT_END
static RuntimeStub* generate_empty_runtime_stub(const char* name) {
CodeBuffer buffer(name, 0, 0);
return RuntimeStub::new_runtime_stub(name, &buffer, 0, 0, NULL, false);
return CAST_FROM_FN_PTR(RuntimeStub*,zero_stub);
}
static SafepointBlob* generate_empty_safepoint_blob() {
CodeBuffer buffer("handler_blob", 0, 0);
return SafepointBlob::create(&buffer, NULL, 0);
return CAST_FROM_FN_PTR(SafepointBlob*,zero_stub);
}
static DeoptimizationBlob* generate_empty_deopt_blob() {
CodeBuffer buffer("handler_blob", 0, 0);
return DeoptimizationBlob::create(&buffer, NULL, 0, 0, 0, 0);
return CAST_FROM_FN_PTR(DeoptimizationBlob*,zero_stub);
}
@ -116,7 +122,7 @@ void SharedRuntime::generate_deopt_blob() {
_deopt_blob = generate_empty_deopt_blob();
}
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, bool cause_return) {
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
return generate_empty_safepoint_blob();
}
@ -124,6 +130,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
return generate_empty_runtime_stub("resolve_blob");
}
int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
int total_args_passed) {

View File

@ -342,7 +342,6 @@ BsdAttachOperation* BsdAttachListener::dequeue() {
// get the credentials of the peer and check the effective uid/guid
// - check with jeff on this.
#ifdef _ALLBSD_SOURCE
uid_t puid;
gid_t pgid;
if (::getpeereid(s, &puid, &pgid) != 0) {
@ -350,17 +349,6 @@ BsdAttachOperation* BsdAttachListener::dequeue() {
RESTARTABLE(::close(s), res);
continue;
}
#else
struct ucred cred_info;
socklen_t optlen = sizeof(cred_info);
if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void*)&cred_info, &optlen) == -1) {
int res;
RESTARTABLE(::close(s), res);
continue;
}
uid_t puid = cred_info.uid;
gid_t pgid = cred_info.gid;
#endif
uid_t euid = geteuid();
gid_t egid = getegid();

View File

@ -39,18 +39,12 @@
private:
#ifdef _ALLBSD_SOURCE
#ifdef __APPLE__
typedef thread_t thread_id_t;
#else
typedef pthread_t thread_id_t;
#endif
#else
typedef pid_t thread_id_t;
#endif
// _pthread_id is the pthread id, which is used by library calls
// (e.g. pthread_kill).
pthread_t _pthread_id;

File diff suppressed because it is too large Load Diff

View File

@ -56,19 +56,6 @@ class Bsd {
static int sigflags[MAXSIGNUM];
static int (*_clock_gettime)(clockid_t, struct timespec *);
#ifndef _ALLBSD_SOURCE
static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
static address _initial_thread_stack_bottom;
static uintptr_t _initial_thread_stack_size;
static const char *_glibc_version;
static const char *_libpthread_version;
static bool _is_floating_stack;
static bool _is_NPTL;
static bool _supports_fast_thread_cpu_time;
#endif
static GrowableArray<int>* _cpu_to_node;
@ -76,28 +63,14 @@ class Bsd {
static julong _physical_memory;
static pthread_t _main_thread;
#ifndef _ALLBSD_SOURCE
static Mutex* _createThread_lock;
#endif
static int _page_size;
static julong available_memory();
static julong physical_memory() { return _physical_memory; }
static void initialize_system_info();
#ifndef _ALLBSD_SOURCE
static void set_glibc_version(const char *s) { _glibc_version = s; }
static void set_libpthread_version(const char *s) { _libpthread_version = s; }
#endif
static bool supports_variable_stack_size();
#ifndef _ALLBSD_SOURCE
static void set_is_NPTL() { _is_NPTL = true; }
static void set_is_BsdThreads() { _is_NPTL = false; }
static void set_is_floating_stack() { _is_floating_stack = true; }
#endif
static void rebuild_cpu_to_node_map();
static GrowableArray<int>* cpu_to_node() { return _cpu_to_node; }
@ -106,25 +79,10 @@ class Bsd {
public:
static void init_thread_fpu_state();
#ifndef _ALLBSD_SOURCE
static int get_fpu_control_word();
static void set_fpu_control_word(int fpu_control);
#endif
static pthread_t main_thread(void) { return _main_thread; }
#ifndef _ALLBSD_SOURCE
// returns kernel thread id (similar to LWP id on Solaris), which can be
// used to access /proc
static pid_t gettid();
static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; }
static Mutex* createThread_lock(void) { return _createThread_lock; }
#endif
static void hotspot_sigmask(Thread* thread);
#ifndef _ALLBSD_SOURCE
static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; }
static uintptr_t initial_thread_stack_size(void) { return _initial_thread_stack_size; }
#endif
static bool is_initial_thread(void);
static int page_size(void) { return _page_size; }
@ -161,23 +119,6 @@ class Bsd {
static struct sigaction *get_chained_signal_action(int sig);
static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
#ifndef _ALLBSD_SOURCE
// GNU libc and libpthread version strings
static const char *glibc_version() { return _glibc_version; }
static const char *libpthread_version() { return _libpthread_version; }
// NPTL or BsdThreads?
static bool is_BsdThreads() { return !_is_NPTL; }
static bool is_NPTL() { return _is_NPTL; }
// NPTL is always floating stack. BsdThreads could be using floating
// stack or fixed stack.
static bool is_floating_stack() { return _is_floating_stack; }
static void libpthread_init();
static bool libnuma_init();
static void* libnuma_dlsym(void* handle, const char* name);
#endif
// Minimum stack size a thread can be created with (allowing
// the VM to completely create the thread and enter user code)
static size_t min_stack_allowed;
@ -186,22 +127,9 @@ class Bsd {
static size_t default_stack_size(os::ThreadType thr_type);
static size_t default_guard_size(os::ThreadType thr_type);
#ifndef _ALLBSD_SOURCE
static void capture_initial_stack(size_t max_size);
// Stack overflow handling
static bool manually_expand_stack(JavaThread * t, address addr);
static int max_register_window_saves_before_flushing();
#endif
// Real-time clock functions
static void clock_init(void);
#ifndef _ALLBSD_SOURCE
// fast POSIX clocks support
static void fast_thread_clock_init(void);
#endif
static inline bool supports_monotonic_clock() {
return _clock_gettime != NULL;
}
@ -210,18 +138,6 @@ class Bsd {
return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
}
#ifndef _ALLBSD_SOURCE
static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) {
return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1;
}
static bool supports_fast_thread_cpu_time() {
return _supports_fast_thread_cpu_time;
}
static jlong fast_thread_cpu_time(clockid_t clockid);
#endif
// Stack repair handling
// none present

View File

@ -25,10 +25,6 @@
#ifndef OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
#define OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
#ifndef _ALLBSD_SOURCE
#include <byteswap.h>
#endif
#ifdef __APPLE__
#include <libkern/OSByteOrder.h>
#endif

View File

@ -76,7 +76,7 @@
# include <ucontext.h>
#endif
#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) && !defined(__NetBSD__)
#if !defined(__APPLE__) && !defined(__NetBSD__)
# include <pthread_np.h>
#endif
@ -489,23 +489,6 @@ JVM_handle_bsd_signal(int sig,
// to handle_unexpected_exception way down below.
thread->disable_stack_red_zone();
tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
#ifndef _ALLBSD_SOURCE
} else {
// Accessing stack address below sp may cause SEGV if current
// thread has MAP_GROWSDOWN stack. This should only happen when
// current thread was created by user code with MAP_GROWSDOWN flag
// and then attached to VM. See notes in os_bsd.cpp.
if (thread->osthread()->expanding_stack() == 0) {
thread->osthread()->set_expanding_stack();
if (os::Bsd::manually_expand_stack(thread, addr)) {
thread->osthread()->clear_expanding_stack();
return 1;
}
thread->osthread()->clear_expanding_stack();
} else {
fatal("recursive segv. expanding stack.");
}
#endif
}
}
}
@ -744,61 +727,21 @@ JVM_handle_bsd_signal(int sig,
ShouldNotReachHere();
}
#ifdef _ALLBSD_SOURCE
// From solaris_i486.s ported to bsd_i486.s
extern "C" void fixcw();
#endif
void os::Bsd::init_thread_fpu_state(void) {
#ifndef AMD64
# ifdef _ALLBSD_SOURCE
// Set fpu to 53 bit precision. This happens too early to use a stub.
fixcw();
# else
// set fpu to 53 bit precision
set_fpu_control_word(0x27f);
# endif
#endif // !AMD64
}
#ifndef _ALLBSD_SOURCE
int os::Bsd::get_fpu_control_word(void) {
#ifdef AMD64
return 0;
#else
int fpu_control;
_FPU_GETCW(fpu_control);
return fpu_control & 0xffff;
#endif // AMD64
}
void os::Bsd::set_fpu_control_word(int fpu_control) {
#ifndef AMD64
_FPU_SETCW(fpu_control);
#endif // !AMD64
}
#endif
// Check that the bsd kernel version is 2.4 or higher since earlier
// versions do not support SSE without patches.
bool os::supports_sse() {
#if defined(AMD64) || defined(_ALLBSD_SOURCE)
return true;
#else
struct utsname uts;
if( uname(&uts) != 0 ) return false; // uname fails?
char *minor_string;
int major = strtol(uts.release,&minor_string,10);
int minor = strtol(minor_string+1,NULL,10);
bool result = (major > 2 || (major==2 && minor >= 4));
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose) {
tty->print("OS version is %d.%d, which %s support SSE/SSE2\n",
major,minor, result ? "DOES" : "does NOT");
}
#endif
return result;
#endif // AMD64
}
bool os::is_allocatable(size_t bytes) {
@ -836,46 +779,7 @@ size_t os::Bsd::min_stack_allowed = (48 DEBUG_ONLY(+4))*K;
#define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
#endif
#ifdef _ALLBSD_SOURCE
bool os::Bsd::supports_variable_stack_size() { return true; }
#else
// Test if pthread library can support variable thread stack size. BsdThreads
// in fixed stack mode allocates 2M fixed slot for each thread. BsdThreads
// in floating stack mode and NPTL support variable stack size.
bool os::Bsd::supports_variable_stack_size() {
if (os::Bsd::is_NPTL()) {
// NPTL, yes
return true;
} else {
// Note: We can't control default stack size when creating a thread.
// If we use non-default stack size (pthread_attr_setstacksize), both
// floating stack and non-floating stack BsdThreads will return the
// same value. This makes it impossible to implement this function by
// detecting thread stack size directly.
//
// An alternative approach is to check %gs. Fixed-stack BsdThreads
// do not use %gs, so its value is 0. Floating-stack BsdThreads use
// %gs (either as LDT selector or GDT selector, depending on kernel)
// to access thread specific data.
//
// Note that %gs is a reserved glibc register since early 2001, so
// applications are not allowed to change its value (Ulrich Drepper from
// Redhat confirmed that all known offenders have been modified to use
// either %fs or TSD). In the worst case scenario, when VM is embedded in
// a native application that plays with %gs, we might see non-zero %gs
// even BsdThreads is running in fixed stack mode. As the result, we'll
// return true and skip _thread_safety_check(), so we may not be able to
// detect stack-heap collisions. But otherwise it's harmless.
//
#ifdef __GNUC__
return (GET_GS() != 0);
#else
return false;
#endif
}
}
#endif
#endif // AMD64
// return default stack size for thr_type
@ -943,7 +847,7 @@ static void current_stack_region(address * bottom, size_t * size) {
*bottom = (address)((char *)ss.ss_sp - ss.ss_size);
*size = ss.ss_size;
#elif defined(_ALLBSD_SOURCE)
#else
pthread_attr_t attr;
int rslt = pthread_attr_init(&attr);
@ -963,33 +867,6 @@ static void current_stack_region(address * bottom, size_t * size) {
}
pthread_attr_destroy(&attr);
#else
if (os::Bsd::is_initial_thread()) {
// initial thread needs special handling because pthread_getattr_np()
// may return bogus value.
*bottom = os::Bsd::initial_thread_stack_bottom();
*size = os::Bsd::initial_thread_stack_size();
} else {
pthread_attr_t attr;
int rslt = pthread_getattr_np(pthread_self(), &attr);
// JVM needs to know exact stack location, abort if it fails
if (rslt != 0) {
if (rslt == ENOMEM) {
vm_exit_out_of_memory(0, "pthread_getattr_np");
} else {
fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
}
}
if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
fatal("Can not locate current stack attributes!");
}
pthread_attr_destroy(&attr);
}
#endif
assert(os::current_stack_pointer() >= *bottom &&
os::current_stack_pointer() < *bottom + *size, "just checking");

View File

@ -23,7 +23,7 @@
*
*/
#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) && !defined(__NetBSD__)
#if !defined(__APPLE__) && !defined(__NetBSD__)
#include <pthread.h>
# include <pthread_np.h> /* For pthread_attr_get_np */
#endif
@ -178,26 +178,6 @@ JVM_handle_bsd_signal(int sig,
thread->disable_stack_red_zone();
ShouldNotCallThis();
}
#ifndef _ALLBSD_SOURCE
else {
// Accessing stack address below sp may cause SEGV if
// current thread has MAP_GROWSDOWN stack. This should
// only happen when current thread was created by user
// code with MAP_GROWSDOWN flag and then attached to VM.
// See notes in os_bsd.cpp.
if (thread->osthread()->expanding_stack() == 0) {
thread->osthread()->set_expanding_stack();
if (os::Bsd::manually_expand_stack(thread, addr)) {
thread->osthread()->clear_expanding_stack();
return true;
}
thread->osthread()->clear_expanding_stack();
}
else {
fatal("recursive segv. expanding stack.");
}
}
#endif
}
}
@ -266,16 +246,6 @@ void os::Bsd::init_thread_fpu_state(void) {
// Nothing to do
}
#ifndef _ALLBSD_SOURCE
int os::Bsd::get_fpu_control_word() {
ShouldNotCallThis();
}
void os::Bsd::set_fpu_control_word(int fpu) {
ShouldNotCallThis();
}
#endif
bool os::is_allocatable(size_t bytes) {
#ifdef _LP64
return true;
@ -339,7 +309,7 @@ static void current_stack_region(address *bottom, size_t *size) {
stack_top = (address) ss.ss_sp;
stack_bytes = ss.ss_size;
stack_bottom = stack_top - stack_bytes;
#elif defined(_ALLBSD_SOURCE)
#else
pthread_attr_t attr;
int rslt = pthread_attr_init(&attr);
@ -362,67 +332,6 @@ static void current_stack_region(address *bottom, size_t *size) {
pthread_attr_destroy(&attr);
stack_top = stack_bottom + stack_bytes;
#else /* Linux */
pthread_attr_t attr;
int res = pthread_getattr_np(pthread_self(), &attr);
if (res != 0) {
if (res == ENOMEM) {
vm_exit_out_of_memory(0, "pthread_getattr_np");
}
else {
fatal(err_msg("pthread_getattr_np failed with errno = " INT32_FORMAT,
res));
}
}
res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes);
if (res != 0) {
fatal(err_msg("pthread_attr_getstack failed with errno = " INT32_FORMAT,
res));
}
stack_top = stack_bottom + stack_bytes;
// The block of memory returned by pthread_attr_getstack() includes
// guard pages where present. We need to trim these off.
size_t page_bytes = os::Bsd::page_size();
assert(((intptr_t) stack_bottom & (page_bytes - 1)) == 0, "unaligned stack");
size_t guard_bytes;
res = pthread_attr_getguardsize(&attr, &guard_bytes);
if (res != 0) {
fatal(err_msg(
"pthread_attr_getguardsize failed with errno = " INT32_FORMAT, res));
}
int guard_pages = align_size_up(guard_bytes, page_bytes) / page_bytes;
assert(guard_bytes == guard_pages * page_bytes, "unaligned guard");
#ifdef IA64
// IA64 has two stacks sharing the same area of memory, a normal
// stack growing downwards and a register stack growing upwards.
// Guard pages, if present, are in the centre. This code splits
// the stack in two even without guard pages, though in theory
// there's nothing to stop us allocating more to the normal stack
// or more to the register stack if one or the other were found
// to grow faster.
int total_pages = align_size_down(stack_bytes, page_bytes) / page_bytes;
stack_bottom += (total_pages - guard_pages) / 2 * page_bytes;
#endif // IA64
stack_bottom += guard_bytes;
pthread_attr_destroy(&attr);
// The initial thread has a growable stack, and the size reported
// by pthread_attr_getstack is the maximum size it could possibly
// be given what currently mapped. This can be huge, so we cap it.
if (os::Bsd::is_initial_thread()) {
stack_bytes = stack_top - stack_bottom;
if (stack_bytes > JavaThread::stack_size_at_create())
stack_bytes = JavaThread::stack_size_at_create();
stack_bottom = stack_top - stack_bytes;
}
#endif
assert(os::current_stack_pointer() >= stack_bottom, "should do");

View File

@ -85,9 +85,11 @@ void end_of_file() { }
#include "dlfcn.h"
#define DECODE_INSTRUCTIONS_NAME "decode_instructions_virtual"
#define DECODE_INSTRUCTIONS_VIRTUAL_NAME "decode_instructions_virtual"
#define DECODE_INSTRUCTIONS_NAME "decode_instructions"
#define HSDIS_NAME "hsdis"
static void* decode_instructions_pv = 0;
static void* decode_instructions_sv = 0;
static const char* hsdis_path[] = {
HSDIS_NAME"-"LIBARCH LIB_EXT,
"./" HSDIS_NAME"-"LIBARCH LIB_EXT,
@ -101,11 +103,12 @@ static const char* load_decode_instructions() {
void* dllib = NULL;
const char* *next_in_path = hsdis_path;
while (1) {
decode_instructions_pv = dlsym(dllib, DECODE_INSTRUCTIONS_NAME);
if (decode_instructions_pv != NULL)
decode_instructions_pv = dlsym(dllib, DECODE_INSTRUCTIONS_VIRTUAL_NAME);
decode_instructions_sv = dlsym(dllib, DECODE_INSTRUCTIONS_NAME);
if (decode_instructions_pv != NULL || decode_instructions_sv != NULL)
return NULL;
if (dllib != NULL)
return "plugin does not defined "DECODE_INSTRUCTIONS_NAME;
return "plugin does not defined "DECODE_INSTRUCTIONS_VIRTUAL_NAME" and "DECODE_INSTRUCTIONS_NAME;
for (dllib = NULL; dllib == NULL; ) {
const char* next_lib = (*next_in_path++);
if (next_lib == NULL)
@ -213,20 +216,44 @@ void disassemble(uintptr_t from, uintptr_t to) {
printf("%s: %s\n", err, dlerror());
exit(1);
}
printf("Decoding from %p to %p...\n", from, to);
decode_instructions_ftype decode_instructions
= (decode_instructions_ftype) decode_instructions_pv;
decode_func_vtype decode_instructions_v
= (decode_func_vtype) decode_instructions_pv;
decode_func_stype decode_instructions_s
= (decode_func_stype) decode_instructions_sv;
void* res;
if (raw && xml) {
res = (*decode_instructions)(from, to, (unsigned char*)from, to - from, simple_handle_event, stdout, NULL, stdout, options);
} else if (raw) {
res = (*decode_instructions)(from, to, (unsigned char*)from, to - from, simple_handle_event, stdout, NULL, stdout, options);
} else {
res = (*decode_instructions)(from, to, (unsigned char*)from, to - from,
handle_event, (void*) event_cookie,
fprintf_callback, stdout,
options);
if (decode_instructions_pv != NULL) {
printf("\nDecoding from %p to %p...with %s\n", from, to, DECODE_INSTRUCTIONS_VIRTUAL_NAME);
if (raw) {
res = (*decode_instructions_v)(from, to,
(unsigned char*)from, to - from,
simple_handle_event, stdout,
NULL, stdout,
options, 0);
} else {
res = (*decode_instructions_v)(from, to,
(unsigned char*)from, to - from,
handle_event, (void*) event_cookie,
fprintf_callback, stdout,
options, 0);
}
if (res != (void*)to)
printf("*** Result was %p!\n", res);
}
void* sres;
if (decode_instructions_sv != NULL) {
printf("\nDecoding from %p to %p...with old decode_instructions\n", from, to, DECODE_INSTRUCTIONS_NAME);
if (raw) {
sres = (*decode_instructions_s)(from, to,
simple_handle_event, stdout,
NULL, stdout,
options);
} else {
sres = (*decode_instructions_s)(from, to,
handle_event, (void*) event_cookie,
fprintf_callback, stdout,
options);
}
if (sres != (void *)to)
printf("*** Result of decode_instructions %p!\n", sres);
}
if (res != (void*)to)
printf("*** Result was %p!\n", res);
}

View File

@ -99,7 +99,7 @@ decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,
unsigned char* buffer, uintptr_t length,
event_callback_t event_callback_arg, void* event_stream_arg,
printf_callback_t printf_callback_arg, void* printf_stream_arg,
const char* options) {
const char* options, int newline) {
struct hsdis_app_data app_data;
memset(&app_data, 0, sizeof(app_data));
app_data.start_va = start_va;
@ -110,7 +110,7 @@ decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,
app_data.event_stream = event_stream_arg;
app_data.printf_callback = printf_callback_arg;
app_data.printf_stream = printf_stream_arg;
app_data.do_newline = false;
app_data.do_newline = newline == 0 ? false : true;
return decode(&app_data, options);
}
@ -132,7 +132,7 @@ decode_instructions(void* start_pv, void* end_pv,
event_stream_arg,
printf_callback_arg,
printf_stream_arg,
options);
options, false);
}
static void* decode(struct hsdis_app_data* app_data, const char* options) {
@ -173,7 +173,7 @@ static void* decode(struct hsdis_app_data* app_data, const char* options) {
if (!app_data->losing) {
const char* insn_close = format_insn_close("/insn", &app_data->dinfo,
buf, sizeof(buf));
(*event_callback)(event_stream, insn_close, (void*) p) != NULL;
(*event_callback)(event_stream, insn_close, (void*) p);
if (app_data->do_newline) {
/* follow each complete insn by a nice newline */
@ -182,13 +182,14 @@ static void* decode(struct hsdis_app_data* app_data, const char* options) {
}
}
(*event_callback)(event_stream, "/insns", (void*) p);
if (app_data->losing) (*event_callback)(event_stream, "/insns", (void*) p);
return (void*) p;
}
}
/* take the address of the function, for luck, and also test the typedef: */
const decode_instructions_ftype decode_instructions_address = &decode_instructions_virtual;
const decode_func_vtype decode_func_virtual_address = &decode_instructions_virtual;
const decode_func_stype decode_func_address = &decode_instructions;
static const char* format_insn_close(const char* close,
disassemble_info* dinfo,

View File

@ -47,6 +47,9 @@
where tag is a simple identifier, signifying (as in XML) a element start,
element end, and standalone element. (To render as XML, add angle brackets.)
*/
#ifndef SHARED_TOOLS_HSDIS_H
#define SHARED_TOOLS_HSDIS_H
extern
#ifdef DLL_EXPORT
DLL_EXPORT
@ -57,16 +60,37 @@ void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,
void* event_stream,
int (*printf_callback)(void*, const char*, ...),
void* printf_stream,
const char* options);
const char* options,
int newline /* bool value for nice new line */);
/* This is the compatability interface for older versions of hotspot */
extern
#ifdef DLL_ENTRY
DLL_ENTRY
#endif
void* decode_instructions(void* start_pv, void* end_pv,
void* (*event_callback)(void*, const char*, void*),
void* event_stream,
int (*printf_callback)(void*, const char*, ...),
void* printf_stream,
const char* options);
/* convenience typedefs */
typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*);
typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...);
typedef void* (*decode_instructions_ftype) (uintptr_t start_va, uintptr_t end_va,
unsigned char* buffer, uintptr_t length,
decode_instructions_event_callback_ftype event_callback,
void* event_stream,
decode_instructions_printf_callback_ftype printf_callback,
void* printf_stream,
const char* options);
typedef void* (*decode_func_vtype) (uintptr_t start_va, uintptr_t end_va,
unsigned char* buffer, uintptr_t length,
decode_instructions_event_callback_ftype event_callback,
void* event_stream,
decode_instructions_printf_callback_ftype printf_callback,
void* printf_stream,
const char* options,
int newline);
typedef void* (*decode_func_stype) (void* start_pv, void* end_pv,
decode_instructions_event_callback_ftype event_callback,
void* event_stream,
decode_instructions_printf_callback_ftype printf_callback,
void* printf_stream,
const char* options);
#endif /* SHARED_TOOLS_HSDIS_H */

View File

@ -758,7 +758,7 @@ void CodeBuffer::relocate_code_to(CodeBuffer* dest) const {
}
}
if (dest->blob() == NULL) {
if (dest->blob() == NULL && dest_filled != NULL) {
// Destination is a final resting place, not just another buffer.
// Normalize uninitialized bytes in the final padding.
Copy::fill_to_bytes(dest_filled, dest_end - dest_filled,

Some files were not shown because too many files have changed in this diff Show More