aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramurillo <none@none>2012-03-09 13:08:18 -0800
committeramurillo <none@none>2012-03-09 13:08:18 -0800
commit6812fc285686b35363ab10f84a257ea7059d4875 (patch)
tree37c0651ca09ba78f752e436b9b4b3b8d4bcdc1d6
parent2cb56c30204e7ea2a0f0673e71969bb1da83316d (diff)
parentacb36bf58f5bdb5905a1b721b343338926f3c292 (diff)
-rw-r--r--make/Makefile3
-rw-r--r--make/bsd/makefiles/defs.make2
-rw-r--r--make/bsd/makefiles/vm.make9
-rw-r--r--make/bsd/makefiles/wb.make46
-rw-r--r--make/hotspot_version2
-rw-r--r--make/jprt.properties46
-rw-r--r--make/linux/makefiles/defs.make4
-rw-r--r--make/linux/makefiles/vm.make7
-rw-r--r--make/linux/makefiles/wb.make46
-rw-r--r--make/solaris/makefiles/defs.make4
-rw-r--r--make/solaris/makefiles/vm.make7
-rw-r--r--make/solaris/makefiles/wb.make46
-rw-r--r--make/windows/makefiles/debug.make5
-rw-r--r--make/windows/makefiles/defs.make4
-rw-r--r--make/windows/makefiles/fastdebug.make5
-rw-r--r--make/windows/makefiles/product.make5
-rw-r--r--make/windows/makefiles/wb.make54
-rw-r--r--src/cpu/sparc/vm/assembler_sparc.hpp2
-rw-r--r--src/cpu/sparc/vm/cppInterpreter_sparc.cpp2
-rw-r--r--src/cpu/sparc/vm/sharedRuntime_sparc.cpp4
-rw-r--r--src/cpu/sparc/vm/templateInterpreter_sparc.cpp4
-rw-r--r--src/share/tools/whitebox/sun/hotspot/WhiteBox.java70
-rw-r--r--src/share/vm/c1/c1_GraphBuilder.cpp2
-rw-r--r--src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp21
-rw-r--r--src/share/vm/opto/compile.hpp2
-rw-r--r--src/share/vm/opto/doCall.cpp21
-rw-r--r--src/share/vm/opto/library_call.cpp32
-rw-r--r--src/share/vm/prims/jvmtiClassFileReconstituter.cpp7
-rw-r--r--src/share/vm/prims/nativeLookup.cpp4
-rw-r--r--src/share/vm/prims/whitebox.cpp114
-rw-r--r--src/share/vm/prims/whitebox.hpp36
-rw-r--r--src/share/vm/runtime/arguments.cpp13
-rw-r--r--src/share/vm/runtime/globals.hpp5
-rw-r--r--src/share/vm/runtime/safepoint.cpp21
-rw-r--r--src/share/vm/runtime/thread.cpp4
-rw-r--r--src/share/vm/runtime/thread.hpp9
-rw-r--r--src/share/vm/utilities/vmError.cpp8
-rw-r--r--test/Makefile20
-rw-r--r--test/sanity/WBApi.java13
39 files changed, 632 insertions, 77 deletions
diff --git a/make/Makefile b/make/Makefile
index 8bebef469..d9f690aca 100644
--- a/make/Makefile
+++ b/make/Makefile
@@ -378,6 +378,9 @@ endif
$(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)
diff --git a/make/bsd/makefiles/defs.make b/make/bsd/makefiles/defs.make
index 7048970bc..dcc7cfe6c 100644
--- a/make/bsd/makefiles/defs.make
+++ b/make/bsd/makefiles/defs.make
@@ -144,6 +144,8 @@ EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
+EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
+
ifndef BUILD_CLIENT_ONLY
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
diff --git a/make/bsd/makefiles/vm.make b/make/bsd/makefiles/vm.make
index 0124422fa..7c4964637 100644
--- a/make/bsd/makefiles/vm.make
+++ b/make/bsd/makefiles/vm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -335,6 +335,9 @@ include $(MAKEFILES_DIR)/jsig.make
# Serviceability agent
include $(MAKEFILES_DIR)/saproc.make
+# Whitebox testing API
+include $(MAKEFILES_DIR)/wb.make
+
#----------------------------------------------------------------------
ifeq ($(OS_VENDOR), Darwin)
@@ -342,10 +345,10 @@ $(LIBJVM).dSYM: $(LIBJVM)
dsymutil $(LIBJVM)
# no libjvm_db for macosx
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM $(WB_JAR)
echo "Doing vm.make build:"
else
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
endif
install: install_jvm install_jsig install_saproc
diff --git a/make/bsd/makefiles/wb.make b/make/bsd/makefiles/wb.make
new file mode 100644
index 000000000..2ec216e6f
--- /dev/null
+++ b/make/bsd/makefiles/wb.make
@@ -0,0 +1,46 @@
+#
+# 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) -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 $@
+
diff --git a/make/hotspot_version b/make/hotspot_version
index 6cc9716c9..534e270f7 100644
--- a/make/hotspot_version
+++ b/make/hotspot_version
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
HS_MAJOR_VER=24
HS_MINOR_VER=0
-HS_BUILD_NUMBER=02
+HS_BUILD_NUMBER=03
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
diff --git a/make/jprt.properties b/make/jprt.properties
index 338f6d261..0e009220d 100644
--- a/make/jprt.properties
+++ b/make/jprt.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -54,58 +54,72 @@ jprt.sync.push=false
# Define the Solaris platforms we want for the various releases
jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10
jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10
+jprt.my.solaris.sparc.jdk7u4=${jprt.my.solaris.sparc.jdk7}
jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}}
jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10
jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10
+jprt.my.solaris.sparcv9.jdk7u4=${jprt.my.solaris.sparcv9.jdk7}
jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}}
jprt.my.solaris.i586.jdk8=solaris_i586_5.10
jprt.my.solaris.i586.jdk7=solaris_i586_5.10
+jprt.my.solaris.i586.jdk7u4=${jprt.my.solaris.i586.jdk7}
jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}}
jprt.my.solaris.x64.jdk8=solaris_x64_5.10
jprt.my.solaris.x64.jdk7=solaris_x64_5.10
+jprt.my.solaris.x64.jdk7u4=${jprt.my.solaris.x64.jdk7}
jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
jprt.my.linux.i586.jdk8=linux_i586_2.6
jprt.my.linux.i586.jdk7=linux_i586_2.6
+jprt.my.linux.i586.jdk7u4=${jprt.my.linux.i586.jdk7}
jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
jprt.my.linux.x64.jdk8=linux_x64_2.6
jprt.my.linux.x64.jdk7=linux_x64_2.6
+jprt.my.linux.x64.jdk7u4=${jprt.my.linux.x64.jdk7}
jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
jprt.my.linux.ppc.jdk8=linux_ppc_2.6
jprt.my.linux.ppc.jdk7=linux_ppc_2.6
+jprt.my.linux.ppc.jdk7u4=${jprt.my.linux.ppc.jdk7}
jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}}
jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6
jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6
+jprt.my.linux.ppcv2.jdk7u4=${jprt.my.linux.ppcv2.jdk7}
jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}}
jprt.my.linux.ppcsflt.jdk8=linux_ppcsflt_2.6
jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt.jdk7u4=${jprt.my.linux.ppcsflt.jdk7}
jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}}
jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6
jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6
+jprt.my.linux.armvfp.jdk7u4=${jprt.my.linux.armvfp.jdk7}
jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}}
jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6
jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6
+jprt.my.linux.armsflt.jdk7u4=${jprt.my.linux.armsflt.jdk7}
jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}}
jprt.my.macosx.x64.jdk8=macosx_x64_10.7
jprt.my.macosx.x64.jdk7=macosx_x64_10.7
+jprt.my.macosx.x64.jdk7u4=${jprt.my.macosx.x64.jdk7}
jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}}
jprt.my.windows.i586.jdk8=windows_i586_5.1
jprt.my.windows.i586.jdk7=windows_i586_5.1
+jprt.my.windows.i586.jdk7u4=${jprt.my.windows.i586.jdk7}
jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
jprt.my.windows.x64.jdk8=windows_x64_5.2
jprt.my.windows.x64.jdk7=windows_x64_5.2
+jprt.my.windows.x64.jdk7u4=${jprt.my.windows.x64.jdk7}
jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
# Standard list of jprt build targets for this source tree
@@ -139,16 +153,7 @@ jprt.build.targets.all=${jprt.build.targets.standard}, \
jprt.build.targets.jdk8=${jprt.build.targets.all}
jprt.build.targets.jdk7=${jprt.build.targets.all}
-jprt.build.targets.jdk7temp=${jprt.build.targets.all}
-jprt.build.targets.jdk7b107=${jprt.build.targets.all}
-jprt.build.targets.jdk6=${jprt.build.targets.standard}
-jprt.build.targets.jdk6perf=${jprt.build.targets.standard}
-jprt.build.targets.jdk6u10=${jprt.build.targets.standard}
-jprt.build.targets.jdk6u14=${jprt.build.targets.standard}
-jprt.build.targets.jdk6u18=${jprt.build.targets.standard}
-jprt.build.targets.jdk6u20=${jprt.build.targets.standard}
-jprt.build.targets.ejdk6=${jprt.build.targets.all}
-jprt.build.targets.ejdk7=${jprt.build.targets.all}
+jprt.build.targets.jdk7u4=${jprt.build.targets.all}
jprt.build.targets=${jprt.build.targets.${jprt.tools.default.release}}
# Subset lists of test targets for this source tree
@@ -474,11 +479,26 @@ jprt.make.rule.test.targets.standard.internalvmtests = \
${jprt.my.macosx.x64}-fastdebug-c2-internalvmtests, \
${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \
${jprt.my.windows.x64}-fastdebug-c2-internalvmtests
-
+
+jprt.make.rule.test.targets.standard.wbapi = \
+ ${jprt.my.solaris.sparc}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.solaris.i586}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.solaris.sparc}-{product|fastdebug}-c1-wbapitest, \
+ ${jprt.my.solaris.i586}-{product|fastdebug}-c1-wbapitest, \
+ ${jprt.my.linux.i586}-{product|fastdebug}-c1-wbapitest, \
+ ${jprt.my.windows.i586}-{product|fastdebug}-c1-wbapitest
+
jprt.make.rule.test.targets.standard = \
${jprt.make.rule.test.targets.standard.client}, \
${jprt.make.rule.test.targets.standard.server}, \
- ${jprt.make.rule.test.targets.standard.internalvmtests}
+ ${jprt.make.rule.test.targets.standard.internalvmtests}, \
+ ${jprt.make.rule.test.targets.standard.wbapi}
jprt.make.rule.test.targets.embedded = \
${jprt.make.rule.test.targets.standard.client}
diff --git a/make/linux/makefiles/defs.make b/make/linux/makefiles/defs.make
index df5b8e4fa..ea3f8a6a0 100644
--- a/make/linux/makefiles/defs.make
+++ b/make/linux/makefiles/defs.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -193,6 +193,8 @@ endif
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
+EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
+
ifndef BUILD_CLIENT_ONLY
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
diff --git a/make/linux/makefiles/vm.make b/make/linux/makefiles/vm.make
index 462f2789b..2c2f40160 100644
--- a/make/linux/makefiles/vm.make
+++ b/make/linux/makefiles/vm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -368,9 +368,12 @@ include $(MAKEFILES_DIR)/jsig.make
# Serviceability agent
include $(MAKEFILES_DIR)/saproc.make
+# Whitebox testing API
+include $(MAKEFILES_DIR)/wb.make
+
#----------------------------------------------------------------------
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
install: install_jvm install_jsig install_saproc
diff --git a/make/linux/makefiles/wb.make b/make/linux/makefiles/wb.make
new file mode 100644
index 000000000..2ec216e6f
--- /dev/null
+++ b/make/linux/makefiles/wb.make
@@ -0,0 +1,46 @@
+#
+# 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) -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 $@
+
diff --git a/make/solaris/makefiles/defs.make b/make/solaris/makefiles/defs.make
index f4b6ea379..6c5fb8b0b 100644
--- a/make/solaris/makefiles/defs.make
+++ b/make/solaris/makefiles/defs.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -148,6 +148,8 @@ ifneq ($(OBJCOPY),)
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
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
diff --git a/make/solaris/makefiles/vm.make b/make/solaris/makefiles/vm.make
index 9cb81062f..6a104512a 100644
--- a/make/solaris/makefiles/vm.make
+++ b/make/solaris/makefiles/vm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 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
@@ -321,9 +321,12 @@ include $(MAKEFILES_DIR)/jsig.make
# 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
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
install: install_jvm install_jsig install_saproc
diff --git a/make/solaris/makefiles/wb.make b/make/solaris/makefiles/wb.make
new file mode 100644
index 000000000..225978df4
--- /dev/null
+++ b/make/solaris/makefiles/wb.make
@@ -0,0 +1,46 @@
+#
+# 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) -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 $@
+
diff --git a/make/windows/makefiles/debug.make b/make/windows/makefiles/debug.make
index 510bb9e9d..8e91bc40d 100644
--- a/make/windows/makefiles/debug.make
+++ b/make/windows/makefiles/debug.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -33,7 +33,7 @@ GENERATED=../generated
BUILD_PCH_FILE=_build_pch_file.obj
!endif
-default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
+default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
!include ../local.make
!include compile.make
@@ -65,3 +65,4 @@ $(AOUT): $(Res_Files) $(Obj_Files) vm.def
!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
diff --git a/make/windows/makefiles/defs.make b/make/windows/makefiles/defs.make
index 993799e37..5938ef255 100644
--- a/make/windows/makefiles/defs.make
+++ b/make/windows/makefiles/defs.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -194,6 +194,8 @@ ifeq ($(ARCH_DATA_MODEL), 32)
EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.map
endif
+EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
+
ifeq ($(BUILD_WIN_SA), 1)
EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX)
EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.pdb
diff --git a/make/windows/makefiles/fastdebug.make b/make/windows/makefiles/fastdebug.make
index 3895ecd78..d7d2cf0fb 100644
--- a/make/windows/makefiles/fastdebug.make
+++ b/make/windows/makefiles/fastdebug.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -33,7 +33,7 @@ GENERATED=../generated
BUILD_PCH_FILE=_build_pch_file.obj
!endif
-default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
+default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
!include ../local.make
!include compile.make
@@ -65,3 +65,4 @@ $(AOUT): $(Res_Files) $(Obj_Files) vm.def
!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
diff --git a/make/windows/makefiles/product.make b/make/windows/makefiles/product.make
index ebbd53832..4799c7a07 100644
--- a/make/windows/makefiles/product.make
+++ b/make/windows/makefiles/product.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -32,7 +32,7 @@ GENERATED=../generated
BUILD_PCH_FILE=_build_pch_file.obj
!endif
-default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA
+default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
!include ../local.make
!include compile.make
@@ -76,3 +76,4 @@ $(AOUT): $(Res_Files) $(Obj_Files) vm.def
!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
diff --git a/make/windows/makefiles/wb.make b/make/windows/makefiles/wb.make
new file mode 100644
index 000000000..b0add7227
--- /dev/null
+++ b/make/windows/makefiles/wb.make
@@ -0,0 +1,54 @@
+#
+# 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) -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)
+
diff --git a/src/cpu/sparc/vm/assembler_sparc.hpp b/src/cpu/sparc/vm/assembler_sparc.hpp
index 04f8a9810..d3437ce6a 100644
--- a/src/cpu/sparc/vm/assembler_sparc.hpp
+++ b/src/cpu/sparc/vm/assembler_sparc.hpp
@@ -2221,7 +2221,7 @@ public:
// traps as per trap.h (SPARC ABI?)
void breakpoint_trap();
- void breakpoint_trap(Condition c, CC cc = icc);
+ void breakpoint_trap(Condition c, CC cc);
void flush_windows_trap();
void clean_windows_trap();
void get_psr_trap();
diff --git a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
index f402d622f..f85d4e331 100644
--- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
+++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
@@ -1187,7 +1187,7 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
#ifdef ASSERT
__ tst(O1);
- __ breakpoint_trap(Assembler::zero);
+ __ breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
#endif // ASSERT
const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
diff --git a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
index f82066e4b..bc9371653 100644
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
@@ -3325,7 +3325,7 @@ static void gen_new_frame(MacroAssembler* masm, bool deopt) {
// make sure that the frames are aligned properly
#ifndef _LP64
__ btst(wordSize*2-1, SP);
- __ breakpoint_trap(Assembler::notZero);
+ __ breakpoint_trap(Assembler::notZero, Assembler::ptr_cc);
#endif
#endif
@@ -3407,7 +3407,7 @@ static void make_new_frames(MacroAssembler* masm, bool deopt) {
#ifdef ASSERT
// make sure that there is at least one entry in the array
__ tst(O4array_size);
- __ breakpoint_trap(Assembler::zero);
+ __ breakpoint_trap(Assembler::zero, Assembler::icc);
#endif
// Now push the new interpreter frames
diff --git a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
index ceb6a5994..98028af0e 100644
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
@@ -379,7 +379,7 @@ void InterpreterGenerator::lock_method(void) {
#ifdef ASSERT
__ tst(O0);
- __ breakpoint_trap(Assembler::zero);
+ __ breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
#endif // ASSERT
__ bind(done);
@@ -2050,7 +2050,7 @@ void TemplateInterpreterGenerator::stop_interpreter_at() {
AddressLiteral stop_at(&StopInterpreterAt);
__ load_ptr_contents(stop_at, G4_scratch);
__ cmp(G3_scratch, G4_scratch);
- __ breakpoint_trap(Assembler::equal);
+ __ breakpoint_trap(Assembler::equal, Assembler::icc);
}
#endif // not PRODUCT
#endif // !CC_INTERP
diff --git a/src/share/tools/whitebox/sun/hotspot/WhiteBox.java b/src/share/tools/whitebox/sun/hotspot/WhiteBox.java
new file mode 100644
index 000000000..ee6a18d50
--- /dev/null
+++ b/src/share/tools/whitebox/sun/hotspot/WhiteBox.java
@@ -0,0 +1,70 @@
+/*
+ * 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.security.BasicPermission;
+
+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();
+
+ // G1
+ public native boolean g1InConcurrentMark();
+ public native boolean g1IsHumongous(Object o);
+ public native long g1NumFreeRegions();
+ public native int g1RegionSize();
+}
diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp
index a59ae10dd..b4659d972 100644
--- a/src/share/vm/c1/c1_GraphBuilder.cpp
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp
@@ -1306,6 +1306,7 @@ void GraphBuilder::table_switch() {
if (sw.dest_offset_at(i) < 0) has_bb = true;
}
// add default successor
+ if (sw.default_offset() < 0) has_bb = true;
sux->at_put(i, block_at(bci() + sw.default_offset()));
ValueStack* state_before = has_bb ? copy_state_before() : NULL;
Instruction* res = append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb));
@@ -1350,6 +1351,7 @@ void GraphBuilder::lookup_switch() {
keys->at_put(i, pair.match());
}
// add default successor
+ if (sw.default_offset() < 0) has_bb = true;
sux->at_put(i, block_at(bci() + sw.default_offset()));
ValueStack* state_before = has_bb ? copy_state_before() : NULL;
Instruction* res = append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb));
diff --git a/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp b/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp
index d22dc7a35..34542618f 100644
--- a/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp
+++ b/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -44,7 +44,9 @@ G1YoungGenerationCounters::G1YoungGenerationCounters(G1MonitoringSupport* g1mm,
G1MonitoringSupport::pad_capacity(0, 3) /* min_capacity */,
G1MonitoringSupport::pad_capacity(g1mm->young_gen_max(), 3),
G1MonitoringSupport::pad_capacity(0, 3) /* curr_capacity */) {
- update_all();
+ if (UsePerfData) {
+ update_all();
+ }
}
G1OldGenerationCounters::G1OldGenerationCounters(G1MonitoringSupport* g1mm,
@@ -53,7 +55,9 @@ G1OldGenerationCounters::G1OldGenerationCounters(G1MonitoringSupport* g1mm,
G1MonitoringSupport::pad_capacity(0) /* min_capacity */,
G1MonitoringSupport::pad_capacity(g1mm->old_gen_max()),
G1MonitoringSupport::pad_capacity(0) /* curr_capacity */) {
- update_all();
+ if (UsePerfData) {
+ update_all();
+ }
}
void G1YoungGenerationCounters::update_all() {
@@ -149,10 +153,6 @@ G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h) :
pad_capacity(0) /* max_capacity */,
pad_capacity(0) /* init_capacity */,
_young_collection_counters);
- // Given that this survivor space is not used, we update it here
- // once to reflect that its used space is 0 so that we don't have to
- // worry about updating it again later.
- _from_counters->update_used(0);
// name "generation.0.space.2"
// See _old_space_counters for additional counters
@@ -160,6 +160,13 @@ G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h) :
pad_capacity(overall_reserved()) /* max_capacity */,
pad_capacity(survivor_space_committed()) /* init_capacity */,
_young_collection_counters);
+
+ if (UsePerfData) {
+ // Given that this survivor space is not used, we update it here
+ // once to reflect that its used space is 0 so that we don't have to
+ // worry about updating it again later.
+ _from_counters->update_used(0);
+ }
}
void G1MonitoringSupport::recalculate_sizes() {
diff --git a/src/share/vm/opto/compile.hpp b/src/share/vm/opto/compile.hpp
index 8254aabca..5e85802f9 100644
--- a/src/share/vm/opto/compile.hpp
+++ b/src/share/vm/opto/compile.hpp
@@ -631,7 +631,7 @@ class Compile : public Phase {
// Decide how to build a call.
// The profile factor is a discount to apply to this site's interp. profile.
- CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor);
+ CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true);
bool should_delay_inlining(ciMethod* call_method, JVMState* jvms);
// Report if there were too many traps at a current method and bci.
diff --git a/src/share/vm/opto/doCall.cpp b/src/share/vm/opto/doCall.cpp
index 9ff9a89f3..fdbbc108b 100644
--- a/src/share/vm/opto/doCall.cpp
+++ b/src/share/vm/opto/doCall.cpp
@@ -61,7 +61,7 @@ void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_met
CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual,
JVMState* jvms, bool allow_inline,
- float prof_factor) {
+ float prof_factor, bool allow_intrinsics) {
ciMethod* caller = jvms->method();
int bci = jvms->bci();
Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
@@ -108,7 +108,7 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
// then we return it as the inlined version of the call.
// We do this before the strict f.p. check below because the
// intrinsics handle strict f.p. correctly.
- if (allow_inline) {
+ if (allow_inline && allow_intrinsics) {
CallGenerator* cg = find_intrinsic(call_method, call_is_virtual);
if (cg != NULL) return cg;
}
@@ -455,21 +455,12 @@ void Parse::do_call() {
// cg->generate(), we are committed. If it fails, the whole
// compilation task is compromised.
if (failing()) return;
-#ifndef PRODUCT
- if (PrintOpto || PrintOptoInlining || PrintInlining) {
- // Only one fall-back, so if an intrinsic fails, ignore any bytecodes.
- if (cg->is_intrinsic() && call_method->code_size() > 0) {
- tty->print("Bailed out of intrinsic, will not inline: ");
- call_method->print_name(); tty->cr();
- }
- }
-#endif
+
// This can happen if a library intrinsic is available, but refuses
// the call site, perhaps because it did not match a pattern the
- // intrinsic was expecting to optimize. The fallback position is
- // to call out-of-line.
- try_inline = false; // Inline tactic bailed out.
- cg = C->call_generator(call_method, vtable_index, call_is_virtual, jvms, try_inline, prof_factor());
+ // intrinsic was expecting to optimize. Should always be possible to
+ // get a normal java call that may inline in that case
+ cg = C->call_generator(call_method, vtable_index, call_is_virtual, jvms, try_inline, prof_factor(), /* allow_intrinsics= */ false);
if ((new_jvms = cg->generate(jvms)) == NULL) {
guarantee(failing(), "call failed to generate: calls should work");
return;
diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp
index 2940e59f1..90465d5ff 100644
--- a/src/share/vm/opto/library_call.cpp
+++ b/src/share/vm/opto/library_call.cpp
@@ -338,8 +338,27 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
break;
case vmIntrinsics::_bitCount_i:
+ if (!Matcher::has_match_rule(Op_PopCountI)) return NULL;
+ break;
+
case vmIntrinsics::_bitCount_l:
- if (!UsePopCountInstruction) return NULL;
+ if (!Matcher::has_match_rule(Op_PopCountL)) return NULL;
+ break;
+
+ case vmIntrinsics::_numberOfLeadingZeros_i:
+ if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return NULL;
+ break;
+
+ case vmIntrinsics::_numberOfLeadingZeros_l:
+ if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return NULL;
+ break;
+
+ case vmIntrinsics::_numberOfTrailingZeros_i:
+ if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return NULL;
+ break;
+
+ case vmIntrinsics::_numberOfTrailingZeros_l:
+ if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return NULL;
break;
case vmIntrinsics::_Reference_get:
@@ -416,14 +435,12 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
return kit.transfer_exceptions_into_jvms();
}
- if (PrintIntrinsics) {
+ // The intrinsic bailed out
+ if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
if (jvms->has_method()) {
// Not a root compile.
- tty->print("Did not inline intrinsic %s%s at bci:%d in",
- vmIntrinsics::name_at(intrinsic_id()),
- (is_virtual() ? " (virtual)" : ""), kit.bci());
- kit.caller()->print_short_name(tty);
- tty->print_cr(" (%d bytes)", kit.caller()->code_size());
+ const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
+ CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), msg);
} else {
// Root compile
tty->print("Did not generate intrinsic %s%s at bci:%d in",
@@ -5453,4 +5470,3 @@ bool LibraryCallKit::inline_reference_get() {
push(result);
return true;
}
-
diff --git a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
index 7e2a327ec..af576eb28 100644
--- a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
+++ b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -727,8 +727,11 @@ void JvmtiClassFileReconstituter::copy_bytecodes(methodHandle mh,
case Bytecodes::_invokestatic : // fall through
case Bytecodes::_invokedynamic : // fall through
case Bytecodes::_invokeinterface :
- assert(len == 3 || (code == Bytecodes::_invokeinterface && len ==5),
+ assert(len == 3 ||
+ (code == Bytecodes::_invokeinterface && len == 5) ||
+ (code == Bytecodes::_invokedynamic && len == 5),
"sanity check");
+
int cpci = Bytes::get_native_u2(bcp+1);
bool is_invokedynamic = (EnableInvokeDynamic && code == Bytecodes::_invokedynamic);
if (is_invokedynamic)
diff --git a/src/share/vm/prims/nativeLookup.cpp b/src/share/vm/prims/nativeLookup.cpp
index f8c627dcb..41fc42da3 100644
--- a/src/share/vm/prims/nativeLookup.cpp
+++ b/src/share/vm/prims/nativeLookup.cpp
@@ -121,6 +121,7 @@ extern "C" {
void JNICALL JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls);
void JNICALL JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass unsafecls);
void JNICALL JVM_RegisterPerfMethods(JNIEnv *env, jclass perfclass);
+ void JNICALL JVM_RegisterWhiteBoxMethods(JNIEnv *env, jclass wbclass);
}
#define CC (char*) /* cast a literal from (const char*) */
@@ -133,7 +134,8 @@ static JNINativeMethod lookup_special_native_methods[] = {
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
- { CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) }
+ { CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
+ { CC"Java_sun_hotspot_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) },
};
static address lookup_special_native(char* jni_name) {
diff --git a/src/share/vm/prims/whitebox.cpp b/src/share/vm/prims/whitebox.cpp
new file mode 100644
index 000000000..86dd7c506
--- /dev/null
+++ b/src/share/vm/prims/whitebox.cpp
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#include "jni.h"
+
+#include "memory/universe.hpp"
+#include "oops/oop.inline.hpp"
+#include "prims/whitebox.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/os.hpp"
+#include "utilities/debug.hpp"
+
+#ifndef SERIALGC
+#include "gc_implementation/g1/concurrentMark.hpp"
+#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+#include "gc_implementation/g1/heapRegionRemSet.hpp"
+#endif // !SERIALGC
+
+bool WhiteBox::_used = false;
+
+// Entry macro to transition from JNI to VM state.
+
+#define WB_ENTRY(result_type, header) JNI_ENTRY(result_type, header)
+#define WB_END JNI_END
+
+// Definitions of functions exposed via Whitebox API
+
+WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
+ return (jlong)(void*)JNIHandles::resolve(obj);
+WB_END
+
+WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
+ return heapOopSize;
+WB_END
+
+#ifndef SERIALGC
+WB_ENTRY(jboolean, WB_G1IsHumongous(JNIEnv* env, jobject o, jobject obj))
+ G1CollectedHeap* g1 = G1CollectedHeap::heap();
+ oop result = JNIHandles::resolve(obj);
+ const HeapRegion* hr = g1->heap_region_containing(result);
+ return hr->isHumongous();
+WB_END
+
+WB_ENTRY(jlong, WB_G1NumFreeRegions(JNIEnv* env, jobject o))
+ G1CollectedHeap* g1 = G1CollectedHeap::heap();
+ size_t nr = g1->free_regions();
+ return (jlong)nr;
+WB_END
+
+WB_ENTRY(jboolean, WB_G1InConcurrentMark(JNIEnv* env, jobject o))
+ G1CollectedHeap* g1 = G1CollectedHeap::heap();
+ ConcurrentMark* cm = g1->concurrent_mark();
+ return cm->concurrent_marking_in_progress();
+WB_END
+
+WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
+ return (jint)HeapRegion::GrainBytes;
+WB_END
+#endif // !SERIALGC
+
+#define CC (char*)
+
+static JNINativeMethod methods[] = {
+ {CC"getObjectAddress", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress },
+ {CC"getHeapOopSize", CC"()I", (void*)&WB_GetHeapOopSize },
+#ifndef SERIALGC
+ {CC"g1InConcurrentMark", CC"()Z", (void*)&WB_G1InConcurrentMark},
+ {CC"g1IsHumongous", CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous },
+ {CC"g1NumFreeRegions", CC"()J", (void*)&WB_G1NumFreeRegions },
+ {CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize },
+#endif // !SERIALGC
+};
+
+#undef CC
+
+JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
+ {
+ if (WhiteBoxAPI) {
+ // Make sure that wbclass is loaded by the null classloader
+ instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
+ Handle loader(ikh->class_loader());
+ if (loader.is_null()) {
+ ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
+ jint result = env->RegisterNatives(wbclass, methods, sizeof(methods)/sizeof(methods[0]));
+ if (result == 0) {
+ WhiteBox::set_used();
+ }
+ }
+ }
+ }
+JVM_END
diff --git a/src/share/vm/prims/whitebox.hpp b/src/share/vm/prims/whitebox.hpp
new file mode 100644
index 000000000..53adc6874
--- /dev/null
+++ b/src/share/vm/prims/whitebox.hpp
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_PRIMS_WHITEBOX_HPP
+#define SHARE_VM_PRIMS_WHITEBOX_HPP
+
+class WhiteBox : public AllStatic {
+ private:
+ static bool _used;
+ public:
+ static bool used() { return _used; }
+ static void set_used() { _used = true; }
+};
+
+#endif // SHARE_VM_PRIMS_WHITEBOX_HPP
diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp
index 366d9fd50..5740794db 100644
--- a/src/share/vm/runtime/arguments.cpp
+++ b/src/share/vm/runtime/arguments.cpp
@@ -2050,6 +2050,19 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) {
FREE_C_HEAP_ARRAY(char, altclasses_path);
}
+ 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);
+ 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);
+ }
+
// Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
if (result != JNI_OK) {
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
index 3245be58e..484442a7f 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -3896,7 +3896,10 @@ class CommandLineFlags {
product(bool, UseVMInterruptibleIO, false, \
"(Unstable, Solaris-specific) Thread interrupt before or with " \
"EINTR for I/O operations results in OS_INTRPT. The default value"\
- " of this flag is true for JDK 6 and earlier")
+ " of this flag is true for JDK 6 and earlier") \
+ \
+ diagnostic(bool, WhiteBoxAPI, false, \
+ "Enable internal testing APIs")
/*
* Macros for factoring of globals
diff --git a/src/share/vm/runtime/safepoint.cpp b/src/share/vm/runtime/safepoint.cpp
index b7910d680..514e7c976 100644
--- a/src/share/vm/runtime/safepoint.cpp
+++ b/src/share/vm/runtime/safepoint.cpp
@@ -219,6 +219,8 @@ void SafepointSynchronize::begin() {
#ifdef ASSERT
for (JavaThread *cur = Threads::first(); cur != NULL; cur = cur->next()) {
assert(cur->safepoint_state()->is_running(), "Illegal initial state");
+ // Clear the visited flag to ensure that the critical counts are collected properly.
+ cur->set_visited_for_critical_count(false);
}
#endif // ASSERT
@@ -378,6 +380,13 @@ void SafepointSynchronize::begin() {
OrderAccess::fence();
+#ifdef ASSERT
+ for (JavaThread *cur = Threads::first(); cur != NULL; cur = cur->next()) {
+ // make sure all the threads were visited
+ assert(cur->was_visited_for_critical_count(), "missed a thread");
+ }
+#endif // ASSERT
+
// Update the count of active JNI critical regions
GC_locker::set_jni_lock_count(_current_jni_active_count);
@@ -626,6 +635,7 @@ void SafepointSynchronize::block(JavaThread *thread) {
_waiting_to_block--;
thread->safepoint_state()->set_has_called_back(true);
+ DEBUG_ONLY(thread->set_visited_for_critical_count(true));
if (thread->in_critical()) {
// Notice that this thread is in a critical section
increment_jni_active_count();
@@ -907,12 +917,8 @@ void ThreadSafepointState::examine_state_of_thread() {
// running, but are actually at a safepoint. We will happily
// agree and update the safepoint state here.
if (SafepointSynchronize::safepoint_safe(_thread, state)) {
- roll_forward(_at_safepoint);
SafepointSynchronize::check_for_lazy_critical_native(_thread, state);
- if (_thread->in_critical()) {
- // Notice that this thread is in a critical section
- SafepointSynchronize::increment_jni_active_count();
- }
+ roll_forward(_at_safepoint);
return;
}
@@ -937,6 +943,11 @@ void ThreadSafepointState::roll_forward(suspend_type type) {
switch(_type) {
case _at_safepoint:
SafepointSynchronize::signal_thread_at_safepoint();
+ DEBUG_ONLY(_thread->set_visited_for_critical_count(true));
+ if (_thread->in_critical()) {
+ // Notice that this thread is in a critical section
+ SafepointSynchronize::increment_jni_active_count();
+ }
break;
case _call_back:
diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp
index 4fd26f9f8..767668289 100644
--- a/src/share/vm/runtime/thread.cpp
+++ b/src/share/vm/runtime/thread.cpp
@@ -247,6 +247,10 @@ Thread::Thread() {
omInUseList = NULL ;
omInUseCount = 0 ;
+#ifdef ASSERT
+ _visited_for_critical_count = false;
+#endif
+
_SR_lock = new Monitor(Mutex::suspend_resume, "SR_lock", true);
_suspend_flags = 0;
diff --git a/src/share/vm/runtime/thread.hpp b/src/share/vm/runtime/thread.hpp
index 459326375..7846cc070 100644
--- a/src/share/vm/runtime/thread.hpp
+++ b/src/share/vm/runtime/thread.hpp
@@ -268,6 +268,15 @@ class Thread: public ThreadShadow {
ObjectMonitor* omInUseList; // SLL to track monitors in circulation
int omInUseCount; // length of omInUseList
+#ifdef ASSERT
+ private:
+ bool _visited_for_critical_count;
+
+ public:
+ void set_visited_for_critical_count(bool z) { _visited_for_critical_count = z; }
+ bool was_visited_for_critical_count() const { return _visited_for_critical_count; }
+#endif
+
public:
enum {
is_definitely_current_thread = true
diff --git a/src/share/vm/utilities/vmError.cpp b/src/share/vm/utilities/vmError.cpp
index 2b4253257..3c6e1ca32 100644
--- a/src/share/vm/utilities/vmError.cpp
+++ b/src/share/vm/utilities/vmError.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "compiler/compileBroker.hpp"
#include "gc_interface/collectedHeap.hpp"
+#include "prims/whitebox.hpp"
#include "runtime/arguments.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/init.hpp"
@@ -717,6 +718,13 @@ void VMError::report(outputStream* st) {
st->cr();
}
+ STEP(215, "(printing warning if internal testing API used)" )
+
+ if (WhiteBox::used()) {
+ st->print_cr("Unsupported internal testing APIs have been used.");
+ st->cr();
+ }
+
STEP(220, "(printing environment variables)" )
if (_verbose) {
diff --git a/test/Makefile b/test/Makefile
index f5365929b..b50de91fd 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 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
@@ -228,6 +228,24 @@ PHONY_LIST += internalvmtests
################################################################
+# wbapitest (make sure the whitebox testing api classes work
+
+wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
+ $(JTREG) -a -v:fail,error \
+ $(JTREG_KEY_OPTION) \
+ $(EXTRA_JTREG_OPTIONS) \
+ -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \
+ -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \
+ -jdk:$(PRODUCT_HOME) \
+ $(JAVA_OPTIONS:%=-vmoption:%) \
+ $(TEST_ROOT)/sanity \
+ || $(BUNDLE_UP_FAILED)
+ $(BUNDLE_UP)
+
+PHONY_LIST += wbapitest
+
+################################################################
+
# packtest
# Expect JPRT to set JPRT_PACKTEST_HOME.
diff --git a/test/sanity/WBApi.java b/test/sanity/WBApi.java
new file mode 100644
index 000000000..79a51641f
--- /dev/null
+++ b/test/sanity/WBApi.java
@@ -0,0 +1,13 @@
+/*
+ * @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
+ */
+
+import sun.hotspot.WhiteBox;
+public class WBApi {
+ public static void main(String... args) {
+ System.out.printf("args at: %x\n",WhiteBox.getWhiteBox().getObjectAddress(args));
+ }
+}