This commit is contained in:
Tobias Hartmann 2016-02-29 09:02:13 +01:00
commit eca88d0a0c
359 changed files with 23971 additions and 2575 deletions

View File

@ -349,3 +349,4 @@ f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
086c682bd8c5f195c324f61e2c61fbcd0226d63b jdk-9+104
db483b34fa7148d257a429acddbde9c13687dcae jdk-9+105
6c644cca3f3fc2763e2ff7d669849a75d34543ba jdk-9+106
1c076468bf7dad5b8f2ee5dcf66e2279caa3e208 jdk-9+107

View File

@ -349,3 +349,4 @@ c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
9a38f8b4ba220708db198d08d82fd2144a64777d jdk-9+104
be58b02c11f90b88c67e4d0e2cb5e4cf2d9b3c57 jdk-9+105
54575d8783b3a39a2d710c28cda675d44261f9d9 jdk-9+106
4d65eba233a8730f913734a6804910b842d2cb54 jdk-9+107

View File

@ -123,12 +123,16 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
[
# COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output
# COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
# COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
# commands produced by the link step (currently AIX only)
if test "x$TOOLCHAIN_TYPE" = xxlc; then
COMPILER_TARGET_BITS_FLAG="-q"
COMPILER_COMMAND_FILE_FLAG="-f"
COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
else
COMPILER_TARGET_BITS_FLAG="-m"
COMPILER_COMMAND_FILE_FLAG="@"
COMPILER_BINDCMD_FILE_FLAG=""
# The solstudio linker does not support @-files.
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
@ -152,6 +156,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
fi
AC_SUBST(COMPILER_TARGET_BITS_FLAG)
AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@ -294,10 +299,23 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
SET_SHARED_LIBRARY_NAME='-h [$]1'
SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
PICFLAG="-qpic=large"
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
# will have to patch this single instruction with a call to some out-of-order code which
# does the load from the TOC. This is of course slow. But in that case we also would have
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which
# can be patched directly by the linker and does not require a jump to out-of-order code.
# Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
# instead. This creates a distinct TOC for every compilation unit (and thus requires two
# loads for accessing a global variable). But there are rumors that this may be seen as a
# 'performance feature' because of improved code locality of the symbols used in a
# compilation unit.
PICFLAG="-qpic"
JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
C_FLAG_REORDER=''
CXX_FLAG_REORDER=''
SHARED_LIBRARY_FLAGS="-qmkshrobj"
SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
SET_EXECUTABLE_ORIGIN=""
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
@ -835,7 +853,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
LDFLAGS_XLC="-brtl -bnolibpath -bexpall -bernotok"
LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC"
fi
@ -891,6 +909,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
AC_SUBST(JDKLIB_LIBS)
AC_SUBST(JDKEXE_LIBS)
AC_SUBST(LDFLAGS_CXX_JDK)
AC_SUBST(LDFLAGS_HASH_STYLE)
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"

View File

@ -701,6 +701,7 @@ COMPILER_SUPPORTS_TARGET_BITS_FLAG
ZERO_ARCHFLAG
LDFLAGS_TESTEXE
LDFLAGS_TESTLIB
LDFLAGS_HASH_STYLE
LDFLAGS_CXX_JDK
JDKEXE_LIBS
JDKLIB_LIBS
@ -743,6 +744,7 @@ EXE_OUT_OPTION
CC_OUT_OPTION
STRIPFLAGS
ARFLAGS
COMPILER_BINDCMD_FILE_FLAG
COMPILER_COMMAND_FILE_FLAG
COMPILER_TARGET_BITS_FLAG
JT_HOME
@ -4230,7 +4232,7 @@ pkgadd_help() {
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -4860,7 +4862,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1455271513
DATE_WHEN_GENERATED=1456136781
###############################################################################
#
@ -45391,12 +45393,16 @@ $as_echo "$tool_specified" >&6; }
# COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output
# COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
# COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
# commands produced by the link step (currently AIX only)
if test "x$TOOLCHAIN_TYPE" = xxlc; then
COMPILER_TARGET_BITS_FLAG="-q"
COMPILER_COMMAND_FILE_FLAG="-f"
COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
else
COMPILER_TARGET_BITS_FLAG="-m"
COMPILER_COMMAND_FILE_FLAG="@"
COMPILER_BINDCMD_FILE_FLAG=""
# The solstudio linker does not support @-files.
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
@ -45424,6 +45430,7 @@ $as_echo "no" >&6; }
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ARFLAGS="-r"
@ -46198,10 +46205,23 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
SET_SHARED_LIBRARY_NAME='-h $1'
SET_SHARED_LIBRARY_MAPFILE='-M$1'
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
PICFLAG="-qpic=large"
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
# will have to patch this single instruction with a call to some out-of-order code which
# does the load from the TOC. This is of course slow. But in that case we also would have
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which
# can be patched directly by the linker and does not require a jump to out-of-order code.
# Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
# instead. This creates a distinct TOC for every compilation unit (and thus requires two
# loads for accessing a global variable). But there are rumors that this may be seen as a
# 'performance feature' because of improved code locality of the symbols used in a
# compilation unit.
PICFLAG="-qpic"
JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
C_FLAG_REORDER=''
CXX_FLAG_REORDER=''
SHARED_LIBRARY_FLAGS="-qmkshrobj"
SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
SET_EXECUTABLE_ORIGIN=""
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
@ -46824,7 +46844,7 @@ $as_echo "$supports" >&6; }
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
LDFLAGS_XLC="-brtl -bnolibpath -bexpall -bernotok"
LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC"
fi
@ -46881,6 +46901,7 @@ $as_echo "$supports" >&6; }
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
@ -58630,7 +58651,8 @@ fi
# Setup libm (the maths library)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
if test "x$OPENJDK_TARGET_OS" != "xwindows"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
$as_echo_n "checking for cos in -lm... " >&6; }
if ${ac_cv_lib_m_cos+:} false; then :
$as_echo_n "(cached) " >&6
@ -58675,12 +58697,15 @@ _ACEOF
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Maths library was not found" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: Maths library was not found" >&5
$as_echo "$as_me: Maths library was not found" >&6;}
fi
LIBM=-lm
LIBM="-lm"
else
LIBM=""
fi
# Setup libdl (for dynamic library loading)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -160,10 +160,14 @@ AC_DEFUN_ONCE([LIB_SETUP_LLVM],
AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
[
# Setup libm (the maths library)
AC_CHECK_LIB(m, cos, [], [
AC_MSG_NOTICE([Maths library was not found])
])
LIBM=-lm
if test "x$OPENJDK_TARGET_OS" != "xwindows"; then
AC_CHECK_LIB(m, cos, [], [
AC_MSG_NOTICE([Maths library was not found])
])
LIBM="-lm"
else
LIBM=""
fi
AC_SUBST(LIBM)
# Setup libdl (for dynamic library loading)

View File

@ -314,6 +314,10 @@ COMPILER_SUPPORTS_TARGET_BITS_FLAG=@COMPILER_SUPPORTS_TARGET_BITS_FLAG@
# Option used to pass a command file to the compiler
COMPILER_COMMAND_FILE_FLAG:=@COMPILER_COMMAND_FILE_FLAG@
# Option for specifying a file which saves the binder commands
# produced by the link step (for debugging, currently AIX only)
COMPILER_BINDCMD_FILE_FLAG:=@COMPILER_BINDCMD_FILE_FLAG@
CC_OUT_OPTION:=@CC_OUT_OPTION@
EXE_OUT_OPTION:=@EXE_OUT_OPTION@
LD_OUT_OPTION:=@LD_OUT_OPTION@
@ -351,6 +355,8 @@ CXXFLAGS_JDKLIB:=@CXXFLAGS_JDKLIB@
CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@
CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
LDFLAGS_HASH_STYLE := @LDFLAGS_HASH_STYLE@
CXX:=@FIXPATH@ @CCACHE@ @ICECC@ @CXX@
CPP:=@FIXPATH@ @CPP@

View File

@ -349,3 +349,4 @@ ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
e385e95e6101711d5c63e7b1a827e99b6ec7a1cc jdk-9+104
64006ae915b3aa85ac7e6fac679024d2da7fe526 jdk-9+105
8ec4f97943fe56f93e4621f622b56b7144c0181a jdk-9+106
49202432b69445164a42be7cbdf74ed5fce98157 jdk-9+107

View File

@ -509,3 +509,4 @@ c5f55130b1b69510d9a6f4a3105b58e21cd7ffe1 jdk-9+103
534c50395957c6025fb6627e93b35756f8d48a08 jdk-9+104
266fa9bb5297bf02cb2a7b038b10a109817d2b48 jdk-9+105
7232de4c17c37f60aecec4f3191090bd3d41d334 jdk-9+106
c5146d4da417f76edfc43097d2e2ced042a65b4e jdk-9+107

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -37,3 +37,11 @@ ifndef USE_SUNCC
endif
OPT_CFLAGS/compactingPermGenGen.o = -O1
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/sharedRuntimeTrig.o += -g
OPT_CFLAGS/sharedRuntimeTrans.o += -g
OPT_CFLAGS/compactingPermGenGen.o += -g
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -24,8 +24,4 @@
Obj_Files += bsd_arm.o
ifneq ($(EXT_LIBS_PATH),)
LIBS += $(EXT_LIBS_PATH)/sflt_glibc.a
endif
CFLAGS += -DVM_LITTLE_ENDIAN

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -330,6 +330,13 @@ ifeq ($(USE_CLANG), true)
), 1)
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
OPT_CFLAGS/unsafe.o += -O1
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/loopTransform.o += -g
OPT_CFLAGS/unsafe.o += -g
endif
else
$(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)")
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -32,3 +32,11 @@ CFLAGS += -DVM_LITTLE_ENDIAN
CFLAGS += -D_LP64=1
OPT_CFLAGS/compactingPermGenGen.o = -O1
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/sharedRuntimeTrig.o += -g
OPT_CFLAGS/sharedRuntimeTrans.o += -g
OPT_CFLAGS/compactingPermGenGen.o += -g
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -265,6 +265,11 @@ ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \&
# GCC >= 4.3
# Gcc 4.1.2 does not support this flag, nor does it have problems compiling the file.
OPT_CFLAGS/vmStructs.o += -fno-var-tracking-assignments
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/vmStructs.o += -g
endif
endif
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
@ -277,6 +282,11 @@ endif
ifeq ($(USE_CLANG), true)
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/loopTransform.o += -g
endif
endif
else
# Do not allow GCC 4.1.1

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -32,3 +32,11 @@ OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
CFLAGS += -DVM_LITTLE_ENDIAN
OPT_CFLAGS/compactingPermGenGen.o = -O1
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/sharedRuntimeTrig.o += -g
OPT_CFLAGS/sharedRuntimeTrans.o += -g
OPT_CFLAGS/compactingPermGenGen.o += -g
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright 2007, 2008 Red Hat, Inc.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
@ -29,12 +29,6 @@
ifeq ($(USE_CLANG), true)
WARNING_FLAGS += -Wno-undef
endif
# Suppress some warning flags that are normally turned on for hotspot,
# because some of the zero code has not been updated accordingly.
WARNING_FLAGS += -Wno-return-type \
-Wno-format-nonliteral -Wno-format-security \
-Wno-maybe-uninitialized
# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,14 @@ ifeq ("${Platform_compiler}", "sparcWorks")
OPT_CFLAGS/generateOptoStub.o = -xO2
# Temporary util SS12u1 C++ compiler is fixed
OPT_CFLAGS/c1_LinearScan.o = -xO2
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/generateOptoStub.o += -g0 -xs
OPT_CFLAGS/LinearScan.o += -g0 -xs
endif
else
ifeq ("${Platform_compiler}", "gcc")

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -35,11 +35,21 @@ OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@))
# for this method for now. (fix this when dtrace bug 6258412 is fixed)
ifndef USE_GCC
OPT_CFLAGS/ciEnv.o = $(OPT_CFLAGS) -xinline=no%__1cFciEnvbFpost_compiled_method_load_event6MpnHnmethod__v_
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/ciEnv.o += -g0 -xs
endif
endif
# Need extra inlining to get oop_ps_push_contents functions to perform well enough.
ifndef USE_GCC
OPT_CFLAGS/psPromotionManager.o = $(OPT_CFLAGS) -W2,-Ainline:inc=1000
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/psPromotionManager.o += -g0 -xs
endif
endif
# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
@ -55,6 +65,12 @@ endif # COMPILER_REV_NUMERIC == 510
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
# dtrace cannot handle tail call optimization (6672627, 6693876)
OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)
# The -g0 -xs flag is added to OPT_CFLAGS in sparcWorks.make, but lost in case of
# per-file overrides of OPT_CFLAGS. Restore it here. This is mainly needed
# to provide a good baseline to compare the new build against.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/jni.o += -g0 -xs
endif
endif # COMPILER_NUMERIC_REV >= 509
# Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12)

View File

@ -158,9 +158,20 @@ OPT_CFLAGS/NO_TAIL_CALL_OPT = -Wu,-O~yz
OPT_CCFLAGS/NO_TAIL_CALL_OPT = -Qoption ube -O~yz
OPT_CFLAGS/stubGenerator_x86_32.o = $(OPT_CFLAGS) -xspace
OPT_CFLAGS/stubGenerator_x86_64.o = $(OPT_CFLAGS) -xspace
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/stubGenerator_x86_32.o += -g0 -xs
OPT_CFLAGS/stubGenerator_x86_64.o += -g0 -xs
endif
endif # Platform_arch == x86
ifeq ("${Platform_arch}", "sparc")
OPT_CFLAGS/stubGenerator_sparc.o = $(OPT_CFLAGS) -xspace
# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides
# of OPT_CFLAGS. Restore it here.
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
OPT_CFLAGS/stubGenerator_sparc.o += -g0 -xs
endif
endif
endif # COMPILER_REV_NUMERIC >= 509

View File

