Merge
This commit is contained in:
commit
351dbc4683
1
.hgtags
1
.hgtags
@ -186,3 +186,4 @@ cdaa6122185f9bf512dcd6600f56bfccc4824e8c jdk8-b61
|
||||
8d9d430b4244b95f5cf1ebe719f834a1ac5d6cd5 jdk8-b62
|
||||
21ee1dd7b809639284900a128b9b656a592ebc7a jdk8-b63
|
||||
70fa4b11f26522e69b51fd652215f60ce350bac3 jdk8-b64
|
||||
a2cf4d4a484378caea2e827ed604b2bbae58bdba jdk8-b65
|
||||
|
@ -186,3 +186,4 @@ e07f499b9dccb529ecf74172cf6ac11a195ec57a jdk8-b60
|
||||
8a3fe0ae06a8cc21347da5a18384b0aa6c2349f5 jdk8-b62
|
||||
3229597524cab4239325bc3602df6c486397a511 jdk8-b63
|
||||
1c8370a55b305d35353346202bde042ba9e8a9fd jdk8-b64
|
||||
b772de306dc24c17f7bd1398531ddeb58723b804 jdk8-b65
|
||||
|
@ -345,7 +345,13 @@ AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
|
||||
[ CONF_NAME=${with_conf_name} ])
|
||||
|
||||
# Test from where we are running configure, in or outside of src root.
|
||||
if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
|
||||
# To enable comparison of directories, CURDIR needs to be symlink free
|
||||
# just like SRC_ROOT already is
|
||||
NOSYM_CURDIR="$CURDIR"
|
||||
BASIC_REMOVE_SYMBOLIC_LINKS(NOSYM_CURDIR)
|
||||
if test "x$NOSYM_CURDIR" = "x$SRC_ROOT" || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common" \
|
||||
|| test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/autoconf" \
|
||||
|| test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
|
||||
# We are running configure from the src root.
|
||||
# Create a default ./build/target-variant-debuglevel output root.
|
||||
if test "x${CONF_NAME}" = x; then
|
||||
|
@ -204,7 +204,7 @@ AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
|
||||
#
|
||||
AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
|
||||
[disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
|
||||
[ENABLE_PRECOMPH=${enable_precompiled-headers}], [ENABLE_PRECOMPH=yes])
|
||||
[ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
|
||||
|
||||
USE_PRECOMPILED_HEADER=1
|
||||
if test "x$ENABLE_PRECOMPH" = xno; then
|
||||
@ -214,17 +214,16 @@ fi
|
||||
if test "x$ENABLE_PRECOMPH" = xyes; then
|
||||
# Check that the compiler actually supports precomp headers.
|
||||
if test "x$GCC" = xyes; then
|
||||
AC_MSG_CHECKING([that precompiled headers work])
|
||||
AC_MSG_CHECKING([that precompiled headers work])
|
||||
echo "int alfa();" > conftest.h
|
||||
$CXX -x c++-header conftest.h -o conftest.hpp.gch
|
||||
$CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
|
||||
if test ! -f conftest.hpp.gch; then
|
||||
echo Precompiled header is not working!
|
||||
USE_PRECOMPILED_HEADER=0
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
rm -f conftest.h
|
||||
rm -f conftest.h conftest.hpp.gch
|
||||
fi
|
||||
fi
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -95,6 +95,8 @@ EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@
|
||||
EXTRA_CXXFLAGS=@LEGACY_EXTRA_CXXFLAGS@
|
||||
EXTRA_LDFLAGS=@LEGACY_EXTRA_LDFLAGS@
|
||||
|
||||
USE_PRECOMPILED_HEADER=@USE_PRECOMPILED_HEADER@
|
||||
|
||||
# Sneak this in via the spec.gmk file, since we don't want to mess around too much with the Hotspot make files.
|
||||
# This is needed to get the LOG setting to work properly.
|
||||
include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
|
||||
|
@ -601,11 +601,16 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
|
||||
# statically link libstdc++ before C++ ABI is stablized on Linux unless
|
||||
# dynamic build is configured on command line.
|
||||
#
|
||||
AC_ARG_ENABLE([static-link-stdc++], [AS_HELP_STRING([--disable-static-link-stdc++],
|
||||
[disable static linking of the C++ runtime on Linux @<:@enabled@:>@])],,
|
||||
[
|
||||
enable_static_link_stdc__=yes
|
||||
])
|
||||
AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
|
||||
[force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
|
||||
[
|
||||
if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
|
||||
&& test "x$with_stdc__lib" != xdefault; then
|
||||
AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
|
||||
fi
|
||||
],
|
||||
[with_stdc__lib=default]
|
||||
)
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
# Test if -lstdc++ works.
|
||||
@ -636,31 +641,31 @@ if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
AC_LANG_POP(C++)
|
||||
AC_MSG_RESULT([$has_static_libstdcxx])
|
||||
|
||||
if test "x$has_static_libcxx" = xno && test "x$has_dynamic_libcxx" = xno; then
|
||||
AC_MSG_ERROR([I cannot link to stdc++! Neither dynamically nor statically.])
|
||||
if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then
|
||||
AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!])
|
||||
fi
|
||||
|
||||
if test "x$enable_static_link_stdc__" = xyes && test "x$has_static_libstdcxx" = xno; then
|
||||
AC_MSG_NOTICE([Static linking of libstdc++ was not possible reverting to dynamic linking.])
|
||||
enable_static_link_stdc__=no
|
||||
if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
|
||||
AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
|
||||
fi
|
||||
|
||||
if test "x$enable_static_link_stdc__" = xno && test "x$has_dynamic_libstdcxx" = xno; then
|
||||
AC_MSG_NOTICE([Dynamic linking of libstdc++ was not possible reverting to static linking.])
|
||||
enable_static_link_stdc__=yes
|
||||
if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then
|
||||
AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([how to link with libstdc++])
|
||||
if test "x$enable_static_link_stdc__" = xyes; then
|
||||
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
|
||||
LDCXX="$CC"
|
||||
STATIC_CXX_SETTING="STATIC_CXX=true"
|
||||
AC_MSG_RESULT([static])
|
||||
else
|
||||
# If dynamic was requested, it's available since it would fail above otherwise.
|
||||
# If dynamic wasn't requested, go with static unless it isn't available.
|
||||
if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno; then
|
||||
LIBCXX="$LIBCXX -lstdc++"
|
||||
LDCXX="$CXX"
|
||||
STATIC_CXX_SETTING="STATIC_CXX=false"
|
||||
AC_MSG_RESULT([dynamic])
|
||||
else
|
||||
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
|
||||
LDCXX="$CC"
|
||||
STATIC_CXX_SETTING="STATIC_CXX=true"
|
||||
AC_MSG_RESULT([static])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(STATIC_CXX_SETTING)
|
||||
|
@ -437,7 +437,10 @@ fi
|
||||
# full debug symbols are enabled.
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
|
||||
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
||||
# Only call fixup if objcopy was found.
|
||||
if test -n "$OBJCOPY"; then
|
||||
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
|
||||
@ -935,10 +938,19 @@ else
|
||||
fi
|
||||
fi
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
|
||||
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \
|
||||
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \
|
||||
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
|
||||
|
||||
# On some platforms (mac) the linker warns about non existing -L dirs.
|
||||
# Add server first if available. Linking aginst client does not always produce the same results.
|
||||
# Only add client dir if client is being built. Default to server for other variants.
|
||||
if test "x$JVM_VARIANT_SERVER" = xtrue; then
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
|
||||
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
|
||||
else
|
||||
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
|
||||
fi
|
||||
|
||||
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
|
||||
if test "x$COMPILER_NAME" = xossc; then
|
||||
LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
|
||||
|
@ -283,13 +283,14 @@ compare_general_files() {
|
||||
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
|
||||
! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
|
||||
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
|
||||
! -name "*.lib" ! -name "*.war" \
|
||||
! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
|
||||
| $GREP -v "./bin/" | $SORT | $FILTER)
|
||||
|
||||
echo General files...
|
||||
for f in $GENERAL_FILES
|
||||
do
|
||||
if [ -e $OTHER_DIR/$f ]; then
|
||||
SUFFIX="${f##*.}"
|
||||
if [ "$(basename $f)" = "release" ]; then
|
||||
# Ignore differences in change numbers in release file.
|
||||
OTHER_FILE=$WORK_DIR/$f.other
|
||||
@ -298,6 +299,22 @@ compare_general_files() {
|
||||
$MKDIR -p $(dirname $THIS_FILE)
|
||||
$CAT $OTHER_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $OTHER_FILE
|
||||
$CAT $THIS_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $THIS_FILE
|
||||
elif [ "x$SUFFIX" = "xhtml" ]; then
|
||||
# Ignore time stamps in docs files
|
||||
OTHER_FILE=$WORK_DIR/$f.other
|
||||
THIS_FILE=$WORK_DIR/$f.this
|
||||
$MKDIR -p $(dirname $OTHER_FILE)
|
||||
$MKDIR -p $(dirname $THIS_FILE)
|
||||
$CAT $OTHER_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
|
||||
-e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
|
||||
-e 's/\(Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday\), [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* \(AM\|PM\) [A-Z][A-Z]*/(removed)/' \
|
||||
-e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
|
||||
> $OTHER_FILE
|
||||
$CAT $THIS_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
|
||||
-e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
|
||||
-e 's/\(Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday\), [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* \(AM\|PM\) [A-Z][A-Z]*/(removed)/' \
|
||||
-e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
|
||||
> $THIS_FILE
|
||||
else
|
||||
OTHER_FILE=$OTHER_DIR/$f
|
||||
THIS_FILE=$THIS_DIR/$f
|
||||
@ -611,10 +628,19 @@ compare_bin_file() {
|
||||
DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE)
|
||||
DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
|
||||
SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
|
||||
if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] && [ "$DIFF_SIZE_REL" -lt 102 ]; then
|
||||
if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \
|
||||
&& [ "$DIFF_SIZE_REL" -lt 102 ]; then
|
||||
SIZE_MSG="($SIZE_MSG)"
|
||||
DIFF_SIZE=
|
||||
elif [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_NUM" = 512 ]; then
|
||||
elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
|
||||
&& [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
|
||||
&& [ "$DIFF_SIZE_NUM" = 512 ]; then
|
||||
# On windows, size of binaries increase in 512 increments.
|
||||
SIZE_MSG="($SIZE_MSG)"
|
||||
DIFF_SIZE=
|
||||
elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
|
||||
&& [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
|
||||
&& [ "$DIFF_SIZE_NUM" = -512 ]; then
|
||||
# On windows, size of binaries increase in 512 increments.
|
||||
SIZE_MSG="($SIZE_MSG)"
|
||||
DIFF_SIZE=
|
||||
@ -840,7 +866,7 @@ compare_all_libs() {
|
||||
OTHER_DIR=$2
|
||||
WORK_DIR=$3
|
||||
|
||||
LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' \) | $SORT | $FILTER)
|
||||
LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER)
|
||||
|
||||
if [ -n "$LIBS" ]; then
|
||||
echo Libraries...
|
||||
@ -1102,6 +1128,22 @@ if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
|
||||
echo "Skipping bundle compare!"
|
||||
fi
|
||||
|
||||
if [ -d "$THIS/docs" ]; then
|
||||
THIS_DOCS="$THIS/docs"
|
||||
fi
|
||||
|
||||
if [ -d "$OTHER/docs" ]; then
|
||||
OTHER_DOCS="$OTHER/docs"
|
||||
fi
|
||||
|
||||
if [ -z "$THIS_DOCS" ]; then
|
||||
echo "WARNING! Docs haven't been built and won't be compared."
|
||||
fi
|
||||
|
||||
if [ -z "$OTHER_DOCS" ]; then
|
||||
echo "WARNING! Other build doesn't contain docs, skipping doc compare."
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
# Do the work
|
||||
|
||||
@ -1139,6 +1181,12 @@ if [ "$CMP_NAMES" = "true" ]; then
|
||||
echo -n "J2RE Bundle "
|
||||
compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
|
||||
fi
|
||||
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
|
||||
echo -n "Docs "
|
||||
compare_dirs $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
|
||||
echo -n "Docs "
|
||||
compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CMP_PERMS" = "true" ]; then
|
||||
@ -1202,6 +1250,10 @@ if [ "$CMP_GENERAL" = "true" ]; then
|
||||
echo -n "J2RE Bundle "
|
||||
compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
|
||||
fi
|
||||
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
|
||||
echo -n "Docs "
|
||||
compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CMP_ZIPS" = "true" ]; then
|
||||
@ -1218,7 +1270,12 @@ fi
|
||||
|
||||
if [ "$CMP_LIBS" = "true" ]; then
|
||||
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
|
||||
echo -n "J2SDK "
|
||||
compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
|
||||
if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
|
||||
echo -n "J2RE "
|
||||
compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
|
||||
fi
|
||||
fi
|
||||
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
|
||||
echo -n "Bundle "
|
||||
|
@ -291,6 +291,14 @@ ACCEPTED_SMALL_SIZE_DIFF="
|
||||
./jre/plugin/i386/ns4/libjavaplugin.so
|
||||
./jre/plugin/i386/ns7/libjavaplugin_oji.so
|
||||
./jre/lib/i386/server/libjvm.so
|
||||
./jre/lib/i386/client/64/libjvm_db.so
|
||||
./jre/lib/i386/client/64/libjvm_dtrace.so
|
||||
./jre/lib/i386/client/libjvm_db.so
|
||||
./jre/lib/i386/client/libjvm_dtrace.so
|
||||
./jre/lib/i386/server/64/libjvm_db.so
|
||||
./jre/lib/i386/server/64/libjvm_dtrace.so
|
||||
./jre/lib/i386/server/libjvm_db.so
|
||||
./jre/lib/i386/server/libjvm_dtrace.so
|
||||
./bin/appletviewer
|
||||
./bin/extcheck
|
||||
./bin/idlj
|
||||
@ -348,7 +356,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
|
||||
SKIP_FULLDUMP_DIFF="true"
|
||||
|
||||
# Filter random C++ symbol strings.
|
||||
DIS_DIFF_FILTER="$SED -e s/\.[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g"
|
||||
# Some numbers differ randomly.
|
||||
# Can't use space in these expressions as the shell will mess with them.
|
||||
DIS_DIFF_FILTER="$SED -e s/\.[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g -e s/\([0-9a-f][0-9a-f].\)\{2,8\}[0-9a-f][0-9a-f]/<NUMS>/g -e s/\(0x\)[0-9a-f]*\([,(>]\)/\1<HEX>\2/g -e s/\(0x\)[0-9a-f]*$/\1<HEX>/g -e s/\(\#.\)[0-9a-f]*\(.<\)/\1<HEX>\2/g -e s/[\.A-Za-z0-9%]\{16,16\}$/<BIN>/g"
|
||||
|
||||
fi
|
||||
|
||||
@ -426,6 +436,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
|
||||
./jre/lib/amd64/libzip.so
|
||||
./jre/lib/amd64/server/64/libjvm_db.so
|
||||
./jre/lib/amd64/server/64/libjvm_dtrace.so
|
||||
./jre/lib/amd64/server/libjvm.so
|
||||
./jre/lib/amd64/server/libjvm_db.so
|
||||
./jre/lib/amd64/server/libjvm_dtrace.so
|
||||
./bin/amd64/appletviewer
|
||||
./bin/amd64/extcheck
|
||||
./bin/amd64/idlj
|
||||
@ -480,7 +493,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
|
||||
SKIP_FULLDUMP_DIFF="true"
|
||||
|
||||
# Filter random C++ symbol strings.
|
||||
DIS_DIFF_FILTER="$SED -e s/\.[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g"
|
||||
# Some numbers differ randomly.
|
||||
# Can't use space in these expressions as the shell will mess with them.
|
||||
DIS_DIFF_FILTER="$SED -e s/\.[a-zA-Z0-9_\$]\{15,15\}/<SYM>/g -e s/\([0-9a-f][0-9a-f].\)\{2,8\}[0-9a-f][0-9a-f]/<NUMS>/g -e s/\(0x\)[0-9a-f]*\([,(>]\)/\1<HEX>\2/g -e s/\(0x\)[0-9a-f]*$/\1<HEX>/g -e s/\(\#.\)[0-9a-f]*\(.<\)/\1<HEX>\2/g -e s/[\.A-Za-z0-9%]\{16,16\}$/<BIN>/g"
|
||||
|
||||
fi
|
||||
|
||||
@ -881,6 +896,7 @@ ACCEPTED_JARZIP_CONTENTS="
|
||||
|
||||
KNOWN_BIN_DIFF="
|
||||
./jre/lib/libJObjC.dylib
|
||||
./lib/libJObjC.dylib
|
||||
"
|
||||
|
||||
ACCEPTED_BIN_DIFF="
|
||||
@ -932,26 +948,34 @@ ACCEPTED_BIN_DIFF="
|
||||
./jre/bin/tnameserv
|
||||
./jre/lib/libsaproc.dylib
|
||||
./jre/lib/server/libjvm.dylib
|
||||
./lib/libsaproc.dylib
|
||||
./lib/server/libjvm.dylib
|
||||
./lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel
|
||||
"
|
||||
|
||||
KNOWN_SIZE_DIFF="
|
||||
./jre/lib/libJObjC.dylib
|
||||
./lib/libJObjC.dylib
|
||||
"
|
||||
|
||||
SORT_SYMBOLS="
|
||||
./jre/lib/libJObjC.dylib
|
||||
./lib/libJObjC.dylib
|
||||
"
|
||||
|
||||
KNOWN_SYM_DIFF="
|
||||
./jre/lib/libJObjC.dylib
|
||||
./lib/libJObjC.dylib
|
||||
"
|
||||
|
||||
KNOWN_ELF_DIFF="
|
||||
./jre/lib/libJObjC.dylib
|
||||
./lib/libJObjC.dylib
|
||||
"
|
||||
|
||||
KNOWN_DIS_DIFF="
|
||||
./jre/lib/libJObjC.dylib
|
||||
./lib/libJObjC.dylib
|
||||
"
|
||||
|
||||
fi
|
||||
|
@ -165,7 +165,7 @@ $(OUTPUT_ROOT)/source_tips: FRC
|
||||
|
||||
|
||||
# Remove everything, except the output from configure.
|
||||
clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
|
||||
clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build clean-docs
|
||||
@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
|
||||
@$(ECHO) Cleaned all build artifacts.
|
||||
|
||||
@ -201,6 +201,9 @@ clean-overlay-images:
|
||||
$(call CleanComponent,overlay-images)
|
||||
clean-bootcycle-build:
|
||||
$(call CleanComponent,bootcycle-build)
|
||||
clean-docs:
|
||||
$(call CleanComponent,docs)
|
||||
$(call CleanComponent,docstemp)
|
||||
|
||||
.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
|
||||
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
|
||||
|
@ -142,7 +142,7 @@ endef
|
||||
define TargetExit
|
||||
$(call RecordEndTime,$(patsubst %-only,%,$@))
|
||||
$(BUILD_LOG_WRAPPER) $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
|
||||
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d " "`"
|
||||
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`"
|
||||
$(call CheckIfMakeAtEnd)
|
||||
endef
|
||||
|
||||
|
@ -50,17 +50,12 @@ BUILD_NUMBER=$(JDK_BUILD_NUMBER)
|
||||
|
||||
BOOT_JAVA_CMD=$(JAVA)
|
||||
|
||||
# Langtools
|
||||
JAVAC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javac.jar
|
||||
JAVADOC_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/javadoc.jar
|
||||
DOCLETS_JAR = $(LANGTOOLS_DIST)/bootstrap/lib/doclets.jar
|
||||
JAVADOC_CMD = $(BOOT_JAVA_CMD) \
|
||||
-Xmx1024m \
|
||||
-Djava.awt.headless=true \
|
||||
"-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
|
||||
-jar $(JAVADOC_JAR)
|
||||
|
||||
JAVADOC_CMD = javadoc
|
||||
"-Xbootclasspath/p:$(JAVADOC_JAR)" \
|
||||
-jar $(JAVADOC_JAR) -bootclasspath $(JDK_OUTPUTDIR)/classes
|
||||
|
||||
# Copyright year for beginning of Java and some of the apis
|
||||
# (Needed when creating the javadocs)
|
||||
@ -113,7 +108,8 @@ DOCSDIR_URL = {@docroot}/$(GET2DOCSDIR)
|
||||
|
||||
# Url to copyright html file
|
||||
COPYRIGHT_URL-7 = $(DOCSDIR_URL)/legal/cpyr.html
|
||||
COPYRIGHT_URL-8 = $(DOCSDIR_URL)/legal/cpyr.html
|
||||
# This isn't added in old build yet.
|
||||
#COPYRIGHT_URL-8 = $(DOCSDIR_URL)/legal/cpyr.html
|
||||
COPYRIGHT_URL = $(COPYRIGHT_URL-$(JDK_MINOR_VERSION))
|
||||
|
||||
# Url to bug filing site
|
||||
@ -125,7 +121,8 @@ BUG_SUBMIT_LINE = <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
|
||||
# Url to devdocs page
|
||||
# Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
|
||||
DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
|
||||
DEV_DOCS_URL-8 = http://download.oracle.com/javase/7/docs/index.html
|
||||
# This isn't added in old build yet.
|
||||
#DEV_DOCS_URL-8 = http://download.oracle.com/javase/7/docs/index.html
|
||||
DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
|
||||
DOCS_BASE_URL = http://download.oracle.com/javase/7/docs
|
||||
|
||||
@ -142,9 +139,10 @@ $(FULL_COMPANY_NAME) in the US and other countries.
|
||||
# Otherwise, you get "No packages or classes specified." due
|
||||
# to $(CLASSPATH_SEPARATOR) being interpreted as an end of
|
||||
# command (newline or shell ; character)
|
||||
ALL_SOURCE_DIRS = $(JDK_IMPSRC) \
|
||||
ALL_SOURCE_DIRS = $(JDK_SHARE_CLASSES) \
|
||||
$(JDK_IMPSRC) \
|
||||
$(JDK_GENSRC) \
|
||||
$(JDK_SHARE_CLASSES) \
|
||||
$(JDK_OUTPUTDIR)/gendocsrc_rmic \
|
||||
$(JDK_TOPDIR)/src/solaris/classes \
|
||||
$(JDK_TOPDIR)/src/windows/classes \
|
||||
$(JDK_SHARE_SRC)/doc/stub
|
||||
@ -440,7 +438,7 @@ docletapidocs: $(DOCLETAPI_INDEX_FILE)
|
||||
$(DOCLETAPI_INDEX_FILE): GET2DOCSDIR=$(DOCLETAPI2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE)
|
||||
$(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(DOCLETAPI_OPTIONS_FILE),$(DOCLETAPI_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -481,7 +479,7 @@ TAGLETAPI_BOTTOM := $(call CommonTrademarkBottom,$(TAGLETAPI_FIRST_COPYRIGHT_Y
|
||||
TAGLETAPI_TEMPDIR = $(DOCSTMPDIR)/taglets_temp
|
||||
|
||||
# The index.html, options, and packages files
|
||||
TAGLETAPI_INDEX_FILE = $(TAGLETAPI_DOCDIR)/com/sun/tools/doclets/Taglet.html
|
||||
TAGLETAPI_INDEX_FILE = $(TAGLETAPI_DOCDIR)/index.html
|
||||
TAGLETAPI_OPTIONS_FILE = $(DOCSTMPDIR)/tagletapi.options
|
||||
TAGLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/tagletapi.packages
|
||||
|
||||
@ -491,7 +489,7 @@ tagletapidocs: $(TAGLETAPI_INDEX_FILE)
|
||||
$(TAGLETAPI_INDEX_FILE): GET2DOCSDIR=$(TAGLETAPI2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE)
|
||||
$(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(RM) -r $(TAGLETAPI_TEMPDIR)
|
||||
$(MKDIR) -p $(TAGLETAPI_TEMPDIR)
|
||||
@ -517,9 +515,7 @@ $(TAGLETAPI_OPTIONS_FILE):
|
||||
# Create a file with the package names in it
|
||||
$(TAGLETAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(TAGLETAPI_PKGS))
|
||||
$(prep-target)
|
||||
$(call PackageFilter,$(TAGLETAPI_PKGS))
|
||||
$(GREP) "$(TAGLETAPI_FILE)" $@ > $@.tmp
|
||||
$(MV) $@.tmp $@
|
||||
@($(ECHO) "$(JDK_IMPSRC)/$(TAGLETAPI_FILE)" ) > $@
|
||||
|
||||
#############################################################
|
||||
#
|
||||
@ -549,7 +545,7 @@ domapidocs: $(DOMAPI_INDEX_FILE)
|
||||
$(DOMAPI_INDEX_FILE): GET2DOCSDIR=$(DOMAPI2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE)
|
||||
$(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(DOMAPI_OPTIONS_FILE),$(DOMAPI_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -611,7 +607,7 @@ jdidocs: $(JDI_INDEX_FILE)
|
||||
$(JDI_INDEX_FILE): GET2DOCSDIR=$(JDI2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE)
|
||||
$(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(JDI_OPTIONS_FILE),$(JDI_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -698,7 +694,7 @@ jaasdocs: $(JAAS_INDEX_FILE)
|
||||
$(JAAS_INDEX_FILE): GET2DOCSDIR=$(JAAS2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE)
|
||||
$(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(JAAS_OPTIONS_FILE),$(JAAS_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -750,7 +746,7 @@ jgssdocs: $(JGSS_INDEX_FILE)
|
||||
$(JGSS_INDEX_FILE): GET2DOCSDIR=$(JGSS2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE)
|
||||
$(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(JGSS_OPTIONS_FILE),$(JGSS_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -802,7 +798,7 @@ smartcardiodocs: $(SMARTCARDIO_INDEX_FILE)
|
||||
$(SMARTCARDIO_INDEX_FILE): GET2DOCSDIR=$(SMARTCARDIO2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FILE)
|
||||
$(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(SMARTCARDIO_OPTIONS_FILE),$(SMARTCARDIO_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -852,7 +848,7 @@ httpserverdocs: $(HTTPSERVER_INDEX_HTML)
|
||||
$(HTTPSERVER_INDEX_HTML): GET2DOCSDIR=$(HTTPSERVER2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE)
|
||||
$(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(HTTPSERVER_OPTIONS_FILE),$(HTTPSERVER_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -887,7 +883,7 @@ ALL_OTHER_TARGETS += mgmtdocs
|
||||
MGMT_DOCDIR := $(JRE_API_DOCSDIR)/management/extension
|
||||
MGMT2COREAPI := ../../$(JDKJRE2COREAPI)
|
||||
JVM_MIB_NAME := JVM-MANAGEMENT-MIB.mib
|
||||
JVM_MIB_SRC := $(CLOSED_SRC)/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
|
||||
JVM_MIB_SRC := $(JDK_TOPDIR)/src/closed/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
|
||||
MGMT_DOCTITLE := Monitoring and Management Interface for the Java$(TRADEMARK) Platform
|
||||
MGMT_WINDOWTITLE := Monitoring and Management Interface for the Java Platform
|
||||
MGMT_HEADER := <strong>Monitoring and Management Interface for the Java Platform</strong>
|
||||
@ -906,7 +902,7 @@ mgmtdocs: $(MGMT_INDEX_FILE)
|
||||
$(MGMT_INDEX_FILE): GET2DOCSDIR=$(MGMT2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE)
|
||||
$(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
@if [ -f $(JVM_MIB_SRC) ] ; then \
|
||||
$(ECHO) "$(CP) $(JVM_MIB_SRC) $(@D)/.."; \
|
||||
@ -963,7 +959,7 @@ attachdocs: $(ATTACH_INDEX_HTML)
|
||||
$(ATTACH_INDEX_HTML): GET2DOCSDIR=$(ATTACH2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE)
|
||||
$(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(ATTACH_OPTIONS_FILE),$(ATTACH_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -1013,7 +1009,7 @@ jconsoledocs: $(JCONSOLE_INDEX_HTML)
|
||||
$(JCONSOLE_INDEX_HTML): GET2DOCSDIR=$(JCONSOLE2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE)
|
||||
$(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(JCONSOLE_OPTIONS_FILE),$(JCONSOLE_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -1065,7 +1061,7 @@ treeapidocs: $(TREEAPI_INDEX_HTML)
|
||||
$(TREEAPI_INDEX_HTML): GET2DOCSDIR=$(TREEAPI2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE)
|
||||
$(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(TREEAPI_OPTIONS_FILE),$(TREEAPI_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
@ -1116,7 +1112,7 @@ sctpdocs: $(SCTPAPI_INDEX_HTML)
|
||||
$(SCTPAPI_INDEX_HTML): GET2DOCSDIR=$(SCTPAPI2COREAPI)/..
|
||||
|
||||
# Run javadoc if the index file is out of date or missing
|
||||
$(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE)
|
||||
$(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE) coredocs
|
||||
$(prep-javadoc)
|
||||
$(call JavadocSummary,$(SCTPAPI_OPTIONS_FILE),$(SCTPAPI_PACKAGES_FILE))
|
||||
$(JAVADOC_CMD) -d $(@D) \
|
||||
|
@ -186,3 +186,4 @@ d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
|
||||
08afb9c6f44f11c3595b01fd0985db64b29834dd jdk8-b62
|
||||
6ccbf67b68bfed1ab9c44ab8748a5bdc7df33506 jdk8-b63
|
||||
54d599a5b4aad83c235d590652fc81f41c2824fb jdk8-b64
|
||||
5132f7900a8f0c30c3ca7f7a32f9433f4fee7745 jdk8-b65
|
||||
|
@ -293,3 +293,5 @@ acabb5c282f59be7e3238920b2ea06b684ab68f7 jdk8-b63
|
||||
8cb93eadfb6dcab88d91b8e2cd3e0e07d0ac4048 hs25-b08
|
||||
5920f72e799c8133d1066c4a62fa1fafcb729966 jdk8-b64
|
||||
b4ee7b773144a88af8b6b92e4384dea82cb948d8 hs25-b09
|
||||
0f7290a03b24bd562583fa325d3566c21c51fb94 jdk8-b65
|
||||
cfc5309f03b7bd6c1567618b63cf1fc74c0f2a8f hs25-b10
|
||||
|
41
hotspot/agent/doc/c2replay.html
Normal file
41
hotspot/agent/doc/c2replay.html
Normal file
@ -0,0 +1,41 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
C2 Replay
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>C2 compiler replay</h1>
|
||||
<p>
|
||||
The C2 compiler replay is a function to repeat the compiling process from a crashed java process in compiled method<br>
|
||||
This function only exists in debug version of VM
|
||||
</p>
|
||||
<h2>Usage</h2>
|
||||
<pre>
|
||||
First, use SA to attach to the core file, if suceeded, do
|
||||
clhsdb>dumpreplaydata <address> | -a | <thread_id> [> replay.txt]
|
||||
create file replay.txt, address is address of Method, or nmethod(CodeBlob)
|
||||
clhsdb>buildreplayjars [all | boot | app]
|
||||
create files:
|
||||
all:
|
||||
app.jar, boot.jar
|
||||
boot:
|
||||
boot.jar
|
||||
app:
|
||||
app.jar
|
||||
exit SA now.
|
||||
Second, use the obtained replay text file, replay.txt and jar files, app.jar and boot.jar, using debug version of java
|
||||
java -Xbootclasspath/p:boot.jar -cp app.jar -XX:ReplayDataFile=<datafile> -XX:+ReplayCompiles ....
|
||||
This will replay the compiling process.
|
||||
|
||||
With ReplayCompiles, the replay will recompile all the methods in app.jar, and in boot.jar to emulate the process in java app.
|
||||
|
||||
notes:
|
||||
1) Most time, we don't need the boot.jar which is the classes loaded from JDK. It will be only modified when an agent(JVMDI) is running and modifies the classes.
|
||||
2) If encounter error as "<flag>" not found, that means the SA is using a VMStructs which is different from the one with corefile. In this case, SA has a utility tool vmstructsdump which is located at agent/src/os/<os>/proc/<os_platform>
|
||||
|
||||
Use this tool to dump VM type library:
|
||||
vmstructsdump libjvm.so > <type_name>.db
|
||||
|
||||
set env SA_TYPEDB=<type_name>.db (refer different shell for set envs)
|
@ -37,12 +37,19 @@ Each CLHSDB command can have zero or more arguments and optionally end with outp
|
||||
Available commands:
|
||||
assert true | false <font color="red">turn on/off asserts in SA code</font>
|
||||
attach pid | exec core <font color="red">attach SA to a process or core</font>
|
||||
buildreplayjars [all | boot | app] <font color="red">build jars for replay, boot.jar for bootclasses, app.jar for application classes</font>
|
||||
class name <font color="red">find a Java class from debuggee and print oop</font>
|
||||
classes <font color="red">print all loaded Java classes with Klass*</font>
|
||||
detach <font color="red">detach SA from current target</font>
|
||||
dis address [ length ] <font color="red">disassemble (sparc/x86) specified number of instructions from given address</font>
|
||||
dissemble address <font color="red">disassemble nmethod</font>
|
||||
dumpcfg -a | id <font color="red">Dump the PhaseCFG for every compiler thread that has one live</font>
|
||||
dumpclass { address | name } [ directory ] <font color="red">dump .class file for given Klass* or class name</font>
|
||||
dumpcodecache <font color="red">dump codecache contents</font>
|
||||
dumpheap [ file ] <font color="red">dump heap in hprof binary format</font>
|
||||
dumpideal -a | id <font color="red">dump ideal graph like debug flag -XX:+PrintIdeal</font>
|
||||
dumpilt -a | id <font color="red">dump inline tree for C2 compilation</font>
|
||||
dumpreplaydata <address> | -a | <thread_id> [>replay.txt] <font color="red">dump replay data into a file</font>
|
||||
echo [ true | false ] <font color="red">turn on/off command echo mode</font>
|
||||
examine [ address/count ] | [ address,address] <font color="red">show contents of memory from given address</font>
|
||||
field [ type [ name fieldtype isStatic offset address ] ] <font color="red">print info about a field of HotSpot type</font>
|
||||
@ -51,29 +58,35 @@ Available commands:
|
||||
help [ command ] <font color="red">print help message for all commands or just given command</font>
|
||||
history <font color="red">show command history. usual !command-number syntax works.</font>
|
||||
inspect expression <font color="red">inspect a given oop</font>
|
||||
intConstant [ name [ value ] ] <font color="red">print out hotspot integer constant(s)</font>
|
||||
jdis address <font color="red">show bytecode disassembly of a given Method*</font>
|
||||
jhisto <font color="red">show Java heap histogram</font>
|
||||
jseval script <font color="red">evaluate a given string as JavaScript code</font>
|
||||
jsload file <font color="red">load and evaluate a JavaScript file</font>
|
||||
jstack [-v] <font color="red">show Java stack trace of all Java threads. -v is verbose mode</font>
|
||||
livenmethods <font color="red">show all live nmethods</font>
|
||||
longConstant [ name [ value ] ] <font color="red">print out hotspot long constant(s)s</font>
|
||||
mem address [ length ] <font color="red">show contents of memory -- also shows closest ELF/COFF symbol if found</font>
|
||||
pmap <font color="red">show Solaris pmap-like output</font>
|
||||
print expression <font color="red">print given Klass*, Method* or arbitrary address</font>
|
||||
printas type expression <font color="red">print given address as given HotSpot type. eg. print JavaThread <address></font>
|
||||
printmdo -a | expression <font color="red">print method data oop</font>
|
||||
printstatics [ type ] <font color="red">print static fields of given HotSpot type (or all types if none specified)</font>
|
||||
pstack [-v] <font color="red">show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode</font>
|
||||
quit <font color="red">quit CLHSDB tool</font>
|
||||
reattach <font color="red">detach and re-attach SA to current target</font>
|
||||
revptrs <font color="red">find liveness of oops</font>
|
||||
scanoops start end [ type ] <font color="red">scan a Oop from given start to end address</font>
|
||||
search [ heap | codecache | threads ] value <font color="red">search a value in heap or codecache or threads</font>
|
||||
source filename <font color="red">load and execute CLHSDB commands from given file</font>
|
||||
symbol name <font color="red">show address of a given ELF/COFF symbol</font>
|
||||
sysprops <font color="red">show all Java System properties</font>
|
||||
thread id <font color="red">show thread of id</font>
|
||||
threads <font color="red">show all Java threads</font>
|
||||
tokenize ...
|
||||
type [ type [ name super isOop isInteger isUnsigned size ] ] <font color="red">show info. on HotSpot type</font>
|
||||
universe <font color="red">print gc universe</font>
|
||||
vmstructsdump <font color="red">dump hotspot type library in text</font>
|
||||
verbose true | false <font color="red">turn on/off verbose mode</font>
|
||||
versioncheck [ true | false ] <font color="red">turn on/off debuggee VM version check</font>
|
||||
whatis address <font color="red">print info about any arbitrary address</font>
|
||||
@ -114,5 +127,11 @@ hsdb> jsload test.js
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<h3>C2 Compilation Replay</h3>
|
||||
<p>
|
||||
When a java process crashes in compiled method, usually a core file is saved.
|
||||
The C2 replay function can reproduce the compiling process in the core.
|
||||
<a href="c2replay.html">c2replay.html</a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -220,6 +220,12 @@ These scripts are used to run SA remotely.
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>C2 Compilation Replay</h3>
|
||||
<p>
|
||||
When a java process crashes in compiled method, usually a core file is saved.
|
||||
The C2 replay function can reproduce the compiling process in the core.
|
||||
<a href="c2replay.html">c2replay.html</a>
|
||||
|
||||
<h3>Debugging transported core dumps</h3>
|
||||
<p>
|
||||
When a core dump is moved from the machine where it was produced to a
|
||||
|
@ -58,10 +58,8 @@ sun.jvm.hotspot.debugger.cdbg.basic \
|
||||
sun.jvm.hotspot.debugger.cdbg.basic.amd64 \
|
||||
sun.jvm.hotspot.debugger.cdbg.basic.x86 \
|
||||
sun.jvm.hotspot.debugger.dummy \
|
||||
sun.jvm.hotspot.debugger.ia64 \
|
||||
sun.jvm.hotspot.debugger.linux \
|
||||
sun.jvm.hotspot.debugger.linux.amd64 \
|
||||
sun.jvm.hotspot.debugger.linux.ia64 \
|
||||
sun.jvm.hotspot.debugger.linux.x86 \
|
||||
sun.jvm.hotspot.debugger.posix \
|
||||
sun.jvm.hotspot.debugger.posix.elf \
|
||||
@ -77,7 +75,6 @@ sun.jvm.hotspot.debugger.sparc \
|
||||
sun.jvm.hotspot.debugger.win32.coff \
|
||||
sun.jvm.hotspot.debugger.windbg \
|
||||
sun.jvm.hotspot.debugger.windbg.amd64 \
|
||||
sun.jvm.hotspot.debugger.windbg.ia64 \
|
||||
sun.jvm.hotspot.debugger.windbg.x86 \
|
||||
sun.jvm.hotspot.debugger.x86 \
|
||||
sun.jvm.hotspot.gc_implementation \
|
||||
@ -97,10 +94,8 @@ sun.jvm.hotspot.runtime.amd64 \
|
||||
sun.jvm.hotspot.runtime.bsd \
|
||||
sun.jvm.hotspot.runtime.bsd_amd64 \
|
||||
sun.jvm.hotspot.runtime.bsd_x86 \
|
||||
sun.jvm.hotspot.runtime.ia64 \
|
||||
sun.jvm.hotspot.runtime.linux \
|
||||
sun.jvm.hotspot.runtime.linux_amd64 \
|
||||
sun.jvm.hotspot.runtime.linux_ia64 \
|
||||
sun.jvm.hotspot.runtime.linux_sparc \
|
||||
sun.jvm.hotspot.runtime.linux_x86 \
|
||||
sun.jvm.hotspot.runtime.posix \
|
||||
@ -109,7 +104,6 @@ sun.jvm.hotspot.runtime.solaris_sparc \
|
||||
sun.jvm.hotspot.runtime.solaris_x86 \
|
||||
sun.jvm.hotspot.runtime.sparc \
|
||||
sun.jvm.hotspot.runtime.win32_amd64 \
|
||||
sun.jvm.hotspot.runtime.win32_ia64 \
|
||||
sun.jvm.hotspot.runtime.win32_x86 \
|
||||
sun.jvm.hotspot.runtime.x86 \
|
||||
sun.jvm.hotspot.tools \
|
||||
@ -152,7 +146,6 @@ sun/jvm/hotspot/debugger/cdbg/basic/*.java \
|
||||
sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \
|
||||
sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \
|
||||
sun/jvm/hotspot/debugger/dummy/*.java \
|
||||
sun/jvm/hotspot/debugger/ia64/*.java \
|
||||
sun/jvm/hotspot/debugger/linux/*.java \
|
||||
sun/jvm/hotspot/debugger/linux/x86/*.java \
|
||||
sun/jvm/hotspot/debugger/posix/*.java \
|
||||
@ -168,7 +161,6 @@ sun/jvm/hotspot/debugger/remote/x86/*.java \
|
||||
sun/jvm/hotspot/debugger/sparc/*.java \
|
||||
sun/jvm/hotspot/debugger/win32/coff/*.java \
|
||||
sun/jvm/hotspot/debugger/windbg/*.java \
|
||||
sun/jvm/hotspot/debugger/windbg/ia64/*.java \
|
||||
sun/jvm/hotspot/debugger/windbg/x86/*.java \
|
||||
sun/jvm/hotspot/debugger/x86/*.java \
|
||||
sun/jvm/hotspot/gc_implementation/g1/*.java \
|
||||
@ -186,10 +178,8 @@ sun/jvm/hotspot/runtime/amd64/*.java \
|
||||
sun/jvm/hotspot/runtime/bsd/*.java \
|
||||
sun/jvm/hotspot/runtime/bsd_amd64/*.java \
|
||||
sun/jvm/hotspot/runtime/bsd_x86/*.java \
|
||||
sun/jvm/hotspot/runtime/ia64/*.java \
|
||||
sun/jvm/hotspot/runtime/linux/*.java \
|
||||
sun/jvm/hotspot/runtime/linux_amd64/*.java \
|
||||
sun/jvm/hotspot/runtime/linux_ia64/*.java \
|
||||
sun/jvm/hotspot/runtime/linux_sparc/*.java \
|
||||
sun/jvm/hotspot/runtime/linux_x86/*.java \
|
||||
sun/jvm/hotspot/runtime/posix/*.java \
|
||||
@ -198,7 +188,6 @@ sun/jvm/hotspot/runtime/solaris_sparc/*.java \
|
||||
sun/jvm/hotspot/runtime/solaris_x86/*.java \
|
||||
sun/jvm/hotspot/runtime/sparc/*.java \
|
||||
sun/jvm/hotspot/runtime/win32_amd64/*.java \
|
||||
sun/jvm/hotspot/runtime/win32_ia64/*.java \
|
||||
sun/jvm/hotspot/runtime/win32_x86/*.java \
|
||||
sun/jvm/hotspot/runtime/x86/*.java \
|
||||
sun/jvm/hotspot/tools/*.java \
|
||||
@ -258,6 +247,7 @@ SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE
|
||||
|
||||
SA_PROPERTIES = $(OUTPUT_DIR)/sa.properties
|
||||
JAVAC = $(JDK_HOME)/bin/javac
|
||||
JAVA = $(JDK_HOME)/bin/java
|
||||
JAVADOC = $(JDK_HOME)/bin/javadoc
|
||||
RMIC = $(JDK_HOME)/bin/rmic
|
||||
|
||||
@ -298,7 +288,7 @@ filelist: $(ALLFILES)
|
||||
|
||||
.PHONY: natives
|
||||
natives:
|
||||
cd ../src/os/`java -classpath $(OUTPUT_DIR) sun.jvm.hotspot.utilities.PlatformInfo`; $(MAKE) all
|
||||
cd ../src/os/`$(JAVA) -classpath $(OUTPUT_DIR) sun.jvm.hotspot.utilities.PlatformInfo`; $(MAKE) all
|
||||
|
||||
.PHONY: sa-jdi.jar
|
||||
sa-jdi.jar:
|
||||
@ -323,5 +313,5 @@ sa.jar:
|
||||
|
||||
clean::
|
||||
rm -rf filelist
|
||||
cd ../src/os/`java -classpath $(OUTPUT_DIR) sun.jvm.hotspot.utilities.PlatformInfo`; $(MAKE) clean
|
||||
cd ../src/os/`$(JAVA) -classpath $(OUTPUT_DIR) sun.jvm.hotspot.utilities.PlatformInfo`; $(MAKE) clean
|
||||
rm -rf $(BUILD_DIR)/*
|
||||
|
@ -33,6 +33,7 @@ import sun.jvm.hotspot.types.Type;
|
||||
import sun.jvm.hotspot.types.Field;
|
||||
import sun.jvm.hotspot.HotSpotTypeDataBase;
|
||||
import sun.jvm.hotspot.types.basic.BasicType;
|
||||
import sun.jvm.hotspot.types.basic.BasicTypeDataBase;
|
||||
import sun.jvm.hotspot.types.CIntegerType;
|
||||
import sun.jvm.hotspot.code.*;
|
||||
import sun.jvm.hotspot.compiler.*;
|
||||
@ -448,6 +449,112 @@ public class CommandProcessor {
|
||||
}
|
||||
}
|
||||
},
|
||||
new Command("dumpreplaydata", "dumpreplaydata { <address > | -a | <thread_id> }", false) {
|
||||
// This is used to dump replay data from ciInstanceKlass, ciMethodData etc
|
||||
// default file name is replay.txt, also if java crashes in compiler
|
||||
// thread, this file will be dumped in error processing.
|
||||
public void doit(Tokens t) {
|
||||
if (t.countTokens() != 1) {
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
String name = t.nextToken();
|
||||
Address a = null;
|
||||
try {
|
||||
a = VM.getVM().getDebugger().parseAddress(name);
|
||||
} catch (NumberFormatException e) { }
|
||||
if (a != null) {
|
||||
// only nmethod, Method, MethodData and InstanceKlass needed to
|
||||
// dump replay data
|
||||
|
||||
CodeBlob cb = VM.getVM().getCodeCache().findBlob(a);
|
||||
if (cb != null && (cb instanceof NMethod)) {
|
||||
((NMethod)cb).dumpReplayData(out);
|
||||
return;
|
||||
}
|
||||
// assume it is Metadata
|
||||
Metadata meta = Metadata.instantiateWrapperFor(a);
|
||||
if (meta != null) {
|
||||
meta.dumpReplayData(out);
|
||||
} else {
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Not an address
|
||||
boolean all = name.equals("-a");
|
||||
Threads threads = VM.getVM().getThreads();
|
||||
for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
thread.printThreadIDOn(new PrintStream(bos));
|
||||
if (all || bos.toString().equals(name)) {
|
||||
if (thread instanceof CompilerThread) {
|
||||
CompilerThread ct = (CompilerThread)thread;
|
||||
ciEnv env = ct.env();
|
||||
if (env != null) {
|
||||
env.dumpReplayData(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Command("buildreplayjars", "buildreplayjars [ all | app | boot ] | [ prefix ]", false) {
|
||||
// This is used to dump jar files of all the classes
|
||||
// loaded in the core. Everything on the bootclasspath
|
||||
// will go in boot.jar and everything else will go in
|
||||
// app.jar. Then the classes can be loaded by the replay
|
||||
// jvm using -Xbootclasspath/p:boot.jar -cp app.jar. boot.jar usually
|
||||
// not needed, unless changed by jvmti.
|
||||
public void doit(Tokens t) {
|
||||
int tcount = t.countTokens();
|
||||
if (tcount > 2) {
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String prefix = "";
|
||||
String option = "all"; // default
|
||||
switch(tcount) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
option = t.nextToken();
|
||||
if (!option.equalsIgnoreCase("all") && !option.equalsIgnoreCase("app") &&
|
||||
!option.equalsIgnoreCase("root")) {
|
||||
prefix = option;
|
||||
option = "all";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
option = t.nextToken();
|
||||
prefix = t.nextToken();
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
if (!option.equalsIgnoreCase("all") && !option.equalsIgnoreCase("app") &&
|
||||
!option.equalsIgnoreCase("boot")) {
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
ClassDump cd = new ClassDump();
|
||||
if (option.equalsIgnoreCase("all") || option.equalsIgnoreCase("boot")) {
|
||||
cd.setClassFilter(new BootFilter());
|
||||
cd.setJarOutput(prefix + "boot.jar");
|
||||
cd.run();
|
||||
}
|
||||
if (option.equalsIgnoreCase("all") || option.equalsIgnoreCase("app")) {
|
||||
cd.setClassFilter(new NonBootFilter());
|
||||
cd.setJarOutput(prefix + "app.jar");
|
||||
cd.run();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
},
|
||||
new Command("findpc", "findpc address", false) {
|
||||
public void doit(Tokens t) {
|
||||
if (t.countTokens() != 1) {
|
||||
|
@ -16,9 +16,9 @@
|
||||
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -50,4 +50,8 @@ public class ciBaseObject extends VMObject {
|
||||
public ciBaseObject(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
out.println("# Unknown ci type " + getAddress().getAddressAt(0));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -16,9 +16,9 @@
|
||||
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -60,4 +60,8 @@ public class ciConstant extends VMObject {
|
||||
public ciConstant(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
// Nothing to be done
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -16,9 +16,9 @@
|
||||
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -74,4 +74,29 @@ public class ciEnv extends VMObject {
|
||||
public CompileTask task() {
|
||||
return new CompileTask(taskField.getValue(this.getAddress()));
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
out.println("JvmtiExport can_access_local_variables " +
|
||||
(JvmtiExport.canAccessLocalVariables() ? '1' : '0'));
|
||||
out.println("JvmtiExport can_hotswap_or_post_breakpoint " +
|
||||
(JvmtiExport.canHotswapOrPostBreakpoint() ? '1' : '0'));
|
||||
out.println("JvmtiExport can_post_on_exceptions " +
|
||||
(JvmtiExport.canPostOnExceptions() ? '1' : '0'));
|
||||
|
||||
GrowableArray<ciMetadata> objects = factory().objects();
|
||||
out.println("# " + objects.length() + " ciObject found");
|
||||
for (int i = 0; i < objects.length(); i++) {
|
||||
ciMetadata o = objects.at(i);
|
||||
out.println("# ciMetadata" + i + " @ " + o);
|
||||
o.dumpReplayData(out);
|
||||
}
|
||||
CompileTask task = task();
|
||||
Method method = task.method();
|
||||
int entryBci = task.osrBci();
|
||||
Klass holder = method.getMethodHolder();
|
||||
out.println("compile " + holder.getName().asString() + " " +
|
||||
OopUtilities.escapeString(method.getName().asString()) + " " +
|
||||
method.getSignature().asString() + " " +
|
||||
entryBci);
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,9 @@
|
||||
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -80,4 +80,84 @@ public class ciInstanceKlass extends ciKlass {
|
||||
public boolean isInitialized() {
|
||||
return initState() == CLASS_STATE_FULLY_INITIALIZED;
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
InstanceKlass ik = (InstanceKlass)getMetadata();
|
||||
ConstantPool cp = ik.getConstants();
|
||||
|
||||
// Try to record related loaded classes
|
||||
Klass sub = ik.getSubklassKlass();
|
||||
while (sub != null) {
|
||||
if (sub instanceof InstanceKlass) {
|
||||
out.println("instanceKlass " + sub.getName().asString());
|
||||
}
|
||||
sub = sub.getNextSiblingKlass();
|
||||
}
|
||||
|
||||
final int length = (int) cp.getLength();
|
||||
out.print("ciInstanceKlass " + name() + " " + (isLinked() ? 1 : 0) + " " + (isInitialized() ? 1 : 0) + " " + length);
|
||||
for (int index = 1; index < length; index++) {
|
||||
out.print(" " + cp.getTags().at(index));
|
||||
}
|
||||
out.println();
|
||||
if (isInitialized()) {
|
||||
Field[] staticFields = ik.getStaticFields();
|
||||
for (int i = 0; i < staticFields.length; i++) {
|
||||
Field f = staticFields[i];
|
||||
Oop mirror = ik.getJavaMirror();
|
||||
if (f.isFinal() && !f.hasInitialValue()) {
|
||||
out.print("staticfield " + name() + " " +
|
||||
OopUtilities.escapeString(f.getID().getName()) + " " +
|
||||
f.getFieldType().getSignature().asString() + " ");
|
||||
if (f instanceof ByteField) {
|
||||
ByteField bf = (ByteField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof BooleanField) {
|
||||
BooleanField bf = (BooleanField)f;
|
||||
out.println(bf.getValue(mirror) ? 1 : 0);
|
||||
} else if (f instanceof ShortField) {
|
||||
ShortField bf = (ShortField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof CharField) {
|
||||
CharField bf = (CharField)f;
|
||||
out.println(bf.getValue(mirror) & 0xffff);
|
||||
} else if (f instanceof IntField) {
|
||||
IntField bf = (IntField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof LongField) {
|
||||
LongField bf = (LongField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof FloatField) {
|
||||
FloatField bf = (FloatField)f;
|
||||
out.println(Float.floatToRawIntBits(bf.getValue(mirror)));
|
||||
} else if (f instanceof DoubleField) {
|
||||
DoubleField bf = (DoubleField)f;
|
||||
out.println(Double.doubleToRawLongBits(bf.getValue(mirror)));
|
||||
} else if (f instanceof OopField) {
|
||||
OopField bf = (OopField)f;
|
||||
Oop value = bf.getValue(mirror);
|
||||
if (value == null) {
|
||||
out.println("null");
|
||||
} else if (value.isInstance()) {
|
||||
Instance inst = (Instance)value;
|
||||
if (inst.isA(SystemDictionary.getStringKlass())) {
|
||||
out.println("\"" + OopUtilities.stringOopToEscapedString(inst) + "\"");
|
||||
} else {
|
||||
out.println(inst.getKlass().getName().asString());
|
||||
}
|
||||
} else if (value.isObjArray()) {
|
||||
ObjArray oa = (ObjArray)value;
|
||||
Klass ek = (ObjArrayKlass)oa.getKlass();
|
||||
out.println(oa.getLength() + " " + ek.getName().asString());
|
||||
} else if (value.isTypeArray()) {
|
||||
TypeArray ta = (TypeArray)value;
|
||||
out.println(ta.getLength());
|
||||
} else {
|
||||
out.println(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,9 @@
|
||||
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -88,4 +88,19 @@ public class ciMethod extends ciMetadata {
|
||||
st.printf(" %s::%s", method.getMethodHolder().getName().asString().replace('/', '.'),
|
||||
method.getName().asString());
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
Method method = (Method)getMetadata();
|
||||
NMethod nm = method.getNativeMethod();
|
||||
Klass holder = method.getMethodHolder();
|
||||
out.println("ciMethod " +
|
||||
holder.getName().asString() + " " +
|
||||
OopUtilities.escapeString(method.getName().asString()) + " " +
|
||||
method.getSignature().asString() + " " +
|
||||
method.getInvocationCounter() + " " +
|
||||
method.getBackedgeCounter() + " " +
|
||||
interpreterInvocationCount() + " " +
|
||||
interpreterThrowoutCount() + " " +
|
||||
instructionsSize());
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,9 @@
|
||||
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -174,4 +174,52 @@ public class ciMethodData extends ciMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
MethodData mdo = (MethodData)getMetadata();
|
||||
Method method = mdo.getMethod();
|
||||
Klass holder = method.getMethodHolder();
|
||||
out.print("ciMethodData " +
|
||||
holder.getName().asString() + " " +
|
||||
OopUtilities.escapeString(method.getName().asString()) + " " +
|
||||
method.getSignature().asString() + " " +
|
||||
state() + " " + currentMileage());
|
||||
byte[] orig = orig();
|
||||
out.print(" orig " + orig.length);
|
||||
for (int i = 0; i < orig.length; i++) {
|
||||
out.print(" " + (orig[i] & 0xff));
|
||||
}
|
||||
|
||||
long[] data = data();
|
||||
out.print(" data " + data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
out.print(" 0x" + Long.toHexString(data[i]));
|
||||
}
|
||||
int count = 0;
|
||||
for (int round = 0; round < 2; round++) {
|
||||
if (round == 1) out.print(" oops " + count);
|
||||
ProfileData pdata = firstData();
|
||||
for ( ; isValid(pdata); pdata = nextData(pdata)) {
|
||||
if (pdata instanceof ciReceiverTypeData) {
|
||||
ciReceiverTypeData vdata = (ciReceiverTypeData)pdata;
|
||||
for (int i = 0; i < vdata.rowLimit(); i++) {
|
||||
ciKlass k = vdata.receiverAt(i);
|
||||
if (k != null) {
|
||||
if (round == 0) count++;
|
||||
else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize) + " " + k.name());
|
||||
}
|
||||
}
|
||||
} else if (pdata instanceof ciVirtualCallData) {
|
||||
ciVirtualCallData vdata = (ciVirtualCallData)pdata;
|
||||
for (int i = 0; i < vdata.rowLimit(); i++) {
|
||||
ciKlass k = vdata.receiverAt(i);
|
||||
if (k != null) {
|
||||
if (round == 0) count++;
|
||||
else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize + " " + k.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.println();
|
||||
}
|
||||
}
|
||||
|
@ -498,6 +498,42 @@ public class NMethod extends CodeBlob {
|
||||
method.getSignature().asString();
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
HashMap h = new HashMap();
|
||||
for (int i = 1; i < getMetadataLength(); i++) {
|
||||
Metadata meta = Metadata.instantiateWrapperFor(getMetadataAt(i));
|
||||
System.err.println(meta);
|
||||
if (h.get(meta) != null) continue;
|
||||
h.put(meta, meta);
|
||||
if (meta instanceof InstanceKlass) {
|
||||
((InstanceKlass)meta).dumpReplayData(out);
|
||||
} else if (meta instanceof Method) {
|
||||
((Method)meta).dumpReplayData(out);
|
||||
MethodData mdo = ((Method)meta).getMethodData();
|
||||
if (mdo != null) {
|
||||
mdo.dumpReplayData(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
Method method = getMethod();
|
||||
if (h.get(method) == null) {
|
||||
method.dumpReplayData(out);
|
||||
MethodData mdo = method.getMethodData();
|
||||
if (mdo != null) {
|
||||
mdo.dumpReplayData(out);
|
||||
}
|
||||
}
|
||||
if (h.get(method.getMethodHolder()) == null) {
|
||||
((InstanceKlass)method.getMethodHolder()).dumpReplayData(out);
|
||||
}
|
||||
Klass holder = method.getMethodHolder();
|
||||
out.println("compile " + holder.getName().asString() + " " +
|
||||
OopUtilities.escapeString(method.getName().asString()) + " " +
|
||||
method.getSignature().asString() + " " +
|
||||
getEntryBCI());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Internals only below this point
|
||||
//
|
||||
|
@ -56,7 +56,7 @@ public class CompileTask extends VMObject {
|
||||
}
|
||||
|
||||
public Method method() {
|
||||
Address oh = methodField.getValue(getAddress()).getAddressAt(0);
|
||||
Address oh = methodField.getValue(getAddress());
|
||||
return (Method)Metadata.instantiateWrapperFor(oh);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class ConstantPoolCache extends Metadata {
|
||||
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("ConstantPoolCache for " + getConstants().getPoolHolder().getName().asString());
|
||||
tty.print("ConstantPoolCache for " + getConstants().getPoolHolder().getName().asString() + " address = " + getAddress() + " offset = " + baseOffset);
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
|
@ -110,6 +110,8 @@ public class Field {
|
||||
public Symbol getSignature() { return signature; }
|
||||
public Symbol getGenericSignature() { return genericSignature; }
|
||||
|
||||
public boolean hasInitialValue() { return holder.getFieldInitialValueIndex(fieldIndex) != 0; }
|
||||
|
||||
//
|
||||
// Following acccessors are for named, non-VM fields only
|
||||
//
|
||||
|
@ -278,7 +278,7 @@ public class InstanceKlass extends Klass {
|
||||
}
|
||||
|
||||
public short getFieldGenericSignatureIndex(int index) {
|
||||
int len = getFields().length();
|
||||
// int len = getFields().length();
|
||||
int allFieldsCount = getAllFieldsCount();
|
||||
int generic_signature_slot = allFieldsCount * FIELD_SLOTS;
|
||||
for (int i = 0; i < allFieldsCount; i++) {
|
||||
@ -325,7 +325,7 @@ public class InstanceKlass extends Klass {
|
||||
public KlassArray getTransitiveInterfaces() { return new KlassArray(transitiveInterfaces.getValue(getAddress())); }
|
||||
public int getJavaFieldsCount() { return (int) javaFieldsCount.getValue(this); }
|
||||
public int getAllFieldsCount() {
|
||||
int len = getFields().length();
|
||||
int len = getFields().length();
|
||||
int allFieldsCount = 0;
|
||||
for (; allFieldsCount*FIELD_SLOTS < len; allFieldsCount++) {
|
||||
short flags = getFieldAccessFlags(allFieldsCount);
|
||||
@ -581,6 +581,19 @@ public class InstanceKlass extends Klass {
|
||||
}
|
||||
}
|
||||
|
||||
public Field[] getStaticFields() {
|
||||
U2Array fields = getFields();
|
||||
int length = getJavaFieldsCount();
|
||||
ArrayList result = new ArrayList();
|
||||
for (int index = 0; index < length; index++) {
|
||||
Field f = newField(index);
|
||||
if (f.isStatic()) {
|
||||
result.add(f);
|
||||
}
|
||||
}
|
||||
return (Field[])result.toArray(new Field[result.size()]);
|
||||
}
|
||||
|
||||
public void iterateNonStaticFields(OopVisitor visitor, Oop obj) {
|
||||
if (getSuper() != null) {
|
||||
((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj);
|
||||
@ -979,4 +992,84 @@ public class InstanceKlass extends Klass {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
ConstantPool cp = getConstants();
|
||||
|
||||
// Try to record related loaded classes
|
||||
Klass sub = getSubklassKlass();
|
||||
while (sub != null) {
|
||||
if (sub instanceof InstanceKlass) {
|
||||
out.println("instanceKlass " + sub.getName().asString());
|
||||
}
|
||||
sub = sub.getNextSiblingKlass();
|
||||
}
|
||||
|
||||
final int length = (int) cp.getLength();
|
||||
out.print("ciInstanceKlass " + getName().asString() + " " + (isLinked() ? 1 : 0) + " " + (isInitialized() ? 1 : 0) + " " + length);
|
||||
for (int index = 1; index < length; index++) {
|
||||
out.print(" " + cp.getTags().at(index));
|
||||
}
|
||||
out.println();
|
||||
if (isInitialized()) {
|
||||
Field[] staticFields = getStaticFields();
|
||||
for (int i = 0; i < staticFields.length; i++) {
|
||||
Field f = staticFields[i];
|
||||
Oop mirror = getJavaMirror();
|
||||
if (f.isFinal() && !f.hasInitialValue()) {
|
||||
out.print("staticfield " + getName().asString() + " " +
|
||||
OopUtilities.escapeString(f.getID().getName()) + " " +
|
||||
f.getFieldType().getSignature().asString() + " ");
|
||||
if (f instanceof ByteField) {
|
||||
ByteField bf = (ByteField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof BooleanField) {
|
||||
BooleanField bf = (BooleanField)f;
|
||||
out.println(bf.getValue(mirror) ? 1 : 0);
|
||||
} else if (f instanceof ShortField) {
|
||||
ShortField bf = (ShortField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof CharField) {
|
||||
CharField bf = (CharField)f;
|
||||
out.println(bf.getValue(mirror) & 0xffff);
|
||||
} else if (f instanceof IntField) {
|
||||
IntField bf = (IntField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof LongField) {
|
||||
LongField bf = (LongField)f;
|
||||
out.println(bf.getValue(mirror));
|
||||
} else if (f instanceof FloatField) {
|
||||
FloatField bf = (FloatField)f;
|
||||
out.println(Float.floatToRawIntBits(bf.getValue(mirror)));
|
||||
} else if (f instanceof DoubleField) {
|
||||
DoubleField bf = (DoubleField)f;
|
||||
out.println(Double.doubleToRawLongBits(bf.getValue(mirror)));
|
||||
} else if (f instanceof OopField) {
|
||||
OopField bf = (OopField)f;
|
||||
|
||||
Oop value = bf.getValue(mirror);
|
||||
if (value == null) {
|
||||
out.println("null");
|
||||
} else if (value.isInstance()) {
|
||||
Instance inst = (Instance)value;
|
||||
if (inst.isA(SystemDictionary.getStringKlass())) {
|
||||
out.println("\"" + OopUtilities.stringOopToEscapedString(inst) + "\"");
|
||||
} else {
|
||||
out.println(inst.getKlass().getName().asString());
|
||||
}
|
||||
} else if (value.isObjArray()) {
|
||||
ObjArray oa = (ObjArray)value;
|
||||
Klass ek = (ObjArrayKlass)oa.getKlass();
|
||||
out.println(oa.getLength() + " " + ek.getName().asString());
|
||||
} else if (value.isTypeArray()) {
|
||||
TypeArray ta = (TypeArray)value;
|
||||
out.println(ta.getLength());
|
||||
} else {
|
||||
out.println(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,4 +79,7 @@ abstract public class Metadata extends VMObject {
|
||||
}
|
||||
|
||||
abstract public void printValueOn(PrintStream tty);
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
out.println("# Unknown Metadata");
|
||||
}
|
||||
}
|
||||
|
@ -358,6 +358,25 @@ public class Method extends Metadata {
|
||||
buf.append(")");
|
||||
return buf.toString().replace('/', '.');
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
NMethod nm = getNativeMethod();
|
||||
int code_size = 0;
|
||||
if (nm != null) {
|
||||
code_size = (int)nm.codeEnd().minus(nm.getVerifiedEntryPoint());
|
||||
}
|
||||
Klass holder = getMethodHolder();
|
||||
out.println("ciMethod " +
|
||||
holder.getName().asString() + " " +
|
||||
OopUtilities.escapeString(getName().asString()) + " " +
|
||||
getSignature().asString() + " " +
|
||||
getInvocationCounter() + " " +
|
||||
getBackedgeCounter() + " " +
|
||||
interpreterInvocationCount() + " " +
|
||||
interpreterThrowoutCount() + " " +
|
||||
code_size);
|
||||
}
|
||||
|
||||
public int interpreterThrowoutCount() {
|
||||
return (int) interpreterThrowoutCountField.getValue(this);
|
||||
}
|
||||
|
@ -332,4 +332,59 @@ public class MethodData extends Metadata {
|
||||
public int currentMileage() {
|
||||
return 20000;
|
||||
}
|
||||
|
||||
public void dumpReplayData(PrintStream out) {
|
||||
Method method = getMethod();
|
||||
Klass holder = method.getMethodHolder();
|
||||
out.print("ciMethodData " +
|
||||
holder.getName().asString() + " " +
|
||||
OopUtilities.escapeString(method.getName().asString()) + " " +
|
||||
method.getSignature().asString() + " " +
|
||||
"2" + " " +
|
||||
currentMileage());
|
||||
byte[] orig = orig();
|
||||
out.print(" orig " + orig.length);
|
||||
for (int i = 0; i < orig.length; i++) {
|
||||
out.print(" " + (orig[i] & 0xff));
|
||||
}
|
||||
|
||||
long[] data = data();
|
||||
out.print(" data " + data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
out.print(" 0x" + Long.toHexString(data[i]));
|
||||
}
|
||||
int count = 0;
|
||||
for (int round = 0; round < 2; round++) {
|
||||
if (round == 1) out.print(" oops " + count);
|
||||
ProfileData pdata = firstData();
|
||||
for ( ; isValid(pdata); pdata = nextData(pdata)) {
|
||||
if (pdata instanceof ReceiverTypeData) {
|
||||
ReceiverTypeData vdata = (ReceiverTypeData)pdata;
|
||||
for (int i = 0; i < vdata.rowLimit(); i++) {
|
||||
Klass k = vdata.receiver(i);
|
||||
if (k != null) {
|
||||
if (round == 0) count++;
|
||||
else out.print(" " +
|
||||
(dpToDi(vdata.dp() +
|
||||
vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " +
|
||||
k.getName().asString());
|
||||
}
|
||||
}
|
||||
} else if (pdata instanceof VirtualCallData) {
|
||||
VirtualCallData vdata = (VirtualCallData)pdata;
|
||||
for (int i = 0; i < vdata.rowLimit(); i++) {
|
||||
Klass k = vdata.receiver(i);
|
||||
if (k != null) {
|
||||
if (round == 0) count++;
|
||||
else out.print(" " +
|
||||
(dpToDi(vdata.dp() +
|
||||
vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " +
|
||||
k.getName().asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.println();
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012
|
||||
|
||||
HS_MAJOR_VER=25
|
||||
HS_MINOR_VER=0
|
||||
HS_BUILD_NUMBER=09
|
||||
HS_BUILD_NUMBER=10
|
||||
|
||||
JDK_MAJOR_VER=1
|
||||
JDK_MINOR_VER=8
|
||||
|
@ -1198,19 +1198,20 @@ static bool file_exists(const char* filename) {
|
||||
return os::stat(filename, &statbuf) == 0;
|
||||
}
|
||||
|
||||
void os::dll_build_name(char* buffer, size_t buflen,
|
||||
bool os::dll_build_name(char* buffer, size_t buflen,
|
||||
const char* pname, const char* fname) {
|
||||
bool retval = false;
|
||||
// Copied from libhpi
|
||||
const size_t pnamelen = pname ? strlen(pname) : 0;
|
||||
|
||||
// Quietly truncate on buffer overflow. Should be an error.
|
||||
// Return error on buffer overflow.
|
||||
if (pnamelen + strlen(fname) + strlen(JNI_LIB_PREFIX) + strlen(JNI_LIB_SUFFIX) + 2 > buflen) {
|
||||
*buffer = '\0';
|
||||
return;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (pnamelen == 0) {
|
||||
snprintf(buffer, buflen, JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, fname);
|
||||
retval = true;
|
||||
} else if (strchr(pname, *os::path_separator()) != NULL) {
|
||||
int n;
|
||||
char** pelements = split_path(pname, &n);
|
||||
@ -1222,6 +1223,7 @@ void os::dll_build_name(char* buffer, size_t buflen,
|
||||
snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX,
|
||||
pelements[i], fname);
|
||||
if (file_exists(buffer)) {
|
||||
retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1236,7 +1238,9 @@ void os::dll_build_name(char* buffer, size_t buflen,
|
||||
}
|
||||
} else {
|
||||
snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
const char* os::get_current_directory(char *buf, int buflen) {
|
||||
|
@ -1650,19 +1650,20 @@ static bool file_exists(const char* filename) {
|
||||
return os::stat(filename, &statbuf) == 0;
|
||||
}
|
||||
|
||||
void os::dll_build_name(char* buffer, size_t buflen,
|
||||
bool os::dll_build_name(char* buffer, size_t buflen,
|
||||
const char* pname, const char* fname) {
|
||||
bool retval = false;
|
||||
// Copied from libhpi
|
||||
const size_t pnamelen = pname ? strlen(pname) : 0;
|
||||
|
||||
// Quietly truncate on buffer overflow. Should be an error.
|
||||
// Return error on buffer overflow.
|
||||
if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
|
||||
*buffer = '\0';
|
||||
return;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (pnamelen == 0) {
|
||||
snprintf(buffer, buflen, "lib%s.so", fname);
|
||||
retval = true;
|
||||
} else if (strchr(pname, *os::path_separator()) != NULL) {
|
||||
int n;
|
||||
char** pelements = split_path(pname, &n);
|
||||
@ -1673,6 +1674,7 @@ void os::dll_build_name(char* buffer, size_t buflen,
|
||||
}
|
||||
snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
|
||||
if (file_exists(buffer)) {
|
||||
retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1687,7 +1689,9 @@ void os::dll_build_name(char* buffer, size_t buflen,
|
||||
}
|
||||
} else {
|
||||
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
const char* os::get_current_directory(char *buf, int buflen) {
|
||||
|
@ -1894,18 +1894,19 @@ static bool file_exists(const char* filename) {
|
||||
return os::stat(filename, &statbuf) == 0;
|
||||
}
|
||||
|
||||
void os::dll_build_name(char* buffer, size_t buflen,
|
||||
bool os::dll_build_name(char* buffer, size_t buflen,
|
||||
const char* pname, const char* fname) {
|
||||
bool retval = false;
|
||||
const size_t pnamelen = pname ? strlen(pname) : 0;
|
||||
|
||||
// Quietly truncate on buffer overflow. Should be an error.
|
||||
// Return error on buffer overflow.
|
||||
if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
|
||||
*buffer = '\0';
|
||||
return;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (pnamelen == 0) {
|
||||
snprintf(buffer, buflen, "lib%s.so", fname);
|
||||
retval = true;
|
||||
} else if (strchr(pname, *os::path_separator()) != NULL) {
|
||||
int n;
|
||||
char** pelements = split_path(pname, &n);
|
||||
@ -1916,6 +1917,7 @@ void os::dll_build_name(char* buffer, size_t buflen,
|
||||
}
|
||||
snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
|
||||
if (file_exists(buffer)) {
|
||||
retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1930,7 +1932,9 @@ void os::dll_build_name(char* buffer, size_t buflen,
|
||||
}
|
||||
} else {
|
||||
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
const char* os::get_current_directory(char *buf, int buflen) {
|
||||
|
@ -1132,21 +1132,23 @@ static bool file_exists(const char* filename) {
|
||||
return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
|
||||
}
|
||||
|
||||
void os::dll_build_name(char *buffer, size_t buflen,
|
||||
bool os::dll_build_name(char *buffer, size_t buflen,
|
||||
const char* pname, const char* fname) {
|
||||
bool retval = false;
|
||||
const size_t pnamelen = pname ? strlen(pname) : 0;
|
||||
const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0;
|
||||
|
||||
// Quietly truncates on buffer overflow. Should be an error.
|
||||
// Return error on buffer overflow.
|
||||
if (pnamelen + strlen(fname) + 10 > buflen) {
|
||||
*buffer = '\0';
|
||||
return;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (pnamelen == 0) {
|
||||
jio_snprintf(buffer, buflen, "%s.dll", fname);
|
||||
retval = true;
|
||||
} else if (c == ':' || c == '\\') {
|
||||
jio_snprintf(buffer, buflen, "%s%s.dll", pname, fname);
|
||||
retval = true;
|
||||
} else if (strchr(pname, *os::path_separator()) != NULL) {
|
||||
int n;
|
||||
char** pelements = split_path(pname, &n);
|
||||
@ -1164,6 +1166,7 @@ void os::dll_build_name(char *buffer, size_t buflen,
|
||||
jio_snprintf(buffer, buflen, "%s\\%s.dll", path, fname);
|
||||
}
|
||||
if (file_exists(buffer)) {
|
||||
retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1178,7 +1181,9 @@ void os::dll_build_name(char *buffer, size_t buflen,
|
||||
}
|
||||
} else {
|
||||
jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Needs to be in os specific directory because windows requires another
|
||||
|
@ -1836,7 +1836,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
|
||||
// check if we could do inlining
|
||||
if (!PatchALot && Inline && klass->is_loaded() &&
|
||||
(klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized())
|
||||
&& target->will_link(klass, callee_holder, code)) {
|
||||
&& target->is_loaded()) {
|
||||
// callee is known => check if we have static binding
|
||||
assert(target->is_loaded(), "callee must be known");
|
||||
if (code == Bytecodes::_invokestatic ||
|
||||
|
@ -374,7 +374,7 @@ JRT_END
|
||||
|
||||
JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
|
||||
ResourceMark rm(thread);
|
||||
const char* klass_name = Klass::cast(obj->klass())->external_name();
|
||||
const char* klass_name = obj->klass()->external_name();
|
||||
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
|
||||
JRT_END
|
||||
|
||||
@ -631,7 +631,7 @@ JRT_ENTRY(void, Runtime1::throw_class_cast_exception(JavaThread* thread, oopDesc
|
||||
NOT_PRODUCT(_throw_class_cast_exception_count++;)
|
||||
ResourceMark rm(thread);
|
||||
char* message = SharedRuntime::generate_class_cast_message(
|
||||
thread, Klass::cast(object->klass())->external_name());
|
||||
thread, object->klass()->external_name());
|
||||
SharedRuntime::throw_and_post_jvmti_exception(
|
||||
thread, vmSymbols::java_lang_ClassCastException(), message);
|
||||
JRT_END
|
||||
@ -876,7 +876,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
|
||||
case Bytecodes::_anewarray:
|
||||
{ Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci));
|
||||
Klass* ek = caller_method->constants()->klass_at(anew.index(), CHECK);
|
||||
k = Klass::cast(ek)->array_klass(CHECK);
|
||||
k = ek->array_klass(CHECK);
|
||||
}
|
||||
break;
|
||||
case Bytecodes::_ldc:
|
||||
@ -1236,7 +1236,7 @@ template <class T> int obj_arraycopy_work(oopDesc* src, T* src_addr,
|
||||
} else {
|
||||
Klass* bound = ObjArrayKlass::cast(dst->klass())->element_klass();
|
||||
Klass* stype = ObjArrayKlass::cast(src->klass())->element_klass();
|
||||
if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
|
||||
if (stype == bound || stype->is_subtype_of(bound)) {
|
||||
// Elements are guaranteed to be subtypes, so no check necessary
|
||||
bs->write_ref_array_pre(dst_addr, length);
|
||||
Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
|
||||
|
@ -282,7 +282,7 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod*
|
||||
ciMethod* inline_target = NULL;
|
||||
if (target->is_loaded() && klass->is_loaded()
|
||||
&& (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized())
|
||||
&& target->will_link(klass, callee_holder, code)) {
|
||||
&& target->is_loaded()) {
|
||||
if (code == Bytecodes::_invokestatic
|
||||
|| code == Bytecodes::_invokespecial
|
||||
|| code == Bytecodes::_invokevirtual && target->is_final_method()) {
|
||||
|
@ -106,6 +106,7 @@ friend class ciSymbol; \
|
||||
friend class ciArray; \
|
||||
friend class ciObjArray; \
|
||||
friend class ciMetadata; \
|
||||
friend class ciReplay; \
|
||||
friend class ciTypeArray; \
|
||||
friend class ciType; \
|
||||
friend class ciReturnAddress; \
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "ci/ciInstanceKlass.hpp"
|
||||
#include "ci/ciMethod.hpp"
|
||||
#include "ci/ciNullObject.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "ci/ciUtilities.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
@ -426,7 +427,7 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
for (int i = cpool->length() - 1; i >= 1; i--) {
|
||||
if (cpool->tag_at(i).is_klass()) {
|
||||
Klass* kls = cpool->resolved_klass_at(i);
|
||||
if (Klass::cast(kls)->name() == sym) {
|
||||
if (kls->name() == sym) {
|
||||
found_klass = KlassHandle(THREAD, kls);
|
||||
break;
|
||||
}
|
||||
@ -772,6 +773,11 @@ ciMethod* ciEnv::get_method_by_index_impl(constantPoolHandle cpool,
|
||||
: !m->method_holder()->is_loaded())) {
|
||||
m = NULL;
|
||||
}
|
||||
#ifdef ASSERT
|
||||
if (m != NULL && ReplayCompiles && !ciReplay::is_loaded(m)) {
|
||||
m = NULL;
|
||||
}
|
||||
#endif
|
||||
if (m != NULL) {
|
||||
// We found the method.
|
||||
return get_method(m);
|
||||
@ -1144,3 +1150,43 @@ void ciEnv::record_out_of_memory_failure() {
|
||||
// If memory is low, we stop compiling methods.
|
||||
record_method_not_compilable("out of memory");
|
||||
}
|
||||
|
||||
fileStream* ciEnv::_replay_data_stream = NULL;
|
||||
|
||||
void ciEnv::dump_replay_data() {
|
||||
VM_ENTRY_MARK;
|
||||
MutexLocker ml(Compile_lock);
|
||||
if (_replay_data_stream == NULL) {
|
||||
_replay_data_stream = new (ResourceObj::C_HEAP, mtCompiler) fileStream(ReplayDataFile);
|
||||
if (_replay_data_stream == NULL) {
|
||||
fatal(err_msg("Can't open %s for replay data", ReplayDataFile));
|
||||
}
|
||||
}
|
||||
dump_replay_data(_replay_data_stream);
|
||||
}
|
||||
|
||||
|
||||
void ciEnv::dump_replay_data(outputStream* out) {
|
||||
ASSERT_IN_VM;
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables);
|
||||
out->print_cr("JvmtiExport can_hotswap_or_post_breakpoint %d", _jvmti_can_hotswap_or_post_breakpoint);
|
||||
out->print_cr("JvmtiExport can_post_on_exceptions %d", _jvmti_can_post_on_exceptions);
|
||||
#endif // INCLUDE_JVMTI
|
||||
|
||||
GrowableArray<ciMetadata*>* objects = _factory->get_ci_metadata();
|
||||
out->print_cr("# %d ciObject found", objects->length());
|
||||
for (int i = 0; i < objects->length(); i++) {
|
||||
objects->at(i)->dump_replay_data(out);
|
||||
}
|
||||
Method* method = task()->method();
|
||||
int entry_bci = task()->osr_bci();
|
||||
// Klass holder = method->method_holder();
|
||||
out->print_cr("compile %s %s %s %d",
|
||||
method->klass_name()->as_quoted_ascii(),
|
||||
method->name()->as_quoted_ascii(),
|
||||
method->signature()->as_quoted_ascii(),
|
||||
entry_bci);
|
||||
out->flush();
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ class ciEnv : StackObj {
|
||||
friend class CompileBroker;
|
||||
friend class Dependencies; // for get_object, during logging
|
||||
|
||||
static fileStream* _replay_data_stream;
|
||||
|
||||
private:
|
||||
Arena* _arena; // Alias for _ciEnv_arena except in init_shared_objects()
|
||||
Arena _ciEnv_arena;
|
||||
@ -448,6 +450,13 @@ public:
|
||||
|
||||
// RedefineClasses support
|
||||
void metadata_do(void f(Metadata*)) { _factory->metadata_do(f); }
|
||||
|
||||
// Dump the compilation replay data for this ciEnv to
|
||||
// ReplayDataFile, creating the file if needed.
|
||||
void dump_replay_data();
|
||||
|
||||
// Dump the compilation replay data for the ciEnv to the stream.
|
||||
void dump_replay_data(outputStream* out);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_CI_CIENV_HPP
|
||||
|
@ -561,3 +561,114 @@ ciInstanceKlass* ciInstanceKlass::implementor() {
|
||||
}
|
||||
return impl;
|
||||
}
|
||||
|
||||
// Utility class for printing of the contents of the static fields for
|
||||
// use by compilation replay. It only prints out the information that
|
||||
// could be consumed by the compiler, so for primitive types it prints
|
||||
// out the actual value. For Strings it's the actual string value.
|
||||
// For array types it it's first level array size since that's the
|
||||
// only value which statically unchangeable. For all other reference
|
||||
// types it simply prints out the dynamic type.
|
||||
|
||||
class StaticFinalFieldPrinter : public FieldClosure {
|
||||
outputStream* _out;
|
||||
const char* _holder;
|
||||
public:
|
||||
StaticFinalFieldPrinter(outputStream* out, const char* holder) :
|
||||
_out(out),
|
||||
_holder(holder) {
|
||||
}
|
||||
void do_field(fieldDescriptor* fd) {
|
||||
if (fd->is_final() && !fd->has_initial_value()) {
|
||||
oop mirror = fd->field_holder()->java_mirror();
|
||||
_out->print("staticfield %s %s %s ", _holder, fd->name()->as_quoted_ascii(), fd->signature()->as_quoted_ascii());
|
||||
switch (fd->field_type()) {
|
||||
case T_BYTE: _out->print_cr("%d", mirror->byte_field(fd->offset())); break;
|
||||
case T_BOOLEAN: _out->print_cr("%d", mirror->bool_field(fd->offset())); break;
|
||||
case T_SHORT: _out->print_cr("%d", mirror->short_field(fd->offset())); break;
|
||||
case T_CHAR: _out->print_cr("%d", mirror->char_field(fd->offset())); break;
|
||||
case T_INT: _out->print_cr("%d", mirror->int_field(fd->offset())); break;
|
||||
case T_LONG: _out->print_cr(INT64_FORMAT, mirror->long_field(fd->offset())); break;
|
||||
case T_FLOAT: {
|
||||
float f = mirror->float_field(fd->offset());
|
||||
_out->print_cr("%d", *(int*)&f);
|
||||
break;
|
||||
}
|
||||
case T_DOUBLE: {
|
||||
double d = mirror->double_field(fd->offset());
|
||||
_out->print_cr(INT64_FORMAT, *(jlong*)&d);
|
||||
break;
|
||||
}
|
||||
case T_ARRAY: {
|
||||
oop value = mirror->obj_field_acquire(fd->offset());
|
||||
if (value == NULL) {
|
||||
_out->print_cr("null");
|
||||
} else {
|
||||
typeArrayOop ta = (typeArrayOop)value;
|
||||
_out->print("%d", ta->length());
|
||||
if (value->is_objArray()) {
|
||||
objArrayOop oa = (objArrayOop)value;
|
||||
const char* klass_name = value->klass()->name()->as_quoted_ascii();
|
||||
_out->print(" %s", klass_name);
|
||||
}
|
||||
_out->cr();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case T_OBJECT: {
|
||||
oop value = mirror->obj_field_acquire(fd->offset());
|
||||
if (value == NULL) {
|
||||
_out->print_cr("null");
|
||||
} else if (value->is_instance()) {
|
||||
if (value->is_a(SystemDictionary::String_klass())) {
|
||||
_out->print("\"");
|
||||
_out->print_raw(java_lang_String::as_quoted_ascii(value));
|
||||
_out->print_cr("\"");
|
||||
} else {
|
||||
const char* klass_name = value->klass()->name()->as_quoted_ascii();
|
||||
_out->print_cr(klass_name);
|
||||
}
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void ciInstanceKlass::dump_replay_data(outputStream* out) {
|
||||
ASSERT_IN_VM;
|
||||
InstanceKlass* ik = get_instanceKlass();
|
||||
ConstantPool* cp = ik->constants();
|
||||
|
||||
// Try to record related loaded classes
|
||||
Klass* sub = ik->subklass();
|
||||
while (sub != NULL) {
|
||||
if (sub->oop_is_instance()) {
|
||||
out->print_cr("instanceKlass %s", sub->name()->as_quoted_ascii());
|
||||
}
|
||||
sub = sub->next_sibling();
|
||||
}
|
||||
|
||||
// Dump out the state of the constant pool tags. During replay the
|
||||
// tags will be validated for things which shouldn't change and
|
||||
// classes will be resolved if the tags indicate that they were
|
||||
// resolved at compile time.
|
||||
out->print("ciInstanceKlass %s %d %d %d", ik->name()->as_quoted_ascii(),
|
||||
is_linked(), is_initialized(), cp->length());
|
||||
for (int index = 1; index < cp->length(); index++) {
|
||||
out->print(" %d", cp->tags()->at(index));
|
||||
}
|
||||
out->cr();
|
||||
if (is_initialized()) {
|
||||
// Dump out the static final fields in case the compilation relies
|
||||
// on their value for correct replay.
|
||||
StaticFinalFieldPrinter sffp(out, ik->name()->as_quoted_ascii());
|
||||
ik->do_local_static_fields(&sffp);
|
||||
}
|
||||
}
|
||||
|
@ -230,6 +230,9 @@ public:
|
||||
// What kind of ciObject is this?
|
||||
bool is_instance_klass() const { return true; }
|
||||
bool is_java_klass() const { return true; }
|
||||
|
||||
// Dump the current state of this klass for compilation replay.
|
||||
virtual void dump_replay_data(outputStream* out);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_CI_CIINSTANCEKLASS_HPP
|
||||
|
@ -61,6 +61,7 @@ class ciMetadata: public ciBaseObject {
|
||||
virtual bool is_array_klass() const { return false; }
|
||||
virtual bool is_obj_array_klass() const { return false; }
|
||||
virtual bool is_type_array_klass() const { return false; }
|
||||
virtual void dump_replay_data(outputStream* st) { /* do nothing */ }
|
||||
|
||||
ciMethod* as_method() {
|
||||
assert(is_method(), "bad cast");
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "ci/ciMethodData.hpp"
|
||||
#include "ci/ciStreams.hpp"
|
||||
#include "ci/ciSymbol.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "ci/ciUtilities.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "compiler/abstractCompiler.hpp"
|
||||
@ -139,6 +140,12 @@ ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
|
||||
}
|
||||
if (_interpreter_invocation_count == 0)
|
||||
_interpreter_invocation_count = 1;
|
||||
_instructions_size = -1;
|
||||
#ifdef ASSERT
|
||||
if (ReplayCompiles) {
|
||||
ciReplay::initialize(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +168,8 @@ ciMethod::ciMethod(ciInstanceKlass* holder,
|
||||
#if defined(COMPILER2) || defined(SHARK)
|
||||
,
|
||||
_flow( NULL),
|
||||
_bcea( NULL)
|
||||
_bcea( NULL),
|
||||
_instructions_size(-1)
|
||||
#endif // COMPILER2 || SHARK
|
||||
{
|
||||
// Usually holder and accessor are the same type but in some cases
|
||||
@ -867,25 +875,6 @@ ciMethodData* ciMethod::method_data_or_null() {
|
||||
return md;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::will_link
|
||||
//
|
||||
// Will this method link in a specific calling context?
|
||||
bool ciMethod::will_link(ciKlass* accessing_klass,
|
||||
ciKlass* declared_method_holder,
|
||||
Bytecodes::Code bc) {
|
||||
if (!is_loaded()) {
|
||||
// Method lookup failed.
|
||||
return false;
|
||||
}
|
||||
|
||||
// The link checks have been front-loaded into the get_method
|
||||
// call. This method (ciMethod::will_link()) will be removed
|
||||
// in the future.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::should_exclude
|
||||
//
|
||||
@ -1000,8 +989,7 @@ bool ciMethod::can_be_osr_compiled(int entry_bci) {
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::has_compiled_code
|
||||
bool ciMethod::has_compiled_code() {
|
||||
VM_ENTRY_MARK;
|
||||
return get_Method()->code() != NULL;
|
||||
return instructions_size() > 0;
|
||||
}
|
||||
|
||||
int ciMethod::comp_level() {
|
||||
@ -1039,14 +1027,18 @@ int ciMethod::code_size_for_inlining() {
|
||||
// junk like exception handler, stubs, and constant table, which are
|
||||
// not highly relevant to an inlined method. So we use the more
|
||||
// specific accessor nmethod::insts_size.
|
||||
int ciMethod::instructions_size(int comp_level) {
|
||||
GUARDED_VM_ENTRY(
|
||||
nmethod* code = get_Method()->code();
|
||||
if (code != NULL && (comp_level == CompLevel_any || comp_level == code->comp_level())) {
|
||||
return code->insts_end() - code->verified_entry_point();
|
||||
}
|
||||
return 0;
|
||||
)
|
||||
int ciMethod::instructions_size() {
|
||||
if (_instructions_size == -1) {
|
||||
GUARDED_VM_ENTRY(
|
||||
nmethod* code = get_Method()->code();
|
||||
if (code != NULL && (code->comp_level() == CompLevel_full_optimization)) {
|
||||
_instructions_size = code->insts_end() - code->verified_entry_point();
|
||||
} else {
|
||||
_instructions_size = 0;
|
||||
}
|
||||
);
|
||||
}
|
||||
return _instructions_size;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -1166,6 +1158,20 @@ ciMethodBlocks *ciMethod::get_method_blocks() {
|
||||
|
||||
#undef FETCH_FLAG_FROM_VM
|
||||
|
||||
void ciMethod::dump_replay_data(outputStream* st) {
|
||||
ASSERT_IN_VM;
|
||||
Method* method = get_Method();
|
||||
Klass* holder = method->method_holder();
|
||||
st->print_cr("ciMethod %s %s %s %d %d %d %d %d",
|
||||
holder->name()->as_quoted_ascii(),
|
||||
method->name()->as_quoted_ascii(),
|
||||
method->signature()->as_quoted_ascii(),
|
||||
method->invocation_counter()->raw_counter(),
|
||||
method->backedge_counter()->raw_counter(),
|
||||
interpreter_invocation_count(),
|
||||
interpreter_throwout_count(),
|
||||
_instructions_size);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::print_codes
|
||||
|
@ -51,6 +51,7 @@ class ciMethod : public ciMetadata {
|
||||
friend class ciExceptionHandlerStream;
|
||||
friend class ciBytecodeStream;
|
||||
friend class ciMethodHandle;
|
||||
friend class ciReplay;
|
||||
|
||||
private:
|
||||
// General method information.
|
||||
@ -69,6 +70,7 @@ class ciMethod : public ciMetadata {
|
||||
int _handler_count;
|
||||
int _interpreter_invocation_count;
|
||||
int _interpreter_throwout_count;
|
||||
int _instructions_size;
|
||||
|
||||
bool _uses_monitors;
|
||||
bool _balanced_monitors;
|
||||
@ -239,9 +241,6 @@ class ciMethod : public ciMetadata {
|
||||
int resolve_vtable_index(ciKlass* caller, ciKlass* receiver);
|
||||
|
||||
// Compilation directives
|
||||
bool will_link(ciKlass* accessing_klass,
|
||||
ciKlass* declared_method_holder,
|
||||
Bytecodes::Code bc);
|
||||
bool should_exclude();
|
||||
bool should_inline();
|
||||
bool should_not_inline();
|
||||
@ -252,7 +251,6 @@ class ciMethod : public ciMetadata {
|
||||
bool can_be_osr_compiled(int entry_bci);
|
||||
void set_not_compilable();
|
||||
bool has_compiled_code();
|
||||
int instructions_size(int comp_level = CompLevel_any);
|
||||
void log_nmethod_identity(xmlStream* log);
|
||||
bool is_not_reached(int bci);
|
||||
bool was_executed_more_than(int times);
|
||||
@ -260,6 +258,7 @@ class ciMethod : public ciMetadata {
|
||||
bool is_klass_loaded(int refinfo_index, bool must_be_resolved) const;
|
||||
bool check_call(int refinfo_index, bool is_static) const;
|
||||
bool ensure_method_data(); // make sure it exists in the VM also
|
||||
int instructions_size();
|
||||
int scale_count(int count, float prof_factor = 1.); // make MDO count commensurate with IIC
|
||||
|
||||
// JSR 292 support
|
||||
@ -291,6 +290,7 @@ class ciMethod : public ciMetadata {
|
||||
bool is_accessor () const;
|
||||
bool is_initializer () const;
|
||||
bool can_be_statically_bound() const { return _can_be_statically_bound; }
|
||||
void dump_replay_data(outputStream* st);
|
||||
|
||||
// Print the bytecodes of this method.
|
||||
void print_codes_on(outputStream* st);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciMetadata.hpp"
|
||||
#include "ci/ciMethodData.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "ci/ciUtilities.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
@ -115,6 +116,11 @@ void ciMethodData::load_data() {
|
||||
_arg_local = mdo->arg_local();
|
||||
_arg_stack = mdo->arg_stack();
|
||||
_arg_returned = mdo->arg_returned();
|
||||
#ifndef PRODUCT
|
||||
if (ReplayCompiles) {
|
||||
ciReplay::initialize(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ciReceiverTypeData::translate_receiver_data_from(ProfileData* data) {
|
||||
@ -366,6 +372,79 @@ void ciMethodData::print_impl(outputStream* st) {
|
||||
ciMetadata::print_impl(st);
|
||||
}
|
||||
|
||||
void ciMethodData::dump_replay_data(outputStream* out) {
|
||||
ASSERT_IN_VM;
|
||||
MethodData* mdo = get_MethodData();
|
||||
Method* method = mdo->method();
|
||||
Klass* holder = method->method_holder();
|
||||
out->print("ciMethodData %s %s %s %d %d",
|
||||
holder->name()->as_quoted_ascii(),
|
||||
method->name()->as_quoted_ascii(),
|
||||
method->signature()->as_quoted_ascii(),
|
||||
_state,
|
||||
current_mileage());
|
||||
|
||||
// dump the contents of the MDO header as raw data
|
||||
unsigned char* orig = (unsigned char*)&_orig;
|
||||
int length = sizeof(_orig);
|
||||
out->print(" orig %d", length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
out->print(" %d", orig[i]);
|
||||
}
|
||||
|
||||
// dump the MDO data as raw data
|
||||
int elements = data_size() / sizeof(intptr_t);
|
||||
out->print(" data %d", elements);
|
||||
for (int i = 0; i < elements; i++) {
|
||||
// We could use INTPTR_FORMAT here but that's a zero justified
|
||||
// which makes comparing it with the SA version of this output
|
||||
// harder.
|
||||
#ifdef _LP64
|
||||
out->print(" 0x%" FORMAT64_MODIFIER "x", data()[i]);
|
||||
#else
|
||||
out->print(" 0x%x", data()[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
// The MDO contained oop references as ciObjects, so scan for those
|
||||
// and emit pairs of offset and klass name so that they can be
|
||||
// reconstructed at runtime. The first round counts the number of
|
||||
// oop references and the second actually emits them.
|
||||
int count = 0;
|
||||
for (int round = 0; round < 2; round++) {
|
||||
if (round == 1) out->print(" oops %d", count);
|
||||
ProfileData* pdata = first_data();
|
||||
for ( ; is_valid(pdata); pdata = next_data(pdata)) {
|
||||
if (pdata->is_ReceiverTypeData()) {
|
||||
ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
|
||||
for (uint i = 0; i < vdata->row_limit(); i++) {
|
||||
ciKlass* k = vdata->receiver(i);
|
||||
if (k != NULL) {
|
||||
if (round == 0) {
|
||||
count++;
|
||||
} else {
|
||||
out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pdata->is_VirtualCallData()) {
|
||||
ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
|
||||
for (uint i = 0; i < vdata->row_limit(); i++) {
|
||||
ciKlass* k = vdata->receiver(i);
|
||||
if (k != NULL) {
|
||||
if (round == 0) {
|
||||
count++;
|
||||
} else {
|
||||
out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out->cr();
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void ciMethodData::print() {
|
||||
print_data_on(tty);
|
||||
|
@ -144,6 +144,7 @@ public:
|
||||
|
||||
class ciMethodData : public ciMetadata {
|
||||
CI_PACKAGE_ACCESS
|
||||
friend class ciReplay;
|
||||
|
||||
private:
|
||||
// Size in bytes
|
||||
@ -320,6 +321,7 @@ public:
|
||||
void print();
|
||||
void print_data_on(outputStream* st);
|
||||
#endif
|
||||
void dump_replay_data(outputStream* out);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_CI_CIMETHODDATA_HPP
|
||||
|
@ -131,6 +131,7 @@ public:
|
||||
// Is this a type or value which has no associated class?
|
||||
// It is true of primitive types and null objects.
|
||||
virtual bool is_classless() const { return false; }
|
||||
virtual void dump_replay_data(outputStream* st) { /* do nothing */ }
|
||||
|
||||
// Note: some ciObjects refer to oops which have yet to be created.
|
||||
// We refer to these as "unloaded". Specifically, there are
|
||||
|
@ -137,6 +137,7 @@ public:
|
||||
|
||||
ciReturnAddress* get_return_address(int bci);
|
||||
|
||||
GrowableArray<ciMetadata*>* get_ci_metadata() const { return _ci_metadata; }
|
||||
// RedefineClasses support
|
||||
void metadata_do(void f(Metadata*));
|
||||
|
||||
|
942
hotspot/src/share/vm/ci/ciReplay.cpp
Normal file
942
hotspot/src/share/vm/ci/ciReplay.cpp
Normal file
@ -0,0 +1,942 @@
|
||||
/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciMethodData.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "ci/ciUtilities.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/oopFactory.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "utilities/copy.hpp"
|
||||
|
||||
#ifdef ASSERT
|
||||
|
||||
// ciReplay
|
||||
|
||||
typedef struct _ciMethodDataRecord {
|
||||
const char* klass;
|
||||
const char* method;
|
||||
const char* signature;
|
||||
int state;
|
||||
int current_mileage;
|
||||
intptr_t* data;
|
||||
int data_length;
|
||||
char* orig_data;
|
||||
int orig_data_length;
|
||||
int oops_length;
|
||||
jobject* oops_handles;
|
||||
int* oops_offsets;
|
||||
} ciMethodDataRecord;
|
||||
|
||||
typedef struct _ciMethodRecord {
|
||||
const char* klass;
|
||||
const char* method;
|
||||
const char* signature;
|
||||
int instructions_size;
|
||||
int interpreter_invocation_count;
|
||||
int interpreter_throwout_count;
|
||||
int invocation_counter;
|
||||
int backedge_counter;
|
||||
} ciMethodRecord;
|
||||
|
||||
class CompileReplay;
|
||||
static CompileReplay* replay_state;
|
||||
|
||||
class CompileReplay : public StackObj {
|
||||
private:
|
||||
FILE* stream;
|
||||
Thread* thread;
|
||||
Handle protection_domain;
|
||||
Handle loader;
|
||||
|
||||
GrowableArray<ciMethodRecord*> ci_method_records;
|
||||
GrowableArray<ciMethodDataRecord*> ci_method_data_records;
|
||||
|
||||
const char* _error_message;
|
||||
|
||||
char* bufptr;
|
||||
char* buffer;
|
||||
int buffer_length;
|
||||
int buffer_end;
|
||||
int line_no;
|
||||
|
||||
public:
|
||||
CompileReplay(const char* filename, TRAPS) {
|
||||
thread = THREAD;
|
||||
loader = Handle(thread, SystemDictionary::java_system_loader());
|
||||
stream = fopen(filename, "rt");
|
||||
if (stream == NULL) {
|
||||
fprintf(stderr, "Can't open replay file %s\n", filename);
|
||||
}
|
||||
buffer_length = 32;
|
||||
buffer = NEW_RESOURCE_ARRAY(char, buffer_length);
|
||||
_error_message = NULL;
|
||||
|
||||
test();
|
||||
}
|
||||
|
||||
~CompileReplay() {
|
||||
if (stream != NULL) fclose(stream);
|
||||
}
|
||||
|
||||
void test() {
|
||||
strcpy(buffer, "1 2 foo 4 bar 0x9 \"this is it\"");
|
||||
bufptr = buffer;
|
||||
assert(parse_int("test") == 1, "what");
|
||||
assert(parse_int("test") == 2, "what");
|
||||
assert(strcmp(parse_string(), "foo") == 0, "what");
|
||||
assert(parse_int("test") == 4, "what");
|
||||
assert(strcmp(parse_string(), "bar") == 0, "what");
|
||||
assert(parse_intptr_t("test") == 9, "what");
|
||||
assert(strcmp(parse_quoted_string(), "this is it") == 0, "what");
|
||||
}
|
||||
|
||||
bool had_error() {
|
||||
return _error_message != NULL || thread->has_pending_exception();
|
||||
}
|
||||
|
||||
bool can_replay() {
|
||||
return !(stream == NULL || had_error());
|
||||
}
|
||||
|
||||
void report_error(const char* msg) {
|
||||
_error_message = msg;
|
||||
// Restore the buffer contents for error reporting
|
||||
for (int i = 0; i < buffer_end; i++) {
|
||||
if (buffer[i] == '\0') buffer[i] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
int parse_int(const char* label) {
|
||||
if (had_error()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int v = 0;
|
||||
int read;
|
||||
if (sscanf(bufptr, "%i%n", &v, &read) != 1) {
|
||||
report_error(label);
|
||||
} else {
|
||||
bufptr += read;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
intptr_t parse_intptr_t(const char* label) {
|
||||
if (had_error()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
intptr_t v = 0;
|
||||
int read;
|
||||
if (sscanf(bufptr, INTPTR_FORMAT "%n", &v, &read) != 1) {
|
||||
report_error(label);
|
||||
} else {
|
||||
bufptr += read;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
void skip_ws() {
|
||||
// Skip any leading whitespace
|
||||
while (*bufptr == ' ' || *bufptr == '\t') {
|
||||
bufptr++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char* scan_and_terminate(char delim) {
|
||||
char* str = bufptr;
|
||||
while (*bufptr != delim && *bufptr != '\0') {
|
||||
bufptr++;
|
||||
}
|
||||
if (*bufptr != '\0') {
|
||||
*bufptr++ = '\0';
|
||||
}
|
||||
if (bufptr == str) {
|
||||
// nothing here
|
||||
return NULL;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
char* parse_string() {
|
||||
if (had_error()) return NULL;
|
||||
|
||||
skip_ws();
|
||||
return scan_and_terminate(' ');
|
||||
}
|
||||
|
||||
char* parse_quoted_string() {
|
||||
if (had_error()) return NULL;
|
||||
|
||||
skip_ws();
|
||||
|
||||
if (*bufptr == '"') {
|
||||
bufptr++;
|
||||
return scan_and_terminate('"');
|
||||
} else {
|
||||
return scan_and_terminate(' ');
|
||||
}
|
||||
}
|
||||
|
||||
const char* parse_escaped_string() {
|
||||
char* result = parse_quoted_string();
|
||||
if (result != NULL) {
|
||||
unescape_string(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Look for the tag 'tag' followed by an
|
||||
bool parse_tag_and_count(const char* tag, int& length) {
|
||||
const char* t = parse_string();
|
||||
if (t == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(tag, t) != 0) {
|
||||
report_error(tag);
|
||||
return false;
|
||||
}
|
||||
length = parse_int("parse_tag_and_count");
|
||||
return !had_error();
|
||||
}
|
||||
|
||||
// Parse a sequence of raw data encoded as bytes and return the
|
||||
// resulting data.
|
||||
char* parse_data(const char* tag, int& length) {
|
||||
if (!parse_tag_and_count(tag, length)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char * result = NEW_RESOURCE_ARRAY(char, length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
int val = parse_int("data");
|
||||
result[i] = val;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Parse a standard chunk of data emitted as:
|
||||
// 'tag' <length> # # ...
|
||||
// Where each # is an intptr_t item
|
||||
intptr_t* parse_intptr_data(const char* tag, int& length) {
|
||||
if (!parse_tag_and_count(tag, length)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
intptr_t* result = NEW_RESOURCE_ARRAY(intptr_t, length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
skip_ws();
|
||||
intptr_t val = parse_intptr_t("data");
|
||||
result[i] = val;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Parse a possibly quoted version of a symbol into a symbolOop
|
||||
Symbol* parse_symbol(TRAPS) {
|
||||
const char* str = parse_escaped_string();
|
||||
if (str != NULL) {
|
||||
Symbol* sym = SymbolTable::lookup(str, (int)strlen(str), CHECK_NULL);
|
||||
return sym;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Parse a valid klass name and look it up
|
||||
Klass* parse_klass(TRAPS) {
|
||||
const char* str = parse_escaped_string();
|
||||
Symbol* klass_name = SymbolTable::lookup(str, (int)strlen(str), CHECK_NULL);
|
||||
if (klass_name != NULL) {
|
||||
Klass* k = SystemDictionary::resolve_or_fail(klass_name, loader, protection_domain, true, THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
report_error(str);
|
||||
return NULL;
|
||||
}
|
||||
return k;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Lookup a klass
|
||||
Klass* resolve_klass(const char* klass, TRAPS) {
|
||||
Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL);
|
||||
return SystemDictionary::resolve_or_fail(klass_name, loader, protection_domain, true, CHECK_NULL);
|
||||
}
|
||||
|
||||
// Parse the standard tuple of <klass> <name> <signature>
|
||||
Method* parse_method(TRAPS) {
|
||||
InstanceKlass* k = (InstanceKlass*)parse_klass(CHECK_NULL);
|
||||
Symbol* method_name = parse_symbol(CHECK_NULL);
|
||||
Symbol* method_signature = parse_symbol(CHECK_NULL);
|
||||
Method* m = k->find_method(method_name, method_signature);
|
||||
if (m == NULL) {
|
||||
report_error("can't find method");
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
// Process each line of the replay file executing each command until
|
||||
// the file ends.
|
||||
void process(TRAPS) {
|
||||
line_no = 1;
|
||||
int pos = 0;
|
||||
int c = getc(stream);
|
||||
while(c != EOF) {
|
||||
if (pos + 1 >= buffer_length) {
|
||||
int newl = buffer_length * 2;
|
||||
char* newb = NEW_RESOURCE_ARRAY(char, newl);
|
||||
memcpy(newb, buffer, pos);
|
||||
buffer = newb;
|
||||
buffer_length = newl;
|
||||
}
|
||||
if (c == '\n') {
|
||||
// null terminate it, reset the pointer and process the line
|
||||
buffer[pos] = '\0';
|
||||
buffer_end = pos++;
|
||||
bufptr = buffer;
|
||||
process_command(CHECK);
|
||||
if (had_error()) {
|
||||
tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message);
|
||||
tty->print_cr("%s", buffer);
|
||||
assert(false, "error");
|
||||
return;
|
||||
}
|
||||
pos = 0;
|
||||
buffer_end = 0;
|
||||
line_no++;
|
||||
} else if (c == '\r') {
|
||||
// skip LF
|
||||
} else {
|
||||
buffer[pos++] = c;
|
||||
}
|
||||
c = getc(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void process_command(TRAPS) {
|
||||
char* cmd = parse_string();
|
||||
if (cmd == NULL) {
|
||||
return;
|
||||
}
|
||||
if (strcmp("#", cmd) == 0) {
|
||||
// ignore
|
||||
} else if (strcmp("compile", cmd) == 0) {
|
||||
process_compile(CHECK);
|
||||
} else if (strcmp("ciMethod", cmd) == 0) {
|
||||
process_ciMethod(CHECK);
|
||||
} else if (strcmp("ciMethodData", cmd) == 0) {
|
||||
process_ciMethodData(CHECK);
|
||||
} else if (strcmp("staticfield", cmd) == 0) {
|
||||
process_staticfield(CHECK);
|
||||
} else if (strcmp("ciInstanceKlass", cmd) == 0) {
|
||||
process_ciInstanceKlass(CHECK);
|
||||
} else if (strcmp("instanceKlass", cmd) == 0) {
|
||||
process_instanceKlass(CHECK);
|
||||
#if INCLUDE_JVMTI
|
||||
} else if (strcmp("JvmtiExport", cmd) == 0) {
|
||||
process_JvmtiExport(CHECK);
|
||||
#endif // INCLUDE_JVMTI
|
||||
} else {
|
||||
report_error("unknown command");
|
||||
}
|
||||
}
|
||||
|
||||
// compile <klass> <name> <signature> <entry_bci>
|
||||
void process_compile(TRAPS) {
|
||||
// methodHandle method;
|
||||
Method* method = parse_method(CHECK);
|
||||
int entry_bci = parse_int("entry_bci");
|
||||
Klass* k = method->method_holder();
|
||||
((InstanceKlass*)k)->initialize(THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
if (ReplayIgnoreInitErrors) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
((InstanceKlass*)k)->set_init_state(InstanceKlass::fully_initialized);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Make sure the existence of a prior compile doesn't stop this one
|
||||
nmethod* nm = (entry_bci != InvocationEntryBci) ? method->lookup_osr_nmethod_for(entry_bci, CompLevel_full_optimization, true) : method->code();
|
||||
if (nm != NULL) {
|
||||
nm->make_not_entrant();
|
||||
}
|
||||
replay_state = this;
|
||||
CompileBroker::compile_method(method, entry_bci, CompLevel_full_optimization,
|
||||
methodHandle(), 0, "replay", THREAD);
|
||||
replay_state = NULL;
|
||||
reset();
|
||||
}
|
||||
|
||||
// ciMethod <klass> <name> <signature> <invocation_counter> <backedge_counter> <interpreter_invocation_count> <interpreter_throwout_count> <instructions_size>
|
||||
//
|
||||
//
|
||||
void process_ciMethod(TRAPS) {
|
||||
Method* method = parse_method(CHECK);
|
||||
ciMethodRecord* rec = new_ciMethod(method);
|
||||
rec->invocation_counter = parse_int("invocation_counter");
|
||||
rec->backedge_counter = parse_int("backedge_counter");
|
||||
rec->interpreter_invocation_count = parse_int("interpreter_invocation_count");
|
||||
rec->interpreter_throwout_count = parse_int("interpreter_throwout_count");
|
||||
rec->instructions_size = parse_int("instructions_size");
|
||||
}
|
||||
|
||||
// ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
|
||||
void process_ciMethodData(TRAPS) {
|
||||
Method* method = parse_method(CHECK);
|
||||
/* jsut copied from Method, to build interpret data*/
|
||||
if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
|
||||
return;
|
||||
}
|
||||
// methodOopDesc::build_interpreter_method_data(method, CHECK);
|
||||
{
|
||||
// Grab a lock here to prevent multiple
|
||||
// MethodData*s from being created.
|
||||
MutexLocker ml(MethodData_lock, THREAD);
|
||||
if (method->method_data() == NULL) {
|
||||
ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
|
||||
MethodData* method_data = MethodData::allocate(loader_data, method, CHECK);
|
||||
method->set_method_data(method_data);
|
||||
}
|
||||
}
|
||||
|
||||
// collect and record all the needed information for later
|
||||
ciMethodDataRecord* rec = new_ciMethodData(method);
|
||||
rec->state = parse_int("state");
|
||||
rec->current_mileage = parse_int("current_mileage");
|
||||
|
||||
rec->orig_data = parse_data("orig", rec->orig_data_length);
|
||||
if (rec->orig_data == NULL) {
|
||||
return;
|
||||
}
|
||||
rec->data = parse_intptr_data("data", rec->data_length);
|
||||
if (rec->data == NULL) {
|
||||
return;
|
||||
}
|
||||
if (!parse_tag_and_count("oops", rec->oops_length)) {
|
||||
return;
|
||||
}
|
||||
rec->oops_handles = NEW_RESOURCE_ARRAY(jobject, rec->oops_length);
|
||||
rec->oops_offsets = NEW_RESOURCE_ARRAY(int, rec->oops_length);
|
||||
for (int i = 0; i < rec->oops_length; i++) {
|
||||
int offset = parse_int("offset");
|
||||
if (had_error()) {
|
||||
return;
|
||||
}
|
||||
Klass* k = parse_klass(CHECK);
|
||||
rec->oops_offsets[i] = offset;
|
||||
rec->oops_handles[i] = (jobject)(new KlassHandle(THREAD, k));
|
||||
}
|
||||
}
|
||||
|
||||
// instanceKlass <name>
|
||||
//
|
||||
// Loads and initializes the klass 'name'. This can be used to
|
||||
// create particular class loading environments
|
||||
void process_instanceKlass(TRAPS) {
|
||||
// just load the referenced class
|
||||
Klass* k = parse_klass(CHECK);
|
||||
}
|
||||
|
||||
// ciInstanceKlass <name> <is_linked> <is_initialized> <length> tag # # # ...
|
||||
//
|
||||
// Load the klass 'name' and link or initialize it. Verify that the
|
||||
// constant pool is the same length as 'length' and make sure the
|
||||
// constant pool tags are in the same state.
|
||||
void process_ciInstanceKlass(TRAPS) {
|
||||
InstanceKlass* k = (InstanceKlass *)parse_klass(CHECK);
|
||||
int is_linked = parse_int("is_linked");
|
||||
int is_initialized = parse_int("is_initialized");
|
||||
int length = parse_int("length");
|
||||
if (is_initialized) {
|
||||
k->initialize(THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
if (ReplayIgnoreInitErrors) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
k->set_init_state(InstanceKlass::fully_initialized);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (is_linked) {
|
||||
k->link_class(CHECK);
|
||||
}
|
||||
ConstantPool* cp = k->constants();
|
||||
if (length != cp->length()) {
|
||||
report_error("constant pool length mismatch: wrong class files?");
|
||||
return;
|
||||
}
|
||||
|
||||
int parsed_two_word = 0;
|
||||
for (int i = 1; i < length; i++) {
|
||||
int tag = parse_int("tag");
|
||||
if (had_error()) {
|
||||
return;
|
||||
}
|
||||
switch (cp->tag_at(i).value()) {
|
||||
case JVM_CONSTANT_UnresolvedClass: {
|
||||
if (tag == JVM_CONSTANT_Class) {
|
||||
tty->print_cr("Resolving klass %s at %d", cp->unresolved_klass_at(i)->as_utf8(), i);
|
||||
Klass* k = cp->klass_at(i, CHECK);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JVM_CONSTANT_Long:
|
||||
case JVM_CONSTANT_Double:
|
||||
parsed_two_word = i + 1;
|
||||
|
||||
case JVM_CONSTANT_ClassIndex:
|
||||
case JVM_CONSTANT_StringIndex:
|
||||
case JVM_CONSTANT_String:
|
||||
case JVM_CONSTANT_UnresolvedClassInError:
|
||||
case JVM_CONSTANT_Fieldref:
|
||||
case JVM_CONSTANT_Methodref:
|
||||
case JVM_CONSTANT_InterfaceMethodref:
|
||||
case JVM_CONSTANT_NameAndType:
|
||||
case JVM_CONSTANT_Utf8:
|
||||
case JVM_CONSTANT_Integer:
|
||||
case JVM_CONSTANT_Float:
|
||||
if (tag != cp->tag_at(i).value()) {
|
||||
report_error("tag mismatch: wrong class files?");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case JVM_CONSTANT_Class:
|
||||
if (tag == JVM_CONSTANT_Class) {
|
||||
} else if (tag == JVM_CONSTANT_UnresolvedClass) {
|
||||
tty->print_cr("Warning: entry was unresolved in the replay data");
|
||||
} else {
|
||||
report_error("Unexpected tag");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if (parsed_two_word == i) continue;
|
||||
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize a class and fill in the value for a static field.
|
||||
// This is useful when the compile was dependent on the value of
|
||||
// static fields but it's impossible to properly rerun the static
|
||||
// initiailizer.
|
||||
void process_staticfield(TRAPS) {
|
||||
InstanceKlass* k = (InstanceKlass *)parse_klass(CHECK);
|
||||
|
||||
if (ReplaySuppressInitializers == 0 ||
|
||||
ReplaySuppressInitializers == 2 && k->class_loader() == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(k->is_initialized(), "must be");
|
||||
|
||||
const char* field_name = parse_escaped_string();;
|
||||
const char* field_signature = parse_string();
|
||||
fieldDescriptor fd;
|
||||
Symbol* name = SymbolTable::lookup(field_name, (int)strlen(field_name), CHECK);
|
||||
Symbol* sig = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK);
|
||||
if (!k->find_local_field(name, sig, &fd) ||
|
||||
!fd.is_static() ||
|
||||
fd.has_initial_value()) {
|
||||
report_error(field_name);
|
||||
return;
|
||||
}
|
||||
|
||||
oop java_mirror = k->java_mirror();
|
||||
if (field_signature[0] == '[') {
|
||||
int length = parse_int("array length");
|
||||
oop value = NULL;
|
||||
|
||||
if (field_signature[1] == '[') {
|
||||
// multi dimensional array
|
||||
ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK);
|
||||
int rank = 0;
|
||||
while (field_signature[rank] == '[') {
|
||||
rank++;
|
||||
}
|
||||
int* dims = NEW_RESOURCE_ARRAY(int, rank);
|
||||
dims[0] = length;
|
||||
for (int i = 1; i < rank; i++) {
|
||||
dims[i] = 1; // These aren't relevant to the compiler
|
||||
}
|
||||
value = kelem->multi_allocate(rank, dims, CHECK);
|
||||
} else {
|
||||
if (strcmp(field_signature, "[B") == 0) {
|
||||
value = oopFactory::new_byteArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[Z") == 0) {
|
||||
value = oopFactory::new_boolArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[C") == 0) {
|
||||
value = oopFactory::new_charArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[S") == 0) {
|
||||
value = oopFactory::new_shortArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[F") == 0) {
|
||||
value = oopFactory::new_singleArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[D") == 0) {
|
||||
value = oopFactory::new_doubleArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[I") == 0) {
|
||||
value = oopFactory::new_intArray(length, CHECK);
|
||||
} else if (strcmp(field_signature, "[J") == 0) {
|
||||
value = oopFactory::new_longArray(length, CHECK);
|
||||
} else if (field_signature[0] == '[' && field_signature[1] == 'L') {
|
||||
KlassHandle kelem = resolve_klass(field_signature + 1, CHECK);
|
||||
value = oopFactory::new_objArray(kelem(), length, CHECK);
|
||||
} else {
|
||||
report_error("unhandled array staticfield");
|
||||
}
|
||||
}
|
||||
java_mirror->obj_field_put(fd.offset(), value);
|
||||
} else {
|
||||
const char* string_value = parse_escaped_string();
|
||||
if (strcmp(field_signature, "I") == 0) {
|
||||
int value = atoi(string_value);
|
||||
java_mirror->int_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "B") == 0) {
|
||||
int value = atoi(string_value);
|
||||
java_mirror->byte_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "C") == 0) {
|
||||
int value = atoi(string_value);
|
||||
java_mirror->char_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "S") == 0) {
|
||||
int value = atoi(string_value);
|
||||
java_mirror->short_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "Z") == 0) {
|
||||
int value = atol(string_value);
|
||||
java_mirror->bool_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "J") == 0) {
|
||||
jlong value;
|
||||
if (sscanf(string_value, INT64_FORMAT, &value) != 1) {
|
||||
fprintf(stderr, "Error parsing long: %s\n", string_value);
|
||||
return;
|
||||
}
|
||||
java_mirror->long_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "F") == 0) {
|
||||
float value = atof(string_value);
|
||||
java_mirror->float_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "D") == 0) {
|
||||
double value = atof(string_value);
|
||||
java_mirror->double_field_put(fd.offset(), value);
|
||||
} else if (strcmp(field_signature, "Ljava/lang/String;") == 0) {
|
||||
Handle value = java_lang_String::create_from_str(string_value, CHECK);
|
||||
java_mirror->obj_field_put(fd.offset(), value());
|
||||
} else if (field_signature[0] == 'L') {
|
||||
Symbol* klass_name = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK);
|
||||
KlassHandle kelem = resolve_klass(field_signature, CHECK);
|
||||
oop value = ((InstanceKlass*)kelem())->allocate_instance(CHECK);
|
||||
java_mirror->obj_field_put(fd.offset(), value);
|
||||
} else {
|
||||
report_error("unhandled staticfield");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
void process_JvmtiExport(TRAPS) {
|
||||
const char* field = parse_string();
|
||||
bool value = parse_int("JvmtiExport flag") != 0;
|
||||
if (strcmp(field, "can_access_local_variables") == 0) {
|
||||
JvmtiExport::set_can_access_local_variables(value);
|
||||
} else if (strcmp(field, "can_hotswap_or_post_breakpoint") == 0) {
|
||||
JvmtiExport::set_can_hotswap_or_post_breakpoint(value);
|
||||
} else if (strcmp(field, "can_post_on_exceptions") == 0) {
|
||||
JvmtiExport::set_can_post_on_exceptions(value);
|
||||
} else {
|
||||
report_error("Unrecognized JvmtiExport directive");
|
||||
}
|
||||
}
|
||||
#endif // INCLUDE_JVMTI
|
||||
|
||||
// Create and initialize a record for a ciMethod
|
||||
ciMethodRecord* new_ciMethod(Method* method) {
|
||||
ciMethodRecord* rec = NEW_RESOURCE_OBJ(ciMethodRecord);
|
||||
rec->klass = method->method_holder()->name()->as_utf8();
|
||||
rec->method = method->name()->as_utf8();
|
||||
rec->signature = method->signature()->as_utf8();
|
||||
ci_method_records.append(rec);
|
||||
return rec;
|
||||
}
|
||||
|
||||
// Lookup data for a ciMethod
|
||||
ciMethodRecord* find_ciMethodRecord(Method* method) {
|
||||
const char* klass_name = method->method_holder()->name()->as_utf8();
|
||||
const char* method_name = method->name()->as_utf8();
|
||||
const char* signature = method->signature()->as_utf8();
|
||||
for (int i = 0; i < ci_method_records.length(); i++) {
|
||||
ciMethodRecord* rec = ci_method_records.at(i);
|
||||
if (strcmp(rec->klass, klass_name) == 0 &&
|
||||
strcmp(rec->method, method_name) == 0 &&
|
||||
strcmp(rec->signature, signature) == 0) {
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create and initialize a record for a ciMethodData
|
||||
ciMethodDataRecord* new_ciMethodData(Method* method) {
|
||||
ciMethodDataRecord* rec = NEW_RESOURCE_OBJ(ciMethodDataRecord);
|
||||
rec->klass = method->method_holder()->name()->as_utf8();
|
||||
rec->method = method->name()->as_utf8();
|
||||
rec->signature = method->signature()->as_utf8();
|
||||
ci_method_data_records.append(rec);
|
||||
return rec;
|
||||
}
|
||||
|
||||
// Lookup data for a ciMethodData
|
||||
ciMethodDataRecord* find_ciMethodDataRecord(Method* method) {
|
||||
const char* klass_name = method->method_holder()->name()->as_utf8();
|
||||
const char* method_name = method->name()->as_utf8();
|
||||
const char* signature = method->signature()->as_utf8();
|
||||
for (int i = 0; i < ci_method_data_records.length(); i++) {
|
||||
ciMethodDataRecord* rec = ci_method_data_records.at(i);
|
||||
if (strcmp(rec->klass, klass_name) == 0 &&
|
||||
strcmp(rec->method, method_name) == 0 &&
|
||||
strcmp(rec->signature, signature) == 0) {
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* error_message() {
|
||||
return _error_message;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
_error_message = NULL;
|
||||
ci_method_records.clear();
|
||||
ci_method_data_records.clear();
|
||||
}
|
||||
|
||||
// Take an ascii string contain \u#### escapes and convert it to utf8
|
||||
// in place.
|
||||
static void unescape_string(char* value) {
|
||||
char* from = value;
|
||||
char* to = value;
|
||||
while (*from != '\0') {
|
||||
if (*from != '\\') {
|
||||
*from++ = *to++;
|
||||
} else {
|
||||
switch (from[1]) {
|
||||
case 'u': {
|
||||
from += 2;
|
||||
jchar value=0;
|
||||
for (int i=0; i<4; i++) {
|
||||
char c = *from++;
|
||||
switch (c) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
value = (value << 4) + c - '0';
|
||||
break;
|
||||
case 'a': case 'b': case 'c':
|
||||
case 'd': case 'e': case 'f':
|
||||
value = (value << 4) + 10 + c - 'a';
|
||||
break;
|
||||
case 'A': case 'B': case 'C':
|
||||
case 'D': case 'E': case 'F':
|
||||
value = (value << 4) + 10 + c - 'A';
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
UNICODE::convert_to_utf8(&value, 1, to);
|
||||
to++;
|
||||
break;
|
||||
}
|
||||
case 't': *to++ = '\t'; from += 2; break;
|
||||
case 'n': *to++ = '\n'; from += 2; break;
|
||||
case 'r': *to++ = '\r'; from += 2; break;
|
||||
case 'f': *to++ = '\f'; from += 2; break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
}
|
||||
*from = *to;
|
||||
}
|
||||
};
|
||||
|
||||
void ciReplay::replay(TRAPS) {
|
||||
int exit_code = replay_impl(THREAD);
|
||||
|
||||
Threads::destroy_vm();
|
||||
|
||||
vm_exit(exit_code);
|
||||
}
|
||||
|
||||
int ciReplay::replay_impl(TRAPS) {
|
||||
HandleMark hm;
|
||||
ResourceMark rm;
|
||||
// Make sure we don't run with background compilation
|
||||
BackgroundCompilation = false;
|
||||
|
||||
if (ReplaySuppressInitializers > 2) {
|
||||
// ReplaySuppressInitializers > 2 means that we want to allow
|
||||
// normal VM bootstrap but once we get into the replay itself
|
||||
// don't allow any intializers to be run.
|
||||
ReplaySuppressInitializers = 1;
|
||||
}
|
||||
|
||||
// Load and parse the replay data
|
||||
CompileReplay rp(ReplayDataFile, THREAD);
|
||||
int exit_code = 0;
|
||||
if (rp.can_replay()) {
|
||||
rp.process(THREAD);
|
||||
} else {
|
||||
exit_code = 1;
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
java_lang_Throwable::print_stack_trace(throwable, tty);
|
||||
tty->cr();
|
||||
exit_code = 2;
|
||||
}
|
||||
|
||||
if (rp.had_error()) {
|
||||
tty->print_cr("Failed on %s", rp.error_message());
|
||||
exit_code = 1;
|
||||
}
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
|
||||
void ciReplay::initialize(ciMethodData* m) {
|
||||
if (replay_state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT_IN_VM;
|
||||
ResourceMark rm;
|
||||
|
||||
Method* method = m->get_MethodData()->method();
|
||||
ciMethodDataRecord* rec = replay_state->find_ciMethodDataRecord(method);
|
||||
if (rec == NULL) {
|
||||
// This indicates some mismatch with the original environment and
|
||||
// the replay environment though it's not always enough to
|
||||
// interfere with reproducing a bug
|
||||
tty->print_cr("Warning: requesting ciMethodData record for method with no data: ");
|
||||
method->print_name(tty);
|
||||
tty->cr();
|
||||
} else {
|
||||
m->_state = rec->state;
|
||||
m->_current_mileage = rec->current_mileage;
|
||||
if (rec->data_length != 0) {
|
||||
assert(m->_data_size == rec->data_length * (int)sizeof(rec->data[0]), "must agree");
|
||||
|
||||
// Write the correct ciObjects back into the profile data
|
||||
ciEnv* env = ciEnv::current();
|
||||
for (int i = 0; i < rec->oops_length; i++) {
|
||||
KlassHandle *h = (KlassHandle *)rec->oops_handles[i];
|
||||
*(ciMetadata**)(rec->data + rec->oops_offsets[i]) =
|
||||
env->get_metadata((*h)());
|
||||
}
|
||||
// Copy the updated profile data into place as intptr_ts
|
||||
#ifdef _LP64
|
||||
Copy::conjoint_jlongs_atomic((jlong *)rec->data, (jlong *)m->_data, rec->data_length);
|
||||
#else
|
||||
Copy::conjoint_jints_atomic((jint *)rec->data, (jint *)m->_data, rec->data_length);
|
||||
#endif
|
||||
}
|
||||
|
||||
// copy in the original header
|
||||
Copy::conjoint_jbytes(rec->orig_data, (char*)&m->_orig, rec->orig_data_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ciReplay::should_not_inline(ciMethod* method) {
|
||||
if (replay_state == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
VM_ENTRY_MARK;
|
||||
// ciMethod without a record shouldn't be inlined.
|
||||
return replay_state->find_ciMethodRecord(method->get_Method()) == NULL;
|
||||
}
|
||||
|
||||
|
||||
void ciReplay::initialize(ciMethod* m) {
|
||||
if (replay_state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT_IN_VM;
|
||||
ResourceMark rm;
|
||||
|
||||
Method* method = m->get_Method();
|
||||
ciMethodRecord* rec = replay_state->find_ciMethodRecord(method);
|
||||
if (rec == NULL) {
|
||||
// This indicates some mismatch with the original environment and
|
||||
// the replay environment though it's not always enough to
|
||||
// interfere with reproducing a bug
|
||||
tty->print_cr("Warning: requesting ciMethod record for method with no data: ");
|
||||
method->print_name(tty);
|
||||
tty->cr();
|
||||
} else {
|
||||
// m->_instructions_size = rec->instructions_size;
|
||||
m->_instructions_size = -1;
|
||||
m->_interpreter_invocation_count = rec->interpreter_invocation_count;
|
||||
m->_interpreter_throwout_count = rec->interpreter_throwout_count;
|
||||
method->invocation_counter()->_counter = rec->invocation_counter;
|
||||
method->backedge_counter()->_counter = rec->backedge_counter;
|
||||
}
|
||||
}
|
||||
|
||||
bool ciReplay::is_loaded(Method* method) {
|
||||
if (replay_state == NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ASSERT_IN_VM;
|
||||
ResourceMark rm;
|
||||
|
||||
ciMethodRecord* rec = replay_state->find_ciMethodRecord(method);
|
||||
return rec != NULL;
|
||||
}
|
||||
#endif
|
55
hotspot/src/share/vm/ci/ciReplay.hpp
Normal file
55
hotspot/src/share/vm/ci/ciReplay.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_VM_CI_CIREPLAY_HPP
|
||||
#define SHARE_VM_CI_CIREPLAY_HPP
|
||||
|
||||
#include "ci/ciMethod.hpp"
|
||||
|
||||
// ciReplay
|
||||
|
||||
class ciReplay {
|
||||
CI_PACKAGE_ACCESS
|
||||
|
||||
#ifdef ASSERT
|
||||
private:
|
||||
static int replay_impl(TRAPS);
|
||||
|
||||
public:
|
||||
static void replay(TRAPS);
|
||||
|
||||
// These are used by the CI to fill in the cached data from the
|
||||
// replay file when replaying compiles.
|
||||
static void initialize(ciMethodData* method);
|
||||
static void initialize(ciMethod* method);
|
||||
|
||||
static bool is_loaded(Method* method);
|
||||
static bool is_loaded(Klass* klass);
|
||||
|
||||
static bool should_not_inline(ciMethod* method);
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_CI_CIREPLAY_HPP
|
@ -63,6 +63,11 @@ const char* ciSymbol::as_utf8() {
|
||||
return s->as_utf8();
|
||||
}
|
||||
|
||||
// The text of the symbol as a null-terminated C string.
|
||||
const char* ciSymbol::as_quoted_ascii() {
|
||||
GUARDED_VM_QUICK_ENTRY(return get_symbol()->as_quoted_ascii();)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciSymbol::base
|
||||
const jbyte* ciSymbol::base() {
|
||||
|
@ -73,6 +73,9 @@ public:
|
||||
const char* as_utf8();
|
||||
int utf8_length();
|
||||
|
||||
// The text of the symbol as ascii with all non-printable characters quoted as \u####
|
||||
const char* as_quoted_ascii();
|
||||
|
||||
// Return the i-th utf8 byte, where i < utf8_length
|
||||
int byte_at(int i);
|
||||
|
||||
|
@ -45,7 +45,7 @@ ciType::ciType(BasicType basic_type) : ciMetadata() {
|
||||
}
|
||||
|
||||
ciType::ciType(KlassHandle k) : ciMetadata(k()) {
|
||||
_basic_type = Klass::cast(k())->oop_is_array() ? T_ARRAY : T_OBJECT;
|
||||
_basic_type = k()->oop_is_array() ? T_ARRAY : T_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -80,6 +80,9 @@
|
||||
#define GUARDED_VM_ENTRY(action) \
|
||||
{if (IS_IN_VM) { action } else { VM_ENTRY_MARK; { action }}}
|
||||
|
||||
#define GUARDED_VM_QUICK_ENTRY(action) \
|
||||
{if (IS_IN_VM) { action } else { VM_QUICK_ENTRY_MARK; { action }}}
|
||||
|
||||
// Redefine this later.
|
||||
#define KILL_COMPILE_ON_FATAL_(result) \
|
||||
THREAD); \
|
||||
|
@ -824,7 +824,7 @@ Array<Klass*>* ClassFileParser::parse_interfaces(constantPoolHandle cp,
|
||||
interf = KlassHandle(THREAD, k);
|
||||
}
|
||||
|
||||
if (!Klass::cast(interf())->is_interface()) {
|
||||
if (!interf()->is_interface()) {
|
||||
THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", NULL);
|
||||
}
|
||||
if (InstanceKlass::cast(interf())->has_default_methods()) {
|
||||
@ -3831,7 +3831,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
|
||||
if (TraceClassResolution) {
|
||||
ResourceMark rm;
|
||||
// print out the superclass.
|
||||
const char * from = Klass::cast(this_klass())->external_name();
|
||||
const char * from = this_klass()->external_name();
|
||||
if (this_klass->java_super() != NULL) {
|
||||
tty->print("RESOLVE %s %s (super)\n", from, InstanceKlass::cast(this_klass->java_super())->external_name());
|
||||
}
|
||||
@ -3982,13 +3982,13 @@ void ClassFileParser::set_precomputed_flags(instanceKlassHandle k) {
|
||||
// java.lang.Object has empty default constructor
|
||||
k->set_has_vanilla_constructor();
|
||||
} else {
|
||||
if (Klass::cast(super)->has_vanilla_constructor() &&
|
||||
if (super->has_vanilla_constructor() &&
|
||||
_has_vanilla_constructor) {
|
||||
k->set_has_vanilla_constructor();
|
||||
}
|
||||
#ifdef ASSERT
|
||||
bool v = false;
|
||||
if (Klass::cast(super)->has_vanilla_constructor()) {
|
||||
if (super->has_vanilla_constructor()) {
|
||||
Method* constructor = k->find_method(vmSymbols::object_initializer_name(
|
||||
), vmSymbols::void_method_signature());
|
||||
if (constructor != NULL && constructor->is_vanilla_constructor()) {
|
||||
@ -4130,7 +4130,7 @@ void ClassFileParser::check_super_interface_access(instanceKlassHandle this_klas
|
||||
int lng = local_interfaces->length();
|
||||
for (int i = lng - 1; i >= 0; i--) {
|
||||
Klass* k = local_interfaces->at(i);
|
||||
assert (k != NULL && Klass::cast(k)->is_interface(), "invalid interface");
|
||||
assert (k != NULL && k->is_interface(), "invalid interface");
|
||||
if (!Reflection::verify_class_access(this_klass(), k, false)) {
|
||||
ResourceMark rm(THREAD);
|
||||
Exceptions::fthrow(
|
||||
|
@ -605,8 +605,10 @@ void ClassLoader::load_zip_library() {
|
||||
// Load zip library
|
||||
char path[JVM_MAXPATHLEN];
|
||||
char ebuf[1024];
|
||||
os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "zip");
|
||||
void* handle = os::dll_load(path, ebuf, sizeof ebuf);
|
||||
void* handle = NULL;
|
||||
if (os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "zip")) {
|
||||
handle = os::dll_load(path, ebuf, sizeof ebuf);
|
||||
}
|
||||
if (handle == NULL) {
|
||||
vm_exit_during_initialization("Unable to load ZIP library", path);
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ void Dictionary::add_klass(Symbol* class_name, ClassLoaderData* loader_data,
|
||||
KlassHandle obj) {
|
||||
assert_locked_or_safepoint(SystemDictionary_lock);
|
||||
assert(obj() != NULL, "adding NULL obj");
|
||||
assert(Klass::cast(obj())->name() == class_name, "sanity check on name");
|
||||
assert(obj()->name() == class_name, "sanity check on name");
|
||||
|
||||
unsigned int hash = compute_hash(class_name, loader_data);
|
||||
int index = hash_to_index(hash);
|
||||
@ -553,7 +553,7 @@ void Dictionary::print() {
|
||||
bool is_defining_class =
|
||||
(loader_data == InstanceKlass::cast(e)->class_loader_data());
|
||||
tty->print("%s%s", is_defining_class ? " " : "^",
|
||||
Klass::cast(e)->external_name());
|
||||
e->external_name());
|
||||
|
||||
tty->print(", loader ");
|
||||
loader_data->print_value();
|
||||
@ -575,7 +575,7 @@ void Dictionary::verify() {
|
||||
probe = probe->next()) {
|
||||
Klass* e = probe->klass();
|
||||
ClassLoaderData* loader_data = probe->loader_data();
|
||||
guarantee(Klass::cast(e)->oop_is_instance(),
|
||||
guarantee(e->oop_is_instance(),
|
||||
"Verify of system dictionary failed");
|
||||
// class loader must be present; a null class loader is the
|
||||
// boostrap loader
|
||||
|
@ -348,6 +348,22 @@ unsigned int java_lang_String::to_hash(oop java_string) {
|
||||
return java_lang_String::to_hash(value->char_at_addr(offset), length);
|
||||
}
|
||||
|
||||
char* java_lang_String::as_quoted_ascii(oop java_string) {
|
||||
typeArrayOop value = java_lang_String::value(java_string);
|
||||
int offset = java_lang_String::offset(java_string);
|
||||
int length = java_lang_String::length(java_string);
|
||||
|
||||
jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
|
||||
if (base == NULL) return NULL;
|
||||
|
||||
int result_length = UNICODE::quoted_ascii_length(base, length) + 1;
|
||||
char* result = NEW_RESOURCE_ARRAY(char, result_length);
|
||||
UNICODE::as_quoted_ascii(base, length, result, result_length);
|
||||
assert(result_length >= length + 1, "must not be shorter");
|
||||
assert(result_length == (int)strlen(result) + 1, "must match");
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned int java_lang_String::hash_string(oop java_string) {
|
||||
int length = java_lang_String::length(java_string);
|
||||
// Zero length string doesn't hash necessarily hash to zero.
|
||||
@ -545,7 +561,7 @@ oop java_lang_Class::create_mirror(KlassHandle k, TRAPS) {
|
||||
assert(k->oop_is_objArray(), "Must be");
|
||||
Klass* element_klass = ObjArrayKlass::cast(k())->element_klass();
|
||||
assert(element_klass != NULL, "Must have an element klass");
|
||||
comp_mirror = Klass::cast(element_klass)->java_mirror();
|
||||
comp_mirror = element_klass->java_mirror();
|
||||
}
|
||||
assert(comp_mirror.not_null(), "must have a mirror");
|
||||
|
||||
@ -628,8 +644,8 @@ void java_lang_Class::print_signature(oop java_class, outputStream* st) {
|
||||
name = vmSymbols::type_signature(primitive_type(java_class));
|
||||
} else {
|
||||
Klass* k = as_Klass(java_class);
|
||||
is_instance = Klass::cast(k)->oop_is_instance();
|
||||
name = Klass::cast(k)->name();
|
||||
is_instance = k->oop_is_instance();
|
||||
name = k->name();
|
||||
}
|
||||
if (name == NULL) {
|
||||
st->print("<null>");
|
||||
@ -651,12 +667,12 @@ Symbol* java_lang_Class::as_signature(oop java_class, bool intern_if_not_found,
|
||||
name->increment_refcount();
|
||||
} else {
|
||||
Klass* k = as_Klass(java_class);
|
||||
if (!Klass::cast(k)->oop_is_instance()) {
|
||||
name = Klass::cast(k)->name();
|
||||
if (!k->oop_is_instance()) {
|
||||
name = k->name();
|
||||
name->increment_refcount();
|
||||
} else {
|
||||
ResourceMark rm;
|
||||
const char* sigstr = Klass::cast(k)->signature_name();
|
||||
const char* sigstr = k->signature_name();
|
||||
int siglen = (int) strlen(sigstr);
|
||||
if (!intern_if_not_found) {
|
||||
name = SymbolTable::probe(sigstr, siglen);
|
||||
@ -671,13 +687,13 @@ Symbol* java_lang_Class::as_signature(oop java_class, bool intern_if_not_found,
|
||||
|
||||
Klass* java_lang_Class::array_klass(oop java_class) {
|
||||
Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
|
||||
assert(k == NULL || k->is_klass() && Klass::cast(k)->oop_is_array(), "should be array klass");
|
||||
assert(k == NULL || k->is_klass() && k->oop_is_array(), "should be array klass");
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
void java_lang_Class::set_array_klass(oop java_class, Klass* klass) {
|
||||
assert(klass->is_klass() && Klass::cast(klass)->oop_is_array(), "should be array klass");
|
||||
assert(klass->is_klass() && klass->oop_is_array(), "should be array klass");
|
||||
java_class->metadata_field_put(_array_klass_offset, klass);
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,8 @@ class java_lang_String : AllStatic {
|
||||
static char* as_utf8_string(oop java_string, int start, int len);
|
||||
static char* as_platform_dependent_str(Handle java_string, TRAPS);
|
||||
static jchar* as_unicode_string(oop java_string, int& length);
|
||||
// produce an ascii string with all other values quoted using \u####
|
||||
static char* as_quoted_ascii(oop java_string);
|
||||
|
||||
// Compute the hash value for a java.lang.String object which would
|
||||
// contain the characters passed in.
|
||||
@ -912,7 +914,7 @@ class java_lang_invoke_MethodHandle: AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::MethodHandle_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::MethodHandle_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -942,7 +944,7 @@ class java_lang_invoke_LambdaForm: AllStatic {
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return SystemDictionary::LambdaForm_klass() != NULL &&
|
||||
Klass::cast(klass)->is_subclass_of(SystemDictionary::LambdaForm_klass());
|
||||
klass->is_subclass_of(SystemDictionary::LambdaForm_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -1004,7 +1006,7 @@ class java_lang_invoke_MemberName: AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::MemberName_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::MemberName_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -1090,7 +1092,7 @@ public:
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::CallSite_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
@ -1160,7 +1162,7 @@ class java_lang_ClassLoader : AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
return Klass::cast(klass)->is_subclass_of(SystemDictionary::ClassLoader_klass());
|
||||
return klass->is_subclass_of(SystemDictionary::ClassLoader_klass());
|
||||
}
|
||||
static bool is_instance(oop obj) {
|
||||
return obj != NULL && is_subclass(obj->klass());
|
||||
|
@ -320,7 +320,7 @@ Klass* LoaderConstraintTable::find_constrained_klass(Symbol* name,
|
||||
Handle loader) {
|
||||
LoaderConstraintEntry *p = *(find_loader_constraint(name, loader));
|
||||
if (p != NULL && p->klass() != NULL) {
|
||||
if (Klass::cast(p->klass())->oop_is_instance() && !InstanceKlass::cast(p->klass())->is_loaded()) {
|
||||
if (p->klass()->oop_is_instance() && !InstanceKlass::cast(p->klass())->is_loaded()) {
|
||||
// Only return fully loaded classes. Classes found through the
|
||||
// constraints might still be in the process of loading.
|
||||
return NULL;
|
||||
|
@ -45,7 +45,7 @@ PlaceholderEntry* PlaceholderTable::new_entry(int hash, Symbol* name,
|
||||
entry->set_loadInstanceThreadQ(NULL);
|
||||
entry->set_defineThreadQ(NULL);
|
||||
entry->set_definer(NULL);
|
||||
entry->set_instanceKlass(NULL);
|
||||
entry->set_instance_klass(NULL);
|
||||
return entry;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ void PlaceholderTable::classes_do(KlassClosure* f) {
|
||||
void PlaceholderEntry::classes_do(KlassClosure* closure) {
|
||||
assert(klassname() != NULL, "should have a non-null klass");
|
||||
if (_instanceKlass != NULL) {
|
||||
closure->do_klass(InstanceKlass());
|
||||
closure->do_klass(instance_klass());
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,9 +220,9 @@ void PlaceholderEntry::print() const {
|
||||
tty->print(", definer ");
|
||||
definer()->print_value();
|
||||
}
|
||||
if (InstanceKlass() != NULL) {
|
||||
if (instance_klass() != NULL) {
|
||||
tty->print(", InstanceKlass ");
|
||||
InstanceKlass()->print_value();
|
||||
instance_klass()->print_value();
|
||||
}
|
||||
tty->print("\n");
|
||||
tty->print("loadInstanceThreadQ threads:");
|
||||
@ -241,9 +241,9 @@ void PlaceholderEntry::verify() const {
|
||||
guarantee(loader_data() != NULL, "Must have been setup.");
|
||||
guarantee(loader_data()->class_loader() == NULL || loader_data()->class_loader()->is_instance(),
|
||||
"checking type of _loader");
|
||||
guarantee(InstanceKlass() == NULL
|
||||
|| Klass::cast(InstanceKlass())->oop_is_instance(),
|
||||
"checking type of InstanceKlass result");
|
||||
guarantee(instance_klass() == NULL
|
||||
|| instance_klass()->oop_is_instance(),
|
||||
"checking type of instance_klass result");
|
||||
}
|
||||
|
||||
void PlaceholderTable::verify() {
|
||||
|
@ -191,8 +191,8 @@ class PlaceholderEntry : public HashtableEntry<Symbol*, mtClass> {
|
||||
Thread* definer() const {return _definer; }
|
||||
void set_definer(Thread* definer) { _definer = definer; }
|
||||
|
||||
Klass* InstanceKlass() const {return _instanceKlass; }
|
||||
void set_instanceKlass(Klass* InstanceKlass) { _instanceKlass = InstanceKlass; }
|
||||
Klass* instance_klass() const {return _instanceKlass; }
|
||||
void set_instance_klass(Klass* ik) { _instanceKlass = ik; }
|
||||
|
||||
SeenThread* superThreadQ() const { return _superThreadQ; }
|
||||
void set_superThreadQ(SeenThread* SeenThread) { _superThreadQ = SeenThread; }
|
||||
|
@ -262,19 +262,14 @@ public:
|
||||
// The string table
|
||||
static StringTable* the_table() { return _the_table; }
|
||||
|
||||
// Size of one bucket in the string table. Used when checking for rollover.
|
||||
static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
|
||||
|
||||
static void create_table() {
|
||||
assert(_the_table == NULL, "One string table allowed.");
|
||||
_the_table = new StringTable();
|
||||
}
|
||||
|
||||
static void create_table(HashtableBucket<mtSymbol>* t, int length,
|
||||
int number_of_entries) {
|
||||
assert(_the_table == NULL, "One string table allowed.");
|
||||
assert((size_t)length == StringTableSize * sizeof(HashtableBucket<mtSymbol>),
|
||||
"bad shared string size.");
|
||||
_the_table = new StringTable(t, number_of_entries);
|
||||
}
|
||||
|
||||
// GC support
|
||||
// Delete pointers to otherwise-unreachable objects.
|
||||
static void unlink(BoolObjectClosure* cl);
|
||||
|
@ -240,7 +240,7 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
|
||||
protection_domain,
|
||||
CHECK_NULL);
|
||||
if (k != NULL) {
|
||||
k = Klass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
|
||||
k = k->array_klass(fd.dimension(), CHECK_NULL);
|
||||
}
|
||||
} else {
|
||||
k = Universe::typeArrayKlassObj(t);
|
||||
@ -328,8 +328,8 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
|
||||
if ((childk != NULL ) && (is_superclass) &&
|
||||
((quicksuperk = InstanceKlass::cast(childk)->super()) != NULL) &&
|
||||
|
||||
((Klass::cast(quicksuperk)->name() == class_name) &&
|
||||
(Klass::cast(quicksuperk)->class_loader() == class_loader()))) {
|
||||
((quicksuperk->name() == class_name) &&
|
||||
(quicksuperk->class_loader() == class_loader()))) {
|
||||
return quicksuperk;
|
||||
} else {
|
||||
PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
|
||||
@ -928,7 +928,7 @@ Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
|
||||
k = SystemDictionary::find(fd.object_key(), class_loader, protection_domain, THREAD);
|
||||
}
|
||||
if (k != NULL) {
|
||||
k = Klass::cast(k)->array_klass_or_null(fd.dimension());
|
||||
k = k->array_klass_or_null(fd.dimension());
|
||||
}
|
||||
} else {
|
||||
k = find(class_name, class_loader, protection_domain, THREAD);
|
||||
@ -1537,7 +1537,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
|
||||
// Only special cases allow parallel defines and can use other thread's results
|
||||
// Other cases fall through, and may run into duplicate defines
|
||||
// caught by finding an entry in the SystemDictionary
|
||||
if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->InstanceKlass() != NULL)) {
|
||||
if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->instance_klass() != NULL)) {
|
||||
probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS);
|
||||
placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, THREAD);
|
||||
SystemDictionary_lock->notify_all();
|
||||
@ -1545,7 +1545,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
|
||||
Klass* check = find_class(d_index, d_hash, name_h, loader_data);
|
||||
assert(check != NULL, "definer missed recording success");
|
||||
#endif
|
||||
return(instanceKlassHandle(THREAD, probe->InstanceKlass()));
|
||||
return(instanceKlassHandle(THREAD, probe->instance_klass()));
|
||||
} else {
|
||||
// This thread will define the class (even if earlier thread tried and had an error)
|
||||
probe->set_definer(THREAD);
|
||||
@ -1566,7 +1566,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
|
||||
linkage_exception = Handle(THREAD,PENDING_EXCEPTION);
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
} else {
|
||||
probe->set_instanceKlass(k());
|
||||
probe->set_instance_klass(k());
|
||||
}
|
||||
probe->set_definer(NULL);
|
||||
probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS);
|
||||
@ -2149,7 +2149,7 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
|
||||
}
|
||||
// If element class already loaded, allocate array klass
|
||||
if (klass != NULL) {
|
||||
klass = Klass::cast(klass)->array_klass_or_null(fd.dimension());
|
||||
klass = klass->array_klass_or_null(fd.dimension());
|
||||
}
|
||||
} else {
|
||||
MutexLocker mu(SystemDictionary_lock, THREAD);
|
||||
@ -2466,9 +2466,9 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
|
||||
Klass* sel_klass = java_lang_Class::as_Klass(mirror);
|
||||
mirror = NULL; // safety
|
||||
// Emulate ConstantPool::verify_constant_pool_resolve.
|
||||
if (Klass::cast(sel_klass)->oop_is_objArray())
|
||||
if (sel_klass->oop_is_objArray())
|
||||
sel_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass();
|
||||
if (Klass::cast(sel_klass)->oop_is_instance()) {
|
||||
if (sel_klass->oop_is_instance()) {
|
||||
KlassHandle sel_kh(THREAD, sel_klass);
|
||||
LinkResolver::check_klass_accessability(accessing_klass, sel_kh, CHECK_(empty));
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ void Dependencies::print_dependency(DepType dept, int nargs, DepArgument args[],
|
||||
}
|
||||
tty->print(" %s = %s", what, (put_star? "*": ""));
|
||||
if (arg.is_klass())
|
||||
tty->print("%s", Klass::cast((Klass*)arg.metadata_value())->external_name());
|
||||
tty->print("%s", ((Klass*)arg.metadata_value())->external_name());
|
||||
else if (arg.is_method())
|
||||
((Method*)arg.metadata_value())->print_value();
|
||||
else
|
||||
@ -563,12 +563,13 @@ void Dependencies::print_dependency(DepType dept, int nargs, DepArgument args[],
|
||||
bool put_star = !Dependencies::is_concrete_klass(witness);
|
||||
tty->print_cr(" witness = %s%s",
|
||||
(put_star? "*": ""),
|
||||
Klass::cast(witness)->external_name());
|
||||
witness->external_name());
|
||||
}
|
||||
}
|
||||
|
||||
void Dependencies::DepStream::log_dependency(Klass* witness) {
|
||||
if (_deps == NULL && xtty == NULL) return; // fast cutout for runtime
|
||||
ResourceMark rm;
|
||||
int nargs = argument_count();
|
||||
DepArgument args[max_arg_count];
|
||||
for (int j = 0; j < nargs; j++) {
|
||||
@ -808,7 +809,7 @@ class ClassHierarchyWalker {
|
||||
if (!(m->is_public() || m->is_protected()))
|
||||
// The override story is complex when packages get involved.
|
||||
return true; // Must punt the assertion to true.
|
||||
Klass* k = Klass::cast(ctxk);
|
||||
Klass* k = ctxk;
|
||||
Method* lm = k->lookup_method(m->name(), m->signature());
|
||||
if (lm == NULL && k->oop_is_instance()) {
|
||||
// It might be an abstract interface method, devoid of mirandas.
|
||||
@ -835,7 +836,7 @@ class ClassHierarchyWalker {
|
||||
}
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Dependency method not found in the associated context:");
|
||||
tty->print_cr(" context = %s", Klass::cast(ctxk)->external_name());
|
||||
tty->print_cr(" context = %s", ctxk->external_name());
|
||||
tty->print( " method = "); m->print_short_name(tty); tty->cr();
|
||||
if (lm != NULL) {
|
||||
tty->print( " found = "); lm->print_short_name(tty); tty->cr();
|
||||
@ -1010,7 +1011,7 @@ Klass* ClassHierarchyWalker::find_witness_in(KlassDepChange& changes,
|
||||
for (int i = 0; i < num_participants(); i++) {
|
||||
Klass* part = participant(i);
|
||||
if (part == NULL) continue;
|
||||
assert(changes.involves_context(part) == Klass::cast(new_type)->is_subtype_of(part),
|
||||
assert(changes.involves_context(part) == new_type->is_subtype_of(part),
|
||||
"correct marking of participants, b/c new_type is unique");
|
||||
if (changes.involves_context(part)) {
|
||||
// new guy is protected from this check by previous participant
|
||||
@ -1146,7 +1147,7 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type,
|
||||
|
||||
|
||||
bool Dependencies::is_concrete_klass(Klass* k) {
|
||||
if (Klass::cast(k)->is_abstract()) return false;
|
||||
if (k->is_abstract()) return false;
|
||||
// %%% We could treat classes which are concrete but
|
||||
// have not yet been instantiated as virtually abstract.
|
||||
// This would require a deoptimization barrier on first instantiation.
|
||||
@ -1705,12 +1706,12 @@ KlassDepChange::~KlassDepChange() {
|
||||
}
|
||||
|
||||
bool KlassDepChange::involves_context(Klass* k) {
|
||||
if (k == NULL || !Klass::cast(k)->oop_is_instance()) {
|
||||
if (k == NULL || !k->oop_is_instance()) {
|
||||
return false;
|
||||
}
|
||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||
bool is_contained = ik->is_marked_dependent();
|
||||
assert(is_contained == Klass::cast(new_type())->is_subtype_of(k),
|
||||
assert(is_contained == new_type()->is_subtype_of(k),
|
||||
"correct marking of potential context types");
|
||||
return is_contained;
|
||||
}
|
||||
|
@ -2568,9 +2568,8 @@ void nmethod::print_dependencies() {
|
||||
deps.print_dependency();
|
||||
Klass* ctxk = deps.context_type();
|
||||
if (ctxk != NULL) {
|
||||
Klass* k = Klass::cast(ctxk);
|
||||
if (k->oop_is_instance() && ((InstanceKlass*)k)->is_dependent_nmethod(this)) {
|
||||
tty->print_cr(" [nmethod<=klass]%s", k->external_name());
|
||||
if (ctxk->oop_is_instance() && ((InstanceKlass*)ctxk)->is_dependent_nmethod(this)) {
|
||||
tty->print_cr(" [nmethod<=klass]%s", ctxk->external_name());
|
||||
}
|
||||
}
|
||||
deps.log_dependency(); // put it into the xml log also
|
||||
|
@ -353,7 +353,7 @@ void decode_env::print_address(address adr) {
|
||||
obj->print_value_on(st);
|
||||
if (st->count() == c) {
|
||||
// No output. (Can happen in product builds.)
|
||||
st->print("(a %s)", Klass::cast(obj->klass())->external_name());
|
||||
st->print("(a %s)", obj->klass()->external_name());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2043,8 +2043,8 @@ run:
|
||||
if (objKlassOop != klassOf &&
|
||||
!objKlassOop->is_subtype_of(klassOf)) {
|
||||
ResourceMark rm(THREAD);
|
||||
const char* objName = Klass::cast(objKlassOop)->external_name();
|
||||
const char* klassName = Klass::cast(klassOf)->external_name();
|
||||
const char* objName = objKlassOop->external_name();
|
||||
const char* klassName = klassOf->external_name();
|
||||
char* message = SharedRuntime::generate_class_cast_message(
|
||||
objName, klassName);
|
||||
VM_JAVA_ERROR(vmSymbols::java_lang_ClassCastException(), message);
|
||||
|
@ -312,7 +312,7 @@ IRT_END
|
||||
|
||||
IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
|
||||
ResourceMark rm(thread);
|
||||
const char* klass_name = Klass::cast(obj->klass())->external_name();
|
||||
const char* klass_name = obj->klass()->external_name();
|
||||
// lookup exception klass
|
||||
TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
|
||||
if (ProfileTraps) {
|
||||
@ -341,7 +341,7 @@ IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
|
||||
|
||||
ResourceMark rm(thread);
|
||||
char* message = SharedRuntime::generate_class_cast_message(
|
||||
thread, Klass::cast(obj->klass())->external_name());
|
||||
thread, obj->klass()->external_name());
|
||||
|
||||
if (ProfileTraps) {
|
||||
note_trap(thread, Deoptimization::Reason_class_check, CHECK);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
class InvocationCounter VALUE_OBJ_CLASS_SPEC {
|
||||
friend class VMStructs;
|
||||
friend class ciReplay;
|
||||
private: // bit no: |31 3| 2 | 1 0 |
|
||||
unsigned int _counter; // format: [count|carry|state]
|
||||
|
||||
@ -85,6 +86,8 @@ class InvocationCounter VALUE_OBJ_CLASS_SPEC {
|
||||
void set_carry(); // set the sticky carry bit
|
||||
void set_carry_flag() { _counter |= carry_mask; }
|
||||
|
||||
int raw_counter() { return _counter; }
|
||||
|
||||
// Accessors
|
||||
State state() const { return (State)(_counter & state_mask); }
|
||||
bool carry() const { return (_counter & carry_mask) != 0; }
|
||||
|
@ -203,7 +203,7 @@ void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, Klass
|
||||
Method* result_oop = klass->uncached_lookup_method(name, signature);
|
||||
result = methodHandle(THREAD, result_oop);
|
||||
while (!result.is_null() && result->is_static()) {
|
||||
klass = KlassHandle(THREAD, Klass::cast(result->method_holder())->super());
|
||||
klass = KlassHandle(THREAD, result->method_holder()->super());
|
||||
result = methodHandle(THREAD, klass->uncached_lookup_method(name, signature));
|
||||
}
|
||||
}
|
||||
@ -428,7 +428,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
|
||||
// 3. method lookup failed
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
method_name,
|
||||
method_signature),
|
||||
nested_exception);
|
||||
@ -448,7 +448,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
|
||||
if (resolved_method->is_abstract() && !resolved_klass->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
method_name,
|
||||
method_signature));
|
||||
}
|
||||
@ -477,7 +477,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res
|
||||
" \"%s\" the class loader (instance of %s) of the current class, %s,"
|
||||
" and the class loader (instance of %s) for resolved class, %s, have"
|
||||
" different Class objects for the type %s used in the signature";
|
||||
char* sig = Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),method_name,method_signature);
|
||||
char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature);
|
||||
const char* loader1 = SystemDictionary::loader_name(loader());
|
||||
char* current = InstanceKlass::cast(current_klass())->name()->as_C_string();
|
||||
const char* loader2 = SystemDictionary::loader_name(class_loader());
|
||||
@ -505,7 +505,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
|
||||
if (!resolved_klass->is_interface()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", Klass::cast(resolved_klass())->external_name());
|
||||
jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass()->external_name());
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
|
||||
// no method found
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
method_name,
|
||||
method_signature));
|
||||
}
|
||||
@ -540,7 +540,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
|
||||
"current class, %s, and the class loader (instance of %s) for "
|
||||
"resolved class, %s, have different Class objects for the type %s "
|
||||
"used in the signature";
|
||||
char* sig = Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),method_name,method_signature);
|
||||
char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature);
|
||||
const char* loader1 = SystemDictionary::loader_name(loader());
|
||||
char* current = InstanceKlass::cast(current_klass())->name()->as_C_string();
|
||||
const char* loader2 = SystemDictionary::loader_name(class_loader());
|
||||
@ -627,7 +627,7 @@ void LinkResolver::resolve_field(FieldAccessInfo& result, constantPoolHandle poo
|
||||
if (is_static != fd.is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char msg[200];
|
||||
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", Klass::cast(resolved_klass())->external_name(), fd.name()->as_C_string());
|
||||
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string());
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
|
||||
}
|
||||
|
||||
@ -701,7 +701,7 @@ void LinkResolver::resolve_static_call(CallInfo& result, KlassHandle& resolved_k
|
||||
bool check_access, bool initialize_class, TRAPS) {
|
||||
methodHandle resolved_method;
|
||||
linktime_resolve_static_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
|
||||
resolved_klass = KlassHandle(THREAD, Klass::cast(resolved_method->method_holder()));
|
||||
resolved_klass = KlassHandle(THREAD, resolved_method->method_holder());
|
||||
|
||||
// Initialize klass (this should only happen if everything is ok)
|
||||
if (initialize_class && resolved_klass->should_be_initialized()) {
|
||||
@ -725,7 +725,7 @@ void LinkResolver::linktime_resolve_static_method(methodHandle& resolved_method,
|
||||
if (!resolved_method->is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -789,7 +789,7 @@ void LinkResolver::linktime_resolve_special_method(methodHandle& resolved_method
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf),
|
||||
"Expecting non-static method %s",
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -829,7 +829,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
|
||||
if (sel_method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
}
|
||||
@ -840,7 +840,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
|
||||
if (sel_method->is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -850,7 +850,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
|
||||
if (sel_method->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
sel_method->name(),
|
||||
sel_method->signature()));
|
||||
}
|
||||
@ -881,7 +881,7 @@ void LinkResolver::linktime_resolve_virtual_method(methodHandle &resolved_method
|
||||
if (resolved_method->is_static()) {
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
@ -950,7 +950,7 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
|
||||
if (selected_method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
}
|
||||
@ -959,7 +959,7 @@ void LinkResolver::runtime_resolve_virtual_method(CallInfo& result,
|
||||
if (check_null_and_abstract && selected_method->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
selected_method->name(),
|
||||
selected_method->signature()));
|
||||
}
|
||||
@ -999,8 +999,8 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
ResourceMark rm(THREAD);
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s",
|
||||
(Klass::cast(recv_klass()))->external_name(),
|
||||
(Klass::cast(resolved_klass()))->external_name());
|
||||
recv_klass()->external_name(),
|
||||
resolved_klass()->external_name());
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
|
||||
}
|
||||
// do lookup based on receiver klass
|
||||
@ -1012,7 +1012,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
if (sel_method.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(recv_klass()),
|
||||
Method::name_and_sig_as_C_string(recv_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
if (!sel_method->is_public()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(recv_klass()),
|
||||
Method::name_and_sig_as_C_string(recv_klass(),
|
||||
sel_method->name(),
|
||||
sel_method->signature()));
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
|
||||
if (check_null_and_abstract && sel_method->is_abstract()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(recv_klass()),
|
||||
Method::name_and_sig_as_C_string(recv_klass(),
|
||||
sel_method->name(),
|
||||
sel_method->signature()));
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ TreeList<Chunk_t, FreeList_t>* TreeList<Chunk_t, FreeList_t>::remove_chunk_repla
|
||||
} else {
|
||||
if (nextTC == NULL) {
|
||||
// Removing chunk at tail of list
|
||||
link_tail(prevFC);
|
||||
this->link_tail(prevFC);
|
||||
}
|
||||
// Chunk is interior to the list
|
||||
prevFC->link_after(nextTC);
|
||||
@ -296,7 +296,7 @@ void TreeList<Chunk_t, FreeList_t>::return_chunk_at_tail(TreeChunk<Chunk_t, Free
|
||||
|
||||
Chunk_t* fc = tail();
|
||||
fc->link_after(chunk);
|
||||
link_tail(chunk);
|
||||
this->link_tail(chunk);
|
||||
|
||||
assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list");
|
||||
FreeList_t<Chunk_t>::increment_count();
|
||||
@ -323,7 +323,7 @@ void TreeList<Chunk_t, FreeList_t>::return_chunk_at_head(TreeChunk<Chunk_t, Free
|
||||
chunk->link_after(fc);
|
||||
} else {
|
||||
assert(tail() == NULL, "List is inconsistent");
|
||||
link_tail(chunk);
|
||||
this->link_tail(chunk);
|
||||
}
|
||||
head()->link_after(chunk);
|
||||
assert(!head() || size() == head()->size(), "Wrong sized chunk in list");
|
||||
@ -940,7 +940,7 @@ class AscendTreeCensusClosure : public TreeCensusClosure<Chunk_t, FreeList_t> {
|
||||
void do_tree(TreeList<Chunk_t, FreeList_t>* tl) {
|
||||
if (tl != NULL) {
|
||||
do_tree(tl->left());
|
||||
do_list(tl);
|
||||
this->do_list(tl);
|
||||
do_tree(tl->right());
|
||||
}
|
||||
}
|
||||
@ -952,7 +952,7 @@ class DescendTreeCensusClosure : public TreeCensusClosure<Chunk_t, FreeList_t> {
|
||||
void do_tree(TreeList<Chunk_t, FreeList_t>* tl) {
|
||||
if (tl != NULL) {
|
||||
do_tree(tl->right());
|
||||
do_list(tl);
|
||||
this->do_list(tl);
|
||||
do_tree(tl->left());
|
||||
}
|
||||
}
|
||||
@ -1022,7 +1022,7 @@ class DescendTreeSearchClosure : public TreeSearchClosure<Chunk_t, FreeList_t> {
|
||||
bool do_tree(TreeList<Chunk_t, FreeList_t>* tl) {
|
||||
if (tl != NULL) {
|
||||
if (do_tree(tl->right())) return true;
|
||||
if (do_list(tl)) return true;
|
||||
if (this->do_list(tl)) return true;
|
||||
if (do_tree(tl->left())) return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -42,6 +42,10 @@
|
||||
|
||||
typedef BinaryTreeDictionary<Metablock, FreeList> BlockTreeDictionary;
|
||||
typedef BinaryTreeDictionary<Metachunk, FreeList> ChunkTreeDictionary;
|
||||
// Define this macro to enable slow integrity checking of
|
||||
// the free chunk lists
|
||||
const bool metaspace_slow_verify = false;
|
||||
|
||||
|
||||
// Parameters for stress mode testing
|
||||
const uint metadata_deallocate_a_lot_block = 10;
|
||||
@ -161,7 +165,17 @@ class ChunkManager VALUE_OBJ_CLASS_SPEC {
|
||||
size_t sum_free_chunks_count();
|
||||
|
||||
void locked_verify_free_chunks_total();
|
||||
void slow_locked_verify_free_chunks_total() {
|
||||
if (metaspace_slow_verify) {
|
||||
locked_verify_free_chunks_total();
|
||||
}
|
||||
}
|
||||
void locked_verify_free_chunks_count();
|
||||
void slow_locked_verify_free_chunks_count() {
|
||||
if (metaspace_slow_verify) {
|
||||
locked_verify_free_chunks_count();
|
||||
}
|
||||
}
|
||||
void verify_free_chunks_count();
|
||||
|
||||
public:
|
||||
@ -201,7 +215,17 @@ class ChunkManager VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
// Debug support
|
||||
void verify();
|
||||
void slow_verify() {
|
||||
if (metaspace_slow_verify) {
|
||||
verify();
|
||||
}
|
||||
}
|
||||
void locked_verify();
|
||||
void slow_locked_verify() {
|
||||
if (metaspace_slow_verify) {
|
||||
locked_verify();
|
||||
}
|
||||
}
|
||||
void verify_free_chunks_total();
|
||||
|
||||
void locked_print_free_chunks(outputStream* st);
|
||||
@ -1507,7 +1531,7 @@ size_t ChunkManager::free_chunks_total() {
|
||||
if (!UseConcMarkSweepGC && !SpaceManager::expand_lock()->is_locked()) {
|
||||
MutexLockerEx cl(SpaceManager::expand_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
locked_verify_free_chunks_total();
|
||||
slow_locked_verify_free_chunks_total();
|
||||
}
|
||||
#endif
|
||||
return _free_chunks_total;
|
||||
@ -1524,10 +1548,10 @@ size_t ChunkManager::free_chunks_count() {
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
// This lock is only needed in debug because the verification
|
||||
// of the _free_chunks_totals walks the list of free chunks
|
||||
locked_verify_free_chunks_count();
|
||||
slow_locked_verify_free_chunks_count();
|
||||
}
|
||||
#endif
|
||||
return _free_chunks_count;
|
||||
return _free_chunks_count;
|
||||
}
|
||||
|
||||
void ChunkManager::locked_verify_free_chunks_total() {
|
||||
@ -1561,14 +1585,9 @@ void ChunkManager::verify_free_chunks_count() {
|
||||
}
|
||||
|
||||
void ChunkManager::verify() {
|
||||
#ifdef ASSERT
|
||||
if (!UseConcMarkSweepGC) {
|
||||
MutexLockerEx cl(SpaceManager::expand_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
locked_verify_free_chunks_total();
|
||||
locked_verify_free_chunks_count();
|
||||
}
|
||||
#endif
|
||||
MutexLockerEx cl(SpaceManager::expand_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
locked_verify();
|
||||
}
|
||||
|
||||
void ChunkManager::locked_verify() {
|
||||
@ -1642,7 +1661,7 @@ void ChunkManager::free_chunks_put(Metachunk* chunk) {
|
||||
free_list->set_head(chunk);
|
||||
// chunk is being returned to the chunk free list
|
||||
inc_free_chunks_total(chunk->capacity_word_size());
|
||||
locked_verify();
|
||||
slow_locked_verify();
|
||||
}
|
||||
|
||||
void ChunkManager::chunk_freelist_deallocate(Metachunk* chunk) {
|
||||
@ -1650,8 +1669,8 @@ void ChunkManager::chunk_freelist_deallocate(Metachunk* chunk) {
|
||||
// manangement code for a Metaspace and does not hold the
|
||||
// lock.
|
||||
assert(chunk != NULL, "Deallocating NULL");
|
||||
// MutexLockerEx fcl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
|
||||
locked_verify();
|
||||
assert_lock_strong(SpaceManager::expand_lock());
|
||||
slow_locked_verify();
|
||||
if (TraceMetadataChunkAllocation) {
|
||||
tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk "
|
||||
PTR_FORMAT " size " SIZE_FORMAT,
|
||||
@ -1663,7 +1682,7 @@ void ChunkManager::chunk_freelist_deallocate(Metachunk* chunk) {
|
||||
Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
|
||||
assert_lock_strong(SpaceManager::expand_lock());
|
||||
|
||||
locked_verify();
|
||||
slow_locked_verify();
|
||||
|
||||
Metachunk* chunk = NULL;
|
||||
if (!SpaceManager::is_humongous(word_size)) {
|
||||
@ -1708,13 +1727,13 @@ Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
locked_verify();
|
||||
slow_locked_verify();
|
||||
return chunk;
|
||||
}
|
||||
|
||||
Metachunk* ChunkManager::chunk_freelist_allocate(size_t word_size) {
|
||||
assert_lock_strong(SpaceManager::expand_lock());
|
||||
locked_verify();
|
||||
slow_locked_verify();
|
||||
|
||||
// Take from the beginning of the list
|
||||
Metachunk* chunk = free_chunks_get(word_size);
|
||||
@ -1959,7 +1978,7 @@ SpaceManager::~SpaceManager() {
|
||||
|
||||
ChunkManager* chunk_manager = vs_list()->chunk_manager();
|
||||
|
||||
chunk_manager->locked_verify();
|
||||
chunk_manager->slow_locked_verify();
|
||||
|
||||
if (TraceMetadataChunkAllocation && Verbose) {
|
||||
gclog_or_tty->print_cr("~SpaceManager(): " PTR_FORMAT, this);
|
||||
@ -2015,7 +2034,7 @@ SpaceManager::~SpaceManager() {
|
||||
humongous_chunks = next_humongous_chunks;
|
||||
}
|
||||
set_chunks_in_use(HumongousIndex, NULL);
|
||||
chunk_manager->locked_verify();
|
||||
chunk_manager->slow_locked_verify();
|
||||
}
|
||||
|
||||
void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
|
||||
@ -2330,8 +2349,7 @@ size_t MetaspaceAux::free_chunks_total(Metaspace::MetadataType mdtype) {
|
||||
ChunkManager* chunk = (mdtype == Metaspace::ClassType) ?
|
||||
Metaspace::class_space_list()->chunk_manager() :
|
||||
Metaspace::space_list()->chunk_manager();
|
||||
|
||||
chunk->verify_free_chunks_total();
|
||||
chunk->slow_verify();
|
||||
return chunk->free_chunks_total();
|
||||
}
|
||||
|
||||
@ -2435,6 +2453,11 @@ void MetaspaceAux::dump(outputStream* out) {
|
||||
print_waste(out);
|
||||
}
|
||||
|
||||
void MetaspaceAux::verify_free_chunks() {
|
||||
Metaspace::space_list()->chunk_manager()->verify();
|
||||
Metaspace::class_space_list()->chunk_manager()->verify();
|
||||
}
|
||||
|
||||
// Metaspace methods
|
||||
|
||||
size_t Metaspace::_first_chunk_word_size = 0;
|
||||
|
@ -189,6 +189,7 @@ class MetaspaceAux : AllStatic {
|
||||
|
||||
static void print_waste(outputStream* out);
|
||||
static void dump(outputStream* out);
|
||||
static void verify_free_chunks();
|
||||
};
|
||||
|
||||
// Metaspace are deallocated when their class loader are GC'ed.
|
||||
|
@ -431,7 +431,7 @@ void VM_PopulateDumpSharedSpace::doit() {
|
||||
}
|
||||
|
||||
static void link_shared_classes(Klass* obj, TRAPS) {
|
||||
Klass* k = Klass::cast(obj);
|
||||
Klass* k = obj;
|
||||
if (k->oop_is_instance()) {
|
||||
InstanceKlass* ik = (InstanceKlass*) k;
|
||||
// Link the class to cause the bytecodes to be rewritten and the
|
||||
|
@ -346,7 +346,7 @@ void Universe::genesis(TRAPS) {
|
||||
// ---
|
||||
// New
|
||||
// Have already been initialized.
|
||||
Klass::cast(_objectArrayKlassObj)->append_to_sibling_list();
|
||||
_objectArrayKlassObj->append_to_sibling_list();
|
||||
|
||||
// Compute is_jdk version flags.
|
||||
// Only 1.3 or later has the java.lang.Shutdown class.
|
||||
@ -1304,6 +1304,8 @@ void Universe::verify(bool silent, VerifyOption option) {
|
||||
if (!silent) gclog_or_tty->print("cldg ");
|
||||
ClassLoaderDataGraph::verify();
|
||||
#endif
|
||||
if (!silent) gclog_or_tty->print("metaspace chunks ");
|
||||
MetaspaceAux::verify_free_chunks();
|
||||
if (!silent) gclog_or_tty->print("hand ");
|
||||
JNIHandles::verify();
|
||||
if (!silent) gclog_or_tty->print("C-heap ");
|
||||
|
@ -67,7 +67,7 @@ oop ArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
|
||||
Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
|
||||
// There are no methods in an array klass but the super class (Object) has some
|
||||
assert(super(), "super klass must be present");
|
||||
return Klass::cast(super())->uncached_lookup_method(name, signature);
|
||||
return super()->uncached_lookup_method(name, signature);
|
||||
}
|
||||
|
||||
ArrayKlass::ArrayKlass(Symbol* name) {
|
||||
|
@ -371,7 +371,7 @@ Method* ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) {
|
||||
int holder_index = cpool->uncached_klass_ref_index_at(constant_pool_index());
|
||||
if (cpool->tag_at(holder_index).is_klass()) {
|
||||
Klass* klass = cpool->resolved_klass_at(holder_index);
|
||||
if (!Klass::cast(klass)->oop_is_instance())
|
||||
if (!klass->oop_is_instance())
|
||||
klass = SystemDictionary::Object_klass();
|
||||
return InstanceKlass::cast(klass)->method_at_vtable(f2_as_index());
|
||||
}
|
||||
|
@ -727,8 +727,8 @@ void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
|
||||
|
||||
// Step 7
|
||||
Klass* super_klass = this_oop->super();
|
||||
if (super_klass != NULL && !this_oop->is_interface() && Klass::cast(super_klass)->should_be_initialized()) {
|
||||
Klass::cast(super_klass)->initialize(THREAD);
|
||||
if (super_klass != NULL && !this_oop->is_interface() && super_klass->should_be_initialized()) {
|
||||
super_klass->initialize(THREAD);
|
||||
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
Handle e(THREAD, PENDING_EXCEPTION);
|
||||
@ -924,7 +924,7 @@ GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slo
|
||||
}
|
||||
|
||||
bool InstanceKlass::compute_is_subtype_of(Klass* k) {
|
||||
if (Klass::cast(k)->is_interface()) {
|
||||
if (k->is_interface()) {
|
||||
return implements_interface(k);
|
||||
} else {
|
||||
return Klass::compute_is_subtype_of(k);
|
||||
@ -933,7 +933,7 @@ bool InstanceKlass::compute_is_subtype_of(Klass* k) {
|
||||
|
||||
bool InstanceKlass::implements_interface(Klass* k) const {
|
||||
if (this == k) return true;
|
||||
assert(Klass::cast(k)->is_interface(), "should be an interface class");
|
||||
assert(k->is_interface(), "should be an interface class");
|
||||
for (int i = 0; i < transitive_interfaces()->length(); i++) {
|
||||
if (transitive_interfaces()->at(i) == k) {
|
||||
return true;
|
||||
@ -1052,6 +1052,13 @@ Method* InstanceKlass::class_initializer() {
|
||||
}
|
||||
|
||||
void InstanceKlass::call_class_initializer_impl(instanceKlassHandle this_oop, TRAPS) {
|
||||
if (ReplayCompiles &&
|
||||
(ReplaySuppressInitializers == 1 ||
|
||||
ReplaySuppressInitializers >= 2 && this_oop->class_loader() != NULL)) {
|
||||
// Hide the existence of the initializer for the purpose of replaying the compile
|
||||
return;
|
||||
}
|
||||
|
||||
methodHandle h_method(THREAD, this_oop->class_initializer());
|
||||
assert(!this_oop->is_initialized(), "we cannot initialize twice");
|
||||
if (TraceClassInitialization) {
|
||||
@ -1100,7 +1107,7 @@ Klass* InstanceKlass::find_interface_field(Symbol* name, Symbol* sig, fieldDescr
|
||||
const int n = local_interfaces()->length();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Klass* intf1 = local_interfaces()->at(i);
|
||||
assert(Klass::cast(intf1)->is_interface(), "just checking type");
|
||||
assert(intf1->is_interface(), "just checking type");
|
||||
// search for field in current interface
|
||||
if (InstanceKlass::cast(intf1)->find_local_field(name, sig, fd)) {
|
||||
assert(fd->is_static(), "interface field must be static");
|
||||
@ -1171,7 +1178,7 @@ bool InstanceKlass::find_field_from_offset(int offset, bool is_static, fieldDesc
|
||||
if (InstanceKlass::cast(klass)->find_local_field_from_offset(offset, is_static, fd)) {
|
||||
return true;
|
||||
}
|
||||
klass = Klass::cast(klass)->super();
|
||||
klass = klass->super();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2359,19 +2366,19 @@ const char* InstanceKlass::signature_name() const {
|
||||
bool InstanceKlass::is_same_class_package(Klass* class2) {
|
||||
Klass* class1 = this;
|
||||
oop classloader1 = InstanceKlass::cast(class1)->class_loader();
|
||||
Symbol* classname1 = Klass::cast(class1)->name();
|
||||
Symbol* classname1 = class1->name();
|
||||
|
||||
if (Klass::cast(class2)->oop_is_objArray()) {
|
||||
if (class2->oop_is_objArray()) {
|
||||
class2 = ObjArrayKlass::cast(class2)->bottom_klass();
|
||||
}
|
||||
oop classloader2;
|
||||
if (Klass::cast(class2)->oop_is_instance()) {
|
||||
if (class2->oop_is_instance()) {
|
||||
classloader2 = InstanceKlass::cast(class2)->class_loader();
|
||||
} else {
|
||||
assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array");
|
||||
assert(class2->oop_is_typeArray(), "should be type array");
|
||||
classloader2 = NULL;
|
||||
}
|
||||
Symbol* classname2 = Klass::cast(class2)->name();
|
||||
Symbol* classname2 = class2->name();
|
||||
|
||||
return InstanceKlass::is_same_class_package(classloader1, classname1,
|
||||
classloader2, classname2);
|
||||
@ -2380,7 +2387,7 @@ bool InstanceKlass::is_same_class_package(Klass* class2) {
|
||||
bool InstanceKlass::is_same_class_package(oop classloader2, Symbol* classname2) {
|
||||
Klass* class1 = this;
|
||||
oop classloader1 = InstanceKlass::cast(class1)->class_loader();
|
||||
Symbol* classname1 = Klass::cast(class1)->name();
|
||||
Symbol* classname1 = class1->name();
|
||||
|
||||
return InstanceKlass::is_same_class_package(classloader1, classname1,
|
||||
classloader2, classname2);
|
||||
@ -2471,7 +2478,7 @@ Klass* InstanceKlass::compute_enclosing_class_impl(instanceKlassHandle self,
|
||||
bool InstanceKlass::is_same_package_member_impl(instanceKlassHandle class1,
|
||||
Klass* class2_oop, TRAPS) {
|
||||
if (class2_oop == class1()) return true;
|
||||
if (!Klass::cast(class2_oop)->oop_is_instance()) return false;
|
||||
if (!class2_oop->oop_is_instance()) return false;
|
||||
instanceKlassHandle class2(THREAD, class2_oop);
|
||||
|
||||
// must be in same package before we try anything else
|
||||
@ -3004,7 +3011,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
if (im != NULL) {
|
||||
guarantee(is_interface(), "only interfaces should have implementor set");
|
||||
guarantee(im->is_klass(), "should be klass");
|
||||
guarantee(!Klass::cast(im)->is_interface() || im == this,
|
||||
guarantee(!im->is_interface() || im == this,
|
||||
"implementors cannot be interfaces");
|
||||
}
|
||||
|
||||
@ -3013,7 +3020,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
Array<Klass*>* local_interfaces = this->local_interfaces();
|
||||
for (int j = 0; j < local_interfaces->length(); j++) {
|
||||
Klass* e = local_interfaces->at(j);
|
||||
guarantee(e->is_klass() && Klass::cast(e)->is_interface(), "invalid local interface");
|
||||
guarantee(e->is_klass() && e->is_interface(), "invalid local interface");
|
||||
}
|
||||
}
|
||||
|
||||
@ -3022,7 +3029,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
Array<Klass*>* transitive_interfaces = this->transitive_interfaces();
|
||||
for (int j = 0; j < transitive_interfaces->length(); j++) {
|
||||
Klass* e = transitive_interfaces->at(j);
|
||||
guarantee(e->is_klass() && Klass::cast(e)->is_interface(), "invalid transitive interface");
|
||||
guarantee(e->is_klass() && e->is_interface(), "invalid transitive interface");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,7 @@ class OopMapBlock VALUE_OBJ_CLASS_SPEC {
|
||||
class InstanceKlass: public Klass {
|
||||
friend class VMStructs;
|
||||
friend class ClassFileParser;
|
||||
friend class CompileReplay;
|
||||
|
||||
protected:
|
||||
// Constructor
|
||||
|
@ -56,7 +56,7 @@ bool Klass::is_subclass_of(Klass* k) const {
|
||||
|
||||
while (t != NULL) {
|
||||
if (t == k) return true;
|
||||
t = Klass::cast(t)->super();
|
||||
t = t->super();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -243,16 +243,16 @@ void Klass::initialize_supers(Klass* k, TRAPS) {
|
||||
juint j = super_depth();
|
||||
assert(j == my_depth, "computed accessor gets right answer");
|
||||
Klass* t = this;
|
||||
while (!Klass::cast(t)->can_be_primary_super()) {
|
||||
t = Klass::cast(t)->super();
|
||||
j = Klass::cast(t)->super_depth();
|
||||
while (!t->can_be_primary_super()) {
|
||||
t = t->super();
|
||||
j = t->super_depth();
|
||||
}
|
||||
for (juint j1 = j+1; j1 < primary_super_limit(); j1++) {
|
||||
assert(primary_super_of_depth(j1) == NULL, "super list padding");
|
||||
}
|
||||
while (t != NULL) {
|
||||
assert(primary_super_of_depth(j) == t, "super list initialization");
|
||||
t = Klass::cast(t)->super();
|
||||
t = t->super();
|
||||
--j;
|
||||
}
|
||||
assert(j == (juint)-1, "correct depth count");
|
||||
@ -333,7 +333,7 @@ GrowableArray<Klass*>* Klass::compute_secondary_supers(int num_extra_slots) {
|
||||
|
||||
|
||||
Klass* Klass::subklass() const {
|
||||
return _subklass == NULL ? NULL : Klass::cast(_subklass);
|
||||
return _subklass == NULL ? NULL : _subklass;
|
||||
}
|
||||
|
||||
InstanceKlass* Klass::superklass() const {
|
||||
@ -342,7 +342,7 @@ InstanceKlass* Klass::superklass() const {
|
||||
}
|
||||
|
||||
Klass* Klass::next_sibling() const {
|
||||
return _next_sibling == NULL ? NULL : Klass::cast(_next_sibling);
|
||||
return _next_sibling == NULL ? NULL : _next_sibling;
|
||||
}
|
||||
|
||||
void Klass::set_subklass(Klass* s) {
|
||||
|
@ -422,12 +422,6 @@ class Klass : public Metadata {
|
||||
// if not, throw either an Error or an Exception.
|
||||
virtual void check_valid_for_instantiation(bool throwError, TRAPS);
|
||||
|
||||
// Casting
|
||||
static Klass* cast(Klass* k) {
|
||||
assert(k->is_klass(), "cast to Klass");
|
||||
return k;
|
||||
}
|
||||
|
||||
// array copying
|
||||
virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
|
||||
|
||||
|
@ -746,7 +746,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass
|
||||
while (target != NULL && target->is_static()) {
|
||||
// continue with recursive lookup through the superclass
|
||||
Klass* super = target->method_holder()->super();
|
||||
target = (super == NULL) ? (Method*)NULL : Klass::cast(super)->uncached_lookup_method(method_name, method_signature);
|
||||
target = (super == NULL) ? (Method*)NULL : super->uncached_lookup_method(method_name, method_signature);
|
||||
}
|
||||
if (target == NULL || !target->is_public() || target->is_abstract()) {
|
||||
// Entry do not resolve. Leave it empty
|
||||
@ -852,7 +852,7 @@ void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosur
|
||||
// Handle array argument
|
||||
for(int i = 0; i < transitive_intf->length(); i++) {
|
||||
Klass* intf = transitive_intf->at(i);
|
||||
assert(Klass::cast(intf)->is_interface(), "sanity check");
|
||||
assert(intf->is_interface(), "sanity check");
|
||||
|
||||
// Find no. of methods excluding a <clinit>
|
||||
int method_count = InstanceKlass::cast(intf)->methods()->length();
|
||||
|
@ -152,11 +152,11 @@ address Method::get_c2i_unverified_entry() {
|
||||
}
|
||||
|
||||
char* Method::name_and_sig_as_C_string() const {
|
||||
return name_and_sig_as_C_string(Klass::cast(constants()->pool_holder()), name(), signature());
|
||||
return name_and_sig_as_C_string(constants()->pool_holder(), name(), signature());
|
||||
}
|
||||
|
||||
char* Method::name_and_sig_as_C_string(char* buf, int size) const {
|
||||
return name_and_sig_as_C_string(Klass::cast(constants()->pool_holder()), name(), signature(), buf, size);
|
||||
return name_and_sig_as_C_string(constants()->pool_holder(), name(), signature(), buf, size);
|
||||
}
|
||||
|
||||
char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature) {
|
||||
@ -578,8 +578,8 @@ objArrayHandle Method::resolved_checked_exceptions_impl(Method* this_oop, TRAPS)
|
||||
for (int i = 0; i < length; i++) {
|
||||
CheckedExceptionElement* table = h_this->checked_exceptions_start(); // recompute on each iteration, not gc safe
|
||||
Klass* k = h_this->constants()->klass_at(table[i].class_cp_index, CHECK_(objArrayHandle()));
|
||||
assert(Klass::cast(k)->is_subclass_of(SystemDictionary::Throwable_klass()), "invalid exception class");
|
||||
mirrors->obj_at_put(i, Klass::cast(k)->java_mirror());
|
||||
assert(k->is_subclass_of(SystemDictionary::Throwable_klass()), "invalid exception class");
|
||||
mirrors->obj_at_put(i, k->java_mirror());
|
||||
}
|
||||
return mirrors;
|
||||
}
|
||||
@ -618,7 +618,7 @@ bool Method::is_klass_loaded_by_klass_index(int klass_index) const {
|
||||
Thread *thread = Thread::current();
|
||||
Symbol* klass_name = constants()->klass_name_at(klass_index);
|
||||
Handle loader(thread, method_holder()->class_loader());
|
||||
Handle prot (thread, Klass::cast(method_holder())->protection_domain());
|
||||
Handle prot (thread, method_holder()->protection_domain());
|
||||
return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
|
||||
} else {
|
||||
return true;
|
||||
@ -1067,8 +1067,8 @@ methodHandle Method::make_method_handle_intrinsic(vmIntrinsics::ID iid,
|
||||
}
|
||||
|
||||
Klass* Method::check_non_bcp_klass(Klass* klass) {
|
||||
if (klass != NULL && Klass::cast(klass)->class_loader() != NULL) {
|
||||
if (Klass::cast(klass)->oop_is_objArray())
|
||||
if (klass != NULL && klass->class_loader() != NULL) {
|
||||
if (klass->oop_is_objArray())
|
||||
klass = ObjArrayKlass::cast(klass)->bottom_klass();
|
||||
return klass;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
|
||||
Array<Klass*>* element_supers = element_klass->secondary_supers();
|
||||
for( int i = element_supers->length()-1; i >= 0; i-- ) {
|
||||
Klass* elem_super = element_supers->at(i);
|
||||
if (Klass::cast(elem_super)->array_klass_or_null() == NULL) {
|
||||
if (elem_super->array_klass_or_null() == NULL) {
|
||||
supers_exist = false;
|
||||
break;
|
||||
}
|
||||
@ -172,7 +172,7 @@ ObjArrayKlass::ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name) : A
|
||||
} else {
|
||||
bk = element_klass();
|
||||
}
|
||||
assert(bk != NULL && (Klass::cast(bk)->oop_is_instance() || Klass::cast(bk)->oop_is_typeArray()), "invalid bottom klass");
|
||||
assert(bk != NULL && (bk->oop_is_instance() || bk->oop_is_typeArray()), "invalid bottom klass");
|
||||
this->set_bottom_klass(bk);
|
||||
this->set_class_loader_data(bk->class_loader_data());
|
||||
|
||||
@ -254,7 +254,7 @@ template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
|
||||
// We have to make sure all elements conform to the destination array
|
||||
Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass();
|
||||
Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass();
|
||||
if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
|
||||
if (stype == bound || stype->is_subtype_of(bound)) {
|
||||
// elements are guaranteed to be subtypes, so no check necessary
|
||||
bs->write_ref_array_pre(dst, length);
|
||||
Copy::conjoint_oops_atomic(src, dst, length);
|
||||
@ -271,7 +271,7 @@ template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src,
|
||||
oop new_val = element_is_null ? oop(NULL)
|
||||
: oopDesc::decode_heap_oop_not_null(element);
|
||||
if (element_is_null ||
|
||||
Klass::cast((new_val->klass()))->is_subtype_of(bound)) {
|
||||
(new_val->klass())->is_subtype_of(bound)) {
|
||||
bs->write_ref_field_pre(p, new_val);
|
||||
*p = *from;
|
||||
} else {
|
||||
@ -381,7 +381,7 @@ bool ObjArrayKlass::can_be_primary_super_slow() const {
|
||||
|
||||
GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots) {
|
||||
// interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... };
|
||||
Array<Klass*>* elem_supers = Klass::cast(element_klass())->secondary_supers();
|
||||
Array<Klass*>* elem_supers = element_klass()->secondary_supers();
|
||||
int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length();
|
||||
int num_secondaries = num_extra_slots + 2 + num_elem_supers;
|
||||
if (num_secondaries == 2) {
|
||||
@ -411,7 +411,7 @@ bool ObjArrayKlass::compute_is_subtype_of(Klass* k) {
|
||||
}
|
||||
|
||||
void ObjArrayKlass::initialize(TRAPS) {
|
||||
Klass::cast(bottom_klass())->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass
|
||||
bottom_klass()->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass
|
||||
}
|
||||
|
||||
#define ObjArrayKlass_SPECIALIZED_OOP_ITERATE(T, a, p, do_oop) \
|
||||
@ -607,7 +607,7 @@ jint ObjArrayKlass::compute_modifier_flags(TRAPS) const {
|
||||
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
|
||||
}
|
||||
// Return the flags of the bottom element type.
|
||||
jint element_flags = Klass::cast(bottom_klass())->compute_modifier_flags(CHECK_0);
|
||||
jint element_flags = bottom_klass()->compute_modifier_flags(CHECK_0);
|
||||
|
||||
return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED))
|
||||
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL);
|
||||
@ -686,7 +686,7 @@ void ObjArrayKlass::verify_on(outputStream* st) {
|
||||
guarantee(element_klass()->is_klass(), "should be klass");
|
||||
guarantee(bottom_klass()->is_metadata(), "should be in metaspace");
|
||||
guarantee(bottom_klass()->is_klass(), "should be klass");
|
||||
Klass* bk = Klass::cast(bottom_klass());
|
||||
Klass* bk = bottom_klass();
|
||||
guarantee(bk->oop_is_instance() || bk->oop_is_typeArray(), "invalid bottom klass");
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ class ObjArrayKlass : public ArrayKlass {
|
||||
void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
|
||||
|
||||
// Compute protection domain
|
||||
oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); }
|
||||
oop protection_domain() { return bottom_klass()->protection_domain(); }
|
||||
|
||||
private:
|
||||
// Either oop or narrowOop depending on UseCompressedOops.
|
||||
|
@ -153,17 +153,15 @@ char* Symbol::as_C_string_flexible_buffer(Thread* t,
|
||||
|
||||
void Symbol::print_symbol_on(outputStream* st) const {
|
||||
st = st ? st : tty;
|
||||
int length = UTF8::unicode_length((const char*)bytes(), utf8_length());
|
||||
const char *ptr = (const char *)bytes();
|
||||
jchar value;
|
||||
for (int index = 0; index < length; index++) {
|
||||
ptr = UTF8::next(ptr, &value);
|
||||
if (value >= 32 && value < 127 || value == '\'' || value == '\\') {
|
||||
st->put(value);
|
||||
} else {
|
||||
st->print("\\u%04x", value);
|
||||
}
|
||||
}
|
||||
st->print("%s", as_quoted_ascii());
|
||||
}
|
||||
|
||||
char* Symbol::as_quoted_ascii() const {
|
||||
const char *ptr = (const char *)&_body[0];
|
||||
int quoted_length = UTF8::quoted_ascii_length(ptr, utf8_length());
|
||||
char* result = NEW_RESOURCE_ARRAY(char, quoted_length + 1);
|
||||
UTF8::as_quoted_ascii(ptr, result, quoted_length + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
jchar* Symbol::as_unicode(int& length) const {
|
||||
|
@ -189,6 +189,8 @@ class Symbol : public MetaspaceObj {
|
||||
// Use buf if needed buffer length is <= size.
|
||||
char* as_C_string_flexible_buffer(Thread* t, char* buf, int size) const;
|
||||
|
||||
// Returns an escaped form of a Java string.
|
||||
char* as_quoted_ascii() const;
|
||||
|
||||
// Returns a null terminated utf8 string in a resource array
|
||||
char* as_utf8() const { return as_C_string(); }
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
@ -150,7 +151,7 @@ const char* InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_
|
||||
} else {
|
||||
// Not hot. Check for medium-sized pre-existing nmethod at cold sites.
|
||||
if (callee_method->has_compiled_code() &&
|
||||
callee_method->instructions_size(CompLevel_full_optimization) > inline_small_code_size)
|
||||
callee_method->instructions_size() > inline_small_code_size)
|
||||
return "already compiled into a medium method";
|
||||
}
|
||||
if (size > max_inline_size) {
|
||||
@ -192,7 +193,7 @@ const char* InlineTree::should_not_inline(ciMethod *callee_method, ciMethod* cal
|
||||
}
|
||||
|
||||
if (callee_method->has_compiled_code() &&
|
||||
callee_method->instructions_size(CompLevel_full_optimization) > InlineSmallCode) {
|
||||
callee_method->instructions_size() > InlineSmallCode) {
|
||||
wci_result->set_profit(wci_result->profit() * 0.1);
|
||||
// %%% adjust wci_result->size()?
|
||||
}
|
||||
@ -216,7 +217,7 @@ const char* InlineTree::should_not_inline(ciMethod *callee_method, ciMethod* cal
|
||||
// Now perform checks which are heuristic
|
||||
|
||||
if (callee_method->has_compiled_code() &&
|
||||
callee_method->instructions_size(CompLevel_full_optimization) > InlineSmallCode) {
|
||||
callee_method->instructions_size() > InlineSmallCode) {
|
||||
return "already compiled into a big method";
|
||||
}
|
||||
|
||||
@ -235,6 +236,12 @@ const char* InlineTree::should_not_inline(ciMethod *callee_method, ciMethod* cal
|
||||
return "disallowed by CompilerOracle";
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (ciReplay::should_not_inline(callee_method)) {
|
||||
return "disallowed by ciReplay";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UseStringCache) {
|
||||
// Do not inline StringCache::profile() method used only at the beginning.
|
||||
if (callee_method->name() == ciSymbol::profile_name() &&
|
||||
|
@ -334,7 +334,7 @@ bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* kl
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(dest_method->will_link(method()->holder(), klass, bc()), "dest_method: typeflow responsibility");
|
||||
assert(dest_method->is_loaded(), "dest_method: typeflow responsibility");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thre
|
||||
assert(check_compiled_frame(thread), "incorrect caller");
|
||||
|
||||
// These checks are cheap to make and support reflective allocation.
|
||||
int lh = Klass::cast(klass)->layout_helper();
|
||||
int lh = klass->layout_helper();
|
||||
if (Klass::layout_helper_needs_slow_path(lh)
|
||||
|| !InstanceKlass::cast(klass)->is_initialized()) {
|
||||
KlassHandle kh(THREAD, klass);
|
||||
@ -283,7 +283,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaT
|
||||
// Scavenge and allocate an instance.
|
||||
oop result;
|
||||
|
||||
if (Klass::cast(array_type)->oop_is_typeArray()) {
|
||||
if (array_type->oop_is_typeArray()) {
|
||||
// The oopFactory likes to work with the element type.
|
||||
// (We could bypass the oopFactory, since it doesn't add much value.)
|
||||
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
|
||||
@ -321,7 +321,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len
|
||||
// Scavenge and allocate an instance.
|
||||
oop result;
|
||||
|
||||
assert(Klass::cast(array_type)->oop_is_typeArray(), "should be called only for type array");
|
||||
assert(array_type->oop_is_typeArray(), "should be called only for type array");
|
||||
// The oopFactory likes to work with the element type.
|
||||
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
|
||||
result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "classfile/altHashing.hpp"
|
||||
#include "classfile/classLoader.hpp"
|
||||
#include "classfile/javaClasses.hpp"
|
||||
@ -233,13 +234,13 @@ bool jfieldIDWorkaround::is_valid_jfieldID(Klass* k, jfieldID id) {
|
||||
intptr_t jfieldIDWorkaround::encode_klass_hash(Klass* k, intptr_t offset) {
|
||||
if (offset <= small_offset_mask) {
|
||||
Klass* field_klass = k;
|
||||
Klass* super_klass = Klass::cast(field_klass)->super();
|
||||
Klass* super_klass = field_klass->super();
|
||||
// With compressed oops the most super class with nonstatic fields would
|
||||
// be the owner of fields embedded in the header.
|
||||
while (InstanceKlass::cast(super_klass)->has_nonstatic_fields() &&
|
||||
InstanceKlass::cast(super_klass)->contains_field_offset(offset)) {
|
||||
field_klass = super_klass; // super contains the field also
|
||||
super_klass = Klass::cast(field_klass)->super();
|
||||
super_klass = field_klass->super();
|
||||
}
|
||||
debug_only(No_Safepoint_Verifier nosafepoint;)
|
||||
uintptr_t klass_hash = field_klass->identity_hash();
|
||||
@ -249,7 +250,7 @@ intptr_t jfieldIDWorkaround::encode_klass_hash(Klass* k, intptr_t offset) {
|
||||
#ifndef PRODUCT
|
||||
{
|
||||
ResourceMark rm;
|
||||
warning("VerifyJNIFields: long offset %d in %s", offset, Klass::cast(k)->external_name());
|
||||
warning("VerifyJNIFields: long offset %d in %s", offset, k->external_name());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -265,7 +266,7 @@ bool jfieldIDWorkaround::klass_hash_ok(Klass* k, jfieldID id) {
|
||||
// Could use a non-blocking query for identity_hash here...
|
||||
if ((k->identity_hash() & klass_mask) == klass_hash)
|
||||
return true;
|
||||
k = Klass::cast(k)->super();
|
||||
k = k->super();
|
||||
} while (k != NULL);
|
||||
return false;
|
||||
}
|
||||
@ -283,7 +284,7 @@ void jfieldIDWorkaround::verify_instance_jfieldID(Klass* k, jfieldID id) {
|
||||
#ifndef PRODUCT
|
||||
if (Verbose) {
|
||||
ResourceMark rm;
|
||||
warning("VerifyJNIFields: unverified offset %d for %s", offset, Klass::cast(k)->external_name());
|
||||
warning("VerifyJNIFields: unverified offset %d for %s", offset, k->external_name());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -415,7 +416,7 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR
|
||||
}
|
||||
|
||||
cls = (jclass)JNIHandles::make_local(
|
||||
env, Klass::cast(k)->java_mirror());
|
||||
env, k->java_mirror());
|
||||
return cls;
|
||||
JNI_END
|
||||
|
||||
@ -536,7 +537,7 @@ JNI_ENTRY(jmethodID, jni_FromReflectedMethod(JNIEnv *env, jobject method))
|
||||
|
||||
KlassHandle k1(THREAD, k);
|
||||
// Make sure class is initialized before handing id's out to methods
|
||||
Klass::cast(k1())->initialize(CHECK_NULL);
|
||||
k1()->initialize(CHECK_NULL);
|
||||
Method* m = InstanceKlass::cast(k1())->method_with_idnum(slot);
|
||||
ret = m==NULL? NULL : m->jmethod_id(); // return NULL if reflected method deleted
|
||||
return ret;
|
||||
@ -569,7 +570,7 @@ JNI_ENTRY(jfieldID, jni_FromReflectedField(JNIEnv *env, jobject field))
|
||||
|
||||
KlassHandle k1(THREAD, k);
|
||||
// Make sure class is initialized before handing id's out to fields
|
||||
Klass::cast(k1())->initialize(CHECK_NULL);
|
||||
k1()->initialize(CHECK_NULL);
|
||||
|
||||
// First check if this is a static field
|
||||
if (modifiers & JVM_ACC_STATIC) {
|
||||
@ -648,17 +649,17 @@ JNI_ENTRY(jclass, jni_GetSuperclass(JNIEnv *env, jclass sub))
|
||||
// interfaces return NULL
|
||||
// proper classes return Klass::super()
|
||||
Klass* k = java_lang_Class::as_Klass(mirror);
|
||||
if (Klass::cast(k)->is_interface()) return NULL;
|
||||
if (k->is_interface()) return NULL;
|
||||
|
||||
// return mirror for superclass
|
||||
Klass* super = Klass::cast(k)->java_super();
|
||||
Klass* super = k->java_super();
|
||||
// super2 is the value computed by the compiler's getSuperClass intrinsic:
|
||||
debug_only(Klass* super2 = ( Klass::cast(k)->oop_is_array()
|
||||
debug_only(Klass* super2 = ( k->oop_is_array()
|
||||
? SystemDictionary::Object_klass()
|
||||
: Klass::cast(k)->super() ) );
|
||||
: k->super() ) );
|
||||
assert(super == super2,
|
||||
"java_super computation depends on interface, array, other super");
|
||||
obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(Klass::cast(super)->java_mirror());
|
||||
obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(super->java_mirror());
|
||||
return obj;
|
||||
JNI_END
|
||||
|
||||
@ -686,7 +687,7 @@ JNI_QUICK_ENTRY(jboolean, jni_IsAssignableFrom(JNIEnv *env, jclass sub, jclass s
|
||||
Klass* sub_klass = java_lang_Class::as_Klass(sub_mirror);
|
||||
Klass* super_klass = java_lang_Class::as_Klass(super_mirror);
|
||||
assert(sub_klass != NULL && super_klass != NULL, "invalid arguments to jni_IsAssignableFrom");
|
||||
jboolean ret = Klass::cast(sub_klass)->is_subtype_of(super_klass) ?
|
||||
jboolean ret = sub_klass->is_subtype_of(super_klass) ?
|
||||
JNI_TRUE : JNI_FALSE;
|
||||
#ifndef USDT2
|
||||
DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret);
|
||||
@ -820,7 +821,7 @@ JNI_ENTRY_NO_PRESERVE(void, jni_ExceptionDescribe(JNIEnv *env))
|
||||
ResourceMark rm(THREAD);
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
". Uncaught exception of type %s.",
|
||||
Klass::cast(ex->klass())->external_name());
|
||||
ex->klass()->external_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1358,7 +1359,7 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
||||
Method* m = Method::resolve_jmethod_id(method_id);
|
||||
number_of_parameters = m->size_of_parameters();
|
||||
Klass* holder = m->method_holder();
|
||||
if (!(Klass::cast(holder))->is_interface()) {
|
||||
if (!(holder)->is_interface()) {
|
||||
// non-interface call -- for that little speed boost, don't handlize
|
||||
debug_only(No_Safepoint_Verifier nosafepoint;)
|
||||
if (call_type == JNI_VIRTUAL) {
|
||||
@ -1423,7 +1424,7 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
||||
|
||||
static instanceOop alloc_object(jclass clazz, TRAPS) {
|
||||
KlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
|
||||
Klass::cast(k())->check_valid_for_instantiation(false, CHECK_NULL);
|
||||
k()->check_valid_for_instantiation(false, CHECK_NULL);
|
||||
InstanceKlass::cast(k())->initialize(CHECK_NULL);
|
||||
instanceOop ih = InstanceKlass::cast(k())->allocate_instance(THREAD);
|
||||
return ih;
|
||||
@ -1545,7 +1546,7 @@ JNI_ENTRY(jclass, jni_GetObjectClass(JNIEnv *env, jobject obj))
|
||||
#endif /* USDT2 */
|
||||
Klass* k = JNIHandles::resolve_non_null(obj)->klass();
|
||||
jclass ret =
|
||||
(jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
(jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
#ifndef USDT2
|
||||
DTRACE_PROBE1(hotspot_jni, GetObjectClass__return, ret);
|
||||
#else /* USDT2 */
|
||||
@ -1610,7 +1611,7 @@ static jmethodID get_method_id(JNIEnv *env, jclass clazz, const char *name_str,
|
||||
|
||||
// Make sure class is linked and initialized before handing id's out to
|
||||
// Method*s.
|
||||
Klass::cast(klass())->initialize(CHECK_NULL);
|
||||
klass()->initialize(CHECK_NULL);
|
||||
|
||||
Method* m;
|
||||
if (name == vmSymbols::object_initializer_name() ||
|
||||
@ -2426,7 +2427,7 @@ JNI_ENTRY(ResultType, \
|
||||
JNI_ArgumentPusherVaArg ap(methodID, args); \
|
||||
/* Make sure class is initialized before trying to invoke its method */ \
|
||||
KlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls))); \
|
||||
Klass::cast(k())->initialize(CHECK_0); \
|
||||
k()->initialize(CHECK_0); \
|
||||
jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \
|
||||
va_end(args); \
|
||||
ret = jvalue.get_##ResultType(); \
|
||||
@ -2611,10 +2612,10 @@ JNI_ENTRY(jfieldID, jni_GetFieldID(JNIEnv *env, jclass clazz,
|
||||
KlassHandle k(THREAD,
|
||||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
|
||||
// Make sure class is initialized before handing id's out to fields
|
||||
Klass::cast(k())->initialize(CHECK_NULL);
|
||||
k()->initialize(CHECK_NULL);
|
||||
|
||||
fieldDescriptor fd;
|
||||
if (!Klass::cast(k())->oop_is_instance() ||
|
||||
if (!k()->oop_is_instance() ||
|
||||
!InstanceKlass::cast(k())->find_field(fieldname, signame, false, &fd)) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
|
||||
}
|
||||
@ -2976,10 +2977,10 @@ JNI_ENTRY(jfieldID, jni_GetStaticFieldID(JNIEnv *env, jclass clazz,
|
||||
KlassHandle k(THREAD,
|
||||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
|
||||
// Make sure class is initialized before handing id's out to static fields
|
||||
Klass::cast(k())->initialize(CHECK_NULL);
|
||||
k()->initialize(CHECK_NULL);
|
||||
|
||||
fieldDescriptor fd;
|
||||
if (!Klass::cast(k())->oop_is_instance() ||
|
||||
if (!k()->oop_is_instance() ||
|
||||
!InstanceKlass::cast(k())->find_field(fieldname, signame, true, &fd)) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
|
||||
}
|
||||
@ -3439,7 +3440,7 @@ JNI_ENTRY(jobjectArray, jni_NewObjectArray(JNIEnv *env, jsize length, jclass ele
|
||||
jobjectArray ret = NULL;
|
||||
DT_RETURN_MARK(NewObjectArray, jobjectArray, (const jobjectArray&)ret);
|
||||
KlassHandle ek(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(elementClass)));
|
||||
Klass* ako = Klass::cast(ek())->array_klass(CHECK_NULL);
|
||||
Klass* ako = ek()->array_klass(CHECK_NULL);
|
||||
KlassHandle ak = KlassHandle(THREAD, ako);
|
||||
ObjArrayKlass::cast(ak())->initialize(CHECK_NULL);
|
||||
objArrayOop result = ObjArrayKlass::cast(ak())->allocate(length, CHECK_NULL);
|
||||
@ -3970,7 +3971,7 @@ static Method* find_prefixed_native(KlassHandle k,
|
||||
if (trial_name == NULL) {
|
||||
continue; // no such symbol, so this prefix wasn't used, try the next prefix
|
||||
}
|
||||
method = Klass::cast(k())->lookup_method(trial_name, signature);
|
||||
method = k()->lookup_method(trial_name, signature);
|
||||
if (method == NULL) {
|
||||
continue; // signature doesn't match, try the next prefix
|
||||
}
|
||||
@ -3987,12 +3988,12 @@ static Method* find_prefixed_native(KlassHandle k,
|
||||
}
|
||||
|
||||
static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, address entry, TRAPS) {
|
||||
Method* method = Klass::cast(k())->lookup_method(name, signature);
|
||||
Method* method = k()->lookup_method(name, signature);
|
||||
if (method == NULL) {
|
||||
ResourceMark rm;
|
||||
stringStream st;
|
||||
st.print("Method %s name or signature does not match",
|
||||
Method::name_and_sig_as_C_string(Klass::cast(k()), name, signature));
|
||||
Method::name_and_sig_as_C_string(k(), name, signature));
|
||||
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false);
|
||||
}
|
||||
if (!method->is_native()) {
|
||||
@ -4002,7 +4003,7 @@ static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, addr
|
||||
ResourceMark rm;
|
||||
stringStream st;
|
||||
st.print("Method %s is not declared as native",
|
||||
Method::name_and_sig_as_C_string(Klass::cast(k()), name, signature));
|
||||
Method::name_and_sig_as_C_string(k(), name, signature));
|
||||
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false);
|
||||
}
|
||||
}
|
||||
@ -4058,7 +4059,7 @@ JNI_ENTRY(jint, jni_RegisterNatives(JNIEnv *env, jclass clazz,
|
||||
if (name == NULL || signature == NULL) {
|
||||
ResourceMark rm;
|
||||
stringStream st;
|
||||
st.print("Method %s.%s%s not found", Klass::cast(h_k())->external_name(), meth_name, meth_sig);
|
||||
st.print("Method %s.%s%s not found", h_k()->external_name(), meth_name, meth_sig);
|
||||
// Must return negative value on failure
|
||||
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), -1);
|
||||
}
|
||||
@ -4084,7 +4085,7 @@ JNI_ENTRY(jint, jni_UnregisterNatives(JNIEnv *env, jclass clazz))
|
||||
#endif /* USDT2 */
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz));
|
||||
//%note jni_2
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
for (int index = 0; index < InstanceKlass::cast(k)->methods()->length(); index++) {
|
||||
Method* m = InstanceKlass::cast(k)->methods()->at(index);
|
||||
if (m->is_native()) {
|
||||
@ -5151,6 +5152,7 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, v
|
||||
|
||||
// Check if we should compile all classes on bootclasspath
|
||||
NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();)
|
||||
NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);)
|
||||
// Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
|
||||
ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
|
||||
} else {
|
||||
|
@ -383,7 +383,7 @@ void jniCheck::validate_throwable_klass(JavaThread* thr, Klass* klass) {
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
assert(klass != NULL, "klass argument must have a value");
|
||||
|
||||
if (!Klass::cast(klass)->oop_is_instance() ||
|
||||
if (!klass->oop_is_instance() ||
|
||||
!InstanceKlass::cast(klass)->is_subclass_of(SystemDictionary::Throwable_klass())) {
|
||||
ReportJNIFatalError(thr, fatal_class_not_a_throwable_class);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ JVM_ENTRY(void, JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src
|
||||
assert(s->is_oop(), "JVM_ArrayCopy: src not an oop");
|
||||
assert(d->is_oop(), "JVM_ArrayCopy: dst not an oop");
|
||||
// Do copy
|
||||
Klass::cast(s->klass())->copy_array(s, src_pos, d, dst_pos, length, thread);
|
||||
s->klass()->copy_array(s, src_pos, d, dst_pos, length, thread);
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -675,7 +675,7 @@ JVM_END
|
||||
JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth))
|
||||
JVMWrapper("JVM_GetCallerClass");
|
||||
Klass* k = thread->security_get_caller_class(depth);
|
||||
return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -739,7 +739,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
|
||||
if (TraceClassResolution) {
|
||||
trace_class_resolution(k);
|
||||
}
|
||||
return (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
return (jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
JVM_END
|
||||
|
||||
JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
|
||||
@ -785,8 +785,8 @@ JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
|
||||
oop class_loader = NULL;
|
||||
oop protection_domain = NULL;
|
||||
if (from_class != NULL) {
|
||||
class_loader = Klass::cast(from_class)->class_loader();
|
||||
protection_domain = Klass::cast(from_class)->protection_domain();
|
||||
class_loader = from_class->class_loader();
|
||||
protection_domain = from_class->protection_domain();
|
||||
}
|
||||
Handle h_loader(THREAD, class_loader);
|
||||
Handle h_prot (THREAD, protection_domain);
|
||||
@ -798,11 +798,11 @@ JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
|
||||
ResourceMark rm;
|
||||
oop from_mirror = JNIHandles::resolve_non_null(from);
|
||||
Klass* from_class = java_lang_Class::as_Klass(from_mirror);
|
||||
const char * from_name = Klass::cast(from_class)->external_name();
|
||||
const char * from_name = from_class->external_name();
|
||||
|
||||
oop mirror = JNIHandles::resolve_non_null(result);
|
||||
Klass* to_class = java_lang_Class::as_Klass(mirror);
|
||||
const char * to = Klass::cast(to_class)->external_name();
|
||||
const char * to = to_class->external_name();
|
||||
tty->print("RESOLVE %s %s (verification)\n", from_name, to);
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name,
|
||||
trace_class_resolution(k);
|
||||
}
|
||||
|
||||
return (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
return (jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
}
|
||||
|
||||
|
||||
@ -936,7 +936,7 @@ JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)
|
||||
CHECK_NULL);
|
||||
|
||||
return (k == NULL) ? NULL :
|
||||
(jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
|
||||
(jclass) JNIHandles::make_local(env, k->java_mirror());
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -954,7 +954,7 @@ JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls))
|
||||
// Consider caching interned string in Klass
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
assert(k->is_klass(), "just checking");
|
||||
name = Klass::cast(k)->external_name();
|
||||
name = k->external_name();
|
||||
}
|
||||
oop result = StringTable::intern((char*) name, CHECK_NULL);
|
||||
return (jstring) JNIHandles::make_local(env, result);
|
||||
@ -991,12 +991,12 @@ JVM_ENTRY(jobjectArray, JVM_GetClassInterfaces(JNIEnv *env, jclass cls))
|
||||
// Regular instance klass, fill in all local interfaces
|
||||
for (int index = 0; index < size; index++) {
|
||||
Klass* k = InstanceKlass::cast(klass())->local_interfaces()->at(index);
|
||||
result->obj_at_put(index, Klass::cast(k)->java_mirror());
|
||||
result->obj_at_put(index, k->java_mirror());
|
||||
}
|
||||
} else {
|
||||
// All arrays implement java.lang.Cloneable and java.io.Serializable
|
||||
result->obj_at_put(0, Klass::cast(SystemDictionary::Cloneable_klass())->java_mirror());
|
||||
result->obj_at_put(1, Klass::cast(SystemDictionary::Serializable_klass())->java_mirror());
|
||||
result->obj_at_put(0, SystemDictionary::Cloneable_klass()->java_mirror());
|
||||
result->obj_at_put(1, SystemDictionary::Serializable_klass()->java_mirror());
|
||||
}
|
||||
return (jobjectArray) JNIHandles::make_local(env, result());
|
||||
JVM_END
|
||||
@ -1008,7 +1008,7 @@ JVM_ENTRY(jobject, JVM_GetClassLoader(JNIEnv *env, jclass cls))
|
||||
return NULL;
|
||||
}
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
oop loader = Klass::cast(k)->class_loader();
|
||||
oop loader = k->class_loader();
|
||||
return JNIHandles::make_local(env, loader);
|
||||
JVM_END
|
||||
|
||||
@ -1020,8 +1020,8 @@ JVM_QUICK_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls))
|
||||
return JNI_FALSE;
|
||||
}
|
||||
Klass* k = java_lang_Class::as_Klass(mirror);
|
||||
jboolean result = Klass::cast(k)->is_interface();
|
||||
assert(!result || Klass::cast(k)->oop_is_instance(),
|
||||
jboolean result = k->is_interface();
|
||||
assert(!result || k->oop_is_instance(),
|
||||
"all interfaces are instance types");
|
||||
// The compiler intrinsic for isInterface tests the
|
||||
// Klass::_access_flags bits in the same way.
|
||||
@ -1039,7 +1039,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassSigners(JNIEnv *env, jclass cls))
|
||||
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
objArrayOop signers = NULL;
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
signers = InstanceKlass::cast(k)->signers();
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ JVM_ENTRY(void, JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signer
|
||||
// Signers are only set once, ClassLoader.java, and thus shouldn't
|
||||
// be called with an array. Only the bootstrap loader creates arrays.
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
InstanceKlass::cast(k)->set_signers(objArrayOop(JNIHandles::resolve(signers)));
|
||||
}
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ JVM_ENTRY(jobject, JVM_GetProtectionDomain(JNIEnv *env, jclass cls))
|
||||
}
|
||||
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
return (jobject) JNIHandles::make_local(env, Klass::cast(k)->protection_domain());
|
||||
return (jobject) JNIHandles::make_local(env, k->protection_domain());
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -1101,7 +1101,7 @@ JVM_ENTRY(void, JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protect
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
|
||||
// cls won't be an array, as this called only from ClassLoader.defineClass
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
oop pd = JNIHandles::resolve(protection_domain);
|
||||
assert(pd == NULL || pd->is_oop(), "just checking");
|
||||
InstanceKlass::cast(k)->set_protection_domain(pd);
|
||||
@ -1124,7 +1124,7 @@ JVM_ENTRY(jobject, JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, job
|
||||
Handle object (THREAD, JNIHandles::resolve(action));
|
||||
|
||||
// get run() method
|
||||
Method* m_oop = Klass::cast(object->klass())->uncached_lookup_method(
|
||||
Method* m_oop = object->klass()->uncached_lookup_method(
|
||||
vmSymbols::run_method_name(),
|
||||
vmSymbols::void_object_signature());
|
||||
methodHandle m (THREAD, m_oop);
|
||||
@ -1267,7 +1267,7 @@ JVM_END
|
||||
JVM_QUICK_ENTRY(jboolean, JVM_IsArrayClass(JNIEnv *env, jclass cls))
|
||||
JVMWrapper("JVM_IsArrayClass");
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
return (k != NULL) && Klass::cast(k)->oop_is_array() ? true : false;
|
||||
return (k != NULL) && k->oop_is_array() ? true : false;
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -1293,7 +1293,7 @@ JVM_ENTRY(jint, JVM_GetClassModifiers(JNIEnv *env, jclass cls))
|
||||
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
|
||||
}
|
||||
|
||||
Klass* k = Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)));
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
debug_only(int computed_modifiers = k->compute_modifier_flags(CHECK_0));
|
||||
assert(k->modifier_flags() == computed_modifiers, "modifiers cache is OK");
|
||||
return k->modifier_flags();
|
||||
@ -1308,7 +1308,7 @@ JVM_ENTRY(jobjectArray, JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass))
|
||||
// of an InstanceKlass
|
||||
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
|
||||
! Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
|
||||
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_instance()) {
|
||||
oop result = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_NULL);
|
||||
return (jobjectArray)JNIHandles::make_local(env, result);
|
||||
}
|
||||
@ -1372,7 +1372,7 @@ JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
|
||||
{
|
||||
// ofClass is a reference to a java_lang_Class object.
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
|
||||
! Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
|
||||
! java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_instance()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1382,7 +1382,7 @@ JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass))
|
||||
)->compute_enclosing_class(&inner_is_member, CHECK_NULL);
|
||||
if (outer_klass == NULL) return NULL; // already a top-level class
|
||||
if (!inner_is_member) return NULL; // an anonymous class (inside a method)
|
||||
return (jclass) JNIHandles::make_local(env, Klass::cast(outer_klass)->java_mirror());
|
||||
return (jclass) JNIHandles::make_local(env, outer_klass->java_mirror());
|
||||
}
|
||||
JVM_END
|
||||
|
||||
@ -1452,7 +1452,7 @@ JVM_ENTRY(jstring, JVM_GetClassSignature(JNIEnv *env, jclass cls))
|
||||
// Return null for arrays and primatives
|
||||
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
Symbol* sym = InstanceKlass::cast(k)->generic_signature();
|
||||
if (sym == NULL) return NULL;
|
||||
Handle str = java_lang_String::create_from_symbol(sym, CHECK_NULL);
|
||||
@ -1470,7 +1470,7 @@ JVM_ENTRY(jbyteArray, JVM_GetClassAnnotations(JNIEnv *env, jclass cls))
|
||||
// Return null for arrays and primitives
|
||||
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->class_annotations(), CHECK_NULL);
|
||||
return (jbyteArray) JNIHandles::make_local(env, a);
|
||||
}
|
||||
@ -1583,7 +1583,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass,
|
||||
|
||||
// Exclude primitive types and array types
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
|
||||
Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_array()) {
|
||||
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|
||||
// Return empty array
|
||||
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), 0, CHECK_NULL);
|
||||
return (jobjectArray) JNIHandles::make_local(env, res);
|
||||
@ -1646,7 +1646,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass,
|
||||
|
||||
// Exclude primitive types and array types
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
|
||||
|| Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_array()) {
|
||||
|| java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|
||||
// Return empty array
|
||||
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), 0, CHECK_NULL);
|
||||
return (jobjectArray) JNIHandles::make_local(env, res);
|
||||
@ -1698,7 +1698,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofC
|
||||
|
||||
// Exclude primitive types and array types
|
||||
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
|
||||
|| Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)))->oop_is_array()) {
|
||||
|| java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
|
||||
// Return empty array
|
||||
oop res = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0 , CHECK_NULL);
|
||||
return (jobjectArray) JNIHandles::make_local(env, res);
|
||||
@ -1751,7 +1751,7 @@ JVM_ENTRY(jint, JVM_GetClassAccessFlags(JNIEnv *env, jclass cls))
|
||||
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
|
||||
}
|
||||
|
||||
Klass* k = Klass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)));
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
return k->access_flags().as_int() & JVM_ACC_WRITTEN_FLAGS;
|
||||
}
|
||||
JVM_END
|
||||
@ -1767,7 +1767,7 @@ JVM_ENTRY(jobject, JVM_GetClassConstantPool(JNIEnv *env, jclass cls))
|
||||
// Return null for primitives and arrays
|
||||
if (!java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
instanceKlassHandle k_h(THREAD, k);
|
||||
Handle jcp = sun_reflect_ConstantPool::create(CHECK_NULL);
|
||||
sun_reflect_ConstantPool::set_cp(jcp(), k_h->constants());
|
||||
@ -2043,12 +2043,12 @@ JVM_ENTRY(jboolean, JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclas
|
||||
if (java_lang_Class::is_primitive(r)) return false;
|
||||
|
||||
Klass* k = java_lang_Class::as_Klass(r);
|
||||
assert(Klass::cast(k)->oop_is_instance(), "must be an instance klass");
|
||||
if (! Klass::cast(k)->oop_is_instance()) return false;
|
||||
assert(k->oop_is_instance(), "must be an instance klass");
|
||||
if (! k->oop_is_instance()) return false;
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
const char* name = Klass::cast(k)->name()->as_C_string();
|
||||
bool system_class = Klass::cast(k)->class_loader() == NULL;
|
||||
const char* name = k->name()->as_C_string();
|
||||
bool system_class = k->class_loader() == NULL;
|
||||
return JavaAssertions::enabled(name, system_class);
|
||||
|
||||
JVM_END
|
||||
@ -2079,7 +2079,7 @@ JVM_ENTRY(const char*, JVM_GetClassNameUTF(JNIEnv *env, jclass cls))
|
||||
JVMWrapper("JVM_GetClassNameUTF");
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
|
||||
return Klass::cast(k)->name()->as_utf8();
|
||||
return k->name()->as_utf8();
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -2089,7 +2089,7 @@ JVM_QUICK_ENTRY(void, JVM_GetClassCPTypes(JNIEnv *env, jclass cls, unsigned char
|
||||
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
|
||||
// types will have length zero if this is not an InstanceKlass
|
||||
// (length is determined by call to JVM_GetClassCPEntriesCount)
|
||||
if (Klass::cast(k)->oop_is_instance()) {
|
||||
if (k->oop_is_instance()) {
|
||||
ConstantPool* cp = InstanceKlass::cast(k)->constants();
|
||||
for (int index = cp->length() - 1; index >= 0; index--) {
|
||||
constantTag tag = cp->tag_at(index);
|
||||
@ -2103,7 +2103,7 @@ JVM_QUICK_ENTRY(jint, JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cls))
|
||||
JVMWrapper("JVM_GetClassCPEntriesCount");
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
|
||||
if (!Klass::cast(k)->oop_is_instance())
|
||||
if (!k->oop_is_instance())
|
||||
return 0;
|
||||
return InstanceKlass::cast(k)->constants()->length();
|
||||
JVM_END
|
||||
@ -2113,7 +2113,7 @@ JVM_QUICK_ENTRY(jint, JVM_GetClassFieldsCount(JNIEnv *env, jclass cls))
|
||||
JVMWrapper("JVM_GetClassFieldsCount");
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
|
||||
if (!Klass::cast(k)->oop_is_instance())
|
||||
if (!k->oop_is_instance())
|
||||
return 0;
|
||||
return InstanceKlass::cast(k)->java_fields_count();
|
||||
JVM_END
|
||||
@ -2123,7 +2123,7 @@ JVM_QUICK_ENTRY(jint, JVM_GetClassMethodsCount(JNIEnv *env, jclass cls))
|
||||
JVMWrapper("JVM_GetClassMethodsCount");
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
|
||||
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
|
||||
if (!Klass::cast(k)->oop_is_instance())
|
||||
if (!k->oop_is_instance())
|
||||
return 0;
|
||||
return InstanceKlass::cast(k)->methods()->length();
|
||||
JVM_END
|
||||
@ -3123,7 +3123,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassContext(JNIEnv *env))
|
||||
// Fill in mirrors corresponding to method holders
|
||||
int index = 0;
|
||||
while (first != NULL) {
|
||||
result->obj_at_put(index++, Klass::cast(first->klass())->java_mirror());
|
||||
result->obj_at_put(index++, first->klass()->java_mirror());
|
||||
first = first->next;
|
||||
}
|
||||
assert(index == depth, "just checking");
|
||||
@ -3217,7 +3217,7 @@ bool force_verify_field_access(Klass* current_class, Klass* field_class, AccessF
|
||||
|
||||
if (access.is_protected()) {
|
||||
// See if current_class is a subclass of field_class
|
||||
if (Klass::cast(current_class)->is_subclass_of(field_class)) {
|
||||
if (current_class->is_subclass_of(field_class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3241,8 +3241,8 @@ JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass c
|
||||
}
|
||||
|
||||
// Arrays not allowed here, must use JVM_AllocateNewArray
|
||||
if (Klass::cast(java_lang_Class::as_Klass(curr_mirror))->oop_is_array() ||
|
||||
Klass::cast(java_lang_Class::as_Klass(init_mirror))->oop_is_array()) {
|
||||
if (java_lang_Class::as_Klass(curr_mirror)->oop_is_array() ||
|
||||
java_lang_Class::as_Klass(init_mirror)->oop_is_array()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_0(vmSymbols::java_lang_InvalidClassException());
|
||||
}
|
||||
@ -3264,7 +3264,7 @@ JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass c
|
||||
if (m.is_null()) {
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(),
|
||||
Method::name_and_sig_as_C_string(Klass::cast(init_klass()),
|
||||
Method::name_and_sig_as_C_string(init_klass(),
|
||||
vmSymbols::object_initializer_name(),
|
||||
vmSymbols::void_method_signature()));
|
||||
}
|
||||
@ -4245,7 +4245,7 @@ JVM_ENTRY(jobjectArray, JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass))
|
||||
return NULL;
|
||||
}
|
||||
Klass* k = java_lang_Class::as_Klass(mirror());
|
||||
if (!Klass::cast(k)->oop_is_instance()) {
|
||||
if (!k->oop_is_instance()) {
|
||||
return NULL;
|
||||
}
|
||||
instanceKlassHandle ik_h(THREAD, k);
|
||||
@ -4256,7 +4256,7 @@ JVM_ENTRY(jobjectArray, JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass))
|
||||
objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::Object_klass(), 3, CHECK_NULL);
|
||||
objArrayHandle dest(THREAD, dest_o);
|
||||
Klass* enc_k = ik_h->constants()->klass_at(encl_method_class_idx, CHECK_NULL);
|
||||
dest->obj_at_put(0, Klass::cast(enc_k)->java_mirror());
|
||||
dest->obj_at_put(0, enc_k->java_mirror());
|
||||
int encl_method_method_idx = ik_h->enclosing_method_method_index();
|
||||
if (encl_method_method_idx != 0) {
|
||||
Symbol* sym = ik_h->constants()->symbol_at(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user