OpenJDK / jdk / jdk10
changeset 26026:8d7f6c44eff4
Merge
author | prr |
---|---|
date | Tue, 05 Aug 2014 12:14:11 -0700 |
parents | 7b31d014cae6 040219b86923 |
children | f42f02a8666d |
files | hotspot/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java jdk/src/share/classes/com/sun/naming/internal/VersionHelper12.java |
diffstat | 392 files changed, 5170 insertions(+), 2933 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Tue Aug 05 15:39:05 2014 +0400 +++ b/.hgtags Tue Aug 05 12:14:11 2014 -0700 @@ -266,3 +266,4 @@ 28dd0c7beb3cad9cf95f17b4b5ad87eb447a4084 jdk9-b21 9678e0db8ff6ed845d4c2ee4a3baf7f386a777e5 jdk9-b22 39cfdc2dcaf3f195c55398e4e677ab053b07e3d2 jdk9-b23 +d9ce05f36ffec3e5e8af62a92455c1c66a63c320 jdk9-b24
--- a/.hgtags-top-repo Tue Aug 05 15:39:05 2014 +0400 +++ b/.hgtags-top-repo Tue Aug 05 12:14:11 2014 -0700 @@ -266,3 +266,4 @@ 9052803f4d01feda28b3d65f2b64dd457d21c7b6 jdk9-b21 8e4bdab4c362aadde2d321f968cd503a2f779e2f jdk9-b22 88567461a2cd9b7fb431fee6440005a694df1f47 jdk9-b23 +1d4a293fbec19dc2d5790bbb2c7dd0ed8f265484 jdk9-b24
--- a/common/autoconf/generated-configure.sh Tue Aug 05 15:39:05 2014 +0400 +++ b/common/autoconf/generated-configure.sh Tue Aug 05 12:14:11 2014 -0700 @@ -4311,7 +4311,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1404942241 +DATE_WHEN_GENERATED=1405336663 ############################################################################### # @@ -14548,7 +14548,7 @@ if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then INCLUDE_SA=false fi - if test "x$VAR_CPU" = xppc64 ; then + if test "x$OPENJDK_TARGET_OS" = xaix ; then INCLUDE_SA=false fi
--- a/common/autoconf/jdk-options.m4 Tue Aug 05 15:39:05 2014 +0400 +++ b/common/autoconf/jdk-options.m4 Tue Aug 05 12:14:11 2014 -0700 @@ -158,7 +158,7 @@ if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then INCLUDE_SA=false fi - if test "x$VAR_CPU" = xppc64 ; then + if test "x$OPENJDK_TARGET_OS" = xaix ; then INCLUDE_SA=false fi AC_SUBST(INCLUDE_SA)
--- a/corba/.hgtags Tue Aug 05 15:39:05 2014 +0400 +++ b/corba/.hgtags Tue Aug 05 12:14:11 2014 -0700 @@ -266,3 +266,4 @@ 3615a4e7f0542ca7552ad6454b742c73ee211d8e jdk9-b21 ddc07abf4307855c0dc904cc5c96cc764023a930 jdk9-b22 57735d66face054440a63ce99789eac5a5ee1dfd jdk9-b23 +8a44142bb7fc8118f70f91a1b97c12dfc50563ee jdk9-b24
--- a/hotspot/.hgtags Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/.hgtags Tue Aug 05 12:14:11 2014 -0700 @@ -426,3 +426,4 @@ 17b4a5e831b398738feedb0afe75245744510153 jdk9-b21 518d1fcc0799494f013e00e0a94a91b6f212d54f jdk9-b22 dd472cdacc32e3afc7c5bfa7ef16ea0e0befb7fa jdk9-b23 +dde2d03b0ea46a27650839e3a1d212c7c1f7b4c8 jdk9-b24
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -33,6 +33,7 @@ import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.debugger.MachineDescription; import sun.jvm.hotspot.debugger.MachineDescriptionAMD64; +import sun.jvm.hotspot.debugger.MachineDescriptionPPC64; import sun.jvm.hotspot.debugger.MachineDescriptionIA64; import sun.jvm.hotspot.debugger.MachineDescriptionIntelX86; import sun.jvm.hotspot.debugger.MachineDescriptionSPARC32Bit; @@ -588,6 +589,8 @@ machDesc = new MachineDescriptionIA64(); } else if (cpu.equals("amd64")) { machDesc = new MachineDescriptionAMD64(); + } else if (cpu.equals("ppc64")) { + machDesc = new MachineDescriptionPPC64(); } else if (cpu.equals("sparc")) { if (LinuxDebuggerLocal.getAddressSize()==8) { machDesc = new MachineDescriptionSPARC64Bit();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionPPC64.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package sun.jvm.hotspot.debugger; + +public class MachineDescriptionPPC64 extends MachineDescriptionTwosComplement implements MachineDescription { + public long getAddressSize() { + return 8; + } + + public boolean isLP64() { + return true; + } + + public boolean isBigEndian() { + return true; + } +}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -61,7 +61,7 @@ return "x86"; } else if (cpu.equals("sparc") || cpu.equals("sparcv9")) { return "sparc"; - } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) { + } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64") || cpu.equals("ppc64")) { return cpu; } else { try {
--- a/hotspot/make/aix/makefiles/buildtree.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/buildtree.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -274,6 +274,8 @@ echo; \ [ -n "$(SPEC)" ] && \ echo "include $(SPEC)"; \ + echo "CP ?= cp"; \ + echo "MV ?= mv"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
--- a/hotspot/make/aix/makefiles/jsig.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/jsig.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -20,7 +20,7 @@ # 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. -# +# # # Rules to build signal interposition library, used by vm.make @@ -40,8 +40,8 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig -# On Linux we really dont want a mapfile, as this library is small -# and preloaded using LD_PRELOAD, making functions private will +# On Linux we really dont want a mapfile, as this library is small +# and preloaded using LD_PRELOAD, making functions private will # cause problems with interposing. See CR: 6466665 # LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) @@ -79,9 +79,9 @@ install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" $(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \ - cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) + $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) $(QUIETLY) test -f $(LIBJSIG_DIZ) && \ - cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" + $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) + $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" .PHONY: install_jsig
--- a/hotspot/make/aix/makefiles/rules.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/rules.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # Common rules/macros for the vm, adlc. @@ -28,7 +28,7 @@ .SUFFIXES: .cpp $(SUFFIXES) DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && mv -f .$@ $@ +DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ # $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
--- a/hotspot/make/aix/makefiles/sa.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/sa.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -98,11 +98,11 @@ $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/* - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ - $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ + $(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
--- a/hotspot/make/aix/makefiles/saproc.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/saproc.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -20,7 +20,7 @@ # 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 $(GAMMADIR)/make/defs.make @@ -108,10 +108,10 @@ $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ test -f $(LIBSAPROC_DEBUGINFO) && \ - cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ + $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ test -f $(LIBSAPROC_DIZ) && \ - cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ - cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ + $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ + $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ fi .PHONY: install_saproc
--- a/hotspot/make/aix/makefiles/top.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/top.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # top.make is included in the Makefile in the build directories. @@ -45,10 +45,10 @@ GENERATED = $(TOPDIR)/../generated VM = $(GAMMADIR)/src/share/vm Plat_File = $(Platform_file) -CDG = cd $(GENERATED); +CDG = cd $(GENERATED); ifneq ($(USE_PRECOMPILED_HEADER),0) -UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) +UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) else UpdatePCH = \# precompiled header is not used endif @@ -84,7 +84,7 @@ @# We need a null action here, so implicit rules don't get consulted. $(Cached_plat): $(Plat_File) - $(CDG) cp $(Plat_File) $(Cached_plat) + $(CDG) $(CP) $(Plat_File) $(Cached_plat) # make AD files as necessary ad_stuff: $(Cached_plat) $(adjust-mflags) @@ -125,12 +125,12 @@ # next rules support "make foo.[ois]" %.o %.i %.s: - $(UpdatePCH) + $(UpdatePCH) $(MAKE) -f vm.make $(MFLAGS) $@ #$(MAKE) -f vm.make $@ # this should force everything to be rebuilt -clean: +clean: rm -f $(GENERATED)/*.class $(MAKE) -f vm.make $(MFLAGS) clean
--- a/hotspot/make/aix/makefiles/vm.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/aix/makefiles/vm.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -346,10 +346,10 @@ install_jvm: $(LIBJVM) @echo "Copying $(LIBJVM) to $(DEST_JVM)" $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \ - cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) + $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) $(QUIETLY) test -f $(LIBJVM_DIZ) && \ - cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" + $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) + $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" #---------------------------------------------------------------------- # Other files
--- a/hotspot/make/bsd/makefiles/buildtree.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/buildtree.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -278,6 +278,8 @@ echo; \ [ -n "$(SPEC)" ] && \ echo "include $(SPEC)"; \ + echo "CP ?= cp"; \ + echo "MV ?= mv"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
--- a/hotspot/make/bsd/makefiles/jsig.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/jsig.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # 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. -# +# # # Rules to build signal interposition library, used by vm.make @@ -47,8 +47,8 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig -# On Bsd we really dont want a mapfile, as this library is small -# and preloaded using LD_PRELOAD, making functions private will +# On Bsd we really dont want a mapfile, as this library is small +# and preloaded using LD_PRELOAD, making functions private will # cause problems with interposing. See CR: 6466665 # LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) @@ -92,13 +92,13 @@ @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" ifeq ($(OS_VENDOR), Darwin) $(QUIETLY) test ! -d $(LIBJSIG_DEBUGINFO) || \ - cp -f -r $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) + $(CP) -f -r $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) else $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ - cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) + $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) endif $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ - cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" + $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) + $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" .PHONY: install_jsig
--- a/hotspot/make/bsd/makefiles/rules.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/rules.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # Common rules/macros for the vm, adlc. @@ -28,7 +28,7 @@ .SUFFIXES: .cpp $(SUFFIXES) DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && mv -f .$@ $@ +DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ # $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
--- a/hotspot/make/bsd/makefiles/sa.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/sa.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, 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 @@ -19,7 +19,7 @@ # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. -# +# # # This makefile (sa.make) is included from the sa.make in the @@ -71,7 +71,7 @@ # if $(AGENT_DIR) does not exist, we don't build SA # also, we don't build SA on Itanium, PowerPC, ARM or zero. -all: +all: if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ -a "$(SRCARCH)" != "arm" \ -a "$(SRCARCH)" != "ppc" \ @@ -112,11 +112,11 @@ $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/* - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ - $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ + $(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
--- a/hotspot/make/bsd/makefiles/saproc.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/saproc.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # 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. -# +# # # Rules to build serviceability agent library, used by vm.make @@ -83,7 +83,7 @@ endif else SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c - SALIBS = + SALIBS = SAARCH = $(ARCHFLAG) endif endif @@ -163,13 +163,13 @@ @echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)" ifeq ($(OS_VENDOR), Darwin) $(QUIETLY) test ! -d $(LIBSAPROC_DEBUGINFO) || \ - cp -f -r $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO) + $(CP) -f -r $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO) else $(QUIETLY) test ! -f $(LIBSAPROC_DEBUGINFO) || \ - cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO) + $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO) endif $(QUIETLY) test ! -f $(LIBSAPROC_DIZ) || \ - cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ) - $(QUIETLY) cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done" + $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ) + $(QUIETLY) $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done" .PHONY: install_saproc
--- a/hotspot/make/bsd/makefiles/top.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/top.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # top.make is included in the Makefile in the build directories. @@ -45,10 +45,10 @@ GENERATED = $(TOPDIR)/../generated VM = $(GAMMADIR)/src/share/vm Plat_File = $(Platform_file) -CDG = cd $(GENERATED); +CDG = cd $(GENERATED); ifneq ($(USE_PRECOMPILED_HEADER),0) -UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) +UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) else UpdatePCH = \# precompiled header is not used endif @@ -84,7 +84,7 @@ @# We need a null action here, so implicit rules don't get consulted. $(Cached_plat): $(Plat_File) - $(CDG) cp $(Plat_File) $(Cached_plat) + $(CDG) $(CP) $(Plat_File) $(Cached_plat) # make AD files as necessary ad_stuff: $(Cached_plat) $(adjust-mflags) @@ -134,12 +134,12 @@ # next rules support "make foo.[ois]" %.o %.i %.s: - $(UpdatePCH) + $(UpdatePCH) $(MAKE) -f vm.make $(MFLAGS) $@ #$(MAKE) -f vm.make $@ # this should force everything to be rebuilt -clean: +clean: rm -f $(GENERATED)/*.class $(MAKE) -f vm.make $(MFLAGS) clean
--- a/hotspot/make/bsd/makefiles/vm.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/bsd/makefiles/vm.make Tue Aug 05 12:14:11 2014 -0700 @@ -360,14 +360,14 @@ @echo "Copying $(LIBJVM) to $(DEST_JVM)" ifeq ($(OS_VENDOR), Darwin) $(QUIETLY) test ! -d $(LIBJVM_DEBUGINFO) || \ - cp -f -r $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) + $(CP) -f -r $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) else $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ - cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) + $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) endif $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ - cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" + $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) + $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" #---------------------------------------------------------------------- # Other files
--- a/hotspot/make/jprt.properties Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/jprt.properties Tue Aug 05 12:14:11 2014 -0700 @@ -350,21 +350,25 @@ ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \ ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests -jprt.make.rule.test.targets.standard.wbapi = \ - ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-wbapitest, \ - ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \ - ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \ - ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \ - ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \ - ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \ - ${jprt.my.linux.i586}-{product|fastdebug}-c1-wbapitest, \ - ${jprt.my.windows.i586}-{product|fastdebug}-c1-wbapitest +jprt.make.rule.test.targets.standard.reg.group = \ + ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GROUP, \ + ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GROUP, \ + ${jprt.my.linux.i586}-{product|fastdebug}-c2-GROUP, \ + ${jprt.my.linux.x64}-{product|fastdebug}-c2-GROUP, \ + ${jprt.my.windows.i586}-{product|fastdebug}-c2-GROUP, \ + ${jprt.my.windows.x64}-{product|fastdebug}-c2-GROUP, \ + ${jprt.my.linux.i586}-{product|fastdebug}-c1-GROUP, \ + ${jprt.my.windows.i586}-{product|fastdebug}-c1-GROUP jprt.make.rule.test.targets.standard = \ ${jprt.make.rule.test.targets.standard.client}, \ ${jprt.make.rule.test.targets.standard.server}, \ ${jprt.make.rule.test.targets.standard.internalvmtests}, \ - ${jprt.make.rule.test.targets.standard.wbapi} + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_wbapitest}, \ + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_compiler}, \ + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_gc}, \ + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_runtime}, \ + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_serviceability} jprt.make.rule.test.targets.embedded = \ ${jprt.make.rule.test.targets.standard.client}
--- a/hotspot/make/linux/makefiles/buildtree.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/buildtree.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -277,6 +277,8 @@ echo; \ [ -n "$(SPEC)" ] && \ echo "include $(SPEC)"; \ + echo "CP ?= cp"; \ + echo "MV ?= mv"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
--- a/hotspot/make/linux/makefiles/defs.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/defs.make Tue Aug 05 12:14:11 2014 -0700 @@ -297,27 +297,23 @@ endif # Serviceability Binaries -# No SA Support for PPC, IA64, ARM or zero -ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ - $(EXPORT_LIB_DIR)/sa-jdi.jar -ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ - $(EXPORT_LIB_DIR)/sa-jdi.jar + +ADD_SA_BINARIES/DEFAULT = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ + $(EXPORT_LIB_DIR)/sa-jdi.jar + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifeq ($(ZIP_DEBUGINFO_FILES),1) - ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz - ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz + ADD_SA_BINARIES/DEFAULT += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz else - ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo - ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo + ADD_SA_BINARIES/DEFAULT += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo endif endif -ADD_SA_BINARIES/ppc = -ADD_SA_BINARIES/ia64 = -ADD_SA_BINARIES/arm = + +ADD_SA_BINARIES/$(HS_ARCH) = $(ADD_SA_BINARIES/DEFAULT) + +# No SA Support for zero ADD_SA_BINARIES/zero = -include $(HS_ALT_MAKE)/linux/makefiles/defs.make EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH)) - -
--- a/hotspot/make/linux/makefiles/jsig.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/jsig.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # 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. -# +# # # Rules to build signal interposition library, used by vm.make @@ -39,8 +39,8 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig -# On Linux we really dont want a mapfile, as this library is small -# and preloaded using LD_PRELOAD, making functions private will +# On Linux we really dont want a mapfile, as this library is small +# and preloaded using LD_PRELOAD, making functions private will # cause problems with interposing. See CR: 6466665 # LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) @@ -75,9 +75,9 @@ install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ - cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) + $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ - cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" + $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) + $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" .PHONY: install_jsig
--- a/hotspot/make/linux/makefiles/rules.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/rules.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # Common rules/macros for the vm, adlc. @@ -28,7 +28,7 @@ .SUFFIXES: .cpp $(SUFFIXES) DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && mv -f .$@ $@ +DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ # $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
--- a/hotspot/make/linux/makefiles/sa.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/sa.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, 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 @@ -19,7 +19,7 @@ # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. -# +# # # This makefile (sa.make) is included from the sa.make in the @@ -60,7 +60,7 @@ # if $(AGENT_DIR) does not exist, we don't build SA # also, we don't build SA on Itanium or zero. -all: +all: if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ -a "$(SRCARCH)" != "zero" ] ; then \ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ @@ -99,11 +99,11 @@ $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/* - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ - $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ + $(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
--- a/hotspot/make/linux/makefiles/saproc.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/saproc.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # 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 $(GAMMADIR)/make/defs.make include $(GAMMADIR)/make/altsrc.make @@ -116,10 +116,10 @@ $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ test ! -f $(LIBSAPROC_DEBUGINFO) || \ - cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ + $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ test ! -f $(LIBSAPROC_DIZ) || \ - cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ - cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ + $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ + $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ fi .PHONY: install_saproc
--- a/hotspot/make/linux/makefiles/top.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/top.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # top.make is included in the Makefile in the build directories. @@ -45,10 +45,10 @@ GENERATED = $(TOPDIR)/../generated VM = $(GAMMADIR)/src/share/vm Plat_File = $(Platform_file) -CDG = cd $(GENERATED); +CDG = cd $(GENERATED); ifneq ($(USE_PRECOMPILED_HEADER),0) -UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) +UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) else UpdatePCH = \# precompiled header is not used endif @@ -84,7 +84,7 @@ @# We need a null action here, so implicit rules don't get consulted. $(Cached_plat): $(Plat_File) - $(CDG) cp $(Plat_File) $(Cached_plat) + $(CDG) $(CP) $(Plat_File) $(Cached_plat) # make AD files as necessary ad_stuff: $(Cached_plat) $(adjust-mflags) @@ -128,12 +128,12 @@ # next rules support "make foo.[ois]" %.o %.i %.s: - $(UpdatePCH) + $(UpdatePCH) $(MAKE) -f vm.make $(MFLAGS) $@ #$(MAKE) -f vm.make $@ # this should force everything to be rebuilt -clean: +clean: rm -f $(GENERATED)/*.class $(MAKE) -f vm.make $(MFLAGS) clean
--- a/hotspot/make/linux/makefiles/vm.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/linux/makefiles/vm.make Tue Aug 05 12:14:11 2014 -0700 @@ -362,10 +362,10 @@ install_jvm: $(LIBJVM) @echo "Copying $(LIBJVM) to $(DEST_JVM)" $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ - cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) + $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ - cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" + $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) + $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" #---------------------------------------------------------------------- # Other files
--- a/hotspot/make/solaris/makefiles/buildtree.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/buildtree.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2014, 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,8 @@ echo; \ [ -n "$(SPEC)" ] && \ echo "include $(SPEC)"; \ + echo "CP ?= cp"; \ + echo "MV ?= mv"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ ) > $@
--- a/hotspot/make/solaris/makefiles/jsig.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/jsig.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # 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. -# +# # # Rules to build signal interposition library, used by vm.make @@ -80,9 +80,9 @@ install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ - cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) + $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ - cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" + $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) + $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" .PHONY: install_jsig
--- a/hotspot/make/solaris/makefiles/rules.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/rules.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # Common rules/macros for the vm, adlc. @@ -28,7 +28,7 @@ .SUFFIXES: .cpp $(SUFFIXES) DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && mv -f .$@ $@ +DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ # $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
--- a/hotspot/make/solaris/makefiles/sa.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/sa.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, 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 @@ -19,7 +19,7 @@ # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. -# +# # # This makefile (sa.make) is included from the sa.make in the @@ -52,7 +52,7 @@ SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties # if $(AGENT_DIR) does not exist, we don't build SA. -all: +all: $(QUIETLY) if [ -d $(AGENT_DIR) ] ; then \ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ fi @@ -90,11 +90,11 @@ $(QUIETLY) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/* - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ - $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ + $(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ $(QUIETLY) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal
--- a/hotspot/make/solaris/makefiles/saproc.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/saproc.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # 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. -# +# # # Rules to build serviceability agent library, used by vm.make @@ -119,7 +119,7 @@ $(SOLARIS_11_B159_OR_LATER) \ $(SADISSRCFILES) \ -c -o $(SADISOBJ) - + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. # Clear the SHF_ALLOC flag (if set) from empty section headers. @@ -150,10 +150,10 @@ $(QUIETLY) if [ -f $(LIBSAPROC) ] ; then \ echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ test ! -f $(LIBSAPROC_DEBUGINFO) || \ - cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ + $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ test ! -f $(LIBSAPROC_DIZ) || \ - cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ - cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ + $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ + $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ fi .PHONY: install_saproc
--- a/hotspot/make/solaris/makefiles/top.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/top.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2014, 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 @@ -19,7 +19,7 @@ # 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. -# +# # # top.make is included in the Makefile in the build directories. @@ -44,7 +44,7 @@ GENERATED = ../generated VM = $(GAMMADIR)/src/share/vm Plat_File = $(Platform_file) -CDG = cd $(GENERATED); +CDG = cd $(GENERATED); Cached_plat = $(GENERATED)/platform.current @@ -77,7 +77,7 @@ @# We need a null action here, so implicit rules don't get consulted. $(Cached_plat): $(Plat_File) - $(CDG) cp $(Plat_File) $(Cached_plat) + $(CDG) $(CP) $(Plat_File) $(Cached_plat) # make AD files as necessary ad_stuff: $(Cached_plat) $(adjust-mflags) @@ -87,7 +87,7 @@ jvmti_stuff: $(Cached_plat) $(adjust-mflags) @$(MAKE) -f jvmti.make $(MFLAGS-adjusted) -# generate trace files +# generate trace files trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags) @$(MAKE) -f trace.make $(MFLAGS-adjusted) @@ -124,7 +124,7 @@ #$(MAKE) -f vm.make $@ # this should force everything to be rebuilt -clean: +clean: rm -f $(GENERATED)/*.class $(MAKE) -f vm.make $(MFLAGS) clean
--- a/hotspot/make/solaris/makefiles/vm.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/solaris/makefiles/vm.make Tue Aug 05 12:14:11 2014 -0700 @@ -336,10 +336,10 @@ install_jvm: $(LIBJVM) @echo "Copying $(LIBJVM) to $(DEST_JVM)" $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ - cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) + $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ - cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" + $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) + $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" #---------------------------------------------------------------------- # Other files
--- a/hotspot/make/windows/build.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/windows/build.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2014, 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 @@ -300,6 +300,8 @@ @ if "$(ENABLE_FULL_DEBUG_SYMBOLS)" NEQ "" echo ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) >> $@ @ if "$(ZIP_DEBUGINFO_FILES)" NEQ "" echo ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) >> $@ @ if "$(RM)" NEQ "" echo RM=$(RM) >> $@ + @ if "$(CP)" NEQ "" echo CP=$(CP) >> $@ + @ if "$(MV)" NEQ "" echo MV=$(MV) >> $@ @ if "$(ZIPEXE)" NEQ "" echo ZIPEXE=$(ZIPEXE) >> $@ checks: checkVariant checkWorkSpace checkSA
--- a/hotspot/make/windows/makefiles/defs.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/windows/makefiles/defs.make Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, 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 @@ -156,6 +156,9 @@ MAKE_ARGS += RM="$(RM)" MAKE_ARGS += ZIPEXE=$(ZIPEXE) +MAKE_ARGS += CP="${CP}" +MAKE_ARGS += MV="${MV}" + # On 32 bit windows we build server and client, on 64 bit just server. ifeq ($(JVM_VARIANTS),)
--- a/hotspot/make/windows/makefiles/sa.make Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/make/windows/makefiles/sa.make Tue Aug 05 12:14:11 2014 -0700 @@ -19,7 +19,7 @@ # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. -# +# # # This makefile is used to build Serviceability Agent code @@ -76,16 +76,16 @@ $(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer $(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES) $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql $(QUIETLY) rm -rf $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) mkdir $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources - $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR) + $(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources + $(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR) $(RUN_JAR) cf $@ -C $(SA_CLASSDIR) . $(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal - $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext - $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.asm.Disassembler @@ -105,7 +105,7 @@ !elseif "$(BUILDARCH)" == "amd64" SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c !else -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" SA_CFLAGS = $(SA_CFLAGS) -ZI !endif @@ -116,7 +116,7 @@ SASRCFILES = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp \ $(AGENT_DIR)/src/share/native/sadis.c - + SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE) !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" SA_LFLAGS = $(SA_LFLAGS) -map -debug @@ -136,7 +136,7 @@ $(SAWINDBG): $(SASRCFILES) set INCLUDE=$(SA_INCLUDE)$(INCLUDE) $(CXX) @<< - -I"$(BootStrapDir)/include" -I"$(BootStrapDir)/include/win32" + -I"$(BootStrapDir)/include" -I"$(BootStrapDir)/include/win32" -I"$(GENERATED)" $(SA_CFLAGS) $(SASRCFILES) -out:$*.obj
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -251,6 +251,49 @@ // buf is started with ", " or is empty _features_str = strdup(strlen(buf) > 2 ? buf + 2 : buf); + // There are three 64-bit SPARC families that do not overlap, e.g., + // both is_ultra3() and is_sparc64() cannot be true at the same time. + // Within these families, there can be more than one chip, e.g., + // is_T4() and is_T7() machines are also is_niagara(). + if (is_ultra3()) { + assert(_L1_data_cache_line_size == 0, "overlap with Ultra3 family"); + // Ref: UltraSPARC III Cu Processor + _L1_data_cache_line_size = 64; + } + if (is_niagara()) { + assert(_L1_data_cache_line_size == 0, "overlap with niagara family"); + // All Niagara's are sun4v's, but not all sun4v's are Niagaras, e.g., + // Fujitsu SPARC64 is sun4v, but we don't want it in this block. + // + // Ref: UltraSPARC T1 Supplement to the UltraSPARC Architecture 2005 + // Appendix F.1.3.1 Cacheable Accesses + // -> 16-byte L1 cache line size + // + // Ref: UltraSPARC T2: A Highly-Threaded, Power-Efficient, SPARC SOC + // Section III: SPARC Processor Core + // -> 16-byte L1 cache line size + // + // Ref: Oracle's SPARC T4-1, SPARC T4-2, SPARC T4-4, and SPARC T4-1B Server Architecture + // Section SPARC T4 Processor Cache Architecture + // -> 32-byte L1 cache line size (no longer see that info on this ref) + // + // XXX - still need a T7 reference here + // + if (is_T7()) { // T7 or newer + _L1_data_cache_line_size = 64; + } else if (is_T4()) { // T4 or newer (until T7) + _L1_data_cache_line_size = 32; + } else { // T1 or newer (until T4) + _L1_data_cache_line_size = 16; + } + } + if (is_sparc64()) { + guarantee(_L1_data_cache_line_size == 0, "overlap with SPARC64 family"); + // Ref: Fujitsu SPARC64 VII Processor + // Section 4 Cache System + _L1_data_cache_line_size = 64; + } + // UseVIS is set to the smallest of what hardware supports and what // the command line requires. I.e., you cannot set UseVIS to 3 on // older UltraSparc which do not support it. @@ -356,6 +399,7 @@ #ifndef PRODUCT if (PrintMiscellaneous && Verbose) { + tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size()); tty->print("Allocation"); if (AllocatePrefetchStyle <= 0) { tty->print_cr(": no prefetching");
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -394,6 +394,8 @@ _stepping = 0; _cpuFeatures = 0; _logical_processors_per_package = 1; + // i486 internal cache is both I&D and has a 16-byte line size + _L1_data_cache_line_size = 16; if (!Use486InstrsOnly) { // Get raw processor info @@ -412,6 +414,7 @@ // Logical processors are only available on P4s and above, // and only if hyperthreading is available. _logical_processors_per_package = logical_processor_count(); + _L1_data_cache_line_size = L1_line_size(); } } @@ -924,6 +927,7 @@ if (PrintMiscellaneous && Verbose) { tty->print_cr("Logical CPUs per core: %u", logical_processors_per_package()); + tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size()); tty->print("UseSSE=%d", (int) UseSSE); if (UseAVX > 0) { tty->print(" UseAVX=%d", (int) UseAVX);
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -581,7 +581,7 @@ return result; } - static intx prefetch_data_size() { + static intx L1_line_size() { intx result = 0; if (is_intel()) { result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1); @@ -593,6 +593,10 @@ return result; } + static intx prefetch_data_size() { + return L1_line_size(); + } + // // Feature identification //
--- a/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java Tue Aug 05 12:14:11 2014 -0700 @@ -478,9 +478,17 @@ } else if (scopes.peek().getCalls().size() > 2 && m == scopes.peek().last(-2).getMethod()) { scopes.push(scopes.peek().last(-2)); } else { - System.out.println(site.getMethod()); - System.out.println(m); - throw new InternalError("call site and parse don't match"); + // C1 prints multiple method tags during inlining when it narrows method being inlinied. + // Example: + // ... + // <method id="813" holder="694" name="toString" return="695" flags="1" bytes="36" iicount="1"/> + // <call method="813" instr="invokevirtual"/> + // <inline_success reason="receiver is statically known"/> + // <method id="814" holder="792" name="toString" return="695" flags="1" bytes="5" iicount="3"/> + // <parse method="814"> + // ... + site.setMethod(m); + scopes.push(site); } } } else if (qname.equals("parse_done")) {
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1573,6 +1573,7 @@ default: constant = new Constant(as_ValueType(field_val)); } + // Stable static fields are checked for non-default values in ciField::initialize_from(). } if (constant != NULL) { push(type, append(constant)); @@ -1614,6 +1615,10 @@ default: constant = new Constant(as_ValueType(field_val)); } + if (FoldStableValues && field->is_stable() && field_val.is_null_or_zero()) { + // Stable field with default value can't be constant. + constant = NULL; + } } else { // For CallSite objects treat the target field as a compile time constant. if (const_oop->is_call_site()) { @@ -3959,10 +3964,15 @@ // Clear out bytecode stream scope_data()->set_stream(NULL); + CompileLog* log = compilation()->log(); + if (log != NULL) log->head("parse method='%d'", log->identify(callee)); + // Ready to resume parsing in callee (either in the same block we // were in before or in the callee's start block) iterate_all_blocks(callee_start_block == NULL); + if (log != NULL) log->done("parse"); + // If we bailed out during parsing, return immediately (this is bad news) if (bailed_out()) return false;
--- a/hotspot/src/share/vm/ci/ciEnv.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/ci/ciEnv.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1125,9 +1125,6 @@ // ------------------------------------------------------------------ // ciEnv::record_failure() void ciEnv::record_failure(const char* reason) { - if (log() != NULL) { - log()->elem("failure reason='%s'", reason); - } if (_failure_reason == NULL) { // Record the first failure reason. _failure_reason = reason;
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -777,11 +777,22 @@ // unneeded entries. bool has_redefined_a_class = JvmtiExport::has_redefined_a_class(); MetadataOnStackMark md_on_stack; + if (has_redefined_a_class) { + // purge_previous_versions also cleans weak method links. Because + // one method's MDO can reference another method from another + // class loader, we need to first clean weak method links for all + // class loaders here. Below, we can then free redefined methods + // for all class loaders. + while (data != NULL) { + if (data->is_alive(is_alive_closure)) { + data->classes_do(InstanceKlass::purge_previous_versions); + } + data = data->next(); + } + } + data = _head; while (data != NULL) { if (data->is_alive(is_alive_closure)) { - if (has_redefined_a_class) { - data->classes_do(InstanceKlass::purge_previous_versions); - } data->free_deallocate_list(); prev = data; data = data->next();
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1239,6 +1239,16 @@ } +// Return Symbol for detailed_message or NULL +Symbol* java_lang_Throwable::detail_message(oop throwable) { + PRESERVE_EXCEPTION_MARK; // Keep original exception + oop detailed_message = java_lang_Throwable::message(throwable); + if (detailed_message != NULL) { + return java_lang_String::as_symbol(detailed_message, THREAD); + } + return NULL; +} + void java_lang_Throwable::set_message(oop throwable, oop value) { throwable->obj_field_put(detailMessage_offset, value); }
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -520,6 +520,7 @@ static oop message(oop throwable); static oop message(Handle throwable); static void set_message(oop throwable, oop value); + static Symbol* detail_message(oop throwable); static void print_stack_element(outputStream *st, Handle mirror, int method, int version, int bci); static void print_stack_element(outputStream *st, methodHandle method, int bci);
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -297,6 +297,7 @@ _hot_count = hot_count; _time_queued = 0; // tidy _comment = comment; + _failure_reason = NULL; if (LogCompilation) { _time_queued = os::elapsed_counter(); @@ -566,6 +567,11 @@ methodHandle method(thread, this->method()); ResourceMark rm(thread); + if (!_is_success) { + const char* reason = _failure_reason != NULL ? _failure_reason : "unknown"; + log->elem("failure reason='%s'", reason); + } + // <task_done ... stamp='1.234'> </task> nmethod* nm = code(); log->begin_elem("task_done success='%d' nmsize='%d' count='%d'", @@ -733,6 +739,7 @@ for (CompileTask* task = head; task != NULL; ) { CompileTask* next_task = task->next(); CompileTaskWrapper ctw(task); // Frees the task + task->set_failure_reason("stale task"); task = next_task; } } @@ -1786,6 +1793,7 @@ } else { // After compilation is disabled, remove remaining methods from queue method->clear_queued_for_compilation(); + task->set_failure_reason("compilation is disabled"); } } } @@ -1973,6 +1981,7 @@ compilable = ci_env.compilable(); if (ci_env.failing()) { + task->set_failure_reason(ci_env.failure_reason()); const char* retry_message = ci_env.retry_message(); if (_compilation_log != NULL) { _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -64,6 +64,7 @@ jobject _hot_method_holder; int _hot_count; // information about its invocation counter const char* _comment; // more info about the task + const char* _failure_reason; public: CompileTask() { @@ -138,6 +139,10 @@ void log_task_queued(); void log_task_start(CompileLog* log); void log_task_done(CompileLog* log); + + void set_failure_reason(const char* reason) { + _failure_reason = reason; + } }; // CompilerCounters
--- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -197,28 +197,29 @@ bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() { #if INCLUDE_ALL_GCS - if (UseConcMarkSweepGC || UseG1GC) { - if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) { - MetaspaceGC::set_should_concurrent_collect(true); - } else if (UseG1GC) { - G1CollectedHeap* g1h = G1CollectedHeap::heap(); - g1h->g1_policy()->set_initiate_conc_mark_if_possible(); + if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) { + MetaspaceGC::set_should_concurrent_collect(true); + return true; + } - GCCauseSetter x(g1h, _gc_cause); + if (UseG1GC) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + g1h->g1_policy()->set_initiate_conc_mark_if_possible(); - // At this point we are supposed to start a concurrent cycle. We - // will do so if one is not already in progress. - bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause); + GCCauseSetter x(g1h, _gc_cause); - if (should_start) { - double pause_target = g1h->g1_policy()->max_pause_time_ms(); - g1h->do_collection_pause_at_safepoint(pause_target); - } + // At this point we are supposed to start a concurrent cycle. We + // will do so if one is not already in progress. + bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause); + + if (should_start) { + double pause_target = g1h->g1_policy()->max_pause_time_ms(); + g1h->do_collection_pause_at_safepoint(pause_target); } - return true; } #endif + return false; }
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -430,9 +430,18 @@ // tracing if (TraceExceptions) { - ttyLocker ttyl; ResourceMark rm(thread); - tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", h_exception->print_value_string(), (address)h_exception()); + Symbol* message = java_lang_Throwable::detail_message(h_exception()); + ttyLocker ttyl; // Lock after getting the detail message + if (message != NULL) { + tty->print_cr("Exception <%s: %s> (" INTPTR_FORMAT ")", + h_exception->print_value_string(), message->as_C_string(), + (address)h_exception()); + } else { + tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", + h_exception->print_value_string(), + (address)h_exception()); + } tty->print_cr(" thrown in interpreter method <%s>", h_method->print_value_string()); tty->print_cr(" at bci %d for thread " INTPTR_FORMAT, current_bci, thread); }
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -244,10 +244,8 @@ method()->print_value(); tty->print(" @ %d = [%d] { ", bci(), n); for (int i = 0; i < n; i++) { -#ifdef ENABLE_ZAP_DEAD_LOCALS if (is_dead(i)) tty->print("%d+ ", i); else -#endif if (is_oop(i)) tty->print("%d ", i); } tty->print_cr("}"); @@ -402,13 +400,11 @@ value |= (mask << oop_bit_number ); } - #ifdef ENABLE_ZAP_DEAD_LOCALS // set dead bit if (!cell->is_live()) { value |= (mask << dead_bit_number); assert(!cell->is_reference(), "dead value marked as oop"); } - #endif } // make sure last word is stored
--- a/hotspot/src/share/vm/interpreter/oopMapCache.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/interpreter/oopMapCache.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -66,19 +66,15 @@ public: enum { - N = 2, // the number of words reserved + N = 4, // the number of words reserved // for inlined mask storage small_mask_limit = N * BitsPerWord, // the maximum number of bits // available for small masks, // small_mask_limit can be set to 0 // for testing bit_mask allocation -#ifdef ENABLE_ZAP_DEAD_LOCALS bits_per_entry = 2, dead_bit_number = 1, -#else - bits_per_entry = 1, -#endif oop_bit_number = 0 }; @@ -119,10 +115,6 @@ void set_expression_stack_size(int sz) { _expression_stack_size = sz; } -#ifdef ENABLE_ZAP_DEAD_LOCALS - bool is_dead(int offset) const { return (entry_at(offset) & (1 << dead_bit_number)) != 0; } -#endif - // Lookup bool match(methodHandle method, int bci) const { return _method == method() && _bci == bci; } bool is_empty() const; @@ -144,6 +136,7 @@ void print() const; int number_of_entries() const { return mask_size() / bits_per_entry; } + bool is_dead(int offset) const { return (entry_at(offset) & (1 << dead_bit_number)) != 0; } bool is_oop (int offset) const { return (entry_at(offset) & (1 << oop_bit_number )) != 0; } int expression_stack_size() const { return _expression_stack_size; }
--- a/hotspot/src/share/vm/oops/constantPool.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/oops/constantPool.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -520,13 +520,9 @@ Symbol* ConstantPool::exception_message(constantPoolHandle this_cp, int which, constantTag tag, oop pending_exception) { // Dig out the detailed message to reuse if possible - Symbol* message = NULL; - oop detailed_message = java_lang_Throwable::message(pending_exception); - if (detailed_message != NULL) { - message = java_lang_String::as_symbol_or_null(detailed_message); - if (message != NULL) { - return message; - } + Symbol* message = java_lang_Throwable::detail_message(pending_exception); + if (message != NULL) { + return message; } // Return specific message for the tag
--- a/hotspot/src/share/vm/oops/method.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/oops/method.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -729,8 +729,8 @@ } if ((TraceDeoptimization || LogCompilation) && (xtty != NULL)) { ttyLocker ttyl; - xtty->begin_elem("make_not_%scompilable thread='" UINTX_FORMAT "'", - is_osr ? "osr_" : "", os::current_thread_id()); + xtty->begin_elem("make_not_compilable thread='" UINTX_FORMAT "' osr='%d' level='%d'", + os::current_thread_id(), is_osr, comp_level); if (reason != NULL) { xtty->print(" reason=\'%s\'", reason); }
--- a/hotspot/src/share/vm/oops/methodData.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/oops/methodData.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1556,7 +1556,7 @@ public: CleanExtraDataMethodClosure() {} bool is_live(Method* m) { - return m->on_stack(); + return !m->is_old() || m->on_stack(); } };
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -107,7 +107,7 @@ int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) { // Allows targeted inlining - if(callee_method->should_inline()) { + if (callee_method->should_inline()) { *wci_result = *(WarmCallInfo::always_hot()); if (C->print_inlining() && Verbose) { CompileTask::print_inline_indent(inline_level()); @@ -118,6 +118,12 @@ return true; } + if (callee_method->force_inline()) { + set_msg("force inline by annotation"); + _forced_inline = true; + return true; + } + #ifndef PRODUCT int inline_depth = inline_level()+1; if (ciReplay::should_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { @@ -244,6 +250,11 @@ } #endif + if (callee_method->force_inline()) { + set_msg("force inline by annotation"); + return false; + } + // Now perform checks which are heuristic if (is_unboxing_method(callee_method, C)) { @@ -251,12 +262,10 @@ return false; } - if (!callee_method->force_inline()) { - if (callee_method->has_compiled_code() && - callee_method->instructions_size() > InlineSmallCode) { - set_msg("already compiled into a big method"); - return true; - } + if (callee_method->has_compiled_code() && + callee_method->instructions_size() > InlineSmallCode) { + set_msg("already compiled into a big method"); + return true; } // don't inline exception code unless the top method belongs to an @@ -349,7 +358,7 @@ // Escape Analysis stress testing when running Xcomp or CTW: // inline constructors even if they are not reached. } else if (forced_inline()) { - // Inlining was forced by CompilerOracle or ciReplay + // Inlining was forced by CompilerOracle, ciReplay or annotation } else if (profile.count() == 0) { // don't inline unreached call sites set_msg("call site not reached");
--- a/hotspot/src/share/vm/opto/machnode.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/opto/machnode.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -639,7 +639,6 @@ } #endif - bool MachCallNode::return_value_is_used() const { if (tf()->range()->cnt() == TypeFunc::Parms) { // void return @@ -657,6 +656,14 @@ return false; } +// Similar to cousin class CallNode::returns_pointer +// Because this is used in deoptimization, we want the type info, not the data +// flow info; the interpreter will "use" things that are dead to the optimizer. +bool MachCallNode::returns_pointer() const { + const TypeTuple *r = tf()->range(); + return (r->cnt() > TypeFunc::Parms && + r->field_at(TypeFunc::Parms)->isa_ptr()); +} //------------------------------Registers-------------------------------------- const RegMask &MachCallNode::in_RegMask(uint idx) const {
--- a/hotspot/src/share/vm/opto/machnode.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/opto/machnode.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -842,6 +842,10 @@ bool returns_long() const { return tf()->return_type() == T_LONG; } bool return_value_is_used() const; + + // Similar to cousin class CallNode::returns_pointer + bool returns_pointer() const; + #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; #endif
--- a/hotspot/src/share/vm/opto/output.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/opto/output.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -854,8 +854,7 @@ } // Check if a call returns an object. - if (mcall->return_value_is_used() && - mcall->tf()->range()->field_at(TypeFunc::Parms)->isa_ptr()) { + if (mcall->returns_pointer()) { return_oop = true; } safepoint_pc_offset += mcall->ret_addr_offset();
--- a/hotspot/src/share/vm/opto/parse.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/opto/parse.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -142,7 +142,7 @@ void print_value_on(outputStream* st) const PRODUCT_RETURN; - bool _forced_inline; // Inlining was forced by CompilerOracle or ciReplay + bool _forced_inline; // Inlining was forced by CompilerOracle, ciReplay or annotation bool forced_inline() const { return _forced_inline; } // Count number of nodes in this subtree int count() const;
--- a/hotspot/src/share/vm/opto/replacednodes.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/opto/replacednodes.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -185,11 +185,11 @@ void ReplacedNodes::dump(outputStream *st) const { if (!is_empty()) { - tty->print("replaced nodes: "); + st->print("replaced nodes: "); for (int i = 0; i < _replaced_nodes->length(); i++) { - tty->print("%d->%d", _replaced_nodes->at(i).initial()->_idx, _replaced_nodes->at(i).improved()->_idx); + st->print("%d->%d", _replaced_nodes->at(i).initial()->_idx, _replaced_nodes->at(i).improved()->_idx); if (i < _replaced_nodes->length()-1) { - tty->print(","); + st->print(","); } } }
--- a/hotspot/src/share/vm/prims/jni.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/prims/jni.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -247,15 +247,6 @@ "Bug in native code: jfieldID offset must address interior of object"); } -// Pick a reasonable higher bound for local capacity requested -// for EnsureLocalCapacity and PushLocalFrame. We don't want it too -// high because a test (or very unusual application) may try to allocate -// that many handles and run out of swap space. An implementation is -// permitted to allocate more handles than the ensured capacity, so this -// value is set high enough to prevent compatibility problems. -const int MAX_REASONABLE_LOCAL_CAPACITY = 4*K; - - // Wrapper to trace JNI functions #ifdef ASSERT @@ -741,7 +732,8 @@ HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY(env, capacity); //%note jni_11 - if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) { + if (capacity < 0 || + ((MaxJNILocalCapacity > 0) && (capacity > MaxJNILocalCapacity))) { HOTSPOT_JNI_PUSHLOCALFRAME_RETURN((uint32_t)JNI_ERR); return JNI_ERR; } @@ -844,7 +836,8 @@ HOTSPOT_JNI_ENSURELOCALCAPACITY_ENTRY(env, capacity); jint ret; - if (capacity >= 0 && capacity <= MAX_REASONABLE_LOCAL_CAPACITY) { + if (capacity >= 0 && + ((MaxJNILocalCapacity <= 0) || (capacity <= MaxJNILocalCapacity))) { ret = JNI_OK; } else { ret = JNI_ERR; @@ -3893,6 +3886,7 @@ run_unit_test(TestKlass_test()); run_unit_test(TestBitMap_test()); run_unit_test(TestAsUtf8()); + run_unit_test(ObjectMonitor::sanity_checks()); #if INCLUDE_VM_STRUCTS run_unit_test(VMStructs::test()); #endif
--- a/hotspot/src/share/vm/prims/jniCheck.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/prims/jniCheck.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -185,6 +185,9 @@ * throw an ArrayIndexOutOfBoundsException or ArrayStoreException. * * In all other cases, a non-error return value guarantees that no exceptions have been thrown. + * + * Programmers often defend against ArrayIndexOutOfBoundsException, so warning + * for these functions would be pedantic. */ static inline void check_pending_exception(JavaThread* thr) { @@ -201,6 +204,16 @@ } } +/** + * Add to the planned number of handles. I.e. plus current live & warning threshold + */ +static inline void +add_planned_handle_capacity(JNIHandleBlock* handles, size_t capacity) { + handles->set_planned_capacity(capacity + + handles->get_number_of_live_handles() + + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); +} + static inline void functionEnterCritical(JavaThread* thr) @@ -243,7 +256,7 @@ thr->print_stack(); ) // Complain just the once, reset to current + warn threshold - handles->set_planned_capacity(live_handles + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); + add_planned_handle_capacity(handles, 0); } } @@ -720,7 +733,7 @@ NativeReportJNIFatalError(thr, "negative capacity"); jint result = UNCHECKED()->PushLocalFrame(env, capacity); if (result == JNI_OK) { - thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); + add_planned_handle_capacity(thr->active_handles(), capacity); } functionExit(thr); return result; @@ -824,7 +837,7 @@ } jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity); if (result == JNI_OK) { - thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); + add_planned_handle_capacity(thr->active_handles(), capacity); } functionExit(thr); return result; @@ -1628,7 +1641,6 @@ check_is_obj_array(thr, array); ) jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index); - thr->set_pending_jni_exception_check("GetObjectArrayElement"); functionExit(thr); return result; JNI_END @@ -1643,7 +1655,6 @@ check_is_obj_array(thr, array); ) UNCHECKED()->SetObjectArrayElement(env,array,index,val); - thr->set_pending_jni_exception_check("SetObjectArrayElement"); functionExit(thr); JNI_END @@ -1733,7 +1744,6 @@ check_primitive_array_type(thr, array, ElementTag); \ ) \ UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \ - thr->set_pending_jni_exception_check("Get"#Result"ArrayRegion"); \ functionExit(thr); \ JNI_END @@ -1758,7 +1768,6 @@ check_primitive_array_type(thr, array, ElementTag); \ ) \ UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \ - thr->set_pending_jni_exception_check("Set"#Result"ArrayRegion"); \ functionExit(thr); \ JNI_END @@ -1835,7 +1844,6 @@ checkString(thr, str); ) UNCHECKED()->GetStringRegion(env, str, start, len, buf); - thr->set_pending_jni_exception_check("GetStringRegion"); functionExit(thr); JNI_END @@ -1850,7 +1858,6 @@ checkString(thr, str); ) UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf); - thr->set_pending_jni_exception_check("GetStringUTFRegion"); functionExit(thr); JNI_END
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "interpreter/interpreter.hpp" +#include "interpreter/oopMapCache.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" @@ -744,6 +745,13 @@ } void VM_GetOrSetLocal::doit() { + InterpreterOopMap oop_mask; + _jvf->method()->mask_for(_jvf->bci(), &oop_mask); + if (oop_mask.is_dead(_index)) { + // The local can be invalid and uninitialized in the scope of current bci + _result = JVMTI_ERROR_INVALID_SLOT; + return; + } if (_set) { // Force deoptimization of frame if compiled because it's // possible the compiler emitted some locals as constant values,
--- a/hotspot/src/share/vm/runtime/atomic.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/atomic.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -35,6 +35,18 @@ // can provide an alternative action if not - see supports_cx8() for // a means to test availability. + // The memory operations that are mentioned with each of the atomic + // function families come from src/share/vm/runtime/orderAccess.hpp, + // e.g., <fence> is described in that file and is implemented by the + // OrderAccess::fence() function. See that file for the gory details + // on the Memory Access Ordering Model. + + // All of the atomic operations that imply a read-modify-write action + // guarantee a two-way memory barrier across that operation. Historically + // these semantics reflect the strength of atomic operations that are + // provided on SPARC/X86. We assume that strength is necessary unless + // we can prove that a weaker form is sufficiently safe. + // Atomically store to a location inline static void store (jbyte store_value, jbyte* dest); inline static void store (jshort store_value, jshort* dest); @@ -55,7 +67,8 @@ // See comment above about using jlong atomics on 32-bit platforms inline static jlong load(volatile jlong* src); - // Atomically add to a location, return updated value + // Atomically add to a location. Returns updated value. add*() provide: + // <fence> add-value-to-dest <membar StoreLoad|StoreStore> inline static jint add (jint add_value, volatile jint* dest); inline static size_t add (size_t add_value, volatile size_t* dest); inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest); @@ -63,30 +76,35 @@ // See comment above about using jlong atomics on 32-bit platforms static jlong add (jlong add_value, volatile jlong* dest); - // Atomically increment location + // Atomically increment location. inc*() provide: + // <fence> increment-dest <membar StoreLoad|StoreStore> inline static void inc (volatile jint* dest); static void inc (volatile jshort* dest); inline static void inc (volatile size_t* dest); inline static void inc_ptr(volatile intptr_t* dest); inline static void inc_ptr(volatile void* dest); - // Atomically decrement a location + // Atomically decrement a location. dec*() provide: + // <fence> decrement-dest <membar StoreLoad|StoreStore> inline static void dec (volatile jint* dest); static void dec (volatile jshort* dest); inline static void dec (volatile size_t* dest); inline static void dec_ptr(volatile intptr_t* dest); inline static void dec_ptr(volatile void* dest); - // Performs atomic exchange of *dest with exchange_value. Returns old prior value of *dest. + // Performs atomic exchange of *dest with exchange_value. Returns old + // prior value of *dest. xchg*() provide: + // <fence> exchange-value-with-dest <membar StoreLoad|StoreStore> inline static jint xchg(jint exchange_value, volatile jint* dest); static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest); inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest); inline static void* xchg_ptr(void* exchange_value, volatile void* dest); - // Performs atomic compare of *dest and compare_value, and exchanges *dest with exchange_value - // if the comparison succeeded. Returns prior value of *dest. Guarantees a two-way memory - // barrier across the cmpxchg. I.e., it's really a 'fence_cmpxchg_acquire'. + // Performs atomic compare of *dest and compare_value, and exchanges + // *dest with exchange_value if the comparison succeeded. Returns prior + // value of *dest. cmpxchg*() provide: + // <fence> compare-and-exchange <membar StoreLoad|StoreStore> static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); // See comment above about using jlong atomics on 32-bit platforms
--- a/hotspot/src/share/vm/runtime/globals.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/globals.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -1216,6 +1216,11 @@ product(bool, UseFastJNIAccessors, true, \ "Use optimized versions of Get<Primitive>Field") \ \ + product(intx, MaxJNILocalCapacity, 65536, \ + "Maximum allowable local JNI handle capacity to " \ + "EnsureLocalCapacity() and PushLocalFrame(), " \ + "where <= 0 is unlimited, default: 65536") \ + \ product(bool, EagerXrunInit, false, \ "Eagerly initialize -Xrun libraries; allows startup profiling, " \ "but not all -Xrun libraries may support the state of the VM " \
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -2497,6 +2497,10 @@ SETKNOB(FastHSSEC); #undef SETKNOB + if (Knob_Verbose) { + sanity_checks(); + } + if (os::is_MP()) { BackOffMask = (1 << Knob_SpinBackOff) - 1; if (Knob_ReportSettings) ::printf("BackOffMask=%X\n", BackOffMask); @@ -2517,6 +2521,66 @@ InitDone = 1; } +void ObjectMonitor::sanity_checks() { + int error_cnt = 0; + int warning_cnt = 0; + bool verbose = Knob_Verbose != 0 NOT_PRODUCT(|| VerboseInternalVMTests); + + if (verbose) { + tty->print_cr("INFO: sizeof(ObjectMonitor)=" SIZE_FORMAT, + sizeof(ObjectMonitor)); + } + + uint cache_line_size = VM_Version::L1_data_cache_line_size(); + if (verbose) { + tty->print_cr("INFO: L1_data_cache_line_size=%u", cache_line_size); + } + + ObjectMonitor dummy; + u_char *addr_begin = (u_char*)&dummy; + u_char *addr_header = (u_char*)&dummy._header; + u_char *addr_owner = (u_char*)&dummy._owner; + + uint offset_header = (uint)(addr_header - addr_begin); + if (verbose) tty->print_cr("INFO: offset(_header)=%u", offset_header); + + uint offset_owner = (uint)(addr_owner - addr_begin); + if (verbose) tty->print_cr("INFO: offset(_owner)=%u", offset_owner); + + if ((uint)(addr_header - addr_begin) != 0) { + tty->print_cr("ERROR: offset(_header) must be zero (0)."); + error_cnt++; + } + + if (cache_line_size != 0) { + // We were able to determine the L1 data cache line size so + // do some cache line specific sanity checks + + if ((offset_owner - offset_header) < cache_line_size) { + tty->print_cr("WARNING: the _header and _owner fields are closer " + "than a cache line which permits false sharing."); + warning_cnt++; + } + + if ((sizeof(ObjectMonitor) % cache_line_size) != 0) { + tty->print_cr("WARNING: ObjectMonitor size is not a multiple of " + "a cache line which permits false sharing."); + warning_cnt++; + } + } + + ObjectSynchronizer::sanity_checks(verbose, cache_line_size, &error_cnt, + &warning_cnt); + + if (verbose || error_cnt != 0 || warning_cnt != 0) { + tty->print_cr("INFO: error_cnt=%d", error_cnt); + tty->print_cr("INFO: warning_cnt=%d", warning_cnt); + } + + guarantee(error_cnt == 0, + "Fatal error(s) found in ObjectMonitor::sanity_checks()"); +} + #ifndef PRODUCT void ObjectMonitor::verify() { }
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -189,6 +189,8 @@ bool check(TRAPS); // true if the thread owns the monitor. void check_slow(TRAPS); void clear(); + static void sanity_checks(); // public for -XX:+ExecuteInternalVMTests + // in PRODUCT for -XX:SyncKnobs=Verbose=1 #ifndef PRODUCT void verify(); void print(); @@ -234,8 +236,6 @@ // WARNING: this must be the very first word of ObjectMonitor // This means this class can't use any virtual member functions. - // TODO-FIXME: assert that offsetof(_header) is 0 or get rid of the - // implicit 0 offset in emitted code. volatile markOop _header; // displaced object header word - mark void* volatile _object; // backward object pointer - strong root
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -392,19 +392,22 @@ // Hash Code handling // // Performance concern: -// OrderAccess::storestore() calls release() which STs 0 into the global volatile -// OrderAccess::Dummy variable. This store is unnecessary for correctness. -// Many threads STing into a common location causes considerable cache migration -// or "sloshing" on large SMP system. As such, I avoid using OrderAccess::storestore() -// until it's repaired. In some cases OrderAccess::fence() -- which incurs local -// latency on the executing processor -- is a better choice as it scales on SMP -// systems. See http://blogs.sun.com/dave/entry/biased_locking_in_hotspot for a -// discussion of coherency costs. Note that all our current reference platforms -// provide strong ST-ST order, so the issue is moot on IA32, x64, and SPARC. +// OrderAccess::storestore() calls release() which at one time stored 0 +// into the global volatile OrderAccess::dummy variable. This store was +// unnecessary for correctness. Many threads storing into a common location +// causes considerable cache migration or "sloshing" on large SMP systems. +// As such, I avoided using OrderAccess::storestore(). In some cases +// OrderAccess::fence() -- which incurs local latency on the executing +// processor -- is a better choice as it scales on SMP systems. +// +// See http://blogs.oracle.com/dave/entry/biased_locking_in_hotspot for +// a discussion of coherency costs. Note that all our current reference +// platforms provide strong ST-ST order, so the issue is moot on IA32, +// x64, and SPARC. // // As a general policy we use "volatile" to control compiler-based reordering -// and explicit fences (barriers) to control for architectural reordering performed -// by the CPU(s) or platform. +// and explicit fences (barriers) to control for architectural reordering +// performed by the CPU(s) or platform. struct SharedGlobals { // These are highly shared mostly-read variables. @@ -1596,7 +1599,55 @@ } //------------------------------------------------------------------------------ -// Non-product code +// Debugging code + +void ObjectSynchronizer::sanity_checks(const bool verbose, + const uint cache_line_size, + int *error_cnt_ptr, + int *warning_cnt_ptr) { + u_char *addr_begin = (u_char*)&GVars; + u_char *addr_stwRandom = (u_char*)&GVars.stwRandom; + u_char *addr_hcSequence = (u_char*)&GVars.hcSequence; + + if (verbose) { + tty->print_cr("INFO: sizeof(SharedGlobals)=" SIZE_FORMAT, + sizeof(SharedGlobals)); + } + + uint offset_stwRandom = (uint)(addr_stwRandom - addr_begin); + if (verbose) tty->print_cr("INFO: offset(stwRandom)=%u", offset_stwRandom); + + uint offset_hcSequence = (uint)(addr_hcSequence - addr_begin); + if (verbose) { + tty->print_cr("INFO: offset(_hcSequence)=%u", offset_hcSequence); + } + + if (cache_line_size != 0) { + // We were able to determine the L1 data cache line size so + // do some cache line specific sanity checks + + if (offset_stwRandom < cache_line_size) { + tty->print_cr("WARNING: the SharedGlobals.stwRandom field is closer " + "to the struct beginning than a cache line which permits " + "false sharing."); + (*warning_cnt_ptr)++; + } + + if ((offset_hcSequence - offset_stwRandom) < cache_line_size) { + tty->print_cr("WARNING: the SharedGlobals.stwRandom and " + "SharedGlobals.hcSequence fields are closer than a cache " + "line which permits false sharing."); + (*warning_cnt_ptr)++; + } + + if ((sizeof(SharedGlobals) - offset_hcSequence) < cache_line_size) { + tty->print_cr("WARNING: the SharedGlobals.hcSequence field is closer " + "to the struct end than a cache line which permits false " + "sharing."); + (*warning_cnt_ptr)++; + } + } +} #ifndef PRODUCT
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/synchronizer.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -121,6 +121,9 @@ static void oops_do(OopClosure* f); // debugging + static void sanity_checks(const bool verbose, + const unsigned int cache_line_size, + int *error_cnt_ptr, int *warning_cnt_ptr); static void verify() PRODUCT_RETURN; static int verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
--- a/hotspot/src/share/vm/runtime/vm_version.cpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/vm_version.cpp Tue Aug 05 12:14:11 2014 -0700 @@ -50,6 +50,7 @@ bool Abstract_VM_Version::_supports_atomic_getadd4 = false; bool Abstract_VM_Version::_supports_atomic_getadd8 = false; unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U; +unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0; int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0; #ifndef HOTSPOT_RELEASE_VERSION
--- a/hotspot/src/share/vm/runtime/vm_version.hpp Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/src/share/vm/runtime/vm_version.hpp Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -42,6 +42,7 @@ static bool _supports_atomic_getadd4; static bool _supports_atomic_getadd8; static unsigned int _logical_processors_per_package; + static unsigned int _L1_data_cache_line_size; static int _vm_major_version; static int _vm_minor_version; static int _vm_micro_version; @@ -98,6 +99,10 @@ return _logical_processors_per_package; } + static unsigned int L1_data_cache_line_size() { + return _L1_data_cache_line_size; + } + // Need a space at the end of TLAB for prefetch instructions // which may fault when accessing memory outside of heap. static int reserve_for_allocation_prefetch() {
--- a/hotspot/test/Makefile Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/Makefile Tue Aug 05 12:14:11 2014 -0700 @@ -23,14 +23,36 @@ # # -# Makefile to run various jdk tests +# Makefile to run various hotspot tests # GETMIXEDPATH=echo -# Get OS/ARCH specifics -OSNAME = $(shell uname -s) -ifeq ($(OSNAME), SunOS) +# Utilities used +AWK = awk +CAT = cat +CD = cd +CHMOD = chmod +CP = cp +CUT = cut +DIRNAME = dirname +ECHO = echo +EGREP = egrep +EXPAND = expand +FIND = find +MKDIR = mkdir +PWD = pwd +SED = sed +SORT = sort +TEE = tee +UNAME = uname +UNIQ = uniq +WC = wc +ZIP = zip + +# Get OS name from uname (Cygwin inexplicably adds _NT-5.1) +UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_) +ifeq ($(UNAME_S), SunOS) PLATFORM = solaris SLASH_JAVA = /java ARCH = $(shell uname -p) @@ -38,7 +60,7 @@ ARCH=i586 endif endif -ifeq ($(OSNAME), Linux) +ifeq ($(UNAME_S), Linux) PLATFORM = linux SLASH_JAVA = /java ARCH = $(shell uname -m) @@ -46,7 +68,7 @@ ARCH = i586 endif endif -ifeq ($(OSNAME), Darwin) +ifeq ($(UNAME_S), Darwin) PLATFORM = bsd SLASH_JAVA = /java ARCH = $(shell uname -m) @@ -54,7 +76,7 @@ ARCH = i586 endif endif -ifeq ($(findstring BSD,$(OSNAME)), BSD) +ifeq ($(findstring BSD,$(UNAME_S)), BSD) PLATFORM = bsd SLASH_JAVA = /java ARCH = $(shell uname -m) @@ -63,12 +85,12 @@ endif endif ifeq ($(PLATFORM),) - # detect wether we're running in MKS or cygwin - ifeq ($(OSNAME), Windows_NT) # MKS + # detect whether we're running in MKS or cygwin + ifeq ($(UNAME_S), Windows_NT) # MKS GETMIXEDPATH=dosname -s endif - ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN) - GETMIXEDPATH=cygpath -m -s + ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) + GETMIXEDPATH=cygpath -m endif PLATFORM = windows SLASH_JAVA = J: @@ -92,13 +114,6 @@ SLASH_JAVA = $(ALT_SLASH_JAVA) endif -# Utilities used -CD = cd -CP = cp -ECHO = echo -MKDIR = mkdir -ZIP = zip - # Root of this test area (important to use full paths in some places) TEST_ROOT := $(shell pwd) @@ -136,21 +151,82 @@ endif # How to create the test bundle (pass or fail, we want to create this) -BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ - && $(CD) $(ABS_TEST_OUTPUT_DIR) \ - && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) -BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) +# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed. +ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \ + && $(CD) $(ABS_TEST_OUTPUT_DIR) \ + && $(CHMOD) -R a+r . \ + && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) + +# important results files +SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt") +STATS_TXT_NAME = Stats.txt +STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)") +RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt") +PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt") +FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt") +EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt") + +TESTEXIT = \ + if [ ! -s $(EXITCODE) ] ; then \ + $(ECHO) "ERROR: EXITCODE file not filled in."; \ + $(ECHO) "1" > $(EXITCODE); \ + fi ; \ + testExitCode=`$(CAT) $(EXITCODE)`; \ + $(ECHO) "EXIT CODE: $${testExitCode}"; \ + exit $${testExitCode} + +BUNDLE_UP_AND_EXIT = \ +( \ + jtregExitCode=$$? && \ + _summary="$(SUMMARY_TXT)"; \ + $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \ + $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \ + if [ -r "$${_summary}" ] ; then \ + $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \ + $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \ + $(EGREP) ' Passed\.' $(RUNLIST) \ + | $(EGREP) -v ' Error\.' \ + | $(EGREP) -v ' Failed\.' > $(PASSLIST); \ + ( $(EGREP) ' Failed\.' $(RUNLIST); \ + $(EGREP) ' Error\.' $(RUNLIST); \ + $(EGREP) -v ' Passed\.' $(RUNLIST) ) \ + | $(SORT) | $(UNIQ) > $(FAILLIST); \ + if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \ + $(EXPAND) $(FAILLIST) \ + | $(CUT) -d' ' -f1 \ + | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \ + if [ $${jtregExitCode} = 0 ] ; then \ + jtregExitCode=1; \ + fi; \ + fi; \ + runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ + passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ + failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ + exclc="FIXME CODETOOLS-7900176"; \ + $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \ + >> $(STATS_TXT); \ + else \ + $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ + fi; \ + if [ -f $(STATS_TXT) ] ; then \ + $(CAT) $(STATS_TXT); \ + fi; \ + $(ZIP_UP_RESULTS) ; \ + $(TESTEXIT) \ +) ################################################################ # Default make rule (runs jtreg_tests) -all: jtreg_tests +all: hotspot_all @$(ECHO) "Testing completed successfully" -# Support "hotspot_" prefixed test make targets too -# The hotspot_% targets are for example invoked by the top level Makefile +# Support "hotspot_" prefixed test make targets (too) +# The hotspot_% targets are used by the top level Makefile +# Unless explicitly defined below, hotspot_<x> is interpreted as a jtreg test group name hotspot_%: - $(MAKE) $* + $(ECHO) "Running tests: $@" + $(MAKE) -j 1 TEST_SELECTION=":$@" UNIQUE_DIR=$@ jtreg_tests; # Prep for output prep: clean @@ -168,41 +244,64 @@ # Expect JT_HOME to be set for jtreg tests. (home for jtreg) ifndef JT_HOME - JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg -endif -ifdef JPRT_JTREG_HOME - JT_HOME = $(JPRT_JTREG_HOME) + JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg + ifdef JPRT_JTREG_HOME + JT_HOME = $(JPRT_JTREG_HOME) + endif endif -# Expect JPRT to set TESTDIRS to the jtreg test dirs -JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof +# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run ifdef TESTDIRS - JTREG_TESTDIRS = $(TESTDIRS) + TEST_SELECTION = $(TESTDIRS) +endif + +ifdef CONCURRENCY + EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY) endif # Default JTREG to run (win32 script works for everybody) JTREG = $(JT_HOME)/win32/bin/jtreg +# Only run automatic tests +JTREG_BASIC_OPTIONS += -a +# Report details on all failed or error tests, times too +JTREG_BASIC_OPTIONS += -v:fail,error,time +# Retain all files for failing tests +JTREG_BASIC_OPTIONS += -retain:fail,error +# Ignore tests are not run and completely silent about it +JTREG_IGNORE_OPTION = -ignore:quiet +JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) +# Add any extra options +JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) +# Set other vm and test options +JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%) + # Option to tell jtreg to not run tests marked with "ignore" ifeq ($(PLATFORM), windows) JTREG_KEY_OPTION = -k:!ignore else JTREG_KEY_OPTION = -k:\!ignore endif +JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION) -#EXTRA_JTREG_OPTIONS = +# Make sure jtreg exists +$(JTREG): $(JT_HOME) -jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) - $(JTREG) -a -v:fail,error \ - $(JTREG_KEY_OPTION) \ - $(EXTRA_JTREG_OPTIONS) \ - -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ - -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ - -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ - $(JAVA_OPTIONS:%=-vmoption:%) \ - $(JTREG_TESTDIRS) \ - || $(BUNDLE_UP_FAILED) - $(BUNDLE_UP) +jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) + ( \ + ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \ + export JT_HOME; \ + $(shell $(GETMIXEDPATH) "$(JTREG)") \ + $(JTREG_BASIC_OPTIONS) \ + -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \ + -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \ + -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ + $(JTREG_EXCLUSIONS) \ + $(JTREG_TEST_OPTIONS) \ + $(TEST_SELECTION) \ + ) ; \ + $(BUNDLE_UP_AND_EXIT) \ + ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT) PHONY_LIST += jtreg_tests @@ -210,7 +309,7 @@ # clienttest (make sure various basic java client options work) -clienttest: prep $(PRODUCT_HOME) +hotspot_clienttest clienttest: prep $(PRODUCT_HOME) $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X @@ -218,73 +317,27 @@ $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump -PHONY_LIST += clienttest +PHONY_LIST += hotspot_clienttest clienttest ################################################################ # servertest (make sure various basic java server options work) -servertest: prep $(PRODUCT_HOME) +hotspot_servertest servertest: prep $(PRODUCT_HOME) $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X -PHONY_LIST += servertest +PHONY_LIST += hotspot_servertest servertest ################################################################ # internalvmtests (run internal unit tests inside the VM) -internalvmtests: prep $(PRODUCT_HOME) +hotspot_internalvmtests internalvmtests: prep $(PRODUCT_HOME) $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version -PHONY_LIST += internalvmtests - -################################################################ - -# wbapitest (make sure the whitebox testing api classes work - -wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) - $(JTREG) -a -v:fail,error \ - $(JTREG_KEY_OPTION) \ - $(EXTRA_JTREG_OPTIONS) \ - -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ - -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ - -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ - $(JAVA_OPTIONS:%=-vmoption:%) \ - $(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity \ - || $(BUNDLE_UP_FAILED) - $(BUNDLE_UP) - -PHONY_LIST += wbapitest - -################################################################ - -# packtest - -# Expect JPRT to set JPRT_PACKTEST_HOME. -PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest -ifdef JPRT_PACKTEST_HOME - PACKTEST_HOME = $(JPRT_PACKTEST_HOME) -endif - -#EXTRA_PACKTEST_OPTIONS = - -packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) - ( $(CD) $(PACKTEST_HOME) && \ - $(PACKTEST_HOME)/ptest \ - -t "$(PRODUCT_HOME)" \ - $(PACKTEST_STRESS_OPTION) \ - $(EXTRA_PACKTEST_OPTIONS) \ - -W $(ABS_TEST_OUTPUT_DIR) \ - $(JAVA_OPTIONS:%=-J %) \ - ) || $(BUNDLE_UP_FAILED) - $(BUNDLE_UP) - -packtest_stress: PACKTEST_STRESS_OPTION=-s -packtest_stress: packtest - -PHONY_LIST += packtest packtest_stress +PHONY_LIST += hotspot_internalvmtests internalvmtests ################################################################ @@ -292,4 +345,3 @@ .PHONY: all clean prep $(PHONY_LIST) ################################################################ -
--- a/hotspot/test/TEST.groups Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/TEST.groups Tue Aug 05 12:14:11 2014 -0700 @@ -271,6 +271,7 @@ gc/arguments/TestCMSHeapSizeFlags.java \ gc/arguments/TestMaxNewSize.java \ gc/arguments/TestUseCompressedOopsErgo.java \ + gc/class_unloading/TestCMSClassUnloadingDisabledHWM.java \ gc/concurrentMarkSweep/ \ gc/startup_warnings/TestCMS.java \ gc/startup_warnings/TestCMSIncrementalMode.java \ @@ -325,3 +326,24 @@ -:needs_parallelgc +# When called from top level the test suites use the hotspot_ prefix +hotspot_wbapitest = \ + sanity/ + +hotspot_compiler = \ + sanity/ExecuteInternalVMTests.java + +hotspot_gc = \ + sanity/ExecuteInternalVMTests.java + +hotspot_runtime = \ + sanity/ExecuteInternalVMTests.java + +hotspot_serviceability = \ + sanity/ExecuteInternalVMTests.java + +hotspot_all = \ + :hotspot_compiler \ + :hotspot_gc \ + :hotspot_runtime \ + :hotspot_serviceability
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2014, 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 8031752 + * @summary speculative traps need to be cleaned up at GC + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx512M TestSpecTrapClassUnloading + * + */ + +import java.lang.reflect.Method; + +public class TestSpecTrapClassUnloading { + static class B { + final public boolean m(Object o) { + if (o.getClass() == B.class) { + return true; + } + return false; + } + } + + static class MemoryChunk { + MemoryChunk other; + long[] array; + MemoryChunk(MemoryChunk other) { + this.other = other; + array = new long[1024 * 1024 * 1024]; + } + } + + static void m1(B b, Object o) { + b.m(o); + } + + static void m2(B b, Object o) { + b.m(o); + } + + public static void main(String[] args) throws Exception { + Method m = B.class.getMethod("m", Object.class); + Object o = new Object(); + B b = new B(); + + // add speculative trap in B.m() for m1 + for (int i = 0; i < 20000; i++) { + m1(b, b); + } + m1(b, o); + + // add speculative trap in B.m() for code generated by reflection + for (int i = 0; i < 20000; i++) { + m.invoke(b, b); + } + m.invoke(b, o); + + m = null; + + // add speculative trap in B.m() for m2 + for (int i = 0; i < 20000; i++) { + m2(b, b); + } + m2(b, o); + + // Exhaust memory which causes the code generated by + // reflection to be unloaded but B.m() is not. + MemoryChunk root = null; + try { + while (true) { + root = new MemoryChunk(root); + } + } catch(OutOfMemoryError e) { + root = null; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/A.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,4 @@ +public class A { + void m() { + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2014, 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.security.*; +import java.lang.instrument.*; +import java.lang.reflect.*; +import java.lang.management.ManagementFactory; +import com.sun.tools.attach.VirtualMachine; +import java.lang.reflect.*; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Paths; + +public class Agent implements ClassFileTransformer { + public static ClassLoader newClassLoader() { + try { + return new URLClassLoader(new URL[] { + Paths.get(System.getProperty("test.classes",".")).toUri().toURL(), + }, null); + } catch (MalformedURLException e){ + throw new RuntimeException("Unexpected URL conversion failure", e); + } + } + + static public Class Test_class; + + static public void main(String[] args) throws Exception { + + // loader2 must be first on the list so loader 1 must be used first + ClassLoader loader1 = newClassLoader(); + Class dummy = loader1.loadClass("Test"); + + ClassLoader loader2 = newClassLoader(); + + Test_class = loader2.loadClass("Test"); + Method m3 = Test_class.getMethod("m3", ClassLoader.class); + // Add speculative trap in m2() (loaded by loader1) that + // references m4() (loaded by loader2). + m3.invoke(Test_class.newInstance(), loader1); + + String nameOfRunningVM = ManagementFactory.getRuntimeMXBean().getName(); + int p = nameOfRunningVM.indexOf('@'); + String pid = nameOfRunningVM.substring(0, p); + + // Make the nmethod go away + for (int i = 0; i < 10; i++) { + System.gc(); + } + + // Redefine class Test loaded by loader2 + for (int i = 0; i < 2; i++) { + try { + VirtualMachine vm = VirtualMachine.attach(pid); + vm.loadAgent(System.getProperty("test.classes",".") + "/agent.jar", ""); + vm.detach(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + // Will process loader2 first, find m4() is redefined and + // needs to be freed then process loader1, check the + // speculative trap in m2() and try to access m4() which was + // freed already. + for (int i = 0; i < 10; i++) { + System.gc(); + } + } + + public synchronized byte[] transform(final ClassLoader classLoader, + final String className, + Class<?> classBeingRedefined, + ProtectionDomain protectionDomain, + byte[] classfileBuffer) { + System.out.println("Transforming class " + className + " "+ classLoader); + return classfileBuffer; + } + + public static void redefine(String agentArgs, Instrumentation instrumentation, Class to_redefine) { + + try { + instrumentation.retransformClasses(to_redefine); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void agentmain(String agentArgs, Instrumentation instrumentation) throws Exception { + Agent transformer = new Agent(); + instrumentation.addTransformer(transformer, true); + + redefine(agentArgs, instrumentation, Test_class); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/B.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,5 @@ +public class B extends A { + void m() { + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014, 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.PrintWriter; +import com.oracle.java.testlibrary.*; + +/* + * @test + * @bug 8040237 + * @library /testlibrary + * @build Agent Test A B + * @run main ClassFileInstaller Agent + * @run main Launcher + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent + */ +public class Launcher { + public static void main(String[] args) throws Exception { + + PrintWriter pw = new PrintWriter("MANIFEST.MF"); + pw.println("Agent-Class: Agent"); + pw.println("Can-Retransform-Classes: true"); + pw.close(); + + ProcessBuilder pb = new ProcessBuilder(); + pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", System.getProperty("test.classes",".") + "/agent.jar", "Agent.class"}); + pb.start().waitFor(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Test.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,50 @@ +import java.lang.reflect.*; + +public class Test { + + public boolean m1(A a, Boolean early_return) { + if (early_return.booleanValue()) return true; + boolean res = m2(a); + return res; + } + + public boolean m2(A a) { + boolean res = false; + if (a.getClass() == B.class) { + a.m(); + } else { + res = true; + } + return res; + } + + public void m3(ClassLoader loader) throws Exception { + Class Test_class = loader.loadClass("Test"); + Object test = Test_class.newInstance(); + Class A_class = loader.loadClass("A"); + Object a = A_class.newInstance(); + Class B_class = loader.loadClass("B"); + Object b = B_class.newInstance(); + Method m1 = Test_class.getMethod("m1", A_class, Boolean.class); + + // So we don't hit uncommon trap in the next loop + for (int i = 0; i < 4000; i++) { + m4(m1, test, a, Boolean.TRUE); + m4(m1, test, b, Boolean.TRUE); + } + for (int i = 0; i < 20000; i++) { + m4(m1, test, a, Boolean.FALSE); + } + for (int i = 0; i < 4; i++) { + m4(m1, test, b, Boolean.FALSE); + } + } + + public Object m4(Method m, Object test, Object a, Object early_return) throws Exception { + return m.invoke(test, a, early_return); + } + + static public A a = new A(); + static public B b = new B(); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/stable/StableConfiguration.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.lang.invoke; + +import java.lang.reflect.Method; +import java.util.Properties; +import sun.hotspot.WhiteBox; + +public class StableConfiguration { + static final WhiteBox WB = WhiteBox.getWhiteBox(); + static final boolean isStableEnabled; + static final boolean isServerWithStable; + + static { + Boolean value = WB.getBooleanVMFlag("FoldStableValues"); + isStableEnabled = (value == null ? false : value); + isServerWithStable = isStableEnabled && get(); + System.out.println("@Stable: " + (isStableEnabled ? "enabled" : "disabled")); + System.out.println("Server Compiler: " + get()); + } + + // ::get() is among immediately compiled methods. + static boolean get() { + try { + Method m = StableConfiguration.class.getDeclaredMethod("get"); + int level = WB.getMethodCompilationLevel(m); + if (level > 0) { + return (level == 4); + } else { + String javaVM = System.getProperty("java.vm.name", ""); + if (javaVM.contains("Server")) return true; + if (javaVM.contains("Client")) return false; + throw new Error("Unknown VM type: "+javaVM); + } + } catch (NoSuchMethodException e) { + throw new Error(e); + } + } + +}
--- a/hotspot/test/compiler/stable/TestStableBoolean.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableBoolean.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableBoolean * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableBoolean.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableBoolean StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableBoolean * java/lang/invoke/TestStableBoolean$BooleanStable * java/lang/invoke/TestStableBoolean$StaticBooleanStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableBoolean$NestedStableField3 * java/lang/invoke/TestStableBoolean$NestedStableField3$A * java/lang/invoke/TestStableBoolean$DefaultValue + * java/lang/invoke/TestStableBoolean$DefaultStaticValue * java/lang/invoke/TestStableBoolean$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableBoolean + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableBoolean * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableBoolean + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableBoolean * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableBoolean - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableBoolean */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableBoolean { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(BooleanStable.class); + run(DefaultStaticValue.class); run(StaticBooleanStable.class); run(VolatileBooleanStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable boolean v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static boolean get() { return c.v; } + public static void test() throws Exception { + boolean val1 = get(); + c.v = true; boolean val2 = get(); + assertEquals(val1, false); + assertEquals(val2, true); + } + } + + /* ==================================================== */ + static class StaticBooleanStable { public static @Stable boolean v; @@ -188,14 +219,14 @@ c.v = new boolean[1]; c.v[0] = true; boolean val1 = get(); c.v[0] = false; boolean val2 = get(); assertEquals(val1, true); - assertEquals(val2, (isStableEnabled ? true : false)); + assertEquals(val2, (isServerWithStable ? true : false)); } { c.v = new boolean[20]; c.v[10] = true; boolean val1 = get1(); c.v[10] = false; boolean val2 = get1(); assertEquals(val1, true); - assertEquals(val2, (isStableEnabled ? true : false)); + assertEquals(val2, (isServerWithStable ? true : false)); } { @@ -220,19 +251,19 @@ c.v = new boolean[1][1]; c.v[0][0] = true; boolean val1 = get(); c.v[0][0] = false; boolean val2 = get(); assertEquals(val1, true); - assertEquals(val2, (isStableEnabled ? true : false)); + assertEquals(val2, (isServerWithStable ? true : false)); c.v = new boolean[1][1]; c.v[0][0] = false; boolean val3 = get(); - assertEquals(val3, (isStableEnabled ? true : false)); + assertEquals(val3, (isServerWithStable ? true : false)); c.v[0] = new boolean[1]; c.v[0][0] = false; boolean val4 = get(); - assertEquals(val4, (isStableEnabled ? true : false)); + assertEquals(val4, (isServerWithStable ? true : false)); } { c.v = new boolean[1][1]; boolean[] val1 = get1(); c.v[0] = new boolean[1]; boolean[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -258,28 +289,28 @@ c.v = new boolean[1][1][1]; c.v[0][0][0] = true; boolean val1 = get(); c.v[0][0][0] = false; boolean val2 = get(); assertEquals(val1, true); - assertEquals(val2, (isStableEnabled ? true : false)); + assertEquals(val2, (isServerWithStable ? true : false)); c.v = new boolean[1][1][1]; c.v[0][0][0] = false; boolean val3 = get(); - assertEquals(val3, (isStableEnabled ? true : false)); + assertEquals(val3, (isServerWithStable ? true : false)); c.v[0] = new boolean[1][1]; c.v[0][0][0] = false; boolean val4 = get(); - assertEquals(val4, (isStableEnabled ? true : false)); + assertEquals(val4, (isServerWithStable ? true : false)); c.v[0][0] = new boolean[1]; c.v[0][0][0] = false; boolean val5 = get(); - assertEquals(val5, (isStableEnabled ? true : false)); + assertEquals(val5, (isServerWithStable ? true : false)); } { c.v = new boolean[1][1][1]; boolean[] val1 = get1(); c.v[0][0] = new boolean[1]; boolean[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new boolean[1][1][1]; boolean[][] val1 = get2(); c.v[0] = new boolean[1][1]; boolean[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -306,37 +337,37 @@ c.v = new boolean[1][1][1][1]; c.v[0][0][0][0] = true; boolean val1 = get(); c.v[0][0][0][0] = false; boolean val2 = get(); assertEquals(val1, true); - assertEquals(val2, (isStableEnabled ? true : false)); + assertEquals(val2, (isServerWithStable ? true : false)); c.v = new boolean[1][1][1][1]; c.v[0][0][0][0] = false; boolean val3 = get(); - assertEquals(val3, (isStableEnabled ? true : false)); + assertEquals(val3, (isServerWithStable ? true : false)); c.v[0] = new boolean[1][1][1]; c.v[0][0][0][0] = false; boolean val4 = get(); - assertEquals(val4, (isStableEnabled ? true : false)); + assertEquals(val4, (isServerWithStable ? true : false)); c.v[0][0] = new boolean[1][1]; c.v[0][0][0][0] = false; boolean val5 = get(); - assertEquals(val5, (isStableEnabled ? true : false)); + assertEquals(val5, (isServerWithStable ? true : false)); c.v[0][0][0] = new boolean[1]; c.v[0][0][0][0] = false; boolean val6 = get(); - assertEquals(val6, (isStableEnabled ? true : false)); + assertEquals(val6, (isServerWithStable ? true : false)); } { c.v = new boolean[1][1][1][1]; boolean[] val1 = get1(); c.v[0][0][0] = new boolean[1]; boolean[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new boolean[1][1][1][1]; boolean[][] val1 = get2(); c.v[0][0] = new boolean[1][1]; boolean[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new boolean[1][1][1][1]; boolean[][][] val1 = get3(); c.v[0] = new boolean[1][1][1]; boolean[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -399,7 +430,7 @@ c.v = new boolean[1][1]; c.v[0] = new boolean[0]; boolean[] val1 = get1(); c.v[0] = new boolean[0]; boolean[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -435,14 +466,14 @@ c.v = new boolean[1][1][1]; c.v[0][0] = new boolean[0]; boolean[] val1 = get1(); c.v[0][0] = new boolean[0]; boolean[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new boolean[1][1][1]; c.v[0] = new boolean[0][0]; boolean[][] val1 = get2(); c.v[0] = new boolean[0][0]; boolean[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -577,7 +608,7 @@ elem.a = false; boolean val3 = get(); boolean val4 = get1(); assertEquals(val1, true); - assertEquals(val3, (isStableEnabled ? true : false)); + assertEquals(val3, (isServerWithStable ? true : false)); assertEquals(val2, true); assertEquals(val4, false); @@ -611,17 +642,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableByte.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableByte.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableByte * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableByte.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableByte StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableByte * java/lang/invoke/TestStableByte$ByteStable * java/lang/invoke/TestStableByte$StaticByteStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableByte$NestedStableField3 * java/lang/invoke/TestStableByte$NestedStableField3$A * java/lang/invoke/TestStableByte$DefaultValue + * java/lang/invoke/TestStableByte$DefaultStaticValue * java/lang/invoke/TestStableByte$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableByte + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableByte * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableByte + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableByte * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableByte - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableByte */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableByte { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(ByteStable.class); + run(DefaultStaticValue.class); run(StaticByteStable.class); run(VolatileByteStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable byte v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static byte get() { return c.v; } + public static void test() throws Exception { + byte val1 = get(); + c.v = 1; byte val2 = get(); + assertEquals(val1, 0); + assertEquals(val2, 1); + } + } + + /* ==================================================== */ + static class StaticByteStable { public static @Stable byte v; @@ -188,20 +219,22 @@ c.v = new byte[1]; c.v[0] = 1; byte val1 = get(); c.v[0] = 2; byte val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new byte[1]; c.v[0] = 3; byte val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { c.v = new byte[20]; c.v[10] = 1; byte val1 = get1(); c.v[10] = 2; byte val2 = get1(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new byte[20]; c.v[10] = 3; byte val3 = get1(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { @@ -226,19 +259,21 @@ c.v = new byte[1][1]; c.v[0][0] = 1; byte val1 = get(); c.v[0][0] = 2; byte val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new byte[1][1]; c.v[0][0] = 3; byte val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new byte[1]; c.v[0][0] = 4; byte val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); } { c.v = new byte[1][1]; byte[] val1 = get1(); c.v[0] = new byte[1]; byte[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new byte[1][1][1]; c.v[0][0][0] = 1; byte val1 = get(); c.v[0][0][0] = 2; byte val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new byte[1][1][1]; c.v[0][0][0] = 3; byte val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new byte[1][1]; c.v[0][0][0] = 4; byte val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new byte[1]; c.v[0][0][0] = 5; byte val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); } { c.v = new byte[1][1][1]; byte[] val1 = get1(); c.v[0][0] = new byte[1]; byte[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new byte[1][1][1]; byte[][] val1 = get2(); c.v[0] = new byte[1][1]; byte[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new byte[1][1][1][1]; c.v[0][0][0][0] = 1; byte val1 = get(); c.v[0][0][0][0] = 2; byte val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new byte[1][1][1][1]; c.v[0][0][0][0] = 3; byte val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new byte[1][1][1]; c.v[0][0][0][0] = 4; byte val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new byte[1][1]; c.v[0][0][0][0] = 5; byte val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); c.v[0][0][0] = new byte[1]; c.v[0][0][0][0] = 6; byte val6 = get(); - assertEquals(val6, (isStableEnabled ? 1 : 6)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 6)); } { c.v = new byte[1][1][1][1]; byte[] val1 = get1(); c.v[0][0][0] = new byte[1]; byte[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new byte[1][1][1][1]; byte[][] val1 = get2(); c.v[0][0] = new byte[1][1]; byte[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new byte[1][1][1][1]; byte[][][] val1 = get3(); c.v[0] = new byte[1][1][1]; byte[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -404,7 +446,7 @@ c.v = new byte[1][1]; c.v[0] = new byte[0]; byte[] val1 = get1(); c.v[0] = new byte[0]; byte[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -440,14 +482,14 @@ c.v = new byte[1][1][1]; c.v[0][0] = new byte[0]; byte[] val1 = get1(); c.v[0][0] = new byte[0]; byte[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new byte[1][1][1]; c.v[0] = new byte[0][0]; byte[][] val1 = get2(); c.v[0] = new byte[0][0]; byte[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -582,7 +624,7 @@ elem.a = 2; byte val3 = get(); byte val4 = get1(); assertEquals(val1, 1); - assertEquals(val3, (isStableEnabled ? 1 : 2)); + assertEquals(val3, (isServerWithStable ? 1 : 2)); assertEquals(val2, 1); assertEquals(val4, 2); @@ -616,17 +658,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableChar.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableChar.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableChar * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableChar.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableChar StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableChar * java/lang/invoke/TestStableChar$CharStable * java/lang/invoke/TestStableChar$StaticCharStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableChar$NestedStableField3 * java/lang/invoke/TestStableChar$NestedStableField3$A * java/lang/invoke/TestStableChar$DefaultValue + * java/lang/invoke/TestStableChar$DefaultStaticValue * java/lang/invoke/TestStableChar$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableChar + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableChar * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableChar + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableChar * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableChar - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableChar */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableChar { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(CharStable.class); + run(DefaultStaticValue.class); run(StaticCharStable.class); run(VolatileCharStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable char v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static char get() { return c.v; } + public static void test() throws Exception { + char val1 = get(); + c.v = 'a'; char val2 = get(); + assertEquals(val1, 0); + assertEquals(val2, 'a'); + } + } + + /* ==================================================== */ + static class StaticCharStable { public @Stable char v; @@ -188,20 +219,22 @@ c.v = new char[1]; c.v[0] = 'a'; char val1 = get(); c.v[0] = 'b'; char val2 = get(); assertEquals(val1, 'a'); - assertEquals(val2, (isStableEnabled ? 'a' : 'b')); + assertEquals(val2, (isServerWithStable ? 'a' : 'b')); c.v = new char[1]; c.v[0] = 'c'; char val3 = get(); - assertEquals(val3, (isStableEnabled ? 'a' : 'c')); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'c')); } { c.v = new char[20]; c.v[10] = 'a'; char val1 = get1(); c.v[10] = 'b'; char val2 = get1(); assertEquals(val1, 'a'); - assertEquals(val2, (isStableEnabled ? 'a' : 'b')); + assertEquals(val2, (isServerWithStable ? 'a' : 'b')); c.v = new char[20]; c.v[10] = 'c'; char val3 = get1(); - assertEquals(val3, (isStableEnabled ? 'a' : 'c')); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'c')); } { @@ -226,19 +259,21 @@ c.v = new char[1][1]; c.v[0][0] = 'a'; char val1 = get(); c.v[0][0] = 'b'; char val2 = get(); assertEquals(val1, 'a'); - assertEquals(val2, (isStableEnabled ? 'a' : 'b')); + assertEquals(val2, (isServerWithStable ? 'a' : 'b')); c.v = new char[1][1]; c.v[0][0] = 'c'; char val3 = get(); - assertEquals(val3, (isStableEnabled ? 'a' : 'c')); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'c')); c.v[0] = new char[1]; c.v[0][0] = 'd'; char val4 = get(); - assertEquals(val4, (isStableEnabled ? 'a' : 'd')); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'd')); } { c.v = new char[1][1]; char[] val1 = get1(); c.v[0] = new char[1]; char[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new char[1][1][1]; c.v[0][0][0] = 'a'; char val1 = get(); c.v[0][0][0] = 'b'; char val2 = get(); assertEquals(val1, 'a'); - assertEquals(val2, (isStableEnabled ? 'a' : 'b')); + assertEquals(val2, (isServerWithStable ? 'a' : 'b')); c.v = new char[1][1][1]; c.v[0][0][0] = 'c'; char val3 = get(); - assertEquals(val3, (isStableEnabled ? 'a' : 'c')); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'c')); c.v[0] = new char[1][1]; c.v[0][0][0] = 'd'; char val4 = get(); - assertEquals(val4, (isStableEnabled ? 'a' : 'd')); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'd')); c.v[0][0] = new char[1]; c.v[0][0][0] = 'e'; char val5 = get(); - assertEquals(val5, (isStableEnabled ? 'a' : 'e')); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'e')); } { c.v = new char[1][1][1]; char[] val1 = get1(); c.v[0][0] = new char[1]; char[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new char[1][1][1]; char[][] val1 = get2(); c.v[0] = new char[1][1]; char[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'a'; char val1 = get(); c.v[0][0][0][0] = 'b'; char val2 = get(); assertEquals(val1, 'a'); - assertEquals(val2, (isStableEnabled ? 'a' : 'b')); + assertEquals(val2, (isServerWithStable ? 'a' : 'b')); c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'c'; char val3 = get(); - assertEquals(val3, (isStableEnabled ? 'a' : 'c')); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'c')); c.v[0] = new char[1][1][1]; c.v[0][0][0][0] = 'd'; char val4 = get(); - assertEquals(val4, (isStableEnabled ? 'a' : 'd')); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'd')); c.v[0][0] = new char[1][1]; c.v[0][0][0][0] = 'e'; char val5 = get(); - assertEquals(val5, (isStableEnabled ? 'a' : 'e')); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'e')); c.v[0][0][0] = new char[1]; c.v[0][0][0][0] = 'f'; char val6 = get(); - assertEquals(val6, (isStableEnabled ? 'a' : 'f')); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') + : 'f')); } { c.v = new char[1][1][1][1]; char[] val1 = get1(); c.v[0][0][0] = new char[1]; char[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new char[1][1][1][1]; char[][] val1 = get2(); c.v[0][0] = new char[1][1]; char[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new char[1][1][1][1]; char[][][] val1 = get3(); c.v[0] = new char[1][1][1]; char[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -350,7 +392,6 @@ c.v = new char[1][1][1][1]; char[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } @@ -403,7 +444,7 @@ c.v = new char[1][1]; c.v[0] = new char[0]; char[] val1 = get1(); c.v[0] = new char[0]; char[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -439,14 +480,14 @@ c.v = new char[1][1][1]; c.v[0][0] = new char[0]; char[] val1 = get1(); c.v[0][0] = new char[0]; char[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new char[1][1][1]; c.v[0] = new char[0][0]; char[][] val1 = get2(); c.v[0] = new char[0][0]; char[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -581,7 +622,7 @@ elem.a = 'b'; char val3 = get(); char val4 = get1(); assertEquals(val1, 'a'); - assertEquals(val3, (isStableEnabled ? 'a' : 'b')); + assertEquals(val3, (isServerWithStable ? 'a' : 'b')); assertEquals(val2, 'a'); assertEquals(val4, 'b'); @@ -615,17 +656,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableDouble.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableDouble.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableDouble * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableDouble.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableDouble StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableDouble * java/lang/invoke/TestStableDouble$DoubleStable * java/lang/invoke/TestStableDouble$StaticDoubleStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableDouble$NestedStableField3 * java/lang/invoke/TestStableDouble$NestedStableField3$A * java/lang/invoke/TestStableDouble$DefaultValue + * java/lang/invoke/TestStableDouble$DefaultStaticValue * java/lang/invoke/TestStableDouble$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableDouble + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableDouble * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableDouble + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableDouble * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableDouble - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableDouble */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableDouble { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(DoubleStable.class); + run(DefaultStaticValue.class); run(StaticDoubleStable.class); run(VolatileDoubleStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable double v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static double get() { return c.v; } + public static void test() throws Exception { + double val1 = get(); + c.v = 1.0; double val2 = get(); + assertEquals(val1, 0); + assertEquals(val2, 1.0); + } + } + + /* ==================================================== */ + static class StaticDoubleStable { public static @Stable double v; @@ -188,20 +219,22 @@ c.v = new double[1]; c.v[0] = 1.0; double val1 = get(); c.v[0] = 2.0; double val2 = get(); assertEquals(val1, 1.0); - assertEquals(val2, (isStableEnabled ? 1.0 : 2.0)); + assertEquals(val2, (isServerWithStable ? 1.0 : 2.0)); c.v = new double[1]; c.v[0] = 3.0; double val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0 : 3.0)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 3.0)); } { c.v = new double[20]; c.v[10] = 1.0; double val1 = get1(); c.v[10] = 2.0; double val2 = get1(); assertEquals(val1, 1.0); - assertEquals(val2, (isStableEnabled ? 1.0 : 2.0)); + assertEquals(val2, (isServerWithStable ? 1.0 : 2.0)); c.v = new double[20]; c.v[10] = 3.0; double val3 = get1(); - assertEquals(val3, (isStableEnabled ? 1.0 : 3.0)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 3.0)); } { @@ -226,19 +259,21 @@ c.v = new double[1][1]; c.v[0][0] = 1.0; double val1 = get(); c.v[0][0] = 2.0; double val2 = get(); assertEquals(val1, 1.0); - assertEquals(val2, (isStableEnabled ? 1.0 : 2.0)); + assertEquals(val2, (isServerWithStable ? 1.0 : 2.0)); c.v = new double[1][1]; c.v[0][0] = 3.0; double val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0 : 3.0)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 3.0)); c.v[0] = new double[1]; c.v[0][0] = 4.0; double val4 = get(); - assertEquals(val4, (isStableEnabled ? 1.0 : 4.0)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 4.0)); } { c.v = new double[1][1]; double[] val1 = get1(); c.v[0] = new double[1]; double[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new double[1][1][1]; c.v[0][0][0] = 1.0; double val1 = get(); c.v[0][0][0] = 2.0; double val2 = get(); assertEquals(val1, 1.0); - assertEquals(val2, (isStableEnabled ? 1.0 : 2.0)); + assertEquals(val2, (isServerWithStable ? 1.0 : 2.0)); c.v = new double[1][1][1]; c.v[0][0][0] = 3.0; double val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0 : 3.0)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 3.0)); c.v[0] = new double[1][1]; c.v[0][0][0] = 4.0; double val4 = get(); - assertEquals(val4, (isStableEnabled ? 1.0 : 4.0)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 4.0)); c.v[0][0] = new double[1]; c.v[0][0][0] = 5.0; double val5 = get(); - assertEquals(val5, (isStableEnabled ? 1.0 : 5.0)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 5.0)); } { c.v = new double[1][1][1]; double[] val1 = get1(); c.v[0][0] = new double[1]; double[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new double[1][1][1]; double[][] val1 = get2(); c.v[0] = new double[1][1]; double[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 1.0; double val1 = get(); c.v[0][0][0][0] = 2.0; double val2 = get(); assertEquals(val1, 1.0); - assertEquals(val2, (isStableEnabled ? 1.0 : 2.0)); + assertEquals(val2, (isServerWithStable ? 1.0 : 2.0)); c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 3.0; double val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0 : 3.0)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 3.0)); c.v[0] = new double[1][1][1]; c.v[0][0][0][0] = 4.0; double val4 = get(); - assertEquals(val4, (isStableEnabled ? 1.0 : 4.0)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 4.0)); c.v[0][0] = new double[1][1]; c.v[0][0][0][0] = 5.0; double val5 = get(); - assertEquals(val5, (isStableEnabled ? 1.0 : 5.0)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 5.0)); c.v[0][0][0] = new double[1]; c.v[0][0][0][0] = 6.0; double val6 = get(); - assertEquals(val6, (isStableEnabled ? 1.0 : 6.0)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0) + : 6.0)); } { c.v = new double[1][1][1][1]; double[] val1 = get1(); c.v[0][0][0] = new double[1]; double[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new double[1][1][1][1]; double[][] val1 = get2(); c.v[0][0] = new double[1][1]; double[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new double[1][1][1][1]; double[][][] val1 = get3(); c.v[0] = new double[1][1][1]; double[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -350,13 +392,11 @@ c.v = new double[1][1][1][1]; double[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } /* ==================================================== */ // Dynamic Dim is higher than static - static class ObjectArrayLowerDim0 { public @Stable Object v; @@ -404,7 +444,7 @@ c.v = new double[1][1]; c.v[0] = new double[0]; double[] val1 = get1(); c.v[0] = new double[0]; double[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -440,14 +480,14 @@ c.v = new double[1][1][1]; c.v[0][0] = new double[0]; double[] val1 = get1(); c.v[0][0] = new double[0]; double[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new double[1][1][1]; c.v[0] = new double[0][0]; double[][] val1 = get2(); c.v[0] = new double[0][0]; double[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -582,7 +622,7 @@ elem.a = 2.0; double val3 = get(); double val4 = get1(); assertEquals(val1, 1.0); - assertEquals(val3, (isStableEnabled ? 1.0 : 2.0)); + assertEquals(val3, (isServerWithStable ? 1.0 : 2.0)); assertEquals(val2, 1.0); assertEquals(val4, 2.0); @@ -616,17 +656,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableFloat.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableFloat.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableFloat * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableFloat.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableFloat StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableFloat * java/lang/invoke/TestStableFloat$FloatStable * java/lang/invoke/TestStableFloat$StaticFloatStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableFloat$NestedStableField3 * java/lang/invoke/TestStableFloat$NestedStableField3$A * java/lang/invoke/TestStableFloat$DefaultValue + * java/lang/invoke/TestStableFloat$DefaultStaticValue * java/lang/invoke/TestStableFloat$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableFloat + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableFloat * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableFloat + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableFloat * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableFloat - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableFloat */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableFloat { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(FloatStable.class); + run(DefaultStaticValue.class); run(StaticFloatStable.class); run(VolatileFloatStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable float v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static float get() { return c.v; } + public static void test() throws Exception { + float val1 = get(); + c.v = 1.0F; float val2 = get(); + assertEquals(val1, 0F); + assertEquals(val2, 1.0F); + } + } + + /* ==================================================== */ + static class StaticFloatStable { public static @Stable float v; @@ -188,20 +219,22 @@ c.v = new float[1]; c.v[0] = 1.0F; float val1 = get(); c.v[0] = 2.0F; float val2 = get(); assertEquals(val1, 1.0F); - assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F)); + assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F)); c.v = new float[1]; c.v[0] = 3.0F; float val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0F : 3.0F)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 3.0F)); } { c.v = new float[20]; c.v[10] = 1.0F; float val1 = get1(); c.v[10] = 2.0F; float val2 = get1(); assertEquals(val1, 1.0F); - assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F)); + assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F)); c.v = new float[20]; c.v[10] = 3.0F; float val3 = get1(); - assertEquals(val3, (isStableEnabled ? 1.0F : 3.0F)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 3.0F)); } { @@ -226,19 +259,21 @@ c.v = new float[1][1]; c.v[0][0] = 1.0F; float val1 = get(); c.v[0][0] = 2.0F; float val2 = get(); assertEquals(val1, 1.0F); - assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F)); + assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F)); c.v = new float[1][1]; c.v[0][0] = 3.0F; float val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0F : 3.0F)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 3.0F)); c.v[0] = new float[1]; c.v[0][0] = 4.0F; float val4 = get(); - assertEquals(val4, (isStableEnabled ? 1.0F : 4.0F)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 4.0F)); } { c.v = new float[1][1]; float[] val1 = get1(); c.v[0] = new float[1]; float[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new float[1][1][1]; c.v[0][0][0] = 1.0F; float val1 = get(); c.v[0][0][0] = 2.0F; float val2 = get(); assertEquals(val1, 1.0F); - assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F)); + assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F)); c.v = new float[1][1][1]; c.v[0][0][0] = 3.0F; float val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0F : 3.0F)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 3.0F)); c.v[0] = new float[1][1]; c.v[0][0][0] = 4.0F; float val4 = get(); - assertEquals(val4, (isStableEnabled ? 1.0F : 4.0F)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 4.0F)); c.v[0][0] = new float[1]; c.v[0][0][0] = 5.0F; float val5 = get(); - assertEquals(val5, (isStableEnabled ? 1.0F : 5.0F)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 5.0F)); } { c.v = new float[1][1][1]; float[] val1 = get1(); c.v[0][0] = new float[1]; float[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new float[1][1][1]; float[][] val1 = get2(); c.v[0] = new float[1][1]; float[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new float[1][1][1][1]; c.v[0][0][0][0] = 1.0F; float val1 = get(); c.v[0][0][0][0] = 2.0F; float val2 = get(); assertEquals(val1, 1.0F); - assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F)); + assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F)); c.v = new float[1][1][1][1]; c.v[0][0][0][0] = 3.0F; float val3 = get(); - assertEquals(val3, (isStableEnabled ? 1.0F : 3.0F)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 3.0F)); c.v[0] = new float[1][1][1]; c.v[0][0][0][0] = 4.0F; float val4 = get(); - assertEquals(val4, (isStableEnabled ? 1.0F : 4.0F)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 4.0F)); c.v[0][0] = new float[1][1]; c.v[0][0][0][0] = 5.0F; float val5 = get(); - assertEquals(val5, (isStableEnabled ? 1.0F : 5.0F)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 5.0F)); c.v[0][0][0] = new float[1]; c.v[0][0][0][0] = 6.0F; float val6 = get(); - assertEquals(val6, (isStableEnabled ? 1.0F : 6.0F)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F) + : 6.0F)); } { c.v = new float[1][1][1][1]; float[] val1 = get1(); c.v[0][0][0] = new float[1]; float[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new float[1][1][1][1]; float[][] val1 = get2(); c.v[0][0] = new float[1][1]; float[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new float[1][1][1][1]; float[][][] val1 = get3(); c.v[0] = new float[1][1][1]; float[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -350,13 +392,11 @@ c.v = new float[1][1][1][1]; float[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } /* ==================================================== */ // Dynamic Dim is higher than static - static class ObjectArrayLowerDim0 { public @Stable Object v; @@ -404,7 +444,7 @@ c.v = new float[1][1]; c.v[0] = new float[0]; float[] val1 = get1(); c.v[0] = new float[0]; float[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -440,14 +480,14 @@ c.v = new float[1][1][1]; c.v[0][0] = new float[0]; float[] val1 = get1(); c.v[0][0] = new float[0]; float[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new float[1][1][1]; c.v[0] = new float[0][0]; float[][] val1 = get2(); c.v[0] = new float[0][0]; float[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -582,7 +622,7 @@ elem.a = 2.0F; float val3 = get(); float val4 = get1(); assertEquals(val1, 1.0F); - assertEquals(val3, (isStableEnabled ? 1.0F : 2.0F)); + assertEquals(val3, (isServerWithStable ? 1.0F : 2.0F)); assertEquals(val2, 1.0F); assertEquals(val4, 2.0F); @@ -616,17 +656,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableInt.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableInt.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableInt * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableInt.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableInt StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableInt * java/lang/invoke/TestStableInt$IntStable * java/lang/invoke/TestStableInt$StaticIntStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableInt$NestedStableField3 * java/lang/invoke/TestStableInt$NestedStableField3$A * java/lang/invoke/TestStableInt$DefaultValue + * java/lang/invoke/TestStableInt$DefaultStaticValue * java/lang/invoke/TestStableInt$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableInt + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableInt * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableInt + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableInt * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableInt - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableInt */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableInt { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(IntStable.class); + run(DefaultStaticValue.class); run(StaticIntStable.class); run(VolatileIntStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable int v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static int get() { return c.v; } + public static void test() throws Exception { + int val1 = get(); + c.v = 1; int val2 = get(); + assertEquals(val1, 0); + assertEquals(val2, 1); + } + } + + /* ==================================================== */ + static class StaticIntStable { public static @Stable int v; @@ -188,20 +219,22 @@ c.v = new int[1]; c.v[0] = 1; int val1 = get(); c.v[0] = 2; int val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new int[1]; c.v[0] = 3; int val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { c.v = new int[20]; c.v[10] = 1; int val1 = get1(); c.v[10] = 2; int val2 = get1(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new int[20]; c.v[10] = 3; int val3 = get1(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { @@ -226,19 +259,21 @@ c.v = new int[1][1]; c.v[0][0] = 1; int val1 = get(); c.v[0][0] = 2; int val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new int[1][1]; c.v[0][0] = 3; int val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new int[1]; c.v[0][0] = 4; int val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); } { c.v = new int[1][1]; int[] val1 = get1(); c.v[0] = new int[1]; int[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new int[1][1][1]; c.v[0][0][0] = 1; int val1 = get(); c.v[0][0][0] = 2; int val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new int[1][1][1]; c.v[0][0][0] = 3; int val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new int[1][1]; c.v[0][0][0] = 4; int val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new int[1]; c.v[0][0][0] = 5; int val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); } { c.v = new int[1][1][1]; int[] val1 = get1(); c.v[0][0] = new int[1]; int[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new int[1][1][1]; int[][] val1 = get2(); c.v[0] = new int[1][1]; int[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new int[1][1][1][1]; c.v[0][0][0][0] = 1; int val1 = get(); c.v[0][0][0][0] = 2; int val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new int[1][1][1][1]; c.v[0][0][0][0] = 3; int val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new int[1][1][1]; c.v[0][0][0][0] = 4; int val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new int[1][1]; c.v[0][0][0][0] = 5; int val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); c.v[0][0][0] = new int[1]; c.v[0][0][0][0] = 6; int val6 = get(); - assertEquals(val6, (isStableEnabled ? 1 : 6)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 6)); } { c.v = new int[1][1][1][1]; int[] val1 = get1(); c.v[0][0][0] = new int[1]; int[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new int[1][1][1][1]; int[][] val1 = get2(); c.v[0][0] = new int[1][1]; int[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new int[1][1][1][1]; int[][][] val1 = get3(); c.v[0] = new int[1][1][1]; int[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -350,13 +392,11 @@ c.v = new int[1][1][1][1]; int[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } /* ==================================================== */ // Dynamic Dim is higher than static - static class ObjectArrayLowerDim0 { public @Stable Object v; @@ -404,7 +444,7 @@ c.v = new int[1][1]; c.v[0] = new int[0]; int[] val1 = get1(); c.v[0] = new int[0]; int[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -440,14 +480,14 @@ c.v = new int[1][1][1]; c.v[0][0] = new int[0]; int[] val1 = get1(); c.v[0][0] = new int[0]; int[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new int[1][1][1]; c.v[0] = new int[0][0]; int[][] val1 = get2(); c.v[0] = new int[0][0]; int[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -582,7 +622,7 @@ elem.a = 2; int val3 = get(); int val4 = get1(); assertEquals(val1, 1); - assertEquals(val3, (isStableEnabled ? 1 : 2)); + assertEquals(val3, (isServerWithStable ? 1 : 2)); assertEquals(val2, 1); assertEquals(val4, 2); @@ -616,17 +656,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableLong.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableLong.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableLong * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableLong.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableLong StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableLong * java/lang/invoke/TestStableLong$LongStable * java/lang/invoke/TestStableLong$StaticLongStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableLong$NestedStableField3 * java/lang/invoke/TestStableLong$NestedStableField3$A * java/lang/invoke/TestStableLong$DefaultValue + * java/lang/invoke/TestStableLong$DefaultStaticValue * java/lang/invoke/TestStableLong$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableLong + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableLong * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableLong + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableLong * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableLong - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableLong */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableLong { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(LongStable.class); + run(DefaultStaticValue.class); run(StaticLongStable.class); run(VolatileLongStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable long v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static long get() { return c.v; } + public static void test() throws Exception { + long val1 = get(); + c.v = 1L; long val2 = get(); + assertEquals(val1, 0); + assertEquals(val2, 1L); + } + } + + /* ==================================================== */ + static class StaticLongStable { public static @Stable long v; @@ -188,20 +219,22 @@ c.v = new long[1]; c.v[0] = 1; long val1 = get(); c.v[0] = 2; long val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new long[1]; c.v[0] = 3; long val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { c.v = new long[20]; c.v[10] = 1; long val1 = get1(); c.v[10] = 2; long val2 = get1(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new long[20]; c.v[10] = 3; long val3 = get1(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { @@ -226,19 +259,21 @@ c.v = new long[1][1]; c.v[0][0] = 1; long val1 = get(); c.v[0][0] = 2; long val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new long[1][1]; c.v[0][0] = 3; long val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new long[1]; c.v[0][0] = 4; long val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); } { c.v = new long[1][1]; long[] val1 = get1(); c.v[0] = new long[1]; long[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new long[1][1][1]; c.v[0][0][0] = 1; long val1 = get(); c.v[0][0][0] = 2; long val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new long[1][1][1]; c.v[0][0][0] = 3; long val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new long[1][1]; c.v[0][0][0] = 4; long val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new long[1]; c.v[0][0][0] = 5; long val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); } { c.v = new long[1][1][1]; long[] val1 = get1(); c.v[0][0] = new long[1]; long[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new long[1][1][1]; long[][] val1 = get2(); c.v[0] = new long[1][1]; long[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 1; long val1 = get(); c.v[0][0][0][0] = 2; long val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 3; long val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new long[1][1][1]; c.v[0][0][0][0] = 4; long val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new long[1][1]; c.v[0][0][0][0] = 5; long val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); c.v[0][0][0] = new long[1]; c.v[0][0][0][0] = 6; long val6 = get(); - assertEquals(val6, (isStableEnabled ? 1 : 6)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 6)); } { c.v = new long[1][1][1][1]; long[] val1 = get1(); c.v[0][0][0] = new long[1]; long[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new long[1][1][1][1]; long[][] val1 = get2(); c.v[0][0] = new long[1][1]; long[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new long[1][1][1][1]; long[][][] val1 = get3(); c.v[0] = new long[1][1][1]; long[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -350,13 +392,11 @@ c.v = new long[1][1][1][1]; long[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } /* ==================================================== */ // Dynamic Dim is higher than static - static class ObjectArrayLowerDim0 { public @Stable Object v; @@ -404,7 +444,7 @@ c.v = new long[1][1]; c.v[0] = new long[0]; long[] val1 = get1(); c.v[0] = new long[0]; long[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -440,14 +480,14 @@ c.v = new long[1][1][1]; c.v[0][0] = new long[0]; long[] val1 = get1(); c.v[0][0] = new long[0]; long[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new long[1][1][1]; c.v[0] = new long[0][0]; long[][] val1 = get2(); c.v[0] = new long[0][0]; long[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -582,7 +622,7 @@ elem.a = 2; long val3 = get(); long val4 = get1(); assertEquals(val1, 1); - assertEquals(val3, (isStableEnabled ? 1 : 2)); + assertEquals(val3, (isServerWithStable ? 1 : 2)); assertEquals(val2, 1); assertEquals(val4, 2); @@ -616,17 +656,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableObject.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableObject.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableObject * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableObject.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableObject StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableObject * java/lang/invoke/TestStableObject$ObjectStable * java/lang/invoke/TestStableObject$StaticObjectStable @@ -49,46 +51,60 @@ * java/lang/invoke/TestStableObject$NestedStableField3$A * java/lang/invoke/TestStableObject$Values * java/lang/invoke/TestStableObject$DefaultValue + * java/lang/invoke/TestStableObject$DefaultStaticValue * java/lang/invoke/TestStableObject$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableObject + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableObject * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableObject + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableObject * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableObject - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableObject */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableObject { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(ObjectStable.class); + run(DefaultStaticValue.class); run(StaticObjectStable.class); run(VolatileObjectStable.class); @@ -148,6 +164,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable Object v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static Object get() { return c.v; } + public static void test() throws Exception { + Object val1 = get(); + c.v = Values.A; Object val2 = get(); + assertEquals(val1, null); + assertEquals(val2, Values.A); + } + } + + /* ==================================================== */ + static class StaticObjectStable { public static @Stable Values v; @@ -191,20 +222,22 @@ c.v = new Object[1]; c.v[0] = Values.A; Object val1 = get(); c.v[0] = Values.B; Object val2 = get(); assertEquals(val1, Values.A); - assertEquals(val2, (isStableEnabled ? Values.A : Values.B)); + assertEquals(val2, (isServerWithStable ? Values.A : Values.B)); c.v = new Object[1]; c.v[0] = Values.C; Object val3 = get(); - assertEquals(val3, (isStableEnabled ? Values.A : Values.C)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.C)); } { c.v = new Object[20]; c.v[10] = Values.A; Object val1 = get1(); c.v[10] = Values.B; Object val2 = get1(); assertEquals(val1, Values.A); - assertEquals(val2, (isStableEnabled ? Values.A : Values.B)); + assertEquals(val2, (isServerWithStable ? Values.A : Values.B)); c.v = new Object[20]; c.v[10] = Values.C; Object val3 = get1(); - assertEquals(val3, (isStableEnabled ? Values.A : Values.C)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.C)); } { @@ -229,19 +262,21 @@ c.v = new Object[1][1]; c.v[0][0] = Values.A; Object val1 = get(); c.v[0][0] = Values.B; Object val2 = get(); assertEquals(val1, Values.A); - assertEquals(val2, (isStableEnabled ? Values.A : Values.B)); + assertEquals(val2, (isServerWithStable ? Values.A : Values.B)); c.v = new Object[1][1]; c.v[0][0] = Values.C; Object val3 = get(); - assertEquals(val3, (isStableEnabled ? Values.A : Values.C)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.C)); c.v[0] = new Object[1]; c.v[0][0] = Values.D; Object val4 = get(); - assertEquals(val4, (isStableEnabled ? Values.A : Values.D)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.D)); } { c.v = new Object[1][1]; Object[] val1 = get1(); c.v[0] = new Object[1]; Object[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -267,28 +302,31 @@ c.v = new Object[1][1][1]; c.v[0][0][0] = Values.A; Object val1 = get(); c.v[0][0][0] = Values.B; Object val2 = get(); assertEquals(val1, Values.A); - assertEquals(val2, (isStableEnabled ? Values.A : Values.B)); + assertEquals(val2, (isServerWithStable ? Values.A : Values.B)); c.v = new Object[1][1][1]; c.v[0][0][0] = Values.C; Object val3 = get(); - assertEquals(val3, (isStableEnabled ? Values.A : Values.C)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.C)); c.v[0] = new Object[1][1]; c.v[0][0][0] = Values.D; Object val4 = get(); - assertEquals(val4, (isStableEnabled ? Values.A : Values.D)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.D)); c.v[0][0] = new Object[1]; c.v[0][0][0] = Values.E; Object val5 = get(); - assertEquals(val5, (isStableEnabled ? Values.A : Values.E)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.E)); } { c.v = new Object[1][1][1]; Object[] val1 = get1(); c.v[0][0] = new Object[1]; Object[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new Object[1][1][1]; Object[][] val1 = get2(); c.v[0] = new Object[1][1]; Object[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -315,37 +353,41 @@ c.v = new Object[1][1][1][1]; c.v[0][0][0][0] = Values.A; Object val1 = get(); c.v[0][0][0][0] = Values.B; Object val2 = get(); assertEquals(val1, Values.A); - assertEquals(val2, (isStableEnabled ? Values.A : Values.B)); + assertEquals(val2, (isServerWithStable ? Values.A : Values.B)); c.v = new Object[1][1][1][1]; c.v[0][0][0][0] = Values.C; Object val3 = get(); - assertEquals(val3, (isStableEnabled ? Values.A : Values.C)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.C)); c.v[0] = new Object[1][1][1]; c.v[0][0][0][0] = Values.D; Object val4 = get(); - assertEquals(val4, (isStableEnabled ? Values.A : Values.D)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.D)); c.v[0][0] = new Object[1][1]; c.v[0][0][0][0] = Values.E; Object val5 = get(); - assertEquals(val5, (isStableEnabled ? Values.A : Values.E)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.E)); c.v[0][0][0] = new Object[1]; c.v[0][0][0][0] = Values.F; Object val6 = get(); - assertEquals(val6, (isStableEnabled ? Values.A : Values.F)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B) + : Values.F)); } { c.v = new Object[1][1][1][1]; Object[] val1 = get1(); c.v[0][0][0] = new Object[1]; Object[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new Object[1][1][1][1]; Object[][] val1 = get2(); c.v[0][0] = new Object[1][1]; Object[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new Object[1][1][1][1]; Object[][][] val1 = get3(); c.v[0] = new Object[1][1][1]; Object[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -353,13 +395,11 @@ c.v = new Object[1][1][1][1]; Object[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } /* ==================================================== */ // Dynamic Dim is higher than static - static class ObjectArrayLowerDim0 { public @Stable Object v; @@ -407,7 +447,7 @@ c.v = new Object[1][1]; c.v[0] = new Object[0]; Object[] val1 = get1(); c.v[0] = new Object[0]; Object[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -443,14 +483,14 @@ c.v = new Object[1][1][1]; c.v[0][0] = new Object[0]; Object[] val1 = get1(); c.v[0][0] = new Object[0]; Object[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new Object[1][1][1]; c.v[0] = new Object[0][0]; Object[][] val1 = get2(); c.v[0] = new Object[0][0]; Object[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -585,7 +625,7 @@ elem.a = Values.B; Object val3 = get(); Object val4 = get1(); assertEquals(val1, Values.A); - assertEquals(val3, (isStableEnabled ? Values.A : Values.B)); + assertEquals(val3, (isServerWithStable ? Values.A : Values.B)); assertEquals(val2, Values.A); assertEquals(val4, Values.B); @@ -619,17 +659,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/stable/TestStableShort.java Tue Aug 05 15:39:05 2014 +0400 +++ b/hotspot/test/compiler/stable/TestStableShort.java Tue Aug 05 12:14:11 2014 -0700 @@ -26,9 +26,11 @@ /* * @test TestStableShort * @summary tests on stable fields and arrays - * @library /testlibrary - * @compile -XDignore.symbol.file TestStableShort.java + * @library /testlibrary /testlibrary/whitebox + * @build TestStableShort StableConfiguration sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller + * java/lang/invoke/StableConfiguration * java/lang/invoke/TestStableShort * java/lang/invoke/TestStableShort$ShortStable * java/lang/invoke/TestStableShort$StaticShortStable @@ -48,46 +50,60 @@ * java/lang/invoke/TestStableShort$NestedStableField3 * java/lang/invoke/TestStableShort$NestedStableField3$A * java/lang/invoke/TestStableShort$DefaultValue + * java/lang/invoke/TestStableShort$DefaultStaticValue * java/lang/invoke/TestStableShort$ObjectArrayLowerDim2 * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableShort + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableShort * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * java.lang.invoke.TestStableShort + * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableShort * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:+FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableShort - * * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop - * -server -XX:-TieredCompilation -Xcomp + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -client -XX:-TieredCompilation + * -XX:-FoldStableValues * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 * java.lang.invoke.TestStableShort */ package java.lang.invoke; -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; -import sun.management.ManagementFactoryHelper; import java.lang.reflect.InvocationTargetException; public class TestStableShort { + static final boolean isStableEnabled = StableConfiguration.isStableEnabled; + static final boolean isServerWithStable = StableConfiguration.isServerWithStable; + public static void main(String[] args) throws Exception { - System.out.println("@Stable enabled: "+isStableEnabled); - System.out.println(); - run(DefaultValue.class); run(ShortStable.class); + run(DefaultStaticValue.class); run(StaticShortStable.class); run(VolatileShortStable.class); @@ -145,6 +161,21 @@ /* ==================================================== */ + static class DefaultStaticValue { + public static @Stable short v; + + public static final DefaultStaticValue c = new DefaultStaticValue(); + public static short get() { return c.v; } + public static void test() throws Exception { + short val1 = get(); + c.v = 1; short val2 = get(); + assertEquals(val1, 0); + assertEquals(val2, 1); + } + } + + /* ==================================================== */ + static class StaticShortStable { public static @Stable short v; @@ -188,20 +219,22 @@ c.v = new short[1]; c.v[0] = 1; short val1 = get(); c.v[0] = 2; short val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new short[1]; c.v[0] = 3; short val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { c.v = new short[20]; c.v[10] = 1; short val1 = get1(); c.v[10] = 2; short val2 = get1(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new short[20]; c.v[10] = 3; short val3 = get1(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); } { @@ -226,19 +259,21 @@ c.v = new short[1][1]; c.v[0][0] = 1; short val1 = get(); c.v[0][0] = 2; short val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new short[1][1]; c.v[0][0] = 3; short val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new short[1]; c.v[0][0] = 4; short val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); } { c.v = new short[1][1]; short[] val1 = get1(); c.v[0] = new short[1]; short[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -264,28 +299,31 @@ c.v = new short[1][1][1]; c.v[0][0][0] = 1; short val1 = get(); c.v[0][0][0] = 2; short val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new short[1][1][1]; c.v[0][0][0] = 3; short val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new short[1][1]; c.v[0][0][0] = 4; short val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new short[1]; c.v[0][0][0] = 5; short val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); } { c.v = new short[1][1][1]; short[] val1 = get1(); c.v[0][0] = new short[1]; short[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new short[1][1][1]; short[][] val1 = get2(); c.v[0] = new short[1][1]; short[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -312,37 +350,41 @@ c.v = new short[1][1][1][1]; c.v[0][0][0][0] = 1; short val1 = get(); c.v[0][0][0][0] = 2; short val2 = get(); assertEquals(val1, 1); - assertEquals(val2, (isStableEnabled ? 1 : 2)); + assertEquals(val2, (isServerWithStable ? 1 : 2)); c.v = new short[1][1][1][1]; c.v[0][0][0][0] = 3; short val3 = get(); - assertEquals(val3, (isStableEnabled ? 1 : 3)); + assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 3)); c.v[0] = new short[1][1][1]; c.v[0][0][0][0] = 4; short val4 = get(); - assertEquals(val4, (isStableEnabled ? 1 : 4)); + assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 4)); c.v[0][0] = new short[1][1]; c.v[0][0][0][0] = 5; short val5 = get(); - assertEquals(val5, (isStableEnabled ? 1 : 5)); + assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 5)); c.v[0][0][0] = new short[1]; c.v[0][0][0][0] = 6; short val6 = get(); - assertEquals(val6, (isStableEnabled ? 1 : 6)); + assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2) + : 6)); } { c.v = new short[1][1][1][1]; short[] val1 = get1(); c.v[0][0][0] = new short[1]; short[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new short[1][1][1][1]; short[][] val1 = get2(); c.v[0][0] = new short[1][1]; short[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new short[1][1][1][1]; short[][][] val1 = get3(); c.v[0] = new short[1][1][1]; short[][][] val2 = get3(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -350,13 +392,11 @@ c.v = new short[1][1][1][1]; short[][][][] val2 = get4(); assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); } - } } /* ==================================================== */ // Dynamic Dim is higher than static - static class ObjectArrayLowerDim0 { public @Stable Object v; @@ -404,7 +444,7 @@ c.v = new short[1][1]; c.v[0] = new short[0]; short[] val1 = get1(); c.v[0] = new short[0]; short[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -440,14 +480,14 @@ c.v = new short[1][1][1]; c.v[0][0] = new short[0]; short[] val1 = get1(); c.v[0][0] = new short[0]; short[] val2 = get1(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { c.v = new short[1][1][1]; c.v[0] = new short[0][0]; short[][] val1 = get2(); c.v[0] = new short[0][0]; short[][] val2 = get2(); - assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); + assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); } { @@ -582,7 +622,7 @@ elem.a = 2; short val3 = get(); short val4 = get1(); assertEquals(val1, 1); - assertEquals(val3, (isStableEnabled ? 1 : 2)); + assertEquals(val3, (isServerWithStable ? 1 : 2)); assertEquals(val2, 1); assertEquals(val4, 2); @@ -616,17 +656,4 @@ } } } - - static final boolean isStableEnabled; - static { - HotSpotDiagnosticMXBean diagnostic - = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption tmp; - try { - tmp = diagnostic.getVMOption("FoldStableValues"); - } catch (IllegalArgumentException e) { - tmp = null; - } - isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); - } }
--- a/hotspot/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java Tue Aug 05 15:39:05 2014 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014, 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 8031752 - * @summary speculative traps need to be cleaned up at GC - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx512M TestSpecTrapClassUnloading - * - */ - -import java.lang.reflect.Method; - -public class TestSpecTrapClassUnloading { - static class B { - final public boolean m(Object o) { - if (o.getClass() == B.class) { - return true; - } - return false; - } - } - - static class MemoryChunk { - MemoryChunk other; - long[] array; - MemoryChunk(MemoryChunk other) { - this.other = other; - array = new long[1024 * 1024 * 1024]; - } - } - - static void m1(B b, Object o) { - b.m(o); - } - - static void m2(B b, Object o) { - b.m(o); - } - - public static void main(String[] args) throws Exception { - Method m = B.class.getMethod("m", Object.class); - Object o = new Object(); - B b = new B(); - - // add speculative trap in B.m() for m1 - for (int i = 0; i < 20000; i++) { - m1(b, b); - } - m1(b, o); - - // add speculative trap in B.m() for code generated by reflection - for (int i = 0; i < 20000; i++) { - m.invoke(b, b); - } - m.invoke(b, o); - - m = null; - - // add speculative trap in B.m() for m2 - for (int i = 0; i < 20000; i++) { - m2(b, b); - } - m2(b, o); - - // Exhaust memory which causes the code generated by - // reflection to be unloaded but B.m() is not. - MemoryChunk root = null; - try { - while (true) { - root = new MemoryChunk(root); - } - } catch(OutOfMemoryError e) { - root = null; - } - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java Tue Aug 05 12:14:11 2014 -0700 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014, 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 8048933 + * @summary TraceExceptions output should have the exception message - useful for ClassNotFoundExceptions especially + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.*; + +public class TraceExceptionsTest { + public static void main(String[] args) throws Exception { + + if (!Platform.isDebugBuild()) { + System.out.println("Skip the test on product builds since XX:+TraceExceptions is not available on product builds"); + return; + } + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+TraceExceptions", "NoClassFound"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("<a 'java/lang/ClassNotFoundException': NoClassFound>"); + output.shouldNotContain("<a 'java/lang/ClassNotFoundException'>"); + output.shouldHaveExitValue(1); + } +}
--- a/jaxp/.hgtags Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxp/.hgtags Tue Aug 05 12:14:11 2014 -0700 @@ -266,3 +266,4 @@ 7eb0ab676ea75cb1dd31c613e77008a7d8cb0af7 jdk9-b21 82b94ff002c6e007a03bf0f364ca94b381e09135 jdk9-b22 2e5b63006187bfc64d8eace374dbc2806267a160 jdk9-b23 +345af113f57206711f75089c3ebf84a36a789122 jdk9-b24
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Tue Aug 05 12:14:11 2014 -0700 @@ -54,6 +54,7 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +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.XNIException; import com.sun.org.apache.xerces.internal.xni.grammars.Grammar; @@ -982,6 +983,18 @@ */ public void reset(XMLComponentManager componentManager) throws XMLConfigurationException { + XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); + if (spm == null) { + spm = new XMLSecurityPropertyManager(); + setProperty(XML_SECURITY_PROPERTY_MANAGER, spm); + } + + XMLSecurityManager sm = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER); + if (sm == null) + setProperty(SECURITY_MANAGER,new XMLSecurityManager(true)); + + faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); + fGrammarBucket.reset(); fSubGroupHandler.reset(); @@ -1065,9 +1078,6 @@ // get generate-synthetic-annotations feature fSchemaHandler.setGenerateSyntheticAnnotations(componentManager.getFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false)); fSchemaHandler.reset(componentManager); - - XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); - faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); } private void initGrammarBucket(){
--- a/jaxws/.hgtags Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/.hgtags Tue Aug 05 12:14:11 2014 -0700 @@ -269,3 +269,4 @@ 4a099451fd7e17b6cc4772fe9547907576a45b6f jdk9-b21 7f5e5902cde75fd9335c52f469491f061fe0239e jdk9-b22 ce19e0403ec8a80223cc47320c905b2a4d45881d jdk9-b23 +0b35542d6bf32af23a9fc59a37c52aa091fee388 jdk9-b24
--- a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -93,10 +93,11 @@ // otherwise, we also allow it if this code and the // factory come from the same (non-system) class loader (e.g., // the JAF classes were loaded with the applet classes). - if (CommandMap.class.getClassLoader() == null || - CommandMap.class.getClassLoader() != - commandMap.getClass().getClassLoader()) + ClassLoader cl = CommandMap.class.getClassLoader(); + if (cl == null || cl.getParent() == null || + cl != commandMap.getClass().getClassLoader()) { throw ex; + } } } // remove any per-thread-context-class-loader CommandMap
--- a/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -96,9 +96,9 @@ // otherwise, we also allow it if this code and the // factory come from the same (non-system) class loader (e.g., // the JAF classes were loaded with the applet classes). - if (FileTypeMap.class.getClassLoader() == null || - FileTypeMap.class.getClassLoader() != - fileTypeMap.getClass().getClassLoader()) + ClassLoader cl = FileTypeMap.class.getClassLoader(); + if (cl == null || cl.getParent() == null || + cl != fileTypeMap.getClass().getClassLoader()) throw ex; } }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java Tue Aug 05 12:14:11 2014 -0700 @@ -35,6 +35,8 @@ import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.lang.reflect.WildcardType; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collection; @@ -264,20 +266,38 @@ return clazz.getSimpleName(); } - public Collection<? extends Field> getDeclaredFields(Class clazz) { - return Arrays.asList(clazz.getDeclaredFields()); + public Collection<? extends Field> getDeclaredFields(final Class clazz) { + Field[] fields = AccessController.doPrivileged(new PrivilegedAction<Field[]>() { + @Override + public Field[] run() { + return clazz.getDeclaredFields(); + } + }); + return Arrays.asList(fields); } - public Field getDeclaredField(Class clazz, String fieldName) { - try { - return clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException e) { - return null; - } + public Field getDeclaredField(final Class clazz, final String fieldName) { + return AccessController.doPrivileged(new PrivilegedAction<Field>() { + @Override + public Field run() { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + return null; + } + } + }); } - public Collection<? extends Method> getDeclaredMethods(Class clazz) { - return Arrays.asList(clazz.getDeclaredMethods()); + public Collection<? extends Method> getDeclaredMethods(final Class clazz) { + Method[] methods = + AccessController.doPrivileged(new PrivilegedAction<Method[]>() { + @Override + public Method[] run() { + return clazz.getDeclaredMethods(); + } + }); + return Arrays.asList(methods); } public Class getDeclaringClassForField(Field field) { @@ -565,7 +585,7 @@ return method.isBridge(); } - public boolean isOverriding(Method method, Class base) { + public boolean isOverriding(Method method, final Class base) { // this isn't actually correct, // as the JLS considers // class Derived extends Base<Integer> { @@ -576,22 +596,30 @@ // } // to be overrided. Handling this correctly needs a careful implementation - String name = method.getName(); - Class[] params = method.getParameterTypes(); + final String name = method.getName(); + final Class[] params = method.getParameterTypes(); + + return AccessController.doPrivileged( + new PrivilegedAction<Boolean>() { - while (base != null) { - try { - if (base.getDeclaredMethod(name, params) != null) { - return true; + @Override + public Boolean run() { + Class clazz = base; + while (clazz != null) { + try { + Method m = clazz.getDeclaredMethod(name, params); + if (m != null) { + return Boolean.TRUE; + } + } catch (NoSuchMethodException ignored) { + // recursively go into the base class + } + clazz = clazz.getSuperclass(); + } + return Boolean.FALSE; + } } - } catch (NoSuchMethodException e) { - // recursively go into the base class - } - - base = base.getSuperclass(); - } - - return false; + ); } public boolean isInterface(Class clazz) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,6 +28,8 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -415,6 +417,15 @@ private static final Class[] unmarshalEventParams = { Unmarshaller.class, Object.class }; private static Class[] marshalEventParams = { Marshaller.class }; + private Method[] getDeclaredMethods(final Class<BeanT> c) { + return AccessController.doPrivileged(new PrivilegedAction<Method[]>() { + @Override + public Method[] run() { + return c.getDeclaredMethods(); + } + }); + } + /** * use reflection to determine which of the 4 object lifecycle methods exist on * the JAXB bound type. @@ -428,7 +439,7 @@ } while (jt != null) { - for (Method m : jt.getDeclaredMethods()) { + for (Method m : getDeclaredMethods(jt)) { String name = m.getName(); if (lcm.beforeUnmarshal == null) { @@ -468,7 +479,7 @@ } catch (SecurityException e) { // this happens when we don't have enough permission. logger.log(Level.WARNING, Messages.UNABLE_TO_DISCOVER_EVENTHANDLER.format( - jaxbType.getName(), e)); + jaxbType.getName(), e), e); } }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java Tue Aug 05 12:14:11 2014 -0700 @@ -229,8 +229,7 @@ if (!Modifier.isPublic(mod) || Modifier.isFinal(mod) || !Modifier.isPublic(f.getDeclaringClass().getModifiers())) { try { // attempt to make it accessible, but do so in the security context of the calling application. - // don't do this in the doPrivilege block, as that would create a security hole for anyone - // to make any field accessible. + // don't do this in the doPrivilege block f.setAccessible(true); } catch (SecurityException e) { if ((!accessWarned) && (!supressAccessorWarnings)) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -146,26 +146,31 @@ private static final Method findLoadedClass; static { + Method[] m = AccessController.doPrivileged( + new PrivilegedAction<Method[]>() { + @Override + public Method[] run() { + return new Method[]{ + getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE), + getMethod(ClassLoader.class, "resolveClass", Class.class), + getMethod(ClassLoader.class, "findLoadedClass", String.class) + }; + } + } + ); + defineClass = m[0]; + resolveClass = m[1]; + findLoadedClass = m[2]; + } + + private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params) { try { - defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE); - resolveClass = ClassLoader.class.getDeclaredMethod("resolveClass", Class.class); - findLoadedClass = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class); + Method m = c.getDeclaredMethod(methodname, params); + m.setAccessible(true); + return m; } catch (NoSuchMethodException e) { - // impossible throw new NoSuchMethodError(e.getMessage()); } - AccessController.doPrivileged(new PrivilegedAction<Void>() { - - @Override - public Void run() { - // TODO: check security implication - // do these setAccessible allow anyone to call these methods freely?s - defineClass.setAccessible(true); - resolveClass.setAccessible(true); - findLoadedClass.setAccessible(true); - return null; - } - }); } private Injector(ClassLoader parent) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java Tue Aug 05 12:14:11 2014 -0700 @@ -42,6 +42,8 @@ import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.logging.Level; import java.util.logging.Logger; @@ -91,8 +93,6 @@ } } catch (XMLStreamException ex) { Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex); - } catch (NoSuchMethodException ex) { - Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex); } } @@ -282,17 +282,31 @@ return new Zephyr(xof,clazz); } catch (XMLStreamException e) { return null; // impossible - } catch (NoSuchMethodException e) { - return null; // this xof wasn't Zephyr } } - private Zephyr(XMLOutputFactory xof, Class clazz) throws NoSuchMethodException { + private Zephyr(XMLOutputFactory xof, Class clazz) { this.xof = xof; zephyrClass = clazz; - setOutputMethod = clazz.getMethod("setOutput", StreamResult.class, String.class); - resetMethod = clazz.getMethod("reset"); + setOutputMethod = getMethod(clazz, "setOutput", StreamResult.class, String.class); + resetMethod = getMethod(clazz, "reset"); + } + + private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params) { + return AccessController.doPrivileged( + new PrivilegedAction<Method>() { + @Override + public Method run() { + try { + return c.getMethod(methodname, params); + } catch (NoSuchMethodException e) { + // impossible + throw new NoSuchMethodError(e.getMessage()); + } + } + } + ); } /**
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/MetroConfigLoader.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/MetroConfigLoader.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -42,13 +42,12 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.ws.WebServiceException; import java.lang.reflect.Method; -import java.lang.reflect.ReflectPermission; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.security.*; -import java.util.PropertyPermission; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; import java.util.logging.Level; /** @@ -258,24 +257,13 @@ public JAXBContext run() throws Exception { return JAXBContext.newInstance(MetroConfig.class.getPackage().getName()); } - }, createSecurityContext() - ); + }); } else { // usage from JAX-WS/Metro/Glassfish return JAXBContext.newInstance(MetroConfig.class.getPackage().getName()); } } - private static AccessControlContext createSecurityContext() { - PermissionCollection perms = new Permissions(); - perms.add(new RuntimePermission("accessClassInPackage.com" + ".sun.xml.internal.ws.runtime.config")); // avoid repackaging - perms.add(new ReflectPermission("suppressAccessChecks")); - return new AccessControlContext( - new ProtectionDomain[]{ - new ProtectionDomain(null, perms), - }); - } - private static boolean isJDKInternal() { // avoid "string repackaging" return MetroConfigLoader.class.getName().startsWith("com." + "sun.xml.internal.ws");
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubeCreator.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubeCreator.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -49,7 +49,7 @@ try { Class<?> factoryClass; if (isJDKInternal(className)) { - factoryClass = Class.forName(className, true, null); + factoryClass = Class.forName(className, true, TubeCreator.class.getClassLoader()); } else { factoryClass = Class.forName(className, true, tubeFactoryClassLoader); }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubelineAssemblyController.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubelineAssemblyController.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -109,11 +109,12 @@ } private Collection<TubeCreator> initializeTubeCreators(TubeFactoryList tfl) { - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + ClassLoader classLoader = tccl != null ? tccl : TubelineAssemblyController.class.getClassLoader(); LinkedList<TubeCreator> tubeCreators = new LinkedList<TubeCreator>(); for (TubeFactoryConfig tubeFactoryConfig : tfl.getTubeFactoryConfigs()) { - tubeCreators.addFirst(new TubeCreator(tubeFactoryConfig, contextClassLoader)); + tubeCreators.addFirst(new TubeCreator(tubeFactoryConfig, classLoader)); } return tubeCreators; }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -91,7 +91,8 @@ import java.lang.reflect.Proxy; import java.net.MalformedURLException; import java.net.URL; -import java.security.*; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -715,11 +716,6 @@ final ClassLoader loader = getDelegatingLoader(portInterface.getClassLoader(), WSServiceDelegate.class.getClassLoader()); - // accessClassInPackage privilege needs to be granted ... - RuntimePermission perm = new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.*"); - PermissionCollection perms = perm.newPermissionCollection(); - perms.add(perm); - return AccessController.doPrivileged( new PrivilegedAction<T>() { @Override @@ -728,12 +724,8 @@ new Class[]{portInterface, WSBindingProvider.class, Closeable.class}, pis); return portInterface.cast(proxy); } - }, - new AccessControlContext( - new ProtectionDomain[]{ - new ProtectionDomain(null, perms) - }) - ); + }); + } private WSDLService getWSDLModelfromSEI(final Class sei) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -58,12 +58,8 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.lang.reflect.ReflectPermission; -import java.security.AccessControlContext; import java.security.AccessController; -import java.security.Permissions; import java.security.PrivilegedAction; -import java.security.ProtectionDomain; import java.util.Iterator; import java.util.Map; import java.util.logging.Level; @@ -569,9 +565,6 @@ // in jdk runtime doPrivileged is necessary since JAX-WS internal classes are in restricted packages if (isJDKRuntime()) { - Permissions permissions = new Permissions(); - permissions.add(new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.ws.fault")); - permissions.add(new ReflectPermission("suppressAccessChecks")); return AccessController.doPrivileged( new PrivilegedAction<JAXBContext>() { @Override @@ -582,9 +575,7 @@ throw new Error(e); } } - }, - new AccessControlContext(new ProtectionDomain[]{new ProtectionDomain(null, permissions)}) - ); + }); } else { try {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Injector.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Injector.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, 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 @@ -50,28 +50,36 @@ private static final Method definePackage; static { + Method[] m = AccessController.doPrivileged( + new PrivilegedAction<Method[]>() { + @Override + public Method[] run() { + return new Method[]{ + getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE), + getMethod(ClassLoader.class, "resolveClass", Class.class), + getMethod(ClassLoader.class, "getPackage", String.class), + getMethod(ClassLoader.class, "definePackage", + String.class, String.class, String.class, String.class, + String.class, String.class, String.class, URL.class) + }; + } + } + ); + defineClass = m[0]; + resolveClass = m[1]; + getPackage = m[2]; + definePackage = m[3]; + } + + private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params) { try { - defineClass = ClassLoader.class.getDeclaredMethod("defineClass",String.class,byte[].class,Integer.TYPE,Integer.TYPE); - resolveClass = ClassLoader.class.getDeclaredMethod("resolveClass",Class.class); - getPackage = ClassLoader.class.getDeclaredMethod("getPackage", String.class); - definePackage = ClassLoader.class.getDeclaredMethod("definePackage", - String.class, String.class, String.class, String.class, - String.class, String.class, String.class, URL.class); + Method m = c.getDeclaredMethod(methodname, params); + m.setAccessible(true); + return m; } catch (NoSuchMethodException e) { // impossible throw new NoSuchMethodError(e.getMessage()); } - AccessController.doPrivileged(new PrivilegedAction<Void>() { - public Void run() { - // TODO: check security implication - // do these setAccessible allow anyone to call these methods freely?s - defineClass.setAccessible(true); - resolveClass.setAccessible(true); - getPackage.setAccessible(true); - definePackage.setAccessible(true); - return null; - } - }); } static synchronized Class inject(ClassLoader cl, String className, byte[] image) {
--- a/jdk/.hgtags Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/.hgtags Tue Aug 05 12:14:11 2014 -0700 @@ -266,3 +266,5 @@ 2df45ac1bf491278f38c12e0dfbeebadb6c54c8c jdk9-b21 85bcf0f99edc08873614afbe5a5563e13ce13c83 jdk9-b22 9febf9dbc0a4b15323f2dbd29931cfbf086332b4 jdk9-b23 +875450e7ef8dde8f59db662ec1351ea30b8cb35d jdk9-b24 +a31efe49556a7c12f9ea2c9ee8b4fae8aa67723a jdk9-b25
--- a/jdk/make/Setup.gmk Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/make/Setup.gmk Tue Aug 05 12:14:11 2014 -0700 @@ -27,7 +27,7 @@ # To build with all warnings enabled, do the following: # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" -JAVAC_WARNINGS := -Xlint:all,-deprecation,-rawtypes,-unchecked -Werror +JAVAC_WARNINGS := -Xlint:all,-deprecation -Werror # Any java code executed during a JDK build to build other parts of the JDK must be # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this
--- a/jdk/src/share/classes/com/sun/jndi/cosnaming/CNCtx.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/cosnaming/CNCtx.java Tue Aug 05 12:14:11 2014 -0700 @@ -1145,7 +1145,7 @@ // Never destroy an orb in CNCtx. // The orb we have is either the shared/default orb, or one passed in to a constructor - // from elsewhere, so that orb is somebody else's reponsibility. + // from elsewhere, so that orb is somebody else's responsibility. } protected void finalize() {
--- a/jdk/src/share/classes/com/sun/jndi/dns/DnsClient.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/dns/DnsClient.java Tue Aug 05 12:14:11 2014 -0700 @@ -376,7 +376,7 @@ /** - * Tries to retreive an UDP packet matching the given xid + * Tries to retrieve a UDP packet matching the given xid * received within the timeout. * If a packet with different xid is received, the received packet * is enqueued with the corresponding xid in 'resps'.
--- a/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java Tue Aug 05 12:14:11 2014 -0700 @@ -137,7 +137,7 @@ limit = (entries == null) ? 0 : entries.size(); // handle empty set posn = 0; // reset - // mimimize the number of calls to processReturnCode() + // minimize the number of calls to processReturnCode() // (expensive when batchSize is small and there are many results) if ((res.status != LdapClient.LDAP_SUCCESS) || ((res.status == LdapClient.LDAP_SUCCESS) &&
--- a/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java Tue Aug 05 12:14:11 2014 -0700 @@ -196,7 +196,7 @@ System.out.println("ClientId received an exception"); e.printStackTrace(); } - // Failed to invoke the comparator; flag unequality + // Failed to invoke the comparator; flag inequality return false; } if (((Integer) ret) == 0) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/EventQueue.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/EventQueue.java Tue Aug 05 12:14:11 2014 -0700 @@ -75,7 +75,7 @@ * Enqueue an event. * @param event Either a <tt>NamingExceptionEvent</tt> or a subclass * of <tt>NamingEvent</tt> or - * <tt>UnsolicitedNotificatoniEvent</tt>. + * <tt>UnsolicitedNotificationEvent</tt>. * If it is a subclass of <tt>NamingEvent</tt>, all listeners must implement * the corresponding subinterface of <tt>NamingListener</tt>. * For example, for a <tt>ObjectAddedEvent</tt>, all listeners <em>must</em> @@ -141,7 +141,7 @@ // it is interested in. (No need to check mask or // instanceof subinterfaces.) // It is the responsibility of the enqueuer to - // only enqueue events with listseners of the correct type. + // only enqueue events with listeners of the correct type. if (e instanceof NamingEvent) { ((NamingEvent)e).dispatch(v.elementAt(i));
--- a/jdk/src/share/classes/com/sun/jndi/ldap/EventSupport.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/EventSupport.java Tue Aug 05 12:14:11 2014 -0700 @@ -83,7 +83,7 @@ *a new notifier is created for the listener. * *<h4>Deregistration</h4> - *When a deregistration request is made, this class attemps to find its + *When a deregistration request is made, this class attempts to find its *corresponding notifier. If the notifier is found, the listener is removed *from the notifier's list. If the listener is the last listener on the list, *the notifier's thread is terminated and removed from this class's hashtable.
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapAttribute.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapAttribute.java Tue Aug 05 12:14:11 2014 -0700 @@ -34,7 +34,7 @@ /** * This subclass is used by LDAP to implement the schema calls. * Basically, it keeps track of which context it is an attribute of - * so it can get the schema for that cotnext. + * so it can get the schema for that context. * * @author Jon Ruiz */ @@ -134,7 +134,7 @@ // setup internal state this.setBaseCtxInfo(); - // let the ObjectOutpurStream do the real work of serialization + // let the ObjectOutputStream do the real work of serialization out.defaultWriteObject(); }
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Tue Aug 05 12:14:11 2014 -0700 @@ -1651,7 +1651,7 @@ * * This function is called regardless of the server's version, since * an administrator may have setup the server to support client schema - * queries. If this function trys a serarch on a v2 server that + * queries. If this function tries a search on a v2 server that * doesn't support schema, one of these two things will happen: * 1) It will get an exception when querying the root DSE * 2) It will not find a subschemasubentry on the root DSE @@ -2016,7 +2016,7 @@ * - the returning attributes list is present but empty */ - // returns true if a search can be caried out as a compare, and sets + // returns true if a search can be carried out as a compare, and sets // tokens[0] and tokens[1] to the type and value respectively. // e.g. filter "cn=Jon Ruiz" becomes, type "cn" and value "Jon Ruiz" // This function uses the documents JNDI Compare example as a model @@ -2083,7 +2083,7 @@ return false; // unbalanced } - // make sure the left and right half are not expresions themselves + // make sure the left and right half are not expressions themselves StringTokenizer illegalCharsTokenizer = new StringTokenizer(tokens[0], "()&|!=~><*", true); @@ -2443,7 +2443,7 @@ } /** - * Set whether aliases are derefereced during resolution and searches. + * Set whether aliases are dereferenced during resolution and searches. */ private void setDerefAliases(String deref) { if (deref != null) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java Tue Aug 05 12:14:11 2014 -0700 @@ -346,8 +346,8 @@ } /** - * Given an attribute value formated according to RFC 2253, - * returns the unformated value. Returns a string value as + * Given an attribute value formatted according to RFC 2253, + * returns the unformatted value. Returns a string value as * a string, and a binary value as a byte array. */ public static Object unescapeAttributeValue(String val) { @@ -687,7 +687,7 @@ private final boolean binary; private final boolean valueCaseSensitive; - // If non-null, a canonical represention of the value suitable + // If non-null, a canonical representation of the value suitable // for comparison using String.compareTo(). private String comparable = null; @@ -842,8 +842,8 @@ } /* - * Given an attribute value formated according to RFC 2253, - * returns the unformated value. Escapes and quotes are + * Given an attribute value formatted according to RFC 2253, + * returns the unformatted value. Escapes and quotes are * stripped away, and hex-encoded UTF-8 is converted to 16-bit * Unicode chars. Returns a string value as a String, and a * binary value as a byte array.
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java Tue Aug 05 12:14:11 2014 -0700 @@ -679,7 +679,7 @@ } catch (LdapReferralException e) { - // %%% VR - setNameResolved(true); + // %%% setNameResolved(true); // append (referrals from) the exception that generated this // context to the new exception, so that referral processing @@ -897,7 +897,7 @@ /* * Use the attributes and scope components from the LDAP URL (if present) - * to override the corrpesonding components supplied in SearchControls. + * to override the corresponding components supplied in SearchControls. */ private SearchControls overrideAttributesAndScope(SearchControls cons) { SearchControls urlCons;
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapRequest.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapRequest.java Tue Aug 05 12:14:11 2014 -0700 @@ -62,7 +62,7 @@ cancelled = true; // Unblock reader of pending request - // Should only ever have atmost one waiter + // Should only ever have at most one waiter notify(); }
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java Tue Aug 05 12:14:11 2014 -0700 @@ -84,7 +84,7 @@ // Object Class specific IDs private static final String ABSTRACT_ID = "ABSTRACT"; private static final String STRUCTURAL_ID = "STRUCTURAL"; - private static final String AUXILARY_ID = "AUXILIARY"; + private static final String AUXILIARY_ID = "AUXILIARY"; private static final String MUST_ID = "MUST"; private static final String MAY_ID = "MAY"; @@ -300,8 +300,8 @@ return new Object[] {currentName, attrs}; } - // returns the index of the first whitespace char of a linear whitspace - // sequince ending at the given position. + // returns the index of the first whitespace char of a linear whitespace + // sequence ending at the given position. final private static int findTrailingWhitespace(String string, int pos) { for(int i = pos; i > 0; i--) { if(string.charAt(i) != WHSP) { @@ -423,7 +423,7 @@ if (tag.equals(OBSOLETE_ID) || tag.equals(ABSTRACT_ID) || tag.equals(STRUCTURAL_ID) || - tag.equals(AUXILARY_ID) || + tag.equals(AUXILIARY_ID) || tag.equals(SINGLE_VAL_ID) || tag.equals(COLLECTIVE_ID) || tag.equals(NO_USER_MOD_ID)) { @@ -819,7 +819,7 @@ count++; } - attr = attrs.get(AUXILARY_ID); + attr = attrs.get(AUXILIARY_ID); if (attr != null) { objectDesc.append(writeBoolean(attr)); count++; @@ -856,7 +856,7 @@ attrId.equals(MUST_ID) || attrId.equals(STRUCTURAL_ID) || attrId.equals(DESC_ID) || - attrId.equals(AUXILARY_ID) || + attrId.equals(AUXILIARY_ID) || attrId.equals(ABSTRACT_ID) || attrId.equals(OBSOLETE_ID)) { continue;
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java Tue Aug 05 12:14:11 2014 -0700 @@ -156,7 +156,7 @@ String[] reqAttrs; if ((reqAttrs = searchArgs.reqAttrs) != null) { // create an attribute set for those requested - Attributes rattrs = new BasicAttributes(true); // caseignore + Attributes rattrs = new BasicAttributes(true); // ignore case for (int i = 0; i < reqAttrs.length; i++) { rattrs.put(reqAttrs[i], null); } @@ -213,8 +213,6 @@ // Update search-specific variables LdapSearchEnumeration se = (LdapSearchEnumeration)ne; startName = se.startName; -//VR - keep original args, don't overwite with current args -// searchArgs = se.searchArgs; } void setStartName(Name nm) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapURL.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapURL.java Tue Aug 05 12:14:11 2014 -0700 @@ -162,7 +162,7 @@ } /** - * Derermines whether an LDAP URL has query components. + * Determines whether an LDAP URL has query components. */ public static boolean hasQueryComponents(String url) { return (url.lastIndexOf('?') != -1);
--- a/jdk/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java Tue Aug 05 12:14:11 2014 -0700 @@ -62,7 +62,7 @@ * * @param dn A string distinguished name (RFC 2253). * @return A domain name or null if none can be derived. - * @throw InvalidNameException If the distinugished name is invalid. + * @throw InvalidNameException If the distinguished name is invalid. */ static String mapDnToDomainName(String dn) throws InvalidNameException { if (dn == null) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper.java Tue Aug 05 12:14:11 2014 -0700 @@ -25,32 +25,77 @@ package com.sun.jndi.ldap; +import sun.misc.SharedSecrets; + import java.net.MalformedURLException; import java.net.URL; +import java.net.URLClassLoader; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.PrivilegedAction; -abstract class VersionHelper { +public final class VersionHelper { + + private static final VersionHelper helper = new VersionHelper(); - private static final VersionHelper helper = new VersionHelper12(); + /** + * Determines whether classes may be loaded from an arbitrary URL code base. + */ + private static final boolean trustURLCodebase; - VersionHelper() {} // Disallow anyone from creating one of these. + static { + // System property to control whether classes may be loaded from an + // arbitrary URL code base + PrivilegedAction<String> act = + () -> System.getProperty("com.sun.jndi.ldap.object.trustURLCodebase", "false"); + String trust = AccessController.doPrivileged(act); + trustURLCodebase = "true".equalsIgnoreCase(trust); + } + + private VersionHelper() { } static VersionHelper getVersionHelper() { return helper; } - abstract ClassLoader getURLClassLoader(String[] url) - throws MalformedURLException; + ClassLoader getURLClassLoader(String[] url) throws MalformedURLException { + ClassLoader parent = getContextClassLoader(); + /* + * Classes may only be loaded from an arbitrary URL code base when + * the system property com.sun.jndi.ldap.object.trustURLCodebase + * has been set to "true". + */ + if (url != null && trustURLCodebase) { + return URLClassLoader.newInstance(getUrlArray(url), parent); + } else { + return parent; + } + } + Class<?> loadClass(String className) throws ClassNotFoundException { + return Class.forName(className, true, getContextClassLoader()); + } - static protected URL[] getUrlArray(String[] url) throws MalformedURLException { + Thread createThread(Runnable r) { + AccessControlContext acc = AccessController.getContext(); + // 4290486: doPrivileged is needed to create a thread in + // an environment that restricts "modifyThreadGroup". + PrivilegedAction<Thread> act = + () -> SharedSecrets.getJavaLangAccess().newThreadWithAcc(r, acc); + return AccessController.doPrivileged(act); + } + + private ClassLoader getContextClassLoader() { + PrivilegedAction<ClassLoader> act = + Thread.currentThread()::getContextClassLoader; + return AccessController.doPrivileged(act); + } + + private static URL[] getUrlArray(String[] url) throws MalformedURLException { URL[] urlArray = new URL[url.length]; for (int i = 0; i < urlArray.length; i++) { urlArray[i] = new URL(url[i]); } return urlArray; } - - abstract Class<?> loadClass(String className) throws ClassNotFoundException; - - abstract Thread createThread(Runnable r); }
--- a/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java Tue Aug 05 15:39:05 2014 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.ldap; - -import java.net.URLClassLoader; -import java.net.MalformedURLException; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.PrivilegedAction; -import sun.misc.SharedSecrets; - -final class VersionHelper12 extends VersionHelper { - - // System property to control whether classes may be loaded from an - // arbitrary URL code base. - private static final String TRUST_URL_CODEBASE_PROPERTY = - "com.sun.jndi.ldap.object.trustURLCodebase"; - - // Determine whether classes may be loaded from an arbitrary URL code base. - private static final String trustURLCodebase = - AccessController.doPrivileged( - new PrivilegedAction<String>() { - public String run() { - return System.getProperty(TRUST_URL_CODEBASE_PROPERTY, - "false"); - } - } - ); - - VersionHelper12() {} // Disallow external from creating one of these. - - ClassLoader getURLClassLoader(String[] url) - throws MalformedURLException { - ClassLoader parent = getContextClassLoader(); - /* - * Classes may only be loaded from an arbitrary URL code base when - * the system property com.sun.jndi.ldap.object.trustURLCodebase - * has been set to "true". - */ - if (url != null && "true".equalsIgnoreCase(trustURLCodebase)) { - return URLClassLoader.newInstance(getUrlArray(url), parent); - } else { - return parent; - } - } - - Class<?> loadClass(String className) throws ClassNotFoundException { - ClassLoader cl = getContextClassLoader(); - return Class.forName(className, true, cl); - } - - private ClassLoader getContextClassLoader() { - return AccessController.doPrivileged( - new PrivilegedAction<ClassLoader>() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - } - ); - } - - Thread createThread(final Runnable r) { - final AccessControlContext acc = AccessController.getContext(); - // 4290486: doPrivileged is needed to create a thread in - // an environment that restricts "modifyThreadGroup". - return AccessController.doPrivileged( - new PrivilegedAction<Thread>() { - public Thread run() { - return SharedSecrets.getJavaLangAccess() - .newThreadWithAcc(r, acc); - } - } - ); - } -}
--- a/jdk/src/share/classes/com/sun/jndi/ldap/pool/Connections.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/pool/Connections.java Tue Aug 05 12:14:11 2014 -0700 @@ -254,7 +254,7 @@ /** * Removes PooledConnection from list of connections. * The closing of the connection is separate from this method. - * This method is called usually when the caller encouters an error + * This method is called usually when the caller encounters an error * when using the connection and wants it removed from the pool. * * @return true if conn removed; false if it was not in pool
--- a/jdk/src/share/classes/com/sun/jndi/ldap/pool/Pool.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/pool/Pool.java Tue Aug 05 12:14:11 2014 -0700 @@ -68,8 +68,8 @@ * whenever a pooled connection is requested or a call to remove the expired * connections is made. The monitoring is done regularly when idle connection * timeout is set as the PoolCleaner removes expired connections periodically. - * As determined by the experiements, cleanup of resources using the - * ReferenceQueue mechanism is reliable and has immidiate effect than the + * As determined by experimentation, cleanup of resources using the + * ReferenceQueue mechanism is reliable and has more immediate effect than the * finalizer approach. * * @author Rosanna Lee
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java Tue Aug 05 12:14:11 2014 -0700 @@ -96,7 +96,7 @@ * Resolves the nns for 'name' when the named context is acting * as an intermediate context. * - * For a system that supports junctions, this would be equilvalent to + * For a system that supports junctions, this would be equivalent to * a_lookup(name, cont); * because for junctions, an intermediate slash simply signifies * a syntactic separator. @@ -487,7 +487,7 @@ resolve_to_nns_and_continue(name, cont); return null; } else { - // use COmponentContext + // use ComponentContext return super.c_getNameParser_nns(name, cont); } }
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java Tue Aug 05 12:14:11 2014 -0700 @@ -137,7 +137,7 @@ * as an intermediate context. * * For a system that supports only junctions, this would be - * equilvalent to + * equivalent to * c_lookup(name, cont); * because for junctions, an intermediate slash simply signifies * a syntactic separator.
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Tue Aug 05 12:14:11 2014 -0700 @@ -172,7 +172,7 @@ * * This method is typically called by _nns methods that have been * given a name to process. It might process part of that name but - * encountered some error. Consequenetly, it would call setErrorNNS() + * encountered some error. Consequently, it would call setErrorNNS() * with the remaining name. Since the _nns method was expected to * operate upon the "nns" of the original name, the remaining name * must include the "nns". That's why this method adds a trailing "/". @@ -219,7 +219,7 @@ * * This method is typically called by methods that have been * given a name to process. It might process part of that name but - * encountered some error. Consequenetly, it would call setError() + * encountered some error. Consequently, it would call setError() * with the resolved object and the remaining name. *<p> * After this method is called, isContinuing() returns false.
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Tue Aug 05 12:14:11 2014 -0700 @@ -182,14 +182,14 @@ if (!currentReturned) { // returning parent - if(debug) {System.out.println("getNextDescedant: simple case");} + if(debug) {System.out.println("getNextDescendant: simple case");} currentReturned = true; return currentChild; } else if (currentChildExpanded && currentChildEnum.hasMore()) { - if(debug) {System.out.println("getNextDescedant: expanded case");} + if(debug) {System.out.println("getNextDescendant: expanded case");} // if the current child is expanded, use it's enumerator return currentChildEnum.next(); @@ -197,7 +197,7 @@ } else { // Ready to go onto next child - if(debug) {System.out.println("getNextDescedant: next case");} + if(debug) {System.out.println("getNextDescendant: next case");} prepNextChild(); return getNextDescendant();
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java Tue Aug 05 12:14:11 2014 -0700 @@ -881,8 +881,8 @@ } } - // CompundNames's HashCode() method isn't good enough for many string. - // The only prupose of this subclass is to have a more discerning + // CompoundNames's HashCode() method isn't good enough for many strings. + // The only purpose of this subclass is to have a more discerning // hash function. We'll make up for the performance hit by caching // the hash value.
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java Tue Aug 05 12:14:11 2014 -0700 @@ -152,7 +152,7 @@ } else if (useFactory) { try { // Give name only if context non-null, - // otherewise, name will be interpreted relative + // otherwise, name will be interpreted relative // to initial context (not what we want) Name nm = (context != null ? new CompositeName(next.getName()) : null);
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java Tue Aug 05 12:14:11 2014 -0700 @@ -256,7 +256,7 @@ static final int LESS_MATCH = 4; /** - * A class for dealing wtih atomic filters + * A class for dealing with atomic filters */ final class AtomicFilter implements StringFilter { private String attrID; @@ -369,7 +369,7 @@ } break; default: - if (debug) {System.out.println("AtomicFilter: unkown " + + if (debug) {System.out.println("AtomicFilter: unknown " + "matchType");} } } @@ -434,7 +434,7 @@ /** - * Creates an LDAP filter as a conjuction of the attributes supplied. + * Creates an LDAP filter as a conjunction of the attributes supplied. */ public static String format(Attributes attrs) throws NamingException { if (attrs == null || attrs.size() == 0) {
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Tue Aug 05 12:14:11 2014 -0700 @@ -168,7 +168,7 @@ } } - // else 0 or 1 iniitial slashes; start is unchanged + // else 0 or 1 initial slashes; start is unchanged return url.substring(0, start); }
--- a/jdk/src/share/classes/com/sun/jndi/url/ldap/ldapURLContext.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/jndi/url/ldap/ldapURLContext.java Tue Aug 05 12:14:11 2014 -0700 @@ -562,7 +562,7 @@ } // Search using the LDAP URL in name. - // LDAP URL query components override the search argments. + // LDAP URL query components override the search arguments. private NamingEnumeration<SearchResult> searchUsingURL(String name) throws NamingException {
--- a/jdk/src/share/classes/com/sun/management/GcInfo.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/management/GcInfo.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -267,7 +267,7 @@ return cdata.toString(); } - public Collection values() { + public Collection<?> values() { return cdata.values(); }
--- a/jdk/src/share/classes/com/sun/naming/internal/VersionHelper.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/naming/internal/VersionHelper.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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,14 +25,19 @@ package com.sun.naming.internal; +import javax.naming.NamingEnumeration; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.util.StringTokenizer; -import java.util.Vector; - -import javax.naming.NamingEnumeration; +import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.*; /** * VersionHelper was used by JNDI to accommodate differences between @@ -45,10 +50,10 @@ * @author Scott Seligman */ -public abstract class VersionHelper { - private static VersionHelper helper = null; +public final class VersionHelper { + private static final VersionHelper helper = new VersionHelper(); - final static String[] PROPS = new String[] { + final static String[] PROPS = new String[]{ javax.naming.Context.INITIAL_CONTEXT_FACTORY, javax.naming.Context.OBJECT_FACTORIES, javax.naming.Context.URL_PKG_PREFIXES, @@ -67,31 +72,57 @@ public final static int DNS_URL = 5; public final static int CONTROL_FACTORIES = 6; - VersionHelper() {} // Disallow anyone from creating one of these. - - static { - helper = new VersionHelper12(); - } + private VersionHelper() {} // Disallow anyone from creating one of these. public static VersionHelper getVersionHelper() { return helper; } - public abstract Class<?> loadClass(String className) - throws ClassNotFoundException; + public Class<?> loadClass(String className) throws ClassNotFoundException { + return loadClass(className, getContextClassLoader()); + } + + /** + * @param className A non-null fully qualified class name. + * @param codebase A non-null, space-separated list of URL strings. + */ + public Class<?> loadClass(String className, String codebase) + throws ClassNotFoundException, MalformedURLException { + + ClassLoader parent = getContextClassLoader(); + ClassLoader cl = + URLClassLoader.newInstance(getUrlArray(codebase), parent); - abstract Class<?> loadClass(String className, ClassLoader cl) - throws ClassNotFoundException; + return loadClass(className, cl); + } - public abstract Class<?> loadClass(String className, String codebase) - throws ClassNotFoundException, MalformedURLException; + /** + * Package private. + * <p> + * This internal method is used with Thread Context Class Loader (TCCL), + * please don't expose this method as public. + */ + Class<?> loadClass(String className, ClassLoader cl) + throws ClassNotFoundException { + Class<?> cls = Class.forName(className, true, cl); + return cls; + } /* - * Returns a JNDI property from the system properties. Returns + * Returns a JNDI property from the system properties. Returns * null if the property is not set, or if there is no permission * to read it. */ - abstract String getJndiProperty(int i); + String getJndiProperty(int i) { + PrivilegedAction<String> act = () -> { + try { + return System.getProperty(PROPS[i]); + } catch (SecurityException e) { + return null; + } + }; + return AccessController.doPrivileged(act); + } /* * Reads each property in PROPS from the system properties, and @@ -99,13 +130,33 @@ * unset property, the corresponding array element is set to null. * Returns null if there is no permission to call System.getProperties(). */ - abstract String[] getJndiProperties(); + String[] getJndiProperties() { + PrivilegedAction<Properties> act = () -> { + try { + return System.getProperties(); + } catch (SecurityException e) { + return null; + } + }; + Properties sysProps = AccessController.doPrivileged(act); + if (sysProps == null) { + return null; + } + String[] jProps = new String[PROPS.length]; + for (int i = 0; i < PROPS.length; i++) { + jProps[i] = sysProps.getProperty(PROPS[i]); + } + return jProps; + } /* * Returns the resource of a given name associated with a particular * class (never null), or null if none can be found. */ - abstract InputStream getResourceAsStream(Class<?> c, String name); + InputStream getResourceAsStream(Class<?> c, String name) { + PrivilegedAction<InputStream> act = () -> c.getResourceAsStream(name); + return AccessController.doPrivileged(act); + } /* * Returns an input stream for a file in <java.home>/lib, @@ -113,7 +164,22 @@ * * @param filename The file name, sans directory. */ - abstract InputStream getJavaHomeLibStream(String filename); + InputStream getJavaHomeLibStream(String filename) { + PrivilegedAction<InputStream> act = () -> { + try { + String javahome = System.getProperty("java.home"); + if (javahome == null) { + return null; + } + String pathname = javahome + File.separator + + "lib" + File.separator + filename; + return new FileInputStream(pathname); + } catch (Exception e) { + return null; + } + }; + return AccessController.doPrivileged(act); + } /* * Returns an enumeration (never null) of InputStreams of the @@ -121,29 +187,55 @@ * loader. Null represents the bootstrap class loader in some * Java implementations. */ - abstract NamingEnumeration<InputStream> getResources( - ClassLoader cl, String name) - throws IOException; + NamingEnumeration<InputStream> getResources(ClassLoader cl, + String name) throws IOException { + Enumeration<URL> urls; + PrivilegedExceptionAction<Enumeration<URL>> act = () -> + (cl == null) + ? ClassLoader.getSystemResources(name) + : cl.getResources(name); + try { + urls = AccessController.doPrivileged(act); + } catch (PrivilegedActionException e) { + throw (IOException) e.getException(); + } + return new InputStreamEnumeration(urls); + } + - /* - * Returns the context class loader associated with the current thread. - * Null indicates the bootstrap class loader in some Java implementations. - * - * @throws SecurityException if the class loader is not accessible. + /** + * Package private. + * <p> + * This internal method returns Thread Context Class Loader (TCCL), + * if null, returns the system Class Loader. + * <p> + * Please don't expose this method as public. + * @throws SecurityException if the class loader is not accessible */ - abstract ClassLoader getContextClassLoader(); + ClassLoader getContextClassLoader() { - static protected URL[] getUrlArray(String codebase) - throws MalformedURLException { + PrivilegedAction<ClassLoader> act = () -> { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + if (loader == null) { + // Don't use bootstrap class loader directly! + loader = ClassLoader.getSystemClassLoader(); + } + return loader; + }; + return AccessController.doPrivileged(act); + } + + private static URL[] getUrlArray(String codebase) + throws MalformedURLException { // Parse codebase into separate URLs StringTokenizer parser = new StringTokenizer(codebase); - Vector<String> vec = new Vector<>(10); + List<String> list = new ArrayList<>(); while (parser.hasMoreTokens()) { - vec.addElement(parser.nextToken()); + list.add(parser.nextToken()); } - String[] url = new String[vec.size()]; + String[] url = new String[list.size()]; for (int i = 0; i < url.length; i++) { - url[i] = vec.elementAt(i); + url[i] = list.get(i); } URL[] urlArray = new URL[url.length]; @@ -152,4 +244,70 @@ } return urlArray; } + + /** + * Given an enumeration of URLs, an instance of this class represents + * an enumeration of their InputStreams. Each operation on the URL + * enumeration is performed within a doPrivileged block. + * This is used to enumerate the resources under a foreign codebase. + * This class is not MT-safe. + */ + private class InputStreamEnumeration implements + NamingEnumeration<InputStream> { + + private final Enumeration<URL> urls; + + private InputStream nextElement; + + InputStreamEnumeration(Enumeration<URL> urls) { + this.urls = urls; + } + + /* + * Returns the next InputStream, or null if there are no more. + * An InputStream that cannot be opened is skipped. + */ + private InputStream getNextElement() { + PrivilegedAction<InputStream> act = () -> { + while (urls.hasMoreElements()) { + try { + return urls.nextElement().openStream(); + } catch (IOException e) { + // skip this URL + } + } + return null; + }; + return AccessController.doPrivileged(act); + } + + public boolean hasMore() { + if (nextElement != null) { + return true; + } + nextElement = getNextElement(); + return (nextElement != null); + } + + public boolean hasMoreElements() { + return hasMore(); + } + + public InputStream next() { + if (hasMore()) { + InputStream res = nextElement; + nextElement = null; + return res; + } else { + throw new NoSuchElementException(); + } + } + + public InputStream nextElement() { + return next(); + } + + public void close() { + } + } }
--- a/jdk/src/share/classes/com/sun/naming/internal/VersionHelper12.java Tue Aug 05 15:39:05 2014 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.naming.internal; - -import java.io.InputStream; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URLClassLoader; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.Enumeration; -import java.util.NoSuchElementException; -import java.util.Properties; - -import javax.naming.*; - -/** - * VersionHelper was used by JNDI to accommodate differences between - * JDK 1.1.x and the Java 2 platform. As this is no longer necessary - * since JNDI's inclusion in the platform, this class currently - * serves as a set of utilities for performing system-level things, - * such as class-loading and reading system properties. - * - * @author Rosanna Lee - * @author Scott Seligman - */ - -final class VersionHelper12 extends VersionHelper { - - // Disallow external from creating one of these. - VersionHelper12() { - } - - public Class<?> loadClass(String className) throws ClassNotFoundException { - return loadClass(className, getContextClassLoader()); - } - - /** - * Package private. - * - * This internal method is used with Thread Context Class Loader (TCCL), - * please don't expose this method as public. - */ - Class<?> loadClass(String className, ClassLoader cl) - throws ClassNotFoundException { - Class<?> cls = Class.forName(className, true, cl); - return cls; - } - - /** - * @param className A non-null fully qualified class name. - * @param codebase A non-null, space-separated list of URL strings. - */ - public Class<?> loadClass(String className, String codebase) - throws ClassNotFoundException, MalformedURLException { - - ClassLoader parent = getContextClassLoader(); - ClassLoader cl = - URLClassLoader.newInstance(getUrlArray(codebase), parent); - - return loadClass(className, cl); - } - - String getJndiProperty(final int i) { - return AccessController.doPrivileged( - new PrivilegedAction<String>() { - public String run() { - try { - return System.getProperty(PROPS[i]); - } catch (SecurityException e) { - return null; - } - } - } - ); - } - - String[] getJndiProperties() { - Properties sysProps = AccessController.doPrivileged( - new PrivilegedAction<Properties>() { - public Properties run() { - try { - return System.getProperties(); - } catch (SecurityException e) { - return null; - } - } - } - ); - if (sysProps == null) { - return null; - } - String[] jProps = new String[PROPS.length]; - for (int i = 0; i < PROPS.length; i++) { - jProps[i] = sysProps.getProperty(PROPS[i]); - } - return jProps; - } - - InputStream getResourceAsStream(final Class<?> c, final String name) { - return AccessController.doPrivileged( - new PrivilegedAction<InputStream>() { - public InputStream run() { - return c.getResourceAsStream(name); - } - } - ); - } - - InputStream getJavaHomeLibStream(final String filename) { - return AccessController.doPrivileged( - new PrivilegedAction<InputStream>() { - public InputStream run() { - try { - String javahome = System.getProperty("java.home"); - if (javahome == null) { - return null; - } - String pathname = javahome + java.io.File.separator + - "lib" + java.io.File.separator + filename; - return new java.io.FileInputStream(pathname); - } catch (Exception e) { - return null; - } - } - } - ); - } - - NamingEnumeration<InputStream> getResources(final ClassLoader cl, - final String name) throws IOException { - Enumeration<URL> urls; - try { - urls = AccessController.doPrivileged( - new PrivilegedExceptionAction<Enumeration<URL>>() { - public Enumeration<URL> run() throws IOException { - return (cl == null) - ? ClassLoader.getSystemResources(name) - : cl.getResources(name); - } - } - ); - } catch (PrivilegedActionException e) { - throw (IOException)e.getException(); - } - return new InputStreamEnumeration(urls); - } - - /** - * Package private. - * - * This internal method returns Thread Context Class Loader (TCCL), - * if null, returns the system Class Loader. - * - * Please don't expose this method as public. - */ - ClassLoader getContextClassLoader() { - - return AccessController.doPrivileged( - new PrivilegedAction<ClassLoader>() { - public ClassLoader run() { - ClassLoader loader = - Thread.currentThread().getContextClassLoader(); - if (loader == null) { - // Don't use bootstrap class loader directly! - loader = ClassLoader.getSystemClassLoader(); - } - - return loader; - } - } - ); - } - - /** - * Given an enumeration of URLs, an instance of this class represents - * an enumeration of their InputStreams. Each operation on the URL - * enumeration is performed within a doPrivileged block. - * This is used to enumerate the resources under a foreign codebase. - * This class is not MT-safe. - */ - class InputStreamEnumeration implements NamingEnumeration<InputStream> { - - private final Enumeration<URL> urls; - - private InputStream nextElement = null; - - InputStreamEnumeration(Enumeration<URL> urls) { - this.urls = urls; - } - - /* - * Returns the next InputStream, or null if there are no more. - * An InputStream that cannot be opened is skipped. - */ - private InputStream getNextElement() { - return AccessController.doPrivileged( - new PrivilegedAction<InputStream>() { - public InputStream run() { - while (urls.hasMoreElements()) { - try { - return urls.nextElement().openStream(); - } catch (IOException e) { - // skip this URL - } - } - return null; - } - } - ); - } - - public boolean hasMore() { - if (nextElement != null) { - return true; - } - nextElement = getNextElement(); - return (nextElement != null); - } - - public boolean hasMoreElements() { - return hasMore(); - } - - public InputStream next() { - if (hasMore()) { - InputStream res = nextElement; - nextElement = null; - return res; - } else { - throw new NoSuchElementException(); - } - } - - public InputStream nextElement() { - return next(); - } - - public void close() { - } - } -}
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java Tue Aug 05 12:14:11 2014 -0700 @@ -33,18 +33,18 @@ public class ExpressionParser implements ExpressionParserConstants { - Stack stack = new Stack(); + Stack<LValue> stack = new Stack<>(); VirtualMachine vm = null; GetFrame frameGetter = null; private static GetFrame lastFrameGetter; private static LValue lastLValue; LValue peek() { - return (LValue)stack.peek(); + return stack.peek(); } LValue pop() { - return (LValue)stack.pop(); + return stack.pop(); } void push(LValue lval) { @@ -915,7 +915,7 @@ } final public void PrimarySuffix() throws ParseException { - List argList; + List<Value> argList; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: jj_consume_token(LBRACKET); @@ -993,8 +993,8 @@ jj_consume_token(NULL); } - final public List Arguments() throws ParseException { - List argList = new ArrayList(); + final public List<Value> Arguments() throws ParseException { + List<Value> argList = new ArrayList<>(); jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FALSE: @@ -1026,7 +1026,7 @@ throw new Error("Missing return statement in function"); } - final public void ArgumentList(List argList) throws ParseException { + final public void ArgumentList(List<Value> argList) throws ParseException { Expression(); argList.add(pop().interiorGetValue()); label_17: @@ -1046,7 +1046,7 @@ } final public void AllocationExpression() throws ParseException { - List argList; String className; + List<Value> argList; String className; if (jj_2_7(2)) { jj_consume_token(NEW); PrimitiveType();
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaClass.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaClass.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -229,9 +229,9 @@ return name.indexOf('[') != -1; } - public Enumeration getInstances(boolean includeSubclasses) { + public Enumeration<JavaHeapObject> getInstances(boolean includeSubclasses) { if (includeSubclasses) { - Enumeration res = instances.elements(); + Enumeration<JavaHeapObject> res = instances.elements(); for (int i = 0; i < subclasses.length; i++) { res = new CompositeEnumeration(res, subclasses[i].getInstances(true));
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaHeapObject.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaHeapObject.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -166,11 +166,11 @@ * * @return an Enumeration of JavaHeapObject instances */ - public Enumeration getReferers() { + public Enumeration<JavaThing> getReferers() { if (referersLen != -1) { throw new RuntimeException("not resolved: " + getIdString()); } - return new Enumeration() { + return new Enumeration<JavaThing>() { private int num = 0; @@ -178,7 +178,7 @@ return referers != null && num < referers.length; } - public Object nextElement() { + public JavaThing nextElement() { return referers[num++]; } };
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/ReachableExcludesImpl.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/ReachableExcludesImpl.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -54,7 +54,7 @@ private File excludesFile; private long lastModified; - private Hashtable methods; // Hashtable<String, String>, used as a bag + private Hashtable<String, String> methods; // Used as a bag /** * Create a new ReachableExcludesImpl over the given file. The file will be
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/ReachableObjects.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/ReachableObjects.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -86,7 +86,7 @@ // Now grab the elements into a vector, and sort it in decreasing size JavaThing[] things = new JavaThing[bag.size()]; int i = 0; - for (Enumeration e = bag.elements(); e.hasMoreElements(); ) { + for (Enumeration<JavaHeapObject> e = bag.elements(); e.hasMoreElements(); ) { things[i++] = (JavaThing) e.nextElement(); } ArraySorter.sort(things, new Comparer() { @@ -131,7 +131,7 @@ return usedFields; } - private String[] getElements(Hashtable ht) { + private String[] getElements(Hashtable<?, ?> ht) { Object[] keys = ht.keySet().toArray(); int len = keys.length; String[] res = new String[len];
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -81,7 +81,7 @@ new HashMap<JavaHeapObject, Root>(); // soft cache of finalizeable objects - lazily initialized - private SoftReference<Vector> finalizablesCache; + private SoftReference<Vector<?>> finalizablesCache; // represents null reference private JavaThing nullThing; @@ -383,7 +383,7 @@ /** * Return an Iterator of all of the classes in this snapshot. **/ - public Iterator getClasses() { + public Iterator<JavaClass> getClasses() { // note that because classes is a TreeMap // classes are already sorted by name return classes.values().iterator(); @@ -395,8 +395,8 @@ return res; } - public synchronized Enumeration getFinalizerObjects() { - Vector obj; + public synchronized Enumeration<?> getFinalizerObjects() { + Vector<?> obj; if (finalizablesCache != null && (obj = finalizablesCache.get()) != null) { return obj.elements(); @@ -418,7 +418,7 @@ finalizables.add(referent); } } - finalizablesCache = new SoftReference<Vector>(finalizables); + finalizablesCache = new SoftReference<Vector<?>>(finalizables); return finalizables.elements(); } @@ -455,7 +455,7 @@ // Even though curr is in the rootset, we want to explore its // referers, because they might be more interesting. } - Enumeration referers = curr.getReferers(); + Enumeration<JavaThing> referers = curr.getReferers(); while (referers.hasMoreElements()) { JavaHeapObject t = (JavaHeapObject) referers.nextElement(); if (t != null && !visited.containsKey(t)) {
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/oql/OQLEngine.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/oql/OQLEngine.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -51,7 +51,7 @@ // create JavaScript engine Method getEngineMethod = managerClass.getMethod("getEngineByName", - new Class[] { String.class }); + new Class<?>[] { String.class }); Object jse = getEngineMethod.invoke(manager, new Object[] {"js"}); oqlSupported = (jse != null); } catch (Exception exp) { @@ -205,9 +205,9 @@ } if (q.className != null) { - Enumeration objects = clazz.getInstances(q.isInstanceOf); + Enumeration<JavaHeapObject> objects = clazz.getInstances(q.isInstanceOf); while (objects.hasMoreElements()) { - JavaHeapObject obj = (JavaHeapObject) objects.nextElement(); + JavaHeapObject obj = objects.nextElement(); Object[] args = new Object[] { wrapJavaObject(obj) }; boolean b = (whereCode == null); if (!b) { @@ -265,14 +265,14 @@ // create JavaScript engine Method getEngineMethod = managerClass.getMethod("getEngineByName", - new Class[] { String.class }); + new Class<?>[] { String.class }); engine = getEngineMethod.invoke(manager, new Object[] {"js"}); // initialize engine with init file (hat.js) InputStream strm = getInitStream(); Class<?> engineClass = Class.forName("javax.script.ScriptEngine"); evalMethod = engineClass.getMethod("eval", - new Class[] { Reader.class }); + new Class<?>[] { Reader.class }); evalMethod.invoke(engine, new Object[] {new InputStreamReader(strm)}); // initialize ScriptEngine.eval(String) and @@ -280,13 +280,13 @@ Class<?> invocableClass = Class.forName("javax.script.Invocable"); evalMethod = engineClass.getMethod("eval", - new Class[] { String.class }); + new Class<?>[] { String.class }); invokeMethod = invocableClass.getMethod("invokeFunction", - new Class[] { String.class, Object[].class }); + new Class<?>[] { String.class, Object[].class }); // initialize ScriptEngine.put(String, Object) method Method putMethod = engineClass.getMethod("put", - new Class[] { String.class, Object.class }); + new Class<?>[] { String.class, Object.class }); // call ScriptEngine.put to initialize built-in heap object putMethod.invoke(engine, new Object[] {
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -58,10 +58,10 @@ startHtml("All Classes (including platform)"); } - Iterator classes = snapshot.getClasses(); + Iterator<JavaClass> classes = snapshot.getClasses(); String lastPackage = null; while (classes.hasNext()) { - JavaClass clazz = (JavaClass) classes.next(); + JavaClass clazz = classes.next(); if (excludePlatform && PlatformClasses.isPlatformClass(clazz)) { // skip this.. continue;
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/ClassQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/ClassQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -151,7 +151,7 @@ } out.println("<h2>References to this object:</h2>"); out.flush(); - Enumeration referers = obj.getReferers(); + Enumeration<JavaThing> referers = obj.getReferers(); while (referers.hasMoreElements()) { JavaHeapObject ref = (JavaHeapObject) referers.nextElement(); printThing(ref);
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/FinalizerObjectsQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/FinalizerObjectsQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,7 +37,7 @@ public class FinalizerObjectsQuery extends QueryHandler { public void run() { - Enumeration objs = snapshot.getFinalizerObjects(); + Enumeration<?> objs = snapshot.getFinalizerObjects(); startHtml("Objects pending finalization"); out.println("<a href='/finalizerSummary/'>Finalizer summary</a>");
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/FinalizerSummaryQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/FinalizerSummaryQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,7 +37,7 @@ public class FinalizerSummaryQuery extends QueryHandler { public void run() { - Enumeration objs = snapshot.getFinalizerObjects(); + Enumeration<?> objs = snapshot.getFinalizerObjects(); startHtml("Finalizer Summary"); out.println("<p align='center'>"); @@ -74,7 +74,7 @@ private long count; } - private void printFinalizerSummary(Enumeration objs) { + private void printFinalizerSummary(Enumeration<?> objs) { int count = 0; Map<JavaClass, HistogramElement> map = new HashMap<JavaClass, HistogramElement>();
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesCountQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesCountQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -111,10 +111,10 @@ } out.print("</a> "); if (snapshot.getHasNewSet()) { - Enumeration objects = clazz.getInstances(false); + Enumeration<JavaHeapObject> objects = clazz.getInstances(false); int newInst = 0; while (objects.hasMoreElements()) { - JavaHeapObject obj = (JavaHeapObject)objects.nextElement(); + JavaHeapObject obj = objects.nextElement(); if (obj.isNew()) { newInst++; }
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -73,11 +73,11 @@ out.print("<strong>"); printClass(clazz); out.print("</strong><br><br>"); - Enumeration objects = clazz.getInstances(includeSubclasses); + Enumeration<JavaHeapObject> objects = clazz.getInstances(includeSubclasses); long totalSize = 0; long instances = 0; while (objects.hasMoreElements()) { - JavaHeapObject obj = (JavaHeapObject) objects.nextElement(); + JavaHeapObject obj = objects.nextElement(); if (newObjects && !obj.isNew()) continue; printThing(obj);
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -47,15 +47,15 @@ } else { Map<JavaClass, Long> referrersStat = new HashMap<JavaClass, Long>(); final Map<JavaClass, Long> refereesStat = new HashMap<JavaClass, Long>(); - Enumeration instances = clazz.getInstances(false); + Enumeration<JavaHeapObject> instances = clazz.getInstances(false); while (instances.hasMoreElements()) { - JavaHeapObject instance = (JavaHeapObject) instances.nextElement(); + JavaHeapObject instance = instances.nextElement(); if (instance.getId() == -1) { continue; } - Enumeration e = instance.getReferers(); + Enumeration<JavaThing> e = instance.getReferers(); while (e.hasMoreElements()) { - JavaHeapObject ref = (JavaHeapObject) e.nextElement(); + JavaHeapObject ref = (JavaHeapObject)e.nextElement(); JavaClass cl = ref.getClazz(); if (cl == null) { System.out.println("null class for " + ref);
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/util/CompositeEnumeration.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/util/CompositeEnumeration.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,12 +34,13 @@ import java.util.Enumeration; import java.util.NoSuchElementException; +import com.sun.tools.hat.internal.model.JavaHeapObject; -public class CompositeEnumeration implements Enumeration { - Enumeration e1; - Enumeration e2; +public class CompositeEnumeration implements Enumeration<JavaHeapObject> { + Enumeration<JavaHeapObject> e1; + Enumeration<JavaHeapObject> e2; - public CompositeEnumeration(Enumeration e1, Enumeration e2) { + public CompositeEnumeration(Enumeration<JavaHeapObject> e1, Enumeration<JavaHeapObject> e2) { this.e1 = e1; this.e2 = e2; } @@ -48,7 +49,7 @@ return e1.hasMoreElements() || e2.hasMoreElements(); } - public Object nextElement() { + public JavaHeapObject nextElement() { if (e1.hasMoreElements()) { return e1.nextElement(); }
--- a/jdk/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Tue Aug 05 12:14:11 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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,7 +39,7 @@ // Warnings from List filters and List[] requestLists is hard to fix. // Remove SuppressWarning when we fix the warnings from List filters // and List[] requestLists. The generic array is not supported. -@SuppressWarnings("unchecked") +@SuppressWarnings({"unchecked", "rawtypes"}) class EventRequestManagerImpl extends MirrorImpl implements EventRequestManager {
--- a/jdk/src/share/classes/java/time/chrono/JapaneseEra.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/java/time/chrono/JapaneseEra.java Tue Aug 05 12:14:11 2014 -0700 @@ -127,7 +127,7 @@ // the number of defined JapaneseEra constants. // There could be an extra era defined in its configuration. - private static final int N_ERA_CONSTANTS = HEISEI.getValue() + ERA_OFFSET + 1; + private static final int N_ERA_CONSTANTS = HEISEI.getValue() + ERA_OFFSET; /** * Serialization version. @@ -148,7 +148,7 @@ for (int i = N_ERA_CONSTANTS; i < ERA_CONFIG.length; i++) { CalendarDate date = ERA_CONFIG[i].getSinceDate(); LocalDate isoDate = LocalDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth()); - KNOWN_ERAS[i] = new JapaneseEra(i - ERA_OFFSET, isoDate); + KNOWN_ERAS[i] = new JapaneseEra(i - ERA_OFFSET + 1, isoDate); } }; @@ -195,7 +195,7 @@ * @throws DateTimeException if the value is invalid */ public static JapaneseEra of(int japaneseEra) { - if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET - 1 >= KNOWN_ERAS.length) { + if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET > KNOWN_ERAS.length) { throw new DateTimeException("Invalid era: " + japaneseEra); } return KNOWN_ERAS[ordinal(japaneseEra)];
--- a/jdk/src/share/classes/java/util/Collections.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/java/util/Collections.java Tue Aug 05 12:14:11 2014 -0700 @@ -3486,6 +3486,7 @@ */ @Override public void replaceAll(UnaryOperator<E> operator) { + Objects.requireNonNull(operator); list.replaceAll(e -> typeCheck(operator.apply(e))); }
--- a/jdk/src/share/classes/javax/naming/directory/DirContext.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/javax/naming/directory/DirContext.java Tue Aug 05 12:14:11 2014 -0700 @@ -723,7 +723,7 @@ * specified set of attributes. * This method returns all the attributes of such objects. * It is equivalent to supplying null as - * the <tt>atributesToReturn</tt> parameter to the method + * the <tt>attributesToReturn</tt> parameter to the method * <code>search(Name, Attributes, String[])</code>. * <br> * See {@link #search(Name, Attributes, String[])} for a full description.
--- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java Tue Aug 05 15:39:05 2014 +0400 +++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java Tue Aug 05 12:14:11 2014 -0700 @@ -421,7 +421,7 @@ private String type; private Object value; - // If non-null, a cannonical representation of the value suitable + // If non-null, a canonical representation of the value suitable // for comparison using String.compareTo() private String comparable = null; @@ -571,10 +571,10 @@ } /** - * Given an attribute value string formated according to the rules + * Given an attribute value string formatted according to the rules * specified in * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>, - * returns the unformated value. Escapes and quotes are + * returns the unformatted value. Escapes and quotes are * stripped away, and hex-encoded UTF-8 is converted to equivalent