@ -773,7 +773,7 @@ InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
}
BasicType CppInterpreter::result_type_of(Method* method) {
BasicType t;
BasicType t = T_ILLEGAL; // silence compiler warnings
switch (method->result_index()) {
case 0 : t = T_BOOLEAN; break;
case 1 : t = T_CHAR; break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -62,7 +62,7 @@ void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_object() {
}
void InterpreterRuntime::SignatureHandlerGeneratorBase::push(BasicType type) {
ffi_type *ftype;
ffi_type *ftype = NULL;
switch (type) {
case T_VOID:
ftype = &ffi_type_void;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -225,7 +225,7 @@ int AixAttachListener::init() {
// We must call bind with the actual socketaddr length. This is obligatory for AS400.
int res = ::bind(listener, (struct sockaddr*)&addr, SUN_LEN(&addr));
if (res == -1) {
RESTARTABLE(::close(listener), res);
::close(listener);
return -1;
}
@ -238,7 +238,7 @@ int AixAttachListener::init() {
}
}
if (res == -1) {
RESTARTABLE(::close(listener), res);
::close(listener);
::unlink(initial_path);
return -1;
}
@ -400,7 +400,7 @@ AixAttachOperation* AixAttachListener::dequeue() {
AixAttachOperation* op = read_request(s);
if (op == NULL) {
int res;
RESTARTABLE(::close(s), res);
::close(s);
continue;
} else {
return op;
@ -452,7 +452,7 @@ void AixAttachOperation::complete(jint result, bufferedStream* st) {
}
// done
RESTARTABLE(::close(this->socket()), rc);
::close(this->socket());
// were we externally suspended while we were waiting?
thread->check_and_wait_while_suspended();

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2013 SAP SE. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -121,7 +121,7 @@ static void save_memory_to_file(char* addr, size_t size) {
addr += result;
}
RESTARTABLE(::close(fd), result);
result = ::close(fd);
if (PrintMiscellaneous && Verbose) {
if (result == OS_ERR) {
warning("Could not close %s: %s\n", destfile, strerror(errno));
@ -299,10 +299,13 @@ static int open_o_nofollow_impl(const char* path, int oflag, mode_t mode, bool u
bool create;
int error;
int fd;
int result;
create = false;
if (lstat(path, &orig_st) != 0) {
RESTARTABLE(::lstat(path, &orig_st), result);
if (result == OS_ERR) {
if (errno == ENOENT && (oflag & O_CREAT) != 0) {
// File doesn't exist, but_we want to create it, add O_EXCL flag
// to make sure no-one creates it (or a symlink) before us
@ -316,7 +319,7 @@ static int open_o_nofollow_impl(const char* path, int oflag, mode_t mode, bool u
return OS_ERR;
}
} else {
// Lstat success, check if existing file is a link.
// lstat success, check if existing file is a link.
if ((orig_st.st_mode & S_IFMT) == S_IFLNK) {
// File is a symlink.
errno = ELOOP;
@ -325,9 +328,9 @@ static int open_o_nofollow_impl(const char* path, int oflag, mode_t mode, bool u
}
if (use_mode == true) {
fd = open(path, oflag, mode);
RESTARTABLE(::open(path, oflag, mode), fd);
} else {
fd = open(path, oflag);
RESTARTABLE(::open(path, oflag), fd);
}
if (fd == OS_ERR) {
@ -336,7 +339,8 @@ static int open_o_nofollow_impl(const char* path, int oflag, mode_t mode, bool u
// Can't do inode checks on before/after if we created the file.
if (create == false) {
if (fstat(fd, &new_st) != 0) {
RESTARTABLE(::fstat(fd, &new_st), result);
if (result == OS_ERR) {
// Keep errno from fstat, in case close also fails.
error = errno;
::close(fd);
@ -384,7 +388,7 @@ static DIR *open_directory_secure(const char* dirname) {
RESTARTABLE(::open(dirname, O_RDONLY|O_NOFOLLOW), result);
#else
// workaround (jdk6 coding)
RESTARTABLE(::open_o_nofollow(dirname, O_RDONLY), result);
result = open_o_nofollow(dirname, O_RDONLY);
#endif
if (result == OS_ERR) {
@ -888,7 +892,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result);
#else
// workaround function (jdk6 code)
RESTARTABLE(::open_o_nofollow(filename, O_RDWR|O_CREAT, S_IREAD|S_IWRITE), result);
result = open_o_nofollow(filename, O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
#endif
if (result == OS_ERR) {
@ -931,7 +935,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
if (PrintMiscellaneous && Verbose) {
warning("could not set shared memory file size: %s\n", strerror(errno));
}
RESTARTABLE(::close(fd), result);
::close(fd);
return -1;
}
@ -951,7 +955,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
#ifdef O_NOFOLLOW
RESTARTABLE(::open(filename, oflags), result);
#else
RESTARTABLE(::open_o_nofollow(filename, oflags), result);
open_o_nofollow(filename, oflags);
#endif
if (result == OS_ERR) {
@ -1006,8 +1010,7 @@ static char* mmap_create_shared(size_t size) {
char* dirname = get_user_tmp_dir(user_name);
char* filename = get_sharedmem_filename(dirname, vmid);
// Get the short filename.
// get the short filename.
char* short_filename = strrchr(filename, '/');
if (short_filename == NULL) {
short_filename = filename;
@ -1033,9 +1036,7 @@ static char* mmap_create_shared(size_t size) {
mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
// attempt to close the file - restart it if it was interrupted,
// but ignore other failures
RESTARTABLE(::close(fd), result);
result = ::close(fd);
assert(result != OS_ERR, "could not close file");
if (mapAddress == MAP_FAILED) {
@ -1142,7 +1143,6 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// constructs for the file and the shared memory mapping.
if (mode == PerfMemory::PERF_MODE_RO) {
mmap_prot = PROT_READ;
// No O_NOFOLLOW defined at buildtime, and it is not documented for open.
#ifdef O_NOFOLLOW
file_flags = O_RDONLY | O_NOFOLLOW;
@ -1205,21 +1205,28 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);
assert(fd != OS_ERR, "unexpected value");
fd = open_sharedmem_file(rfilename, file_flags, THREAD);
if (fd == OS_ERR) {
return;
}
if (HAS_PENDING_EXCEPTION) {
::close(fd);
return;
}
if (*sizep == 0) {
size = sharedmem_filesize(fd, CHECK);
assert(size != 0, "unexpected size");
} else {
size = *sizep;
}
assert(size > 0, "unexpected size <= 0");
mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0);
// attempt to close the file - restart if it gets interrupted,
// but ignore other failures
RESTARTABLE(::close(fd), result);
result = ::close(fd);
assert(result != OS_ERR, "could not close file");
if (mapAddress == MAP_FAILED) {
@ -1230,7 +1237,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
"Could not map PerfMemory");
}
// It does not go through os api, the operation has to record from here.
// it does not go through os api, the operation has to record from here.
MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC, mtInternal);
*addr = mapAddress;
@ -1238,7 +1245,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
if (PerfTraceMemOps) {
tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -238,14 +238,12 @@ void os::Posix::print_uname_info(outputStream* st) {
st->cr();
}
#ifndef PRODUCT
bool os::get_host_name(char* buf, size_t buflen) {
struct utsname name;
uname(&name);
jio_snprintf(buf, buflen, "%s", name.nodename);
return true;
}
#endif // PRODUCT
bool os::has_allocatable_memory_limit(julong* limit) {
struct rlimit rlim;

View File

@ -1531,12 +1531,10 @@ int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *pa
return result;
}
#ifndef PRODUCT
bool os::get_host_name(char* buf, size_t buflen) {
DWORD size = (DWORD)buflen;
return (GetComputerNameEx(ComputerNameDnsHostname, buf, &size) == TRUE);
}
#endif // PRODUCT
void os::get_summary_os_info(char* buf, size_t buflen) {
stringStream sst(buf, buflen);

View File

@ -628,6 +628,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
if (!is_directory_secure(dirname)) {
// the directory is not secure, don't attempt any cleanup
os::closedir(dirp);
return;
}
@ -1445,6 +1446,8 @@ static char* mapping_create_shared(size_t size) {
// check that the file system is secure - i.e. it supports ACLs.
if (!is_filesystem_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, user);
return NULL;
}
@ -1624,6 +1627,7 @@ static void open_file_mapping(const char* user, int vmid,
//
if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -65,6 +65,7 @@ address os::current_stack_pointer() {
frame os::get_sender_for_C_frame(frame* fr) {
ShouldNotCallThis();
return frame(NULL, NULL); // silence compile warning.
}
frame os::current_frame() {
@ -102,6 +103,7 @@ void os::initialize_thread(Thread * thr){
address os::Linux::ucontext_get_pc(const ucontext_t* uc) {
ShouldNotCallThis();
return NULL; // silence compile warnings
}
void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
@ -112,10 +114,12 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
ShouldNotCallThis();
return NULL; // silence compile warnings
}
frame os::fetch_frame_from_context(const void* ucVoid) {
ShouldNotCallThis();
return frame(NULL, NULL); // silence compile warnings
}
extern "C" JNIEXPORT int
@ -262,11 +266,16 @@ JVM_handle_linux_signal(int sig,
}
#endif // !PRODUCT
const char *fmt = "caught unhandled signal %d";
char buf[64];
sprintf(buf, fmt, sig);
sprintf(buf, "caught unhandled signal %d", sig);
// Silence -Wformat-security warning for fatal()
PRAGMA_DIAG_PUSH
PRAGMA_FORMAT_NONLITERAL_IGNORED
fatal(buf);
PRAGMA_DIAG_POP
return true; // silence compiler warnings
}
void os::Linux::init_thread_fpu_state(void) {
@ -275,6 +284,7 @@ void os::Linux::init_thread_fpu_state(void) {
int os::Linux::get_fpu_control_word() {
ShouldNotCallThis();
return -1; // silence compile warnings
}
void os::Linux::set_fpu_control_word(int fpu) {
@ -419,6 +429,7 @@ void os::print_register_info(outputStream *st, const void *context) {
extern "C" {
int SpinPause() {
return -1; // silence compile warnings
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -110,6 +110,7 @@
void* ucontext,
bool isInJava) {
ShouldNotCallThis();
return false; // silence compile warning
}
// These routines are only used on cpu architectures that

View File

@ -200,7 +200,6 @@ oop StringTable::lookup(jchar* name, int len) {
return string;
}
oop StringTable::intern(Handle string_or_null, jchar* name,
int len, TRAPS) {
oop found_string = lookup_shared(name, len);
@ -214,7 +213,9 @@ oop StringTable::intern(Handle string_or_null, jchar* name,
// Found
if (found_string != NULL) {
ensure_string_alive(found_string);
if (found_string != string_or_null()) {
ensure_string_alive(found_string);
}
return found_string;
}
@ -249,7 +250,9 @@ oop StringTable::intern(Handle string_or_null, jchar* name,
hashValue, CHECK_NULL);
}
ensure_string_alive(added_or_found);
if (added_or_found != string()) {
ensure_string_alive(added_or_found);
}
return added_or_found;
}

View File

@ -39,6 +39,7 @@
#include "gc/shared/genOopClosures.inline.hpp"
#include "gc/shared/generation.hpp"
#include "gc/shared/plab.inline.hpp"
#include "gc/shared/preservedMarks.inline.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/space.hpp"
#include "gc/shared/spaceDecorator.hpp"
@ -64,6 +65,7 @@ ParScanThreadState::ParScanThreadState(Space* to_space_,
int thread_num_,
ObjToScanQueueSet* work_queue_set_,
Stack<oop, mtGC>* overflow_stacks_,
PreservedMarks* preserved_marks_,
size_t desired_plab_sz_,
ParallelTaskTerminator& term_) :
_to_space(to_space_),
@ -73,6 +75,7 @@ ParScanThreadState::ParScanThreadState(Space* to_space_,
_work_queue(work_queue_set_->queue(thread_num_)),
_to_space_full(false),
_overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL),
_preserved_marks(preserved_marks_),
_ageTable(false), // false ==> not the global age table, no perf data.
_to_space_alloc_buffer(desired_plab_sz_),
_to_space_closure(young_gen_, this),
@ -286,6 +289,7 @@ public:
Generation& old_gen,
ObjToScanQueueSet& queue_set,
Stack<oop, mtGC>* overflow_stacks_,
PreservedMarksSet& preserved_marks_set,
size_t desired_plab_sz,
ParallelTaskTerminator& term);
@ -322,6 +326,7 @@ ParScanThreadStateSet::ParScanThreadStateSet(int num_threads,
Generation& old_gen,
ObjToScanQueueSet& queue_set,
Stack<oop, mtGC>* overflow_stacks,
PreservedMarksSet& preserved_marks_set,
size_t desired_plab_sz,
ParallelTaskTerminator& term)
: ResourceArray(sizeof(ParScanThreadState), num_threads),
@ -336,7 +341,8 @@ ParScanThreadStateSet::ParScanThreadStateSet(int num_threads,
for (int i = 0; i < num_threads; ++i) {
new ((ParScanThreadState*)_data + i)
ParScanThreadState(&to_space, &young_gen, &old_gen, i, &queue_set,
overflow_stacks, desired_plab_sz, term);
overflow_stacks, preserved_marks_set.get(i),
desired_plab_sz, term);
}
}
@ -905,12 +911,16 @@ void ParNewGeneration::collect(bool full,
// Set the correct parallelism (number of queues) in the reference processor
ref_processor()->set_active_mt_degree(active_workers);
// Need to initialize the preserved marks before the ThreadStateSet c'tor.
_preserved_marks_set.init(active_workers);
// Always set the terminator for the active number of workers
// because only those workers go through the termination protocol.
ParallelTaskTerminator _term(active_workers, task_queues());
ParScanThreadStateSet thread_state_set(active_workers,
*to(), *this, *_old_gen, *task_queues(),
_overflow_stacks, desired_plab_sz(), _term);
_overflow_stacks, _preserved_marks_set,
desired_plab_sz(), _term);
thread_state_set.reset(active_workers, promotion_failed());
@ -993,6 +1003,7 @@ void ParNewGeneration::collect(bool full,
} else {
handle_promotion_failed(gch, thread_state_set);
}
_preserved_marks_set.reclaim();
// set new iteration safe limit for the survivor spaces
from()->set_concurrent_iteration_safe_limit(from()->top());
to()->set_concurrent_iteration_safe_limit(to()->top());
@ -1070,15 +1081,6 @@ oop ParNewGeneration::real_forwardee_slow(oop obj) {
return forward_ptr;
}
void ParNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) {
if (m->must_be_preserved_for_promotion_failure(obj)) {
// We should really have separate per-worker stacks, rather
// than use locking of a common pair of stacks.
MutexLocker ml(ParGCRareEvent_lock);
preserve_mark(obj, m);
}
}
// Multiple GC threads may try to promote an object. If the object
// is successfully promoted, a forwarding pointer will be installed in
// the object in the young generation. This method claims the right
@ -1136,7 +1138,7 @@ oop ParNewGeneration::copy_to_survivor_space(ParScanThreadState* par_scan_state,
_promotion_failed = true;
new_obj = old;
preserve_mark_if_necessary(old, m);
par_scan_state->preserved_marks()->push_if_necessary(old, m);
par_scan_state->register_promotion_failure(sz);
}

View File

@ -30,6 +30,7 @@
#include "gc/shared/copyFailedInfo.hpp"
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/plab.hpp"
#include "gc/shared/preservedMarks.hpp"
#include "gc/shared/taskqueue.hpp"
#include "memory/padded.hpp"
@ -65,6 +66,7 @@ class ParScanThreadState {
private:
ObjToScanQueue *_work_queue;
Stack<oop, mtGC>* const _overflow_stack;
PreservedMarks* const _preserved_marks;
PLAB _to_space_alloc_buffer;
@ -128,6 +130,7 @@ class ParScanThreadState {
Generation* old_gen_, int thread_num_,
ObjToScanQueueSet* work_queue_set_,
Stack<oop, mtGC>* overflow_stacks_,
PreservedMarks* preserved_marks_,
size_t desired_plab_sz_,
ParallelTaskTerminator& term_);
@ -136,6 +139,8 @@ class ParScanThreadState {
ObjToScanQueue* work_queue() { return _work_queue; }
PreservedMarks* preserved_marks() const { return _preserved_marks; }
PLAB* to_space_alloc_buffer() {
return &_to_space_alloc_buffer;
}
@ -331,10 +336,6 @@ class ParNewGeneration: public DefNewGeneration {
static oop real_forwardee_slow(oop obj);
static void waste_some_time();
// Preserve the mark of "obj", if necessary, in preparation for its mark
// word being overwritten with a self-forwarding-pointer.
void preserve_mark_if_necessary(oop obj, markOop m);
void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set);
protected:

View File

@ -89,8 +89,6 @@ bool ConcurrentG1RefineThread::is_active() {
void ConcurrentG1RefineThread::activate() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (!is_primary()) {
log_debug(gc, refine)("G1-Refine-activated worker %d, on threshold %d, current %d",
_worker_id, _threshold, JavaThread::dirty_card_queue_set().completed_buffers_num());
set_active(true);
} else {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
@ -102,8 +100,6 @@ void ConcurrentG1RefineThread::activate() {
void ConcurrentG1RefineThread::deactivate() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (!is_primary()) {
log_debug(gc, refine)("G1-Refine-deactivated worker %d, off threshold %d, current %d",
_worker_id, _deactivation_threshold, JavaThread::dirty_card_queue_set().completed_buffers_num());
set_active(false);
} else {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
@ -130,9 +126,12 @@ void ConcurrentG1RefineThread::run_service() {
break;
}
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
log_debug(gc, refine)("Activated %d, on threshold: %d, current: %d",
_worker_id, _threshold, dcqs.completed_buffers_num());
{
SuspendibleThreadSetJoiner sts_join;
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
do {
int curr_buffer_num = (int)dcqs.completed_buffers_num();
@ -142,24 +141,19 @@ void ConcurrentG1RefineThread::run_service() {
dcqs.set_completed_queue_padding(0);
}
if (!is_primary() && curr_buffer_num <= _deactivation_threshold) {
// If the number of the buffer has fallen below our threshold
// we should deactivate. The predecessor will reactivate this
// thread should the number of the buffers cross the threshold again.
deactivate();
break;
}
// Check if we need to activate the next thread.
if (_next != NULL && !_next->is_active() && curr_buffer_num > _next->_threshold) {
_next->activate();
}
} while (dcqs.apply_closure_to_completed_buffer(_refine_closure, _worker_id + _worker_id_offset, cg1r()->green_zone()));
} while (dcqs.apply_closure_to_completed_buffer(_refine_closure,
_worker_id + _worker_id_offset,
_deactivation_threshold,
false /* during_pause */));
// We can exit the loop above while being active if there was a yield request.
if (is_active()) {
deactivate();
}
deactivate();
log_debug(gc, refine)("Deactivated %d, off threshold: %d, current: %d",
_worker_id, _deactivation_threshold,
dcqs.completed_buffers_num());
}
if (os::supports_vtime()) {
@ -169,7 +163,7 @@ void ConcurrentG1RefineThread::run_service() {
}
}
log_debug(gc, refine)("G1-Refine-stop");
log_debug(gc, refine)("Stopping %d", _worker_id);
}
void ConcurrentG1RefineThread::stop() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -228,37 +228,30 @@ BufferNode* DirtyCardQueueSet::get_completed_buffer(int stop_at) {
return nd;
}
bool DirtyCardQueueSet::apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
uint worker_i,
BufferNode* nd) {
if (nd != NULL) {
void **buf = BufferNode::make_buffer_from_node(nd);
size_t index = nd->index();
bool b =
DirtyCardQueue::apply_closure_to_buffer(cl, buf,
index, _sz,
true, worker_i);
if (b) {
deallocate_buffer(buf);
return true; // In normal case, go on to next buffer.
} else {
enqueue_complete_buffer(buf, index);
return false;
}
} else {
return false;
}
}
bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
uint worker_i,
int stop_at,
bool during_pause) {
assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
BufferNode* nd = get_completed_buffer(stop_at);
bool res = apply_closure_to_completed_buffer_helper(cl, worker_i, nd);
if (res) Atomic::inc(&_processed_buffers_rs_thread);
return res;
if (nd == NULL) {
return false;
} else {
void** buf = BufferNode::make_buffer_from_node(nd);
size_t index = nd->index();
if (DirtyCardQueue::apply_closure_to_buffer(cl,
buf, index, _sz,
true, worker_i)) {
// Done with fully processed buffer.
deallocate_buffer(buf);
Atomic::inc(&_processed_buffers_rs_thread);
return true;
} else {
// Return partially processed buffer to the queue.
enqueue_complete_buffer(buf, index);
return false;
}
}
}
void DirtyCardQueueSet::apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -133,14 +133,9 @@ public:
// partially completed buffer (with its processed elements set to NULL)
// is returned to the completed buffer set, and this call returns false.
bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
uint worker_i = 0,
int stop_at = 0,
bool during_pause = false);
// Helper routine for the above.
bool apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
uint worker_i,
BufferNode* nd);
uint worker_i,
int stop_at,
bool during_pause);
BufferNode* get_completed_buffer(int stop_at);

View File

@ -2777,12 +2777,6 @@ void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const {
}
void G1CollectedHeap::print_tracing_info() const {
// We'll overload this to mean "trace GC pause statistics."
if (TraceYoungGenTime || TraceOldGenTime) {
// The "G1CollectorPolicy" is keeping track of these stats, so delegate
// to that.
g1_policy()->print_tracing_info();
}
g1_rem_set()->print_summary_info();
concurrent_mark()->print_summary_info();
g1_policy()->print_yg_surv_rate_info();
@ -2908,7 +2902,6 @@ HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size,
bool* succeeded,
GCCause::Cause gc_cause) {
assert_heap_not_locked_and_not_at_safepoint();
g1_policy()->record_stop_world_start();
VM_G1IncCollectionPause op(gc_count_before,
word_size,
false, /* should_initiate_conc_mark */
@ -3242,10 +3235,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
GCTraceCPUTime tcpu;
uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
Threads::number_of_non_daemon_threads());
workers()->set_active_workers(active_workers);
FormatBuffer<> gc_string("Pause ");
if (collector_state()->during_initial_mark_pause()) {
gc_string.append("Initial Mark");
@ -3256,6 +3245,11 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
}
GCTraceTime(Info, gc) tm(gc_string, NULL, gc_cause(), true);
uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
Threads::number_of_non_daemon_threads());
workers()->set_active_workers(active_workers);
g1_policy()->note_gc_start(active_workers);
TraceCollectorStats tcs(g1mm()->incremental_collection_counters());

View File

@ -81,10 +81,8 @@ static double non_young_other_cost_per_region_ms_defaults[] = {
G1CollectorPolicy::G1CollectorPolicy() :
_predictor(G1ConfidencePercent / 100.0),
_parallel_gc_threads(ParallelGCThreads),
_recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
_stop_world_start(0.0),
_concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
_concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
@ -129,7 +127,6 @@ G1CollectorPolicy::G1CollectorPolicy() :
_inc_cset_head(NULL),
_inc_cset_tail(NULL),
_inc_cset_bytes_used_before(0),
_inc_cset_max_finger(NULL),
_inc_cset_recorded_rs_lengths(0),
_inc_cset_recorded_rs_lengths_diffs(0),
_inc_cset_predicted_elapsed_time_ms(0.0),
@ -172,9 +169,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
clear_ratio_check_data();
_phase_times = new G1GCPhaseTimes(_parallel_gc_threads);
_phase_times = new G1GCPhaseTimes(ParallelGCThreads);
int index = MIN2(_parallel_gc_threads - 1, 7);
int index = MIN2(ParallelGCThreads - 1, 7u);
_rs_length_diff_seq->add(rs_length_diff_defaults[index]);
_cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
@ -872,8 +869,6 @@ void G1CollectorPolicy::record_full_collection_end() {
double full_gc_time_sec = end_sec - _full_collection_start_sec;
double full_gc_time_ms = full_gc_time_sec * 1000.0;
_trace_old_gen_time_data.record_full_collection(full_gc_time_ms);
update_recent_gc_times(end_sec, full_gc_time_ms);
collector_state()->set_full_collection(false);
@ -904,10 +899,6 @@ void G1CollectorPolicy::record_full_collection_end() {
record_pause(FullGC, _full_collection_start_sec, end_sec);
}
void G1CollectorPolicy::record_stop_world_start() {
_stop_world_start = os::elapsedTime();
}
void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
// We only need to do this here as the policy will only be applied
// to the GC we're about to start. so, no point is calculating this
@ -918,10 +909,6 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
"sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
_g1->used(), _g1->recalculate_used());
double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
_trace_young_gen_time_data.record_start_collection(s_w_t_ms);
_stop_world_start = 0.0;
phase_times()->record_cur_collection_start_sec(start_time_sec);
_pending_cards = _g1->pending_card_num();
@ -973,13 +960,6 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
collector_state()->set_in_marking_window(false);
}
void G1CollectorPolicy::record_concurrent_pause() {
if (_stop_world_start > 0.0) {
double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0;
_trace_young_gen_time_data.record_yield_time(yield_ms);
}
}
double G1CollectorPolicy::average_time_ms(G1GCPhaseTimes::GCParPhases phase) const {
return phase_times()->average_time_ms(phase);
}
@ -1064,7 +1044,6 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, size_t
}
if (update_stats) {
_trace_young_gen_time_data.record_end_collection(pause_time_ms, phase_times());
// We maintain the invariant that all objects allocated by mutator
// threads will be allocated out of eden regions. So, we can use
// the eden region number allocated since the previous GC to
@ -1654,11 +1633,6 @@ size_t G1CollectorPolicy::expansion_amount() {
return expand_bytes;
}
void G1CollectorPolicy::print_tracing_info() const {
_trace_young_gen_time_data.print();
_trace_old_gen_time_data.print();
}
void G1CollectorPolicy::print_yg_surv_rate_info() const {
#ifndef PRODUCT
_short_lived_surv_rate_group->print_surv_rate_summary();
@ -1869,7 +1843,6 @@ void G1CollectorPolicy::start_incremental_cset_building() {
_inc_cset_tail = NULL;
_inc_cset_bytes_used_before = 0;
_inc_cset_max_finger = 0;
_inc_cset_recorded_rs_lengths = 0;
_inc_cset_recorded_rs_lengths_diffs = 0;
_inc_cset_predicted_elapsed_time_ms = 0.0;
@ -1981,9 +1954,6 @@ void G1CollectorPolicy::add_region_to_incremental_cset_common(HeapRegion* hr) {
size_t rs_length = hr->rem_set()->occupied();
add_to_incremental_cset_info(hr, rs_length);
HeapWord* hr_end = hr->end();
_inc_cset_max_finger = MAX2(_inc_cset_max_finger, hr_end);
assert(!hr->in_collection_set(), "invariant");
_g1->register_young_region_with_cset(hr);
assert(hr->next_in_collection_set() == NULL, "invariant");
@ -2190,12 +2160,6 @@ double G1CollectorPolicy::finalize_young_cset_part(double target_pause_time_ms)
collector_state()->set_last_gc_was_young(collector_state()->gcs_are_young());
if (collector_state()->last_gc_was_young()) {
_trace_young_gen_time_data.increment_young_collection_count();
} else {
_trace_young_gen_time_data.increment_mixed_collection_count();
}
// The young list is laid with the survivor regions from the previous
// pause are appended to the RHS of the young list, i.e.
// [Newly Young Regions ++ Survivors from last pause].
@ -2335,127 +2299,3 @@ void G1CollectorPolicy::finalize_old_cset_part(double time_remaining_ms) {
double non_young_end_time_sec = os::elapsedTime();
phase_times()->record_non_young_cset_choice_time_ms((non_young_end_time_sec - non_young_start_time_sec) * 1000.0);
}
void TraceYoungGenTimeData::record_start_collection(double time_to_stop_the_world_ms) {
if(TraceYoungGenTime) {
_all_stop_world_times_ms.add(time_to_stop_the_world_ms);
}
}
void TraceYoungGenTimeData::record_yield_time(double yield_time_ms) {
if(TraceYoungGenTime) {
_all_yield_times_ms.add(yield_time_ms);
}
}
void TraceYoungGenTimeData::record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times) {
if(TraceYoungGenTime) {
_total.add(pause_time_ms);
_other.add(pause_time_ms - phase_times->accounted_time_ms());
_root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms());
_parallel.add(phase_times->cur_collection_par_time_ms());
_ext_root_scan.add(phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan));
_satb_filtering.add(phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering));
_update_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS));
_scan_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::ScanRS));
_obj_copy.add(phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy));
_termination.add(phase_times->average_time_ms(G1GCPhaseTimes::Termination));
double parallel_known_time = phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan) +
phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering) +
phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS) +
phase_times->average_time_ms(G1GCPhaseTimes::ScanRS) +
phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy) +
phase_times->average_time_ms(G1GCPhaseTimes::Termination);
double parallel_other_time = phase_times->cur_collection_par_time_ms() - parallel_known_time;
_parallel_other.add(parallel_other_time);
_clear_ct.add(phase_times->cur_clear_ct_time_ms());
}
}
void TraceYoungGenTimeData::increment_young_collection_count() {
if(TraceYoungGenTime) {
++_young_pause_num;
}
}
void TraceYoungGenTimeData::increment_mixed_collection_count() {
if(TraceYoungGenTime) {
++_mixed_pause_num;
}
}
void TraceYoungGenTimeData::print_summary(const char* str,
const NumberSeq* seq) const {
double sum = seq->sum();
tty->print_cr("%-27s = %8.2lf s (avg = %8.2lf ms)",
str, sum / 1000.0, seq->avg());
}
void TraceYoungGenTimeData::print_summary_sd(const char* str,
const NumberSeq* seq) const {
print_summary(str, seq);
tty->print_cr("%45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
"(num", seq->num(), seq->sd(), seq->maximum());
}
void TraceYoungGenTimeData::print() const {
if (!TraceYoungGenTime) {
return;
}
tty->print_cr("ALL PAUSES");
print_summary_sd(" Total", &_total);
tty->cr();
tty->cr();
tty->print_cr(" Young GC Pauses: %8d", _young_pause_num);
tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num);
tty->cr();
tty->print_cr("EVACUATION PAUSES");
if (_young_pause_num == 0 && _mixed_pause_num == 0) {
tty->print_cr("none");
} else {
print_summary_sd(" Evacuation Pauses", &_total);
print_summary(" Root Region Scan Wait", &_root_region_scan_wait);
print_summary(" Parallel Time", &_parallel);
print_summary(" Ext Root Scanning", &_ext_root_scan);
print_summary(" SATB Filtering", &_satb_filtering);
print_summary(" Update RS", &_update_rs);
print_summary(" Scan RS", &_scan_rs);
print_summary(" Object Copy", &_obj_copy);
print_summary(" Termination", &_termination);
print_summary(" Parallel Other", &_parallel_other);
print_summary(" Clear CT", &_clear_ct);
print_summary(" Other", &_other);
}
tty->cr();
tty->print_cr("MISC");
print_summary_sd(" Stop World", &_all_stop_world_times_ms);
print_summary_sd(" Yields", &_all_yield_times_ms);
}
void TraceOldGenTimeData::record_full_collection(double full_gc_time_ms) {
if (TraceOldGenTime) {
_all_full_gc_times.add(full_gc_time_ms);
}
}
void TraceOldGenTimeData::print() const {
if (!TraceOldGenTime) {
return;
}
if (_all_full_gc_times.num() > 0) {
tty->print("\n%4d full_gcs: total time = %8.2f s",
_all_full_gc_times.num(),
_all_full_gc_times.sum() / 1000.0);
tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times.avg());
tty->print_cr(" [std. dev = %8.2f ms, max = %8.2f ms]",
_all_full_gc_times.sd(),
_all_full_gc_times.maximum());
}
}

View File

@ -45,52 +45,6 @@ class CollectionSetChooser;
class G1IHOPControl;
class G1YoungGenSizer;
// TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses
// (the latter may contain non-young regions - i.e. regions that are
// technically in old) while TraceOldGenTime collects data about full GCs.
class TraceYoungGenTimeData : public CHeapObj<mtGC> {
private:
unsigned _young_pause_num;
unsigned _mixed_pause_num;
NumberSeq _all_stop_world_times_ms;
NumberSeq _all_yield_times_ms;
NumberSeq _total;
NumberSeq _other;
NumberSeq _root_region_scan_wait;
NumberSeq _parallel;
NumberSeq _ext_root_scan;
NumberSeq _satb_filtering;
NumberSeq _update_rs;
NumberSeq _scan_rs;
NumberSeq _obj_copy;
NumberSeq _termination;
NumberSeq _parallel_other;
NumberSeq _clear_ct;
void print_summary(const char* str, const NumberSeq* seq) const;
void print_summary_sd(const char* str, const NumberSeq* seq) const;
public:
TraceYoungGenTimeData() : _young_pause_num(0), _mixed_pause_num(0) {};
void record_start_collection(double time_to_stop_the_world_ms);
void record_yield_time(double yield_time_ms);
void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times);
void increment_young_collection_count();
void increment_mixed_collection_count();
void print() const;
};
class TraceOldGenTimeData : public CHeapObj<mtGC> {
private:
NumberSeq _all_full_gc_times;
public:
void record_full_collection(double full_gc_time_ms);
void print() const;
};
class G1CollectorPolicy: public CollectorPolicy {
private:
G1IHOPControl* _ihop_control;
@ -107,13 +61,6 @@ class G1CollectorPolicy: public CollectorPolicy {
double get_new_prediction(TruncatedSeq const* seq) const;
size_t get_new_size_prediction(TruncatedSeq const* seq) const;
// either equal to the number of parallel threads, if ParallelGCThreads
// has been set, or 1 otherwise
int _parallel_gc_threads;
// The number of GC threads currently active.
uintx _no_of_gc_threads;
G1MMUTracker* _mmu_tracker;
void initialize_alignments();
@ -134,11 +81,6 @@ class G1CollectorPolicy: public CollectorPolicy {
double _ratio_over_threshold_sum;
uint _pauses_since_start;
TraceYoungGenTimeData _trace_young_gen_time_data;
TraceOldGenTimeData _trace_old_gen_time_data;
double _stop_world_start;
uint _young_list_target_length;
uint _young_list_fixed_length;
@ -212,9 +154,6 @@ class G1CollectorPolicy: public CollectorPolicy {
double update_rs_processed_buffers,
double goal_ms);
uintx no_of_gc_threads() { return _no_of_gc_threads; }
void set_no_of_gc_threads(uintx v) { _no_of_gc_threads = v; }
double _pause_time_target_ms;
size_t _pending_cards;
@ -389,9 +328,6 @@ private:
// an evacuation pause.
size_t _inc_cset_bytes_used_before;
// Used to record the highest end of heap region in collection set
HeapWord* _inc_cset_max_finger;
// The RSet lengths recorded for regions in the CSet. It is updated
// by the thread that adds a new region to the CSet. We assume that
// only one thread can be allocating a new CSet region (currently,
@ -573,9 +509,6 @@ public:
virtual void print_phases();
void record_stop_world_start();
void record_concurrent_pause();
// Record how much space we copied during a GC. This is typically
// called when a GC alloc region is being retired.
void record_bytes_copied_during_gc(size_t bytes) {
@ -685,9 +618,6 @@ public:
// Clear ratio tracking data used by expansion_amount().
void clear_ratio_check_data();
// Print tracing information.
void print_tracing_info() const;
// Print stats on young survival ratio
void print_yg_surv_rate_info() const;

View File

@ -2662,9 +2662,6 @@ void G1ConcurrentMark::print_on_error(outputStream* st) const {
// We take a break if someone is trying to stop the world.
bool G1ConcurrentMark::do_yield_check(uint worker_id) {
if (SuspendibleThreadSet::should_yield()) {
if (worker_id == 0) {
_g1h->g1_policy()->record_concurrent_pause();
}
SuspendibleThreadSet::yield();
return true;
} else {

View File

@ -27,25 +27,12 @@
#include "gc/g1/g1OopClosures.hpp"
#include "gc/g1/heapRegionManager.hpp"
#include "gc/shared/preservedMarks.hpp"
#include "gc/shared/workgroup.hpp"
#include "utilities/globalDefinitions.hpp"
class G1CollectedHeap;
class OopAndMarkOop {
oop _o;
markOop _m;
public:
OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) {
}
void set_mark() {
_o->set_mark(_m);
}
};
typedef Stack<OopAndMarkOop,mtGC> OopAndMarkOopStack;
// Task to fixup self-forwarding pointers
// installed as a result of an evacuation failure.
class G1ParRemoveSelfForwardPtrsTask: public AbstractGangTask {

View File

@ -36,6 +36,7 @@
#include "gc/shared/genCollectedHeap.hpp"
#include "gc/shared/genOopClosures.inline.hpp"
#include "gc/shared/generationSpec.hpp"
#include "gc/shared/preservedMarks.inline.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/space.inline.hpp"
#include "gc/shared/spaceDecorator.hpp"
@ -184,6 +185,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
size_t initial_size,
const char* policy)
: Generation(rs, initial_size),
_preserved_marks_set(false /* in_c_heap */),
_promo_failure_drain_in_progress(false),
_should_allocate_from_space(false)
{
@ -602,6 +604,8 @@ void DefNewGeneration::collect(bool full,
age_table()->clear();
to()->clear(SpaceDecorator::Mangle);
// The preserved marks should be empty at the start of the GC.
_preserved_marks_set.init(1);
gch->rem_set()->prepare_for_younger_refs_iterate(false);
@ -704,6 +708,8 @@ void DefNewGeneration::collect(bool full,
// Reset the PromotionFailureALot counters.
NOT_PRODUCT(gch->reset_promotion_should_fail();)
}
// We should have processed and cleared all the preserved marks.
_preserved_marks_set.reclaim();
// set new iteration safe limit for the survivor spaces
from()->set_concurrent_iteration_safe_limit(from()->top());
to()->set_concurrent_iteration_safe_limit(to()->top());
@ -721,13 +727,6 @@ void DefNewGeneration::collect(bool full,
gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
}
class RemoveForwardPointerClosure: public ObjectClosure {
public:
void do_object(oop obj) {
obj->init_mark();
}
};
void DefNewGeneration::init_assuming_no_promotion_failure() {
_promotion_failed = false;
_promotion_failed_info.reset();
@ -735,33 +734,12 @@ void DefNewGeneration::init_assuming_no_promotion_failure() {
}
void DefNewGeneration::remove_forwarding_pointers() {
RemoveForwardPointerClosure rspc;
RemoveForwardedPointerClosure rspc;
eden()->object_iterate(&rspc);
from()->object_iterate(&rspc);
// Now restore saved marks, if any.
assert(_objs_with_preserved_marks.size() == _preserved_marks_of_objs.size(),
"should be the same");
while (!_objs_with_preserved_marks.is_empty()) {
oop obj = _objs_with_preserved_marks.pop();
markOop m = _preserved_marks_of_objs.pop();
obj->set_mark(m);
}
_objs_with_preserved_marks.clear(true);
_preserved_marks_of_objs.clear(true);
}
void DefNewGeneration::preserve_mark(oop obj, markOop m) {
assert(_promotion_failed && m->must_be_preserved_for_promotion_failure(obj),
"Oversaving!");
_objs_with_preserved_marks.push(obj);
_preserved_marks_of_objs.push(m);
}
void DefNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) {
if (m->must_be_preserved_for_promotion_failure(obj)) {
preserve_mark(obj, m);
}
_preserved_marks_set.restore();
}
void DefNewGeneration::handle_promotion_failure(oop old) {
@ -769,7 +747,7 @@ void DefNewGeneration::handle_promotion_failure(oop old) {
_promotion_failed = true;
_promotion_failed_info.register_copy_failure(old->size());
preserve_mark_if_necessary(old, old->mark());
_preserved_marks_set.get()->push_if_necessary(old, old->mark());
// forward to self
old->forward_to(old);

View File

@ -30,6 +30,7 @@
#include "gc/shared/copyFailedInfo.hpp"
#include "gc/shared/generation.hpp"
#include "gc/shared/generationCounters.hpp"
#include "gc/shared/preservedMarks.hpp"
#include "utilities/stack.hpp"
class ContiguousSpace;
@ -87,15 +88,8 @@ protected:
// therefore we must remove their forwarding pointers.
void remove_forwarding_pointers();
// Preserve the mark of "obj", if necessary, in preparation for its mark
// word being overwritten with a self-forwarding-pointer.
void preserve_mark_if_necessary(oop obj, markOop m);
void preserve_mark(oop obj, markOop m); // work routine used by the above
// Together, these keep <object with a preserved mark, mark value> pairs.
// They should always contain the same number of elements.
Stack<oop, mtGC> _objs_with_preserved_marks;
Stack<markOop, mtGC> _preserved_marks_of_objs;
// Preserved marks
PreservedMarksSet _preserved_marks_set;
// Promotion failure handling
ExtendedOopClosure *_promo_failure_scan_stack_closure;

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/shared/preservedMarks.inline.hpp"
#include "memory/allocation.inline.hpp"
#include "oops/oop.inline.hpp"
void PreservedMarks::restore() {
// First, iterate over the stack and restore all marks.
StackIterator<OopAndMarkOop, mtGC> iter(_stack);
while (!iter.is_empty()) {
OopAndMarkOop elem = iter.next();
elem.set_mark();
}
// Second, reclaim all the stack memory
_stack.clear(true /* clear_cache */);
}
void RemoveForwardedPointerClosure::do_object(oop obj) {
if (obj->is_forwarded()) {
obj->init_mark();
}
}
void PreservedMarksSet::init(uint num) {
assert(_stacks == NULL && _num == 0, "do not re-initialize");
assert(num > 0, "pre-condition");
if (_in_c_heap) {
_stacks = NEW_C_HEAP_ARRAY(Padded<PreservedMarks>, num, mtGC);
} else {
_stacks = NEW_RESOURCE_ARRAY(Padded<PreservedMarks>, num);
}
for (uint i = 0; i < num; i += 1) {
::new (_stacks + i) PreservedMarks();
}
_num = num;
assert_empty();
}
void PreservedMarksSet::restore() {
for (uint i = 0; i < _num; i += 1) {
get(i)->restore();
}
}
void PreservedMarksSet::reclaim() {
assert_empty();
for (uint i = 0; i < _num; i += 1) {
_stacks[i].~Padded<PreservedMarks>();
}
if (_in_c_heap) {
FREE_C_HEAP_ARRAY(Padded<PreservedMarks>, _stacks);
} else {
// the array was resource-allocated, so nothing to do
}
_stacks = NULL;
_num = 0;
}
#ifndef PRODUCT
void PreservedMarksSet::assert_empty() {
assert(_stacks != NULL && _num > 0, "should have been initialized");
for (uint i = 0; i < _num; i += 1) {
assert(get(i)->is_empty(), "stack should be empty");
}
}
#endif // ndef PRODUCT

View File

@ -0,0 +1,111 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_GC_SHARED_PRESERVEDMARKS_HPP
#define SHARE_VM_GC_SHARED_PRESERVEDMARKS_HPP
#include "memory/allocation.hpp"
#include "memory/padded.hpp"
#include "oops/oop.hpp"
#include "utilities/stack.hpp"
class OopAndMarkOop {
private:
oop _o;
markOop _m;
public:
OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) { }
void set_mark() const {
_o->set_mark(_m);
}
};
typedef Stack<OopAndMarkOop, mtGC> OopAndMarkOopStack;
class PreservedMarks VALUE_OBJ_CLASS_SPEC {
private:
OopAndMarkOopStack _stack;
inline bool should_preserve_mark(oop obj, markOop m) const;
inline void push(oop obj, markOop m);
public:
bool is_empty() const { return _stack.is_empty(); }
inline void push_if_necessary(oop obj, markOop m);
// Iterate over the stack, restore the preserved marks, then reclaim
// the memory taken up by stack chunks.
void restore();
~PreservedMarks() { assert(is_empty(), "should have been cleared"); }
};
class RemoveForwardedPointerClosure: public ObjectClosure {
public:
virtual void do_object(oop obj);
};
class PreservedMarksSet VALUE_OBJ_CLASS_SPEC {
private:
// true -> _stacks will be allocated in the C heap
// false -> _stacks will be allocated in the resource arena
const bool _in_c_heap;
// Number of stacks we have allocated (typically, one stack per GC worker).
// This should be >= 1 if the stacks have been initialized,
// or == 0 if they have not.
uint _num;
// Stack array (typically, one stack per GC worker) of length _num.
// This should be != NULL if the stacks have been initialized,
// or == NULL if they have not.
Padded<PreservedMarks>* _stacks;
public:
// Return the i'th stack.
PreservedMarks* get(uint i = 0) const {
assert(_num > 0 && _stacks != NULL, "stacks should have been initialized");
assert(i < _num, "pre-condition");
return (_stacks + i);
}
// Allocate stack array.
void init(uint num);
// Iterate over all stacks, restore all preserved marks, then
// reclaim the memory taken up by stack chunks.
void restore();
// Reclaim stack array.
void reclaim();
// Assert all the stacks are empty.
void assert_empty() PRODUCT_RETURN;
PreservedMarksSet(bool in_c_heap)
: _in_c_heap(in_c_heap), _num(0), _stacks(NULL) { }
~PreservedMarksSet() {
assert(_stacks == NULL && _num == 0, "stacks should have been reclaimed");
}
};
#endif // SHARE_VM_GC_SHARED_PRESERVEDMARKS_HPP

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "gc/shared/preservedMarks.hpp"
#include "oops/markOop.inline.hpp"
#include "utilities/stack.inline.hpp"
#ifndef SHARE_VM_GC_SHARED_PRESERVEDMARKS_INLINE_HPP
#define SHARE_VM_GC_SHARED_PRESERVEDMARKS_INLINE_HPP
inline bool PreservedMarks::should_preserve_mark(oop obj, markOop m) const {
return m->must_be_preserved_for_promotion_failure(obj);
}
inline void PreservedMarks::push(oop obj, markOop m) {
assert(should_preserve_mark(obj, m), "pre-condition");
OopAndMarkOop elem(obj, m);
_stack.push(elem);
}
inline void PreservedMarks::push_if_necessary(oop obj, markOop m) {
if (should_preserve_mark(obj, m)) {
push(obj, m);
}
}
#endif // SHARE_VM_GC_SHARED_PRESERVEDMARKS_INLINE_HPP

View File

@ -339,7 +339,7 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list,
// all linked Reference objects. Note that it is important to not dirty any
// cards during reference processing since this will cause card table
// verification to fail for G1.
log_develop_trace(gc, ref)("ReferenceProcessor::enqueue_discovered_reflist list " INTPTR_FORMAT, p2i(refs_list.head()));
log_develop_trace(gc, ref)("ReferenceProcessor::enqueue_discovered_reflist list " INTPTR_FORMAT, p2i(&refs_list));
oop obj = NULL;
oop next_d = refs_list.head();
@ -502,7 +502,7 @@ ReferenceProcessor::process_phase1(DiscoveredList& refs_list,
// Close the reachable set
complete_gc->do_void();
log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " dead Refs out of " SIZE_FORMAT " discovered Refs by policy, from list " INTPTR_FORMAT,
iter.removed(), iter.processed(), p2i(refs_list.head()));
iter.removed(), iter.processed(), p2i(&refs_list));
}
// Traverse the list and remove any Refs that are not active, or
@ -536,7 +536,7 @@ ReferenceProcessor::pp2_work(DiscoveredList& refs_list,
if (iter.processed() > 0) {
log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT
" Refs in discovered list " INTPTR_FORMAT,
iter.removed(), iter.processed(), p2i(refs_list.head()));
iter.removed(), iter.processed(), p2i(&refs_list));
}
)
}
@ -575,7 +575,7 @@ ReferenceProcessor::pp2_work_concurrent_discovery(DiscoveredList& refs_list,
if (iter.processed() > 0) {
log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT
" Refs in discovered list " INTPTR_FORMAT,
iter.removed(), iter.processed(), p2i(refs_list.head()));
iter.removed(), iter.processed(), p2i(&refs_list));
}
)
}
@ -1198,7 +1198,7 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list,
NOT_PRODUCT(
if (iter.processed() > 0) {
log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " Refs out of " SIZE_FORMAT " Refs in discovered list " INTPTR_FORMAT,
iter.removed(), iter.processed(), p2i(refs_list.head()));
iter.removed(), iter.processed(), p2i(&refs_list));
}
)
}

View File

@ -29,6 +29,7 @@
#include "runtime/globals.hpp"
#include "runtime/thread.hpp"
#include "gc/shared/gcId.hpp"
#include "logging/log.hpp"
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"
@ -151,6 +152,7 @@ class AbstractWorkGang : public CHeapObj<mtInternal> {
_active_workers = MAX2(1U, _active_workers);
assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
"Unless dynamic should use total workers");
log_info(gc, task)("GC Workers: %d", _active_workers);
}
// Return the Ith worker.

View File

@ -27,6 +27,7 @@
#include "interpreter/cppInterpreterGenerator.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "runtime/logTimer.hpp"
#ifdef CC_INTERP
@ -42,7 +43,7 @@ void CppInterpreter::initialize() {
// generate interpreter
{ ResourceMark rm;
TraceTime timer("Interpreter generation", TraceStartupTime);
TraceStartupTime timer("Interpreter generation");
int code_size = InterpreterCodeSize;
NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
_code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,

View File

@ -31,6 +31,7 @@
#include "interpreter/templateInterpreterGenerator.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/logTimer.hpp"
#ifndef CC_INTERP
@ -48,7 +49,7 @@ void TemplateInterpreter::initialize() {
// generate interpreter
{ ResourceMark rm;
TraceTime timer("Interpreter generation", TraceStartupTime);
TraceStartupTime timer("Interpreter generation");
int code_size = InterpreterCodeSize;
NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
#if INCLUDE_JVMTI

View File

@ -26,8 +26,7 @@
#include "gc/shared/collectedHeap.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "runtime/timer.hpp"
#include "runtime/logTimer.hpp"
#ifdef CC_INTERP
@ -246,7 +245,7 @@ void TemplateTable::initialize() {
if (_is_initialized) return;
// Initialize table
TraceTime timer("TemplateTable initialization", TraceStartupTime);
TraceStartupTime timer("TemplateTable initialization");
_bs = Universe::heap()->barrier_set();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,8 +82,7 @@ void LogConfiguration::post_initialize() {
void LogConfiguration::initialize(jlong vm_start_time) {
LogFileOutput::set_file_name_parameters(vm_start_time);
LogDecorations::set_vm_start_time_millis(vm_start_time);
LogDecorations::initialize(vm_start_time);
assert(_outputs == NULL, "Should not initialize _outputs before this function, initialize called twice?");
_outputs = NEW_C_HEAP_ARRAY(LogOutput*, 2, mtLogging);
_outputs[0] = LogOutput::Stdout;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,12 +29,21 @@
#include "services/management.hpp"
jlong LogDecorations::_vm_start_time_millis = 0;
const char* LogDecorations::_host_name = "";
LogDecorations::LogDecorations(LogLevelType level, const LogTagSet &tagset, const LogDecorators &decorators)
: _level(level), _tagset(tagset), _millis(-1) {
create_decorations(decorators);
}
void LogDecorations::initialize(jlong vm_start_time) {
char buffer[1024];
if (os::get_host_name(buffer, sizeof(buffer))){
_host_name = os::strdup_check_oom(buffer);
}
_vm_start_time_millis = vm_start_time;
}
void LogDecorations::create_decorations(const LogDecorators &decorators) {
char* position = _decorations_buffer;
#define DECORATOR(full_name, abbr) \
@ -109,3 +118,9 @@ char* LogDecorations::create_tags_decoration(char* pos) {
int written = _tagset.label(pos, DecorationsBufferSize - (pos - _decorations_buffer));
ASSERT_AND_RETURN(written, pos)
}
char* LogDecorations::create_hostname_decoration(char* pos) {
int written = jio_snprintf(pos, DecorationsBufferSize - (pos - _decorations_buffer), "%s", _host_name);
ASSERT_AND_RETURN(written, pos)
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,6 +39,7 @@ class LogDecorations VALUE_OBJ_CLASS_SPEC {
LogTagSet _tagset;
jlong _millis;
static jlong _vm_start_time_millis;
static const char* _host_name;
jlong java_millis();
void create_decorations(const LogDecorators& decorators);
@ -48,15 +49,13 @@ class LogDecorations VALUE_OBJ_CLASS_SPEC {
#undef DECORATOR
public:
static void initialize(jlong vm_start_time);
LogDecorations(LogLevelType level, const LogTagSet& tagset, const LogDecorators& decorators);
const char* decoration(LogDecorators::Decorator decorator) const {
return _decoration_offset[decorator];
}
static void set_vm_start_time_millis(jlong start_time) {
_vm_start_time_millis = start_time;
}
};
#endif // SHARE_VM_LOGGING_LOGDECORATIONS_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@
// uptimemillis - Milliseconds since the JVM started
// timenanos - The same value as generated by System.nanoTime()
// uptimenanos - Nanoseconds since the JVM started
// hostname - The hostname
// pid - The process identifier
// tid - The thread identifier
// level - The level associated with the log message
@ -45,6 +46,7 @@
DECORATOR(uptimemillis, um) \
DECORATOR(timenanos, tn) \
DECORATOR(uptimenanos, un) \
DECORATOR(hostname, hn) \
DECORATOR(pid, p) \
DECORATOR(tid, ti) \
DECORATOR(level, l) \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@
LOG_TAG(alloc) \
LOG_TAG(age) \
LOG_TAG(barrier) \
LOG_TAG(biasedlocking) \
LOG_TAG(bot) \
LOG_TAG(census) \
LOG_TAG(classhisto) \
@ -73,6 +74,7 @@
LOG_TAG(scavenge) \
LOG_TAG(scrub) \
LOG_TAG(start) \
LOG_TAG(startuptime) \
LOG_TAG(state) \
LOG_TAG(stats) \
LOG_TAG(stringdedup) \

View File

@ -791,7 +791,6 @@ Mutex* const SpaceManager::_expand_lock =
void VirtualSpaceNode::inc_container_count() {
assert_lock_strong(SpaceManager::expand_lock());
_container_count++;
DEBUG_ONLY(verify_container_count();)
}
void VirtualSpaceNode::dec_container_count() {
@ -1073,6 +1072,7 @@ void VirtualSpaceList::purge(ChunkManager* chunk_manager) {
VirtualSpaceNode* next_vsl = prev_vsl;
while (next_vsl != NULL) {
VirtualSpaceNode* vsl = next_vsl;
DEBUG_ONLY(vsl->verify_container_count();)
next_vsl = vsl->next();
// Don't free the current virtual space since it will likely
// be needed soon.
@ -1137,19 +1137,19 @@ void VirtualSpaceList::retire_current_virtual_space() {
}
void VirtualSpaceNode::retire(ChunkManager* chunk_manager) {
DEBUG_ONLY(verify_container_count();)
for (int i = (int)MediumIndex; i >= (int)ZeroIndex; --i) {
ChunkIndex index = (ChunkIndex)i;
size_t chunk_size = chunk_manager->free_chunks(index)->size();
while (free_words_in_vs() >= chunk_size) {
DEBUG_ONLY(verify_container_count();)
Metachunk* chunk = get_chunk_vs(chunk_size);
assert(chunk != NULL, "allocation should have been successful");
chunk_manager->return_chunks(index, chunk);
chunk_manager->inc_free_chunks_total(chunk_size);
DEBUG_ONLY(verify_container_count();)
}
DEBUG_ONLY(verify_container_count();)
}
assert(free_words_in_vs() == 0, "should be empty now");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@
#include "memory/metaspaceShared.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/os.hpp"
#include "runtime/signature.hpp"
#include "runtime/vmThread.hpp"
@ -771,88 +772,89 @@ void MetaspaceShared::prepare_for_dumping() {
// Preload classes from a list, populate the shared spaces and dump to a
// file.
void MetaspaceShared::preload_and_dump(TRAPS) {
TraceTime timer("Dump Shared Spaces", TraceStartupTime);
ResourceMark rm;
char class_list_path_str[JVM_MAXPATHLEN];
{ TraceStartupTime timer("Dump Shared Spaces");
ResourceMark rm;
char class_list_path_str[JVM_MAXPATHLEN];
tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
MetaspaceShared::shared_rs()->size(),
p2i(MetaspaceShared::shared_rs()->base()));
tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
MetaspaceShared::shared_rs()->size(),
p2i(MetaspaceShared::shared_rs()->base()));
// Preload classes to be shared.
// Should use some os:: method rather than fopen() here. aB.
const char* class_list_path;
if (SharedClassListFile == NULL) {
// Construct the path to the class list (in jre/lib)
// Walk up two directories from the location of the VM and
// optionally tack on "lib" (depending on platform)
os::jvm_path(class_list_path_str, sizeof(class_list_path_str));
for (int i = 0; i < 3; i++) {
char *end = strrchr(class_list_path_str, *os::file_separator());
if (end != NULL) *end = '\0';
}
int class_list_path_len = (int)strlen(class_list_path_str);
if (class_list_path_len >= 3) {
if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
if (class_list_path_len < JVM_MAXPATHLEN - 4) {
jio_snprintf(class_list_path_str + class_list_path_len,
sizeof(class_list_path_str) - class_list_path_len,
"%slib", os::file_separator());
class_list_path_len += 4;
// Preload classes to be shared.
// Should use some os:: method rather than fopen() here. aB.
const char* class_list_path;
if (SharedClassListFile == NULL) {
// Construct the path to the class list (in jre/lib)
// Walk up two directories from the location of the VM and
// optionally tack on "lib" (depending on platform)
os::jvm_path(class_list_path_str, sizeof(class_list_path_str));
for (int i = 0; i < 3; i++) {
char *end = strrchr(class_list_path_str, *os::file_separator());
if (end != NULL) *end = '\0';
}
int class_list_path_len = (int)strlen(class_list_path_str);
if (class_list_path_len >= 3) {
if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
if (class_list_path_len < JVM_MAXPATHLEN - 4) {
jio_snprintf(class_list_path_str + class_list_path_len,
sizeof(class_list_path_str) - class_list_path_len,
"%slib", os::file_separator());
class_list_path_len += 4;
}
}
}
if (class_list_path_len < JVM_MAXPATHLEN - 10) {
jio_snprintf(class_list_path_str + class_list_path_len,
sizeof(class_list_path_str) - class_list_path_len,
"%sclasslist", os::file_separator());
}
class_list_path = class_list_path_str;
} else {
class_list_path = SharedClassListFile;
}
if (class_list_path_len < JVM_MAXPATHLEN - 10) {
jio_snprintf(class_list_path_str + class_list_path_len,
sizeof(class_list_path_str) - class_list_path_len,
"%sclasslist", os::file_separator());
}
class_list_path = class_list_path_str;
} else {
class_list_path = SharedClassListFile;
}
int class_count = 0;
GrowableArray<Klass*>* class_promote_order = new GrowableArray<Klass*>();
int class_count = 0;
GrowableArray<Klass*>* class_promote_order = new GrowableArray<Klass*>();
// sun.io.Converters
static const char obj_array_sig[] = "[[Ljava/lang/Object;";
SymbolTable::new_permanent_symbol(obj_array_sig, THREAD);
// sun.io.Converters
static const char obj_array_sig[] = "[[Ljava/lang/Object;";
SymbolTable::new_permanent_symbol(obj_array_sig, THREAD);
// java.util.HashMap
static const char map_entry_array_sig[] = "[Ljava/util/Map$Entry;";
SymbolTable::new_permanent_symbol(map_entry_array_sig, THREAD);
// java.util.HashMap
static const char map_entry_array_sig[] = "[Ljava/util/Map$Entry;";
SymbolTable::new_permanent_symbol(map_entry_array_sig, THREAD);
// Need to allocate the op here:
// op.misc_data_space_alloc() will be called during preload_and_dump().
ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
VM_PopulateDumpSharedSpace op(loader_data, class_promote_order);
// Need to allocate the op here:
// op.misc_data_space_alloc() will be called during preload_and_dump().
ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
VM_PopulateDumpSharedSpace op(loader_data, class_promote_order);
tty->print_cr("Loading classes to share ...");
_has_error_classes = false;
class_count += preload_and_dump(class_list_path, class_promote_order,
THREAD);
if (ExtraSharedClassListFile) {
class_count += preload_and_dump(ExtraSharedClassListFile, class_promote_order,
tty->print_cr("Loading classes to share ...");
_has_error_classes = false;
class_count += preload_and_dump(class_list_path, class_promote_order,
THREAD);
if (ExtraSharedClassListFile) {
class_count += preload_and_dump(ExtraSharedClassListFile, class_promote_order,
THREAD);
}
tty->print_cr("Loading classes to share: done.");
if (PrintSharedSpaces) {
tty->print_cr("Shared spaces: preloaded %d classes", class_count);
}
// Rewrite and link classes
tty->print_cr("Rewriting and linking classes ...");
// Link any classes which got missed. This would happen if we have loaded classes that
// were not explicitly specified in the classlist. E.g., if an interface implemented by class K
// fails verification, all other interfaces that were not specified in the classlist but
// are implemented by K are not verified.
link_and_cleanup_shared_classes(CATCH);
tty->print_cr("Rewriting and linking classes: done");
VMThread::execute(&op);
}
tty->print_cr("Loading classes to share: done.");
if (PrintSharedSpaces) {
tty->print_cr("Shared spaces: preloaded %d classes", class_count);
}
// Rewrite and link classes
tty->print_cr("Rewriting and linking classes ...");
// Link any classes which got missed. This would happen if we have loaded classes that
// were not explicitly specified in the classlist. E.g., if an interface implemented by class K
// fails verification, all other interfaces that were not specified in the classlist but
// are implemented by K are not verified.
link_and_cleanup_shared_classes(CATCH);
tty->print_cr("Rewriting and linking classes: done");
VMThread::execute(&op);
// Since various initialization steps have been undone by this process,
// it is not reasonable to continue running a java process.
exit(0);

View File

@ -64,6 +64,7 @@
#include "runtime/init.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/synchronizer.hpp"
#include "runtime/thread.inline.hpp"
@ -626,7 +627,9 @@ jint universe_init() {
guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
"oop size is not not a multiple of HeapWord size");
TraceTime timer("Genesis", TraceStartupTime);
TraceStartupTime timer("Genesis");
JavaClasses::compute_hard_coded_offsets();
jint status = Universe::initialize_heap();

View File

@ -930,13 +930,7 @@ class JNI_ArgumentPusherVaArg : public JNI_ArgumentPusher {
_arguments->push_oop(Handle((oop *)l, false)); }
inline void set_ap(va_list rap) {
#ifdef va_copy
va_copy(_ap, rap);
#elif defined (__va_copy)
__va_copy(_ap, rap);
#else
_ap = rap;
#endif
}
public:

View File

@ -2200,6 +2200,16 @@ extern "C" {
}
jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
// get agent name and options
const char* agent = op->arg(0);
const char* absParam = op->arg(1);
const char* options = op->arg(2);
return load_agent_library(agent, absParam, options, st);
}
jint JvmtiExport::load_agent_library(const char *agent, const char *absParam,
const char *options, outputStream* st) {
char ebuf[1024];
char buffer[JVM_MAXPATHLEN];
void* library = NULL;
@ -2207,11 +2217,6 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS;
size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols);
// get agent name and options
const char* agent = op->arg(0);
const char* absParam = op->arg(1);
const char* options = op->arg(2);
// The abs paramter should be "true" or "false"
bool is_absolute_path = (absParam != NULL) && (strcmp(absParam,"true")==0);

View File

@ -372,6 +372,7 @@ class JvmtiExport : public AllStatic {
static void transition_pending_onload_raw_monitors() NOT_JVMTI_RETURN;
// attach support
static jint load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
static jint load_agent_library(AttachOperation* op, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
// SetNativeMethodPrefix support

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "runtime/compilationPolicy.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/reflection.hpp"
#include "runtime/signature.hpp"
#include "runtime/stubRoutines.hpp"
@ -72,7 +73,7 @@ void MethodHandles::generate_adapters() {
assert(_adapter_code == NULL, "generate only once");
ResourceMark rm;
TraceTime timer("MethodHandles adapters generation", TraceStartupTime);
TraceStartupTime timer("MethodHandles adapters generation");
_adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size);
CodeBuffer code(_adapter_code);
MethodHandlesAdapterGenerator g(&code);

View File

@ -409,6 +409,7 @@ static AliasedLoggingFlag const aliased_logging_flags[] = {
{ "TraceClassResolution", LogLevel::Info, true, LogTag::_classresolve },
{ "TraceExceptions", LogLevel::Info, true, LogTag::_exceptions },
{ "TraceMonitorInflation", LogLevel::Debug, true, LogTag::_monitorinflation },
{ "TraceBiasedLocking", LogLevel::Info, true, LogTag::_biasedlocking },
{ NULL, LogLevel::Off, false, LogTag::__NO_TAG }
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,8 @@
*/
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "oops/klass.inline.hpp"
#include "oops/markOop.hpp"
#include "oops/oop.inline.hpp"
@ -60,9 +62,7 @@ class VM_EnableBiasedLocking: public VM_Operation {
// Indicate that future instances should enable it as well
_biased_locking_enabled = true;
if (TraceBiasedLocking) {
tty->print_cr("Biased locking enabled");
}
log_info(biasedlocking)("Biased locking enabled");
}
bool allow_nested_vm_operations() const { return false; }
@ -144,14 +144,14 @@ static GrowableArray<MonitorInfo*>* get_or_compute_monitor_info(JavaThread* thre
return info;
}
static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_bulk, JavaThread* requesting_thread) {
markOop mark = obj->mark();
if (!mark->has_bias_pattern()) {
if (TraceBiasedLocking) {
if (log_is_enabled(Info, biasedlocking)) {
ResourceMark rm;
tty->print_cr(" (Skipping revocation of object of type %s because it's no longer biased)",
obj->klass()->external_name());
log_info(biasedlocking)(" (Skipping revocation of object of type %s "
"because it's no longer biased)",
obj->klass()->external_name());
}
return BiasedLocking::NOT_BIASED;
}
@ -160,10 +160,29 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
markOop biased_prototype = markOopDesc::biased_locking_prototype()->set_age(age);
markOop unbiased_prototype = markOopDesc::prototype()->set_age(age);
if (TraceBiasedLocking && (Verbose || !is_bulk)) {
// Log at "info" level if not bulk, else "trace" level
if (!is_bulk) {
ResourceMark rm;
tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
p2i((void *)obj), (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
log_info(biasedlocking)("Revoking bias of object " INTPTR_FORMAT " , mark "
INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT
" , allow rebias %d , requesting thread " INTPTR_FORMAT,
p2i((void *)obj),
(intptr_t) mark,
obj->klass()->external_name(),
(intptr_t) obj->klass()->prototype_header(),
(allow_rebias ? 1 : 0),
(intptr_t) requesting_thread);
} else {
ResourceMark rm;
log_trace(biasedlocking)("Revoking bias of object " INTPTR_FORMAT " , mark "
INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT
" , allow rebias %d , requesting thread " INTPTR_FORMAT,
p2i((void *)obj),
(intptr_t) mark,
obj->klass()->external_name(),
(intptr_t) obj->klass()->prototype_header(),
(allow_rebias ? 1 : 0),
(intptr_t) requesting_thread);
}
JavaThread* biased_thread = mark->biased_locker();
@ -174,8 +193,11 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
if (!allow_rebias) {
obj->set_mark(unbiased_prototype);
}
if (TraceBiasedLocking && (Verbose || !is_bulk)) {
tty->print_cr(" Revoked bias of anonymously-biased object");
// Log at "info" level if not bulk, else "trace" level
if (!is_bulk) {
log_info(biasedlocking)(" Revoked bias of anonymously-biased object");
} else {
log_trace(biasedlocking)(" Revoked bias of anonymously-biased object");
}
return BiasedLocking::BIAS_REVOKED;
}
@ -198,8 +220,11 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
} else {
obj->set_mark(unbiased_prototype);
}
if (TraceBiasedLocking && (Verbose || !is_bulk)) {
tty->print_cr(" Revoked bias of object biased toward dead thread");
// Log at "info" level if not bulk, else "trace" level
if (!is_bulk) {
log_info(biasedlocking)(" Revoked bias of object biased toward dead thread");
} else {
log_trace(biasedlocking)(" Revoked bias of object biased toward dead thread");
}
return BiasedLocking::BIAS_REVOKED;
}
@ -214,21 +239,17 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i);
if (mon_info->owner() == obj) {
if (TraceBiasedLocking && Verbose) {
tty->print_cr(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
p2i((void *) mon_info->owner()),
p2i((void *) obj));
}
log_trace(biasedlocking)(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
p2i((void *) mon_info->owner()),
p2i((void *) obj));
// Assume recursive case and fix up highest lock later
markOop mark = markOopDesc::encode((BasicLock*) NULL);
highest_lock = mon_info->lock();
highest_lock->set_displaced_header(mark);
} else {
if (TraceBiasedLocking && Verbose) {
tty->print_cr(" mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
p2i((void *) mon_info->owner()),
p2i((void *) obj));
}
log_trace(biasedlocking)(" mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
p2i((void *) mon_info->owner()),
p2i((void *) obj));
}
}
if (highest_lock != NULL) {
@ -240,12 +261,18 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
// ordering (e.g. ppc).
obj->release_set_mark(markOopDesc::encode(highest_lock));
assert(!obj->mark()->has_bias_pattern(), "illegal mark state: stack lock used bias bit");
if (TraceBiasedLocking && (Verbose || !is_bulk)) {
tty->print_cr(" Revoked bias of currently-locked object");
// Log at "info" level if not bulk, else "trace" level
if (!is_bulk) {
log_info(biasedlocking)(" Revoked bias of currently-locked object");
} else {
log_trace(biasedlocking)(" Revoked bias of currently-locked object");
}
} else {
if (TraceBiasedLocking && (Verbose || !is_bulk)) {
tty->print_cr(" Revoked bias of currently-unlocked object");
// Log at "info" level if not bulk, else "trace" level
if (!is_bulk) {
log_info(biasedlocking)(" Revoked bias of currently-unlocked object");
} else {
log_trace(biasedlocking)(" Revoked bias of currently-unlocked object");
}
if (allow_rebias) {
obj->set_mark(biased_prototype);
@ -326,12 +353,12 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
JavaThread* requesting_thread) {
assert(SafepointSynchronize::is_at_safepoint(), "must be done at safepoint");
if (TraceBiasedLocking) {
tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
(bulk_rebias ? "rebias" : "revoke"),
p2i((void *) o), (intptr_t) o->mark(), o->klass()->external_name());
}
log_info(biasedlocking)("* Beginning bulk revocation (kind == %s) because of object "
INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
(bulk_rebias ? "rebias" : "revoke"),
p2i((void *) o),
(intptr_t) o->mark(),
o->klass()->external_name());
jlong cur_time = os::javaTimeMillis();
o->klass()->set_last_biased_lock_bulk_revocation_time(cur_time);
@ -377,9 +404,9 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
// adjust the header of the given object to revoke its bias.
revoke_bias(o, attempt_rebias_of_object && klass->prototype_header()->has_bias_pattern(), true, requesting_thread);
} else {
if (TraceBiasedLocking) {
if (log_is_enabled(Info, biasedlocking)) {
ResourceMark rm;
tty->print_cr("* Disabling biased locking for type %s", klass->external_name());
log_info(biasedlocking)("* Disabling biased locking for type %s", klass->external_name());
}
// Disable biased locking for this data type. Not only will this
@ -407,9 +434,7 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
revoke_bias(o, false, true, requesting_thread);
}
if (TraceBiasedLocking) {
tty->print_cr("* Ending bulk revocation");
}
log_info(biasedlocking)("* Ending bulk revocation");
BiasedLocking::Condition status_code = BiasedLocking::BIAS_REVOKED;
@ -420,9 +445,7 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
klass->prototype_header()->bias_epoch());
o->set_mark(new_mark);
status_code = BiasedLocking::BIAS_REVOKED_AND_REBIASED;
if (TraceBiasedLocking) {
tty->print_cr(" Rebiased object toward thread " INTPTR_FORMAT, (intptr_t) requesting_thread);
}
log_info(biasedlocking)(" Rebiased object toward thread " INTPTR_FORMAT, (intptr_t) requesting_thread);
}
assert(!o->mark()->has_bias_pattern() ||
@ -485,16 +508,12 @@ public:
virtual void doit() {
if (_obj != NULL) {
if (TraceBiasedLocking) {
tty->print_cr("Revoking bias with potentially per-thread safepoint:");
}
log_info(biasedlocking)("Revoking bias with potentially per-thread safepoint:");
_status_code = revoke_bias((*_obj)(), false, false, _requesting_thread);
clean_up_cached_monitor_info();
return;
} else {
if (TraceBiasedLocking) {
tty->print_cr("Revoking bias with global safepoint:");
}
log_info(biasedlocking)("Revoking bias with global safepoint:");
BiasedLocking::revoke_at_safepoint(_objs);
}
}
@ -608,9 +627,7 @@ BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attem
// can come in with a CAS to steal the bias of an object that has a
// stale epoch.
ResourceMark rm;
if (TraceBiasedLocking) {
tty->print_cr("Revoking bias by walking my own stack:");
}
log_info(biasedlocking)("Revoking bias by walking my own stack:");
BiasedLocking::Condition cond = revoke_bias(obj(), false, false, (JavaThread*) THREAD);
((JavaThread*) THREAD)->set_cached_monitor_info(NULL);
assert(cond == BIAS_REVOKED, "why not?");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -403,25 +403,20 @@ void Flag::print_on(outputStream* st, bool withComments, bool printRanges) {
st->cr();
} else if (!is_bool() && !is_ccstr()) {
st->print("%9s %-50s ", _type, _name);
if (printRanges) {
CommandLineFlagRangeList::print(_name, st, true);
st->print("%9s %-50s ", _type, _name);
CommandLineFlagRangeList::print(_name, st, true);
st->print(" %-20s", " ");
print_kind(st);
st->print(" %-20s", " ");
print_kind(st);
#ifndef PRODUCT
if (withComments) {
st->print("%s", _doc);
}
if (withComments) {
st->print("%s", _doc);
}
#endif
st->cr();
}
st->cr();
}
}
@ -1255,8 +1250,6 @@ void CommandLineFlags::verify() {
#endif // PRODUCT
#define ONLY_PRINT_PRODUCT_FLAGS
void CommandLineFlags::printFlags(outputStream* out, bool withComments, bool printRanges) {
// Print the flags sorted by name
// note: this method is called before the thread structure is in place
@ -1281,9 +1274,6 @@ void CommandLineFlags::printFlags(outputStream* out, bool withComments, bool pri
for (size_t i = 0; i < length; i++) {
if (array[i]->is_unlocked()) {
#ifdef ONLY_PRINT_PRODUCT_FLAGS
if (!array[i]->is_notproduct() && !array[i]->is_develop())
#endif // ONLY_PRINT_PRODUCT_FLAGS
array[i]->print_on(out, withComments, printRanges);
}
}

View File

@ -1482,18 +1482,12 @@ public:
develop(bool, TraceCompiledIC, false, \
"Trace changes of compiled IC") \
\
develop(bool, TraceStartupTime, false, \
"Trace setup time") \
\
develop(bool, TraceProtectionDomainVerification, false, \
"Trace protection domain verification") \
\
develop(bool, TraceClearedExceptions, false, \
"Print when an exception is forcibly cleared") \
\
product(bool, TraceBiasedLocking, false, \
"Trace biased locking in JVM") \
\
/* gc */ \
\
product(bool, UseSerialGC, false, \

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_RUNTIME_LOG_TIMER_HPP
#define SHARE_VM_RUNTIME_LOG_TIMER_HPP
#include "logging/log.hpp"
#include "runtime/timer.hpp"
// TraceStartupTime is used for tracing the execution time of a block with logging
// Usage:
// { TraceStartupTime t("block time")
// some_code();
// }
//
class TraceStartupTime : public TraceTime {
public:
TraceStartupTime(const char* s) : TraceTime(s, log_is_enabled(Info, startuptime), LogTag::_startuptime) {}
};
#endif // SHARE_VM_RUNTIME_LOG_TIMER_HPP

View File

@ -152,7 +152,6 @@ class os: AllStatic {
static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned);
// Get summary strings for system information in buffer provided
static bool get_host_name(char* buf, size_t buflen) PRODUCT_RETURN_(return false;); // true if available
static void get_summary_cpu_info(char* buf, size_t buflen);
static void get_summary_os_info(char* buf, size_t buflen);
@ -595,6 +594,9 @@ class os: AllStatic {
// Write to stream
static int log_vsnprintf(char* buf, size_t len, const char* fmt, va_list args) ATTRIBUTE_PRINTF(3, 0);
// Get host name in buffer provided
static bool get_host_name(char* buf, size_t buflen);
// Print out system information; they are called by fatal error handler.
// Output format may be different on different platforms.
static void print_os_info(outputStream* st);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,9 +28,9 @@
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/timer.hpp"
#include "utilities/copy.hpp"
#ifdef COMPILER2
#include "opto/runtime.hpp"
@ -183,7 +183,7 @@ extern void StubGenerator_generate(CodeBuffer* code, bool all); // only interfac
void StubRoutines::initialize1() {
if (_code1 == NULL) {
ResourceMark rm;
TraceTime timer("StubRoutines generation 1", TraceStartupTime);
TraceStartupTime timer("StubRoutines generation 1");
_code1 = BufferBlob::create("StubRoutines (1)", code_size1);
if (_code1 == NULL) {
vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)");
@ -276,7 +276,7 @@ static void test_safefetchN() {
void StubRoutines::initialize2() {
if (_code2 == NULL) {
ResourceMark rm;
TraceTime timer("StubRoutines generation 2", TraceStartupTime);
TraceStartupTime timer("StubRoutines generation 2");
_code2 = BufferBlob::create("StubRoutines (2)", code_size2);
if (_code2 == NULL) {
vm_exit_out_of_memory(code_size2, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (2)");

View File

@ -67,6 +67,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniPeriodicChecker.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/memprofiler.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
@ -169,11 +170,10 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
"JavaThread alignment code overflowed allocated storage");
if (TraceBiasedLocking) {
if (aligned_addr != real_malloc_addr) {
tty->print_cr("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT,
p2i(real_malloc_addr), p2i(aligned_addr));
}
if (aligned_addr != real_malloc_addr) {
log_info(biasedlocking)("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT,
p2i(real_malloc_addr),
p2i(aligned_addr));
}
((Thread*) aligned_addr)->_real_malloc_address = real_malloc_addr;
return aligned_addr;
@ -3341,7 +3341,7 @@ void Threads::threads_do(ThreadClosure* tc) {
}
void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
TraceTime timer("Initialize java.lang classes", TraceStartupTime);
TraceStartupTime timer("Initialize java.lang classes");
if (EagerXrunInit && Arguments::init_libraries_at_startup()) {
create_vm_init_libraries();
@ -3388,6 +3388,8 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
}
void Threads::initialize_jsr292_core_classes(TRAPS) {
TraceStartupTime timer("Initialize java.lang.invoke classes");
initialize_class(vmSymbols::java_lang_invoke_MethodHandle(), CHECK);
initialize_class(vmSymbols::java_lang_invoke_MemberName(), CHECK);
initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK);
@ -3457,7 +3459,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
HOTSPOT_VM_INIT_BEGIN();
// Timing (must come after argument parsing)
TraceTime timer("Create VM", TraceStartupTime);
TraceStartupTime timer("Create VM");
// Initialize the os module after parsing the args
jint os_init_2_result = os::init_2();
@ -3542,8 +3544,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
JvmtiExport::transition_pending_onload_raw_monitors();
// Create the VMThread
{ TraceTime timer("Start VMThread", TraceStartupTime);
VMThread::create();
{ TraceStartupTime timer("Start VMThread");
VMThread::create();
Thread* vmthread = VMThread::vm_thread();
if (!os::create_thread(vmthread, os::vm_thread)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/timer.hpp"
#include "utilities/ostream.hpp"
@ -114,14 +115,15 @@ jlong TimeStamp::ticks_since_update() const {
}
TraceTime::TraceTime(const char* title,
bool doit) {
bool doit,
LogTagType tag) {
_active = doit;
_verbose = true;
_tag = tag;
_title = title;
if (_active) {
_accum = NULL;
tty->print("[%s", title);
tty->flush();
_t.start();
}
}
@ -129,14 +131,14 @@ TraceTime::TraceTime(const char* title,
TraceTime::TraceTime(const char* title,
elapsedTimer* accumulator,
bool doit,
bool verbose) {
_active = doit;
_verbose = verbose;
bool verbose,
LogTagType tag) {
_active = doit;
_verbose = verbose;
_tag = tag;
_title = title;
if (_active) {
if (_verbose) {
tty->print("[%s", title);
tty->flush();
}
_accum = accumulator;
_t.start();
}
@ -147,8 +149,15 @@ TraceTime::~TraceTime() {
_t.stop();
if (_accum!=NULL) _accum->add(_t);
if (_verbose) {
tty->print_cr(", %3.7f secs]", _t.seconds());
tty->flush();
switch (_tag) {
case LogTag::_startuptime :
log_info(startuptime)("%s, %3.7f secs", _title, _t.seconds());
break;
case LogTag::__NO_TAG :
default :
tty->print_cr("[%s, %3.7f secs]", _title, _t.seconds());
tty->flush();
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
#ifndef SHARE_VM_RUNTIME_TIMER_HPP
#define SHARE_VM_RUNTIME_TIMER_HPP
#include "logging/logTag.hpp"
#include "utilities/globalDefinitions.hpp"
// Timers for simple measurement.
@ -85,14 +86,19 @@ class TraceTime: public StackObj {
bool _verbose; // report every timing
elapsedTimer _t; // timer
elapsedTimer* _accum; // accumulator
const char* _title; // name of timer
LogTagType _tag; // stream to print to
public:
// Constructors
TraceTime(const char* title,
bool doit = true);
bool doit = true,
LogTagType tag = LogTag::__NO_TAG);
TraceTime(const char* title,
elapsedTimer* accumulator,
bool doit = true,
bool verbose = false);
bool verbose = false,
LogTagType tag = LogTag::__NO_TAG);
~TraceTime();
// Accessors

View File

@ -71,6 +71,7 @@ void DCmdRegistrant::register_dcmds(){
#endif // INCLUDE_SERVICES
#if INCLUDE_JVMTI
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
#endif // INCLUDE_JVMTI
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
@ -254,6 +255,66 @@ void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
}
}
JVMTIAgentLoadDCmd::JVMTIAgentLoadDCmd(outputStream* output, bool heap) :
DCmdWithParser(output, heap),
_libpath("library path", "Absolute path of the JVMTI agent to load.",
"STRING", true),
_option("agent option", "Option string to pass the agent.", "STRING", false) {
_dcmdparser.add_dcmd_argument(&_libpath);
_dcmdparser.add_dcmd_argument(&_option);
}
void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) {
if (_libpath.value() == NULL) {
output()->print_cr("JVMTI.agent_load dcmd needs library path.");
return;
}
char *suffix = strrchr(_libpath.value(), '.');
bool is_java_agent = (suffix != NULL) && (strncmp(".jar", suffix, 4) == 0);
if (is_java_agent) {
if (_option.value() == NULL) {
JvmtiExport::load_agent_library("instrument", "false",
_libpath.value(), output());
} else {
size_t opt_len = strlen(_libpath.value()) + strlen(_option.value()) + 2;
if (opt_len > 4096) {
output()->print_cr("JVMTI agent attach failed: Options is too long.");
return;
}
char *opt = (char *)os::malloc(opt_len, mtInternal);
if (opt == NULL) {
output()->print_cr("JVMTI agent attach failed: "
"Could not allocate %zu bytes for argument.",
opt_len);
return;
}
jio_snprintf(opt, opt_len, "%s=%s", _libpath.value(), _option.value());
JvmtiExport::load_agent_library("instrument", "false", opt, output());
os::free(opt);
}
} else {
JvmtiExport::load_agent_library(_libpath.value(), "true",
_option.value(), output());
}
}
int JVMTIAgentLoadDCmd::num_arguments() {
ResourceMark rm;
JVMTIAgentLoadDCmd* dcmd = new JVMTIAgentLoadDCmd(NULL, false);
if (dcmd != NULL) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
return 0;
}
}
void PrintSystemPropertiesDCmd::execute(DCmdSource source, TRAPS) {
// load sun.misc.VMSupport
Symbol* klass = vmSymbols::sun_misc_VMSupport();

View File

@ -174,6 +174,26 @@ public:
virtual void execute(DCmdSource source, TRAPS);
};
class JVMTIAgentLoadDCmd : public DCmdWithParser {
protected:
DCmdArgument<char*> _libpath;
DCmdArgument<char*> _option;
public:
JVMTIAgentLoadDCmd(outputStream* output, bool heap);
static const char* name() { return "JVMTI.agent_load"; }
static const char* description() {
return "Load JVMTI native agent.";
}
static const char* impact() { return "Low"; }
static const JavaPermission permission() {
JavaPermission p = {"java.lang.management.ManagementPermission",
"control", NULL};
return p;
}
static int num_arguments();
virtual void execute(DCmdSource source, TRAPS);
};
class VMDynamicLibrariesDCmd : public DCmd {
public:
VMDynamicLibrariesDCmd(outputStream* output, bool heap);

View File

@ -174,6 +174,8 @@ const jlong max_jlong = CONST64(0x7fffffffffffffff);
#if _MSC_VER < 1800
// Visual Studio 2013 introduced strtoull(); before, one has to use _strtoui64() instead.
#define strtoull _strtoui64
// Visual Studio prior to 2013 had no va_copy, but could safely copy va_list by assignement
#define va_copy(dest, src) dest = src
// Fixes some wrong warnings about 'this' : used in base member initializer list
#pragma warning( disable : 4355 )
#endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
keys=cte_test jcmd nmt regression gc stress
groups=TEST.groups [closed/TEST.groups]
requires.properties=sun.arch.data.model java.version
requires.properties=sun.arch.data.model
# Tests using jtreg 4.1 b12 features
requiredVersion=4.1 b12

View File

@ -35,6 +35,7 @@
* gc.g1.plab.lib.MemoryConsumer
* gc.g1.plab.lib.PLABUtils
* gc.g1.plab.lib.AppPLABResize
* @ignore 8150183
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main gc.g1.plab.TestPLABResize

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,12 +24,11 @@
/*
* @test TestPrintGCDetailsVerbose
* @bug 8016740
* @summary Tests that jvm with PrintGCDetails and Verbose flags do not crash when ParOldGC has no memory
* @summary Tests that jvm with maximally verbose GC logging does not crash when ParOldGC has no memory
* @key gc
* @requires java.version ~= ".*fastdebug"
* @requires vm.gc=="Parallel" | vm.gc=="null"
* @library /testlibrary
* @run main/othervm -Xmx50m -XX:+UseParallelOldGC -XX:+PrintGCDetails -XX:+Verbose TestPrintGCDetailsVerbose
* @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose
*/
public class TestPrintGCDetailsVerbose {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -75,7 +75,7 @@ public class TestOptionsWithRanges {
int failedTests;
List<JVMOption> allOptions;
allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap(origin -> (!(origin.contains("develop") || origin.contains("notproduct"))));
/* Shared flags can cause JVM to exit with error code 2 */
setAllowedExitCodes("SharedReadWriteSize", 2);
@ -83,6 +83,13 @@ public class TestOptionsWithRanges {
setAllowedExitCodes("SharedMiscDataSize", 2);
setAllowedExitCodes("SharedMiscCodeSize", 2);
/*
* JDK-8145204
* Temporarily remove testing of max range for ParGCArrayScanChunk because
* JVM can hang when ParGCArrayScanChunk=4294967296 and ParallelGC is used
*/
excludeTestMaxRange("ParGCArrayScanChunk");
/*
* Remove CICompilerCount from testing because currently it can hang system
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,7 @@ import jdk.test.lib.dcmd.JMXExecutor;
import sun.tools.attach.HotSpotVirtualMachine;
import static optionsvalidation.JVMOptionsUtils.failedMessage;
import static optionsvalidation.JVMOptionsUtils.GCType;
import static optionsvalidation.JVMOptionsUtils.printOutputContent;
import static optionsvalidation.JVMOptionsUtils.VMType;
@ -374,17 +375,21 @@ public abstract class JVMOption {
private boolean runJavaWithParam(String optionValue, boolean valid) throws Exception {
int exitCode;
boolean result = true;
String value = optionValue.substring(optionValue.lastIndexOf("=") + 1);
String fullOptionString = prependString.toString() + optionValue;
String errorMessage = null;
List<String> runJava = new ArrayList<>();
OutputAnalyzer out;
if (VMType != null) {
runJava.add(VMType);
}
if (GCType != null) {
runJava.add(GCType);
}
runJava.addAll(prepend);
runJava.add(optionValue);
runJava.add(JVMOptionsUtils.class.getName());
runJava.add(JVMStartup.class.getName());
out = new OutputAnalyzer(ProcessTools.createJavaProcessBuilder(runJava.toArray(new String[0])).start());
@ -392,40 +397,37 @@ public abstract class JVMOption {
if (out.getOutput().contains("A fatal error has been detected by the Java Runtime Environment")) {
/* Always consider "fatal error" in output as fail */
failedMessage(name, fullOptionString, valid, "JVM output reports a fatal error. JVM exited with code " + exitCode + "!");
printOutputContent(out);
result = false;
errorMessage = "JVM output reports a fatal error. JVM exited with code " + exitCode + "!";
} else if (valid == true) {
if (!allowedExitCodes.contains(exitCode)) {
failedMessage(name, fullOptionString, valid, "JVM exited with unexpected error code = " + exitCode);
printOutputContent(out);
result = false;
errorMessage = "JVM exited with unexpected error code = " + exitCode;
} else if ((exitCode != 0) && (out.getOutput().isEmpty() == true)) {
failedMessage(name, fullOptionString, valid, "JVM exited with error(exitcode == " + exitCode +
"), but with empty stdout and stderr. Description of error is needed!");
result = false;
errorMessage = "JVM exited with error(exitcode == " + exitCode + "), but with empty stdout and stderr. " +
"Description of error is needed!";
} else if (out.getOutput().contains("is outside the allowed range")) {
failedMessage(name, fullOptionString, valid, "JVM output contains \"is outside the allowed range\"");
printOutputContent(out);
result = false;
errorMessage = "JVM output contains \"is outside the allowed range\"";
}
} else {
// valid == false
String value = optionValue.substring(optionValue.lastIndexOf("=") + 1);
String errorMessageCommandLineValue = getErrorMessageCommandLine(value);
if (exitCode == 0) {
failedMessage(name, fullOptionString, valid, "JVM successfully exit");
result = false;
errorMessage = "JVM successfully exit";
} else if (exitCode != 1) {
failedMessage(name, fullOptionString, valid, "JVM exited with code "
+ exitCode + " which not equal to 1");
result = false;
} else if (!out.getOutput().contains(getErrorMessageCommandLine(value))) {
failedMessage(name, fullOptionString, valid, "JVM output does not contain "
+ "expected output \"" + getErrorMessageCommandLine(value) + "\"");
printOutputContent(out);
result = false;
errorMessage = "JVM exited with code " + exitCode + " which not equal to 1";
} else if (!out.getOutput().contains(errorMessageCommandLineValue)) {
errorMessage = "JVM output does not contain expected output \"" + errorMessageCommandLineValue + "\"";
}
}
if (errorMessage != null) {
String fullOptionString = String.format("%s %s %s %s",
VMType == null ? "" : VMType, GCType == null ? "" : GCType, prependString.toString(), optionValue).trim().replaceAll(" +", " ");
failedMessage(name, fullOptionString, valid, errorMessage);
printOutputContent(out);
result = false;
}
System.out.println("");
return result;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
@ -50,6 +52,9 @@ public class JVMOptionsUtils {
/* Used to start the JVM with the same type as current */
static String VMType;
/* Used to start the JVM with the same GC type as current */
static String GCType;
private static Map<String, JVMOption> optionsAsMap;
static {
@ -64,6 +69,27 @@ public class JVMOptionsUtils {
} else {
VMType = null;
}
List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
GCType = null;
for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
switch (gcMxBean.getName()) {
case "ConcurrentMarkSweep":
GCType = "-XX:+UseConcMarkSweepGC";
break;
case "MarkSweepCompact":
GCType = "-XX:+UseSerialGC";
break;
case "PS Scavenge":
GCType = "-XX:+UseParallelGC";
break;
case "G1 Old Generation":
GCType = "-XX:+UseG1GC";
break;
}
}
}
public static boolean fitsRange(String optionName, BigDecimal number) throws Exception {
@ -443,6 +469,10 @@ public class JVMOptionsUtils {
if (VMType != null) {
runJava.add(VMType);
}
if (GCType != null) {
runJava.add(GCType);
}
runJava.add(PRINT_FLAGS_RANGES);
runJava.add("-version");
@ -534,9 +564,4 @@ public class JVMOptionsUtils {
public static Map<String, JVMOption> getOptionsWithRangeAsMap(String... additionalArgs) throws Exception {
return getOptionsWithRangeAsMap(origin -> true, additionalArgs);
}
/* Simple method to test that java start-up. Used for testing options. */
public static void main(String[] args) {
System.out.print("Java start-up!");
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package optionsvalidation;
import java.lang.ref.WeakReference;
class JVMStartup {
private static volatile WeakReference<Object> weakRef;
private static synchronized void createWeakRef() {
Object o = new Object();
weakRef = new WeakReference<>(o);
}
/* Simple method to test that java start-up. Used for testing options. */
public static void main(String[] args) throws Exception {
byte[] garbage = new byte[8192];
int i = 0;
createWeakRef();
do {
garbage = new byte[8192];
i++;
/* Initiate GC after 5 iterations */
if (i > 5) {
System.gc();
}
} while(weakRef.get() != null);
System.out.println("Java start-up!");
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8149383
* @summary -Xlog:biasedlocking should have logging from statements in the source code
* @library /testlibrary
* @modules java.base/sun.misc
* java.management
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
* @run driver BiasedLockingTest
*/
import jdk.test.lib.OutputAnalyzer;
import jdk.test.lib.ProcessTools;
public class BiasedLockingTest {
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Biased locking enabled");
output.shouldHaveExitValue(0);
}
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("[biasedlocking]");
output.shouldHaveExitValue(0);
}
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:biasedlocking",
"-XX:BiasedLockingStartupDelay=0",
InnerClass.class.getName());
analyzeOutputOn(pb);
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceBiasedLocking",
"-XX:BiasedLockingStartupDelay=0",
InnerClass.class.getName());
analyzeOutputOn(pb);
pb = ProcessTools.createJavaProcessBuilder("-Xlog:biasedlocking=off",
"-XX:BiasedLockingStartupDelay=0",
InnerClass.class.getName());
analyzeOutputOff(pb);
pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceBiasedLocking",
"-XX:BiasedLockingStartupDelay=0",
InnerClass.class.getName());
analyzeOutputOff(pb);
}
public static class InnerClass {
public static void main(String[] args) {
System.out.println("Biased Locking test");
}
}
}

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
/*
* @test
* @bug 8148630
* @summary -Xlog:startuptime should produce logging from the source code
* @library /testlibrary
* @modules java.base/sun.misc
* java.management
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
* @run driver StartupTimeTest
*/
import jdk.test.lib.OutputAnalyzer;
import jdk.test.lib.ProcessTools;
public class StartupTimeTest {
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldMatch("(Genesis, [0-9]+.[0-9]+ secs)");
output.shouldMatch("(Start VMThread, [0-9]+.[0-9]+ secs)");
output.shouldMatch("(Create VM, [0-9]+.[0-9]+ secs)");
output.shouldHaveExitValue(0);
}
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("[startuptime]");
output.shouldHaveExitValue(0);
}
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime",
InnerClass.class.getName());
analyzeOutputOn(pb);
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime=off",
InnerClass.class.getName());
analyzeOutputOff(pb);
}
public static class InnerClass {
public static void main(String[] args) throws Exception {
System.out.println("Testing startuptime.");
}
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.*;
import java.nio.file.*;
import jdk.test.lib.*;
import jdk.test.lib.dcmd.*;
import org.testng.annotations.Test;
/*
* Test to attach JVMTI java agent.
*
* @test
* @bug 8147388
* @library /testlibrary
* @modules java.base/sun.misc
* java.compiler
* java.instrument
* java.management
* jdk.jvmstat/sun.jvmstat.monitor
* @build ClassFileInstaller jdk.test.lib.* SimpleJvmtiAgent
* @ignore 8150318
* @run main ClassFileInstaller SimpleJvmtiAgent
* @run testng LoadAgentDcmdTest
*/
public class LoadAgentDcmdTest {
public String getLibInstrumentPath() throws FileNotFoundException {
String jdkPath = System.getProperty("test.jdk");
if (jdkPath == null) {
throw new RuntimeException(
"System property 'test.jdk' not set. " +
"This property is normally set by jtreg. " +
"When running test separately, set this property using " +
"'-Dtest.jdk=/path/to/jdk'.");
}
Path libpath;
if (Platform.isWindows()) {
libpath = Paths.get(jdkPath, "bin", "instrument.dll");
} else {
libpath = Paths.get(jdkPath, "lib", Platform.getOsArch(), "libinstrument.so");
}
if (!libpath.toFile().exists()) {
throw new FileNotFoundException(
"Could not find " + libpath.toAbsolutePath());
}
return libpath.toAbsolutePath().toString();
}
public void run(CommandExecutor executor) {
try{
PrintWriter pw = new PrintWriter("MANIFEST.MF");
pw.println("Agent-Class: SimpleJvmtiAgent");
pw.close();
ProcessBuilder pb = new ProcessBuilder();
pb.command(new String[] { JDKToolFinder.getJDKTool("jar"),
"cmf",
"MANIFEST.MF",
"agent.jar",
"SimpleJvmtiAgent.class"});
pb.start().waitFor();
String libpath = getLibInstrumentPath();
// Test 1: No argument
OutputAnalyzer output = executor.execute("JVMTI.agent_load " +
libpath + " agent.jar");
output.stderrShouldBeEmpty();
// Test 2: With argument
output = executor.execute("JVMTI.agent_load " +
libpath + " \"agent.jar=foo=bar\"");
output.stderrShouldBeEmpty();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Test
public void jmx() throws Throwable {
run(new JMXExecutor());
}
@Test
public void cli() throws Throwable {
run(new PidJcmdExecutor());
}
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.*;
import jdk.test.lib.*;
import jdk.test.lib.dcmd.*;
import org.testng.annotations.Test;
/*
* Test to attach JVMTI java agent.
*
* @test
* @bug 8147388
* @library /testlibrary
* @modules java.base/sun.misc
* java.compiler
* java.instrument
* java.management
* jdk.jvmstat/sun.jvmstat.monitor
* @build ClassFileInstaller jdk.test.lib.* SimpleJvmtiAgent
* @run main ClassFileInstaller SimpleJvmtiAgent
* @run testng LoadJavaAgentDcmdTest
*/
public class LoadJavaAgentDcmdTest {
public void run(CommandExecutor executor) {
try{
PrintWriter pw = new PrintWriter("MANIFEST.MF");
pw.println("Agent-Class: SimpleJvmtiAgent");
pw.close();
ProcessBuilder pb = new ProcessBuilder();
pb.command(new String[] { JDKToolFinder.getJDKTool("jar"),
"cmf",
"MANIFEST.MF",
"agent.jar",
"SimpleJvmtiAgent.class"});
pb.start().waitFor();
// Test 1: No argument
OutputAnalyzer output = executor.execute("JVMTI.agent_load " +
"agent.jar");
output.stderrShouldBeEmpty();
// Test 2: With argument
output = executor.execute("JVMTI.agent_load " +
"\"agent.jar=foo=bar\"");
output.stderrShouldBeEmpty();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Test
public void jmx() throws Throwable {
run(new JMXExecutor());
}
@Test
public void cli() throws Throwable {
run(new PidJcmdExecutor());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,15 +20,10 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.lang.instrument.*;
// key: compiler.warn.synthetic.name.conflict
// options: -XDwarnOnSyntheticConflicts
class WarnSyntheticNameConflict {
static class Outer {
WarnSyntheticNameConflict this$0 = null;
public class SimpleJvmtiAgent {
public static void agentmain(String agentArgs, Instrumentation instrumentation) {
System.out.println("attach succeeded (args: \"" + agentArgs + "\")");
}
public class Inner extends Outer { }
}

View File

@ -27,6 +27,7 @@ import utils.*;
* @test
* @summary Test checks the consistency of the output
* displayed with jstat -gccapacity.
* @ignore 8149778
* @library /test/lib/share/classes
* @library ../share
* @requires vm.opt.ExplicitGCInvokesConcurrent != true

View File

@ -349,3 +349,4 @@ bdbf2342b21bd8ecad1b4e6499a0dfb314952bd7 jdk-9+103
58448465334e1d8bf1cfc09052783937b1cc21c0 jdk-9+104
5acf6071d4d610068a19c79e004ba8e59cf1b087 jdk-9+105
65d615f71e81bae46dcb4d053e590582e5705879 jdk-9+106
781b83dadcae89b8ae7545bb4044ddc62c6fa006 jdk-9+107

View File

@ -97,19 +97,9 @@ import com.sun.org.apache.xerces.internal.xni.XNIException;
public class XML11DTDScannerImpl
extends XMLDTDScannerImpl {
/** Array of 3 strings. */
private String[] fStrings = new String[3];
/** String. */
private XMLString fString = new XMLString();
/** String buffer. */
private XMLStringBuffer fStringBuffer = new XMLStringBuffer();
/** String buffer. */
private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer();
private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer();
//
// Constructors
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -46,7 +46,6 @@ import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.xml.internal.stream.Entity;
/**
* This class is responsible for scanning the declarations found

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -23,7 +23,6 @@ package com.sun.org.apache.xerces.internal.impl;
import com.sun.xml.internal.stream.XMLBufferListener;
import com.sun.xml.internal.stream.XMLEntityStorage;
import com.sun.xml.internal.stream.XMLInputFactoryImpl;
import com.sun.xml.internal.stream.dtd.DTDGrammarUtil;
import java.io.EOFException;
@ -50,17 +49,11 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.State;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import javax.xml.XMLConstants;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
/**
*
@ -210,12 +203,12 @@ public class XMLDocumentFragmentScannerImpl
null,
null,
null,
EXTERNAL_ACCESS_DEFAULT
null
};
private static final char [] cdata = {'[','C','D','A','T','A','['};
static final char [] xmlDecl = {'<','?','x','m','l'};
private static final char [] endTag = {'<','/'};
// private static final char [] endTag = {'<','/'};
// debugging
/** Debug scanner state. */
@ -2066,7 +2059,7 @@ public class XMLDocumentFragmentScannerImpl
*/
String checkAccess(String systemId, String allowedProtocols) throws IOException {
String baseSystemId = fEntityScanner.getBaseSystemId();
String expandedSystemId = fEntityManager.expandSystemId(systemId, baseSystemId,fStrictURI);
String expandedSystemId = XMLEntityManager.expandSystemId(systemId, baseSystemId, fStrictURI);
return SecuritySupport.checkAccess(expandedSystemId, allowedProtocols, Constants.ACCESS_EXTERNAL_ALL);
}
@ -2602,8 +2595,6 @@ public class XMLDocumentFragmentScannerImpl
//
// Driver methods
//
private boolean fContinueDispatching = true;
private boolean fScanningForMarkup = true;
/**
* decides the appropriate state of the parser
@ -3266,7 +3257,7 @@ public class XMLDocumentFragmentScannerImpl
protected XMLString getString(){
if(fAttributeCacheUsedCount < initialCacheCount || fAttributeCacheUsedCount < attributeValueCache.size()){
return (XMLString)attributeValueCache.get(fAttributeCacheUsedCount++);
return attributeValueCache.get(fAttributeCacheUsedCount++);
} else{
XMLString str = new XMLString();
fAttributeCacheUsedCount++;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -31,7 +31,6 @@ import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
import com.sun.org.apache.xerces.internal.xni.XMLString;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
@ -224,9 +223,6 @@ public class XMLDocumentScannerImpl
/** A DTD Description. */
private final XMLDTDDescription fDTDDescription = new XMLDTDDescription(null, null, null, null, null);
/** String. */
private XMLString fString = new XMLString();
private static final char [] DOCTYPE = {'D','O','C','T','Y','P','E'};
private static final char [] COMMENTSTRING = {'-','-'};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -370,7 +370,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
protected Map<String, Entity> fEntities = new HashMap<>();
/** Entity stack. */
protected Stack fEntityStack = new Stack();
protected Stack<Entity> fEntityStack = new Stack<>();
/** Current entity. */
protected Entity.ScannedEntity fCurrentEntity = null;
@ -633,10 +633,10 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
final HTTPInputSource httpInputSource = (HTTPInputSource) xmlInputSource;
// set request properties
Iterator propIter = httpInputSource.getHTTPRequestProperties();
Iterator<Map.Entry<String, String>> propIter = httpInputSource.getHTTPRequestProperties();
while (propIter.hasNext()) {
Map.Entry entry = (Map.Entry) propIter.next();
urlConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue());
Map.Entry<String, String> entry = propIter.next();
urlConnection.setRequestProperty(entry.getKey(), entry.getValue());
}
// set preference for redirection
@ -1057,7 +1057,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
String literalSystemId = resourceIdentifier.getLiteralSystemId();
String baseSystemId = resourceIdentifier.getBaseSystemId();
String expandedSystemId = resourceIdentifier.getExpandedSystemId();
String namespace = resourceIdentifier.getNamespace();
// if no base systemId given, assume that it's relative
// to the systemId of the current scanned entity
@ -2067,14 +2066,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
// system id has to be a valid URI
if (strict) {
// check if there is a system id before
// trying to expand it.
if (systemId == null) {
return null;
}
try {
// if it's already an absolute one, return it
new URI(systemId);
@ -2968,7 +2959,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
if (!fCurrentEntity.xmlDeclChunkRead)
{
fCurrentEntity.xmlDeclChunkRead = true;
len = fCurrentEntity.DEFAULT_XMLDECL_BUFFER_SIZE;
len = Entity.ScannedEntity.DEFAULT_XMLDECL_BUFFER_SIZE;
}
return fInputStream.read(b, off, len);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -25,8 +25,6 @@ import com.sun.org.apache.xerces.internal.xni.XMLString;
import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidatorFilter;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
import com.sun.org.apache.xerces.internal.util.XMLAttributesIteratorImpl;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.QName;
@ -34,13 +32,9 @@ import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -25,7 +25,6 @@ import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.xml.internal.stream.XMLEntityStorage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.xml.stream.events.XMLEvent;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
@ -120,8 +119,8 @@ public abstract class XMLScanner
//we should have a feature when set to true computes this value
private boolean fNeedNonNormalizedValue = false;
protected ArrayList attributeValueCache = new ArrayList();
protected ArrayList stringBufferCache = new ArrayList();
protected ArrayList<XMLString> attributeValueCache = new ArrayList<>();
protected ArrayList<XMLStringBuffer> stringBufferCache = new ArrayList<>();
protected int fStringBufferIndex = 0;
protected boolean fAttributeCacheInitDone = false;
protected int fAttributeCacheUsedCount = 0;
@ -1470,7 +1469,7 @@ public abstract class XMLScanner
XMLStringBuffer getStringBuffer(){
if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){
return (XMLStringBuffer)stringBufferCache.get(fStringBufferIndex++);
return stringBufferCache.get(fStringBufferIndex++);
}else{
XMLStringBuffer tmpObj = new XMLStringBuffer();
fStringBufferIndex++;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -1172,7 +1172,7 @@ public class XSAttributeChecker {
if (max != SchemaSymbols.OCCURRENCE_UNBOUNDED) {
// maxOccurLimit is only check in secure mode
if (fSchemaHandler.fSecureProcessing != null) {
if (fSchemaHandler.fSecurityManager != null) {
String localName = element.getLocalName();
// The maxOccurs restriction no longer applies to elements
@ -1191,8 +1191,8 @@ public class XSAttributeChecker {
if (!optimize) {
//Revisit :: IMO this is not right place to check
// maxOccurNodeLimit.
int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT);
if (max > maxOccurNodeLimit && !fSchemaHandler.fSecureProcessing.isNoLimit(maxOccurNodeLimit)) {
int maxOccurNodeLimit = fSchemaHandler.fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT);
if (max > maxOccurNodeLimit && !fSchemaHandler.fSecurityManager.isNoLimit(maxOccurNodeLimit)) {
reportSchemaFatalError("MaxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
// reset max values in case processing continues on error

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -194,6 +194,7 @@ public class XSDHandler {
/** Property identifier: entity resolver. */
public static final String ENTITY_RESOLVER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
/** Property identifier: entity manager. */
protected static final String ENTITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
@ -214,16 +215,13 @@ public class XSDHandler {
protected static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
private static final String SECURE_PROCESSING =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
/** Property identifier: locale. */
protected static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
/** Property identifier: Security property manager. */
/** Property identifier: Security property manager. */
private static final String XML_SECURITY_PROPERTY_MANAGER =
Constants.XML_SECURITY_PROPERTY_MANAGER;
Constants.XML_SECURITY_PROPERTY_MANAGER;
protected static final boolean DEBUG_NODE_POOL = false;
@ -243,17 +241,12 @@ public class XSDHandler {
// as unlikely as possible to cause collisions.
public final static String REDEF_IDENTIFIER = "_fn3dktizrknc9pi";
//
//protected data that can be accessable by any traverser
//protected data that can be accessible by any traverser
protected XSDeclarationPool fDeclPool = null;
/**
* <p>Security manager in effect.</p>
*
* <p>Protected to allow access by any traverser.</p>
*/
protected XMLSecurityManager fSecureProcessing = null;
// the Security manager in effect.
protected XMLSecurityManager fSecurityManager = null;
private String fAccessExternalSchema;
private String fAccessExternalDTD;
@ -266,27 +259,28 @@ public class XSDHandler {
// XSDocumentInfoRegistry we can easily get the corresponding
// XSDocumentInfo object.
private boolean registryEmpty = true;
private Map<String, Element> fUnparsedAttributeRegistry = new HashMap();
private Map<String, Element> fUnparsedAttributeGroupRegistry = new HashMap();
private Map<String, Element> fUnparsedElementRegistry = new HashMap();
private Map<String, Element> fUnparsedGroupRegistry = new HashMap();
private Map<String, Element> fUnparsedIdentityConstraintRegistry = new HashMap();
private Map<String, Element> fUnparsedNotationRegistry = new HashMap();
private Map<String, Element> fUnparsedTypeRegistry = new HashMap();
private Map<String, Element> fUnparsedAttributeRegistry = new HashMap<>();
private Map<String, Element> fUnparsedAttributeGroupRegistry = new HashMap<>();
private Map<String, Element> fUnparsedElementRegistry = new HashMap<>();
private Map<String, Element> fUnparsedGroupRegistry = new HashMap<>();
private Map<String, Element> fUnparsedIdentityConstraintRegistry = new HashMap<>();
private Map<String, Element> fUnparsedNotationRegistry = new HashMap<>();
private Map<String, Element> fUnparsedTypeRegistry = new HashMap<>();
// Compensation for the above maps to locate XSDocumentInfo,
// Since we may take Schema Element directly, so can not get the
// corresponding XSDocumentInfo object just using above maps.
private Map<String, XSDocumentInfo> fUnparsedAttributeRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedAttributeGroupRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedElementRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedGroupRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedIdentityConstraintRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedNotationRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedTypeRegistrySub = new HashMap();
private Map<String, XSDocumentInfo> fUnparsedAttributeRegistrySub = new HashMap<>();
private Map<String, XSDocumentInfo> fUnparsedAttributeGroupRegistrySub = new HashMap<>();
private Map<String, XSDocumentInfo> fUnparsedElementRegistrySub = new HashMap<>();
private Map<String, XSDocumentInfo> fUnparsedGroupRegistrySub = new HashMap<>();
private Map<String, XSDocumentInfo> fUnparsedIdentityConstraintRegistrySub = new HashMap<>();
private Map<String, XSDocumentInfo> fUnparsedNotationRegistrySub = new HashMap<>();
private Map<String, XSDocumentInfo> fUnparsedTypeRegistrySub = new HashMap<>();
// Stores XSDocumentInfo (keyed by component name), to check for duplicate
// components declared within the same xsd document
private Map fUnparsedRegistriesExt[] = new HashMap[] {
@SuppressWarnings("unchecked")
private Map<String, XSDocumentInfo> fUnparsedRegistriesExt[] = new HashMap[] {
null,
null, // ATTRIBUTE_TYPE
null, // ATTRIBUTEGROUP_TYPE
@ -300,17 +294,19 @@ public class XSDHandler {
// this map is keyed on by XSDocumentInfo objects. Its values
// are Vectors containing the XSDocumentInfo objects <include>d,
// <import>ed or <redefine>d by the key XSDocumentInfo.
private Map<XSDocumentInfo, Vector> fDependencyMap = new HashMap();
private Map<XSDocumentInfo, Vector<XSDocumentInfo>> fDependencyMap = new HashMap<>();
// this map is keyed on by a target namespace. Its values
// are Vectors containing namespaces imported by schema documents
// with the key target namespace.
// if an imprted schema has absent namespace, the value "null" is stored.
private Map<String, Vector> fImportMap = new HashMap();
// if an imported schema has absent namespace, the value "null" is stored.
private Map<String, Vector> fImportMap = new HashMap<> ();
// all namespaces that imports other namespaces
// if the importing schema has absent namespace, empty string is stored.
// (because the key of a map can't be null.)
private Vector fAllTNSs = new Vector();
private Vector<String> fAllTNSs = new Vector<>();
// stores instance document mappings between namespaces and schema hints
private Map<String, XMLSchemaLoader.LocationArray> fLocationPairs = null;
@ -333,7 +329,7 @@ public class XSDHandler {
if(ele.getOwnerDocument() instanceof com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOM){
documentURI = ((com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOM) ele.getOwnerDocument()).getDocumentURI();
}
return documentURI != null ? documentURI : (String) fDoc2SystemId.get(ele);
return documentURI != null ? documentURI : fDoc2SystemId.get(ele);
}
// This vector stores strings which are combinations of the
@ -341,11 +337,11 @@ public class XSDHandler {
// schema document. This combination is used so that the user's
// EntityResolver can provide a consistent way of identifying a
// schema document that is included in multiple other schemas.
private Map fTraversed = new HashMap();
private Map<XSDKey, Element> fTraversed = new HashMap<>();
// this map contains a mapping from Schema Element to its systemId
// this is useful to resolve a uri relative to the referring document
private Map fDoc2SystemId = new HashMap();
private Map<Element, String> fDoc2SystemId = new HashMap<>();
// the primary XSDocumentInfo we were called to parse
private XSDocumentInfo fRoot = null;
@ -387,7 +383,15 @@ public class XSDHandler {
// the XMLErrorReporter
private XMLErrorReporter fErrorReporter;
private XMLEntityResolver fEntityResolver;
// the XMLErrorHandler
private XMLErrorHandler fErrorHandler;
// the Locale
private Locale fLocale;
// the XMLEntityManager
private XMLEntityResolver fEntityManager;
// the XSAttributeChecker
private XSAttributeChecker fAttributeChecker;
@ -404,6 +408,9 @@ public class XSDHandler {
// the Grammar Pool
private XMLGrammarPool fGrammarPool;
// the security property manager
private XMLSecurityPropertyManager fSecurityPropertyMgr = null;
//************ Traversers **********
XSDAttributeGroupTraverser fAttributeGroupTraverser;
XSDAttributeTraverser fAttributeTraverser;
@ -638,7 +645,7 @@ public class XSDHandler {
// for all grammars with <import>s
for (int i = fAllTNSs.size() - 1; i >= 0; i--) {
// get its target namespace
String tns = (String)fAllTNSs.elementAt(i);
String tns = fAllTNSs.elementAt(i);
// get all namespaces it imports
Vector ins = (Vector)fImportMap.get(tns);
// get the grammar
@ -696,12 +703,13 @@ public class XSDHandler {
fAnnotationValidator.setFeature(VALIDATION, true);
fAnnotationValidator.setFeature(XMLSCHEMA_VALIDATION, true);
fAnnotationValidator.setProperty(XMLGRAMMAR_POOL, fGrammarBucketAdapter);
/** set security manager and XML Security Property Manager **/
fAnnotationValidator.setProperty(SECURITY_MANAGER, (fSecurityManager != null) ? fSecurityManager : new XMLSecurityManager(true));
fAnnotationValidator.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
/** Set error handler. **/
XMLErrorHandler errorHandler = fErrorReporter.getErrorHandler();
fAnnotationValidator.setProperty(ERROR_HANDLER, (errorHandler != null) ? errorHandler : new DefaultErrorHandler());
fAnnotationValidator.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler());
/** Set locale. **/
Locale locale = fErrorReporter.getLocale();
fAnnotationValidator.setProperty(LOCALE, locale);
fAnnotationValidator.setProperty(LOCALE, fLocale);
}
/**
@ -880,10 +888,10 @@ public class XSDHandler {
// store the document and its location
// REVISIT: don't expose the DOM tree
sg.addDocument(null, (String)fDoc2SystemId.get(currSchemaInfo.fSchemaElement));
sg.addDocument(null, fDoc2SystemId.get(currSchemaInfo.fSchemaElement));
fDoc2XSDocumentMap.put(schemaRoot, currSchemaInfo);
Vector dependencies = new Vector();
Vector<XSDocumentInfo> dependencies = new Vector<>();
Element rootNode = schemaRoot;
Element newSchemaRoot = null;
@ -1334,9 +1342,9 @@ public class XSDHandler {
} // end for
// now we're done with this one!
DOMUtil.setHidden(currDoc, fHiddenNodes);
DOMUtil.setHidden(currDoc, fHiddenNodes);
// now add the schemas this guy depends on
Vector currSchemaDepends = (Vector)fDependencyMap.get(currSchemaDoc);
Vector<XSDocumentInfo> currSchemaDepends = fDependencyMap.get(currSchemaDoc);
for (int i = 0; i < currSchemaDepends.size(); i++) {
schemasToProcess.push(currSchemaDepends.elementAt(i));
}
@ -1466,7 +1474,7 @@ public class XSDHandler {
DOMUtil.setHidden(currDoc, fHiddenNodes);
// now add the schemas this guy depends on
Vector currSchemaDepends = (Vector)fDependencyMap.get(currSchemaDoc);
Vector<XSDocumentInfo> currSchemaDepends = fDependencyMap.get(currSchemaDoc);
for (int i = 0; i < currSchemaDepends.size(); i++) {
schemasToProcess.push(currSchemaDepends.elementAt(i));
}
@ -1915,7 +1923,7 @@ public class XSDHandler {
}
public String schemaDocument2SystemId(XSDocumentInfo schemaDoc) {
return (String)fDoc2SystemId.get(schemaDoc.fSchemaElement);
return fDoc2SystemId.get(schemaDoc.fSchemaElement);
}
// This method determines whether there is a group
@ -2044,7 +2052,7 @@ public class XSDHandler {
XMLInputSource schemaSource = null;
try {
Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
}
catch (IOException ex) {
if (mustResolve) {
@ -2097,7 +2105,7 @@ public class XSDHandler {
XMLInputSource schemaSource = null;
try {
Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
}
catch (IOException ex) {
if (mustResolve) {
@ -2152,7 +2160,7 @@ public class XSDHandler {
if (referType != XSDDescription.CONTEXT_PREPARSE){
schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false);
key = new XSDKey(schemaId, referType, schemaNamespace);
if((schemaElement = (Element)fTraversed.get(key)) != null) {
if((schemaElement = fTraversed.get(key)) != null) {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
@ -2211,7 +2219,7 @@ public class XSDHandler {
if (referType != XSDDescription.CONTEXT_PREPARSE) {
schemaId = XMLEntityManager.expandSystemId(inputSource.getSystemId(), schemaSource.getBaseSystemId(), false);
key = new XSDKey(schemaId, referType, schemaNamespace);
if ((schemaElement = (Element) fTraversed.get(key)) != null) {
if ((schemaElement = fTraversed.get(key)) != null) {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
@ -2238,9 +2246,8 @@ public class XSDHandler {
namespacePrefixes = true;
// If this is a Xerces SAX parser set the security manager if there is one
if (parser instanceof SAXParser) {
Object securityManager = fSchemaParser.getProperty(SECURITY_MANAGER);
if (securityManager != null) {
parser.setProperty(SECURITY_MANAGER, securityManager);
if (fSecurityManager != null) {
parser.setProperty(SECURITY_MANAGER, fSecurityManager);
}
}
}
@ -2347,7 +2354,7 @@ public class XSDHandler {
}
if (isDocument) {
key = new XSDKey(schemaId, referType, schemaNamespace);
if ((schemaElement = (Element) fTraversed.get(key)) != null) {
if ((schemaElement = fTraversed.get(key)) != null) {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
@ -2402,7 +2409,7 @@ public class XSDHandler {
}
if (isDocument) {
key = new XSDKey(schemaId, referType, schemaNamespace);
if ((schemaElement = (Element) fTraversed.get(key)) != null) {
if ((schemaElement = fTraversed.get(key)) != null) {
fLastSchemaWasDuplicate = true;
return schemaElement;
}
@ -3502,40 +3509,21 @@ public class XSDHandler {
// set symbol table
fSymbolTable = (SymbolTable) componentManager.getProperty(SYMBOL_TABLE);
fSecureProcessing = null;
if( componentManager!=null ) {
fSecureProcessing = (XMLSecurityManager) componentManager.getProperty(SECURE_PROCESSING, null);
}
// set security manager
fSecurityManager = (XMLSecurityManager) componentManager.getProperty(SECURITY_MANAGER, null);
//set entity manager
fEntityManager = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER);
//set entity resolver
fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER);
XMLEntityResolver er = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER);
if (er != null)
fSchemaParser.setEntityResolver(er);
// set error reporter
fErrorReporter =
(XMLErrorReporter) componentManager.getProperty(ERROR_REPORTER);
try {
XMLErrorHandler currErrorHandler = fErrorReporter.getErrorHandler();
// Setting a parser property can be much more expensive
// than checking its value. Don't set the ERROR_HANDLER
// or LOCALE properties unless they've actually changed.
if (currErrorHandler != fSchemaParser.getProperty(ERROR_HANDLER)) {
fSchemaParser.setProperty(ERROR_HANDLER, (currErrorHandler != null) ? currErrorHandler : new DefaultErrorHandler());
if (fAnnotationValidator != null) {
fAnnotationValidator.setProperty(ERROR_HANDLER, (currErrorHandler != null) ? currErrorHandler : new DefaultErrorHandler());
}
}
Locale currentLocale = fErrorReporter.getLocale();
if (currentLocale != fSchemaParser.getProperty(LOCALE)) {
fSchemaParser.setProperty(LOCALE, currentLocale);
if (fAnnotationValidator != null) {
fAnnotationValidator.setProperty(LOCALE, currentLocale);
}
}
}
catch (XMLConfigurationException e) {}
fErrorReporter = (XMLErrorReporter) componentManager.getProperty(ERROR_REPORTER);
fErrorHandler = fErrorReporter.getErrorHandler();
fLocale = fErrorReporter.getLocale();
fValidateAnnotations = componentManager.getFeature(VALIDATE_ANNOTATIONS, false);
fHonourAllSchemaLocations = componentManager.getFeature(HONOUR_ALL_SCHEMALOCATIONS, false);
@ -3543,56 +3531,66 @@ public class XSDHandler {
fTolerateDuplicates = componentManager.getFeature(TOLERATE_DUPLICATES, false);
try {
fSchemaParser.setFeature(
CONTINUE_AFTER_FATAL_ERROR,
fErrorReporter.getFeature(CONTINUE_AFTER_FATAL_ERROR));
} catch (XMLConfigurationException e) {
// Setting a parser property can be much more expensive
// than checking its value. Don't set the ERROR_HANDLER
// or LOCALE properties unless they've actually changed.
if (fErrorHandler != fSchemaParser.getProperty(ERROR_HANDLER)) {
fSchemaParser.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler());
if (fAnnotationValidator != null) {
fAnnotationValidator.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler());
}
}
if (fLocale != fSchemaParser.getProperty(LOCALE)) {
fSchemaParser.setProperty(LOCALE, fLocale);
if (fAnnotationValidator != null) {
fAnnotationValidator.setProperty(LOCALE, fLocale);
}
}
}
catch (XMLConfigurationException e) {}
try {
fSchemaParser.setFeature(CONTINUE_AFTER_FATAL_ERROR, fErrorReporter.getFeature(CONTINUE_AFTER_FATAL_ERROR));
} catch (XMLConfigurationException e) {}
try {
if (componentManager.getFeature(ALLOW_JAVA_ENCODINGS, false)) {
fSchemaParser.setFeature(ALLOW_JAVA_ENCODINGS, true);
}
} catch (XMLConfigurationException e) {
}
} catch (XMLConfigurationException e) {}
try {
if (componentManager.getFeature(STANDARD_URI_CONFORMANT_FEATURE, false)) {
fSchemaParser.setFeature(STANDARD_URI_CONFORMANT_FEATURE, true);
}
} catch (XMLConfigurationException e) {
}
} catch (XMLConfigurationException e) {}
try {
fGrammarPool =
(XMLGrammarPool) componentManager.getProperty(XMLGRAMMAR_POOL);
fGrammarPool = (XMLGrammarPool) componentManager.getProperty(XMLGRAMMAR_POOL);
} catch (XMLConfigurationException e) {
fGrammarPool = null;
}
// security features
try {
if (componentManager.getFeature(DISALLOW_DOCTYPE, false)) {
fSchemaParser.setFeature(DISALLOW_DOCTYPE, true);
}
} catch (XMLConfigurationException e) {
}
} catch (XMLConfigurationException e) {}
try {
Object security = componentManager.getProperty(SECURITY_MANAGER, null);
if (security != null){
fSchemaParser.setProperty(SECURITY_MANAGER, security);
if (fSecurityManager != null) {
fSchemaParser.setProperty(SECURITY_MANAGER, fSecurityManager);
}
} catch (XMLConfigurationException e) {
}
} catch (XMLConfigurationException e) {}
fSecurityPropertyMgr = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
XMLSecurityPropertyManager securityPropertyMgr = (XMLSecurityPropertyManager)
componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
//Passing on the setting to the parser
fSchemaParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, securityPropertyMgr);
fSchemaParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
fAccessExternalDTD = securityPropertyMgr.getValue(
XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
fAccessExternalSchema = securityPropertyMgr.getValue(
XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
fAccessExternalDTD = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
fAccessExternalSchema = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
} // reset(XMLComponentManager)
@ -4051,7 +4049,7 @@ public class XSDHandler {
so long as there's some include/import/redefine path amongst them.
If they rver reverse this decision the code's right here though... - neilg
// now look in fDependencyMap to see if this is reachable
if(((Vector)fDependencyMap.get(currSchema)).contains(declDocInfo)) {
if((fDependencyMap.get(currSchema)).contains(declDocInfo)) {
return declDocInfo;
}
// obviously the requesting doc didn't include, redefine or
@ -4072,9 +4070,9 @@ public class XSDHandler {
if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) {
// make it visible
DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes);
Vector dependingSchemas = (Vector)fDependencyMap.get(startSchema);
Vector<XSDocumentInfo> dependingSchemas = fDependencyMap.get(startSchema);
for (int i = 0; i < dependingSchemas.size(); i++) {
setSchemasVisible((XSDocumentInfo)dependingSchemas.elementAt(i));
setSchemasVisible(dependingSchemas.elementAt(i));
}
}
// if it's visible already than so must be its children
@ -4107,7 +4105,7 @@ public class XSDHandler {
ElementImpl ele = (ElementImpl)e;
// get system id from document object
Document doc = ele.getOwnerDocument();
String sid = (String)fDoc2SystemId.get(DOMUtil.getRoot(doc));
String sid = fDoc2SystemId.get(DOMUtil.getRoot(doc));
// line/column numbers are stored in the element node
int line = ele.getLineNumber();
int column = ele.getColumnNumber();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -52,7 +52,6 @@ import com.sun.org.apache.xerces.internal.util.FeatureState;
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
import com.sun.org.apache.xerces.internal.util.PropertyState;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
@ -166,59 +165,57 @@ public class XML11Configuration extends ParserConfigurationSettings
protected static final String USE_GRAMMAR_POOL_ONLY =
Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
// feature identifiers
// feature identifiers
/** Feature identifier: validation. */
protected static final String VALIDATION =
Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
/** Feature identifier: validation. */
protected static final String VALIDATION =
Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
/** Feature identifier: namespaces. */
protected static final String NAMESPACES =
Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
/** Feature identifier: namespaces. */
protected static final String NAMESPACES =
Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
/** Feature identifier: external general entities. */
protected static final String EXTERNAL_GENERAL_ENTITIES =
Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
/** Feature identifier: external general entities. */
protected static final String EXTERNAL_GENERAL_ENTITIES =
Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
/** Feature identifier: external parameter entities. */
protected static final String EXTERNAL_PARAMETER_ENTITIES =
Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
/** Feature identifier: external parameter entities. */
protected static final String EXTERNAL_PARAMETER_ENTITIES =
Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
/** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
protected static final String IGNORE_XSI_TYPE =
Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
/** Feature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered */
protected static final String IGNORE_XSI_TYPE =
Constants.XERCES_FEATURE_PREFIX + Constants.IGNORE_XSI_TYPE_FEATURE;
/** Feature identifier: whether to ignore ID/IDREF errors */
protected static final String ID_IDREF_CHECKING =
Constants.XERCES_FEATURE_PREFIX + Constants.ID_IDREF_CHECKING_FEATURE;
/** Feature identifier: whether to ignore ID/IDREF errors */
protected static final String ID_IDREF_CHECKING =
Constants.XERCES_FEATURE_PREFIX + Constants.ID_IDREF_CHECKING_FEATURE;
/** Feature identifier: whether to ignore unparsed entity errors */
protected static final String UNPARSED_ENTITY_CHECKING =
Constants.XERCES_FEATURE_PREFIX + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
/** Feature identifier: whether to ignore unparsed entity errors */
protected static final String UNPARSED_ENTITY_CHECKING =
Constants.XERCES_FEATURE_PREFIX + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
/** Feature identifier: whether to ignore identity constraint errors */
protected static final String IDENTITY_CONSTRAINT_CHECKING =
Constants.XERCES_FEATURE_PREFIX + Constants.IDC_CHECKING_FEATURE;
/** Feature identifier: whether to ignore identity constraint errors */
protected static final String IDENTITY_CONSTRAINT_CHECKING =
Constants.XERCES_FEATURE_PREFIX + Constants.IDC_CHECKING_FEATURE;
// property identifiers
/** Property identifier: xml string. */
protected static final String XML_STRING =
Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY;
/** Property identifier: xml string. */
protected static final String XML_STRING =
Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY;
/** Property identifier: symbol table. */
protected static final String SYMBOL_TABLE =
Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
/** Property identifier: symbol table. */
protected static final String SYMBOL_TABLE =
Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
/** Property identifier: error handler. */
protected static final String ERROR_HANDLER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
/** Property identifier: entity resolver. */
protected static final String ENTITY_RESOLVER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
/** Property identifier: error handler. */
protected static final String ERROR_HANDLER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
/** Property identifier: entity resolver. */
protected static final String ENTITY_RESOLVER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
/** Property identifier: XML Schema validator. */
protected static final String SCHEMA_VALIDATOR =
@ -232,8 +229,6 @@ public class XML11Configuration extends ParserConfigurationSettings
protected static final String SCHEMA_NONS_LOCATION =
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_NONS_LOCATION;
// property identifiers
/** Property identifier: error reporter. */
protected static final String ERROR_REPORTER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
@ -313,33 +308,33 @@ public class XML11Configuration extends ParserConfigurationSettings
// Data
//
protected SymbolTable fSymbolTable;
protected SymbolTable fSymbolTable;
protected XMLInputSource fInputSource;
protected ValidationManager fValidationManager;
protected XMLVersionDetector fVersionDetector;
protected XMLVersionDetector fVersionDetector;
protected XMLLocator fLocator;
protected Locale fLocale;
protected Locale fLocale;
/** XML 1.0 Components. */
protected ArrayList fComponents;
/** XML 1.0 Components. */
protected ArrayList<XMLComponent> fComponents;
/** XML 1.1. Components. */
protected ArrayList fXML11Components = null;
/** XML 1.1. Components. */
protected ArrayList<XMLComponent> fXML11Components = null;
/** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */
protected ArrayList fCommonComponents = null;
/** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */
protected ArrayList<XMLComponent> fCommonComponents = null;
/** The document handler. */
protected XMLDocumentHandler fDocumentHandler;
/** The document handler. */
protected XMLDocumentHandler fDocumentHandler;
/** The DTD handler. */
protected XMLDTDHandler fDTDHandler;
/** The DTD handler. */
protected XMLDTDHandler fDTDHandler;
/** The DTD content model handler. */
protected XMLDTDContentModelHandler fDTDContentModelHandler;
/** The DTD content model handler. */
protected XMLDTDContentModelHandler fDTDContentModelHandler;
/** Last component in the document pipeline */
protected XMLDocumentSource fLastComponent;
/** Last component in the document pipeline */
protected XMLDocumentSource fLastComponent;
/**
* True if a parse is in progress. This state is needed because
@ -477,15 +472,15 @@ public class XML11Configuration extends ParserConfigurationSettings
// create a vector to hold all the components in use
// XML 1.0 specialized components
fComponents = new ArrayList();
fComponents = new ArrayList<>();
// XML 1.1 specialized components
fXML11Components = new ArrayList();
fXML11Components = new ArrayList<>();
// Common components for XML 1.1. and XML 1.0
fCommonComponents = new ArrayList();
fCommonComponents = new ArrayList<>();
// create table for features and properties
fFeatures = new HashMap();
fProperties = new HashMap();
fFeatures = new HashMap<>();
fProperties = new HashMap<>();
// add default recognized features
final String[] recognizedFeatures =
@ -580,35 +575,35 @@ public class XML11Configuration extends ParserConfigurationSettings
}
fEntityManager = new XMLEntityManager();
fProperties.put(ENTITY_MANAGER, fEntityManager);
fProperties.put(ENTITY_MANAGER, fEntityManager);
addCommonComponent(fEntityManager);
fErrorReporter = new XMLErrorReporter();
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
fProperties.put(ERROR_REPORTER, fErrorReporter);
fProperties.put(ERROR_REPORTER, fErrorReporter);
addCommonComponent(fErrorReporter);
fNamespaceScanner = new XMLNSDocumentScannerImpl();
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
addComponent((XMLComponent) fNamespaceScanner);
fDTDScanner = new XMLDTDScannerImpl();
fProperties.put(DTD_SCANNER, fDTDScanner);
fProperties.put(DTD_SCANNER, fDTDScanner);
addComponent((XMLComponent) fDTDScanner);
fDTDProcessor = new XMLDTDProcessor();
fProperties.put(DTD_PROCESSOR, fDTDProcessor);
fProperties.put(DTD_PROCESSOR, fDTDProcessor);
addComponent((XMLComponent) fDTDProcessor);
fDTDValidator = new XMLNSDTDValidator();
fProperties.put(DTD_VALIDATOR, fDTDValidator);
fProperties.put(DTD_VALIDATOR, fDTDValidator);
addComponent(fDTDValidator);
fDatatypeValidatorFactory = DTDDVFactory.getInstance();
fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory);
fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory);
fValidationManager = new ValidationManager();
fProperties.put(VALIDATION_MANAGER, fValidationManager);
fProperties.put(VALIDATION_MANAGER, fValidationManager);
fVersionDetector = new XMLVersionDetector();
@ -935,20 +930,20 @@ public class XML11Configuration extends ParserConfigurationSettings
// forward to every XML 1.0 component
int count = fComponents.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fComponents.get(i);
XMLComponent c = fComponents.get(i);
c.setFeature(featureId, state);
}
// forward it to common components
count = fCommonComponents.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fCommonComponents.get(i);
XMLComponent c = fCommonComponents.get(i);
c.setFeature(featureId, state);
}
// forward to every XML 1.1 component
count = fXML11Components.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fXML11Components.get(i);
XMLComponent c = fXML11Components.get(i);
try{
c.setFeature(featureId, state);
}
@ -996,19 +991,19 @@ public class XML11Configuration extends ParserConfigurationSettings
// forward to every XML 1.0 component
int count = fComponents.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fComponents.get(i);
XMLComponent c = fComponents.get(i);
c.setProperty(propertyId, value);
}
// forward it to every common Component
count = fCommonComponents.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fCommonComponents.get(i);
XMLComponent c = fCommonComponents.get(i);
c.setProperty(propertyId, value);
}
// forward it to every XML 1.1 component
count = fXML11Components.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fXML11Components.get(i);
XMLComponent c = fXML11Components.get(i);
try{
c.setProperty(propertyId, value);
}
@ -1034,7 +1029,7 @@ public class XML11Configuration extends ParserConfigurationSettings
protected void reset() throws XNIException {
int count = fComponents.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fComponents.get(i);
XMLComponent c = fComponents.get(i);
c.reset(this);
}
@ -1047,7 +1042,7 @@ public class XML11Configuration extends ParserConfigurationSettings
// reset common components
int count = fCommonComponents.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fCommonComponents.get(i);
XMLComponent c = fCommonComponents.get(i);
c.reset(this);
}
@ -1061,7 +1056,7 @@ public class XML11Configuration extends ParserConfigurationSettings
// reset every component
int count = fXML11Components.size();
for (int i = 0; i < count; i++) {
XMLComponent c = (XMLComponent) fXML11Components.get(i);
XMLComponent c = fXML11Components.get(i);
c.reset(this);
}

View File

@ -51,7 +51,7 @@ public final class HTTPInputSource extends XMLInputSource {
protected boolean fFollowRedirects = true;
/** HTTP request properties. **/
protected Map fHTTPRequestProperties = new HashMap();
protected Map<String, String> fHTTPRequestProperties = new HashMap<>();
//
// Constructors
@ -159,7 +159,7 @@ public final class HTTPInputSource extends XMLInputSource {
* been set
*/
public String getHTTPRequestProperty(String key) {
return (String) fHTTPRequestProperties.get(key);
return fHTTPRequestProperties.get(key);
} // getHTTPRequestProperty(String):String
/**
@ -172,7 +172,7 @@ public final class HTTPInputSource extends XMLInputSource {
* @return an iterator for the request properties this
* input source contains
*/
public Iterator getHTTPRequestProperties() {
public Iterator<Map.Entry<String, String>> getHTTPRequestProperties() {
return fHTTPRequestProperties.entrySet().iterator();
} // getHTTPRequestProperties():Iterator

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>Testapp for XSD annotation issue</xs:appinfo>
<xs:documentation xml:lang="en">This is an XSD annotation, just for the sake of it.</xs:documentation>
</xs:annotation>
</xs:schema>

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package validation;
import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;
import org.testng.annotations.Test;
/*
* @summary Test Schema creation
* @bug 8149915
*/
public class SchemaTest {
/*
* @bug 8149915
* Verifies that the annotation validator is initialized with the security manager for schema
* creation with http://apache.org/xml/features/validate-annotations=true.
*/
@Test
public void testValidation() throws Exception {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
factory.setFeature("http://apache.org/xml/features/validate-annotations", true);
factory.newSchema(new File(getClass().getResource("Bug8149915.xsd").getFile()));
}
}

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