8006753: fix failed for JDK-8002415 White box testing API for HotSpot

Tue, 19 Feb 2013 18:45:49 +0100

author
mgerdin
date
Tue, 19 Feb 2013 18:45:49 +0100
changeset 4637
1b0dc9f87e75
parent 4610
1048edb5434a
child 4639
b861c8af2510

8006753: fix failed for JDK-8002415 White box testing API for HotSpot
Summary: Modify WhiteBoxAPI to use interface classes from test/testlibrary instead, add ClassFileInstaller to resolve the boot class path issue
Reviewed-by: ctornqvi, dsamersoff, coleenp, kvn

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/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/tools/whitebox/sun/hotspot/parser/DiagnosticCommand.java file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
test/compiler/whitebox/DeoptimizeAllTest.java file | annotate | diff | comparison | revisions
test/compiler/whitebox/DeoptimizeMethodTest.java file | annotate | diff | comparison | revisions
test/compiler/whitebox/IsMethodCompilableTest.java file | annotate | diff | comparison | revisions
test/compiler/whitebox/MakeMethodNotCompilableTest.java file | annotate | diff | comparison | revisions
test/compiler/whitebox/SetDontInlineMethodTest.java file | annotate | diff | comparison | revisions
test/runtime/NMT/AllocTestType.java file | annotate | diff | comparison | revisions
test/runtime/NMT/PrintNMTStatistics.java file | annotate | diff | comparison | revisions
test/runtime/NMT/SummarySanityCheck.java file | annotate | diff | comparison | revisions
test/sanity/WBApi.java file | annotate | diff | comparison | revisions
test/serviceability/ParserTest.java file | annotate | diff | comparison | revisions
test/testlibrary/ClassFileInstaller.java file | annotate | diff | comparison | revisions
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java file | annotate | diff | comparison | revisions
test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/Makefile	Tue Feb 19 13:33:39 2013 -0500
     1.2 +++ b/make/Makefile	Tue Feb 19 18:45:49 2013 +0100
     1.3 @@ -464,9 +464,6 @@
     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	Tue Feb 19 13:33:39 2013 -0500
     2.2 +++ b/make/bsd/makefiles/defs.make	Tue Feb 19 18:45:49 2013 +0100
     2.3 @@ -157,8 +157,6 @@
     2.4  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
     2.5  EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
     2.6  
     2.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
     2.8 -
     2.9  ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
    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	Tue Feb 19 13:33:39 2013 -0500
     3.2 +++ b/make/bsd/makefiles/vm.make	Tue Feb 19 18:45:49 2013 +0100
     3.3 @@ -337,9 +337,6 @@
     3.4  # Serviceability agent
     3.5  include $(MAKEFILES_DIR)/saproc.make
     3.6  
     3.7 -# Whitebox testing API
     3.8 -include $(MAKEFILES_DIR)/wb.make
     3.9 -
    3.10  #----------------------------------------------------------------------
    3.11  
    3.12  ifeq ($(OS_VENDOR), Darwin)
    3.13 @@ -347,10 +344,10 @@
    3.14  	dsymutil $(LIBJVM)
    3.15  
    3.16  # no libjvm_db for macosx
    3.17 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM $(WB_JAR)
    3.18 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM
    3.19  	echo "Doing vm.make build:"
    3.20  else
    3.21 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
    3.22 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
    3.23  endif
    3.24  
    3.25  install: install_jvm install_jsig install_saproc
     4.1 --- a/make/bsd/makefiles/wb.make	Tue Feb 19 13:33:39 2013 -0500
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,46 +0,0 @@
     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) -sourcepath $(WBSRCDIR) -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/linux/makefiles/defs.make	Tue Feb 19 13:33:39 2013 -0500
     5.2 +++ b/make/linux/makefiles/defs.make	Tue Feb 19 18:45:49 2013 +0100
     5.3 @@ -258,8 +258,6 @@
     5.4  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
     5.5  EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
     5.6  
     5.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
     5.8 -
     5.9  ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
    5.10    EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
    5.11    EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
     6.1 --- a/make/linux/makefiles/vm.make	Tue Feb 19 13:33:39 2013 -0500
     6.2 +++ b/make/linux/makefiles/vm.make	Tue Feb 19 18:45:49 2013 +0100
     6.3 @@ -381,12 +381,9 @@
     6.4  # Serviceability agent
     6.5  include $(MAKEFILES_DIR)/saproc.make
     6.6  
     6.7 -# Whitebox testing API
     6.8 -include $(MAKEFILES_DIR)/wb.make
     6.9 -
    6.10  #----------------------------------------------------------------------
    6.11  
    6.12 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
    6.13 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck
    6.14  
    6.15  install: install_jvm install_jsig install_saproc
    6.16  
     7.1 --- a/make/linux/makefiles/wb.make	Tue Feb 19 13:33:39 2013 -0500
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,46 +0,0 @@
     7.4 -#
     7.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     7.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 -#
     7.8 -# This code is free software; you can redistribute it and/or modify it
     7.9 -# under the terms of the GNU General Public License version 2 only, as
    7.10 -# published by the Free Software Foundation.
    7.11 -#
    7.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 -# version 2 for more details (a copy is included in the LICENSE file that
    7.16 -# accompanied this code).
    7.17 -#
    7.18 -# You should have received a copy of the GNU General Public License version
    7.19 -# 2 along with this work; if not, write to the Free Software Foundation,
    7.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 -#
    7.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 -# or visit www.oracle.com if you need additional information or have any
    7.24 -# questions.
    7.25 -#  
    7.26 -#
    7.27 -
    7.28 -# Rules to build whitebox testing library, used by vm.make
    7.29 -WB = wb
    7.30 -
    7.31 -WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
    7.32 -
    7.33 -WB_JAR = $(GENERATED)/$(WB).jar
    7.34 -
    7.35 -WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
    7.36 -WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
    7.37 -
    7.38 -WB_JAVA_CLASSES  = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
    7.39 -	$(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
    7.40 -
    7.41 -$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
    7.42 -	$(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $<
    7.43 -
    7.44 -$(WB_JAR): $(WB_JAVA_CLASSES)
    7.45 -	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
    7.46 -
    7.47 -$(WB_JAVA_CLASSDIR):
    7.48 -	$(QUIETLY) mkdir -p $@
    7.49 -
     8.1 --- a/make/solaris/makefiles/defs.make	Tue Feb 19 13:33:39 2013 -0500
     8.2 +++ b/make/solaris/makefiles/defs.make	Tue Feb 19 18:45:49 2013 +0100
     8.3 @@ -187,8 +187,6 @@
     8.4    endif
     8.5  endif
     8.6  
     8.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
     8.8 -
     8.9  EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
    8.10  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
    8.11  
     9.1 --- a/make/solaris/makefiles/vm.make	Tue Feb 19 13:33:39 2013 -0500
     9.2 +++ b/make/solaris/makefiles/vm.make	Tue Feb 19 18:45:49 2013 +0100
     9.3 @@ -347,12 +347,9 @@
     9.4  # Serviceability agent
     9.5  include $(MAKEFILES_DIR)/saproc.make
     9.6  
     9.7 -# Whitebox testing API
     9.8 -include $(MAKEFILES_DIR)/wb.make
     9.9 -
    9.10  #----------------------------------------------------------------------
    9.11  
    9.12 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
    9.13 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
    9.14  
    9.15  install: install_jvm install_jsig install_saproc
    9.16  
    10.1 --- a/make/solaris/makefiles/wb.make	Tue Feb 19 13:33:39 2013 -0500
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,46 +0,0 @@
    10.4 -#
    10.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    10.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 -#
    10.8 -# This code is free software; you can redistribute it and/or modify it
    10.9 -# under the terms of the GNU General Public License version 2 only, as
   10.10 -# published by the Free Software Foundation.
   10.11 -#
   10.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
   10.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.15 -# version 2 for more details (a copy is included in the LICENSE file that
   10.16 -# accompanied this code).
   10.17 -#
   10.18 -# You should have received a copy of the GNU General Public License version
   10.19 -# 2 along with this work; if not, write to the Free Software Foundation,
   10.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.21 -#
   10.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.23 -# or visit www.oracle.com if you need additional information or have any
   10.24 -# questions.
   10.25 -#
   10.26 -
   10.27 -# Rules to build whitebox testing library, used by vm.make
   10.28 -
   10.29 -WB = wb
   10.30 -
   10.31 -WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
   10.32 -
   10.33 -WB_JAR = $(GENERATED)/$(WB).jar
   10.34 -
   10.35 -WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
   10.36 -WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
   10.37 -
   10.38 -WB_JAVA_CLASSES  = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
   10.39 -	$(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
   10.40 -
   10.41 -$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
   10.42 -	$(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $<
   10.43 -
   10.44 -$(WB_JAR): $(WB_JAVA_CLASSES)
   10.45 -	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
   10.46 -
   10.47 -$(WB_JAVA_CLASSDIR):
   10.48 -	$(QUIETLY) mkdir -p $@
   10.49 -
    11.1 --- a/make/windows/makefiles/debug.make	Tue Feb 19 13:33:39 2013 -0500
    11.2 +++ b/make/windows/makefiles/debug.make	Tue Feb 19 18:45:49 2013 +0100
    11.3 @@ -33,7 +33,7 @@
    11.4  BUILD_PCH_FILE=_build_pch_file.obj
    11.5  !endif
    11.6  
    11.7 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
    11.8 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
    11.9  
   11.10  !include ../local.make
   11.11  !include compile.make
   11.12 @@ -72,4 +72,3 @@
   11.13  !include $(WorkSpace)/make/windows/makefiles/shared.make
   11.14  !include $(WorkSpace)/make/windows/makefiles/sa.make
   11.15  !include $(WorkSpace)/make/windows/makefiles/launcher.make
   11.16 -!include $(WorkSpace)/make/windows/makefiles/wb.make
    12.1 --- a/make/windows/makefiles/defs.make	Tue Feb 19 13:33:39 2013 -0500
    12.2 +++ b/make/windows/makefiles/defs.make	Tue Feb 19 18:45:49 2013 +0100
    12.3 @@ -277,8 +277,6 @@
    12.4    endif
    12.5  endif
    12.6  
    12.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
    12.8 -
    12.9  ifeq ($(BUILD_WIN_SA), 1)
   12.10    EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX)
   12.11    ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    13.1 --- a/make/windows/makefiles/fastdebug.make	Tue Feb 19 13:33:39 2013 -0500
    13.2 +++ b/make/windows/makefiles/fastdebug.make	Tue Feb 19 18:45:49 2013 +0100
    13.3 @@ -33,7 +33,7 @@
    13.4  BUILD_PCH_FILE=_build_pch_file.obj
    13.5  !endif
    13.6  
    13.7 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
    13.8 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
    13.9  
   13.10  !include ../local.make
   13.11  !include compile.make
   13.12 @@ -71,4 +71,3 @@
   13.13  !include $(WorkSpace)/make/windows/makefiles/shared.make
   13.14  !include $(WorkSpace)/make/windows/makefiles/sa.make
   13.15  !include $(WorkSpace)/make/windows/makefiles/launcher.make
   13.16 -!include $(WorkSpace)/make/windows/makefiles/wb.make
    14.1 --- a/make/windows/makefiles/product.make	Tue Feb 19 13:33:39 2013 -0500
    14.2 +++ b/make/windows/makefiles/product.make	Tue Feb 19 18:45:49 2013 +0100
    14.3 @@ -32,7 +32,7 @@
    14.4  BUILD_PCH_FILE=_build_pch_file.obj
    14.5  !endif
    14.6  
    14.7 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
    14.8 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
    14.9  
   14.10  !include ../local.make
   14.11  !include compile.make
   14.12 @@ -82,4 +82,3 @@
   14.13  !include $(WorkSpace)/make/windows/makefiles/shared.make
   14.14  !include $(WorkSpace)/make/windows/makefiles/sa.make
   14.15  !include $(WorkSpace)/make/windows/makefiles/launcher.make
   14.16 -!include $(WorkSpace)/make/windows/makefiles/wb.make
    15.1 --- a/make/windows/makefiles/wb.make	Tue Feb 19 13:33:39 2013 -0500
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,54 +0,0 @@
    15.4 -#
    15.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    15.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 -#
    15.8 -# This code is free software; you can redistribute it and/or modify it
    15.9 -# under the terms of the GNU General Public License version 2 only, as
   15.10 -# published by the Free Software Foundation.
   15.11 -#
   15.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 -# version 2 for more details (a copy is included in the LICENSE file that
   15.16 -# accompanied this code).
   15.17 -#
   15.18 -# You should have received a copy of the GNU General Public License version
   15.19 -# 2 along with this work; if not, write to the Free Software Foundation,
   15.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 -#
   15.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.23 -# or visit www.oracle.com if you need additional information or have any
   15.24 -# questions.
   15.25 -#  
   15.26 -#
   15.27 -
   15.28 -# This makefile is used to build the whitebox testing lib
   15.29 -# and compile the tests which use it
   15.30 -
   15.31 -!include $(WorkSpace)/make/windows/makefiles/rules.make
   15.32 -
   15.33 -WBSRCDIR = $(WorkSpace)/src/share/tools/whitebox
   15.34 -
   15.35 -# turn GENERATED into a windows path to get sane dependencies
   15.36 -WB_CLASSES=$(GENERATED:/=\)\wb\classes
   15.37 -WB_JAR=$(GENERATED:/=\)\wb.jar
   15.38 -
   15.39 -# call recursive make to do wildcard expansion
   15.40 -.SUFFIXES : .java .class
   15.41 -wb_java_srcs: $(WorkSpace)\src\share\tools\whitebox\sun\hotspot\*.java $(WB_CLASSES)
   15.42 -	$(MAKE) -f $(WorkSpace)\make\windows\makefiles\$(BUILD_FLAVOR).make $(**:.java=.class)
   15.43 -
   15.44 -
   15.45 -{$(WorkSpace)\src\share\tools\whitebox\sun\hotspot}.java.class::
   15.46 -	$(COMPILE_JAVAC) -sourcepath $(WBSRCDIR) -d $(WB_CLASSES) $<
   15.47 -
   15.48 -$(WB_JAR): wb_java_srcs
   15.49 -	$(RUN_JAR) cf $@ -C $(WB_CLASSES) .
   15.50 -
   15.51 -# turn $@ to a unix path because mkdir in PATH is cygwin/mks mkdir
   15.52 -$(WB_CLASSES):
   15.53 -	mkdir -p $(@:\=/)
   15.54 -
   15.55 -# main target to build wb
   15.56 -wb: $(WB_JAR)
   15.57 -
    16.1 --- a/src/share/tools/whitebox/sun/hotspot/WhiteBox.java	Tue Feb 19 13:33:39 2013 -0500
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,97 +0,0 @@
    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 -package sun.hotspot;
   16.29 -
   16.30 -import java.lang.reflect.Method;
   16.31 -import java.security.BasicPermission;
   16.32 -import sun.hotspot.parser.DiagnosticCommand;
   16.33 -
   16.34 -public class WhiteBox {
   16.35 -
   16.36 -  @SuppressWarnings("serial")
   16.37 -  public static class WhiteBoxPermission extends BasicPermission {
   16.38 -    public WhiteBoxPermission(String s) {
   16.39 -      super(s);
   16.40 -    }
   16.41 -  }
   16.42 -
   16.43 -  private WhiteBox() {}
   16.44 -  private static final WhiteBox instance = new WhiteBox();
   16.45 -  private static native void registerNatives();
   16.46 -
   16.47 -  /**
   16.48 -   * Returns the singleton WhiteBox instance.
   16.49 -   *
   16.50 -   * The returned WhiteBox object should be carefully guarded
   16.51 -   * by the caller, since it can be used to read and write data
   16.52 -   * at arbitrary memory addresses. It must never be passed to
   16.53 -   * untrusted code.
   16.54 -   */
   16.55 -  public synchronized static WhiteBox getWhiteBox() {
   16.56 -    SecurityManager sm = System.getSecurityManager();
   16.57 -    if (sm != null) {
   16.58 -      sm.checkPermission(new WhiteBoxPermission("getInstance"));
   16.59 -    }
   16.60 -    return instance;
   16.61 -  }
   16.62 -
   16.63 -  static {
   16.64 -    registerNatives();
   16.65 -  }
   16.66 -
   16.67 -  // Memory
   16.68 -  public native long getObjectAddress(Object o);
   16.69 -  public native int  getHeapOopSize();
   16.70 -
   16.71 -  // Runtime
   16.72 -  // Make sure class name is in the correct format
   16.73 -  public boolean isClassAlive(String name) {
   16.74 -    return isClassAlive0(name.replace('.', '/'));
   16.75 -  }
   16.76 -  private native boolean isClassAlive0(String name);
   16.77 -
   16.78 -  // G1
   16.79 -  public native boolean g1InConcurrentMark();
   16.80 -  public native boolean g1IsHumongous(Object o);
   16.81 -  public native long    g1NumFreeRegions();
   16.82 -  public native int     g1RegionSize();
   16.83 -  public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
   16.84 -
   16.85 -  // NMT
   16.86 -  public native boolean NMTAllocTest();
   16.87 -  public native boolean NMTFreeTestMemory();
   16.88 -  public native boolean NMTWaitForDataMerge();
   16.89 -
   16.90 -  // Compiler
   16.91 -  public native void    deoptimizeAll();
   16.92 -  public native boolean isMethodCompiled(Method method);
   16.93 -  public native boolean isMethodCompilable(Method method);
   16.94 -  public native boolean isMethodQueuedForCompilation(Method method);
   16.95 -  public native int     deoptimizeMethod(Method method);
   16.96 -  public native void    makeMethodNotCompilable(Method method);
   16.97 -  public native int     getMethodCompilationLevel(Method method);
   16.98 -  public native boolean setDontInlineMethod(Method method, boolean value);
   16.99 -  public native int     getCompileQueuesSize();
  16.100 -}
    17.1 --- a/src/share/tools/whitebox/sun/hotspot/parser/DiagnosticCommand.java	Tue Feb 19 13:33:39 2013 -0500
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,43 +0,0 @@
    17.4 -package sun.hotspot.parser;
    17.5 -
    17.6 -public class DiagnosticCommand {
    17.7 -
    17.8 -    public enum DiagnosticArgumentType {
    17.9 -        JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE
   17.10 -    }
   17.11 -
   17.12 -    private String name;
   17.13 -    private String desc;
   17.14 -    private DiagnosticArgumentType type;
   17.15 -    private boolean mandatory;
   17.16 -    private String defaultValue;
   17.17 -
   17.18 -    public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
   17.19 -            boolean mandatory, String defaultValue) {
   17.20 -        this.name = name;
   17.21 -        this.desc = desc;
   17.22 -        this.type = type;
   17.23 -        this.mandatory = mandatory;
   17.24 -        this.defaultValue = defaultValue;
   17.25 -    }
   17.26 -
   17.27 -    public String getName() {
   17.28 -        return name;
   17.29 -    }
   17.30 -
   17.31 -    public String getDesc() {
   17.32 -        return desc;
   17.33 -    }
   17.34 -
   17.35 -    public DiagnosticArgumentType getType() {
   17.36 -        return type;
   17.37 -    }
   17.38 -
   17.39 -    public boolean isMandatory() {
   17.40 -        return mandatory;
   17.41 -    }
   17.42 -
   17.43 -    public String getDefaultValue() {
   17.44 -        return defaultValue;
   17.45 -    }
   17.46 -}
    18.1 --- a/src/share/vm/runtime/arguments.cpp	Tue Feb 19 13:33:39 2013 -0500
    18.2 +++ b/src/share/vm/runtime/arguments.cpp	Tue Feb 19 18:45:49 2013 +0100
    18.3 @@ -2191,19 +2191,6 @@
    18.4      FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal);
    18.5    }
    18.6  
    18.7 -  if (WhiteBoxAPI) {
    18.8 -    // Append wb.jar to bootclasspath if enabled
    18.9 -    const char* wb_jar = "wb.jar";
   18.10 -    size_t wb_path_len = strlen(get_meta_index_dir()) + 1 +
   18.11 -                         strlen(wb_jar);
   18.12 -    char* wb_path = NEW_C_HEAP_ARRAY(char, wb_path_len, mtInternal);
   18.13 -    strcpy(wb_path, get_meta_index_dir());
   18.14 -    strcat(wb_path, wb_jar);
   18.15 -    scp.add_suffix(wb_path);
   18.16 -    scp_assembly_required = true;
   18.17 -    FREE_C_HEAP_ARRAY(char, wb_path, mtInternal);
   18.18 -  }
   18.19 -
   18.20    // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
   18.21    result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
   18.22    if (result != JNI_OK) {
    19.1 --- a/test/compiler/whitebox/DeoptimizeAllTest.java	Tue Feb 19 13:33:39 2013 -0500
    19.2 +++ b/test/compiler/whitebox/DeoptimizeAllTest.java	Tue Feb 19 18:45:49 2013 +0100
    19.3 @@ -23,9 +23,10 @@
    19.4  
    19.5  /*
    19.6   * @test DeoptimizeAllTest
    19.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
    19.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeAllTest.java
    19.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest
   19.10 + * @library /testlibrary /testlibrary/whitebox
   19.11 + * @build DeoptimizeAllTest
   19.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   19.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest
   19.14   * @author igor.ignatyev@oracle.com
   19.15   */
   19.16  public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
    20.1 --- a/test/compiler/whitebox/DeoptimizeMethodTest.java	Tue Feb 19 13:33:39 2013 -0500
    20.2 +++ b/test/compiler/whitebox/DeoptimizeMethodTest.java	Tue Feb 19 18:45:49 2013 +0100
    20.3 @@ -23,9 +23,10 @@
    20.4  
    20.5  /*
    20.6   * @test DeoptimizeMethodTest
    20.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
    20.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeMethodTest.java
    20.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest
   20.10 + * @library /testlibrary /testlibrary/whitebox
   20.11 + * @build DeoptimizeMethodTest
   20.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   20.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest
   20.14   * @author igor.ignatyev@oracle.com
   20.15   */
   20.16  public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
    21.1 --- a/test/compiler/whitebox/IsMethodCompilableTest.java	Tue Feb 19 13:33:39 2013 -0500
    21.2 +++ b/test/compiler/whitebox/IsMethodCompilableTest.java	Tue Feb 19 18:45:49 2013 +0100
    21.3 @@ -24,9 +24,10 @@
    21.4  /*
    21.5   * @test IsMethodCompilableTest
    21.6   * @bug 8007270
    21.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
    21.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI IsMethodCompilableTest.java
    21.9 - * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest
   21.10 + * @library /testlibrary /testlibrary/whitebox
   21.11 + * @build IsMethodCompilableTest
   21.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   21.13 + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest
   21.14   * @author igor.ignatyev@oracle.com
   21.15   */
   21.16  public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
    22.1 --- a/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Tue Feb 19 13:33:39 2013 -0500
    22.2 +++ b/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Tue Feb 19 18:45:49 2013 +0100
    22.3 @@ -23,9 +23,10 @@
    22.4  
    22.5  /*
    22.6   * @test MakeMethodNotCompilableTest
    22.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
    22.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI MakeMethodNotCompilableTest.java
    22.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest
   22.10 + * @library /testlibrary /testlibrary/whitebox
   22.11 + * @build MakeMethodNotCompilableTest
   22.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   22.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest
   22.14   * @author igor.ignatyev@oracle.com
   22.15   */
   22.16  public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
    23.1 --- a/test/compiler/whitebox/SetDontInlineMethodTest.java	Tue Feb 19 13:33:39 2013 -0500
    23.2 +++ b/test/compiler/whitebox/SetDontInlineMethodTest.java	Tue Feb 19 18:45:49 2013 +0100
    23.3 @@ -23,9 +23,10 @@
    23.4  
    23.5  /*
    23.6   * @test SetDontInlineMethodTest
    23.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
    23.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SetDontInlineMethodTest.java
    23.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest
   23.10 + * @library /testlibrary /testlibrary/whitebox
   23.11 + * @build SetDontInlineMethodTest
   23.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   23.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest
   23.14   * @author igor.ignatyev@oracle.com
   23.15   */
   23.16  public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
    24.1 --- a/test/runtime/NMT/AllocTestType.java	Tue Feb 19 13:33:39 2013 -0500
    24.2 +++ b/test/runtime/NMT/AllocTestType.java	Tue Feb 19 18:45:49 2013 +0100
    24.3 @@ -25,9 +25,10 @@
    24.4   * @test
    24.5   * @summary Test consistency of NMT by leaking a few select allocations of the Test type and then verify visibility with jcmd
    24.6   * @key nmt jcmd
    24.7 - * @library /testlibrary
    24.8 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI AllocTestType.java
    24.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail AllocTestType
   24.10 + * @library /testlibrary /testlibrary/whitebox
   24.11 + * @build AllocTestType
   24.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   24.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail AllocTestType
   24.14   */
   24.15  
   24.16  import com.oracle.java.testlibrary.*;
    25.1 --- a/test/runtime/NMT/PrintNMTStatistics.java	Tue Feb 19 13:33:39 2013 -0500
    25.2 +++ b/test/runtime/NMT/PrintNMTStatistics.java	Tue Feb 19 18:45:49 2013 +0100
    25.3 @@ -26,8 +26,8 @@
    25.4   * @key nmt regression
    25.5   * @bug 8005936
    25.6   * @summary Make sure PrintNMTStatistics works on normal JVM exit
    25.7 - * @library /testlibrary
    25.8 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI PrintNMTStatistics.java
    25.9 + * @library /testlibrary /testlibrary/whitebox
   25.10 + * @run compile PrintNMTStatistics.java
   25.11   */
   25.12  
   25.13  import com.oracle.java.testlibrary.*;
    26.1 --- a/test/runtime/NMT/SummarySanityCheck.java	Tue Feb 19 13:33:39 2013 -0500
    26.2 +++ b/test/runtime/NMT/SummarySanityCheck.java	Tue Feb 19 18:45:49 2013 +0100
    26.3 @@ -25,9 +25,10 @@
    26.4   * @test
    26.5   * @key nmt jcmd
    26.6   * @summary Sanity check the output of NMT
    26.7 - * @library /testlibrary
    26.8 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SummarySanityCheck.java
    26.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck
   26.10 + * @library /testlibrary /testlibrary/whitebox
   26.11 + * @build SummarySanityCheck
   26.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   26.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck
   26.14   */
   26.15  
   26.16  import com.oracle.java.testlibrary.*;
    27.1 --- a/test/sanity/WBApi.java	Tue Feb 19 13:33:39 2013 -0500
    27.2 +++ b/test/sanity/WBApi.java	Tue Feb 19 18:45:49 2013 +0100
    27.3 @@ -1,8 +1,33 @@
    27.4 +/*
    27.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
    27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.7 + *
    27.8 + * This code is free software; you can redistribute it and/or modify it
    27.9 + * under the terms of the GNU General Public License version 2 only, as
   27.10 + * published by the Free Software Foundation.
   27.11 + *
   27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   27.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   27.15 + * version 2 for more details (a copy is included in the LICENSE file that
   27.16 + * accompanied this code).
   27.17 + *
   27.18 + * You should have received a copy of the GNU General Public License version
   27.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   27.21 + *
   27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   27.23 + * or visit www.oracle.com if you need additional information or have any
   27.24 + * questions.
   27.25 + */
   27.26 +
   27.27  /*
   27.28   * @test WBApi
   27.29   * @summary verify that whitebox functions can be linked and executed
   27.30 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI WBApi.java
   27.31 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi
   27.32 + * @library /testlibrary /testlibrary/whitebox
   27.33 + * @build WBApi
   27.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   27.35 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi
   27.36   */
   27.37  
   27.38  import sun.hotspot.WhiteBox;
    28.1 --- a/test/serviceability/ParserTest.java	Tue Feb 19 13:33:39 2013 -0500
    28.2 +++ b/test/serviceability/ParserTest.java	Tue Feb 19 18:45:49 2013 +0100
    28.3 @@ -1,8 +1,33 @@
    28.4 +/*
    28.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
    28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.7 + *
    28.8 + * This code is free software; you can redistribute it and/or modify it
    28.9 + * under the terms of the GNU General Public License version 2 only, as
   28.10 + * published by the Free Software Foundation.
   28.11 + *
   28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   28.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   28.15 + * version 2 for more details (a copy is included in the LICENSE file that
   28.16 + * accompanied this code).
   28.17 + *
   28.18 + * You should have received a copy of the GNU General Public License version
   28.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   28.21 + *
   28.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   28.23 + * or visit www.oracle.com if you need additional information or have any
   28.24 + * questions.
   28.25 + */
   28.26 +
   28.27  /*
   28.28   * @test ParserTest
   28.29 - * @summary verify that whitebox functions can be linked and executed
   28.30 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI ParserTest.java
   28.31 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest
   28.32 + * @summary Test that the diagnostic command arguemnt parser works
   28.33 + * @library /testlibrary /testlibrary/whitebox
   28.34 + * @build ParserTest
   28.35 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   28.36 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest
   28.37   */
   28.38  
   28.39  import java.math.BigInteger;
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/test/testlibrary/ClassFileInstaller.java	Tue Feb 19 18:45:49 2013 +0100
    29.3 @@ -0,0 +1,53 @@
    29.4 +/*
    29.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    29.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.7 + *
    29.8 + * This code is free software; you can redistribute it and/or modify it
    29.9 + * under the terms of the GNU General Public License version 2 only, as
   29.10 + * published by the Free Software Foundation.
   29.11 + *
   29.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   29.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   29.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   29.15 + * version 2 for more details (a copy is included in the LICENSE file that
   29.16 + * accompanied this code).
   29.17 + *
   29.18 + * You should have received a copy of the GNU General Public License version
   29.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   29.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   29.21 + *
   29.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   29.23 + * or visit www.oracle.com if you need additional information or have any
   29.24 + * questions.
   29.25 + */
   29.26 +
   29.27 +import java.io.InputStream;
   29.28 +import java.nio.file.Files;
   29.29 +import java.nio.file.Path;
   29.30 +import java.nio.file.Paths;
   29.31 +import java.nio.file.StandardCopyOption;
   29.32 +
   29.33 +/**
   29.34 + * Dump a class file for a class on the class path in the current directory
   29.35 + */
   29.36 +public class ClassFileInstaller {
   29.37 +    /**
   29.38 +     * @param args The names of the classes to dump
   29.39 +     * @throws Exception
   29.40 +     */
   29.41 +    public static void main(String... args) throws Exception {
   29.42 +        for (String arg : args) {
   29.43 +            ClassLoader cl = ClassFileInstaller.class.getClassLoader();
   29.44 +
   29.45 +            // Convert dotted class name to a path to a class file
   29.46 +            String pathName = arg.replace('.', '/').concat(".class");
   29.47 +            InputStream is = cl.getResourceAsStream(pathName);
   29.48 +
   29.49 +            // Create the class file's package directory
   29.50 +            Path p = Paths.get(pathName);
   29.51 +            Files.createDirectories(p.getParent());
   29.52 +            // Create the class file
   29.53 +            Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
   29.54 +        }
   29.55 +    }
   29.56 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Tue Feb 19 18:45:49 2013 +0100
    30.3 @@ -0,0 +1,97 @@
    30.4 +/*
    30.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
    30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 + *
    30.8 + * This code is free software; you can redistribute it and/or modify it
    30.9 + * under the terms of the GNU General Public License version 2 only, as
   30.10 + * published by the Free Software Foundation.
   30.11 + *
   30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.15 + * version 2 for more details (a copy is included in the LICENSE file that
   30.16 + * accompanied this code).
   30.17 + *
   30.18 + * You should have received a copy of the GNU General Public License version
   30.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.21 + *
   30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.23 + * or visit www.oracle.com if you need additional information or have any
   30.24 + * questions.
   30.25 + *
   30.26 + */
   30.27 +
   30.28 +package sun.hotspot;
   30.29 +
   30.30 +import java.lang.reflect.Method;
   30.31 +import java.security.BasicPermission;
   30.32 +import sun.hotspot.parser.DiagnosticCommand;
   30.33 +
   30.34 +public class WhiteBox {
   30.35 +
   30.36 +  @SuppressWarnings("serial")
   30.37 +  public static class WhiteBoxPermission extends BasicPermission {
   30.38 +    public WhiteBoxPermission(String s) {
   30.39 +      super(s);
   30.40 +    }
   30.41 +  }
   30.42 +
   30.43 +  private WhiteBox() {}
   30.44 +  private static final WhiteBox instance = new WhiteBox();
   30.45 +  private static native void registerNatives();
   30.46 +
   30.47 +  /**
   30.48 +   * Returns the singleton WhiteBox instance.
   30.49 +   *
   30.50 +   * The returned WhiteBox object should be carefully guarded
   30.51 +   * by the caller, since it can be used to read and write data
   30.52 +   * at arbitrary memory addresses. It must never be passed to
   30.53 +   * untrusted code.
   30.54 +   */
   30.55 +  public synchronized static WhiteBox getWhiteBox() {
   30.56 +    SecurityManager sm = System.getSecurityManager();
   30.57 +    if (sm != null) {
   30.58 +      sm.checkPermission(new WhiteBoxPermission("getInstance"));
   30.59 +    }
   30.60 +    return instance;
   30.61 +  }
   30.62 +
   30.63 +  static {
   30.64 +    registerNatives();
   30.65 +  }
   30.66 +
   30.67 +  // Memory
   30.68 +  public native long getObjectAddress(Object o);
   30.69 +  public native int  getHeapOopSize();
   30.70 +
   30.71 +  // Runtime
   30.72 +  // Make sure class name is in the correct format
   30.73 +  public boolean isClassAlive(String name) {
   30.74 +    return isClassAlive0(name.replace('.', '/'));
   30.75 +  }
   30.76 +  private native boolean isClassAlive0(String name);
   30.77 +
   30.78 +  // G1
   30.79 +  public native boolean g1InConcurrentMark();
   30.80 +  public native boolean g1IsHumongous(Object o);
   30.81 +  public native long    g1NumFreeRegions();
   30.82 +  public native int     g1RegionSize();
   30.83 +  public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
   30.84 +
   30.85 +  // NMT
   30.86 +  public native boolean NMTAllocTest();
   30.87 +  public native boolean NMTFreeTestMemory();
   30.88 +  public native boolean NMTWaitForDataMerge();
   30.89 +
   30.90 +  // Compiler
   30.91 +  public native void    deoptimizeAll();
   30.92 +  public native boolean isMethodCompiled(Method method);
   30.93 +  public native boolean isMethodCompilable(Method method);
   30.94 +  public native boolean isMethodQueuedForCompilation(Method method);
   30.95 +  public native int     deoptimizeMethod(Method method);
   30.96 +  public native void    makeMethodNotCompilable(Method method);
   30.97 +  public native int     getMethodCompilationLevel(Method method);
   30.98 +  public native boolean setDontInlineMethod(Method method, boolean value);
   30.99 +  public native int     getCompileQueuesSize();
  30.100 +}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java	Tue Feb 19 18:45:49 2013 +0100
    31.3 @@ -0,0 +1,66 @@
    31.4 +/*
    31.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.
   31.11 + *
   31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.15 + * version 2 for more details (a copy is included in the LICENSE file that
   31.16 + * accompanied this code).
   31.17 + *
   31.18 + * You should have received a copy of the GNU General Public License version
   31.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.21 + *
   31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.23 + * or visit www.oracle.com if you need additional information or have any
   31.24 + * questions.
   31.25 + */
   31.26 +
   31.27 +package sun.hotspot.parser;
   31.28 +
   31.29 +public class DiagnosticCommand {
   31.30 +
   31.31 +    public enum DiagnosticArgumentType {
   31.32 +        JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE
   31.33 +    }
   31.34 +
   31.35 +    private String name;
   31.36 +    private String desc;
   31.37 +    private DiagnosticArgumentType type;
   31.38 +    private boolean mandatory;
   31.39 +    private String defaultValue;
   31.40 +
   31.41 +    public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
   31.42 +            boolean mandatory, String defaultValue) {
   31.43 +        this.name = name;
   31.44 +        this.desc = desc;
   31.45 +        this.type = type;
   31.46 +        this.mandatory = mandatory;
   31.47 +        this.defaultValue = defaultValue;
   31.48 +    }
   31.49 +
   31.50 +    public String getName() {
   31.51 +        return name;
   31.52 +    }
   31.53 +
   31.54 +    public String getDesc() {
   31.55 +        return desc;
   31.56 +    }
   31.57 +
   31.58 +    public DiagnosticArgumentType getType() {
   31.59 +        return type;
   31.60 +    }
   31.61 +
   31.62 +    public boolean isMandatory() {
   31.63 +        return mandatory;
   31.64 +    }
   31.65 +
   31.66 +    public String getDefaultValue() {
   31.67 +        return defaultValue;
   31.68 +    }
   31.69 +}

mercurial