--- a/hotspot/make/aix/makefiles/buildtree.make Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/buildtree.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/jsig.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/rules.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/sa.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/saproc.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/top.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/aix/makefiles/vm.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/buildtree.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/jsig.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/rules.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/sa.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/saproc.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/top.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/bsd/makefiles/vm.make Mon Jul 21 09:48:38 2014 -0400
@@ -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/linux/makefiles/buildtree.make Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/buildtree.make Mon Jul 21 09:48:38 2014 -0400
@@ -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/jsig.make Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/jsig.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/rules.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/sa.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/saproc.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/top.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/linux/makefiles/vm.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/buildtree.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/jsig.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/rules.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/sa.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/saproc.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/top.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/solaris/makefiles/vm.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/windows/build.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/windows/makefiles/defs.make Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/make/windows/makefiles/sa.make Mon Jul 21 09:48:38 2014 -0400
@@ -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/os/aix/vm/os_aix.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -1214,10 +1214,6 @@
::abort();
}
-// Unused on Aix for now.
-void os::set_error_file(const char *logfile) {}
-
-
// This method is a copy of JDK's sysGetLastErrorString
// from src/solaris/hpi/src/system_md.c
--- a/hotspot/src/os/bsd/dtrace/libjvm_db.c Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/bsd/dtrace/libjvm_db.c Mon Jul 21 09:48:38 2014 -0400
@@ -260,6 +260,9 @@
uint64_t base;
int err;
+ /* Clear *vmp now in case we jump to fail: */
+ memset(vmp, 0, sizeof(VMStructEntry));
+
err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
CHECK_FAIL(err);
err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -1172,10 +1172,6 @@
::abort();
}
-// unused on bsd for now.
-void os::set_error_file(const char *logfile) {}
-
-
// This method is a copy of JDK's sysGetLastErrorString
// from src/solaris/hpi/src/system_md.c
@@ -1832,6 +1828,7 @@
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
+ assert(len < buflen, "Ran out of buffer space");
jrelib_p = buf + len;
// Add the appropriate library subdir
@@ -1865,7 +1862,7 @@
}
}
- strcpy(saved_jvm_path, buf);
+ strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -1553,9 +1553,6 @@
::abort();
}
-// unused on linux for now.
-void os::set_error_file(const char *logfile) {}
-
// This method is a copy of JDK's sysGetLastErrorString
// from src/solaris/hpi/src/system_md.c
@@ -2345,6 +2342,7 @@
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
+ assert(len < buflen, "Ran out of buffer room");
jrelib_p = buf + len;
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
if (0 != access(buf, F_OK)) {
@@ -2365,7 +2363,7 @@
}
}
- strcpy(saved_jvm_path, buf);
+ strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
--- a/hotspot/src/os/solaris/dtrace/libjvm_db.c Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c Mon Jul 21 09:48:38 2014 -0400
@@ -260,6 +260,9 @@
uint64_t base;
int err;
+ /* Clear *vmp now in case we jump to fail: */
+ memset(vmp, 0, sizeof(VMStructEntry));
+
err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
CHECK_FAIL(err);
err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -1544,9 +1544,6 @@
::abort(); // dump core (for debugging)
}
-// unused
-void os::set_error_file(const char *logfile) {}
-
// DLL functions
const char* os::dll_file_extension() { return ".so"; }
@@ -2186,6 +2183,7 @@
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
+ assert(len < buflen, "Ran out of buffer space");
jrelib_p = buf + len;
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
if (0 != access(buf, F_OK)) {
@@ -2204,7 +2202,7 @@
}
}
- strcpy(saved_jvm_path, buf);
+ strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
--- a/hotspot/src/os/windows/vm/os_windows.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -1825,7 +1825,9 @@
// looks like jvm.dll is installed there (append a fake suffix
// hotspot/jvm.dll).
char* java_home_var = ::getenv("JAVA_HOME");
- if (java_home_var != NULL && java_home_var[0] != 0) {
+ if (java_home_var != NULL && java_home_var[0] != 0 &&
+ strlen(java_home_var) < (size_t)buflen) {
+
strncpy(buf, java_home_var, buflen);
// determine if this is a legacy image or modules image
@@ -1844,7 +1846,7 @@
if (buf[0] == '\0') {
GetModuleFileName(vm_lib_handle, buf, buflen);
}
- strcpy(saved_jvm_path, buf);
+ strncpy(saved_jvm_path, buf, MAX_PATH);
}
@@ -2292,17 +2294,6 @@
return EXCEPTION_CONTINUE_SEARCH;
}
-// Fatal error reporting is single threaded so we can make this a
-// static and preallocated. If it's more than MAX_PATH silently ignore
-// it.
-static char saved_error_file[MAX_PATH] = {0};
-
-void os::set_error_file(const char *logfile) {
- if (strlen(logfile) <= MAX_PATH) {
- strncpy(saved_error_file, logfile, MAX_PATH);
- }
-}
-
static inline void report_error(Thread* t, DWORD exception_code,
address addr, void* siginfo, void* context) {
VMError err(t, exception_code, addr, siginfo, context);
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -141,12 +141,10 @@
}
frame os::get_sender_for_C_frame(frame* fr) {
- return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
+ return frame(fr->sender_sp(), frame::unpatchable, fr->sender_pc());
}
frame os::current_frame() {
- fprintf(stderr, "current_frame()");
-
intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
frame myframe(sp, frame::unpatchable,
CAST_FROM_FN_PTR(address, os::current_frame));
--- a/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -1574,6 +1574,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));
@@ -1615,6 +1616,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()) {
@@ -3960,10 +3965,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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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/classFileParser.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -919,7 +919,7 @@
"Wrong size %u for field's Signature attribute in class file %s",
attribute_length, CHECK);
}
- generic_signature_index = cfs->get_u2(CHECK);
+ generic_signature_index = parse_generic_signature_attribute(CHECK);
} else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
if (runtime_visible_annotations != NULL) {
classfile_parse_error(
@@ -2306,8 +2306,7 @@
"Invalid Signature attribute length %u in class file %s",
method_attribute_length, CHECK_(nullHandle));
}
- cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index
- generic_signature_index = cfs->get_u2_fast();
+ generic_signature_index = parse_generic_signature_attribute(CHECK_(nullHandle));
} else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
if (runtime_visible_annotations != NULL) {
classfile_parse_error(
@@ -2644,6 +2643,17 @@
return method_ordering;
}
+// Parse generic_signature attribute for methods and fields
+u2 ClassFileParser::parse_generic_signature_attribute(TRAPS) {
+ ClassFileStream* cfs = stream();
+ cfs->guarantee_more(2, CHECK_0); // generic_signature_index
+ u2 generic_signature_index = cfs->get_u2_fast();
+ check_property(
+ valid_symbol_at(generic_signature_index),
+ "Invalid Signature attribute at constant pool index %u in class file %s",
+ generic_signature_index, CHECK_0);
+ return generic_signature_index;
+}
void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) {
ClassFileStream* cfs = stream();
@@ -2798,17 +2808,19 @@
ClassFileStream* cfs = stream();
u1* current_start = cfs->current();
- cfs->guarantee_more(2, CHECK); // length
+ guarantee_property(attribute_byte_length >= sizeof(u2),
+ "Invalid BootstrapMethods attribute length %u in class file %s",
+ attribute_byte_length,
+ CHECK);
+
+ cfs->guarantee_more(attribute_byte_length, CHECK);
+
int attribute_array_length = cfs->get_u2_fast();
guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
"Short length on BootstrapMethods in class file %s",
CHECK);
- guarantee_property(attribute_byte_length >= sizeof(u2),
- "Invalid BootstrapMethods attribute length %u in class file %s",
- attribute_byte_length,
- CHECK);
// The attribute contains a counted array of counted tuples of shorts,
// represending bootstrap specifiers:
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp Mon Jul 21 09:48:38 2014 -0400
@@ -266,6 +266,7 @@
u1* parse_stackmap_table(u4 code_attribute_length, TRAPS);
// Classfile attribute parsing
+ u2 parse_generic_signature_attribute(TRAPS);
void parse_classfile_sourcefile_attribute(TRAPS);
void parse_classfile_source_debug_extension_attribute(int length, TRAPS);
u2 parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start,
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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/stackMapTable.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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
@@ -134,6 +134,7 @@
}
// check if uninitialized objects exist on backward branches
check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
+ frame->verifier()->update_furthest_jump(target);
}
void StackMapTable::check_new_object(
--- a/hotspot/src/share/vm/classfile/verifier.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -619,6 +619,9 @@
bool no_control_flow = false; // Set to true when there is no direct control
// flow from current instruction to the next
// instruction in sequence
+
+ set_furthest_jump(0);
+
Bytecodes::Code opcode;
while (!bcs.is_last_bytecode()) {
// Check for recursive re-verification before each bytecode.
@@ -2234,6 +2237,29 @@
"Bad <init> method call");
return;
}
+
+ // Make sure that this call is not jumped over.
+ if (bci < furthest_jump()) {
+ verify_error(ErrorContext::bad_code(bci),
+ "Bad <init> method call from inside of a branch");
+ return;
+ }
+
+ // Make sure that this call is not done from within a TRY block because
+ // that can result in returning an incomplete object. Simply checking
+ // (bci >= start_pc) also ensures that this call is not done after a TRY
+ // block. That is also illegal because this call must be the first Java
+ // statement in the constructor.
+ ExceptionTable exhandlers(_method());
+ int exlength = exhandlers.length();
+ for(int i = 0; i < exlength; i++) {
+ if (bci >= exhandlers.start_pc(i)) {
+ verify_error(ErrorContext::bad_code(bci),
+ "Bad <init> method call from after the start of a try block");
+ return;
+ }
+ }
+
current_frame->initialize_object(type, current_type());
*this_uninit = true;
} else if (type.is_uninitialized()) {
@@ -2271,16 +2297,19 @@
vmSymbols::object_initializer_name(),
cp->signature_ref_at(bcs->get_index_u2()),
Klass::normal);
- instanceKlassHandle mh(THREAD, m->method_holder());
- if (m->is_protected() && !mh->is_same_class_package(_klass())) {
- bool assignable = current_type().is_assignable_from(
- objectref_type, this, CHECK_VERIFY(this));
- if (!assignable) {
- verify_error(ErrorContext::bad_type(bci,
- TypeOrigin::cp(new_class_index, objectref_type),
- TypeOrigin::implicit(current_type())),
- "Bad access to protected <init> method");
- return;
+ // Do nothing if method is not found. Let resolution detect the error.
+ if (m != NULL) {
+ instanceKlassHandle mh(THREAD, m->method_holder());
+ if (m->is_protected() && !mh->is_same_class_package(_klass())) {
+ bool assignable = current_type().is_assignable_from(
+ objectref_type, this, CHECK_VERIFY(this));
+ if (!assignable) {
+ verify_error(ErrorContext::bad_type(bci,
+ TypeOrigin::cp(new_class_index, objectref_type),
+ TypeOrigin::implicit(current_type())),
+ "Bad access to protected <init> method");
+ return;
+ }
}
}
}
--- a/hotspot/src/share/vm/classfile/verifier.hpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.hpp Mon Jul 21 09:48:38 2014 -0400
@@ -258,6 +258,9 @@
ErrorContext _error_context; // contains information about an error
+ // Used to detect illegal jumps over calls to super() nd this() in ctors.
+ int32_t _furthest_jump;
+
void verify_method(methodHandle method, TRAPS);
char* generate_code_data(methodHandle m, u4 code_length, TRAPS);
void verify_exception_handler_table(u4 code_length, char* code_data,
@@ -403,6 +406,20 @@
Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
TypeOrigin ref_ctx(const char* str, TRAPS);
+
+ // Keep track of the furthest branch done in a method to make sure that
+ // there are no branches over calls to super() or this() from inside of
+ // a constructor.
+ int32_t furthest_jump() { return _furthest_jump; }
+
+ void set_furthest_jump(int32_t target) {
+ _furthest_jump = target;
+ }
+
+ void update_furthest_jump(int32_t target) {
+ if (target > _furthest_jump) _furthest_jump = target;
+ }
+
};
inline int ClassVerifier::change_sig_to_verificationType(
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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);
@@ -2123,6 +2132,7 @@
ResourceMark rm;
char* method_name = method->name()->as_C_string();
strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length);
+ _last_method_compiled[CompileBroker::name_buffer_length - 1] = '\0'; // ensure null terminated
char current_method[CompilerCounters::cmname_buffer_length];
size_t maxLen = CompilerCounters::cmname_buffer_length;
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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/oops/klassVtable.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -251,6 +251,17 @@
// For bytecodes not produced by javac together it is possible that a method does not override
// the superclass's method, but might indirectly override a super-super class's vtable entry
// If none found, return a null superk, else return the superk of the method this does override
+// For public and protected methods: if they override a superclass, they will
+// also be overridden themselves appropriately.
+// Private methods do not override and are not overridden.
+// Package Private methods are trickier:
+// e.g. P1.A, pub m
+// P2.B extends A, package private m
+// P1.C extends B, public m
+// P1.C.m needs to override P1.A.m and can not override P2.B.m
+// Therefore: all package private methods need their own vtable entries for
+// them to be the root of an inheritance overriding decision
+// Package private methods may also override other vtable entries
InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
InstanceKlass* superk = initialsuper;
@@ -398,8 +409,11 @@
target_classname, THREAD))
!= (InstanceKlass*)NULL))))
{
- // overriding, so no new entry
- allocate_new = false;
+ // Package private methods always need a new entry to root their own
+ // overriding. They may also override other methods.
+ if (!target_method()->is_package_private()) {
+ allocate_new = false;
+ }
if (checkconstraints) {
// Override vtable entry if passes loader constraint check
@@ -543,8 +557,9 @@
AccessFlags class_flags,
TRAPS) {
if (class_flags.is_interface()) {
- // Interfaces do not use vtables, so there is no point to assigning
- // a vtable index to any of their methods. If we refrain from doing this,
+ // Interfaces do not use vtables, except for java.lang.Object methods,
+ // so there is no point to assigning
+ // a vtable index to any of their local methods. If we refrain from doing this,
// we can use Method::_vtable_index to hold the itable index
return false;
}
@@ -582,6 +597,12 @@
return true;
}
+ // Package private methods always need a new entry to root their own
+ // overriding. This allows transitive overriding to work.
+ if (target_method()->is_package_private()) {
+ return true;
+ }
+
// search through the super class hierarchy to see if we need
// a new entry
ResourceMark rm;
--- a/hotspot/src/share/vm/oops/method.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -731,8 +731,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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/opto/machnode.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/opto/machnode.hpp Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/opto/output.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -856,8 +856,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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/opto/parse.hpp Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/opto/replacednodes.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -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/runtime/os.hpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp Mon Jul 21 09:48:38 2014 -0400
@@ -469,9 +469,6 @@
// run cmd in a separate process and return its exit code; or -1 on failures
static int fork_and_exec(char *cmd);
- // Set file to send error reports.
- static void set_error_file(const char *logfile);
-
// os::exit() is merged with vm_exit()
// static void exit(int num);
--- a/hotspot/src/share/vm/utilities/vmError.cpp Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Mon Jul 21 09:48:38 2014 -0400
@@ -990,7 +990,6 @@
if (fd != -1) {
out.print_raw("# An error report file with more information is saved as:\n# ");
out.print_raw_cr(buffer);
- os::set_error_file(buffer);
log.set_fd(fd);
} else {
--- a/hotspot/test/TEST.groups Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/TEST.groups Mon Jul 21 09:48:38 2014 -0400
@@ -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 \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/profiling/TestSpecTrapClassUnloading.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableBoolean.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableByte.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableChar.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableDouble.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableFloat.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableInt.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableLong.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableObject.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ b/hotspot/test/compiler/stable/TestStableShort.java Mon Jul 21 09:48:38 2014 -0400
@@ -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 Mon Jul 21 06:00:44 2014 -0700
+++ /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;
- }
- }
-}