Merge
This commit is contained in:
commit
1d66e87cea
@ -372,3 +372,4 @@ f80c841ae2545eaf9acd2724bccc305d98cefbe2 jdk-9+124
|
||||
8fa686245bd2a072ece3392743460030f0854520 jdk-9+127
|
||||
b30ae794d974d7dd3eb4e84203f70021823fa6c6 jdk-9+128
|
||||
f5902d3841b82cac6e7716a20c24e8e916fb14a8 jdk-9+129
|
||||
d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130
|
||||
|
@ -684,7 +684,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
|
||||
AC_SUBST(CXXFLAGS_TESTEXE)
|
||||
|
||||
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
|
||||
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
|
||||
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
|
||||
|
||||
AC_SUBST(LDFLAGS_TESTLIB)
|
||||
AC_SUBST(LDFLAGS_TESTEXE)
|
||||
@ -713,20 +713,17 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
|
||||
IF_FALSE: [$2CXXSTD_CXXFLAG=""])
|
||||
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
|
||||
$2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}"
|
||||
AC_SUBST([$2CXXSTD_CXXFLAG])
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
|
||||
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
||||
$2CFLAGS_JDKLIB_EXTRA='-xstrconst'
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
|
||||
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
||||
$2CFLAGS_JDKLIB_EXTRA='-xstrconst'
|
||||
fi
|
||||
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
|
||||
@ -768,7 +765,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
esac
|
||||
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS)
|
||||
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($2))
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
|
||||
|
||||
@ -1112,7 +1109,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
||||
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
|
||||
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
|
||||
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
|
||||
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
|
||||
$2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
|
||||
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
|
||||
@ -1147,11 +1144,11 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
||||
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
|
||||
$2JDKLIB_LIBS=""
|
||||
else
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)"
|
||||
|
||||
if test "x$1" = "xTARGET"; then
|
||||
@ -1160,17 +1157,17 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
# Only add client/minimal dir if client/minimal is being built.
|
||||
# Default to server for other variants.
|
||||
if HOTSPOT_CHECK_JVM_VARIANT(server); then
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
|
||||
elif HOTSPOT_CHECK_JVM_VARIANT(client); then
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
|
||||
elif HOTSPOT_CHECK_JVM_VARIANT(minimal); then
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
|
||||
else
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
|
||||
fi
|
||||
elif test "x$1" = "xBUILD"; then
|
||||
# When building a buildjdk, it's always only the server variant
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
|
||||
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
|
||||
fi
|
||||
|
||||
@ -1181,6 +1178,8 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
|
||||
fi
|
||||
|
||||
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
|
||||
|
||||
# Set $2JVM_LIBS (per os)
|
||||
if test "x$OPENJDK_$1_OS" = xlinux; then
|
||||
$2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
|
||||
@ -1447,19 +1446,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
|
||||
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
|
||||
# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
|
||||
# Arguments:
|
||||
# $1 - Optional prefix for each variable defined.
|
||||
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
|
||||
[
|
||||
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
|
||||
# runs afoul of the more aggressive versions of these optimisations.
|
||||
# Notably, value range propagation now assumes that the this pointer of C++
|
||||
# member functions is non-null.
|
||||
NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_NULL_POINTER_CHECK_CFLAG -Werror],
|
||||
IF_FALSE: [NO_NULL_POINTER_CHECK_CFLAG=""])
|
||||
AC_SUBST([NO_NULL_POINTER_CHECK_CFLAG])
|
||||
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
|
||||
dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
|
||||
dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
|
||||
dnl IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
|
||||
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
|
||||
IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
|
||||
CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
AC_SUBST([NO_LIFETIME_DSE_CFLAG])
|
||||
dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
|
||||
dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
|
||||
dnl IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
|
||||
AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
|
||||
$1CFLAGS_JDK="[$]$1CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
$1JVM_CFLAGS="[$]$1JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
])
|
||||
|
@ -749,8 +749,6 @@ CXXFLAGS_JDKLIB
|
||||
CFLAGS_JDKEXE
|
||||
CFLAGS_JDKLIB
|
||||
MACOSX_VERSION_MIN
|
||||
NO_LIFETIME_DSE_CFLAG
|
||||
NO_NULL_POINTER_CHECK_CFLAG
|
||||
CXXSTD_CXXFLAG
|
||||
CXX_O_FLAG_SIZE
|
||||
CXX_O_FLAG_NONE
|
||||
@ -4092,6 +4090,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
||||
|
||||
|
||||
|
||||
# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
|
||||
# Arguments:
|
||||
# $1 - Optional prefix for each variable defined.
|
||||
|
||||
|
||||
#
|
||||
@ -4913,7 +4914,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
|
||||
TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
|
||||
TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
|
||||
TOOLCHAIN_MINIMUM_VERSION_microsoft=""
|
||||
TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
|
||||
TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
|
||||
TOOLCHAIN_MINIMUM_VERSION_xlc=""
|
||||
|
||||
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
|
||||
@ -5094,7 +5095,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1469202305
|
||||
DATE_WHEN_GENERATED=1470415803
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -43767,8 +43768,12 @@ $as_echo "$as_me: Rewriting OBJDUMP to \"$new_complete\"" >&6;}
|
||||
fi
|
||||
|
||||
|
||||
# Restore old path.
|
||||
PATH="$OLD_PATH"
|
||||
# Restore old path, except for the microsoft toolchain, which requires VS_PATH
|
||||
# to remain in place. Otherwise the compiler will not work in some siutations
|
||||
# in later configure checks.
|
||||
if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
|
||||
PATH="$OLD_PATH"
|
||||
fi
|
||||
|
||||
# Restore the flags to the user specified values.
|
||||
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
|
||||
@ -47232,6 +47237,28 @@ $as_echo "$as_me: WARNING: C compiler version number has a part larger than 9999
|
||||
BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
|
||||
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
|
||||
BUILD_AR="$AR"
|
||||
|
||||
|
||||
if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&5
|
||||
$as_echo "$as_me: WARNING: C and C++ compiler have different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
|
||||
$as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
|
||||
fi
|
||||
|
||||
# We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
|
||||
if [[ "[$]CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
|
||||
$as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
|
||||
fi
|
||||
|
||||
if [[ "[$]CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
|
||||
$as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
|
||||
fi
|
||||
|
||||
OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$CC_VERSION_NUMBER"`
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@ -49781,20 +49808,17 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
|
||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} ${CXXSTD_CXXFLAG}"
|
||||
JVM_CFLAGS="${JVM_CFLAGS} ${CXXSTD_CXXFLAG}"
|
||||
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
|
||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
||||
CFLAGS_JDKLIB_EXTRA='-xstrconst'
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
|
||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
||||
CFLAGS_JDKLIB_EXTRA='-xstrconst'
|
||||
fi
|
||||
|
||||
CFLAGS_JDK="${CFLAGS_JDK} ${EXTRA_CFLAGS}"
|
||||
@ -49913,542 +49937,12 @@ $as_echo "$supports" >&6; }
|
||||
# runs afoul of the more aggressive versions of these optimisations.
|
||||
# Notably, value range propagation now assumes that the this pointer of C++
|
||||
# member functions is non-null.
|
||||
NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function body
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function body
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if the C compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
|
||||
supports=yes
|
||||
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $NO_NULL_POINTER_CHECK_CFLAG -Werror"
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int i;
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
else
|
||||
supports=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
|
||||
$as_echo "$supports" >&6; }
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
C_COMP_SUPPORTS="yes"
|
||||
else
|
||||
:
|
||||
C_COMP_SUPPORTS="no"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function body
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if the C++ compiler supports \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
|
||||
supports=yes
|
||||
|
||||
saved_cxxflags="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAG $NO_NULL_POINTER_CHECK_CFLAG -Werror"
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int i;
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
|
||||
else
|
||||
supports=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
CXXFLAGS="$saved_cxxflags"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
|
||||
$as_echo "$supports" >&6; }
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
CXX_COMP_SUPPORTS="yes"
|
||||
else
|
||||
:
|
||||
CXX_COMP_SUPPORTS="no"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if both compilers support \"$NO_NULL_POINTER_CHECK_CFLAG -Werror\"... " >&6; }
|
||||
supports=no
|
||||
if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
|
||||
$as_echo "$supports" >&6; }
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
|
||||
else
|
||||
:
|
||||
NO_NULL_POINTER_CHECK_CFLAG=""
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function body
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function body
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
|
||||
supports=yes
|
||||
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $NO_LIFETIME_DSE_CFLAG -Werror"
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int i;
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
else
|
||||
supports=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
|
||||
$as_echo "$supports" >&6; }
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
C_COMP_SUPPORTS="yes"
|
||||
else
|
||||
:
|
||||
C_COMP_SUPPORTS="no"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function body
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
|
||||
supports=yes
|
||||
|
||||
saved_cxxflags="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAG $NO_LIFETIME_DSE_CFLAG -Werror"
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int i;
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
|
||||
else
|
||||
supports=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
CXXFLAGS="$saved_cxxflags"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
|
||||
$as_echo "$supports" >&6; }
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
CXX_COMP_SUPPORTS="yes"
|
||||
else
|
||||
:
|
||||
CXX_COMP_SUPPORTS="no"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
|
||||
supports=no
|
||||
if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
|
||||
$as_echo "$supports" >&6; }
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
|
||||
else
|
||||
:
|
||||
NO_LIFETIME_DSE_CFLAG=""
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
|
||||
|
||||
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
|
||||
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&5
|
||||
$as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&6;}
|
||||
CFLAGS_JDK="$CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
JVM_CFLAGS="$JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
|
||||
else
|
||||
:
|
||||
@ -50900,7 +50394,7 @@ $as_echo "$supports" >&6; }
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
||||
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
|
||||
LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
|
||||
LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
|
||||
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
|
||||
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
|
||||
JVM_LDFLAGS="$JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
|
||||
@ -50935,11 +50429,11 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
|
||||
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
|
||||
JDKLIB_LIBS=""
|
||||
else
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)"
|
||||
|
||||
if test "xTARGET" = "xTARGET"; then
|
||||
@ -50948,17 +50442,17 @@ $as_echo "$supports" >&6; }
|
||||
# Only add client/minimal dir if client/minimal is being built.
|
||||
# Default to server for other variants.
|
||||
if [[ " $JVM_VARIANTS " =~ " server " ]] ; then
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
|
||||
elif [[ " $JVM_VARIANTS " =~ " client " ]] ; then
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
|
||||
elif [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
|
||||
else
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
|
||||
fi
|
||||
elif test "xTARGET" = "xBUILD"; then
|
||||
# When building a buildjdk, it's always only the server variant
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
|
||||
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
|
||||
fi
|
||||
|
||||
@ -50969,6 +50463,8 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${JAVA_BASE_LDFLAGS}"
|
||||
|
||||
# Set JVM_LIBS (per os)
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
JVM_LIBS="$JVM_LIBS -lm -ldl -lpthread"
|
||||
@ -51127,20 +50623,17 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
|
||||
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} ${OPENJDK_BUILD_CXXSTD_CXXFLAG}"
|
||||
OPENJDK_BUILD_JVM_CFLAGS="${OPENJDK_BUILD_JVM_CFLAGS} ${OPENJDK_BUILD_CXXSTD_CXXFLAG}"
|
||||
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
|
||||
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
|
||||
OPENJDK_BUILD_CFLAGS_JDKLIB_EXTRA='-xstrconst'
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
|
||||
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
|
||||
OPENJDK_BUILD_CFLAGS_JDKLIB_EXTRA='-xstrconst'
|
||||
fi
|
||||
|
||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CFLAGS}"
|
||||
@ -51255,6 +50748,17 @@ $as_echo "$supports" >&6; }
|
||||
if test $OPENJDK_BUILD_COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
|
||||
:
|
||||
|
||||
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
|
||||
# runs afoul of the more aggressive versions of these optimisations.
|
||||
# Notably, value range propagation now assumes that the this pointer of C++
|
||||
# member functions is non-null.
|
||||
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
|
||||
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&5
|
||||
$as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}" >&6;}
|
||||
OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
||||
|
||||
else
|
||||
:
|
||||
|
||||
@ -51705,7 +51209,7 @@ $as_echo "$supports" >&6; }
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
||||
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
|
||||
OPENJDK_BUILD_LDFLAGS_JDK="$OPENJDK_BUILD_LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
|
||||
OPENJDK_BUILD_LDFLAGS_JDK="$OPENJDK_BUILD_LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
|
||||
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
|
||||
OPENJDK_BUILD_LDFLAGS_CXX_JDK="$OPENJDK_BUILD_LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
|
||||
OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
|
||||
@ -51740,11 +51244,11 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
|
||||
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
|
||||
OPENJDK_BUILD_JDKLIB_LIBS=""
|
||||
else
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)"
|
||||
|
||||
if test "xBUILD" = "xTARGET"; then
|
||||
@ -51753,17 +51257,17 @@ $as_echo "$supports" >&6; }
|
||||
# Only add client/minimal dir if client/minimal is being built.
|
||||
# Default to server for other variants.
|
||||
if [[ " $JVM_VARIANTS " =~ " server " ]] ; then
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
|
||||
elif [[ " $JVM_VARIANTS " =~ " client " ]] ; then
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client"
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/client"
|
||||
elif [[ " $JVM_VARIANTS " =~ " minimal " ]] ; then
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal"
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/minimal"
|
||||
else
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
|
||||
fi
|
||||
elif test "xBUILD" = "xBUILD"; then
|
||||
# When building a buildjdk, it's always only the server variant
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
|
||||
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_BUILD_CPU_LIBDIR)/server"
|
||||
fi
|
||||
|
||||
@ -51774,6 +51278,8 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${OPENJDK_BUILD_JAVA_BASE_LDFLAGS}"
|
||||
|
||||
# Set OPENJDK_BUILD_JVM_LIBS (per os)
|
||||
if test "x$OPENJDK_BUILD_OS" = xlinux; then
|
||||
OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lm -ldl -lpthread"
|
||||
@ -51838,7 +51344,7 @@ $as_echo "$supports" >&6; }
|
||||
|
||||
|
||||
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
|
||||
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
|
||||
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
|
||||
|
||||
|
||||
|
||||
@ -53328,8 +52834,8 @@ $as_echo "$JVM_FEATURES" >&6; }
|
||||
as_fn_error $? "Specified JVM feature 'management' requires feature 'nmt'" "$LINENO" 5
|
||||
fi
|
||||
|
||||
if [[ " $JVM_FEATURES " =~ " jvmci " ]] && ! [[ " $JVM_FEATURES " =~ " compiler2 " ]] ; then
|
||||
as_fn_error $? "Specified JVM feature 'jvmci' requires feature 'compiler2'" "$LINENO" 5
|
||||
if [[ " $JVM_FEATURES " =~ " jvmci " ]] && ! ( [[ " $JVM_FEATURES " =~ " compiler1 " ]] || [[ " $JVM_FEATURES " =~ " compiler2 " ]] ); then
|
||||
as_fn_error $? "Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'" "$LINENO" 5
|
||||
fi
|
||||
|
||||
if [[ " $JVM_FEATURES " =~ " compiler2 " ]] && ! [[ " $JVM_FEATURES " =~ " all-gcs " ]] ; then
|
||||
@ -53369,7 +52875,7 @@ $as_echo "$JVM_FEATURES" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
# Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
|
||||
# Only enable jvmci on x86_64, sparcv9 and aarch64.
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
|
||||
@ -53383,7 +52889,7 @@ $as_echo "$JVM_FEATURES" >&6; }
|
||||
|
||||
# Enable features depending on variant.
|
||||
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
|
||||
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
|
||||
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
|
||||
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
|
||||
JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
|
||||
JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
|
||||
|
@ -198,8 +198,8 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
|
||||
AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt'])
|
||||
fi
|
||||
|
||||
if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! HOTSPOT_CHECK_JVM_FEATURE(compiler2); then
|
||||
AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2'])
|
||||
if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! (HOTSPOT_CHECK_JVM_FEATURE(compiler1) || HOTSPOT_CHECK_JVM_FEATURE(compiler2)); then
|
||||
AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'])
|
||||
fi
|
||||
|
||||
if HOTSPOT_CHECK_JVM_FEATURE(compiler2) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
|
||||
@ -239,7 +239,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
|
||||
fi
|
||||
fi
|
||||
|
||||
# Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
|
||||
# Only enable jvmci on x86_64, sparcv9 and aarch64.
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
|
||||
@ -253,7 +253,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
|
||||
|
||||
# Enable features depending on variant.
|
||||
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
|
||||
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
|
||||
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
|
||||
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
|
||||
JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
|
||||
JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
|
||||
|
@ -391,8 +391,6 @@ CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
|
||||
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
|
||||
|
||||
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
|
||||
NO_NULL_POINTER_CHECK_FLAG=@NO_NULL_POINTER_CHECK_CFLAG@
|
||||
NO_LIFETIME_DSE_CFLAG=@NO_LIFETIME_DSE_CFLAG@
|
||||
CXXSTD_CXXFLAG=@CXXSTD_CXXFLAG@
|
||||
|
||||
# Tools that potentially need to be cross compilation aware.
|
||||
|
@ -54,7 +54,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
|
||||
TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
|
||||
TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
|
||||
TOOLCHAIN_MINIMUM_VERSION_microsoft=""
|
||||
TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
|
||||
TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
|
||||
TOOLCHAIN_MINIMUM_VERSION_xlc=""
|
||||
|
||||
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
|
||||
@ -312,8 +312,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
|
||||
# Restore path, etc
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
|
||||
[
|
||||
# Restore old path.
|
||||
PATH="$OLD_PATH"
|
||||
# Restore old path, except for the microsoft toolchain, which requires VS_PATH
|
||||
# to remain in place. Otherwise the compiler will not work in some siutations
|
||||
# in later configure checks.
|
||||
if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
|
||||
PATH="$OLD_PATH"
|
||||
fi
|
||||
|
||||
# Restore the flags to the user specified values.
|
||||
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
|
||||
@ -831,6 +835,8 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
|
||||
BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
|
||||
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
|
||||
BUILD_AR="$AR"
|
||||
|
||||
TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_])
|
||||
fi
|
||||
|
||||
AC_SUBST(BUILD_CC)
|
||||
|
@ -335,7 +335,10 @@ else
|
||||
for j in ${repos_extra} ; do
|
||||
if [ "${i}" = "${j}" ] ; then
|
||||
# it's an "extra"
|
||||
pull_base="${pull_extra}"
|
||||
if [ -n "${pull_extra}" ]; then
|
||||
# if no pull_extra is defined, assume that pull_default is valid
|
||||
pull_base="${pull_extra}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -357,6 +357,18 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
var boot_jdk_platform = input.build_os + "-"
|
||||
+ (input.build_cpu == "x86" ? "i586" : input.build_cpu);
|
||||
|
||||
var boot_jdk_revision = "8";
|
||||
var boot_jdk_subdirpart = "1.8.0";
|
||||
// JDK 8 does not work on sparc M7 cpus, need a newer update when building
|
||||
// on such hardware.
|
||||
if (input.build_cpu == "sparcv9") {
|
||||
var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
|
||||
if (cpu_brand.trim() == 'SPARC-M7') {
|
||||
boot_jdk_revision = "8u20";
|
||||
boot_jdk_subdirpart = "1.8.0_20";
|
||||
}
|
||||
}
|
||||
|
||||
var devkit_platform_revisions = {
|
||||
linux_x64: "gcc4.9.2-OEL6.4+1.0",
|
||||
macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
|
||||
@ -374,12 +386,12 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
boot_jdk: {
|
||||
server: "javare",
|
||||
module: "jdk",
|
||||
revision: "8",
|
||||
revision: boot_jdk_revision,
|
||||
checksum_file: boot_jdk_platform + "/MD5_VALUES",
|
||||
file: boot_jdk_platform + "/jdk-8-" + boot_jdk_platform + ".tar.gz",
|
||||
file: boot_jdk_platform + "/jdk-" + boot_jdk_revision + "-" + boot_jdk_platform + ".tar.gz",
|
||||
configure_args: (input.build_os == "macosx"
|
||||
? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0.jdk/Contents/Home"
|
||||
: "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0")
|
||||
? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart + ".jdk/Contents/Home"
|
||||
: "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart)
|
||||
},
|
||||
|
||||
devkit: {
|
||||
|
@ -532,3 +532,4 @@ adc8c84b7cf8c540d920182f78a2bc982366432a jdk-9+126
|
||||
352357128f602dcf0426b1cbe011a4685a4d9f97 jdk-9+127
|
||||
22bf6db9767b1b3a1994cbf32eb3331f31ae2093 jdk-9+128
|
||||
e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
|
||||
7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
|
||||
|
@ -64,7 +64,7 @@ _jvmciModes = {
|
||||
_jdkDebugLevels = ['release', 'fastdebug', 'slowdebug']
|
||||
|
||||
# TODO: add client once/if it can be built on 64-bit platforms
|
||||
_jdkJvmVariants = ['server']
|
||||
_jdkJvmVariants = ['server', 'client']
|
||||
|
||||
"""
|
||||
Translation table from mx_jvmci:8 --vmbuild values to mx_jvmci:9 --jdk-debug-level values.
|
||||
|
@ -51,6 +51,9 @@ ifeq ($(call check-jvm-feature, compiler2), true)
|
||||
ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS
|
||||
endif
|
||||
|
||||
# Set the C++ standard if supported
|
||||
ADLC_CFLAGS += $(CXXSTD_CXXFLAG)
|
||||
|
||||
# NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to
|
||||
# hurt.
|
||||
ADLC_CFLAGS += -DASSERT
|
||||
@ -153,10 +156,10 @@ ifeq ($(call check-jvm-feature, compiler2), true)
|
||||
$(call MakeDir, $(@D))
|
||||
$(call ExecuteWithLog, $(ADLC_SUPPORT_DIR)/adlc_run, \
|
||||
$(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \
|
||||
-c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).cpp \
|
||||
-h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).hpp \
|
||||
-a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU).cpp \
|
||||
-v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU).hpp)
|
||||
-c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
|
||||
-h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
|
||||
-a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
|
||||
-v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp)
|
||||
$(TOUCH) $@
|
||||
|
||||
##############################################################################
|
||||
@ -164,17 +167,17 @@ ifeq ($(call check-jvm-feature, compiler2), true)
|
||||
# and postprocess them by fixing dummy #line directives.
|
||||
|
||||
ADLC_GENERATED_FILES := $(addprefix $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/, \
|
||||
ad_$(HOTSPOT_TARGET_CPU).cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU).hpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_clone.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_expand.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_format.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_gen.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_misc.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_peephole.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU)_pipeline.cpp \
|
||||
adGlobals_$(HOTSPOT_TARGET_CPU).hpp \
|
||||
dfa_$(HOTSPOT_TARGET_CPU).cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_clone.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_expand.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_format.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_gen.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_misc.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_peephole.cpp \
|
||||
ad_$(HOTSPOT_TARGET_CPU_ARCH)_pipeline.cpp \
|
||||
adGlobals_$(HOTSPOT_TARGET_CPU_ARCH).hpp \
|
||||
dfa_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
|
||||
)
|
||||
|
||||
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(ADLC_RUN_MARKER)
|
||||
|
@ -104,7 +104,7 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \
|
||||
-I$(GTEST_FRAMEWORK_SRC)/include, \
|
||||
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
|
||||
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
|
||||
LDFLAGS := $(LDFLAGS_TESTEXE), \
|
||||
LDFLAGS := $(LDFLAGS_JDKEXE), \
|
||||
LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_solaris := -library=stlport4, \
|
||||
LIBS_unix := -ljvm, \
|
||||
|
@ -60,12 +60,15 @@ JVM_CFLAGS_INCLUDES += \
|
||||
-I$(HOTSPOT_TOPDIR)/src/share/vm/prims \
|
||||
#
|
||||
|
||||
# INCLUDE_SUFFIX_* is only meant for including the proper
|
||||
# platform files. Don't use it to guard code. Use the value of
|
||||
# HOTSPOT_TARGET_CPU_DEFINE etc. instead.
|
||||
# Remaining TARGET_ARCH_* is needed to distinguish closed and open
|
||||
# 64-bit ARM ports (also called AARCH64).
|
||||
JVM_CFLAGS_TARGET_DEFINES += \
|
||||
-DTARGET_OS_FAMILY_$(HOTSPOT_TARGET_OS) \
|
||||
-DTARGET_ARCH_MODEL_$(HOTSPOT_TARGET_CPU) \
|
||||
-DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DTARGET_OS_ARCH_MODEL_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU) \
|
||||
-DTARGET_OS_ARCH_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \
|
||||
-DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
|
||||
-D$(HOTSPOT_TARGET_CPU_DEFINE) \
|
||||
-DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
|
||||
|
@ -53,6 +53,8 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/native \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \
|
||||
$(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \
|
||||
$(HOTSPOT_TOPDIR)/test/compiler/jvmci/jdk.vm.ci.code.test \
|
||||
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetModulesInfo \
|
||||
#
|
||||
|
||||
# Add conditional directories here when needed.
|
||||
@ -62,12 +64,26 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC += \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/ThreadSignalMask
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
BUILD_HOTSPOT_JTREG_NATIVE_SRC += \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/execstack \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jsig \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/StackGuardPages
|
||||
endif
|
||||
|
||||
ifeq ($(TOOLCHAIN_TYPE), solstudio)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libSimpleClassFileLoadHook := -lc
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libGetNamedModuleTest := -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
|
||||
BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread
|
||||
BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE
|
||||
endif
|
||||
|
||||
BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
|
||||
|
||||
BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
|
||||
|
@ -1942,12 +1942,35 @@ source %{
|
||||
|
||||
bool is_CAS(int opcode)
|
||||
{
|
||||
return (opcode == Op_CompareAndSwapI ||
|
||||
opcode == Op_CompareAndSwapL ||
|
||||
opcode == Op_CompareAndSwapN ||
|
||||
opcode == Op_CompareAndSwapP);
|
||||
switch(opcode) {
|
||||
// We handle these
|
||||
case Op_CompareAndSwapI:
|
||||
case Op_CompareAndSwapL:
|
||||
case Op_CompareAndSwapP:
|
||||
case Op_CompareAndSwapN:
|
||||
// case Op_CompareAndSwapB:
|
||||
// case Op_CompareAndSwapS:
|
||||
return true;
|
||||
// These are TBD
|
||||
case Op_WeakCompareAndSwapB:
|
||||
case Op_WeakCompareAndSwapS:
|
||||
case Op_WeakCompareAndSwapI:
|
||||
case Op_WeakCompareAndSwapL:
|
||||
case Op_WeakCompareAndSwapP:
|
||||
case Op_WeakCompareAndSwapN:
|
||||
case Op_CompareAndExchangeB:
|
||||
case Op_CompareAndExchangeS:
|
||||
case Op_CompareAndExchangeI:
|
||||
case Op_CompareAndExchangeL:
|
||||
case Op_CompareAndExchangeP:
|
||||
case Op_CompareAndExchangeN:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// leading_to_trailing
|
||||
//
|
||||
//graph traversal helper which detects the normal case Mem feed from
|
||||
@ -3330,9 +3353,6 @@ int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf)
|
||||
const bool Matcher::match_rule_supported(int opcode) {
|
||||
|
||||
switch (opcode) {
|
||||
case Op_StrComp:
|
||||
if (CompactStrings) return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4241,14 +4261,16 @@ encode %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::xword, /*acquire*/ false, /*release*/ true);
|
||||
Assembler::xword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, noreg);
|
||||
%}
|
||||
|
||||
enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::word, /*acquire*/ false, /*release*/ true);
|
||||
Assembler::word, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, noreg);
|
||||
%}
|
||||
|
||||
|
||||
@ -4260,14 +4282,16 @@ encode %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::xword, /*acquire*/ true, /*release*/ true);
|
||||
Assembler::xword, /*acquire*/ true, /*release*/ true,
|
||||
/*weak*/ false, noreg);
|
||||
%}
|
||||
|
||||
enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::word, /*acquire*/ true, /*release*/ true);
|
||||
Assembler::word, /*acquire*/ true, /*release*/ true,
|
||||
/*weak*/ false, noreg);
|
||||
%}
|
||||
|
||||
|
||||
@ -5806,6 +5830,7 @@ operand iRegLNoSp()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(no_special_reg));
|
||||
match(RegL);
|
||||
match(iRegL_R0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
@ -5927,6 +5952,39 @@ operand iRegP_R10()
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
// Long 64 bit Register R0 only
|
||||
operand iRegL_R0()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(r0_reg));
|
||||
match(RegL);
|
||||
match(iRegLNoSp);
|
||||
op_cost(0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
// Long 64 bit Register R2 only
|
||||
operand iRegL_R2()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(r2_reg));
|
||||
match(RegL);
|
||||
match(iRegLNoSp);
|
||||
op_cost(0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
// Long 64 bit Register R3 only
|
||||
operand iRegL_R3()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(r3_reg));
|
||||
match(RegL);
|
||||
match(iRegLNoSp);
|
||||
op_cost(0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
// Long 64 bit Register R11 only
|
||||
operand iRegL_R11()
|
||||
%{
|
||||
@ -5983,7 +6041,7 @@ operand iRegI_R3()
|
||||
%}
|
||||
|
||||
|
||||
// Register R2 only
|
||||
// Register R4 only
|
||||
operand iRegI_R4()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(int_r4_reg));
|
||||
@ -6007,6 +6065,33 @@ operand iRegN()
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
operand iRegN_R0()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(r0_reg));
|
||||
match(iRegN);
|
||||
op_cost(0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
operand iRegN_R2()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(r2_reg));
|
||||
match(iRegN);
|
||||
op_cost(0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
operand iRegN_R3()
|
||||
%{
|
||||
constraint(ALLOC_IN_RC(r3_reg));
|
||||
match(iRegN);
|
||||
op_cost(0);
|
||||
format %{ %}
|
||||
interface(REG_INTER);
|
||||
%}
|
||||
|
||||
// Integer 64 bit Register not Special
|
||||
operand iRegNNoSp()
|
||||
%{
|
||||
@ -9393,12 +9478,12 @@ instruct storeIConditional(indirect mem, iRegINoSp oldval, iRegINoSp newval, rFl
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
// XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher
|
||||
// can't match them
|
||||
|
||||
// standard CompareAndSwapX when we are using barriers
|
||||
// these have higher priority than the rules selected by a predicate
|
||||
|
||||
// XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher
|
||||
// can't match them
|
||||
|
||||
instruct compareAndSwapI(iRegINoSp res, indirect mem, iRegINoSp oldval, iRegINoSp newval, rFlagsReg cr) %{
|
||||
|
||||
match(Set res (CompareAndSwapI mem (Binary oldval newval)));
|
||||
@ -9550,6 +9635,216 @@ instruct compareAndSwapNAcq(iRegINoSp res, indirect mem, iRegNNoSp oldval, iRegN
|
||||
%}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Sundry CAS operations. Note that release is always true,
|
||||
// regardless of the memory ordering of the CAS. This is because we
|
||||
// need the volatile case to be sequentially consistent but there is
|
||||
// no trailing StoreLoad barrier emitted by C2. Unfortunately we
|
||||
// can't check the type of memory ordering here, so we always emit a
|
||||
// STLXR.
|
||||
|
||||
// This section is generated from aarch64_ad_cas.m4
|
||||
|
||||
|
||||
instruct compareAndExchangeB(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchangeB mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ uxtbw(rscratch2, $oldval$$Register);
|
||||
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
|
||||
Assembler::byte, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
__ sxtbw($res$$Register, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct compareAndExchangeS(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchangeS mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ uxthw(rscratch2, $oldval$$Register);
|
||||
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
|
||||
Assembler::halfword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
__ sxthw($res$$Register, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct compareAndExchangeI(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchangeI mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::word, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct compareAndExchangeL(iRegL_R0 res, indirect mem, iRegL_R2 oldval, iRegL_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchangeL mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::xword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct compareAndExchangeN(iRegN_R0 res, indirect mem, iRegN_R2 oldval, iRegN_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchangeN mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::word, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct compareAndExchangeP(iRegP_R0 res, indirect mem, iRegP_R2 oldval, iRegP_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchangeP mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::xword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct weakCompareAndSwapB(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwapB mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ uxtbw(rscratch2, $oldval$$Register);
|
||||
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
|
||||
Assembler::byte, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct weakCompareAndSwapS(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwapS mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ uxthw(rscratch2, $oldval$$Register);
|
||||
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
|
||||
Assembler::halfword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct weakCompareAndSwapI(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwapI mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::word, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct weakCompareAndSwapL(iRegINoSp res, indirect mem, iRegL oldval, iRegL newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwapL mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::xword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct weakCompareAndSwapN(iRegINoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwapN mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::word, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct weakCompareAndSwapP(iRegINoSp res, indirect mem, iRegP oldval, iRegP newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwapP mem (Binary oldval newval)));
|
||||
ins_cost(2 * VOLATILE_REF_COST);
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::xword, /*acquire*/ false, /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
instruct get_and_setI(indirect mem, iRegINoSp newv, iRegI prev) %{
|
||||
match(Set prev (GetAndSetI mem newv));
|
||||
format %{ "atomic_xchgw $prev, $newv, [$mem]" %}
|
||||
@ -14988,11 +15283,61 @@ instruct string_compareU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 c
|
||||
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %}
|
||||
ins_encode %{
|
||||
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
|
||||
__ asrw($cnt1$$Register, $cnt1$$Register, 1);
|
||||
__ asrw($cnt2$$Register, $cnt2$$Register, 1);
|
||||
__ string_compare($str1$$Register, $str2$$Register,
|
||||
$cnt1$$Register, $cnt2$$Register, $result$$Register,
|
||||
$tmp1$$Register);
|
||||
$tmp1$$Register,
|
||||
fnoreg, fnoreg, StrIntrinsicNode::UU);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_compareL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
|
||||
iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr)
|
||||
%{
|
||||
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
|
||||
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
|
||||
effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
|
||||
|
||||
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %}
|
||||
ins_encode %{
|
||||
__ string_compare($str1$$Register, $str2$$Register,
|
||||
$cnt1$$Register, $cnt2$$Register, $result$$Register,
|
||||
$tmp1$$Register,
|
||||
fnoreg, fnoreg, StrIntrinsicNode::LL);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_compareUL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
|
||||
iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr)
|
||||
%{
|
||||
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL);
|
||||
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
|
||||
effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr);
|
||||
|
||||
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %}
|
||||
ins_encode %{
|
||||
__ string_compare($str1$$Register, $str2$$Register,
|
||||
$cnt1$$Register, $cnt2$$Register, $result$$Register,
|
||||
$tmp1$$Register,
|
||||
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::UL);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
|
||||
iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr)
|
||||
%{
|
||||
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU);
|
||||
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
|
||||
effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr);
|
||||
|
||||
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # KILL $tmp1" %}
|
||||
ins_encode %{
|
||||
__ string_compare($str1$$Register, $str2$$Register,
|
||||
$cnt1$$Register, $cnt2$$Register, $result$$Register,
|
||||
$tmp1$$Register,
|
||||
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::LU);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -67,9 +67,6 @@ class Bytes: AllStatic {
|
||||
|
||||
|
||||
// The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base]
|
||||
|
||||
#ifdef TARGET_OS_ARCH_linux_aarch64
|
||||
# include "bytes_linux_aarch64.inline.hpp"
|
||||
#endif
|
||||
#include OS_CPU_HEADER_INLINE(bytes)
|
||||
|
||||
#endif // CPU_AARCH64_VM_BYTES_AARCH64_HPP
|
||||
|
@ -1556,13 +1556,13 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
|
||||
}
|
||||
|
||||
void LIR_Assembler::casw(Register addr, Register newval, Register cmpval) {
|
||||
__ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, rscratch1);
|
||||
__ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1);
|
||||
__ cset(rscratch1, Assembler::NE);
|
||||
__ membar(__ AnyAny);
|
||||
}
|
||||
|
||||
void LIR_Assembler::casl(Register addr, Register newval, Register cmpval) {
|
||||
__ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, rscratch1);
|
||||
__ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1);
|
||||
__ cset(rscratch1, Assembler::NE);
|
||||
__ membar(__ AnyAny);
|
||||
}
|
||||
|
@ -808,7 +808,6 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) {
|
||||
} else {
|
||||
a = new LIR_Address(obj.result(),
|
||||
offset.result(),
|
||||
LIR_Address::times_1,
|
||||
0,
|
||||
as_BasicType(type));
|
||||
}
|
||||
@ -1002,7 +1001,6 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) {
|
||||
|
||||
LIR_Address* a = new LIR_Address(base_op,
|
||||
index,
|
||||
LIR_Address::times_1,
|
||||
offset,
|
||||
T_BYTE);
|
||||
BasicTypeList signature(3);
|
||||
|
54
hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp
Normal file
54
hotspot/src/cpu/aarch64/vm/c1_LIR_aarch64.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/register.hpp"
|
||||
#include "c1/c1_LIR.hpp"
|
||||
|
||||
FloatRegister LIR_OprDesc::as_float_reg() const {
|
||||
return as_FloatRegister(fpu_regnr());
|
||||
}
|
||||
|
||||
FloatRegister LIR_OprDesc::as_double_reg() const {
|
||||
return as_FloatRegister(fpu_regnrLo());
|
||||
}
|
||||
|
||||
// Reg2 unused.
|
||||
LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
|
||||
assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform");
|
||||
return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
|
||||
(reg1 << LIR_OprDesc::reg2_shift) |
|
||||
LIR_OprDesc::double_type |
|
||||
LIR_OprDesc::fpu_register |
|
||||
LIR_OprDesc::double_size);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void LIR_Address::verify() const {
|
||||
assert(base()->is_cpu_register(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_double_cpu() || index()->is_single_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
}
|
||||
#endif // PRODUCT
|
109
hotspot/src/cpu/aarch64/vm/cas.m4
Normal file
109
hotspot/src/cpu/aarch64/vm/cas.m4
Normal file
@ -0,0 +1,109 @@
|
||||
// Sundry CAS operations. Note that release is always true,
|
||||
// regardless of the memory ordering of the CAS. This is because we
|
||||
// need the volatile case to be sequentially consistent but there is
|
||||
// no trailing StoreLoad barrier emitted by C2. Unfortunately we
|
||||
// can't check the type of memory ordering here, so we always emit a
|
||||
// STLXR.
|
||||
|
||||
define(`CAS_INSN',
|
||||
`
|
||||
instruct compareAndExchange$1$5(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
|
||||
ifelse($5,Acq,' predicate(needs_acquiring_load_exclusive(n));
|
||||
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`)
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}')dnl
|
||||
define(`CAS_INSN4',
|
||||
`
|
||||
instruct compareAndExchange$1$7(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{
|
||||
match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
|
||||
ifelse($7,Acq,' predicate(needs_acquiring_load_exclusive(n));
|
||||
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`)
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ $5(rscratch2, $oldval$$Register);
|
||||
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
|
||||
Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
|
||||
/*weak*/ false, $res$$Register);
|
||||
__ $6($res$$Register, $res$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}')dnl
|
||||
CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw)
|
||||
CAS_INSN4(S,I,short,halfword,uxthw,sxthw)
|
||||
CAS_INSN(I,I,int,word)
|
||||
CAS_INSN(L,L,long,xword)
|
||||
CAS_INSN(N,N,narrow oop,word)
|
||||
CAS_INSN(P,P,ptr,xword)
|
||||
dnl
|
||||
dnl CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw,Acq)
|
||||
dnl CAS_INSN4(S,I,short,halfword,uxthw,sxthw,Acq)
|
||||
dnl CAS_INSN(I,I,int,word,Acq)
|
||||
dnl CAS_INSN(L,L,long,xword,Acq)
|
||||
dnl CAS_INSN(N,N,narrow oop,word,Acq)
|
||||
dnl CAS_INSN(P,P,ptr,xword,Acq)
|
||||
dnl
|
||||
define(`CAS_INSN2',
|
||||
`
|
||||
instruct weakCompareAndSwap$1$6(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));
|
||||
ifelse($6,Acq,' predicate(needs_acquiring_load_exclusive(n));
|
||||
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`)
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ uxt$5(rscratch2, $oldval$$Register);
|
||||
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
|
||||
Assembler::$4, /*acquire*/ ifelse($6,Acq,true,false), /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}')dnl
|
||||
define(`CAS_INSN3',
|
||||
`
|
||||
instruct weakCompareAndSwap$1$5(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
|
||||
match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));
|
||||
ifelse($5,Acq,' predicate(needs_acquiring_load_exclusive(n));
|
||||
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`)
|
||||
effect(KILL cr);
|
||||
format %{
|
||||
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
|
||||
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
|
||||
%}
|
||||
ins_encode %{
|
||||
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
|
||||
Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
|
||||
/*weak*/ true, noreg);
|
||||
__ csetw($res$$Register, Assembler::EQ);
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}')dnl
|
||||
CAS_INSN2(B,I,byte,byte,bw)
|
||||
CAS_INSN2(S,I,short,halfword,hw)
|
||||
CAS_INSN3(I,I,int,word)
|
||||
CAS_INSN3(L,L,long,xword)
|
||||
CAS_INSN3(N,N,narrow oop,word)
|
||||
CAS_INSN3(P,P,ptr,xword)
|
||||
dnl CAS_INSN2(B,I,byte,byte,bw,Acq)
|
||||
dnl CAS_INSN2(S,I,short,halfword,hw,Acq)
|
||||
dnl CAS_INSN3(I,I,int,word,Acq)
|
||||
dnl CAS_INSN3(L,L,long,xword,Acq)
|
||||
dnl CAS_INSN3(N,N,narrow oop,word,Acq)
|
||||
dnl CAS_INSN3(P,P,ptr,xword,Acq)
|
||||
dnl
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -29,9 +29,7 @@
|
||||
// Inline functions for memory copy and fill.
|
||||
|
||||
// Contains inline asm implementations
|
||||
#ifdef TARGET_OS_ARCH_linux_aarch64
|
||||
# include "copy_linux_aarch64.inline.hpp"
|
||||
#endif
|
||||
#include OS_CPU_HEADER_INLINE(copy)
|
||||
|
||||
|
||||
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
|
||||
|
@ -70,11 +70,7 @@ define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS
|
||||
|
||||
define_pd_global(uintx, TypeProfileLevel, 111);
|
||||
|
||||
// No performance work done here yet.
|
||||
define_pd_global(bool, CompactStrings, false);
|
||||
|
||||
// avoid biased locking while we are bootstrapping the aarch64 build
|
||||
define_pd_global(bool, UseBiasedLocking, false);
|
||||
define_pd_global(bool, CompactStrings, true);
|
||||
|
||||
// Clear short arrays bigger than one word in an arch-specific way
|
||||
define_pd_global(intx, InitArrayShortSize, BytesPerLong);
|
||||
@ -118,6 +114,7 @@ define_pd_global(intx, InlineSmallCode, 1000);
|
||||
// Don't attempt to use Neon on builtin sim until builtin sim supports it
|
||||
#define UseCRC32 false
|
||||
#define UseSIMDForMemoryOps false
|
||||
#define AvoidUnalignedAcesses false
|
||||
|
||||
#else
|
||||
#define UseBuiltinSim false
|
||||
@ -144,6 +141,8 @@ define_pd_global(intx, InlineSmallCode, 1000);
|
||||
"Use CRC32 instructions for CRC32 computation") \
|
||||
product(bool, UseSIMDForMemoryOps, false, \
|
||||
"Use SIMD instructions in generated memory move code") \
|
||||
product(bool, AvoidUnalignedAccesses, false, \
|
||||
"Avoid generating unaligned memory accesses") \
|
||||
product(bool, UseLSE, false, \
|
||||
"Use LSE instructions") \
|
||||
product(bool, UseBlockZeroing, true, \
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "oops/klass.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "opto/compile.hpp"
|
||||
#include "opto/intrinsicnode.hpp"
|
||||
#include "opto/node.hpp"
|
||||
#include "runtime/biasedLocking.hpp"
|
||||
#include "runtime/icache.hpp"
|
||||
@ -565,11 +566,6 @@ void MacroAssembler::biased_locking_exit(Register obj_reg, Register temp_reg, La
|
||||
br(Assembler::EQ, done);
|
||||
}
|
||||
|
||||
|
||||
// added to make this compile
|
||||
|
||||
REGISTER_DEFINITION(Register, noreg);
|
||||
|
||||
static void pass_arg0(MacroAssembler* masm, Register arg) {
|
||||
if (c_rarg0 != arg ) {
|
||||
masm->mov(c_rarg0, arg);
|
||||
@ -2145,30 +2141,40 @@ void MacroAssembler::cmpxchgw(Register oldv, Register newv, Register addr, Regis
|
||||
b(*fail);
|
||||
}
|
||||
|
||||
// A generic CAS; success or failure is in the EQ flag.
|
||||
// A generic CAS; success or failure is in the EQ flag. A weak CAS
|
||||
// doesn't retry and may fail spuriously. If the oldval is wanted,
|
||||
// Pass a register for the result, otherwise pass noreg.
|
||||
|
||||
// Clobbers rscratch1
|
||||
void MacroAssembler::cmpxchg(Register addr, Register expected,
|
||||
Register new_val,
|
||||
enum operand_size size,
|
||||
bool acquire, bool release,
|
||||
Register tmp) {
|
||||
bool weak,
|
||||
Register result) {
|
||||
if (result == noreg) result = rscratch1;
|
||||
if (UseLSE) {
|
||||
mov(tmp, expected);
|
||||
lse_cas(tmp, new_val, addr, size, acquire, release, /*not_pair*/ true);
|
||||
cmp(tmp, expected);
|
||||
mov(result, expected);
|
||||
lse_cas(result, new_val, addr, size, acquire, release, /*not_pair*/ true);
|
||||
cmp(result, expected);
|
||||
} else {
|
||||
BLOCK_COMMENT("cmpxchg {");
|
||||
Label retry_load, done;
|
||||
if ((VM_Version::features() & VM_Version::CPU_STXR_PREFETCH))
|
||||
prfm(Address(addr), PSTL1STRM);
|
||||
bind(retry_load);
|
||||
load_exclusive(tmp, addr, size, acquire);
|
||||
load_exclusive(result, addr, size, acquire);
|
||||
if (size == xword)
|
||||
cmp(tmp, expected);
|
||||
cmp(result, expected);
|
||||
else
|
||||
cmpw(tmp, expected);
|
||||
cmpw(result, expected);
|
||||
br(Assembler::NE, done);
|
||||
store_exclusive(tmp, new_val, addr, size, release);
|
||||
cbnzw(tmp, retry_load);
|
||||
store_exclusive(rscratch1, new_val, addr, size, release);
|
||||
if (weak) {
|
||||
cmpw(rscratch1, 0u); // If the store fails, return NE to our caller.
|
||||
} else {
|
||||
cbnzw(rscratch1, retry_load);
|
||||
}
|
||||
bind(done);
|
||||
BLOCK_COMMENT("} cmpxchg");
|
||||
}
|
||||
@ -4500,21 +4506,49 @@ void MacroAssembler::string_indexof(Register str2, Register str1,
|
||||
BIND(DONE);
|
||||
}
|
||||
|
||||
typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
|
||||
typedef void (MacroAssembler::* uxt_insn)(Register Rd, Register Rn);
|
||||
|
||||
// Compare strings.
|
||||
void MacroAssembler::string_compare(Register str1, Register str2,
|
||||
Register cnt1, Register cnt2, Register result,
|
||||
Register tmp1) {
|
||||
Register tmp1,
|
||||
FloatRegister vtmp, FloatRegister vtmpZ, int ae) {
|
||||
Label LENGTH_DIFF, DONE, SHORT_LOOP, SHORT_STRING,
|
||||
NEXT_WORD, DIFFERENCE;
|
||||
|
||||
bool isLL = ae == StrIntrinsicNode::LL;
|
||||
bool isLU = ae == StrIntrinsicNode::LU;
|
||||
bool isUL = ae == StrIntrinsicNode::UL;
|
||||
|
||||
bool str1_isL = isLL || isLU;
|
||||
bool str2_isL = isLL || isUL;
|
||||
|
||||
int str1_chr_shift = str1_isL ? 0 : 1;
|
||||
int str2_chr_shift = str2_isL ? 0 : 1;
|
||||
int str1_chr_size = str1_isL ? 1 : 2;
|
||||
int str2_chr_size = str2_isL ? 1 : 2;
|
||||
|
||||
chr_insn str1_load_chr = str1_isL ? (chr_insn)&MacroAssembler::ldrb :
|
||||
(chr_insn)&MacroAssembler::ldrh;
|
||||
chr_insn str2_load_chr = str2_isL ? (chr_insn)&MacroAssembler::ldrb :
|
||||
(chr_insn)&MacroAssembler::ldrh;
|
||||
uxt_insn ext_chr = isLL ? (uxt_insn)&MacroAssembler::uxtbw :
|
||||
(uxt_insn)&MacroAssembler::uxthw;
|
||||
|
||||
BLOCK_COMMENT("string_compare {");
|
||||
|
||||
// Bizzarely, the counts are passed in bytes, regardless of whether they
|
||||
// are L or U strings, however the result is always in characters.
|
||||
if (!str1_isL) asrw(cnt1, cnt1, 1);
|
||||
if (!str2_isL) asrw(cnt2, cnt2, 1);
|
||||
|
||||
// Compute the minimum of the string lengths and save the difference.
|
||||
subsw(tmp1, cnt1, cnt2);
|
||||
cselw(cnt2, cnt1, cnt2, Assembler::LE); // min
|
||||
|
||||
// A very short string
|
||||
cmpw(cnt2, 4);
|
||||
cmpw(cnt2, isLL ? 8:4);
|
||||
br(Assembler::LT, SHORT_STRING);
|
||||
|
||||
// Check if the strings start at the same location.
|
||||
@ -4523,20 +4557,37 @@ void MacroAssembler::string_compare(Register str1, Register str2,
|
||||
|
||||
// Compare longwords
|
||||
{
|
||||
subw(cnt2, cnt2, 4); // The last longword is a special case
|
||||
subw(cnt2, cnt2, isLL ? 8:4); // The last longword is a special case
|
||||
|
||||
// Move both string pointers to the last longword of their
|
||||
// strings, negate the remaining count, and convert it to bytes.
|
||||
lea(str1, Address(str1, cnt2, Address::uxtw(1)));
|
||||
lea(str2, Address(str2, cnt2, Address::uxtw(1)));
|
||||
sub(cnt2, zr, cnt2, LSL, 1);
|
||||
lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
|
||||
lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
|
||||
if (isLU || isUL) {
|
||||
sub(cnt1, zr, cnt2, LSL, str1_chr_shift);
|
||||
eor(vtmpZ, T16B, vtmpZ, vtmpZ);
|
||||
}
|
||||
sub(cnt2, zr, cnt2, LSL, str2_chr_shift);
|
||||
|
||||
// Loop, loading longwords and comparing them into rscratch2.
|
||||
bind(NEXT_WORD);
|
||||
ldr(result, Address(str1, cnt2));
|
||||
ldr(cnt1, Address(str2, cnt2));
|
||||
adds(cnt2, cnt2, wordSize);
|
||||
eor(rscratch2, result, cnt1);
|
||||
if (isLU) {
|
||||
ldrs(vtmp, Address(str1, cnt1));
|
||||
zip1(vtmp, T8B, vtmp, vtmpZ);
|
||||
umov(result, vtmp, D, 0);
|
||||
} else {
|
||||
ldr(result, Address(str1, isUL ? cnt1:cnt2));
|
||||
}
|
||||
if (isUL) {
|
||||
ldrs(vtmp, Address(str2, cnt2));
|
||||
zip1(vtmp, T8B, vtmp, vtmpZ);
|
||||
umov(rscratch1, vtmp, D, 0);
|
||||
} else {
|
||||
ldr(rscratch1, Address(str2, cnt2));
|
||||
}
|
||||
adds(cnt2, cnt2, isUL ? 4:8);
|
||||
if (isLU || isUL) add(cnt1, cnt1, isLU ? 4:8);
|
||||
eor(rscratch2, result, rscratch1);
|
||||
cbnz(rscratch2, DIFFERENCE);
|
||||
br(Assembler::LT, NEXT_WORD);
|
||||
|
||||
@ -4544,9 +4595,21 @@ void MacroAssembler::string_compare(Register str1, Register str2,
|
||||
// same longword twice, but that's still faster than another
|
||||
// conditional branch.
|
||||
|
||||
ldr(result, Address(str1));
|
||||
ldr(cnt1, Address(str2));
|
||||
eor(rscratch2, result, cnt1);
|
||||
if (isLU) {
|
||||
ldrs(vtmp, Address(str1));
|
||||
zip1(vtmp, T8B, vtmp, vtmpZ);
|
||||
umov(result, vtmp, D, 0);
|
||||
} else {
|
||||
ldr(result, Address(str1));
|
||||
}
|
||||
if (isUL) {
|
||||
ldrs(vtmp, Address(str2));
|
||||
zip1(vtmp, T8B, vtmp, vtmpZ);
|
||||
umov(rscratch1, vtmp, D, 0);
|
||||
} else {
|
||||
ldr(rscratch1, Address(str2));
|
||||
}
|
||||
eor(rscratch2, result, rscratch1);
|
||||
cbz(rscratch2, LENGTH_DIFF);
|
||||
|
||||
// Find the first different characters in the longwords and
|
||||
@ -4554,12 +4617,12 @@ void MacroAssembler::string_compare(Register str1, Register str2,
|
||||
bind(DIFFERENCE);
|
||||
rev(rscratch2, rscratch2);
|
||||
clz(rscratch2, rscratch2);
|
||||
andr(rscratch2, rscratch2, -16);
|
||||
andr(rscratch2, rscratch2, isLL ? -8 : -16);
|
||||
lsrv(result, result, rscratch2);
|
||||
uxthw(result, result);
|
||||
lsrv(cnt1, cnt1, rscratch2);
|
||||
uxthw(cnt1, cnt1);
|
||||
subw(result, result, cnt1);
|
||||
(this->*ext_chr)(result, result);
|
||||
lsrv(rscratch1, rscratch1, rscratch2);
|
||||
(this->*ext_chr)(rscratch1, rscratch1);
|
||||
subw(result, result, rscratch1);
|
||||
b(DONE);
|
||||
}
|
||||
|
||||
@ -4568,8 +4631,8 @@ void MacroAssembler::string_compare(Register str1, Register str2,
|
||||
cbz(cnt2, LENGTH_DIFF);
|
||||
|
||||
bind(SHORT_LOOP);
|
||||
load_unsigned_short(result, Address(post(str1, 2)));
|
||||
load_unsigned_short(cnt1, Address(post(str2, 2)));
|
||||
(this->*str1_load_chr)(result, Address(post(str1, str1_chr_size)));
|
||||
(this->*str2_load_chr)(cnt1, Address(post(str2, str2_chr_size)));
|
||||
subw(result, result, cnt1);
|
||||
cbnz(result, DONE);
|
||||
sub(cnt2, cnt2, 1);
|
||||
@ -4853,7 +4916,7 @@ void MacroAssembler::block_zero(Register base, Register cnt, bool is_large)
|
||||
// alignment.
|
||||
if (!is_large || !(BlockZeroingLowLimit >= zva_length * 2)) {
|
||||
int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit);
|
||||
cmp(cnt, low_limit >> 3);
|
||||
subs(tmp, cnt, low_limit >> 3);
|
||||
br(Assembler::LT, small);
|
||||
}
|
||||
|
||||
|
@ -995,10 +995,11 @@ public:
|
||||
}
|
||||
|
||||
// A generic CAS; success or failure is in the EQ flag.
|
||||
// Clobbers rscratch1
|
||||
void cmpxchg(Register addr, Register expected, Register new_val,
|
||||
enum operand_size size,
|
||||
bool acquire, bool release,
|
||||
Register tmp = rscratch1);
|
||||
bool acquire, bool release, bool weak,
|
||||
Register result);
|
||||
|
||||
// Calls
|
||||
|
||||
@ -1198,7 +1199,8 @@ public:
|
||||
|
||||
void string_compare(Register str1, Register str2,
|
||||
Register cnt1, Register cnt2, Register result,
|
||||
Register tmp1);
|
||||
Register tmp1,
|
||||
FloatRegister vtmp, FloatRegister vtmpZ, int ae);
|
||||
|
||||
void arrays_equals(Register a1, Register a2,
|
||||
Register result, Register cnt1,
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "register_aarch64.hpp"
|
||||
# include "interp_masm_aarch64.hpp"
|
||||
|
||||
REGISTER_DEFINITION(Register, noreg);
|
||||
|
||||
REGISTER_DEFINITION(Register, r0);
|
||||
REGISTER_DEFINITION(Register, r1);
|
||||
REGISTER_DEFINITION(Register, r2);
|
||||
@ -62,6 +64,8 @@ REGISTER_DEFINITION(Register, r29);
|
||||
REGISTER_DEFINITION(Register, r30);
|
||||
REGISTER_DEFINITION(Register, sp);
|
||||
|
||||
REGISTER_DEFINITION(FloatRegister, fnoreg);
|
||||
|
||||
REGISTER_DEFINITION(FloatRegister, v0);
|
||||
REGISTER_DEFINITION(FloatRegister, v1);
|
||||
REGISTER_DEFINITION(FloatRegister, v2);
|
||||
|
@ -801,6 +801,12 @@ class StubGenerator: public StubCodeGenerator {
|
||||
StubCodeMark mark(this, "StubRoutines", stub_name);
|
||||
__ align(CodeEntryAlignment);
|
||||
__ bind(start);
|
||||
|
||||
Label unaligned_copy_long;
|
||||
if (AvoidUnalignedAccesses) {
|
||||
__ tbnz(d, 3, unaligned_copy_long);
|
||||
}
|
||||
|
||||
if (direction == copy_forwards) {
|
||||
__ sub(s, s, bias);
|
||||
__ sub(d, d, bias);
|
||||
@ -901,6 +907,198 @@ class StubGenerator: public StubCodeGenerator {
|
||||
}
|
||||
|
||||
__ ret(lr);
|
||||
|
||||
if (AvoidUnalignedAccesses) {
|
||||
Label drain, again;
|
||||
// Register order for storing. Order is different for backward copy.
|
||||
|
||||
__ bind(unaligned_copy_long);
|
||||
|
||||
// source address is even aligned, target odd aligned
|
||||
//
|
||||
// when forward copying word pairs we read long pairs at offsets
|
||||
// {0, 2, 4, 6} (in long words). when backwards copying we read
|
||||
// long pairs at offsets {-2, -4, -6, -8}. We adjust the source
|
||||
// address by -2 in the forwards case so we can compute the
|
||||
// source offsets for both as {2, 4, 6, 8} * unit where unit = 1
|
||||
// or -1.
|
||||
//
|
||||
// when forward copying we need to store 1 word, 3 pairs and
|
||||
// then 1 word at offsets {0, 1, 3, 5, 7}. Rather thna use a
|
||||
// zero offset We adjust the destination by -1 which means we
|
||||
// have to use offsets { 1, 2, 4, 6, 8} * unit for the stores.
|
||||
//
|
||||
// When backwards copyng we need to store 1 word, 3 pairs and
|
||||
// then 1 word at offsets {-1, -3, -5, -7, -8} i.e. we use
|
||||
// offsets {1, 3, 5, 7, 8} * unit.
|
||||
|
||||
if (direction == copy_forwards) {
|
||||
__ sub(s, s, 16);
|
||||
__ sub(d, d, 8);
|
||||
}
|
||||
|
||||
// Fill 8 registers
|
||||
//
|
||||
// for forwards copy s was offset by -16 from the original input
|
||||
// value of s so the register contents are at these offsets
|
||||
// relative to the 64 bit block addressed by that original input
|
||||
// and so on for each successive 64 byte block when s is updated
|
||||
//
|
||||
// t0 at offset 0, t1 at offset 8
|
||||
// t2 at offset 16, t3 at offset 24
|
||||
// t4 at offset 32, t5 at offset 40
|
||||
// t6 at offset 48, t7 at offset 56
|
||||
|
||||
// for backwards copy s was not offset so the register contents
|
||||
// are at these offsets into the preceding 64 byte block
|
||||
// relative to that original input and so on for each successive
|
||||
// preceding 64 byte block when s is updated. this explains the
|
||||
// slightly counter-intuitive looking pattern of register usage
|
||||
// in the stp instructions for backwards copy.
|
||||
//
|
||||
// t0 at offset -16, t1 at offset -8
|
||||
// t2 at offset -32, t3 at offset -24
|
||||
// t4 at offset -48, t5 at offset -40
|
||||
// t6 at offset -64, t7 at offset -56
|
||||
|
||||
__ ldp(t0, t1, Address(s, 2 * unit));
|
||||
__ ldp(t2, t3, Address(s, 4 * unit));
|
||||
__ ldp(t4, t5, Address(s, 6 * unit));
|
||||
__ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
|
||||
|
||||
__ subs(count, count, 16);
|
||||
__ br(Assembler::LO, drain);
|
||||
|
||||
int prefetch = PrefetchCopyIntervalInBytes;
|
||||
bool use_stride = false;
|
||||
if (direction == copy_backwards) {
|
||||
use_stride = prefetch > 256;
|
||||
prefetch = -prefetch;
|
||||
if (use_stride) __ mov(stride, prefetch);
|
||||
}
|
||||
|
||||
__ bind(again);
|
||||
|
||||
if (PrefetchCopyIntervalInBytes > 0)
|
||||
__ prfm(use_stride ? Address(s, stride) : Address(s, prefetch), PLDL1KEEP);
|
||||
|
||||
if (direction == copy_forwards) {
|
||||
// allowing for the offset of -8 the store instructions place
|
||||
// registers into the target 64 bit block at the following
|
||||
// offsets
|
||||
//
|
||||
// t0 at offset 0
|
||||
// t1 at offset 8, t2 at offset 16
|
||||
// t3 at offset 24, t4 at offset 32
|
||||
// t5 at offset 40, t6 at offset 48
|
||||
// t7 at offset 56
|
||||
|
||||
__ str(t0, Address(d, 1 * unit));
|
||||
__ stp(t1, t2, Address(d, 2 * unit));
|
||||
__ ldp(t0, t1, Address(s, 2 * unit));
|
||||
__ stp(t3, t4, Address(d, 4 * unit));
|
||||
__ ldp(t2, t3, Address(s, 4 * unit));
|
||||
__ stp(t5, t6, Address(d, 6 * unit));
|
||||
__ ldp(t4, t5, Address(s, 6 * unit));
|
||||
__ str(t7, Address(__ pre(d, 8 * unit)));
|
||||
__ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
|
||||
} else {
|
||||
// d was not offset when we started so the registers are
|
||||
// written into the 64 bit block preceding d with the following
|
||||
// offsets
|
||||
//
|
||||
// t1 at offset -8
|
||||
// t3 at offset -24, t0 at offset -16
|
||||
// t5 at offset -48, t2 at offset -32
|
||||
// t7 at offset -56, t4 at offset -48
|
||||
// t6 at offset -64
|
||||
//
|
||||
// note that this matches the offsets previously noted for the
|
||||
// loads
|
||||
|
||||
__ str(t1, Address(d, 1 * unit));
|
||||
__ stp(t3, t0, Address(d, 3 * unit));
|
||||
__ ldp(t0, t1, Address(s, 2 * unit));
|
||||
__ stp(t5, t2, Address(d, 5 * unit));
|
||||
__ ldp(t2, t3, Address(s, 4 * unit));
|
||||
__ stp(t7, t4, Address(d, 7 * unit));
|
||||
__ ldp(t4, t5, Address(s, 6 * unit));
|
||||
__ str(t6, Address(__ pre(d, 8 * unit)));
|
||||
__ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
|
||||
}
|
||||
|
||||
__ subs(count, count, 8);
|
||||
__ br(Assembler::HS, again);
|
||||
|
||||
// Drain
|
||||
//
|
||||
// this uses the same pattern of offsets and register arguments
|
||||
// as above
|
||||
__ bind(drain);
|
||||
if (direction == copy_forwards) {
|
||||
__ str(t0, Address(d, 1 * unit));
|
||||
__ stp(t1, t2, Address(d, 2 * unit));
|
||||
__ stp(t3, t4, Address(d, 4 * unit));
|
||||
__ stp(t5, t6, Address(d, 6 * unit));
|
||||
__ str(t7, Address(__ pre(d, 8 * unit)));
|
||||
} else {
|
||||
__ str(t1, Address(d, 1 * unit));
|
||||
__ stp(t3, t0, Address(d, 3 * unit));
|
||||
__ stp(t5, t2, Address(d, 5 * unit));
|
||||
__ stp(t7, t4, Address(d, 7 * unit));
|
||||
__ str(t6, Address(__ pre(d, 8 * unit)));
|
||||
}
|
||||
// now we need to copy any remaining part block which may
|
||||
// include a 4 word block subblock and/or a 2 word subblock.
|
||||
// bits 2 and 1 in the count are the tell-tale for whetehr we
|
||||
// have each such subblock
|
||||
{
|
||||
Label L1, L2;
|
||||
__ tbz(count, exact_log2(4), L1);
|
||||
// this is the same as above but copying only 4 longs hence
|
||||
// with ony one intervening stp between the str instructions
|
||||
// but note that the offsets and registers still follow the
|
||||
// same pattern
|
||||
__ ldp(t0, t1, Address(s, 2 * unit));
|
||||
__ ldp(t2, t3, Address(__ pre(s, 4 * unit)));
|
||||
if (direction == copy_forwards) {
|
||||
__ str(t0, Address(d, 1 * unit));
|
||||
__ stp(t1, t2, Address(d, 2 * unit));
|
||||
__ str(t3, Address(__ pre(d, 4 * unit)));
|
||||
} else {
|
||||
__ str(t1, Address(d, 1 * unit));
|
||||
__ stp(t3, t0, Address(d, 3 * unit));
|
||||
__ str(t2, Address(__ pre(d, 4 * unit)));
|
||||
}
|
||||
__ bind(L1);
|
||||
|
||||
__ tbz(count, 1, L2);
|
||||
// this is the same as above but copying only 2 longs hence
|
||||
// there is no intervening stp between the str instructions
|
||||
// but note that the offset and register patterns are still
|
||||
// the same
|
||||
__ ldp(t0, t1, Address(__ pre(s, 2 * unit)));
|
||||
if (direction == copy_forwards) {
|
||||
__ str(t0, Address(d, 1 * unit));
|
||||
__ str(t1, Address(__ pre(d, 2 * unit)));
|
||||
} else {
|
||||
__ str(t1, Address(d, 1 * unit));
|
||||
__ str(t0, Address(__ pre(d, 2 * unit)));
|
||||
}
|
||||
__ bind(L2);
|
||||
|
||||
// for forwards copy we need to re-adjust the offsets we
|
||||
// applied so that s and d are follow the last words written
|
||||
|
||||
if (direction == copy_forwards) {
|
||||
__ add(s, s, 16);
|
||||
__ add(d, d, 8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
__ ret(lr);
|
||||
}
|
||||
}
|
||||
|
||||
// Small copy: less than 16 bytes.
|
||||
@ -1024,11 +1222,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
// (96 bytes if SIMD because we do 32 byes per instruction)
|
||||
__ bind(copy80);
|
||||
if (UseSIMDForMemoryOps) {
|
||||
__ ldpq(v0, v1, Address(s, 0));
|
||||
__ ldpq(v2, v3, Address(s, 32));
|
||||
__ ld4(v0, v1, v2, v3, __ T16B, Address(s, 0));
|
||||
__ ldpq(v4, v5, Address(send, -32));
|
||||
__ stpq(v0, v1, Address(d, 0));
|
||||
__ stpq(v2, v3, Address(d, 32));
|
||||
__ st4(v0, v1, v2, v3, __ T16B, Address(d, 0));
|
||||
__ stpq(v4, v5, Address(dend, -32));
|
||||
} else {
|
||||
__ ldp(t0, t1, Address(s, 0));
|
||||
@ -2150,8 +2346,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ subw(count, count, cnt_words, Assembler::LSL, 3 - shift);
|
||||
if (UseBlockZeroing) {
|
||||
Label non_block_zeroing, rest;
|
||||
Register tmp = rscratch1;
|
||||
// count >= BlockZeroingLowLimit && value == 0
|
||||
__ cmp(cnt_words, BlockZeroingLowLimit >> 3);
|
||||
__ subs(tmp, cnt_words, BlockZeroingLowLimit >> 3);
|
||||
__ ccmp(value, 0 /* comparing value */, 0 /* NZCV */, Assembler::GE);
|
||||
__ br(Assembler::NE, non_block_zeroing);
|
||||
__ mov(bz_base, to);
|
||||
|
@ -437,6 +437,21 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
|
||||
__ restore_locals();
|
||||
__ restore_constant_pool_cache();
|
||||
__ get_method(rmethod);
|
||||
__ get_dispatch();
|
||||
|
||||
// Calculate stack limit
|
||||
__ ldr(rscratch1, Address(rmethod, Method::const_offset()));
|
||||
__ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
|
||||
__ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2);
|
||||
__ ldr(rscratch2,
|
||||
Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
|
||||
__ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3);
|
||||
__ andr(sp, rscratch1, -16);
|
||||
|
||||
// Restore expression stack pointer
|
||||
__ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
|
||||
// NULL last_sp until next java call
|
||||
__ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
// Check if we need to take lock at entry of synchronized method.
|
||||
@ -463,22 +478,6 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
|
||||
__ bind(L);
|
||||
}
|
||||
|
||||
__ get_dispatch();
|
||||
|
||||
// Calculate stack limit
|
||||
__ ldr(rscratch1, Address(rmethod, Method::const_offset()));
|
||||
__ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
|
||||
__ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2);
|
||||
__ ldr(rscratch2,
|
||||
Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
|
||||
__ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3);
|
||||
__ andr(sp, rscratch1, -16);
|
||||
|
||||
// Restore expression stack pointer
|
||||
__ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
|
||||
// NULL last_sp until next java call
|
||||
__ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
|
||||
|
||||
__ dispatch_next(state, step);
|
||||
return entry;
|
||||
}
|
||||
|
@ -2434,7 +2434,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
__ ldrsb(r0, field);
|
||||
__ push(ztos);
|
||||
// Rewrite bytecode to be faster
|
||||
if (!is_static) {
|
||||
if (rc == may_rewrite) {
|
||||
// use btos rewriting, no truncating to t/f bit is needed for getfield.
|
||||
patch_bytecode(Bytecodes::_fast_bgetfield, bc, r1);
|
||||
}
|
||||
@ -2670,7 +2670,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
if (!is_static) pop_and_check_object(obj);
|
||||
__ andw(r0, r0, 0x1);
|
||||
__ strb(r0, field);
|
||||
if (!is_static) {
|
||||
if (rc == may_rewrite) {
|
||||
patch_bytecode(Bytecodes::_fast_zputfield, bc, r1, true, byte_no);
|
||||
}
|
||||
__ b(Done);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, Red Hat Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -29,10 +29,10 @@
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/stubCodeGenerator.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "vm_version_aarch64.hpp"
|
||||
#ifdef TARGET_OS_FAMILY_linux
|
||||
# include "os_linux.inline.hpp"
|
||||
#endif
|
||||
|
||||
#include OS_HEADER_INLINE(os)
|
||||
|
||||
#ifndef BUILTIN_SIM
|
||||
#include <sys/auxv.h>
|
||||
@ -175,7 +175,15 @@ void VM_Version::get_processor_features() {
|
||||
}
|
||||
|
||||
// Enable vendor specific features
|
||||
if (_cpu == CPU_CAVIUM && _variant == 0) _features |= CPU_DMB_ATOMICS;
|
||||
if (_cpu == CPU_CAVIUM) {
|
||||
if (_variant == 0) _features |= CPU_DMB_ATOMICS;
|
||||
if (FLAG_IS_DEFAULT(AvoidUnalignedAccesses)) {
|
||||
FLAG_SET_DEFAULT(AvoidUnalignedAccesses, true);
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) {
|
||||
FLAG_SET_DEFAULT(UseSIMDForMemoryOps, (_variant > 0));
|
||||
}
|
||||
}
|
||||
if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC;
|
||||
if (_cpu == CPU_ARM && (_model == 0xd07 || _model2 == 0xd07)) _features |= CPU_STXR_PREFETCH;
|
||||
// If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2013 SAP SE. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016 SAP SE. 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
|
||||
@ -274,8 +274,6 @@ class Bytes: AllStatic {
|
||||
#endif // VM_LITTLE_ENDIAN
|
||||
};
|
||||
|
||||
#if defined(TARGET_OS_ARCH_linux_ppc)
|
||||
#include "bytes_linux_ppc.inline.hpp"
|
||||
#endif
|
||||
#include OS_CPU_HEADER_INLINE(bytes)
|
||||
|
||||
#endif // CPU_PPC_VM_BYTES_PPC_HPP
|
||||
|
64
hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp
Normal file
64
hotspot/src/cpu/ppc/vm/c1_LIR_ppc.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016 SAP SE. 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/register.hpp"
|
||||
#include "c1/c1_LIR.hpp"
|
||||
|
||||
FloatRegister LIR_OprDesc::as_float_reg() const {
|
||||
return as_FloatRegister(fpu_regnr());
|
||||
}
|
||||
|
||||
FloatRegister LIR_OprDesc::as_double_reg() const {
|
||||
return as_FloatRegister(fpu_regnrLo());
|
||||
}
|
||||
|
||||
// Reg2 unused.
|
||||
LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
|
||||
assert(!as_FloatRegister(reg2)->is_valid(), "Not used on this platform");
|
||||
return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
|
||||
(reg1 << LIR_OprDesc::reg2_shift) |
|
||||
LIR_OprDesc::double_type |
|
||||
LIR_OprDesc::fpu_register |
|
||||
LIR_OprDesc::double_size);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void LIR_Address::verify() const {
|
||||
assert(scale() == times_1, "Scaled addressing mode not available on PPC and should not be used");
|
||||
assert(disp() == 0 || index()->is_illegal(), "can't have both");
|
||||
#ifdef _LP64
|
||||
assert(base()->is_cpu_register(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
#else
|
||||
assert(base()->is_single_cpu(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
#endif
|
||||
}
|
||||
#endif // PRODUCT
|
@ -47,7 +47,7 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
|
||||
// The expected size in bytes of a cache line, used to pad data structures.
|
||||
#define DEFAULT_CACHE_LINE_SIZE 128
|
||||
|
||||
#if defined(COMPILER2) && (defined(AIX) || defined(linux))
|
||||
#if defined(COMPILER2) && (defined(AIX) || defined(LINUX))
|
||||
// Include Transactional Memory lock eliding optimization
|
||||
#define INCLUDE_RTM_OPT 1
|
||||
#endif
|
||||
|
@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
|
||||
#define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
|
||||
#ifndef CPU_PPC_VM_INTERP_MASM_PPC_HPP
|
||||
#define CPU_PPC_VM_INTERP_MASM_PPC_HPP
|
||||
|
||||
#include "asm/macroAssembler.hpp"
|
||||
#include "interpreter/invocationCounter.hpp"
|
||||
@ -263,4 +263,4 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
NotifyMethodExitMode mode, bool check_exceptions);
|
||||
};
|
||||
|
||||
#endif // CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
|
||||
#endif // CPU_PPC_VM_INTERP_MASM_PPC_HPP
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/macroAssembler.inline.hpp"
|
||||
#include "interp_masm_ppc_64.hpp"
|
||||
#include "interp_masm_ppc.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "prims/jvmtiThreadState.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
|
@ -1,24 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
// Copyright (c) 2012, 2013 SAP SE. 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.
|
||||
//
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016 SAP SE. 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
|
||||
@ -76,7 +76,7 @@ class RegisterImpl;
|
||||
typedef RegisterImpl* Register;
|
||||
|
||||
inline Register as_Register(int encoding) {
|
||||
assert(encoding >= 0 && encoding < 32, "bad register encoding");
|
||||
assert(encoding >= -1 && encoding < 32, "bad register encoding");
|
||||
return (Register)(intptr_t)encoding;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class RegisterImpl: public AbstractRegisterImpl {
|
||||
inline friend Register as_Register(int encoding);
|
||||
|
||||
// accessors
|
||||
int encoding() const { assert(is_valid(), "invalid register"); return value(); }
|
||||
int encoding() const { assert(is_valid(), "invalid register"); return value(); }
|
||||
inline VMReg as_VMReg();
|
||||
Register successor() const { return as_Register(encoding() + 1); }
|
||||
|
||||
@ -247,7 +247,7 @@ class FloatRegisterImpl;
|
||||
typedef FloatRegisterImpl* FloatRegister;
|
||||
|
||||
inline FloatRegister as_FloatRegister(int encoding) {
|
||||
assert(encoding >= 0 && encoding < 32, "bad float register encoding");
|
||||
assert(encoding >= -1 && encoding < 32, "bad float register encoding");
|
||||
return (FloatRegister)(intptr_t)encoding;
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ class FloatRegisterImpl: public AbstractRegisterImpl {
|
||||
FloatRegister successor() const { return as_FloatRegister(encoding() + 1); }
|
||||
|
||||
// testers
|
||||
bool is_valid() const { return (0 <= value() && value() < number_of_registers); }
|
||||
bool is_valid() const { return (0 <= value() && value() < number_of_registers); }
|
||||
|
||||
const char* name() const;
|
||||
};
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "c1/c1_Runtime1.hpp"
|
||||
#endif
|
||||
#ifdef COMPILER2
|
||||
#include "adfiles/ad_ppc_64.hpp"
|
||||
#include "opto/ad.hpp"
|
||||
#include "opto/runtime.hpp"
|
||||
#endif
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016 SAP SE. 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
|
||||
@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPU_PPC_VM_STUBROUTINES_PPC_64_HPP
|
||||
#define CPU_PPC_VM_STUBROUTINES_PPC_64_HPP
|
||||
#ifndef CPU_PPC_VM_STUBROUTINES_PPC_HPP
|
||||
#define CPU_PPC_VM_STUBROUTINES_PPC_HPP
|
||||
|
||||
// This file holds the platform specific parts of the StubRoutines
|
||||
// definition. See stubRoutines.hpp for a description on how to
|
||||
@ -61,4 +61,4 @@ class ppc64 {
|
||||
|
||||
};
|
||||
|
||||
#endif // CPU_PPC_VM_STUBROUTINES_PPC_64_HPP
|
||||
#endif // CPU_PPC_VM_STUBROUTINES_PPC_HPP
|
@ -881,10 +881,6 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rmem_f
|
||||
BLOCK_COMMENT("} stack_overflow_check_with_compare");
|
||||
}
|
||||
|
||||
void TemplateInterpreterGenerator::unlock_method(bool check_exceptions) {
|
||||
__ unlock_object(R26_monitor, check_exceptions);
|
||||
}
|
||||
|
||||
// Lock the current method, interpreter register window must be set up!
|
||||
void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded) {
|
||||
const Register Robj_to_lock = Rscratch2;
|
||||
@ -1566,7 +1562,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
|
||||
if (synchronized) {
|
||||
// Don't check for exceptions since we're still in the i2n frame. Do that
|
||||
// manually afterwards.
|
||||
unlock_method(false);
|
||||
__ unlock_object(R26_monitor, false); // Can also unlock methods.
|
||||
}
|
||||
|
||||
// Reset active handles after returning from native.
|
||||
@ -1609,7 +1605,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
|
||||
if (synchronized) {
|
||||
// Don't check for exceptions since we're still in the i2n frame. Do that
|
||||
// manually afterwards.
|
||||
unlock_method(false);
|
||||
__ unlock_object(R26_monitor, false); // Can also unlock methods.
|
||||
}
|
||||
BIND(exception_return_sync_check_already_unlocked);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2014 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2016 SAP SE. 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
|
||||
@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP
|
||||
#define CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP
|
||||
#ifndef CPU_PPC_VM_TEMPLATETABLE_PPC_HPP
|
||||
#define CPU_PPC_VM_TEMPLATETABLE_PPC_HPP
|
||||
|
||||
static void prepare_invoke(int byte_no, Register Rmethod, Register Rret_addr, Register Rindex, Register Rrecv, Register Rflags, Register Rscratch);
|
||||
static void invokevfinal_helper(Register Rmethod, Register Rflags, Register Rscratch1, Register Rscratch2);
|
||||
@ -35,4 +35,4 @@
|
||||
static void branch_conditional(ConditionRegister crx, TemplateTable::Condition cc, Label& L, bool invert = false);
|
||||
static void if_cmp_common(Register Rfirst, Register Rsecond, Register Rscratch1, Register Rscratch2, Condition cc, bool is_jint, bool cmp0);
|
||||
|
||||
#endif // CPU_PPC_VM_TEMPLATETABLE_PPC_64_HPP
|
||||
#endif // CPU_PPC_VM_TEMPLATETABLE_PPC_HPP
|
@ -1668,9 +1668,13 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
|
||||
__ lwz(Rscratch3, in_bytes(MethodData::backedge_mask_offset()), Rmdo);
|
||||
__ addi(Rscratch2, Rscratch2, increment);
|
||||
__ stw(Rscratch2, mdo_bc_offs, Rmdo);
|
||||
__ and_(Rscratch3, Rscratch2, Rscratch3);
|
||||
__ bne(CCR0, Lforward);
|
||||
__ b(Loverflow);
|
||||
if (UseOnStackReplacement) {
|
||||
__ and_(Rscratch3, Rscratch2, Rscratch3);
|
||||
__ bne(CCR0, Lforward);
|
||||
__ b(Loverflow);
|
||||
} else {
|
||||
__ b(Lforward);
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no MDO, increment counter in method.
|
||||
@ -1680,9 +1684,12 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
|
||||
__ lwz(Rscratch3, in_bytes(MethodCounters::backedge_mask_offset()), R4_counters);
|
||||
__ addi(Rscratch2, Rscratch2, increment);
|
||||
__ stw(Rscratch2, mo_bc_offs, R4_counters);
|
||||
__ and_(Rscratch3, Rscratch2, Rscratch3);
|
||||
__ bne(CCR0, Lforward);
|
||||
|
||||
if (UseOnStackReplacement) {
|
||||
__ and_(Rscratch3, Rscratch2, Rscratch3);
|
||||
__ bne(CCR0, Lforward);
|
||||
} else {
|
||||
__ b(Lforward);
|
||||
}
|
||||
__ bind(Loverflow);
|
||||
|
||||
// Notify point for loop, pass branch bytecode.
|
||||
|
@ -278,7 +278,7 @@ void VM_Version::initialize() {
|
||||
os_too_old = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef linux
|
||||
#ifdef LINUX
|
||||
// At least Linux kernel 4.2, as the problematic behavior of syscalls
|
||||
// being called in the middle of a transaction has been addressed.
|
||||
// Please, refer to commit b4b56f9ecab40f3b4ef53e130c9f6663be491894
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2012, 2016 SAP SE. 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
|
||||
@ -26,7 +26,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/macroAssembler.inline.hpp"
|
||||
#include "code/vtableStubs.hpp"
|
||||
#include "interp_masm_ppc_64.hpp"
|
||||
#include "interp_masm_ppc.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
@ -243,7 +243,7 @@ VtableStub* VtableStubs::create_itable_stub(int vtable_index) {
|
||||
}
|
||||
|
||||
int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
|
||||
if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) {
|
||||
if (DebugVtables || CountCompiledCalls || VerifyOops) {
|
||||
return 1000;
|
||||
} else {
|
||||
int decode_klass_size = MacroAssembler::instr_size_for_decode_klass_not_null();
|
||||
|
63
hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp
Normal file
63
hotspot/src/cpu/sparc/vm/c1_LIR_sparc.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/register.hpp"
|
||||
#include "c1/c1_FrameMap.hpp"
|
||||
#include "c1/c1_LIR.hpp"
|
||||
|
||||
FloatRegister LIR_OprDesc::as_float_reg() const {
|
||||
return FrameMap::nr2floatreg(fpu_regnr());
|
||||
}
|
||||
|
||||
FloatRegister LIR_OprDesc::as_double_reg() const {
|
||||
return FrameMap::nr2floatreg(fpu_regnrHi());
|
||||
}
|
||||
|
||||
LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
|
||||
assert(as_FloatRegister(reg2) != fnoreg, "Sparc holds double in two regs.");
|
||||
return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
|
||||
(reg2 << LIR_OprDesc::reg2_shift) |
|
||||
LIR_OprDesc::double_type |
|
||||
LIR_OprDesc::fpu_register |
|
||||
LIR_OprDesc::double_size);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void LIR_Address::verify() const {
|
||||
assert(scale() == times_1, "Scaled addressing mode not available on SPARC and should not be used");
|
||||
assert(disp() == 0 || index()->is_illegal(), "can't have both");
|
||||
#ifdef _LP64
|
||||
assert(base()->is_cpu_register(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
#else
|
||||
assert(base()->is_single_cpu(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
#endif
|
||||
}
|
||||
#endif // PRODUCT
|
@ -77,8 +77,7 @@ int CompiledStaticCall::to_interp_stub_size() {
|
||||
// This doesn't need to be accurate but it must be larger or equal to
|
||||
// the real size of the stub.
|
||||
return (NativeMovConstReg::instruction_size + // sethi/setlo;
|
||||
NativeJump::instruction_size + // sethi; jmp; nop
|
||||
(TraceJumps ? 20 * BytesPerInstWord : 0) );
|
||||
NativeJump::instruction_size); // sethi; jmp; nop
|
||||
}
|
||||
|
||||
// Relocation entries for call stub, compiled java to interpreter.
|
||||
|
@ -32,7 +32,7 @@ const int StackAlignmentInBytes = (2*wordSize);
|
||||
|
||||
// Indicates whether the C calling conventions require that
|
||||
// 32-bit integer argument values are extended to 64 bits.
|
||||
const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
const bool CCallingConventionRequiresIntsAsLongs = true;
|
||||
|
||||
#define SUPPORTS_NATIVE_CX8
|
||||
|
||||
|
@ -33,12 +33,10 @@
|
||||
|
||||
int InlineCacheBuffer::ic_stub_code_size() {
|
||||
#ifdef _LP64
|
||||
if (TraceJumps) return 600 * wordSize;
|
||||
return (NativeMovConstReg::instruction_size + // sethi;add
|
||||
NativeJump::instruction_size + // sethi; jmp; delay slot
|
||||
(1*BytesPerInstWord) + 1); // flush + 1 extra byte
|
||||
#else
|
||||
if (TraceJumps) return 300 * wordSize;
|
||||
return (2+2+ 1) * wordSize + 1; // set/jump_to/nop + 1 byte so that code_end can be set in CodeBuffer
|
||||
#endif
|
||||
}
|
||||
|
@ -184,72 +184,10 @@ void MacroAssembler::null_check(Register reg, int offset) {
|
||||
|
||||
void MacroAssembler::jmp2(Register r1, Register r2, const char* file, int line ) {
|
||||
assert_not_delayed();
|
||||
// This can only be traceable if r1 & r2 are visible after a window save
|
||||
if (TraceJumps) {
|
||||
#ifndef PRODUCT
|
||||
save_frame(0);
|
||||
verify_thread();
|
||||
ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
|
||||
add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
|
||||
sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
|
||||
add(O2, O1, O1);
|
||||
|
||||
add(r1->after_save(), r2->after_save(), O2);
|
||||
set((intptr_t)file, O3);
|
||||
set(line, O4);
|
||||
Label L;
|
||||
// get nearby pc, store jmp target
|
||||
call(L, relocInfo::none); // No relocation for call to pc+0x8
|
||||
delayed()->st(O2, O1, 0);
|
||||
bind(L);
|
||||
|
||||
// store nearby pc
|
||||
st(O7, O1, sizeof(intptr_t));
|
||||
// store file
|
||||
st(O3, O1, 2*sizeof(intptr_t));
|
||||
// store line
|
||||
st(O4, O1, 3*sizeof(intptr_t));
|
||||
add(O0, 1, O0);
|
||||
and3(O0, JavaThread::jump_ring_buffer_size - 1, O0);
|
||||
st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
|
||||
restore();
|
||||
#endif /* PRODUCT */
|
||||
}
|
||||
jmpl(r1, r2, G0);
|
||||
}
|
||||
void MacroAssembler::jmp(Register r1, int offset, const char* file, int line ) {
|
||||
assert_not_delayed();
|
||||
// This can only be traceable if r1 is visible after a window save
|
||||
if (TraceJumps) {
|
||||
#ifndef PRODUCT
|
||||
save_frame(0);
|
||||
verify_thread();
|
||||
ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
|
||||
add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
|
||||
sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
|
||||
add(O2, O1, O1);
|
||||
|
||||
add(r1->after_save(), offset, O2);
|
||||
set((intptr_t)file, O3);
|
||||
set(line, O4);
|
||||
Label L;
|
||||
// get nearby pc, store jmp target
|
||||
call(L, relocInfo::none); // No relocation for call to pc+0x8
|
||||
delayed()->st(O2, O1, 0);
|
||||
bind(L);
|
||||
|
||||
// store nearby pc
|
||||
st(O7, O1, sizeof(intptr_t));
|
||||
// store file
|
||||
st(O3, O1, 2*sizeof(intptr_t));
|
||||
// store line
|
||||
st(O4, O1, 3*sizeof(intptr_t));
|
||||
add(O0, 1, O0);
|
||||
and3(O0, JavaThread::jump_ring_buffer_size - 1, O0);
|
||||
st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
|
||||
restore();
|
||||
#endif /* PRODUCT */
|
||||
}
|
||||
jmp(r1, offset);
|
||||
}
|
||||
|
||||
@ -260,44 +198,7 @@ void MacroAssembler::jumpl(const AddressLiteral& addrlit, Register temp, Registe
|
||||
// variable length instruction streams.
|
||||
patchable_sethi(addrlit, temp);
|
||||
Address a(temp, addrlit.low10() + offset); // Add the offset to the displacement.
|
||||
if (TraceJumps) {
|
||||
#ifndef PRODUCT
|
||||
// Must do the add here so relocation can find the remainder of the
|
||||
// value to be relocated.
|
||||
add(a.base(), a.disp(), a.base(), addrlit.rspec(offset));
|
||||
save_frame(0);
|
||||
verify_thread();
|
||||
ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
|
||||
add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
|
||||
sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
|
||||
add(O2, O1, O1);
|
||||
|
||||
set((intptr_t)file, O3);
|
||||
set(line, O4);
|
||||
Label L;
|
||||
|
||||
// get nearby pc, store jmp target
|
||||
call(L, relocInfo::none); // No relocation for call to pc+0x8
|
||||
delayed()->st(a.base()->after_save(), O1, 0);
|
||||
bind(L);
|
||||
|
||||
// store nearby pc
|
||||
st(O7, O1, sizeof(intptr_t));
|
||||
// store file
|
||||
st(O3, O1, 2*sizeof(intptr_t));
|
||||
// store line
|
||||
st(O4, O1, 3*sizeof(intptr_t));
|
||||
add(O0, 1, O0);
|
||||
and3(O0, JavaThread::jump_ring_buffer_size - 1, O0);
|
||||
st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
|
||||
restore();
|
||||
jmpl(a.base(), G0, d);
|
||||
#else
|
||||
jmpl(a.base(), a.disp(), d);
|
||||
#endif /* PRODUCT */
|
||||
} else {
|
||||
jmpl(a.base(), a.disp(), d);
|
||||
}
|
||||
jmpl(a.base(), a.disp(), d);
|
||||
}
|
||||
|
||||
void MacroAssembler::jump(const AddressLiteral& addrlit, Register temp, int offset, const char* file, int line) {
|
||||
|
@ -703,8 +703,8 @@ class MacroAssembler : public Assembler {
|
||||
|
||||
inline void tst( Register s );
|
||||
|
||||
inline void ret( bool trace = TraceJumps );
|
||||
inline void retl( bool trace = TraceJumps );
|
||||
inline void ret( bool trace = false );
|
||||
inline void retl( bool trace = false );
|
||||
|
||||
// Required platform-specific helpers for Label::patch_instructions.
|
||||
// They _shadow_ the declarations in AbstractAssembler, which are undefined.
|
||||
|
@ -760,8 +760,7 @@ void NativeJump::verify() {
|
||||
Register rd = inv_rd(i0);
|
||||
#ifndef _LP64
|
||||
if (!(is_op2(i0, Assembler::sethi_op2) && rd != G0 &&
|
||||
(is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op) ||
|
||||
(TraceJumps && is_op3(i1, Assembler::add_op3, Assembler::arith_op))) &&
|
||||
(is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op)) &&
|
||||
inv_immed(i1) && (unsigned)get_simm13(i1) < (1 << 10) &&
|
||||
rd == inv_rs1(i1))) {
|
||||
fatal("not a jump_to instruction");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, 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
|
||||
@ -25,7 +25,9 @@
|
||||
// make sure the defines don't screw up the declarations later on in this file
|
||||
#define DONT_USE_REGISTER_DEFINES
|
||||
|
||||
#include "precompiled.hpp"
|
||||
// Note: precompiled headers can not be used in this file because of the above
|
||||
// definition
|
||||
|
||||
#include "asm/assembler.hpp"
|
||||
#include "asm/register.hpp"
|
||||
#include "interp_masm_sparc.hpp"
|
||||
|
@ -3368,9 +3368,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// setup code generation tools
|
||||
// Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread)
|
||||
// Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread)
|
||||
// even larger with TraceJumps
|
||||
int pad = TraceJumps ? 512 : 0;
|
||||
CodeBuffer buffer("handler_blob", 1600 + pad, 512);
|
||||
CodeBuffer buffer("handler_blob", 1600, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
int frame_size_words;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
@ -3462,9 +3460,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// setup code generation tools
|
||||
// Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread)
|
||||
// Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread)
|
||||
// even larger with TraceJumps
|
||||
int pad = TraceJumps ? 512 : 0;
|
||||
CodeBuffer buffer(name, 1600 + pad, 512);
|
||||
CodeBuffer buffer(name, 1600, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
int frame_size_words;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
|
@ -501,16 +501,10 @@ class HandlerImpl {
|
||||
static int emit_deopt_handler(CodeBuffer& cbuf);
|
||||
|
||||
static uint size_exception_handler() {
|
||||
if (TraceJumps) {
|
||||
return (400); // just a guess
|
||||
}
|
||||
return ( NativeJump::instruction_size ); // sethi;jmp;nop
|
||||
}
|
||||
|
||||
static uint size_deopt_handler() {
|
||||
if (TraceJumps) {
|
||||
return (400); // just a guess
|
||||
}
|
||||
return ( 4+ NativeJump::instruction_size ); // save;sethi;jmp;restore
|
||||
}
|
||||
};
|
||||
@ -720,7 +714,7 @@ intptr_t get_offset_from_base_2(const MachNode* n, const TypePtr* atype, int dis
|
||||
return offset;
|
||||
}
|
||||
|
||||
static inline jdouble replicate_immI(int con, int count, int width) {
|
||||
static inline jlong replicate_immI(int con, int count, int width) {
|
||||
// Load a constant replicated "count" times with width "width"
|
||||
assert(count*width == 8 && width <= 4, "sanity");
|
||||
int bit_width = width * 8;
|
||||
@ -729,17 +723,15 @@ static inline jdouble replicate_immI(int con, int count, int width) {
|
||||
for (int i = 0; i < count - 1; i++) {
|
||||
val |= (val << bit_width);
|
||||
}
|
||||
jdouble dval = *((jdouble*) &val); // coerce to double type
|
||||
return dval;
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline jdouble replicate_immF(float con) {
|
||||
static inline jlong replicate_immF(float con) {
|
||||
// Replicate float con 2 times and pack into vector.
|
||||
int val = *((int*)&con);
|
||||
jlong lval = val;
|
||||
lval = (lval << 32) | (lval & 0xFFFFFFFFl);
|
||||
jdouble dval = *((jdouble*) &lval); // coerce to double type
|
||||
return dval;
|
||||
return lval;
|
||||
}
|
||||
|
||||
// Standard Sparc opcode form2 field breakdown
|
||||
@ -2661,8 +2653,7 @@ encode %{
|
||||
|
||||
// Emit stub for static call.
|
||||
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
|
||||
// Stub does not fit into scratch buffer if TraceJumps is enabled
|
||||
if (stub == NULL && !(TraceJumps && Compile::current()->in_scratch_emit_size())) {
|
||||
if (stub == NULL) {
|
||||
ciEnv::current()->record_failure("CodeCache is full");
|
||||
return;
|
||||
}
|
||||
|
@ -1560,13 +1560,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
|
||||
__ bind(ok);
|
||||
}
|
||||
#endif
|
||||
if (TraceJumps) {
|
||||
// Move target to register that is recordable
|
||||
__ mov(Lscratch, G3_scratch);
|
||||
__ JMP(G3_scratch, 0);
|
||||
} else {
|
||||
__ jmp(Lscratch, 0);
|
||||
}
|
||||
__ jmp(Lscratch, 0);
|
||||
__ delayed()->nop();
|
||||
|
||||
|
||||
|
@ -1636,7 +1636,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
|
||||
in_bytes(InvocationCounter::counter_offset()));
|
||||
Address mask(G4_scratch, in_bytes(MethodData::backedge_mask_offset()));
|
||||
__ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0,
|
||||
Assembler::notZero, &Lforward);
|
||||
(UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward);
|
||||
__ ba_short(Loverflow);
|
||||
}
|
||||
|
||||
@ -1647,7 +1647,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
|
||||
in_bytes(InvocationCounter::counter_offset()));
|
||||
Address mask(G3_method_counters, in_bytes(MethodCounters::backedge_mask_offset()));
|
||||
__ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0,
|
||||
Assembler::notZero, &Lforward);
|
||||
(UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward);
|
||||
__ bind(Loverflow);
|
||||
|
||||
// notify point for loop, pass branch bytecode
|
||||
|
@ -221,7 +221,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
|
||||
|
||||
int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
|
||||
if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
|
||||
if (DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
|
||||
else {
|
||||
const int slop = 2*BytesPerInstWord; // sethi;add (needed for long offsets)
|
||||
if (is_vtable_stub) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -26,6 +26,7 @@
|
||||
#define CPU_X86_VM_BYTES_X86_HPP
|
||||
|
||||
#include "memory/allocation.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
class Bytes: AllStatic {
|
||||
private:
|
||||
@ -70,20 +71,7 @@ class Bytes: AllStatic {
|
||||
static inline u8 swap_u8(u8 x);
|
||||
};
|
||||
|
||||
|
||||
// The following header contains the implementations of swap_u2, swap_u4, and swap_u8[_base]
|
||||
#ifdef TARGET_OS_ARCH_linux_x86
|
||||
# include "bytes_linux_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_solaris_x86
|
||||
# include "bytes_solaris_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_windows_x86
|
||||
# include "bytes_windows_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_bsd_x86
|
||||
# include "bytes_bsd_x86.inline.hpp"
|
||||
#endif
|
||||
|
||||
#include OS_CPU_HEADER_INLINE(bytes)
|
||||
|
||||
#endif // CPU_X86_VM_BYTES_X86_HPP
|
||||
|
@ -761,7 +761,6 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) {
|
||||
} else {
|
||||
a = new LIR_Address(obj.result(),
|
||||
offset.result(),
|
||||
LIR_Address::times_1,
|
||||
0,
|
||||
as_BasicType(type));
|
||||
}
|
||||
@ -1081,7 +1080,6 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) {
|
||||
|
||||
LIR_Address* a = new LIR_Address(base_op,
|
||||
index,
|
||||
LIR_Address::times_1,
|
||||
offset,
|
||||
T_BYTE);
|
||||
BasicTypeList signature(3);
|
||||
@ -1157,13 +1155,11 @@ void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
|
||||
|
||||
LIR_Address* addr_a = new LIR_Address(result_a,
|
||||
result_aOffset,
|
||||
LIR_Address::times_1,
|
||||
constant_aOffset,
|
||||
T_BYTE);
|
||||
|
||||
LIR_Address* addr_b = new LIR_Address(result_b,
|
||||
result_bOffset,
|
||||
LIR_Address::times_1,
|
||||
constant_bOffset,
|
||||
T_BYTE);
|
||||
|
||||
|
74
hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp
Normal file
74
hotspot/src/cpu/x86/vm/c1_LIR_x86.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/register.hpp"
|
||||
#include "c1/c1_FrameMap.hpp"
|
||||
#include "c1/c1_LIR.hpp"
|
||||
|
||||
|
||||
FloatRegister LIR_OprDesc::as_float_reg() const {
|
||||
ShouldNotReachHere();
|
||||
return fnoreg;
|
||||
}
|
||||
|
||||
FloatRegister LIR_OprDesc::as_double_reg() const {
|
||||
ShouldNotReachHere();
|
||||
return fnoreg;
|
||||
}
|
||||
|
||||
XMMRegister LIR_OprDesc::as_xmm_float_reg() const {
|
||||
return FrameMap::nr2xmmreg(xmm_regnr());
|
||||
}
|
||||
|
||||
XMMRegister LIR_OprDesc::as_xmm_double_reg() const {
|
||||
assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation");
|
||||
return FrameMap::nr2xmmreg(xmm_regnrLo());
|
||||
}
|
||||
|
||||
// Reg2 unused.
|
||||
LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
|
||||
assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform");
|
||||
return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
|
||||
(reg1 << LIR_OprDesc::reg2_shift) |
|
||||
LIR_OprDesc::double_type |
|
||||
LIR_OprDesc::fpu_register |
|
||||
LIR_OprDesc::double_size);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void LIR_Address::verify() const {
|
||||
#ifdef _LP64
|
||||
assert(base()->is_cpu_register(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
#else
|
||||
assert(base()->is_single_cpu(), "wrong base operand");
|
||||
assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
|
||||
assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
|
||||
"wrong type for addresses");
|
||||
#endif
|
||||
}
|
||||
#endif // PRODUCT
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2016, 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
|
||||
@ -28,19 +28,7 @@
|
||||
// Inline functions for memory copy and fill.
|
||||
|
||||
// Contains inline asm implementations
|
||||
#ifdef TARGET_OS_ARCH_linux_x86
|
||||
# include "copy_linux_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_solaris_x86
|
||||
# include "copy_solaris_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_windows_x86
|
||||
# include "copy_windows_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_bsd_x86
|
||||
# include "copy_bsd_x86.inline.hpp"
|
||||
#endif
|
||||
|
||||
#include OS_CPU_HEADER_INLINE(copy)
|
||||
|
||||
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
|
||||
#ifdef AMD64
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -56,7 +56,7 @@ const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER2) && !defined(JAVASE_EMBEDDED)
|
||||
#if defined(COMPILER2)
|
||||
// Include Restricted Transactional Memory lock eliding optimization
|
||||
#define INCLUDE_RTM_OPT 1
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -22,14 +22,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
#ifndef CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP
|
||||
#define CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP
|
||||
|
||||
import com.sun.jdi.*;
|
||||
// Still empty.
|
||||
|
||||
abstract class ValueImpl extends MirrorImpl implements Value {
|
||||
ValueImpl(VirtualMachine aVm) {
|
||||
super(aVm);
|
||||
}
|
||||
|
||||
// type() is in the subclasses
|
||||
}
|
||||
#endif // CPU_X86_VM_MACROASSEMBLER_X86_INLINE_HPP
|
@ -1060,7 +1060,7 @@ void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm
|
||||
|
||||
bind(B1_4);
|
||||
addq(rsp, 16);
|
||||
|
||||
pop(rbx);
|
||||
}
|
||||
#else
|
||||
// The 32 bit code is at most SSE2 compliant
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, 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
|
||||
@ -26,9 +26,7 @@
|
||||
#include "asm/assembler.hpp"
|
||||
#include "asm/register.hpp"
|
||||
#include "register_x86.hpp"
|
||||
#ifdef TARGET_ARCH_x86
|
||||
# include "interp_masm_x86.hpp"
|
||||
#endif
|
||||
#include "interp_masm_x86.hpp"
|
||||
|
||||
REGISTER_DEFINITION(Register, noreg);
|
||||
REGISTER_DEFINITION(Register, rax);
|
||||
@ -50,6 +48,8 @@ REGISTER_DEFINITION(Register, r14);
|
||||
REGISTER_DEFINITION(Register, r15);
|
||||
#endif // AMD64
|
||||
|
||||
REGISTER_DEFINITION(FloatRegister, fnoreg);
|
||||
|
||||
REGISTER_DEFINITION(XMMRegister, xnoreg);
|
||||
REGISTER_DEFINITION(XMMRegister, xmm0 );
|
||||
REGISTER_DEFINITION(XMMRegister, xmm1 );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2016, 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
|
||||
@ -124,6 +124,8 @@ class FloatRegisterImpl: public AbstractRegisterImpl {
|
||||
|
||||
};
|
||||
|
||||
CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg, (-1));
|
||||
|
||||
// Use XMMRegister as shortcut
|
||||
class XMMRegisterImpl;
|
||||
typedef XMMRegisterImpl* XMMRegister;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2016, 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
|
||||
@ -29,6 +29,83 @@
|
||||
// definition. See stubRoutines.hpp for a description on how to
|
||||
// extend it.
|
||||
|
||||
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
|
||||
|
||||
enum platform_dependent_constants {
|
||||
code_size1 = 20000 LP64_ONLY(+10000), // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 33800 LP64_ONLY(+1200) // simply increase if too small (assembler will crash if too small)
|
||||
};
|
||||
|
||||
class x86 {
|
||||
friend class StubGenerator;
|
||||
friend class VMStructs;
|
||||
|
||||
#ifdef _LP64
|
||||
private:
|
||||
static address _get_previous_fp_entry;
|
||||
static address _get_previous_sp_entry;
|
||||
|
||||
static address _f2i_fixup;
|
||||
static address _f2l_fixup;
|
||||
static address _d2i_fixup;
|
||||
static address _d2l_fixup;
|
||||
|
||||
static address _float_sign_mask;
|
||||
static address _float_sign_flip;
|
||||
static address _double_sign_mask;
|
||||
static address _double_sign_flip;
|
||||
|
||||
public:
|
||||
|
||||
static address get_previous_fp_entry() {
|
||||
return _get_previous_fp_entry;
|
||||
}
|
||||
|
||||
static address get_previous_sp_entry() {
|
||||
return _get_previous_sp_entry;
|
||||
}
|
||||
|
||||
static address f2i_fixup() {
|
||||
return _f2i_fixup;
|
||||
}
|
||||
|
||||
static address f2l_fixup() {
|
||||
return _f2l_fixup;
|
||||
}
|
||||
|
||||
static address d2i_fixup() {
|
||||
return _d2i_fixup;
|
||||
}
|
||||
|
||||
static address d2l_fixup() {
|
||||
return _d2l_fixup;
|
||||
}
|
||||
|
||||
static address float_sign_mask() {
|
||||
return _float_sign_mask;
|
||||
}
|
||||
|
||||
static address float_sign_flip() {
|
||||
return _float_sign_flip;
|
||||
}
|
||||
|
||||
static address double_sign_mask() {
|
||||
return _double_sign_mask;
|
||||
}
|
||||
|
||||
static address double_sign_flip() {
|
||||
return _double_sign_flip;
|
||||
}
|
||||
#else // !LP64
|
||||
|
||||
private:
|
||||
static address _verify_fpu_cntrl_wrd_entry;
|
||||
|
||||
public:
|
||||
static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
|
||||
|
||||
#endif // !LP64
|
||||
|
||||
private:
|
||||
static address _verify_mxcsr_entry;
|
||||
// shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
|
||||
@ -138,4 +215,6 @@
|
||||
static address _Pi4x4_addr() { return _Pi4x4_adr; }
|
||||
static address _ones_addr() { return _ones_adr; }
|
||||
|
||||
#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
|
||||
};
|
||||
|
||||
#endif // CPU_X86_VM_STUBROUTINES_X86_HPP
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPU_X86_VM_STUBROUTINES_X86_32_HPP
|
||||
#define CPU_X86_VM_STUBROUTINES_X86_32_HPP
|
||||
|
||||
// This file holds the platform specific parts of the StubRoutines
|
||||
// definition. See stubRoutines.hpp for a description on how to
|
||||
// extend it.
|
||||
|
||||
enum platform_dependent_constants {
|
||||
code_size1 = 20000, // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 33800 // simply increase if too small (assembler will crash if too small)
|
||||
};
|
||||
|
||||
class x86 {
|
||||
friend class StubGenerator;
|
||||
friend class VMStructs;
|
||||
|
||||
private:
|
||||
static address _verify_fpu_cntrl_wrd_entry;
|
||||
|
||||
public:
|
||||
static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
|
||||
|
||||
# include "stubRoutines_x86.hpp"
|
||||
|
||||
};
|
||||
|
||||
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
|
||||
|
||||
#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPU_X86_VM_STUBROUTINES_X86_64_HPP
|
||||
#define CPU_X86_VM_STUBROUTINES_X86_64_HPP
|
||||
|
||||
// This file holds the platform specific parts of the StubRoutines
|
||||
// definition. See stubRoutines.hpp for a description on how to
|
||||
// extend it.
|
||||
|
||||
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
|
||||
|
||||
enum platform_dependent_constants {
|
||||
code_size1 = 30000, // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 35000 // simply increase if too small (assembler will crash if too small)
|
||||
};
|
||||
|
||||
class x86 {
|
||||
friend class StubGenerator;
|
||||
|
||||
private:
|
||||
static address _get_previous_fp_entry;
|
||||
static address _get_previous_sp_entry;
|
||||
|
||||
static address _f2i_fixup;
|
||||
static address _f2l_fixup;
|
||||
static address _d2i_fixup;
|
||||
static address _d2l_fixup;
|
||||
|
||||
static address _float_sign_mask;
|
||||
static address _float_sign_flip;
|
||||
static address _double_sign_mask;
|
||||
static address _double_sign_flip;
|
||||
|
||||
public:
|
||||
|
||||
static address get_previous_fp_entry()
|
||||
{
|
||||
return _get_previous_fp_entry;
|
||||
}
|
||||
|
||||
static address get_previous_sp_entry()
|
||||
{
|
||||
return _get_previous_sp_entry;
|
||||
}
|
||||
|
||||
static address f2i_fixup()
|
||||
{
|
||||
return _f2i_fixup;
|
||||
}
|
||||
|
||||
static address f2l_fixup()
|
||||
{
|
||||
return _f2l_fixup;
|
||||
}
|
||||
|
||||
static address d2i_fixup()
|
||||
{
|
||||
return _d2i_fixup;
|
||||
}
|
||||
|
||||
static address d2l_fixup()
|
||||
{
|
||||
return _d2l_fixup;
|
||||
}
|
||||
|
||||
static address float_sign_mask()
|
||||
{
|
||||
return _float_sign_mask;
|
||||
}
|
||||
|
||||
static address float_sign_flip()
|
||||
{
|
||||
return _float_sign_flip;
|
||||
}
|
||||
|
||||
static address double_sign_mask()
|
||||
{
|
||||
return _double_sign_mask;
|
||||
}
|
||||
|
||||
static address double_sign_flip()
|
||||
{
|
||||
return _double_sign_flip;
|
||||
}
|
||||
|
||||
# include "stubRoutines_x86.hpp"
|
||||
|
||||
};
|
||||
|
||||
#endif // CPU_X86_VM_STUBROUTINES_X86_64_HPP
|
@ -2131,7 +2131,7 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load,
|
||||
return size+offset_size;
|
||||
}
|
||||
|
||||
static inline jfloat replicate4_imm(int con, int width) {
|
||||
static inline jint replicate4_imm(int con, int width) {
|
||||
// Load a constant of "width" (in bytes) and replicate it to fill 32bit.
|
||||
assert(width == 1 || width == 2, "only byte or short types here");
|
||||
int bit_width = width * 8;
|
||||
@ -2141,11 +2141,10 @@ static inline jfloat replicate4_imm(int con, int width) {
|
||||
val |= (val << bit_width);
|
||||
bit_width <<= 1;
|
||||
}
|
||||
jfloat fval = *((jfloat*) &val); // coerce to float type
|
||||
return fval;
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline jdouble replicate8_imm(int con, int width) {
|
||||
static inline jlong replicate8_imm(int con, int width) {
|
||||
// Load a constant of "width" (in bytes) and replicate it to fill 64bit.
|
||||
assert(width == 1 || width == 2 || width == 4, "only byte, short or int types here");
|
||||
int bit_width = width * 8;
|
||||
@ -2155,8 +2154,7 @@ static inline jdouble replicate8_imm(int con, int width) {
|
||||
val |= (val << bit_width);
|
||||
bit_width <<= 1;
|
||||
}
|
||||
jdouble dval = *((jdouble*) &val); // coerce to double type
|
||||
return dval;
|
||||
return val;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -165,12 +165,8 @@ class Bytes: AllStatic {
|
||||
#ifdef VM_LITTLE_ENDIAN
|
||||
// The following header contains the implementations of swap_u2,
|
||||
// swap_u4, and swap_u8
|
||||
#ifdef TARGET_OS_ARCH_linux_zero
|
||||
# include "bytes_linux_zero.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_bsd_zero
|
||||
# include "bytes_bsd_zero.inline.hpp"
|
||||
#endif
|
||||
|
||||
#include OS_CPU_HEADER_INLINE(bytes)
|
||||
|
||||
#endif // VM_LITTLE_ENDIAN
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -22,12 +22,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "mutex_bsd.inline.hpp"
|
||||
#include "runtime/interfaceSupport.hpp"
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#ifndef CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP
|
||||
#define CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP
|
||||
|
||||
// put OS-includes here
|
||||
# include <signal.h>
|
||||
// Needed for includes in shared files.
|
||||
|
||||
#endif // CPU_ZERO_VM_MACROASSEMBLER_ZERO_HPP
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -22,12 +22,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "mutex_linux.inline.hpp"
|
||||
#include "runtime/interfaceSupport.hpp"
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#ifndef CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP
|
||||
#define CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP
|
||||
|
||||
// put OS-includes here
|
||||
# include <signal.h>
|
||||
// Needed for includes in shared files.
|
||||
|
||||
#endif // CPU_ZERO_VM_MACROASSEMBLER_ZERO_INLINE_HPP
|
@ -1,38 +0,0 @@
|
||||
The HotSpot Serviceability Agent (SA) is a debugger for hotspot core
|
||||
dumps and hung processes. There is a read-only JDI (Java Debugger
|
||||
Interface) implementation on top of SA. This is part of JDK product and
|
||||
the classes are in $JDK/tools/sa-jdi.jar.
|
||||
|
||||
In addition, there are few serviceability tools in $JDK/bin, namely,
|
||||
jstack (java stack trace tool), jmap (heap tool), jinfo (Java config
|
||||
tool) and jsadebugd. The classes for these are also in sa-jdi.jar
|
||||
file. sa-jdi.jar file is built along with hotspot (libjvm.so) on Solaris
|
||||
and Linux platforms. On Windows platform, SA-JDI is not included and
|
||||
serviceability tools do not use SA.
|
||||
|
||||
Apart from these, HotSpot SA consists of a number of tools that are
|
||||
*not* included in JDK product bits.
|
||||
|
||||
The sources and makefile for all-of-SA (including non-productized stuff)
|
||||
are under $HOTSPOT_WS/agent directory. The makefile $HOTSPOT/agent/make
|
||||
directory and shell scripts (and batch files) are used to build and run
|
||||
SA non-product tools. There is also documentation of SA under
|
||||
$HOTSPOT/agent/doc directory.
|
||||
|
||||
To build complete SA, you need to have Rhino Mozilla jar (js.jar)
|
||||
version 1.5R5 under $HOTSPOT/agent/src/share/lib directory. Rhino is
|
||||
JavaScript interpreter written in Java. Rhino is used to implement SA
|
||||
features such as
|
||||
|
||||
* SA command line debugger's JavaScript interface
|
||||
- refer to $HOTSPOT/agent/doc/clhsdb.html
|
||||
- refer to $HOTSPOT/agent/doc/jsdb.html
|
||||
* SA simple object query language (SOQL)
|
||||
- language to query Java heap.
|
||||
|
||||
Rhino's "js.jar" is not included in hotspot source bundles. You need to
|
||||
download it from http://www.mozilla.org/rhino/download.html.
|
||||
|
||||
Without js.jar, $HOTSPOT/agent/make/Makefile will fail to build. But,
|
||||
note that sa-jdi.jar containing the productized portions of SA will
|
||||
still be built when you build hotspot JVM.
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2016, 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
|
||||
@ -28,12 +28,8 @@ module jdk.hotspot.agent {
|
||||
requires java.desktop;
|
||||
requires java.rmi;
|
||||
requires java.scripting;
|
||||
requires jdk.jdi;
|
||||
|
||||
// RMI needs to serialize types in this package
|
||||
exports sun.jvm.hotspot.debugger.remote to java.rmi;
|
||||
provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SACoreAttachingConnector;
|
||||
provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SADebugServerAttachingConnector;
|
||||
provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SAPIDAttachingConnector;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
@ -36,6 +36,7 @@ public class SALauncher {
|
||||
|
||||
private static boolean launcherHelp() {
|
||||
System.out.println(" clhsdb \tcommand line debugger");
|
||||
System.out.println(" debugd \tdebug server");
|
||||
System.out.println(" hsdb \tui debugger");
|
||||
System.out.println(" jstack --help\tto get more information");
|
||||
System.out.println(" jmap --help\tto get more information");
|
||||
@ -54,6 +55,21 @@ public class SALauncher {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean debugdHelp() {
|
||||
// [options] <pid> [server-id]
|
||||
// [options] <executable> <core> [server-id]
|
||||
java.io.PrintStream out = System.out;
|
||||
out.print(" [option] <pid> [server-id]");
|
||||
out.println("\t\t(to connect to a live java process)");
|
||||
out.print(" or [option] <executable> <core> [server-id]");
|
||||
out.println("\t\t(to connect to a core file produced by <executable>)");
|
||||
out.print("\t\tserver-id is an optional unique id for this debug server, needed ");
|
||||
out.println("\t\tif multiple debug servers are run on the same machine");
|
||||
out.println("where option includes:");
|
||||
out.println(" -h | -help\tto print this help message");
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean jinfoHelp() {
|
||||
// --flags -> -flags
|
||||
// --sysprops -> -sysprops
|
||||
@ -106,6 +122,9 @@ public class SALauncher {
|
||||
if (toolName.equals("jsnap")) {
|
||||
return jsnapHelp();
|
||||
}
|
||||
if (toolName.equals("debugd")) {
|
||||
return debugdHelp();
|
||||
}
|
||||
if (toolName.equals("hsdb") || toolName.equals("clhsdb")) {
|
||||
return commonHelp();
|
||||
}
|
||||
@ -377,13 +396,28 @@ public class SALauncher {
|
||||
JSnap.main(newArgs.toArray(new String[newArgs.size()]));
|
||||
}
|
||||
|
||||
private static void runDEBUGD(String[] oldArgs) {
|
||||
if ((oldArgs.length < 1) || (oldArgs.length > 3)) {
|
||||
debugdHelp();
|
||||
}
|
||||
|
||||
// By default SA agent classes prefer Windows process debugger
|
||||
// to windbg debugger. SA expects special properties to be set
|
||||
// to choose other debuggers. We will set those here before
|
||||
// attaching to SA agent.
|
||||
System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true");
|
||||
|
||||
// delegate to the actual SA debug server.
|
||||
sun.jvm.hotspot.DebugServer.main(oldArgs);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Provide a help
|
||||
if (args.length == 0) {
|
||||
launcherHelp();
|
||||
return;
|
||||
}
|
||||
// No arguments imply help for jstack, jmap, jinfo but launch clhsdb and hsdb
|
||||
// No arguments imply help for debugd, jstack, jmap, jinfo but launch clhsdb and hsdb
|
||||
if (args.length == 1 && !args[0].equals("clhsdb") && !args[0].equals("hsdb")) {
|
||||
toolHelp(args[0]);
|
||||
return;
|
||||
@ -431,6 +465,11 @@ public class SALauncher {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equals("debugd")) {
|
||||
runDEBUGD(oldArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new SAGetoptException("Unknown tool: " + args[0]);
|
||||
} catch (SAGetoptException e) {
|
||||
System.err.println(e.getMessage());
|
||||
|
@ -1,171 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import sun.jvm.hotspot.oops.Instance;
|
||||
import sun.jvm.hotspot.oops.Array;
|
||||
import sun.jvm.hotspot.runtime.BasicType;
|
||||
import sun.jvm.hotspot.utilities.Assert;
|
||||
|
||||
public class ArrayReferenceImpl extends ObjectReferenceImpl
|
||||
implements ArrayReference
|
||||
{
|
||||
private int length;
|
||||
ArrayReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Array aRef) {
|
||||
super(aVm, aRef);
|
||||
length = (int) aRef.getLength();
|
||||
}
|
||||
|
||||
ArrayTypeImpl arrayType() {
|
||||
return (ArrayTypeImpl)type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array length.
|
||||
*/
|
||||
public int length() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public Value getValue(int index) {
|
||||
List list = getValues(index, 1);
|
||||
return (Value)list.get(0);
|
||||
}
|
||||
|
||||
public List getValues() {
|
||||
return getValues(0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the range to set/get is valid.
|
||||
* length of -1 (meaning rest of array) has been converted
|
||||
* before entry.
|
||||
*/
|
||||
private void validateArrayAccess(int index, int len) {
|
||||
// because length can be computed from index,
|
||||
// index must be tested first for correct error message
|
||||
if ((index < 0) || (index > length())) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
"Invalid array index: " + index);
|
||||
}
|
||||
if (len < 0) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
"Invalid array range length: " + len);
|
||||
}
|
||||
if (index + len > length()) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
"Invalid array range: " +
|
||||
index + " to " + (index + len - 1));
|
||||
}
|
||||
}
|
||||
|
||||
public List getValues(int index, int len) {
|
||||
if (len == -1) { // -1 means the rest of the array
|
||||
len = length() - index;
|
||||
}
|
||||
validateArrayAccess(index, len);
|
||||
List vals = new ArrayList();
|
||||
if (len == 0) {
|
||||
return vals;
|
||||
}
|
||||
|
||||
sun.jvm.hotspot.oops.TypeArray typeArray = null;
|
||||
sun.jvm.hotspot.oops.ObjArray objArray = null;
|
||||
if (ref() instanceof sun.jvm.hotspot.oops.TypeArray) {
|
||||
typeArray = (sun.jvm.hotspot.oops.TypeArray)ref();
|
||||
} else if (ref() instanceof sun.jvm.hotspot.oops.ObjArray) {
|
||||
objArray = (sun.jvm.hotspot.oops.ObjArray)ref();
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
}
|
||||
|
||||
char c = arrayType().componentSignature().charAt(0);
|
||||
BasicType variableType = BasicType.charToBasicType(c);
|
||||
|
||||
final int limit = index + len;
|
||||
for (int ii = index; ii < limit; ii++) {
|
||||
ValueImpl valueImpl;
|
||||
if (variableType == BasicType.T_BOOLEAN) {
|
||||
valueImpl = (BooleanValueImpl) vm.mirrorOf(typeArray.getBooleanAt(ii));
|
||||
} else if (variableType == BasicType.T_CHAR) {
|
||||
valueImpl = (CharValueImpl) vm.mirrorOf(typeArray.getCharAt(ii));
|
||||
} else if (variableType == BasicType.T_FLOAT) {
|
||||
valueImpl = (FloatValueImpl) vm.mirrorOf(typeArray.getFloatAt(ii));
|
||||
} else if (variableType == BasicType.T_DOUBLE) {
|
||||
valueImpl = (DoubleValueImpl) vm.mirrorOf(typeArray.getDoubleAt(ii));
|
||||
} else if (variableType == BasicType.T_BYTE) {
|
||||
valueImpl = (ByteValueImpl) vm.mirrorOf(typeArray.getByteAt(ii));
|
||||
} else if (variableType == BasicType.T_SHORT) {
|
||||
valueImpl = (ShortValueImpl) vm.mirrorOf(typeArray.getShortAt(ii));
|
||||
} else if (variableType == BasicType.T_INT) {
|
||||
valueImpl = (IntegerValueImpl) vm.mirrorOf(typeArray.getIntAt(ii));
|
||||
} else if (variableType == BasicType.T_LONG) {
|
||||
valueImpl = (LongValueImpl) vm.mirrorOf(typeArray.getLongAt(ii));
|
||||
} else if (variableType == BasicType.T_OBJECT) {
|
||||
// we may have an [Ljava/lang/Object; - i.e., Object[] with the
|
||||
// elements themselves may be arrays because every array is an Object.
|
||||
valueImpl = (ObjectReferenceImpl) vm.objectMirror(objArray.getObjAt(ii));
|
||||
} else if (variableType == BasicType.T_ARRAY) {
|
||||
valueImpl = (ArrayReferenceImpl) vm.arrayMirror((Array) objArray.getObjAt(ii));
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
}
|
||||
vals.add (valueImpl);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
public void setValue(int index, Value value)
|
||||
throws InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
vm.throwNotReadOnlyException("ArrayReference.setValue(...)");
|
||||
}
|
||||
|
||||
public void setValues(List values)
|
||||
throws InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
setValues(0, values, 0, -1);
|
||||
}
|
||||
|
||||
public void setValues(int index, List values,
|
||||
int srcIndex, int length)
|
||||
throws InvalidTypeException,
|
||||
ClassNotLoadedException {
|
||||
|
||||
vm.throwNotReadOnlyException("ArrayReference.setValue(...)");
|
||||
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "instance of " + arrayType().componentTypeName() +
|
||||
"[" + length() + "] (id=" + uniqueID() + ")";
|
||||
}
|
||||
}
|
@ -1,222 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import sun.jvm.hotspot.oops.ArrayKlass;
|
||||
import sun.jvm.hotspot.oops.Instance;
|
||||
import sun.jvm.hotspot.oops.InstanceKlass;
|
||||
import sun.jvm.hotspot.oops.Klass;
|
||||
import sun.jvm.hotspot.oops.ObjArrayKlass;
|
||||
import sun.jvm.hotspot.oops.Symbol;
|
||||
import sun.jvm.hotspot.oops.TypeArrayKlass;
|
||||
|
||||
import com.sun.jdi.ArrayReference;
|
||||
import com.sun.jdi.ArrayType;
|
||||
import com.sun.jdi.ClassLoaderReference;
|
||||
import com.sun.jdi.ClassNotLoadedException;
|
||||
import com.sun.jdi.InterfaceType;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.PrimitiveType;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.Type;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
|
||||
public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType {
|
||||
protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) {
|
||||
super(aVm, aRef);
|
||||
}
|
||||
|
||||
public ArrayReference newInstance(int length) {
|
||||
vm.throwNotReadOnlyException("ArrayType.newInstance(int)");
|
||||
return null;
|
||||
}
|
||||
|
||||
public String componentSignature() {
|
||||
return signature().substring(1); // Just skip the leading '['
|
||||
}
|
||||
|
||||
public String componentTypeName() {
|
||||
JNITypeParser parser = new JNITypeParser(componentSignature());
|
||||
return parser.typeName();
|
||||
}
|
||||
|
||||
public ClassLoaderReference classLoader() {
|
||||
if (ref() instanceof TypeArrayKlass) {
|
||||
// primitive array klasses are loaded by bootstrap loader
|
||||
return null;
|
||||
} else {
|
||||
Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
|
||||
if (bottomKlass instanceof TypeArrayKlass) {
|
||||
// multidimensional primitive array klasses are loaded by bootstrap loader
|
||||
return null;
|
||||
} else {
|
||||
// class loader of any other obj array klass is same as the loader
|
||||
// that loaded the bottom InstanceKlass
|
||||
Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
|
||||
return vm.classLoaderMirror(xx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> handledInterfaces) {
|
||||
// arrays don't have methods
|
||||
}
|
||||
|
||||
List getAllMethods() {
|
||||
// arrays don't have methods
|
||||
// JLS says arrays have methods of java.lang.Object. But
|
||||
// JVMDI-JDI returns zero size list. We do the same here
|
||||
// for consistency.
|
||||
return new ArrayList(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the type object, if any, of a component type of this array.
|
||||
* The component type does not have to be immediate; e.g. this method
|
||||
* can be used to find the component Foo of Foo[][].
|
||||
*/
|
||||
public Type componentType() throws ClassNotLoadedException {
|
||||
ArrayKlass k = (ArrayKlass) ref();
|
||||
if (k instanceof ObjArrayKlass) {
|
||||
Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
|
||||
if (elementKlass == null) {
|
||||
throw new ClassNotLoadedException(componentSignature());
|
||||
} else {
|
||||
return vm.referenceType(elementKlass);
|
||||
}
|
||||
} else {
|
||||
// It's a primitive type
|
||||
return vm.primitiveTypeMirror(signature().charAt(1));
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isComponentAssignable(Type destination, Type source) {
|
||||
if (source instanceof PrimitiveType) {
|
||||
// Assignment of primitive arrays requires identical
|
||||
// component types.
|
||||
return source.equals(destination);
|
||||
} else {
|
||||
if (destination instanceof PrimitiveType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ReferenceTypeImpl refSource = (ReferenceTypeImpl)source;
|
||||
ReferenceTypeImpl refDestination = (ReferenceTypeImpl)destination;
|
||||
// Assignment of object arrays requires availability
|
||||
// of widening conversion of component types
|
||||
return refSource.isAssignableTo(refDestination);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return true if an instance of the given reference type
|
||||
* can be assigned to a variable of this type
|
||||
*/
|
||||
boolean isAssignableTo(ReferenceType destType) {
|
||||
if (destType instanceof ArrayType) {
|
||||
try {
|
||||
Type destComponentType = ((ArrayType)destType).componentType();
|
||||
return isComponentAssignable(destComponentType, componentType());
|
||||
} catch (ClassNotLoadedException e) {
|
||||
// One or both component types has not yet been
|
||||
// loaded => can't assign
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Symbol typeName = ((ReferenceTypeImpl)destType).typeNameAsSymbol();
|
||||
if (destType instanceof InterfaceType) {
|
||||
// Every array type implements java.io.Serializable and
|
||||
// java.lang.Cloneable. fixme in JVMDI-JDI, includes only
|
||||
// Cloneable but not Serializable.
|
||||
return typeName.equals(vm.javaLangCloneable()) ||
|
||||
typeName.equals(vm.javaIoSerializable());
|
||||
} else {
|
||||
// Only valid ClassType assignee is Object
|
||||
return typeName.equals(vm.javaLangObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List inheritedTypes() {
|
||||
// arrays are derived from java.lang.Object and
|
||||
// B[] is derived from A[] if B is derived from A.
|
||||
// But JVMDI-JDI returns zero sized list and we do the
|
||||
// same for consistency.
|
||||
return new ArrayList(0);
|
||||
}
|
||||
|
||||
int getModifiers() {
|
||||
/*
|
||||
* For object arrays, the return values for Interface
|
||||
* Accessible.isPrivate(), Accessible.isProtected(),
|
||||
* etc... are the same as would be returned for the
|
||||
* component type. Fetch the modifier bits from the
|
||||
* component type and use those.
|
||||
*
|
||||
* For primitive arrays, the modifiers are always
|
||||
* VMModifiers.FINAL | VMModifiers.PUBLIC
|
||||
*
|
||||
* Reference com.sun.jdi.Accessible.java.
|
||||
*/
|
||||
try {
|
||||
Type t = componentType();
|
||||
if (t instanceof PrimitiveType) {
|
||||
return VMModifiers.FINAL | VMModifiers.PUBLIC;
|
||||
} else {
|
||||
ReferenceType rt = (ReferenceType)t;
|
||||
return rt.modifiers();
|
||||
}
|
||||
} catch (ClassNotLoadedException cnle) {
|
||||
cnle.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "array class " + name() + " (" + loaderString() + ")";
|
||||
}
|
||||
|
||||
/*
|
||||
* Save a pointless trip over the wire for these methods
|
||||
* which have undefined results for arrays.
|
||||
*/
|
||||
public boolean isPrepared() { return true; }
|
||||
public boolean isVerified() { return true; }
|
||||
public boolean isInitialized() { return true; }
|
||||
public boolean failedToInitialize() { return false; }
|
||||
public boolean isAbstract() { return false; }
|
||||
|
||||
/*
|
||||
* Defined always to be true for arrays
|
||||
*/
|
||||
public boolean isFinal() { return true; }
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
class BaseLineInfo implements LineInfo {
|
||||
private final int lineNumber;
|
||||
private final ReferenceTypeImpl declaringType;
|
||||
|
||||
BaseLineInfo(int lineNumber,
|
||||
ReferenceTypeImpl declaringType) {
|
||||
this.lineNumber = lineNumber;
|
||||
this.declaringType = declaringType;
|
||||
}
|
||||
|
||||
public String liStratum() {
|
||||
return SDE.BASE_STRATUM_NAME;
|
||||
}
|
||||
|
||||
public int liLineNumber() {
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
public String liSourceName()
|
||||
throws AbsentInformationException {
|
||||
return declaringType.baseSourceName();
|
||||
}
|
||||
|
||||
public String liSourcePath()
|
||||
throws AbsentInformationException {
|
||||
return declaringType.baseSourcePath();
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class BooleanTypeImpl extends PrimitiveTypeImpl implements BooleanType {
|
||||
BooleanTypeImpl(VirtualMachine vm) {
|
||||
super(vm);
|
||||
}
|
||||
|
||||
public String signature() {
|
||||
return "Z";
|
||||
}
|
||||
|
||||
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
|
||||
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedBooleanValue());
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class BooleanValueImpl extends PrimitiveValueImpl
|
||||
implements BooleanValue {
|
||||
private boolean value;
|
||||
|
||||
BooleanValueImpl(VirtualMachine aVm,boolean aValue) {
|
||||
super(aVm);
|
||||
|
||||
value = aValue;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof BooleanValue)) {
|
||||
return (value == ((BooleanValue)obj).value())
|
||||
&& super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
/*
|
||||
* TO DO: Better hash code
|
||||
*/
|
||||
return intValue();
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return vm.theBooleanType();
|
||||
}
|
||||
|
||||
public boolean value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return(byte)((value)?1:0);
|
||||
}
|
||||
|
||||
public char charValue() {
|
||||
return(char)((value)?1:0);
|
||||
}
|
||||
|
||||
public short shortValue() {
|
||||
return(short)((value)?1:0);
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return(int)((value)?1:0);
|
||||
}
|
||||
|
||||
public long longValue() {
|
||||
return(long)((value)?1:0);
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return(float)((value)?1.0:0.0);
|
||||
}
|
||||
|
||||
public double doubleValue() {
|
||||
return(double)((value)?1.0:0.0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + value;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class ByteTypeImpl extends PrimitiveTypeImpl implements ByteType {
|
||||
ByteTypeImpl(VirtualMachine vm) {
|
||||
super(vm);
|
||||
}
|
||||
|
||||
|
||||
public String signature() {
|
||||
return "B";
|
||||
}
|
||||
|
||||
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
|
||||
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedByteValue());
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class ByteValueImpl extends PrimitiveValueImpl
|
||||
implements ByteValue {
|
||||
private byte value;
|
||||
|
||||
ByteValueImpl(VirtualMachine aVm,byte aValue) {
|
||||
super(aVm);
|
||||
|
||||
value = aValue;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof ByteValue)) {
|
||||
return (value == ((ByteValue)obj).value())
|
||||
&& super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
/*
|
||||
* TO DO: Better hash code
|
||||
*/
|
||||
return intValue();
|
||||
}
|
||||
|
||||
public int compareTo(ByteValue byteVal) {
|
||||
return value() - byteVal.value();
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return vm.theByteType();
|
||||
}
|
||||
|
||||
public byte value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
return(value == 0)?false:true;
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public char charValue() {
|
||||
return(char)value;
|
||||
}
|
||||
|
||||
public short shortValue() {
|
||||
return(short)value;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return(int)value;
|
||||
}
|
||||
|
||||
public long longValue() {
|
||||
return(long)value;
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return(float)value;
|
||||
}
|
||||
|
||||
public double doubleValue() {
|
||||
return(double)value;
|
||||
}
|
||||
|
||||
char checkedCharValue() throws InvalidTypeException {
|
||||
if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to char");
|
||||
} else {
|
||||
return super.checkedCharValue();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + value;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class CharTypeImpl extends PrimitiveTypeImpl implements CharType {
|
||||
CharTypeImpl(VirtualMachine vm) {
|
||||
super(vm);
|
||||
}
|
||||
|
||||
|
||||
public String signature() {
|
||||
return "C";
|
||||
}
|
||||
|
||||
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
|
||||
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedCharValue());
|
||||
}
|
||||
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class CharValueImpl extends PrimitiveValueImpl
|
||||
implements CharValue {
|
||||
private char value;
|
||||
|
||||
CharValueImpl(VirtualMachine aVm,char aValue) {
|
||||
super(aVm);
|
||||
|
||||
value = aValue;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof CharValue)) {
|
||||
return (value == ((CharValue)obj).value()) &&
|
||||
super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
/*
|
||||
* TO DO: Better hash code
|
||||
*/
|
||||
return intValue();
|
||||
}
|
||||
|
||||
public int compareTo(CharValue charVal) {
|
||||
return value() - charVal.value();
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return vm.theCharType();
|
||||
}
|
||||
|
||||
public char value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
return(value == 0)?false:true;
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return(byte)value;
|
||||
}
|
||||
|
||||
public char charValue() {
|
||||
return(char)value;
|
||||
}
|
||||
|
||||
public short shortValue() {
|
||||
return(short)value;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return(int)value;
|
||||
}
|
||||
|
||||
public long longValue() {
|
||||
return(long)value;
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return(float)value;
|
||||
}
|
||||
|
||||
public double doubleValue() {
|
||||
return(double)value;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + value;
|
||||
}
|
||||
|
||||
byte checkedByteValue() throws InvalidTypeException {
|
||||
// Note: since char is unsigned, don't check against MIN_VALUE
|
||||
if (value > Byte.MAX_VALUE) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to byte");
|
||||
} else {
|
||||
return super.checkedByteValue();
|
||||
}
|
||||
}
|
||||
|
||||
short checkedShortValue() throws InvalidTypeException {
|
||||
// Note: since char is unsigned, don't check against MIN_VALUE
|
||||
if (value > Short.MAX_VALUE) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to short");
|
||||
} else {
|
||||
return super.checkedShortValue();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import sun.jvm.hotspot.oops.Oop;
|
||||
import sun.jvm.hotspot.oops.Instance;
|
||||
import sun.jvm.hotspot.oops.Klass;
|
||||
import sun.jvm.hotspot.memory.SystemDictionary;
|
||||
import sun.jvm.hotspot.memory.Universe;
|
||||
import sun.jvm.hotspot.runtime.VM;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.*;
|
||||
|
||||
public class ClassLoaderReferenceImpl
|
||||
extends ObjectReferenceImpl
|
||||
implements ClassLoaderReference
|
||||
{
|
||||
// because we work on process snapshot or core we can
|
||||
// cache visibleClasses & definedClasses always (i.e., no suspension)
|
||||
private List visibleClassesCache;
|
||||
private List definedClassesCache;
|
||||
|
||||
ClassLoaderReferenceImpl(VirtualMachine aVm, Instance oRef) {
|
||||
super(aVm, oRef);
|
||||
}
|
||||
|
||||
protected String description() {
|
||||
return "ClassLoaderReference " + uniqueID();
|
||||
}
|
||||
|
||||
public List definedClasses() {
|
||||
if (definedClassesCache == null) {
|
||||
definedClassesCache = new ArrayList();
|
||||
Iterator iter = vm.allClasses().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ReferenceType type = (ReferenceType)iter.next();
|
||||
if (equals(type.classLoader())) { /* thanks OTI */
|
||||
definedClassesCache.add(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
return definedClassesCache;
|
||||
}
|
||||
|
||||
private SystemDictionary getSystemDictionary() {
|
||||
return vm.saSystemDictionary();
|
||||
}
|
||||
|
||||
private Universe getUniverse() {
|
||||
return vm.saUniverse();
|
||||
}
|
||||
|
||||
public List visibleClasses() {
|
||||
if (visibleClassesCache != null)
|
||||
return visibleClassesCache;
|
||||
|
||||
visibleClassesCache = new ArrayList();
|
||||
|
||||
// refer to getClassLoaderClasses in jvmtiGetLoadedClasses.cpp
|
||||
// a. SystemDictionary::classes_do doesn't include arrays of primitive types (any dimensions)
|
||||
SystemDictionary sysDict = getSystemDictionary();
|
||||
sysDict.classesDo(
|
||||
new SystemDictionary.ClassAndLoaderVisitor() {
|
||||
public void visit(Klass k, Oop loader) {
|
||||
if (ref().equals(loader)) {
|
||||
for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
|
||||
visibleClassesCache.add(vm.referenceType(l));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// b. multi dimensional arrays of primitive types
|
||||
sysDict.primArrayClassesDo(
|
||||
new SystemDictionary.ClassAndLoaderVisitor() {
|
||||
public void visit(Klass k, Oop loader) {
|
||||
if (ref().equals(loader)) {
|
||||
visibleClassesCache.add(vm.referenceType(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// c. single dimensional primitive array klasses from Universe
|
||||
// these are not added to SystemDictionary
|
||||
getUniverse().basicTypeClassesDo(
|
||||
new SystemDictionary.ClassVisitor() {
|
||||
public void visit(Klass k) {
|
||||
visibleClassesCache.add(vm.referenceType(k));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return visibleClassesCache;
|
||||
}
|
||||
|
||||
Type findType(String signature) throws ClassNotLoadedException {
|
||||
List types = visibleClasses();
|
||||
Iterator iter = types.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ReferenceType type = (ReferenceType)iter.next();
|
||||
if (type.signature().equals(signature)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
JNITypeParser parser = new JNITypeParser(signature);
|
||||
throw new ClassNotLoadedException(parser.typeName(),
|
||||
"Class " + parser.typeName() + " not loaded");
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import sun.jvm.hotspot.oops.Instance;
|
||||
import sun.jvm.hotspot.oops.Klass;
|
||||
import sun.jvm.hotspot.oops.java_lang_Class;
|
||||
|
||||
public class ClassObjectReferenceImpl extends ObjectReferenceImpl
|
||||
implements ClassObjectReference {
|
||||
private ReferenceType reflectedType;
|
||||
|
||||
ClassObjectReferenceImpl(VirtualMachine vm, Instance oRef) {
|
||||
super(vm, oRef);
|
||||
}
|
||||
|
||||
public ReferenceType reflectedType() {
|
||||
if (reflectedType == null) {
|
||||
Klass k = java_lang_Class.asKlass(ref());
|
||||
reflectedType = vm.referenceType(k);
|
||||
}
|
||||
return reflectedType;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "instance of " + referenceType().name() +
|
||||
"(reflected class=" + reflectedType().name() + ", " + "id=" +
|
||||
uniqueID() + ")";
|
||||
}
|
||||
}
|
@ -1,263 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import sun.jvm.hotspot.oops.InstanceKlass;
|
||||
|
||||
import com.sun.jdi.ClassNotLoadedException;
|
||||
import com.sun.jdi.ClassType;
|
||||
import com.sun.jdi.Field;
|
||||
import com.sun.jdi.IncompatibleThreadStateException;
|
||||
import com.sun.jdi.InterfaceType;
|
||||
import com.sun.jdi.InvalidTypeException;
|
||||
import com.sun.jdi.InvocationException;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
import com.sun.jdi.Value;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
|
||||
public class ClassTypeImpl extends ReferenceTypeImpl
|
||||
implements ClassType
|
||||
{
|
||||
private SoftReference interfacesCache = null;
|
||||
private SoftReference allInterfacesCache = null;
|
||||
private SoftReference subclassesCache = null;
|
||||
|
||||
protected ClassTypeImpl(VirtualMachine aVm, InstanceKlass aRef) {
|
||||
super(aVm, aRef);
|
||||
}
|
||||
|
||||
public ClassType superclass() {
|
||||
InstanceKlass kk = (InstanceKlass)ref().getSuper();
|
||||
if (kk == null) {
|
||||
return null;
|
||||
}
|
||||
return (ClassType) vm.referenceType(kk);
|
||||
}
|
||||
|
||||
public List interfaces() {
|
||||
List interfaces = (interfacesCache != null)? (List) interfacesCache.get() : null;
|
||||
if (interfaces == null) {
|
||||
checkPrepared();
|
||||
interfaces = Collections.unmodifiableList(getInterfaces());
|
||||
interfacesCache = new SoftReference(interfaces);
|
||||
}
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
void addInterfaces(List list) {
|
||||
List immediate = interfaces();
|
||||
|
||||
HashSet hashList = new HashSet(list);
|
||||
hashList.addAll(immediate);
|
||||
list.clear();
|
||||
list.addAll(hashList);
|
||||
|
||||
Iterator iter = immediate.iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
|
||||
interfaze.addSuperinterfaces(list);
|
||||
}
|
||||
|
||||
ClassTypeImpl superclass = (ClassTypeImpl)superclass();
|
||||
if (superclass != null) {
|
||||
superclass.addInterfaces(list);
|
||||
}
|
||||
}
|
||||
|
||||
public List allInterfaces() {
|
||||
List allinterfaces = (allInterfacesCache != null)? (List) allInterfacesCache.get() : null;
|
||||
if (allinterfaces == null) {
|
||||
checkPrepared();
|
||||
allinterfaces = new ArrayList();
|
||||
addInterfaces(allinterfaces);
|
||||
allinterfaces = Collections.unmodifiableList(allinterfaces);
|
||||
allInterfacesCache = new SoftReference(allinterfaces);
|
||||
}
|
||||
return allinterfaces;
|
||||
}
|
||||
|
||||
public List subclasses() {
|
||||
List subclasses = (subclassesCache != null)? (List) subclassesCache.get() : null;
|
||||
if (subclasses == null) {
|
||||
List all = vm.allClasses();
|
||||
subclasses = new ArrayList(0);
|
||||
Iterator iter = all.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ReferenceType refType = (ReferenceType)iter.next();
|
||||
if (refType instanceof ClassType) {
|
||||
ClassType clazz = (ClassType)refType;
|
||||
ClassType superclass = clazz.superclass();
|
||||
if ((superclass != null) && superclass.equals(this)) {
|
||||
subclasses.add(refType);
|
||||
}
|
||||
}
|
||||
}
|
||||
subclasses = Collections.unmodifiableList(subclasses);
|
||||
subclassesCache = new SoftReference(subclasses);
|
||||
}
|
||||
return subclasses;
|
||||
}
|
||||
|
||||
public Method concreteMethodByName(String name, String signature) {
|
||||
checkPrepared();
|
||||
List methods = visibleMethods();
|
||||
Method method = null;
|
||||
Iterator iter = methods.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Method candidate = (Method)iter.next();
|
||||
if (candidate.name().equals(name) &&
|
||||
candidate.signature().equals(signature) &&
|
||||
!candidate.isAbstract()) {
|
||||
|
||||
method = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
List getAllMethods() {
|
||||
ArrayList list = new ArrayList(methods());
|
||||
ClassType clazz = superclass();
|
||||
while (clazz != null) {
|
||||
list.addAll(clazz.methods());
|
||||
clazz = clazz.superclass();
|
||||
}
|
||||
/*
|
||||
* Avoid duplicate checking on each method by iterating through
|
||||
* duplicate-free allInterfaces() rather than recursing
|
||||
*/
|
||||
Iterator iter = allInterfaces().iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceType interfaze = (InterfaceType)iter.next();
|
||||
list.addAll(interfaze.methods());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
List inheritedTypes() {
|
||||
List inherited = new ArrayList(interfaces());
|
||||
if (superclass() != null) {
|
||||
inherited.add(0, superclass()); /* insert at front */
|
||||
}
|
||||
return inherited;
|
||||
}
|
||||
|
||||
public boolean isEnum() {
|
||||
ClassTypeImpl superclass = (ClassTypeImpl) superclass();
|
||||
if (superclass != null) {
|
||||
return superclass.typeNameAsSymbol().equals(vm.javaLangEnum());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(Field field, Value value)
|
||||
throws InvalidTypeException, ClassNotLoadedException {
|
||||
vm.throwNotReadOnlyException("ClassType.setValue(...)");
|
||||
}
|
||||
|
||||
|
||||
public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
|
||||
List arguments, int options)
|
||||
throws InvalidTypeException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvocationException {
|
||||
vm.throwNotReadOnlyException("ClassType.invokeMethod(...)");
|
||||
return null;
|
||||
}
|
||||
|
||||
public ObjectReference newInstance(ThreadReference threadIntf,
|
||||
Method methodIntf,
|
||||
List arguments, int options)
|
||||
throws InvalidTypeException,
|
||||
ClassNotLoadedException,
|
||||
IncompatibleThreadStateException,
|
||||
InvocationException {
|
||||
vm.throwNotReadOnlyException("ClassType.newInstance(...)");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
|
||||
/*
|
||||
* Add methods from
|
||||
* parent types first, so that the methods in this class will
|
||||
* overwrite them in the hash table
|
||||
*/
|
||||
|
||||
Iterator<InterfaceType> iter = interfaces().iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
|
||||
if (!seenInterfaces.contains(interfaze)) {
|
||||
interfaze.addVisibleMethods(methodMap, seenInterfaces);
|
||||
seenInterfaces.add(interfaze);
|
||||
}
|
||||
}
|
||||
|
||||
ClassTypeImpl clazz = (ClassTypeImpl)superclass();
|
||||
if (clazz != null) {
|
||||
clazz.addVisibleMethods(methodMap, seenInterfaces);
|
||||
}
|
||||
|
||||
addToMethodMap(methodMap, methods());
|
||||
}
|
||||
|
||||
boolean isAssignableTo(ReferenceType type) {
|
||||
ClassTypeImpl superclazz = (ClassTypeImpl)superclass();
|
||||
if (this.equals(type)) {
|
||||
return true;
|
||||
} else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
|
||||
return true;
|
||||
} else {
|
||||
List interfaces = interfaces();
|
||||
Iterator iter = interfaces.iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
|
||||
if (interfaze.isAssignableTo(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "class " + name() + "(" + loaderString() + ")";
|
||||
}
|
||||
}
|
@ -1,467 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import sun.jvm.hotspot.oops.Symbol;
|
||||
import sun.jvm.hotspot.oops.LocalVariableTableElement;
|
||||
import sun.jvm.hotspot.oops.LineNumberTableElement;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Collections;
|
||||
|
||||
public class ConcreteMethodImpl extends MethodImpl {
|
||||
|
||||
/*
|
||||
* A subset of the line number info that is softly cached
|
||||
*/
|
||||
static private class SoftLocationXRefs {
|
||||
final String stratumID; // The stratum of this information
|
||||
final Map lineMapper; // Maps line number to location(s)
|
||||
final List lineLocations; // List of locations ordered by code index
|
||||
|
||||
/*
|
||||
* Note: these do not necessarily correspond to
|
||||
* the line numbers of the first and last elements
|
||||
* in the lineLocations list. Use these only for bounds
|
||||
* checking and with lineMapper.
|
||||
*/
|
||||
final int lowestLine;
|
||||
final int highestLine;
|
||||
|
||||
SoftLocationXRefs(String stratumID, Map lineMapper, List lineLocations,
|
||||
int lowestLine, int highestLine) {
|
||||
this.stratumID = stratumID;
|
||||
this.lineMapper = Collections.unmodifiableMap(lineMapper);
|
||||
this.lineLocations =
|
||||
Collections.unmodifiableList(lineLocations);
|
||||
this.lowestLine = lowestLine;
|
||||
this.highestLine = highestLine;
|
||||
}
|
||||
}
|
||||
|
||||
private SoftReference softBaseLocationXRefsRef;
|
||||
private SoftReference softOtherLocationXRefsRef;
|
||||
private SoftReference variablesRef = null;
|
||||
private int firstIndex = -1;
|
||||
private int lastIndex = -1;
|
||||
private Location location;
|
||||
private SoftReference bytecodesRef = null;
|
||||
|
||||
ConcreteMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
|
||||
sun.jvm.hotspot.oops.Method saMethod ) {
|
||||
super(vm, declaringType, saMethod);
|
||||
}
|
||||
|
||||
int argSlotCount() throws AbsentInformationException {
|
||||
return (int) saMethod.getSizeOfParameters();
|
||||
}
|
||||
|
||||
private SoftLocationXRefs getLocations(SDE.Stratum stratum) {
|
||||
if (stratum.isJava()) {
|
||||
return getBaseLocations();
|
||||
}
|
||||
String stratumID = stratum.id();
|
||||
SoftLocationXRefs info =
|
||||
(softOtherLocationXRefsRef == null) ? null :
|
||||
(SoftLocationXRefs)softOtherLocationXRefsRef.get();
|
||||
if (info != null && info.stratumID.equals(stratumID)) {
|
||||
return info;
|
||||
}
|
||||
|
||||
List lineLocations = new ArrayList();
|
||||
Map lineMapper = new HashMap();
|
||||
int lowestLine = -1;
|
||||
int highestLine = -1;
|
||||
SDE.LineStratum lastLineStratum = null;
|
||||
SDE.Stratum baseStratum =
|
||||
declaringType.stratum(SDE.BASE_STRATUM_NAME);
|
||||
Iterator it = getBaseLocations().lineLocations.iterator();
|
||||
while(it.hasNext()) {
|
||||
LocationImpl loc = (LocationImpl)it.next();
|
||||
int baseLineNumber = loc.lineNumber(baseStratum);
|
||||
SDE.LineStratum lineStratum =
|
||||
stratum.lineStratum(declaringType,
|
||||
baseLineNumber);
|
||||
|
||||
if (lineStratum == null) {
|
||||
// location not mapped in this stratum
|
||||
continue;
|
||||
}
|
||||
|
||||
int lineNumber = lineStratum.lineNumber();
|
||||
|
||||
// remove unmapped and dup lines
|
||||
if ((lineNumber != -1) &&
|
||||
(!lineStratum.equals(lastLineStratum))) {
|
||||
lastLineStratum = lineStratum;
|
||||
// Remember the largest/smallest line number
|
||||
if (lineNumber > highestLine) {
|
||||
highestLine = lineNumber;
|
||||
}
|
||||
if ((lineNumber < lowestLine) || (lowestLine == -1)) {
|
||||
lowestLine = lineNumber;
|
||||
}
|
||||
|
||||
loc.addStratumLineInfo(
|
||||
new StratumLineInfo(stratumID,
|
||||
lineNumber,
|
||||
lineStratum.sourceName(),
|
||||
lineStratum.sourcePath()));
|
||||
|
||||
// Add to the location list
|
||||
lineLocations.add(loc);
|
||||
|
||||
// Add to the line -> locations map
|
||||
Integer key = new Integer(lineNumber);
|
||||
List mappedLocs = (List)lineMapper.get(key);
|
||||
if (mappedLocs == null) {
|
||||
mappedLocs = new ArrayList(1);
|
||||
lineMapper.put(key, mappedLocs);
|
||||
}
|
||||
mappedLocs.add(loc);
|
||||
}
|
||||
}
|
||||
|
||||
info = new SoftLocationXRefs(stratumID,
|
||||
lineMapper, lineLocations,
|
||||
lowestLine, highestLine);
|
||||
softOtherLocationXRefsRef = new SoftReference(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
private SoftLocationXRefs getBaseLocations() {
|
||||
SoftLocationXRefs info = (softBaseLocationXRefsRef == null) ? null :
|
||||
(SoftLocationXRefs)softBaseLocationXRefsRef.get();
|
||||
if (info != null) {
|
||||
return info;
|
||||
}
|
||||
|
||||
byte[] codeBuf = bytecodes();
|
||||
firstIndex = 0;
|
||||
lastIndex = codeBuf.length - 1;
|
||||
// This is odd; what is the Location of a Method?
|
||||
// A StackFrame can have a location, but a Method?
|
||||
// I guess it must be the Location for bci 0.
|
||||
location = new LocationImpl(virtualMachine(), this, 0);
|
||||
|
||||
boolean hasLineInfo = saMethod.hasLineNumberTable();
|
||||
LineNumberTableElement[] lntab = null;
|
||||
int count;
|
||||
|
||||
if (hasLineInfo) {
|
||||
lntab = saMethod.getLineNumberTable();
|
||||
count = lntab.length;
|
||||
} else {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
List lineLocations = new ArrayList(count);
|
||||
Map lineMapper = new HashMap();
|
||||
int lowestLine = -1;
|
||||
int highestLine = -1;
|
||||
for (int i = 0; i < count; i++) {
|
||||
long bci = lntab[i].getStartBCI();
|
||||
int lineNumber = lntab[i].getLineNumber();
|
||||
|
||||
/*
|
||||
* Some compilers will point multiple consecutive
|
||||
* lines at the same location. We need to choose
|
||||
* one of them so that we can consistently map back
|
||||
* and forth between line and location. So we choose
|
||||
* to record only the last line entry at a particular
|
||||
* location.
|
||||
*/
|
||||
if ((i + 1 == count) || (bci != lntab[i+1].getStartBCI())) {
|
||||
// Remember the largest/smallest line number
|
||||
if (lineNumber > highestLine) {
|
||||
highestLine = lineNumber;
|
||||
}
|
||||
if ((lineNumber < lowestLine) || (lowestLine == -1)) {
|
||||
lowestLine = lineNumber;
|
||||
}
|
||||
LocationImpl loc =
|
||||
new LocationImpl(virtualMachine(), this, bci);
|
||||
loc.addBaseLineInfo(
|
||||
new BaseLineInfo(lineNumber, declaringType));
|
||||
|
||||
// Add to the location list
|
||||
lineLocations.add(loc);
|
||||
|
||||
// Add to the line -> locations map
|
||||
Integer key = new Integer(lineNumber);
|
||||
List mappedLocs = (List)lineMapper.get(key);
|
||||
if (mappedLocs == null) {
|
||||
mappedLocs = new ArrayList(1);
|
||||
lineMapper.put(key, mappedLocs);
|
||||
}
|
||||
mappedLocs.add(loc);
|
||||
}
|
||||
}
|
||||
|
||||
info = new SoftLocationXRefs(SDE.BASE_STRATUM_NAME,
|
||||
lineMapper, lineLocations,
|
||||
lowestLine, highestLine);
|
||||
softBaseLocationXRefsRef = new SoftReference(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
List sourceNameFilter(List list,
|
||||
SDE.Stratum stratum,
|
||||
String sourceName)
|
||||
throws AbsentInformationException {
|
||||
if (sourceName == null) {
|
||||
return list;
|
||||
} else {
|
||||
/* needs sourceName filteration */
|
||||
List locs = new ArrayList();
|
||||
Iterator it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
LocationImpl loc = (LocationImpl)it.next();
|
||||
if (loc.sourceName(stratum).equals(sourceName)) {
|
||||
locs.add(loc);
|
||||
}
|
||||
}
|
||||
return locs;
|
||||
}
|
||||
}
|
||||
|
||||
public List allLineLocations(SDE.Stratum stratum, String sourceName)
|
||||
throws AbsentInformationException {
|
||||
List lineLocations = getLocations(stratum).lineLocations;
|
||||
|
||||
if (lineLocations.size() == 0) {
|
||||
throw new AbsentInformationException();
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(
|
||||
sourceNameFilter(lineLocations, stratum, sourceName));
|
||||
}
|
||||
|
||||
public List locationsOfLine(SDE.Stratum stratum, String sourceName,
|
||||
int lineNumber) throws AbsentInformationException {
|
||||
SoftLocationXRefs info = getLocations(stratum);
|
||||
|
||||
if (info.lineLocations.size() == 0) {
|
||||
throw new AbsentInformationException();
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the locations which match the line number
|
||||
* passed in.
|
||||
*/
|
||||
List list = (List)info.lineMapper.get(
|
||||
new Integer(lineNumber));
|
||||
|
||||
if (list == null) {
|
||||
list = new ArrayList(0);
|
||||
}
|
||||
return Collections.unmodifiableList(
|
||||
sourceNameFilter(list, stratum, sourceName));
|
||||
}
|
||||
|
||||
LineInfo codeIndexToLineInfo(SDE.Stratum stratum,
|
||||
long codeIndex) {
|
||||
if (firstIndex == -1) {
|
||||
getBaseLocations();
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for invalid code index.
|
||||
*/
|
||||
if (codeIndex < firstIndex || codeIndex > lastIndex) {
|
||||
throw new InternalError(
|
||||
"Location with invalid code index");
|
||||
}
|
||||
|
||||
List lineLocations = getLocations(stratum).lineLocations;
|
||||
|
||||
/*
|
||||
* Check for absent line numbers.
|
||||
*/
|
||||
if (lineLocations.size() == 0) {
|
||||
return super.codeIndexToLineInfo(stratum, codeIndex);
|
||||
}
|
||||
|
||||
Iterator iter = lineLocations.iterator();
|
||||
/*
|
||||
* Treat code before the beginning of the first line table
|
||||
* entry as part of the first line. javac will generate
|
||||
* code like this for some local classes. This "prolog"
|
||||
* code contains assignments from locals in the enclosing
|
||||
* scope to synthetic fields in the local class. Same for
|
||||
* other language prolog code.
|
||||
*/
|
||||
LocationImpl bestMatch = (LocationImpl)iter.next();
|
||||
while (iter.hasNext()) {
|
||||
LocationImpl current = (LocationImpl)iter.next();
|
||||
if (current.codeIndex() > codeIndex) {
|
||||
break;
|
||||
}
|
||||
bestMatch = current;
|
||||
}
|
||||
return bestMatch.getLineInfo(stratum);
|
||||
}
|
||||
|
||||
public Location locationOfCodeIndex(long codeIndex) {
|
||||
if (firstIndex == -1) {
|
||||
getBaseLocations();
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for invalid code index.
|
||||
*/
|
||||
if (codeIndex < firstIndex || codeIndex > lastIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LocationImpl(virtualMachine(), this, codeIndex);
|
||||
}
|
||||
|
||||
public List variables() throws AbsentInformationException {
|
||||
return getVariables();
|
||||
}
|
||||
|
||||
public List variablesByName(String name) throws AbsentInformationException {
|
||||
List variables = getVariables();
|
||||
|
||||
List retList = new ArrayList(2);
|
||||
Iterator iter = variables.iterator();
|
||||
while(iter.hasNext()) {
|
||||
LocalVariable variable = (LocalVariable)iter.next();
|
||||
if (variable.name().equals(name)) {
|
||||
retList.add(variable);
|
||||
}
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
public List arguments() throws AbsentInformationException {
|
||||
if (argumentTypeNames().size() == 0) {
|
||||
return new ArrayList(0);
|
||||
}
|
||||
List variables = getVariables();
|
||||
List retList = new ArrayList(variables.size());
|
||||
Iterator iter = variables.iterator();
|
||||
while(iter.hasNext()) {
|
||||
LocalVariable variable = (LocalVariable)iter.next();
|
||||
if (variable.isArgument()) {
|
||||
retList.add(variable);
|
||||
}
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
public byte[] bytecodes() {
|
||||
byte[] bytecodes = (bytecodesRef == null) ? null :
|
||||
(byte[])bytecodesRef.get();
|
||||
if (bytecodes == null) {
|
||||
bytecodes = saMethod.getByteCode();
|
||||
bytecodesRef = new SoftReference(bytecodes);
|
||||
}
|
||||
/*
|
||||
* Arrays are always modifiable, so it is a little unsafe
|
||||
* to return the cached bytecodes directly; instead, we
|
||||
* make a clone at the cost of using more memory.
|
||||
*/
|
||||
return (byte[])bytecodes.clone();
|
||||
}
|
||||
|
||||
public Location location() {
|
||||
if (location == null) {
|
||||
getBaseLocations();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
private List getVariables() throws AbsentInformationException {
|
||||
List variables = (variablesRef == null) ? null :
|
||||
(List)variablesRef.get();
|
||||
if (variables != null) {
|
||||
return variables;
|
||||
}
|
||||
|
||||
// if there are no locals, there won't be a LVT
|
||||
if (saMethod.getMaxLocals() == 0) {
|
||||
variables = Collections.unmodifiableList(new ArrayList(0));
|
||||
variablesRef = new SoftReference(variables);
|
||||
return variables;
|
||||
}
|
||||
|
||||
if (! saMethod.hasLocalVariableTable()) {
|
||||
throw new AbsentInformationException();
|
||||
}
|
||||
//Build up the JDI view of local variable table.
|
||||
LocalVariableTableElement[] locals = saMethod.getLocalVariableTable();
|
||||
int localCount = locals.length;
|
||||
variables = new ArrayList(localCount);
|
||||
for (int ii = 0; ii < localCount; ii++) {
|
||||
String name =
|
||||
saMethod.getConstants().getSymbolAt(locals[ii].getNameCPIndex()).asString();
|
||||
/*
|
||||
* Skip "this$*", "this+*", "this" entries because they are never real
|
||||
* variables from the JLS perspective. "this+*" is new with 1.5.
|
||||
* Instead of using '+', we check for java letter or digit to avoid
|
||||
* depending on javac's current choice of '+'.
|
||||
*/
|
||||
boolean isInternalName = name.startsWith("this") &&
|
||||
(name.length() == 4 || name.charAt(4)=='$' || !Character.isJavaIdentifierPart(name.charAt(4)));
|
||||
if (! isInternalName) {
|
||||
int slot = locals[ii].getSlot();
|
||||
long codeIndex = locals[ii].getStartBCI();
|
||||
int length = locals[ii].getLength();
|
||||
Location scopeStart = new LocationImpl(virtualMachine(),
|
||||
this, codeIndex);
|
||||
Location scopeEnd =
|
||||
new LocationImpl(virtualMachine(), this,
|
||||
codeIndex + length - 1);
|
||||
String signature =
|
||||
saMethod.getConstants().getSymbolAt(locals[ii].getDescriptorCPIndex()).asString();
|
||||
|
||||
int genericSigIndex = locals[ii].getSignatureCPIndex();
|
||||
String genericSignature = null;
|
||||
if (genericSigIndex != 0) {
|
||||
genericSignature = saMethod.getConstants().getSymbolAt(genericSigIndex).asString();
|
||||
}
|
||||
|
||||
LocalVariable variable =
|
||||
new LocalVariableImpl(virtualMachine(), this,
|
||||
slot, scopeStart, scopeEnd,
|
||||
name, signature, genericSignature);
|
||||
// Add to the variable list
|
||||
variables.add(variable);
|
||||
}
|
||||
}
|
||||
|
||||
variables = Collections.unmodifiableList(variables);
|
||||
variablesRef = new SoftReference(variables);
|
||||
return variables;
|
||||
}
|
||||
}
|
@ -1,631 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.connect.*;
|
||||
import com.sun.jdi.InternalException;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.ref.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
abstract class ConnectorImpl implements Connector {
|
||||
Map defaultArguments = new LinkedHashMap();
|
||||
|
||||
// Used by BooleanArgument
|
||||
static String trueString = null;
|
||||
static String falseString;
|
||||
|
||||
|
||||
/** This is not public in VirtualMachineManagerImpl
|
||||
ThreadGroup mainGroupForJDI() {
|
||||
return ((VirtualMachineManagerImpl)manager).mainGroupForJDI();
|
||||
}
|
||||
***/
|
||||
|
||||
// multiple debuggee support for SA/JDI
|
||||
private static List freeVMClasses; // List<SoftReference<Class>>
|
||||
private static ClassLoader myLoader;
|
||||
// debug mode for SA/JDI connectors
|
||||
static final protected boolean DEBUG;
|
||||
static {
|
||||
myLoader = ConnectorImpl.class.getClassLoader();
|
||||
freeVMClasses = new ArrayList(0);
|
||||
DEBUG = System.getProperty("sun.jvm.hotspot.jdi.ConnectorImpl.DEBUG") != null;
|
||||
}
|
||||
|
||||
// add a new free VirtualMachineImpl class
|
||||
private static synchronized void addFreeVMImplClass(Class clazz) {
|
||||
if (DEBUG) {
|
||||
System.out.println("adding free VirtualMachineImpl class");
|
||||
}
|
||||
freeVMClasses.add(new SoftReference(clazz));
|
||||
}
|
||||
|
||||
// returns null if we don't have anything free
|
||||
private static synchronized Class getFreeVMImplClass() {
|
||||
while (!freeVMClasses.isEmpty()) {
|
||||
SoftReference ref = (SoftReference) freeVMClasses.remove(0);
|
||||
Object o = ref.get();
|
||||
if (o != null) {
|
||||
if (DEBUG) {
|
||||
System.out.println("re-using loaded VirtualMachineImpl");
|
||||
}
|
||||
return (Class) o;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Class getVMImplClassFrom(ClassLoader cl)
|
||||
throws ClassNotFoundException {
|
||||
return Class.forName("sun.jvm.hotspot.jdi.VirtualMachineImpl", true, cl);
|
||||
}
|
||||
|
||||
/* SA has not been designed to support multiple debuggee VMs
|
||||
* at-a-time. But, JDI supports multiple debuggee VMs. We
|
||||
* support multiple debuggee VMs in SA/JDI, by creating a new
|
||||
* class loader instance (refer to comment in SAJDIClassLoader
|
||||
* for details). But, to avoid excessive class loading (and
|
||||
* thereby resulting in larger footprint), we re-use 'dispose'd
|
||||
* VirtualMachineImpl classes.
|
||||
*/
|
||||
protected static Class loadVirtualMachineImplClass()
|
||||
throws ClassNotFoundException {
|
||||
Class vmImplClass = getFreeVMImplClass();
|
||||
if (vmImplClass == null) {
|
||||
ClassLoader cl = new SAJDIClassLoader(myLoader);
|
||||
vmImplClass = getVMImplClassFrom(cl);
|
||||
}
|
||||
return vmImplClass;
|
||||
}
|
||||
|
||||
/* We look for System property sun.jvm.hotspot.jdi.<vm version>.
|
||||
* This property should have the value of JDK HOME directory for
|
||||
* the given <vm version>.
|
||||
*/
|
||||
private static String getSAClassPathForVM(String vmVersion) {
|
||||
final String prefix = "sun.jvm.hotspot.jdi.";
|
||||
// look for exact match of VM version
|
||||
String jvmHome = System.getProperty(prefix + vmVersion);
|
||||
if (DEBUG) {
|
||||
System.out.println("looking for System property " + prefix + vmVersion);
|
||||
}
|
||||
|
||||
if (jvmHome == null) {
|
||||
// omit chars after first '-' in VM version and try
|
||||
// for example, in '1.5.0-b55' we take '1.5.0'
|
||||
int index = vmVersion.indexOf('-');
|
||||
if (index != -1) {
|
||||
vmVersion = vmVersion.substring(0, index);
|
||||
if (DEBUG) {
|
||||
System.out.println("looking for System property " + prefix + vmVersion);
|
||||
}
|
||||
jvmHome = System.getProperty(prefix + vmVersion);
|
||||
}
|
||||
|
||||
if (jvmHome == null) {
|
||||
// System property is not set
|
||||
if (DEBUG) {
|
||||
System.out.println("can't locate JDK home for " + vmVersion);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("JDK home for " + vmVersion + " is " + jvmHome);
|
||||
}
|
||||
|
||||
// sa-jdi is in $JDK_HOME/lib directory
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(jvmHome);
|
||||
buf.append(File.separatorChar);
|
||||
buf.append("lib");
|
||||
buf.append(File.separatorChar);
|
||||
buf.append("sa-jdi.jar");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/* This method loads VirtualMachineImpl class by a ClassLoader
|
||||
* configured with sa-jdi.jar path of given 'vmVersion'. This is
|
||||
* used for cross VM version debugging. Refer to comments in
|
||||
* SAJDIClassLoader as well.
|
||||
*/
|
||||
protected static Class loadVirtualMachineImplClass(String vmVersion)
|
||||
throws ClassNotFoundException {
|
||||
if (DEBUG) {
|
||||
System.out.println("attemping to load sa-jdi.jar for version " + vmVersion);
|
||||
}
|
||||
String classPath = getSAClassPathForVM(vmVersion);
|
||||
if (classPath != null) {
|
||||
ClassLoader cl = new SAJDIClassLoader(myLoader, classPath);
|
||||
return getVMImplClassFrom(cl);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* Is the given throwable an instanceof VMVersionMismatchException?
|
||||
* Note that we can't do instanceof check because the exception
|
||||
* class might have been loaded by a different class loader.
|
||||
*/
|
||||
private static boolean isVMVersionMismatch(Throwable throwable) {
|
||||
String className = throwable.getClass().getName();
|
||||
return className.equals("sun.jvm.hotspot.runtime.VMVersionMismatchException");
|
||||
}
|
||||
|
||||
/* gets target VM version from the given VMVersionMismatchException.
|
||||
* Note that we need to reflectively call the method because of we may
|
||||
* have got this from different classloader's namespace */
|
||||
private static String getVMVersion(Throwable throwable)
|
||||
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
// assert isVMVersionMismatch(throwable), "not a VMVersionMismatch"
|
||||
Class expClass = throwable.getClass();
|
||||
Method targetVersionMethod = expClass.getMethod("getTargetVersion", new Class[0]);
|
||||
return (String) targetVersionMethod.invoke(throwable);
|
||||
}
|
||||
|
||||
/** If the causal chain has a sun.jvm.hotspot.runtime.VMVersionMismatchException,
|
||||
attempt to load VirtualMachineImpl class for target VM version. */
|
||||
protected static Class handleVMVersionMismatch(InvocationTargetException ite) {
|
||||
Throwable cause = ite.getCause();
|
||||
if (DEBUG) {
|
||||
System.out.println("checking for version mismatch...");
|
||||
}
|
||||
while (cause != null) {
|
||||
try {
|
||||
if (isVMVersionMismatch(cause)) {
|
||||
if (DEBUG) {
|
||||
System.out.println("Triggering cross VM version support...");
|
||||
}
|
||||
return loadVirtualMachineImplClass(getVMVersion(cause));
|
||||
}
|
||||
} catch (Exception exp) {
|
||||
if (DEBUG) {
|
||||
System.out.println("failed to load VirtualMachineImpl class");
|
||||
exp.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
cause = cause.getCause();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void checkNativeLink(SecurityManager sm, String os) {
|
||||
if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) {
|
||||
// link "saproc" - SA native library on SunOS, Linux, and Mac OS X
|
||||
sm.checkLink("saproc");
|
||||
} else if (os.startsWith("Windows")) {
|
||||
// link "sawindbg" - SA native library on Windows.
|
||||
sm.checkLink("sawindbg");
|
||||
} else {
|
||||
throw new RuntimeException(os + " is not yet supported");
|
||||
}
|
||||
}
|
||||
|
||||
// we set an observer to detect VirtualMachineImpl.dispose call
|
||||
// and on dispose we add corresponding VirtualMachineImpl.class to
|
||||
// free VirtualMachimeImpl Class list.
|
||||
protected static void setVMDisposeObserver(final Object vm) {
|
||||
try {
|
||||
Method setDisposeObserverMethod = vm.getClass().getDeclaredMethod("setDisposeObserver",
|
||||
new Class[] { java.util.Observer.class });
|
||||
setDisposeObserverMethod.setAccessible(true);
|
||||
setDisposeObserverMethod.invoke(vm,
|
||||
new Object[] {
|
||||
new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
if (DEBUG) {
|
||||
System.out.println("got VM.dispose notification");
|
||||
}
|
||||
addFreeVMImplClass(vm.getClass());
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception exp) {
|
||||
if (DEBUG) {
|
||||
System.out.println("setVMDisposeObserver() got an exception:");
|
||||
exp.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map defaultArguments() {
|
||||
Map defaults = new LinkedHashMap();
|
||||
Collection values = defaultArguments.values();
|
||||
|
||||
Iterator iter = values.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ArgumentImpl argument = (ArgumentImpl)iter.next();
|
||||
defaults.put(argument.name(), argument.clone());
|
||||
}
|
||||
return defaults;
|
||||
}
|
||||
|
||||
void addStringArgument(String name, String label, String description,
|
||||
String defaultValue, boolean mustSpecify) {
|
||||
defaultArguments.put(name,
|
||||
new StringArgumentImpl(name, label,
|
||||
description,
|
||||
defaultValue,
|
||||
mustSpecify));
|
||||
}
|
||||
|
||||
void addBooleanArgument(String name, String label, String description,
|
||||
boolean defaultValue, boolean mustSpecify) {
|
||||
defaultArguments.put(name,
|
||||
new BooleanArgumentImpl(name, label,
|
||||
description,
|
||||
defaultValue,
|
||||
mustSpecify));
|
||||
}
|
||||
|
||||
void addIntegerArgument(String name, String label, String description,
|
||||
String defaultValue, boolean mustSpecify,
|
||||
int min, int max) {
|
||||
defaultArguments.put(name,
|
||||
new IntegerArgumentImpl(name, label,
|
||||
description,
|
||||
defaultValue,
|
||||
mustSpecify,
|
||||
min, max));
|
||||
}
|
||||
|
||||
void addSelectedArgument(String name, String label, String description,
|
||||
String defaultValue, boolean mustSpecify,
|
||||
List list) {
|
||||
defaultArguments.put(name,
|
||||
new SelectedArgumentImpl(name, label,
|
||||
description,
|
||||
defaultValue,
|
||||
mustSpecify, list));
|
||||
}
|
||||
|
||||
ArgumentImpl argument(String name, Map arguments)
|
||||
throws IllegalConnectorArgumentsException {
|
||||
|
||||
ArgumentImpl argument = (ArgumentImpl)arguments.get(name);
|
||||
if (argument == null) {
|
||||
throw new IllegalConnectorArgumentsException(
|
||||
"Argument missing", name);
|
||||
}
|
||||
String value = argument.value();
|
||||
if (value == null || value.length() == 0) {
|
||||
if (argument.mustSpecify()) {
|
||||
throw new IllegalConnectorArgumentsException(
|
||||
"Argument unspecified", name);
|
||||
}
|
||||
} else if(!argument.isValid(value)) {
|
||||
throw new IllegalConnectorArgumentsException(
|
||||
"Argument invalid", name);
|
||||
}
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
String getString(String key) {
|
||||
//fixme jjh; needs i18n
|
||||
// this is not public return ((VirtualMachineManagerImpl)manager).getString(key);
|
||||
return key;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String string = name() + " (defaults: ";
|
||||
Iterator iter = defaultArguments().values().iterator();
|
||||
boolean first = true;
|
||||
while (iter.hasNext()) {
|
||||
ArgumentImpl argument = (ArgumentImpl)iter.next();
|
||||
if (!first) {
|
||||
string += ", ";
|
||||
}
|
||||
string += argument.toString();
|
||||
first = false;
|
||||
}
|
||||
return string + ")";
|
||||
}
|
||||
|
||||
abstract class ArgumentImpl implements Connector.Argument, Cloneable, Serializable {
|
||||
private String name;
|
||||
private String label;
|
||||
private String description;
|
||||
private String value;
|
||||
private boolean mustSpecify;
|
||||
|
||||
ArgumentImpl(String name, String label, String description,
|
||||
String value,
|
||||
boolean mustSpecify) {
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.description = description;
|
||||
this.value = value;
|
||||
this.mustSpecify = mustSpecify;
|
||||
}
|
||||
|
||||
public abstract boolean isValid(String value);
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String label() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException("Can't set null value");
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean mustSpecify() {
|
||||
return mustSpecify;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof Connector.Argument)) {
|
||||
Connector.Argument other = (Connector.Argument)obj;
|
||||
return (name().equals(other.name())) &&
|
||||
(description().equals(other.description())) &&
|
||||
(mustSpecify() == other.mustSpecify()) &&
|
||||
(value().equals(other.value()));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return description().hashCode();
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// Object should always support clone
|
||||
throw (InternalException) new InternalException().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name() + "=" + value();
|
||||
}
|
||||
}
|
||||
|
||||
class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl
|
||||
implements Connector.BooleanArgument {
|
||||
|
||||
BooleanArgumentImpl(String name, String label, String description,
|
||||
boolean value,
|
||||
boolean mustSpecify) {
|
||||
super(name, label, description, null, mustSpecify);
|
||||
if(trueString == null) {
|
||||
trueString = getString("true");
|
||||
falseString = getString("false");
|
||||
}
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the argument.
|
||||
*/
|
||||
public void setValue(boolean value) {
|
||||
setValue(stringValueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs basic sanity check of argument.
|
||||
* @return <code>true</code> if value is a string
|
||||
* representation of a boolean value.
|
||||
* @see #stringValueOf(boolean)
|
||||
*/
|
||||
public boolean isValid(String value) {
|
||||
return value.equals(trueString) || value.equals(falseString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the string representation of the <code>value</code>
|
||||
* parameter.
|
||||
* Does not set or examine the value or the argument.
|
||||
* @return the localized String representation of the
|
||||
* boolean value.
|
||||
*/
|
||||
public String stringValueOf(boolean value) {
|
||||
return value? trueString : falseString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the argument as a boolean. Since
|
||||
* the argument may not have been set or may have an invalid
|
||||
* value {@link #isValid(String)} should be called on
|
||||
* {@link #value()} to check its validity. If it is invalid
|
||||
* the boolean returned by this method is undefined.
|
||||
* @return the value of the argument as a boolean.
|
||||
*/
|
||||
public boolean booleanValue() {
|
||||
return value().equals(trueString);
|
||||
}
|
||||
}
|
||||
|
||||
class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl
|
||||
implements Connector.IntegerArgument {
|
||||
|
||||
private final int min;
|
||||
private final int max;
|
||||
|
||||
IntegerArgumentImpl(String name, String label, String description,
|
||||
String value,
|
||||
boolean mustSpecify, int min, int max) {
|
||||
super(name, label, description, value, mustSpecify);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the argument.
|
||||
* The value should be checked with {@link #isValid(int)}
|
||||
* before setting it; invalid values will throw an exception
|
||||
* when the connection is established - for example,
|
||||
* on {@link LaunchingConnector#launch}
|
||||
*/
|
||||
public void setValue(int value) {
|
||||
setValue(stringValueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs basic sanity check of argument.
|
||||
* @return <code>true</code> if value represents an int that is
|
||||
* <code>{@link #min()} <= value <= {@link #max()}</code>
|
||||
*/
|
||||
public boolean isValid(String value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return isValid(Integer.decode(value).intValue());
|
||||
} catch(NumberFormatException exc) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs basic sanity check of argument.
|
||||
* @return <code>true</code> if
|
||||
* <code>{@link #min()} <= value <= {@link #max()}</code>
|
||||
*/
|
||||
public boolean isValid(int value) {
|
||||
return min <= value && value <= max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the string representation of the <code>value</code>
|
||||
* parameter.
|
||||
* Does not set or examine the value or the argument.
|
||||
* @return the String representation of the
|
||||
* int value.
|
||||
*/
|
||||
public String stringValueOf(int value) {
|
||||
// *** Should this be internationalized????
|
||||
// *** Even Brian Beck was unsure if an Arabic programmer
|
||||
// *** would expect port numbers in Arabic numerals,
|
||||
// *** so punt for now.
|
||||
return ""+value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the argument as a int. Since
|
||||
* the argument may not have been set or may have an invalid
|
||||
* value {@link #isValid(String)} should be called on
|
||||
* {@link #value()} to check its validity. If it is invalid
|
||||
* the int returned by this method is undefined.
|
||||
* @return the value of the argument as a int.
|
||||
*/
|
||||
public int intValue() {
|
||||
if (value() == null) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return Integer.decode(value()).intValue();
|
||||
} catch(NumberFormatException exc) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The upper bound for the value.
|
||||
* @return the maximum allowed value for this argument.
|
||||
*/
|
||||
public int max() {
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* The lower bound for the value.
|
||||
* @return the minimum allowed value for this argument.
|
||||
*/
|
||||
public int min() {
|
||||
return min;
|
||||
}
|
||||
}
|
||||
|
||||
class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
|
||||
implements Connector.StringArgument {
|
||||
|
||||
StringArgumentImpl(String name, String label, String description,
|
||||
String value,
|
||||
boolean mustSpecify) {
|
||||
super(name, label, description, value, mustSpecify);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs basic sanity check of argument.
|
||||
* @return <code>true</code> always
|
||||
*/
|
||||
public boolean isValid(String value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl
|
||||
implements Connector.SelectedArgument {
|
||||
|
||||
private final List choices;
|
||||
|
||||
SelectedArgumentImpl(String name, String label, String description,
|
||||
String value,
|
||||
boolean mustSpecify, List choices) {
|
||||
super(name, label, description, value, mustSpecify);
|
||||
this.choices = Collections.unmodifiableList(
|
||||
new ArrayList(choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the possible values for the argument
|
||||
* @return {@link List} of {@link String}
|
||||
*/
|
||||
public List choices() {
|
||||
return choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs basic sanity check of argument.
|
||||
* @return <code>true</code> if value is one of {@link #choices()}.
|
||||
*/
|
||||
public boolean isValid(String value) {
|
||||
return choices.contains(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class DoubleTypeImpl extends PrimitiveTypeImpl implements DoubleType {
|
||||
DoubleTypeImpl(VirtualMachine vm) {
|
||||
super(vm);
|
||||
}
|
||||
|
||||
|
||||
public String signature() {
|
||||
return "D";
|
||||
}
|
||||
|
||||
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
|
||||
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedDoubleValue());
|
||||
}
|
||||
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class DoubleValueImpl extends PrimitiveValueImpl
|
||||
implements DoubleValue {
|
||||
private double value;
|
||||
|
||||
DoubleValueImpl(VirtualMachine aVm,double aValue) {
|
||||
super(aVm);
|
||||
|
||||
value = aValue;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof DoubleValue)) {
|
||||
return (value == ((DoubleValue)obj).value()) &&
|
||||
super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int compareTo(DoubleValue doubleVal) {
|
||||
double other = doubleVal.value();
|
||||
if (value() < other) {
|
||||
return -1;
|
||||
} else if (value() == other) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
/*
|
||||
* TO DO: Better hash code
|
||||
*/
|
||||
return intValue();
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return vm.theDoubleType();
|
||||
}
|
||||
|
||||
public double value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
return(value == 0.0)?false:true;
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return(byte)value;
|
||||
}
|
||||
|
||||
public char charValue() {
|
||||
return(char)value;
|
||||
}
|
||||
|
||||
public short shortValue() {
|
||||
return(short)value;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return(int)value;
|
||||
}
|
||||
|
||||
public long longValue() {
|
||||
return(long)value;
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return(float)value;
|
||||
}
|
||||
|
||||
public double doubleValue() {
|
||||
return(double)value;
|
||||
}
|
||||
|
||||
byte checkedByteValue() throws InvalidTypeException {
|
||||
if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to byte");
|
||||
} else {
|
||||
return super.checkedByteValue();
|
||||
}
|
||||
}
|
||||
|
||||
char checkedCharValue() throws InvalidTypeException {
|
||||
if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to char");
|
||||
} else {
|
||||
return super.checkedCharValue();
|
||||
}
|
||||
}
|
||||
|
||||
short checkedShortValue() throws InvalidTypeException {
|
||||
if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to short");
|
||||
} else {
|
||||
return super.checkedShortValue();
|
||||
}
|
||||
}
|
||||
|
||||
int checkedIntValue() throws InvalidTypeException {
|
||||
if ((value > Integer.MAX_VALUE) || (value < Integer.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to int");
|
||||
} else {
|
||||
return super.checkedIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
long checkedLongValue() throws InvalidTypeException {
|
||||
long longValue = (long)value;
|
||||
if (longValue != value) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to long");
|
||||
} else {
|
||||
return super.checkedLongValue();
|
||||
}
|
||||
}
|
||||
|
||||
float checkedFloatValue() throws InvalidTypeException {
|
||||
float floatValue = (float)value;
|
||||
if (floatValue != value) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to float");
|
||||
} else {
|
||||
return super.checkedFloatValue();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + value;
|
||||
}
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import sun.jvm.hotspot.oops.Oop;
|
||||
import sun.jvm.hotspot.oops.Instance;
|
||||
import sun.jvm.hotspot.oops.Array;
|
||||
import sun.jvm.hotspot.oops.InstanceKlass;
|
||||
import sun.jvm.hotspot.oops.Symbol;
|
||||
import sun.jvm.hotspot.oops.FieldIdentifier;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class FieldImpl extends TypeComponentImpl implements Field {
|
||||
private JNITypeParser signatureParser;
|
||||
private sun.jvm.hotspot.oops.Field saField;
|
||||
|
||||
FieldImpl( VirtualMachine vm, ReferenceTypeImpl declaringType,
|
||||
sun.jvm.hotspot.oops.Field saField) {
|
||||
super(vm, declaringType);
|
||||
this.saField = saField;
|
||||
getParser();
|
||||
}
|
||||
|
||||
private void getParser() {
|
||||
if (signatureParser == null) {
|
||||
Symbol sig1 = saField.getSignature();
|
||||
signature = sig1.asString();
|
||||
signatureParser = new JNITypeParser(signature);
|
||||
}
|
||||
}
|
||||
|
||||
sun.jvm.hotspot.oops.Field ref() {
|
||||
return saField;
|
||||
}
|
||||
|
||||
// get the value of static field
|
||||
ValueImpl getValue() {
|
||||
return getValue(saField.getFieldHolder().getJavaMirror());
|
||||
}
|
||||
|
||||
// get the value of this Field from a specific Oop
|
||||
ValueImpl getValue(Oop target) {
|
||||
ValueImpl valueImpl;
|
||||
sun.jvm.hotspot.oops.Field saField = (sun.jvm.hotspot.oops.Field) ref();
|
||||
sun.jvm.hotspot.oops.FieldType ft = saField.getFieldType();
|
||||
if (ft.isArray()) {
|
||||
sun.jvm.hotspot.oops.OopField of = (sun.jvm.hotspot.oops.OopField)saField;
|
||||
valueImpl = (ArrayReferenceImpl) vm.arrayMirror((Array)of.getValue(target));
|
||||
} else if (ft.isObject()) {
|
||||
sun.jvm.hotspot.oops.OopField of = (sun.jvm.hotspot.oops.OopField)saField;
|
||||
valueImpl = (ObjectReferenceImpl) vm.objectMirror(of.getValue(target));
|
||||
} else if (ft.isByte()) {
|
||||
sun.jvm.hotspot.oops.ByteField bf = (sun.jvm.hotspot.oops.ByteField)saField;
|
||||
valueImpl = (ByteValueImpl) vm.mirrorOf(bf.getValue(target));
|
||||
} else if (ft.isChar()) {
|
||||
sun.jvm.hotspot.oops.CharField cf = (sun.jvm.hotspot.oops.CharField)saField;
|
||||
valueImpl = (CharValueImpl) vm.mirrorOf(cf.getValue(target));
|
||||
} else if (ft.isDouble()) {
|
||||
sun.jvm.hotspot.oops.DoubleField df = (sun.jvm.hotspot.oops.DoubleField)saField;
|
||||
valueImpl = (DoubleValueImpl) vm.mirrorOf(df.getValue(target));
|
||||
} else if (ft.isFloat()) {
|
||||
sun.jvm.hotspot.oops.FloatField ff = (sun.jvm.hotspot.oops.FloatField)saField;
|
||||
valueImpl = (FloatValueImpl) vm.mirrorOf(ff.getValue(target));
|
||||
} else if (ft.isInt()) {
|
||||
sun.jvm.hotspot.oops.IntField iif = (sun.jvm.hotspot.oops.IntField)saField;
|
||||
valueImpl = (IntegerValueImpl) vm.mirrorOf(iif.getValue(target));
|
||||
} else if (ft.isLong()) {
|
||||
sun.jvm.hotspot.oops.LongField lf = (sun.jvm.hotspot.oops.LongField)saField;
|
||||
valueImpl = (LongValueImpl) vm.mirrorOf(lf.getValue(target));
|
||||
} else if (ft.isShort()) {
|
||||
sun.jvm.hotspot.oops.ShortField sf = (sun.jvm.hotspot.oops.ShortField)saField;
|
||||
valueImpl = (ShortValueImpl) vm.mirrorOf(sf.getValue(target));
|
||||
} else if (ft.isBoolean()) {
|
||||
sun.jvm.hotspot.oops.BooleanField bf = (sun.jvm.hotspot.oops.BooleanField)saField;
|
||||
valueImpl = (BooleanValueImpl) vm.mirrorOf(bf.getValue(target));
|
||||
} else {
|
||||
throw new RuntimeException("Should not reach here");
|
||||
}
|
||||
return valueImpl;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof FieldImpl)) {
|
||||
FieldImpl other = (FieldImpl)obj;
|
||||
return (declaringType().equals(other.declaringType())) &&
|
||||
(ref().equals(other.ref())) &&
|
||||
super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTransient() {
|
||||
return saField.isTransient();
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
return saField.isVolatile();
|
||||
}
|
||||
|
||||
public boolean isEnumConstant() {
|
||||
return saField.isEnumConstant();
|
||||
}
|
||||
|
||||
public Type type() throws ClassNotLoadedException {
|
||||
// So, we do it just like JDI does by searching the enclosing type.
|
||||
return findType(signature());
|
||||
}
|
||||
|
||||
public String typeName() { //fixme jjh: jpda version creates redundant JNITypeParsers
|
||||
getParser();
|
||||
return signatureParser.typeName();
|
||||
}
|
||||
|
||||
public String genericSignature() {
|
||||
Symbol genSig = saField.getGenericSignature();
|
||||
return (genSig != null)? genSig.asString() : null;
|
||||
}
|
||||
|
||||
// From interface Comparable
|
||||
public int compareTo(Field field) {
|
||||
ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType();
|
||||
int rc = declaringType.compareTo(field.declaringType());
|
||||
if (rc == 0) {
|
||||
rc = declaringType.indexOf(this) -
|
||||
declaringType.indexOf(field);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
// from interface Mirror
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
buf.append(declaringType().name());
|
||||
buf.append('.');
|
||||
buf.append(name());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String name() {
|
||||
FieldIdentifier myName = saField.getID();
|
||||
return myName.getName();
|
||||
}
|
||||
|
||||
// From interface Accessible
|
||||
public int modifiers() {
|
||||
return saField.getAccessFlagsObj().getStandardFlags();
|
||||
}
|
||||
|
||||
public boolean isPackagePrivate() {
|
||||
return saField.isPackagePrivate();
|
||||
}
|
||||
|
||||
public boolean isPrivate() {
|
||||
return saField.isPrivate();
|
||||
}
|
||||
|
||||
public boolean isProtected() {
|
||||
return saField.isProtected();
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
return saField.isPublic();
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return saField.isStatic();
|
||||
}
|
||||
|
||||
public boolean isFinal() {
|
||||
return saField.isFinal();
|
||||
}
|
||||
|
||||
public boolean isSynthetic() {
|
||||
return saField.isSynthetic();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return saField.hashCode();
|
||||
}
|
||||
|
||||
|
||||
private Type findType(String signature) throws ClassNotLoadedException {
|
||||
ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType();
|
||||
return enclosing.findType(signature);
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class FloatTypeImpl extends PrimitiveTypeImpl implements FloatType {
|
||||
FloatTypeImpl(VirtualMachine vm) {
|
||||
super(vm);
|
||||
}
|
||||
|
||||
|
||||
public String signature() {
|
||||
return "F";
|
||||
}
|
||||
|
||||
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
|
||||
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedFloatValue());
|
||||
}
|
||||
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class FloatValueImpl extends PrimitiveValueImpl
|
||||
implements FloatValue {
|
||||
private float value;
|
||||
|
||||
FloatValueImpl(VirtualMachine aVm,float aValue) {
|
||||
super(aVm);
|
||||
|
||||
value = aValue;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof FloatValue)) {
|
||||
return (value == ((FloatValue)obj).value()) &&
|
||||
super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
/*
|
||||
* TO DO: Better hash code
|
||||
*/
|
||||
return intValue();
|
||||
}
|
||||
|
||||
public int compareTo(FloatValue floatVal) {
|
||||
float other = floatVal.value();
|
||||
if (value() < other) {
|
||||
return -1;
|
||||
} else if (value() == other) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return vm.theFloatType();
|
||||
}
|
||||
|
||||
public float value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
return(value == 0.0)?false:true;
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return(byte)value;
|
||||
}
|
||||
|
||||
public char charValue() {
|
||||
return(char)value;
|
||||
}
|
||||
|
||||
public short shortValue() {
|
||||
return(short)value;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return(int)value;
|
||||
}
|
||||
|
||||
public long longValue() {
|
||||
return(long)value;
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return(float)value;
|
||||
}
|
||||
|
||||
public double doubleValue() {
|
||||
return(double)value;
|
||||
}
|
||||
|
||||
byte checkedByteValue() throws InvalidTypeException {
|
||||
if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to byte");
|
||||
} else {
|
||||
return super.checkedByteValue();
|
||||
}
|
||||
}
|
||||
|
||||
char checkedCharValue() throws InvalidTypeException {
|
||||
if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to char");
|
||||
} else {
|
||||
return super.checkedCharValue();
|
||||
}
|
||||
}
|
||||
|
||||
short checkedShortValue() throws InvalidTypeException {
|
||||
if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to short");
|
||||
} else {
|
||||
return super.checkedShortValue();
|
||||
}
|
||||
}
|
||||
|
||||
int checkedIntValue() throws InvalidTypeException {
|
||||
int intValue = (int)value;
|
||||
if (intValue != value) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to int");
|
||||
} else {
|
||||
return super.checkedIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
long checkedLongValue() throws InvalidTypeException {
|
||||
long longValue = (long)value;
|
||||
if (longValue != value) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to long");
|
||||
} else {
|
||||
return super.checkedLongValue();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + value;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class IntegerTypeImpl extends PrimitiveTypeImpl implements IntegerType {
|
||||
IntegerTypeImpl(VirtualMachine vm) {
|
||||
super(vm);
|
||||
}
|
||||
|
||||
public String signature() {
|
||||
return "I";
|
||||
}
|
||||
|
||||
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
|
||||
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedIntValue());
|
||||
}
|
||||
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
public class IntegerValueImpl extends PrimitiveValueImpl
|
||||
implements IntegerValue {
|
||||
private int value;
|
||||
|
||||
IntegerValueImpl(VirtualMachine aVm,int aValue) {
|
||||
super(aVm);
|
||||
|
||||
value = aValue;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof IntegerValue)) {
|
||||
return (value == ((IntegerValue)obj).value()) &&
|
||||
super.equals(obj);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
/*
|
||||
* TO DO: Better hash code
|
||||
*/
|
||||
return intValue();
|
||||
}
|
||||
|
||||
public int compareTo(IntegerValue integerVal) {
|
||||
return value() - integerVal.value();
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return vm.theIntegerType();
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
return(value == 0)?false:true;
|
||||
}
|
||||
|
||||
public byte byteValue() {
|
||||
return(byte)value;
|
||||
}
|
||||
|
||||
public char charValue() {
|
||||
return(char)value;
|
||||
}
|
||||
|
||||
public short shortValue() {
|
||||
return(short)value;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return(int)value;
|
||||
}
|
||||
|
||||
public long longValue() {
|
||||
return(long)value;
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return(float)value;
|
||||
}
|
||||
|
||||
public double doubleValue() {
|
||||
return(double)value;
|
||||
}
|
||||
|
||||
byte checkedByteValue() throws InvalidTypeException {
|
||||
if ((value > Byte.MAX_VALUE) || (value < Byte.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to byte");
|
||||
} else {
|
||||
return super.checkedByteValue();
|
||||
}
|
||||
}
|
||||
|
||||
char checkedCharValue() throws InvalidTypeException {
|
||||
if ((value > Character.MAX_VALUE) || (value < Character.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to char");
|
||||
} else {
|
||||
return super.checkedCharValue();
|
||||
}
|
||||
}
|
||||
|
||||
short checkedShortValue() throws InvalidTypeException {
|
||||
if ((value > Short.MAX_VALUE) || (value < Short.MIN_VALUE)) {
|
||||
throw new InvalidTypeException("Can't convert " + value + " to short");
|
||||
} else {
|
||||
return super.checkedShortValue();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "" + value;
|
||||
}
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import sun.jvm.hotspot.oops.InstanceKlass;
|
||||
|
||||
import com.sun.jdi.ClassNotPreparedException;
|
||||
import com.sun.jdi.ClassType;
|
||||
import com.sun.jdi.InterfaceType;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
|
||||
public class InterfaceTypeImpl extends ReferenceTypeImpl
|
||||
implements InterfaceType {
|
||||
private SoftReference superInterfacesCache = null;
|
||||
private SoftReference subInterfacesCache = null;
|
||||
private SoftReference implementorsCache = null;
|
||||
|
||||
protected InterfaceTypeImpl(VirtualMachine aVm, InstanceKlass aRef) {
|
||||
super(aVm, aRef);
|
||||
}
|
||||
|
||||
public List superinterfaces() throws ClassNotPreparedException {
|
||||
List superinterfaces = (superInterfacesCache != null)? (List) superInterfacesCache.get() : null;
|
||||
if (superinterfaces == null) {
|
||||
checkPrepared();
|
||||
superinterfaces = Collections.unmodifiableList(getInterfaces());
|
||||
superInterfacesCache = new SoftReference(superinterfaces);
|
||||
}
|
||||
return superinterfaces;
|
||||
}
|
||||
|
||||
public List subinterfaces() {
|
||||
List subinterfaces = (subInterfacesCache != null)? (List) subInterfacesCache.get() : null;
|
||||
if (subinterfaces == null) {
|
||||
List all = vm.allClasses();
|
||||
subinterfaces = new ArrayList();
|
||||
Iterator iter = all.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ReferenceType refType = (ReferenceType)iter.next();
|
||||
if (refType instanceof InterfaceType) {
|
||||
InterfaceType interfaze = (InterfaceType)refType;
|
||||
if (interfaze.isPrepared() && interfaze.superinterfaces().contains(this)) {
|
||||
subinterfaces.add(interfaze);
|
||||
}
|
||||
}
|
||||
}
|
||||
subinterfaces = Collections.unmodifiableList(subinterfaces);
|
||||
subInterfacesCache = new SoftReference(subinterfaces);
|
||||
}
|
||||
return subinterfaces;
|
||||
}
|
||||
|
||||
public List implementors() {
|
||||
List implementors = (implementorsCache != null)? (List) implementorsCache.get() : null;
|
||||
if (implementors == null) {
|
||||
List all = vm.allClasses();
|
||||
implementors = new ArrayList();
|
||||
Iterator iter = all.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ReferenceType refType = (ReferenceType)iter.next();
|
||||
if (refType instanceof ClassType) {
|
||||
ClassType clazz = (ClassType)refType;
|
||||
if (clazz.isPrepared() && clazz.interfaces().contains(this)) {
|
||||
implementors.add(clazz);
|
||||
}
|
||||
}
|
||||
}
|
||||
implementors = Collections.unmodifiableList(implementors);
|
||||
implementorsCache = new SoftReference(implementors);
|
||||
}
|
||||
return implementors;
|
||||
}
|
||||
|
||||
@Override
|
||||
void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
|
||||
/*
|
||||
* Add methods from
|
||||
* parent types first, so that the methods in this class will
|
||||
* overwrite them in the hash table
|
||||
*/
|
||||
Iterator<InterfaceType> iter = superinterfaces().iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
|
||||
if (!seenInterfaces.contains(interfaze)) {
|
||||
interfaze.addVisibleMethods(methodMap, seenInterfaces);
|
||||
seenInterfaces.add(interfaze);
|
||||
}
|
||||
}
|
||||
|
||||
addToMethodMap(methodMap, methods());
|
||||
}
|
||||
|
||||
List getAllMethods() {
|
||||
ArrayList list = new ArrayList(methods());
|
||||
/*
|
||||
* It's more efficient if don't do this
|
||||
* recursively.
|
||||
*/
|
||||
List interfaces = allSuperinterfaces();
|
||||
Iterator iter = interfaces.iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceType interfaze = (InterfaceType)iter.next();
|
||||
list.addAll(interfaze.methods());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
List allSuperinterfaces() {
|
||||
ArrayList list = new ArrayList();
|
||||
addSuperinterfaces(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
void addSuperinterfaces(List list) {
|
||||
/*
|
||||
* This code is a little strange because it
|
||||
* builds the list with a more suitable order than the
|
||||
* depth-first approach a normal recursive solution would
|
||||
* take. Instead, all direct superinterfaces precede all
|
||||
* indirect ones.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get a list of direct superinterfaces that's not already in the
|
||||
* list being built.
|
||||
*/
|
||||
List immediate = new ArrayList(superinterfaces());
|
||||
Iterator iter = immediate.iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceType interfaze = (InterfaceType)iter.next();
|
||||
if (list.contains(interfaze)) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add all new direct superinterfaces
|
||||
*/
|
||||
list.addAll(immediate);
|
||||
|
||||
/*
|
||||
* Recurse for all new direct superinterfaces.
|
||||
*/
|
||||
iter = immediate.iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
|
||||
interfaze.addSuperinterfaces(list);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAssignableTo(ReferenceType type) {
|
||||
|
||||
// Exact match?
|
||||
if (this.equals(type)) {
|
||||
return true;
|
||||
} else {
|
||||
// Try superinterfaces.
|
||||
List supers = superinterfaces();
|
||||
Iterator iter = supers.iterator();
|
||||
while (iter.hasNext()) {
|
||||
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
|
||||
if (interfaze.isAssignableTo(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
List inheritedTypes() {
|
||||
return superinterfaces();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return isPrepared();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "interface " + name() + " (" + loaderString() + ")";
|
||||
}
|
||||
}
|
@ -1,240 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class JNITypeParser {
|
||||
|
||||
static final char SIGNATURE_ENDCLASS = ';';
|
||||
static final char SIGNATURE_FUNC = '(';
|
||||
static final char SIGNATURE_ENDFUNC = ')';
|
||||
|
||||
private String signature;
|
||||
private List typeNameList;
|
||||
private List signatureList;
|
||||
private int currentIndex;
|
||||
|
||||
JNITypeParser(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
static String typeNameToSignature(String signature) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
int firstIndex = signature.indexOf('[');
|
||||
int index = firstIndex;
|
||||
while (index != -1) {
|
||||
buffer.append('[');
|
||||
index = signature.indexOf('[', index + 1);
|
||||
}
|
||||
|
||||
if (firstIndex != -1) {
|
||||
signature = signature.substring(0, firstIndex);
|
||||
}
|
||||
|
||||
if (signature.equals("boolean")) {
|
||||
buffer.append('Z');
|
||||
} else if (signature.equals("byte")) {
|
||||
buffer.append('B');
|
||||
} else if (signature.equals("char")) {
|
||||
buffer.append('C');
|
||||
} else if (signature.equals("short")) {
|
||||
buffer.append('S');
|
||||
} else if (signature.equals("int")) {
|
||||
buffer.append('I');
|
||||
} else if (signature.equals("long")) {
|
||||
buffer.append('J');
|
||||
} else if (signature.equals("float")) {
|
||||
buffer.append('F');
|
||||
} else if (signature.equals("double")) {
|
||||
buffer.append('D');
|
||||
} else {
|
||||
buffer.append('L');
|
||||
buffer.append(signature.replace('.', '/'));
|
||||
buffer.append(';');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
String typeName() {
|
||||
return (String)typeNameList().get(typeNameList().size()-1);
|
||||
}
|
||||
|
||||
List argumentTypeNames() {
|
||||
return typeNameList().subList(0, typeNameList().size() - 1);
|
||||
}
|
||||
|
||||
String signature() {
|
||||
return (String)signatureList().get(signatureList().size()-1);
|
||||
}
|
||||
|
||||
List argumentSignatures() {
|
||||
return signatureList().subList(0, signatureList().size() - 1);
|
||||
}
|
||||
|
||||
int dimensionCount() {
|
||||
int count = 0;
|
||||
String signature = signature();
|
||||
while (signature.charAt(count) == '[') {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
String componentSignature(int level) {
|
||||
return signature().substring(level);
|
||||
}
|
||||
|
||||
private synchronized List signatureList() {
|
||||
if (signatureList == null) {
|
||||
signatureList = new ArrayList(10);
|
||||
String elem;
|
||||
|
||||
currentIndex = 0;
|
||||
|
||||
while(currentIndex < signature.length()) {
|
||||
elem = nextSignature();
|
||||
signatureList.add(elem);
|
||||
}
|
||||
if (signatureList.size() == 0) {
|
||||
throw new IllegalArgumentException("Invalid JNI signature '" +
|
||||
signature + "'");
|
||||
}
|
||||
}
|
||||
return signatureList;
|
||||
}
|
||||
|
||||
private synchronized List typeNameList() {
|
||||
if (typeNameList == null) {
|
||||
typeNameList = new ArrayList(10);
|
||||
String elem;
|
||||
|
||||
currentIndex = 0;
|
||||
|
||||
while(currentIndex < signature.length()) {
|
||||
elem = nextTypeName();
|
||||
typeNameList.add(elem);
|
||||
}
|
||||
if (typeNameList.size() == 0) {
|
||||
throw new IllegalArgumentException("Invalid JNI signature '" +
|
||||
signature + "'");
|
||||
}
|
||||
}
|
||||
return typeNameList;
|
||||
}
|
||||
|
||||
private String nextSignature() {
|
||||
char key = signature.charAt(currentIndex++);
|
||||
|
||||
switch(key) {
|
||||
case '[':
|
||||
return key + nextSignature();
|
||||
|
||||
case 'L':
|
||||
int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
|
||||
currentIndex);
|
||||
String retVal = signature.substring(currentIndex - 1,
|
||||
endClass + 1);
|
||||
currentIndex = endClass + 1;
|
||||
return retVal;
|
||||
|
||||
case 'V':
|
||||
case 'Z':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'S':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'F':
|
||||
case 'D':
|
||||
return String.valueOf(key);
|
||||
|
||||
case SIGNATURE_FUNC:
|
||||
case SIGNATURE_ENDFUNC:
|
||||
return nextSignature();
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid JNI signature character '" + key + "'");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String nextTypeName() {
|
||||
char key = signature.charAt(currentIndex++);
|
||||
|
||||
switch(key) {
|
||||
case '[':
|
||||
return nextTypeName() + "[]";
|
||||
|
||||
case 'B':
|
||||
return "byte";
|
||||
|
||||
case 'C':
|
||||
return "char";
|
||||
|
||||
case 'L':
|
||||
int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
|
||||
currentIndex);
|
||||
String retVal = signature.substring(currentIndex,
|
||||
endClass);
|
||||
retVal = retVal.replace('/','.');
|
||||
currentIndex = endClass + 1;
|
||||
return retVal;
|
||||
|
||||
case 'F':
|
||||
return "float";
|
||||
|
||||
case 'D':
|
||||
return "double";
|
||||
|
||||
case 'I':
|
||||
return "int";
|
||||
|
||||
case 'J':
|
||||
return "long";
|
||||
|
||||
case 'S':
|
||||
return "short";
|
||||
|
||||
case 'V':
|
||||
return "void";
|
||||
|
||||
case 'Z':
|
||||
return "boolean";
|
||||
|
||||
case SIGNATURE_ENDFUNC:
|
||||
case SIGNATURE_FUNC:
|
||||
return nextTypeName();
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid JNI signature character '" + key + "'");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2013, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
// from JVMTI specification - refer to jvmti.xml
|
||||
public interface JVMTIThreadState {
|
||||
public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
|
||||
public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
|
||||
public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
|
||||
public static final int JVMTI_THREAD_STATE_WAITING = 0x0080;
|
||||
public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
|
||||
public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
|
||||
public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040;
|
||||
public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100;
|
||||
public static final int JVMTI_THREAD_STATE_PARKED = 0x0200;
|
||||
public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
|
||||
public static final int JVMTI_THREAD_STATE_SUSPENDED = 0x100000;
|
||||
public static final int JVMTI_THREAD_STATE_INTERRUPTED = 0x200000;
|
||||
public static final int JVMTI_THREAD_STATE_IN_NATIVE = 0x400000;
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.jdi;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
interface LineInfo {
|
||||
|
||||
String liStratum();
|
||||
|
||||
int liLineNumber();
|
||||
|
||||
String liSourceName() throws AbsentInformationException;
|
||||
|
||||
String liSourcePath() throws AbsentInformationException;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user