7148152: Add whitebox testing API to HotSpot

Thu, 23 Feb 2012 14:58:35 +0100

author
mgerdin
date
Thu, 23 Feb 2012 14:58:35 +0100
changeset 3619
2d503de963b3
parent 3585
4ab89de75552
child 3620
b5290bf0a9e4

7148152: Add whitebox testing API to HotSpot
Summary: Add an internal testing API to HotSpot to enable more targeted testing of vm functionality
Reviewed-by: phh, dholmes

make/Makefile file | annotate | diff | comparison | revisions
make/bsd/makefiles/defs.make file | annotate | diff | comparison | revisions
make/bsd/makefiles/vm.make file | annotate | diff | comparison | revisions
make/bsd/makefiles/wb.make file | annotate | diff | comparison | revisions
make/jprt.properties file | annotate | diff | comparison | revisions
make/linux/makefiles/defs.make file | annotate | diff | comparison | revisions
make/linux/makefiles/vm.make file | annotate | diff | comparison | revisions
make/linux/makefiles/wb.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/defs.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/vm.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/wb.make file | annotate | diff | comparison | revisions
make/windows/makefiles/debug.make file | annotate | diff | comparison | revisions
make/windows/makefiles/defs.make file | annotate | diff | comparison | revisions
make/windows/makefiles/fastdebug.make file | annotate | diff | comparison | revisions
make/windows/makefiles/product.make file | annotate | diff | comparison | revisions
make/windows/makefiles/wb.make file | annotate | diff | comparison | revisions
src/share/tools/whitebox/sun/hotspot/WhiteBox.java file | annotate | diff | comparison | revisions
src/share/vm/prims/nativeLookup.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/whitebox.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/whitebox.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/vmError.cpp file | annotate | diff | comparison | revisions
test/Makefile file | annotate | diff | comparison | revisions
test/sanity/WBApi.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/Makefile	Fri Feb 17 15:11:32 2012 -0800
     1.2 +++ b/make/Makefile	Thu Feb 23 14:58:35 2012 +0100
     1.3 @@ -378,6 +378,9 @@
     1.4  $(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
     1.5  	$(install-file)
     1.6  
     1.7 +$(EXPORT_JRE_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
     1.8 +	$(install-file)
     1.9 +
    1.10  # Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h)
    1.11  $(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
    1.12  	$(install-file)
     2.1 --- a/make/bsd/makefiles/defs.make	Fri Feb 17 15:11:32 2012 -0800
     2.2 +++ b/make/bsd/makefiles/defs.make	Thu Feb 23 14:58:35 2012 +0100
     2.3 @@ -144,6 +144,8 @@
     2.4  EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
     2.5  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
     2.6  
     2.7 +EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
     2.8 +
     2.9  ifndef BUILD_CLIENT_ONLY
    2.10  EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
    2.11  EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
     3.1 --- a/make/bsd/makefiles/vm.make	Fri Feb 17 15:11:32 2012 -0800
     3.2 +++ b/make/bsd/makefiles/vm.make	Thu Feb 23 14:58:35 2012 +0100
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3.6 +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  #
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -335,6 +335,9 @@
    3.11  # Serviceability agent
    3.12  include $(MAKEFILES_DIR)/saproc.make
    3.13  
    3.14 +# Whitebox testing API
    3.15 +include $(MAKEFILES_DIR)/wb.make
    3.16 +
    3.17  #----------------------------------------------------------------------
    3.18  
    3.19  ifeq ($(OS_VENDOR), Darwin)
    3.20 @@ -342,10 +345,10 @@
    3.21  	dsymutil $(LIBJVM)
    3.22  
    3.23  # no libjvm_db for macosx
    3.24 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM
    3.25 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM $(WB_JAR)
    3.26  	echo "Doing vm.make build:"
    3.27  else
    3.28 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
    3.29 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
    3.30  endif
    3.31  
    3.32  install: install_jvm install_jsig install_saproc
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/make/bsd/makefiles/wb.make	Thu Feb 23 14:58:35 2012 +0100
     4.3 @@ -0,0 +1,46 @@
     4.4 +#
     4.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     4.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 +#
     4.8 +# This code is free software; you can redistribute it and/or modify it
     4.9 +# under the terms of the GNU General Public License version 2 only, as
    4.10 +# published by the Free Software Foundation.
    4.11 +#
    4.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 +# version 2 for more details (a copy is included in the LICENSE file that
    4.16 +# accompanied this code).
    4.17 +#
    4.18 +# You should have received a copy of the GNU General Public License version
    4.19 +# 2 along with this work; if not, write to the Free Software Foundation,
    4.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 +#
    4.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.23 +# or visit www.oracle.com if you need additional information or have any
    4.24 +# questions.
    4.25 +#  
    4.26 +#
    4.27 +
    4.28 +# Rules to build whitebox testing library, used by vm.make
    4.29 +WB = wb
    4.30 +
    4.31 +WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
    4.32 +
    4.33 +WB_JAR = $(GENERATED)/$(WB).jar
    4.34 +
    4.35 +WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
    4.36 +WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
    4.37 +
    4.38 +WB_JAVA_CLASSES  = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
    4.39 +	$(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
    4.40 +
    4.41 +$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
    4.42 +	$(REMOTE) $(COMPILE.JAVAC) -nowarn -d $(WB_JAVA_CLASSDIR) $<
    4.43 +
    4.44 +$(WB_JAR): $(WB_JAVA_CLASSES)
    4.45 +	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
    4.46 +
    4.47 +$(WB_JAVA_CLASSDIR):
    4.48 +	$(QUIETLY) mkdir -p $@
    4.49 +
     5.1 --- a/make/jprt.properties	Fri Feb 17 15:11:32 2012 -0800
     5.2 +++ b/make/jprt.properties	Thu Feb 23 14:58:35 2012 +0100
     5.3 @@ -1,5 +1,5 @@
     5.4  #
     5.5 -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
     5.6 +# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
     5.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8  #
     5.9  # This code is free software; you can redistribute it and/or modify it
    5.10 @@ -474,11 +474,26 @@
    5.11    ${jprt.my.macosx.x64}-fastdebug-c2-internalvmtests, \
    5.12    ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \
    5.13    ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests
    5.14 -  
    5.15 +
    5.16 +jprt.make.rule.test.targets.standard.wbapi = \
    5.17 +  ${jprt.my.solaris.sparc}-{product|fastdebug}-c2-wbapitest, \
    5.18 +  ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-wbapitest, \
    5.19 +  ${jprt.my.solaris.i586}-{product|fastdebug}-c2-wbapitest, \
    5.20 +  ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \
    5.21 +  ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \
    5.22 +  ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \
    5.23 +  ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \
    5.24 +  ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \
    5.25 +  ${jprt.my.solaris.sparc}-{product|fastdebug}-c1-wbapitest, \
    5.26 +  ${jprt.my.solaris.i586}-{product|fastdebug}-c1-wbapitest, \
    5.27 +  ${jprt.my.linux.i586}-{product|fastdebug}-c1-wbapitest, \
    5.28 +  ${jprt.my.windows.i586}-{product|fastdebug}-c1-wbapitest
    5.29 +
    5.30  jprt.make.rule.test.targets.standard = \
    5.31    ${jprt.make.rule.test.targets.standard.client}, \
    5.32    ${jprt.make.rule.test.targets.standard.server}, \
    5.33 -  ${jprt.make.rule.test.targets.standard.internalvmtests}
    5.34 +  ${jprt.make.rule.test.targets.standard.internalvmtests}, \
    5.35 +  ${jprt.make.rule.test.targets.standard.wbapi}
    5.36  
    5.37  jprt.make.rule.test.targets.embedded = \
    5.38    ${jprt.make.rule.test.targets.standard.client}
     6.1 --- a/make/linux/makefiles/defs.make	Fri Feb 17 15:11:32 2012 -0800
     6.2 +++ b/make/linux/makefiles/defs.make	Thu Feb 23 14:58:35 2012 +0100
     6.3 @@ -1,5 +1,5 @@
     6.4  #
     6.5 -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
     6.6 +# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
     6.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8  #
     6.9  # This code is free software; you can redistribute it and/or modify it
    6.10 @@ -193,6 +193,8 @@
    6.11  EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
    6.12  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
    6.13  
    6.14 +EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
    6.15 +
    6.16  ifndef BUILD_CLIENT_ONLY
    6.17  EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
    6.18  EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
     7.1 --- a/make/linux/makefiles/vm.make	Fri Feb 17 15:11:32 2012 -0800
     7.2 +++ b/make/linux/makefiles/vm.make	Thu Feb 23 14:58:35 2012 +0100
     7.3 @@ -1,5 +1,5 @@
     7.4  #
     7.5 -# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     7.6 +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     7.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8  #
     7.9  # This code is free software; you can redistribute it and/or modify it
    7.10 @@ -368,9 +368,12 @@
    7.11  # Serviceability agent
    7.12  include $(MAKEFILES_DIR)/saproc.make
    7.13  
    7.14 +# Whitebox testing API
    7.15 +include $(MAKEFILES_DIR)/wb.make
    7.16 +
    7.17  #----------------------------------------------------------------------
    7.18  
    7.19 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
    7.20 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
    7.21  
    7.22  install: install_jvm install_jsig install_saproc
    7.23  
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/make/linux/makefiles/wb.make	Thu Feb 23 14:58:35 2012 +0100
     8.3 @@ -0,0 +1,46 @@
     8.4 +#
     8.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     8.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 +#
     8.8 +# This code is free software; you can redistribute it and/or modify it
     8.9 +# under the terms of the GNU General Public License version 2 only, as
    8.10 +# published by the Free Software Foundation.
    8.11 +#
    8.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
    8.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.15 +# version 2 for more details (a copy is included in the LICENSE file that
    8.16 +# accompanied this code).
    8.17 +#
    8.18 +# You should have received a copy of the GNU General Public License version
    8.19 +# 2 along with this work; if not, write to the Free Software Foundation,
    8.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.21 +#
    8.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.23 +# or visit www.oracle.com if you need additional information or have any
    8.24 +# questions.
    8.25 +#  
    8.26 +#
    8.27 +
    8.28 +# Rules to build whitebox testing library, used by vm.make
    8.29 +WB = wb
    8.30 +
    8.31 +WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
    8.32 +
    8.33 +WB_JAR = $(GENERATED)/$(WB).jar
    8.34 +
    8.35 +WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
    8.36 +WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
    8.37 +
    8.38 +WB_JAVA_CLASSES  = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
    8.39 +	$(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
    8.40 +
    8.41 +$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
    8.42 +	$(REMOTE) $(COMPILE.JAVAC) -nowarn -d $(WB_JAVA_CLASSDIR) $<
    8.43 +
    8.44 +$(WB_JAR): $(WB_JAVA_CLASSES)
    8.45 +	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
    8.46 +
    8.47 +$(WB_JAVA_CLASSDIR):
    8.48 +	$(QUIETLY) mkdir -p $@
    8.49 +
     9.1 --- a/make/solaris/makefiles/defs.make	Fri Feb 17 15:11:32 2012 -0800
     9.2 +++ b/make/solaris/makefiles/defs.make	Thu Feb 23 14:58:35 2012 +0100
     9.3 @@ -1,5 +1,5 @@
     9.4  #
     9.5 -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
     9.6 +# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
     9.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8  #
     9.9  # This code is free software; you can redistribute it and/or modify it
    9.10 @@ -148,6 +148,8 @@
    9.11    EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
    9.12  endif
    9.13  
    9.14 +EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
    9.15 +
    9.16  EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
    9.17  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
    9.18  
    10.1 --- a/make/solaris/makefiles/vm.make	Fri Feb 17 15:11:32 2012 -0800
    10.2 +++ b/make/solaris/makefiles/vm.make	Thu Feb 23 14:58:35 2012 +0100
    10.3 @@ -1,5 +1,5 @@
    10.4  #
    10.5 -# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    10.6 +# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    10.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8  #
    10.9  # This code is free software; you can redistribute it and/or modify it
   10.10 @@ -321,9 +321,12 @@
   10.11  # Serviceability agent
   10.12  include $(MAKEFILES_DIR)/saproc.make
   10.13  
   10.14 +# Whitebox testing API
   10.15 +include $(MAKEFILES_DIR)/wb.make
   10.16 +
   10.17  #----------------------------------------------------------------------
   10.18  
   10.19 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
   10.20 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
   10.21  
   10.22  install: install_jvm install_jsig install_saproc
   10.23  
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/make/solaris/makefiles/wb.make	Thu Feb 23 14:58:35 2012 +0100
    11.3 @@ -0,0 +1,46 @@
    11.4 +#
    11.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    11.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 +#
    11.8 +# This code is free software; you can redistribute it and/or modify it
    11.9 +# under the terms of the GNU General Public License version 2 only, as
   11.10 +# published by the Free Software Foundation.
   11.11 +#
   11.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
   11.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.15 +# version 2 for more details (a copy is included in the LICENSE file that
   11.16 +# accompanied this code).
   11.17 +#
   11.18 +# You should have received a copy of the GNU General Public License version
   11.19 +# 2 along with this work; if not, write to the Free Software Foundation,
   11.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.21 +#
   11.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.23 +# or visit www.oracle.com if you need additional information or have any
   11.24 +# questions.
   11.25 +#
   11.26 +
   11.27 +# Rules to build whitebox testing library, used by vm.make
   11.28 +
   11.29 +WB = wb
   11.30 +
   11.31 +WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
   11.32 +
   11.33 +WB_JAR = $(GENERATED)/$(WB).jar
   11.34 +
   11.35 +WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
   11.36 +WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
   11.37 +
   11.38 +WB_JAVA_CLASSES  = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
   11.39 +	$(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
   11.40 +
   11.41 +$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
   11.42 +	$(REMOTE) $(COMPILE.JAVAC) -nowarn -d $(WB_JAVA_CLASSDIR) $<
   11.43 +
   11.44 +$(WB_JAR): $(WB_JAVA_CLASSES)
   11.45 +	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
   11.46 +
   11.47 +$(WB_JAVA_CLASSDIR):
   11.48 +	$(QUIETLY) mkdir -p $@
   11.49 +
    12.1 --- a/make/windows/makefiles/debug.make	Fri Feb 17 15:11:32 2012 -0800
    12.2 +++ b/make/windows/makefiles/debug.make	Thu Feb 23 14:58:35 2012 +0100
    12.3 @@ -1,5 +1,5 @@
    12.4  #
    12.5 -# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    12.6 +# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    12.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8  #
    12.9  # This code is free software; you can redistribute it and/or modify it
   12.10 @@ -33,7 +33,7 @@
   12.11  BUILD_PCH_FILE=_build_pch_file.obj
   12.12  !endif
   12.13  
   12.14 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
   12.15 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
   12.16  
   12.17  !include ../local.make
   12.18  !include compile.make
   12.19 @@ -65,3 +65,4 @@
   12.20  !include $(WorkSpace)/make/windows/makefiles/shared.make
   12.21  !include $(WorkSpace)/make/windows/makefiles/sa.make
   12.22  !include $(WorkSpace)/make/windows/makefiles/launcher.make
   12.23 +!include $(WorkSpace)/make/windows/makefiles/wb.make
    13.1 --- a/make/windows/makefiles/defs.make	Fri Feb 17 15:11:32 2012 -0800
    13.2 +++ b/make/windows/makefiles/defs.make	Thu Feb 23 14:58:35 2012 +0100
    13.3 @@ -1,5 +1,5 @@
    13.4  #
    13.5 -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    13.6 +# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
    13.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8  #
    13.9  # This code is free software; you can redistribute it and/or modify it
   13.10 @@ -194,6 +194,8 @@
   13.11    EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.map
   13.12  endif
   13.13  
   13.14 +EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
   13.15 +
   13.16  ifeq ($(BUILD_WIN_SA), 1)
   13.17    EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX)
   13.18    EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.pdb
    14.1 --- a/make/windows/makefiles/fastdebug.make	Fri Feb 17 15:11:32 2012 -0800
    14.2 +++ b/make/windows/makefiles/fastdebug.make	Thu Feb 23 14:58:35 2012 +0100
    14.3 @@ -1,5 +1,5 @@
    14.4  #
    14.5 -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    14.6 +# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
    14.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8  #
    14.9  # This code is free software; you can redistribute it and/or modify it
   14.10 @@ -33,7 +33,7 @@
   14.11  BUILD_PCH_FILE=_build_pch_file.obj
   14.12  !endif
   14.13  
   14.14 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
   14.15 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
   14.16  
   14.17  !include ../local.make
   14.18  !include compile.make
   14.19 @@ -65,3 +65,4 @@
   14.20  !include $(WorkSpace)/make/windows/makefiles/shared.make
   14.21  !include $(WorkSpace)/make/windows/makefiles/sa.make
   14.22  !include $(WorkSpace)/make/windows/makefiles/launcher.make
   14.23 +!include $(WorkSpace)/make/windows/makefiles/wb.make
    15.1 --- a/make/windows/makefiles/product.make	Fri Feb 17 15:11:32 2012 -0800
    15.2 +++ b/make/windows/makefiles/product.make	Thu Feb 23 14:58:35 2012 +0100
    15.3 @@ -1,5 +1,5 @@
    15.4  #
    15.5 -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    15.6 +# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
    15.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.8  #
    15.9  # This code is free software; you can redistribute it and/or modify it
   15.10 @@ -32,7 +32,7 @@
   15.11  BUILD_PCH_FILE=_build_pch_file.obj
   15.12  !endif
   15.13  
   15.14 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
   15.15 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
   15.16  
   15.17  !include ../local.make
   15.18  !include compile.make
   15.19 @@ -76,3 +76,4 @@
   15.20  !include $(WorkSpace)/make/windows/makefiles/shared.make
   15.21  !include $(WorkSpace)/make/windows/makefiles/sa.make
   15.22  !include $(WorkSpace)/make/windows/makefiles/launcher.make
   15.23 +!include $(WorkSpace)/make/windows/makefiles/wb.make
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/make/windows/makefiles/wb.make	Thu Feb 23 14:58:35 2012 +0100
    16.3 @@ -0,0 +1,54 @@
    16.4 +#
    16.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    16.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 +#
    16.8 +# This code is free software; you can redistribute it and/or modify it
    16.9 +# under the terms of the GNU General Public License version 2 only, as
   16.10 +# published by the Free Software Foundation.
   16.11 +#
   16.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 +# version 2 for more details (a copy is included in the LICENSE file that
   16.16 +# accompanied this code).
   16.17 +#
   16.18 +# You should have received a copy of the GNU General Public License version
   16.19 +# 2 along with this work; if not, write to the Free Software Foundation,
   16.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 +#
   16.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.23 +# or visit www.oracle.com if you need additional information or have any
   16.24 +# questions.
   16.25 +#  
   16.26 +#
   16.27 +
   16.28 +# This makefile is used to build the whitebox testing lib
   16.29 +# and compile the tests which use it
   16.30 +
   16.31 +!include $(WorkSpace)/make/windows/makefiles/rules.make
   16.32 +
   16.33 +WBSRCDIR = $(WorkSpace)/src/share/tools/whitebox
   16.34 +
   16.35 +# turn GENERATED into a windows path to get sane dependencies
   16.36 +WB_CLASSES=$(GENERATED:/=\)\wb\classes
   16.37 +WB_JAR=$(GENERATED:/=\)\wb.jar
   16.38 +
   16.39 +# call recursive make to do wildcard expansion
   16.40 +.SUFFIXES : .java .class
   16.41 +wb_java_srcs: $(WorkSpace)\src\share\tools\whitebox\sun\hotspot\*.java $(WB_CLASSES)
   16.42 +	$(MAKE) -f $(WorkSpace)\make\windows\makefiles\$(BUILD_FLAVOR).make $(**:.java=.class)
   16.43 +
   16.44 +
   16.45 +{$(WorkSpace)\src\share\tools\whitebox\sun\hotspot}.java.class::
   16.46 +	$(COMPILE_JAVAC) -d $(WB_CLASSES) $<
   16.47 +
   16.48 +$(WB_JAR): wb_java_srcs
   16.49 +	$(RUN_JAR) cf $@ -C $(WB_CLASSES) .
   16.50 +
   16.51 +# turn $@ to a unix path because mkdir in PATH is cygwin/mks mkdir
   16.52 +$(WB_CLASSES):
   16.53 +	mkdir -p $(@:\=/)
   16.54 +
   16.55 +# main target to build wb
   16.56 +wb: $(WB_JAR)
   16.57 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/src/share/tools/whitebox/sun/hotspot/WhiteBox.java	Thu Feb 23 14:58:35 2012 +0100
    17.3 @@ -0,0 +1,70 @@
    17.4 +/*
    17.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.
   17.11 + *
   17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 + * version 2 for more details (a copy is included in the LICENSE file that
   17.16 + * accompanied this code).
   17.17 + *
   17.18 + * You should have received a copy of the GNU General Public License version
   17.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 + *
   17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.23 + * or visit www.oracle.com if you need additional information or have any
   17.24 + * questions.
   17.25 + *
   17.26 + */
   17.27 +
   17.28 +package sun.hotspot;
   17.29 +import java.security.BasicPermission;
   17.30 +
   17.31 +public class WhiteBox {
   17.32 +
   17.33 +  @SuppressWarnings("serial")
   17.34 +  public static class WhiteBoxPermission extends BasicPermission {
   17.35 +    public WhiteBoxPermission(String s) {
   17.36 +      super(s);
   17.37 +    }
   17.38 +  }
   17.39 +
   17.40 +  private WhiteBox() {}
   17.41 +  private static final WhiteBox instance = new WhiteBox();
   17.42 +  private static native void registerNatives();
   17.43 +
   17.44 +  /**
   17.45 +   * Returns the singleton WhiteBox instance.
   17.46 +   *
   17.47 +   * The returned WhiteBox object should be carefully guarded
   17.48 +   * by the caller, since it can be used to read and write data
   17.49 +   * at arbitrary memory addresses. It must never be passed to
   17.50 +   * untrusted code.
   17.51 +   */
   17.52 +  public synchronized static WhiteBox getWhiteBox() {
   17.53 +    SecurityManager sm = System.getSecurityManager();
   17.54 +    if (sm != null) {
   17.55 +      sm.checkPermission(new WhiteBoxPermission("getInstance"));
   17.56 +    }
   17.57 +    return instance;
   17.58 +  }
   17.59 +
   17.60 +  static {
   17.61 +    registerNatives();
   17.62 +  }
   17.63 +
   17.64 +  // Memory
   17.65 +  public native long getObjectAddress(Object o);
   17.66 +  public native int  getHeapOopSize();
   17.67 +
   17.68 +  // G1
   17.69 +  public native boolean g1InConcurrentMark();
   17.70 +  public native boolean g1IsHumongous(Object o);
   17.71 +  public native long    g1NumFreeRegions();
   17.72 +  public native int     g1RegionSize();
   17.73 +}
    18.1 --- a/src/share/vm/prims/nativeLookup.cpp	Fri Feb 17 15:11:32 2012 -0800
    18.2 +++ b/src/share/vm/prims/nativeLookup.cpp	Thu Feb 23 14:58:35 2012 +0100
    18.3 @@ -121,6 +121,7 @@
    18.4    void JNICALL JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls);
    18.5    void JNICALL JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass unsafecls);
    18.6    void JNICALL JVM_RegisterPerfMethods(JNIEnv *env, jclass perfclass);
    18.7 +  void JNICALL JVM_RegisterWhiteBoxMethods(JNIEnv *env, jclass wbclass);
    18.8  }
    18.9  
   18.10  #define CC (char*)  /* cast a literal from (const char*) */
   18.11 @@ -133,7 +134,8 @@
   18.12  
   18.13    { CC"Java_sun_misc_Unsafe_registerNatives",                      NULL, FN_PTR(JVM_RegisterUnsafeMethods)       },
   18.14    { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
   18.15 -  { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         }
   18.16 +  { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         },
   18.17 +  { CC"Java_sun_hotspot_WhiteBox_registerNatives",                 NULL, FN_PTR(JVM_RegisterWhiteBoxMethods)     },
   18.18  };
   18.19  
   18.20  static address lookup_special_native(char* jni_name) {
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/share/vm/prims/whitebox.cpp	Thu Feb 23 14:58:35 2012 +0100
    19.3 @@ -0,0 +1,114 @@
    19.4 +/*
    19.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.
   19.11 + *
   19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.15 + * version 2 for more details (a copy is included in the LICENSE file that
   19.16 + * accompanied this code).
   19.17 + *
   19.18 + * You should have received a copy of the GNU General Public License version
   19.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.21 + *
   19.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.23 + * or visit www.oracle.com if you need additional information or have any
   19.24 + * questions.
   19.25 + *
   19.26 + */
   19.27 +
   19.28 +#include "precompiled.hpp"
   19.29 +
   19.30 +#include "jni.h"
   19.31 +
   19.32 +#include "memory/universe.hpp"
   19.33 +#include "oops/oop.inline.hpp"
   19.34 +#include "prims/whitebox.hpp"
   19.35 +#include "runtime/interfaceSupport.hpp"
   19.36 +#include "runtime/os.hpp"
   19.37 +#include "utilities/debug.hpp"
   19.38 +
   19.39 +#ifndef SERIALGC
   19.40 +#include "gc_implementation/g1/concurrentMark.hpp"
   19.41 +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
   19.42 +#include "gc_implementation/g1/heapRegionRemSet.hpp"
   19.43 +#endif // !SERIALGC
   19.44 +
   19.45 +bool WhiteBox::_used = false;
   19.46 +
   19.47 +// Entry macro to transition from JNI to VM state.
   19.48 +
   19.49 +#define WB_ENTRY(result_type, header) JNI_ENTRY(result_type, header)
   19.50 +#define WB_END JNI_END
   19.51 +
   19.52 +// Definitions of functions exposed via Whitebox API
   19.53 +
   19.54 +WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
   19.55 +  return (jlong)(void*)JNIHandles::resolve(obj);
   19.56 +WB_END
   19.57 +
   19.58 +WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
   19.59 +  return heapOopSize;
   19.60 +WB_END
   19.61 +
   19.62 +#ifndef SERIALGC
   19.63 +WB_ENTRY(jboolean, WB_G1IsHumongous(JNIEnv* env, jobject o, jobject obj))
   19.64 +  G1CollectedHeap* g1 = G1CollectedHeap::heap();
   19.65 +  oop result = JNIHandles::resolve(obj);
   19.66 +  const HeapRegion* hr = g1->heap_region_containing(result);
   19.67 +  return hr->isHumongous();
   19.68 +WB_END
   19.69 +
   19.70 +WB_ENTRY(jlong, WB_G1NumFreeRegions(JNIEnv* env, jobject o))
   19.71 +  G1CollectedHeap* g1 = G1CollectedHeap::heap();
   19.72 +  size_t nr = g1->free_regions();
   19.73 +  return (jlong)nr;
   19.74 +WB_END
   19.75 +
   19.76 +WB_ENTRY(jboolean, WB_G1InConcurrentMark(JNIEnv* env, jobject o))
   19.77 +  G1CollectedHeap* g1 = G1CollectedHeap::heap();
   19.78 +  ConcurrentMark* cm = g1->concurrent_mark();
   19.79 +  return cm->concurrent_marking_in_progress();
   19.80 +WB_END
   19.81 +
   19.82 +WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
   19.83 +  return (jint)HeapRegion::GrainBytes;
   19.84 +WB_END
   19.85 +#endif // !SERIALGC
   19.86 +
   19.87 +#define CC (char*)
   19.88 +
   19.89 +static JNINativeMethod methods[] = {
   19.90 +  {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
   19.91 +  {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
   19.92 +#ifndef SERIALGC
   19.93 +  {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
   19.94 +  {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
   19.95 +  {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },
   19.96 +  {CC"g1RegionSize",       CC"()I",                   (void*)&WB_G1RegionSize      },
   19.97 +#endif // !SERIALGC
   19.98 +};
   19.99 +
  19.100 +#undef CC
  19.101 +
  19.102 +JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
  19.103 +  {
  19.104 +    if (WhiteBoxAPI) {
  19.105 +      // Make sure that wbclass is loaded by the null classloader
  19.106 +      instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
  19.107 +      Handle loader(ikh->class_loader());
  19.108 +      if (loader.is_null()) {
  19.109 +        ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
  19.110 +        jint result = env->RegisterNatives(wbclass, methods, sizeof(methods)/sizeof(methods[0]));
  19.111 +        if (result == 0) {
  19.112 +          WhiteBox::set_used();
  19.113 +        }
  19.114 +      }
  19.115 +    }
  19.116 +  }
  19.117 +JVM_END
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/share/vm/prims/whitebox.hpp	Thu Feb 23 14:58:35 2012 +0100
    20.3 @@ -0,0 +1,36 @@
    20.4 +/*
    20.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.
   20.11 + *
   20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.15 + * version 2 for more details (a copy is included in the LICENSE file that
   20.16 + * accompanied this code).
   20.17 + *
   20.18 + * You should have received a copy of the GNU General Public License version
   20.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.21 + *
   20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.23 + * or visit www.oracle.com if you need additional information or have any
   20.24 + * questions.
   20.25 + *
   20.26 + */
   20.27 +
   20.28 +#ifndef SHARE_VM_PRIMS_WHITEBOX_HPP
   20.29 +#define SHARE_VM_PRIMS_WHITEBOX_HPP
   20.30 +
   20.31 +class WhiteBox : public AllStatic {
   20.32 + private:
   20.33 +  static bool _used;
   20.34 + public:
   20.35 +  static bool used()     { return _used; }
   20.36 +  static void set_used() { _used = true; }
   20.37 +};
   20.38 +
   20.39 +#endif // SHARE_VM_PRIMS_WHITEBOX_HPP
    21.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Feb 17 15:11:32 2012 -0800
    21.2 +++ b/src/share/vm/runtime/arguments.cpp	Thu Feb 23 14:58:35 2012 +0100
    21.3 @@ -2050,6 +2050,19 @@
    21.4      FREE_C_HEAP_ARRAY(char, altclasses_path);
    21.5    }
    21.6  
    21.7 +  if (WhiteBoxAPI) {
    21.8 +    // Append wb.jar to bootclasspath if enabled
    21.9 +    const char* wb_jar = "wb.jar";
   21.10 +    size_t wb_path_len = strlen(get_meta_index_dir()) + 1 +
   21.11 +                         strlen(wb_jar);
   21.12 +    char* wb_path = NEW_C_HEAP_ARRAY(char, wb_path_len);
   21.13 +    strcpy(wb_path, get_meta_index_dir());
   21.14 +    strcat(wb_path, wb_jar);
   21.15 +    scp.add_suffix(wb_path);
   21.16 +    scp_assembly_required = true;
   21.17 +    FREE_C_HEAP_ARRAY(char, wb_path);
   21.18 +  }
   21.19 +
   21.20    // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
   21.21    result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
   21.22    if (result != JNI_OK) {
    22.1 --- a/src/share/vm/runtime/globals.hpp	Fri Feb 17 15:11:32 2012 -0800
    22.2 +++ b/src/share/vm/runtime/globals.hpp	Thu Feb 23 14:58:35 2012 +0100
    22.3 @@ -3896,7 +3896,10 @@
    22.4    product(bool, UseVMInterruptibleIO, false,                                \
    22.5            "(Unstable, Solaris-specific) Thread interrupt before or with "   \
    22.6            "EINTR for I/O operations results in OS_INTRPT. The default value"\
    22.7 -          " of this flag is true for JDK 6 and earlier")
    22.8 +          " of this flag is true for JDK 6 and earlier")                    \
    22.9 +                                                                            \
   22.10 +  diagnostic(bool, WhiteBoxAPI, false,                                      \
   22.11 +          "Enable internal testing APIs")
   22.12  
   22.13  /*
   22.14   *  Macros for factoring of globals
    23.1 --- a/src/share/vm/utilities/vmError.cpp	Fri Feb 17 15:11:32 2012 -0800
    23.2 +++ b/src/share/vm/utilities/vmError.cpp	Thu Feb 23 14:58:35 2012 +0100
    23.3 @@ -25,6 +25,7 @@
    23.4  #include "precompiled.hpp"
    23.5  #include "compiler/compileBroker.hpp"
    23.6  #include "gc_interface/collectedHeap.hpp"
    23.7 +#include "prims/whitebox.hpp"
    23.8  #include "runtime/arguments.hpp"
    23.9  #include "runtime/frame.inline.hpp"
   23.10  #include "runtime/init.hpp"
   23.11 @@ -717,6 +718,13 @@
   23.12         st->cr();
   23.13       }
   23.14  
   23.15 +  STEP(215, "(printing warning if internal testing API used)" )
   23.16 +
   23.17 +     if (WhiteBox::used()) {
   23.18 +       st->print_cr("Unsupported internal testing APIs have been used.");
   23.19 +       st->cr();
   23.20 +     }
   23.21 +
   23.22    STEP(220, "(printing environment variables)" )
   23.23  
   23.24       if (_verbose) {
    24.1 --- a/test/Makefile	Fri Feb 17 15:11:32 2012 -0800
    24.2 +++ b/test/Makefile	Thu Feb 23 14:58:35 2012 +0100
    24.3 @@ -1,5 +1,5 @@
    24.4  #
    24.5 -# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
    24.6 +# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
    24.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8  #
    24.9  # This code is free software; you can redistribute it and/or modify it
   24.10 @@ -228,6 +228,24 @@
   24.11  
   24.12  ################################################################
   24.13  
   24.14 +# wbapitest (make sure the whitebox testing api classes work
   24.15 +
   24.16 +wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
   24.17 +	$(JTREG) -a -v:fail,error               \
   24.18 +          $(JTREG_KEY_OPTION)                   \
   24.19 +          $(EXTRA_JTREG_OPTIONS)                \
   24.20 +          -r:$(ABS_TEST_OUTPUT_DIR)/JTreport    \
   24.21 +          -w:$(ABS_TEST_OUTPUT_DIR)/JTwork      \
   24.22 +          -jdk:$(PRODUCT_HOME)                  \
   24.23 +          $(JAVA_OPTIONS:%=-vmoption:%)         \
   24.24 +          $(TEST_ROOT)/sanity                   \
   24.25 +	  || $(BUNDLE_UP_FAILED)
   24.26 +	$(BUNDLE_UP)
   24.27 +
   24.28 +PHONY_LIST += wbapitest
   24.29 +
   24.30 +################################################################
   24.31 +
   24.32  # packtest
   24.33  
   24.34  # Expect JPRT to set JPRT_PACKTEST_HOME.
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/sanity/WBApi.java	Thu Feb 23 14:58:35 2012 +0100
    25.3 @@ -0,0 +1,13 @@
    25.4 +/*
    25.5 + * @test WBApi
    25.6 + * @summary verify that whitebox functions can be linked and executed
    25.7 + * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI WBApi.java
    25.8 + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi
    25.9 + */
   25.10 +
   25.11 +import sun.hotspot.WhiteBox;
   25.12 +public class WBApi {
   25.13 +    public static void main(String... args) {
   25.14 +        System.out.printf("args at: %x\n",WhiteBox.getWhiteBox().getObjectAddress(args));
   25.15 +    }
   25.16 +}

mercurial