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
--- a/hotspot/make/Makefile Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/Makefile Tue Feb 19 18:45:49 2013 +0100
@@ -464,9 +464,6 @@
$(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
$(install-file)
-$(EXPORT_JRE_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
- $(install-file)
-
# Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h)
$(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
$(install-file)
--- a/hotspot/make/bsd/makefiles/defs.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/bsd/makefiles/defs.make Tue Feb 19 18:45:49 2013 +0100
@@ -157,8 +157,6 @@
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
-EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
-
ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
--- a/hotspot/make/bsd/makefiles/vm.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/bsd/makefiles/vm.make Tue Feb 19 18:45:49 2013 +0100
@@ -337,9 +337,6 @@
# Serviceability agent
include $(MAKEFILES_DIR)/saproc.make
-# Whitebox testing API
-include $(MAKEFILES_DIR)/wb.make
-
#----------------------------------------------------------------------
ifeq ($(OS_VENDOR), Darwin)
@@ -347,10 +344,10 @@
dsymutil $(LIBJVM)
# no libjvm_db for macosx
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM
echo "Doing vm.make build:"
else
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
endif
install: install_jvm install_jsig install_saproc
--- a/hotspot/make/bsd/makefiles/wb.make Tue Feb 19 13:33:39 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-#
-
-# Rules to build whitebox testing library, used by vm.make
-WB = wb
-
-WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
-
-WB_JAR = $(GENERATED)/$(WB).jar
-
-WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
-WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
-
-WB_JAVA_CLASSES = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
- $(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
-
-$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
- $(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $<
-
-$(WB_JAR): $(WB_JAVA_CLASSES)
- $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
-
-$(WB_JAVA_CLASSDIR):
- $(QUIETLY) mkdir -p $@
-
--- a/hotspot/make/linux/makefiles/defs.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/linux/makefiles/defs.make Tue Feb 19 18:45:49 2013 +0100
@@ -258,8 +258,6 @@
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
-EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
-
ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
--- a/hotspot/make/linux/makefiles/vm.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/linux/makefiles/vm.make Tue Feb 19 18:45:49 2013 +0100
@@ -381,12 +381,9 @@
# Serviceability agent
include $(MAKEFILES_DIR)/saproc.make
-# Whitebox testing API
-include $(MAKEFILES_DIR)/wb.make
-
#----------------------------------------------------------------------
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck
install: install_jvm install_jsig install_saproc
--- a/hotspot/make/linux/makefiles/wb.make Tue Feb 19 13:33:39 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-#
-
-# Rules to build whitebox testing library, used by vm.make
-WB = wb
-
-WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
-
-WB_JAR = $(GENERATED)/$(WB).jar
-
-WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
-WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
-
-WB_JAVA_CLASSES = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
- $(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
-
-$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
- $(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $<
-
-$(WB_JAR): $(WB_JAVA_CLASSES)
- $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
-
-$(WB_JAVA_CLASSDIR):
- $(QUIETLY) mkdir -p $@
-
--- a/hotspot/make/solaris/makefiles/defs.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/solaris/makefiles/defs.make Tue Feb 19 18:45:49 2013 +0100
@@ -187,8 +187,6 @@
endif
endif
-EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
-
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
--- a/hotspot/make/solaris/makefiles/vm.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/solaris/makefiles/vm.make Tue Feb 19 18:45:49 2013 +0100
@@ -347,12 +347,9 @@
# Serviceability agent
include $(MAKEFILES_DIR)/saproc.make
-# Whitebox testing API
-include $(MAKEFILES_DIR)/wb.make
-
#----------------------------------------------------------------------
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
install: install_jvm install_jsig install_saproc
--- a/hotspot/make/solaris/makefiles/wb.make Tue Feb 19 13:33:39 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-
-# Rules to build whitebox testing library, used by vm.make
-
-WB = wb
-
-WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox
-
-WB_JAR = $(GENERATED)/$(WB).jar
-
-WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java')
-WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes
-
-WB_JAVA_CLASSES = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \
- $(patsubst %.java,%.class,$(WB_JAVA_SRCS)))
-
-$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR)
- $(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $<
-
-$(WB_JAR): $(WB_JAVA_CLASSES)
- $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ .
-
-$(WB_JAVA_CLASSDIR):
- $(QUIETLY) mkdir -p $@
-
--- a/hotspot/make/windows/makefiles/debug.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/windows/makefiles/debug.make Tue Feb 19 18:45:49 2013 +0100
@@ -33,7 +33,7 @@
BUILD_PCH_FILE=_build_pch_file.obj
!endif
-default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
+default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
!include ../local.make
!include compile.make
@@ -72,4 +72,3 @@
!include $(WorkSpace)/make/windows/makefiles/shared.make
!include $(WorkSpace)/make/windows/makefiles/sa.make
!include $(WorkSpace)/make/windows/makefiles/launcher.make
-!include $(WorkSpace)/make/windows/makefiles/wb.make
--- a/hotspot/make/windows/makefiles/defs.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/windows/makefiles/defs.make Tue Feb 19 18:45:49 2013 +0100
@@ -277,8 +277,6 @@
endif
endif
-EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
-
ifeq ($(BUILD_WIN_SA), 1)
EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
--- a/hotspot/make/windows/makefiles/fastdebug.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/windows/makefiles/fastdebug.make Tue Feb 19 18:45:49 2013 +0100
@@ -33,7 +33,7 @@
BUILD_PCH_FILE=_build_pch_file.obj
!endif
-default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
+default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
!include ../local.make
!include compile.make
@@ -71,4 +71,3 @@
!include $(WorkSpace)/make/windows/makefiles/shared.make
!include $(WorkSpace)/make/windows/makefiles/sa.make
!include $(WorkSpace)/make/windows/makefiles/launcher.make
-!include $(WorkSpace)/make/windows/makefiles/wb.make
--- a/hotspot/make/windows/makefiles/product.make Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/make/windows/makefiles/product.make Tue Feb 19 18:45:49 2013 +0100
@@ -32,7 +32,7 @@
BUILD_PCH_FILE=_build_pch_file.obj
!endif
-default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
+default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
!include ../local.make
!include compile.make
@@ -82,4 +82,3 @@
!include $(WorkSpace)/make/windows/makefiles/shared.make
!include $(WorkSpace)/make/windows/makefiles/sa.make
!include $(WorkSpace)/make/windows/makefiles/launcher.make
-!include $(WorkSpace)/make/windows/makefiles/wb.make
--- a/hotspot/make/windows/makefiles/wb.make Tue Feb 19 13:33:39 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-#
-
-# This makefile is used to build the whitebox testing lib
-# and compile the tests which use it
-
-!include $(WorkSpace)/make/windows/makefiles/rules.make
-
-WBSRCDIR = $(WorkSpace)/src/share/tools/whitebox
-
-# turn GENERATED into a windows path to get sane dependencies
-WB_CLASSES=$(GENERATED:/=\)\wb\classes
-WB_JAR=$(GENERATED:/=\)\wb.jar
-
-# call recursive make to do wildcard expansion
-.SUFFIXES : .java .class
-wb_java_srcs: $(WorkSpace)\src\share\tools\whitebox\sun\hotspot\*.java $(WB_CLASSES)
- $(MAKE) -f $(WorkSpace)\make\windows\makefiles\$(BUILD_FLAVOR).make $(**:.java=.class)
-
-
-{$(WorkSpace)\src\share\tools\whitebox\sun\hotspot}.java.class::
- $(COMPILE_JAVAC) -sourcepath $(WBSRCDIR) -d $(WB_CLASSES) $<
-
-$(WB_JAR): wb_java_srcs
- $(RUN_JAR) cf $@ -C $(WB_CLASSES) .
-
-# turn $@ to a unix path because mkdir in PATH is cygwin/mks mkdir
-$(WB_CLASSES):
- mkdir -p $(@:\=/)
-
-# main target to build wb
-wb: $(WB_JAR)
-
--- a/hotspot/src/share/tools/whitebox/sun/hotspot/WhiteBox.java Tue Feb 19 13:33:39 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.hotspot;
-
-import java.lang.reflect.Method;
-import java.security.BasicPermission;
-import sun.hotspot.parser.DiagnosticCommand;
-
-public class WhiteBox {
-
- @SuppressWarnings("serial")
- public static class WhiteBoxPermission extends BasicPermission {
- public WhiteBoxPermission(String s) {
- super(s);
- }
- }
-
- private WhiteBox() {}
- private static final WhiteBox instance = new WhiteBox();
- private static native void registerNatives();
-
- /**
- * Returns the singleton WhiteBox instance.
- *
- * The returned WhiteBox object should be carefully guarded
- * by the caller, since it can be used to read and write data
- * at arbitrary memory addresses. It must never be passed to
- * untrusted code.
- */
- public synchronized static WhiteBox getWhiteBox() {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(new WhiteBoxPermission("getInstance"));
- }
- return instance;
- }
-
- static {
- registerNatives();
- }
-
- // Memory
- public native long getObjectAddress(Object o);
- public native int getHeapOopSize();
-
- // Runtime
- // Make sure class name is in the correct format
- public boolean isClassAlive(String name) {
- return isClassAlive0(name.replace('.', '/'));
- }
- private native boolean isClassAlive0(String name);
-
- // G1
- public native boolean g1InConcurrentMark();
- public native boolean g1IsHumongous(Object o);
- public native long g1NumFreeRegions();
- public native int g1RegionSize();
- public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args);
-
- // NMT
- public native boolean NMTAllocTest();
- public native boolean NMTFreeTestMemory();
- public native boolean NMTWaitForDataMerge();
-
- // Compiler
- public native void deoptimizeAll();
- public native boolean isMethodCompiled(Method method);
- public native boolean isMethodCompilable(Method method);
- public native boolean isMethodQueuedForCompilation(Method method);
- public native int deoptimizeMethod(Method method);
- public native void makeMethodNotCompilable(Method method);
- public native int getMethodCompilationLevel(Method method);
- public native boolean setDontInlineMethod(Method method, boolean value);
- public native int getCompileQueuesSize();
-}
--- a/hotspot/src/share/tools/whitebox/sun/hotspot/parser/DiagnosticCommand.java Tue Feb 19 13:33:39 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-package sun.hotspot.parser;
-
-public class DiagnosticCommand {
-
- public enum DiagnosticArgumentType {
- JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE
- }
-
- private String name;
- private String desc;
- private DiagnosticArgumentType type;
- private boolean mandatory;
- private String defaultValue;
-
- public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
- boolean mandatory, String defaultValue) {
- this.name = name;
- this.desc = desc;
- this.type = type;
- this.mandatory = mandatory;
- this.defaultValue = defaultValue;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDesc() {
- return desc;
- }
-
- public DiagnosticArgumentType getType() {
- return type;
- }
-
- public boolean isMandatory() {
- return mandatory;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-}
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Tue Feb 19 18:45:49 2013 +0100
@@ -2191,19 +2191,6 @@
FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal);
}
- if (WhiteBoxAPI) {
- // Append wb.jar to bootclasspath if enabled
- const char* wb_jar = "wb.jar";
- size_t wb_path_len = strlen(get_meta_index_dir()) + 1 +
- strlen(wb_jar);
- char* wb_path = NEW_C_HEAP_ARRAY(char, wb_path_len, mtInternal);
- strcpy(wb_path, get_meta_index_dir());
- strcat(wb_path, wb_jar);
- scp.add_suffix(wb_path);
- scp_assembly_required = true;
- FREE_C_HEAP_ARRAY(char, wb_path, mtInternal);
- }
-
// Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
if (result != JNI_OK) {
--- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java Tue Feb 19 18:45:49 2013 +0100
@@ -23,9 +23,10 @@
/*
* @test DeoptimizeAllTest
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeAllTest.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest
+ * @library /testlibrary /testlibrary/whitebox
+ * @build DeoptimizeAllTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest
* @author igor.ignatyev@oracle.com
*/
public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
--- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java Tue Feb 19 18:45:49 2013 +0100
@@ -23,9 +23,10 @@
/*
* @test DeoptimizeMethodTest
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeMethodTest.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest
+ * @library /testlibrary /testlibrary/whitebox
+ * @build DeoptimizeMethodTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest
* @author igor.ignatyev@oracle.com
*/
public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java Tue Feb 19 18:45:49 2013 +0100
@@ -24,9 +24,10 @@
/*
* @test IsMethodCompilableTest
* @bug 8007270
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI IsMethodCompilableTest.java
- * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest
+ * @library /testlibrary /testlibrary/whitebox
+ * @build IsMethodCompilableTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest
* @author igor.ignatyev@oracle.com
*/
public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java Tue Feb 19 18:45:49 2013 +0100
@@ -23,9 +23,10 @@
/*
* @test MakeMethodNotCompilableTest
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI MakeMethodNotCompilableTest.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest
+ * @library /testlibrary /testlibrary/whitebox
+ * @build MakeMethodNotCompilableTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest
* @author igor.ignatyev@oracle.com
*/
public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
--- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java Tue Feb 19 18:45:49 2013 +0100
@@ -23,9 +23,10 @@
/*
* @test SetDontInlineMethodTest
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
- * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SetDontInlineMethodTest.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest
+ * @library /testlibrary /testlibrary/whitebox
+ * @build SetDontInlineMethodTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest
* @author igor.ignatyev@oracle.com
*/
public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
--- a/hotspot/test/runtime/NMT/AllocTestType.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/runtime/NMT/AllocTestType.java Tue Feb 19 18:45:49 2013 +0100
@@ -25,9 +25,10 @@
* @test
* @summary Test consistency of NMT by leaking a few select allocations of the Test type and then verify visibility with jcmd
* @key nmt jcmd
- * @library /testlibrary
- * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI AllocTestType.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail AllocTestType
+ * @library /testlibrary /testlibrary/whitebox
+ * @build AllocTestType
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail AllocTestType
*/
import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/PrintNMTStatistics.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/runtime/NMT/PrintNMTStatistics.java Tue Feb 19 18:45:49 2013 +0100
@@ -26,8 +26,8 @@
* @key nmt regression
* @bug 8005936
* @summary Make sure PrintNMTStatistics works on normal JVM exit
- * @library /testlibrary
- * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI PrintNMTStatistics.java
+ * @library /testlibrary /testlibrary/whitebox
+ * @run compile PrintNMTStatistics.java
*/
import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/SummarySanityCheck.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/runtime/NMT/SummarySanityCheck.java Tue Feb 19 18:45:49 2013 +0100
@@ -25,9 +25,10 @@
* @test
* @key nmt jcmd
* @summary Sanity check the output of NMT
- * @library /testlibrary
- * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SummarySanityCheck.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck
+ * @library /testlibrary /testlibrary/whitebox
+ * @build SummarySanityCheck
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck
*/
import com.oracle.java.testlibrary.*;
--- a/hotspot/test/sanity/WBApi.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/sanity/WBApi.java Tue Feb 19 18:45:49 2013 +0100
@@ -1,8 +1,33 @@
+/*
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
/*
* @test WBApi
* @summary verify that whitebox functions can be linked and executed
- * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI WBApi.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi
+ * @library /testlibrary /testlibrary/whitebox
+ * @build WBApi
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi
*/
import sun.hotspot.WhiteBox;
--- a/hotspot/test/serviceability/ParserTest.java Tue Feb 19 13:33:39 2013 -0500
+++ b/hotspot/test/serviceability/ParserTest.java Tue Feb 19 18:45:49 2013 +0100
@@ -1,8 +1,33 @@
+/*
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
/*
* @test ParserTest
- * @summary verify that whitebox functions can be linked and executed
- * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI ParserTest.java
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest
+ * @summary Test that the diagnostic command arguemnt parser works
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ParserTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest
*/
import java.math.BigInteger;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/ClassFileInstaller.java Tue Feb 19 18:45:49 2013 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+/**
+ * Dump a class file for a class on the class path in the current directory
+ */
+public class ClassFileInstaller {
+ /**
+ * @param args The names of the classes to dump
+ * @throws Exception
+ */
+ public static void main(String... args) throws Exception {
+ for (String arg : args) {
+ ClassLoader cl = ClassFileInstaller.class.getClassLoader();
+
+ // Convert dotted class name to a path to a class file
+ String pathName = arg.replace('.', '/').concat(".class");
+ InputStream is = cl.getResourceAsStream(pathName);
+
+ // Create the class file's package directory
+ Path p = Paths.get(pathName);
+ Files.createDirectories(p.getParent());
+ // Create the class file
+ Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Tue Feb 19 18:45:49 2013 +0100
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.hotspot;
+
+import java.lang.reflect.Method;
+import java.security.BasicPermission;
+import sun.hotspot.parser.DiagnosticCommand;
+
+public class WhiteBox {
+
+ @SuppressWarnings("serial")
+ public static class WhiteBoxPermission extends BasicPermission {
+ public WhiteBoxPermission(String s) {
+ super(s);
+ }
+ }
+
+ private WhiteBox() {}
+ private static final WhiteBox instance = new WhiteBox();
+ private static native void registerNatives();
+
+ /**
+ * Returns the singleton WhiteBox instance.
+ *
+ * The returned WhiteBox object should be carefully guarded
+ * by the caller, since it can be used to read and write data
+ * at arbitrary memory addresses. It must never be passed to
+ * untrusted code.
+ */
+ public synchronized static WhiteBox getWhiteBox() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(new WhiteBoxPermission("getInstance"));
+ }
+ return instance;
+ }
+
+ static {
+ registerNatives();
+ }
+
+ // Memory
+ public native long getObjectAddress(Object o);
+ public native int getHeapOopSize();
+
+ // Runtime
+ // Make sure class name is in the correct format
+ public boolean isClassAlive(String name) {
+ return isClassAlive0(name.replace('.', '/'));
+ }
+ private native boolean isClassAlive0(String name);
+
+ // G1
+ public native boolean g1InConcurrentMark();
+ public native boolean g1IsHumongous(Object o);
+ public native long g1NumFreeRegions();
+ public native int g1RegionSize();
+ public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args);
+
+ // NMT
+ public native boolean NMTAllocTest();
+ public native boolean NMTFreeTestMemory();
+ public native boolean NMTWaitForDataMerge();
+
+ // Compiler
+ public native void deoptimizeAll();
+ public native boolean isMethodCompiled(Method method);
+ public native boolean isMethodCompilable(Method method);
+ public native boolean isMethodQueuedForCompilation(Method method);
+ public native int deoptimizeMethod(Method method);
+ public native void makeMethodNotCompilable(Method method);
+ public native int getMethodCompilationLevel(Method method);
+ public native boolean setDontInlineMethod(Method method, boolean value);
+ public native int getCompileQueuesSize();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java Tue Feb 19 18:45:49 2013 +0100
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.hotspot.parser;
+
+public class DiagnosticCommand {
+
+ public enum DiagnosticArgumentType {
+ JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE
+ }
+
+ private String name;
+ private String desc;
+ private DiagnosticArgumentType type;
+ private boolean mandatory;
+ private String defaultValue;
+
+ public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
+ boolean mandatory, String defaultValue) {
+ this.name = name;
+ this.desc = desc;
+ this.type = type;
+ this.mandatory = mandatory;
+ this.defaultValue = defaultValue;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ public DiagnosticArgumentType getType() {
+ return type;
+ }
+
+ public boolean isMandatory() {
+ return mandatory;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+}