This commit is contained in:
Rickard Bäckman 2014-07-18 10:41:05 +02:00
commit eefe77eaff
61 changed files with 1271 additions and 679 deletions

View File

@ -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 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
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"; \

View File

@ -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 @@ DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ)
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 @@ $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
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

View File

@ -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)

View File

@ -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 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(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

View File

@ -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 @@ install_saproc: $(BUILDLIBSAPROC)
$(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

View File

@ -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 @@ TOPDIR = $(shell echo `pwd`)
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 @@ vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) trace_stu
@# 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 @@ install gamma: the_vm
# 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

View File

@ -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 @@ DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
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

View File

@ -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 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
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"; \

View File

@ -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 @@ DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ)
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 @@ install_jsig: $(LIBJSIG)
@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

View File

@ -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)

View File

@ -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 @@ SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
# 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 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(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

View File

@ -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 @@ else
endif
else
SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
SALIBS =
SALIBS =
SAARCH = $(ARCHFLAG)
endif
endif
@ -163,13 +163,13 @@ install_saproc: $(BUILDLIBSAPROC)
@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

View File

@ -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 @@ TOPDIR = $(shell echo `pwd`)
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 @@ vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stu
@# 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 @@ install : the_vm
# 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

View File

@ -360,14 +360,14 @@ install_jvm: $(LIBJVM)
@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

View File

@ -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 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
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"; \

View File

@ -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 @@ DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ)
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 @@ endif
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

View File

@ -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)

View File

@ -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 @@ SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
# 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 @@ $(GENERATED)/sa-jdi.jar:: $(AGENT_FILES)
$(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

View File

@ -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 @@ install_saproc: $(BUILDLIBSAPROC)
$(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

View File

@ -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 @@ TOPDIR = $(shell echo `pwd`)
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 @@ vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) trace_stu
@# 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 @@ install: the_vm
# 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

View File

@ -362,10 +362,10 @@ DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
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

View File

@ -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 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
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"; \
) > $@

View File

@ -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 @@ endif
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

View File

@ -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)

View File

@ -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_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE
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 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(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

View File

@ -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 @@ $(SADISOBJ): $(SADISSRCFILES)
$(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 @@ install_saproc: $(BULDLIBSAPROC)
$(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

View File

@ -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 @@ include $(GAMMADIR)/make/altsrc.make
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 @@ vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stu
@# 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 @@ ad_stuff: $(Cached_plat) $(adjust-mflags)
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 @@ install: the_vm
#$(MAKE) -f vm.make $@
# this should force everything to be rebuilt
clean:
clean:
rm -f $(GENERATED)/*.class
$(MAKE) -f vm.make $(MFLAGS) clean

View File

@ -336,10 +336,10 @@ DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
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

View File

@ -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 @@ $(variantDir)\local.make: checks
@ 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

View File

@ -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 @@ endif
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),)

View File

@ -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 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(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 @@ SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN
!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 @@ SA_LD_FLAGS = -manifest $(SA_LD_FLAGS)
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 @@ SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
$(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

View File

@ -478,9 +478,17 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
} 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")) {

View File

@ -1573,6 +1573,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
default:
constant = new Constant(as_ValueType(field_val));
}
// Stable static fields are checked for non-default values in ciField::initialize_from().
}
if (constant != NULL) {
push(type, append(constant));
@ -1614,6 +1615,10 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
default:
constant = new Constant(as_ValueType(field_val));
}
if (FoldStableValues && field->is_stable() && field_val.is_null_or_zero()) {
// Stable field with default value can't be constant.
constant = NULL;
}
} else {
// For CallSite objects treat the target field as a compile time constant.
if (const_oop->is_call_site()) {
@ -3959,10 +3964,15 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, Bytecode
// 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;

View File

@ -1125,9 +1125,6 @@ int ciEnv::num_inlined_bytecodes() const {
// ------------------------------------------------------------------
// 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;

View File

@ -777,11 +777,22 @@ bool ClassLoaderDataGraph::do_unloading(BoolObjectClosure* is_alive_closure) {
// unneeded entries.
bool has_redefined_a_class = JvmtiExport::has_redefined_a_class();
MetadataOnStackMark md_on_stack;
while (data != NULL) {
if (data->is_alive(is_alive_closure)) {
if (has_redefined_a_class) {
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)) {
data->free_deallocate_list();
prev = data;
data = data->next();

View File

@ -297,6 +297,7 @@ void CompileTask::initialize(int compile_id,
_hot_count = hot_count;
_time_queued = 0; // tidy
_comment = comment;
_failure_reason = NULL;
if (LogCompilation) {
_time_queued = os::elapsed_counter();
@ -566,6 +567,11 @@ void CompileTask::log_task_done(CompileLog* log) {
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 @@ void CompileQueue::purge_stale_tasks() {
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 @@ void CompileBroker::compiler_thread_loop() {
} 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 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
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);

View File

@ -64,6 +64,7 @@ class CompileTask : public CHeapObj<mtCompiler> {
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 @@ public:
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

View File

@ -729,8 +729,8 @@ void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report,
}
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);
}

View File

@ -1556,7 +1556,7 @@ class CleanExtraDataMethodClosure : public CleanExtraDataClosure {
public:
CleanExtraDataMethodClosure() {}
bool is_live(Method* m) {
return m->on_stack();
return !m->is_old() || m->on_stack();
}
};

View File

@ -107,7 +107,7 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
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 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
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 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
}
#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 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
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 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
// 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");

View File

@ -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 @@ void MachCallNode::dump_spec(outputStream *st) const {
}
#endif
bool MachCallNode::return_value_is_used() const {
if (tf()->range()->cnt() == TypeFunc::Parms) {
// void return
@ -657,6 +656,14 @@ bool MachCallNode::return_value_is_used() const {
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 {

View File

@ -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 @@ public:
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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -854,8 +854,7 @@ void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) {
}
// 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();

View File

@ -142,7 +142,7 @@ public:
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;

View File

@ -185,11 +185,11 @@ void ReplacedNodes::apply(Compile* C, Node* ctl) {
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(",");
}
}
}

View File

@ -0,0 +1,4 @@
public class A {
void m() {
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,5 @@
public class B extends A {
void m() {
}
}

View File

@ -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();
}
}

View File

@ -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();
}

View File

@ -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);
}
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(BooleanStable.class);
run(DefaultStaticValue.class);
run(StaticBooleanStable.class);
run(VolatileBooleanStable.class);
@ -145,6 +161,21 @@ public class TestStableBoolean {
/* ==================================================== */
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
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 @@ public class TestStableBoolean {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(ByteStable.class);
run(DefaultStaticValue.class);
run(StaticByteStable.class);
run(VolatileByteStable.class);
@ -145,6 +161,21 @@ public class TestStableByte {
/* ==================================================== */
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
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 @@ public class TestStableByte {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(CharStable.class);
run(DefaultStaticValue.class);
run(StaticCharStable.class);
run(VolatileCharStable.class);
@ -145,6 +161,21 @@ public class TestStableChar {
/* ==================================================== */
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 @@ public class TestStableChar {
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 @@ public class TestStableChar {
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 @@ public class TestStableChar {
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 @@ public class TestStableChar {
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 @@ public class TestStableChar {
c.v = new char[1][1][1][1]; char[][][][] val2 = get4();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
}
}
@ -403,7 +444,7 @@ public class TestStableChar {
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 @@ public class TestStableChar {
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 @@ public class TestStableChar {
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 @@ public class TestStableChar {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(DoubleStable.class);
run(DefaultStaticValue.class);
run(StaticDoubleStable.class);
run(VolatileDoubleStable.class);
@ -145,6 +161,21 @@ public class TestStableDouble {
/* ==================================================== */
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
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 @@ public class TestStableDouble {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(FloatStable.class);
run(DefaultStaticValue.class);
run(StaticFloatStable.class);
run(VolatileFloatStable.class);
@ -145,6 +161,21 @@ public class TestStableFloat {
/* ==================================================== */
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
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 @@ public class TestStableFloat {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(IntStable.class);
run(DefaultStaticValue.class);
run(StaticIntStable.class);
run(VolatileIntStable.class);
@ -145,6 +161,21 @@ public class TestStableInt {
/* ==================================================== */
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
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 @@ public class TestStableInt {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(LongStable.class);
run(DefaultStaticValue.class);
run(StaticLongStable.class);
run(VolatileLongStable.class);
@ -145,6 +161,21 @@ public class TestStableLong {
/* ==================================================== */
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
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 @@ public class TestStableLong {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(ObjectStable.class);
run(DefaultStaticValue.class);
run(StaticObjectStable.class);
run(VolatileObjectStable.class);
@ -148,6 +164,21 @@ public class TestStableObject {
/* ==================================================== */
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
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 @@ public class TestStableObject {
}
}
}
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()));
}
}

View File

@ -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 {
public static void main(String[] args) throws Exception {
System.out.println("@Stable enabled: "+isStableEnabled);
System.out.println();
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
public static void main(String[] args) throws Exception {
run(DefaultValue.class);
run(ShortStable.class);
run(DefaultStaticValue.class);
run(StaticShortStable.class);
run(VolatileShortStable.class);
@ -145,6 +161,21 @@ public class TestStableShort {
/* ==================================================== */
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
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 @@ public class TestStableShort {
}
}
}
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()));
}
}