Merge
authorcoleenp
Wed, 25 Nov 2015 16:13:14 +0000
changeset 34306 f64a5e6127f2
parent 34305 e399e6b44631 (current diff)
parent 34292 e005cf237e46 (diff)
child 34307 bd47d777584e
Merge
hotspot/make/aix/makefiles/sa.make
hotspot/make/aix/makefiles/saproc.make
hotspot/make/bsd/makefiles/sa.make
hotspot/make/linux/makefiles/sa.make
hotspot/make/linux/makefiles/saproc.make
hotspot/make/sa.files
hotspot/make/solaris/makefiles/sa.make
hotspot/make/solaris/makefiles/saproc.make
hotspot/make/windows/makefiles/sa.make
hotspot/src/os/windows/vm/os_windows.cpp
hotspot/test/runtime/8087223/BadMethodHandles.java
hotspot/test/runtime/8087223/IntfMethod.java
--- a/hotspot/make/Makefile	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/Makefile	Wed Nov 25 16:13:14 2015 +0000
@@ -44,9 +44,7 @@
 #  ALT_EXPORT_PATH            Directory to export hotspot build to
 #  ALT_JDK_IMPORT_PATH        Current JDK build (only for create_jdk rules)
 #  ALT_JDK_TARGET_IMPORT_PATH Current JDK build when cross-compiling
-#  ALT_BUILD_WIN_SA           Building SA on Windows is disabled by default.
-#                             Set ALT_BUILD_WIN_SA=1 to enable building SA on
-#                             Windows.
+#
 # Version strings and numbers:
 #  JDK_VERSION                Current JDK version (e.g. 1.6.0)
 #  PREVIOUS_JDK_VERSION       Previous (bootdir) JDK version (e.g. 1.5.0)
--- a/hotspot/make/aix/Makefile	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/aix/Makefile	Wed Nov 25 16:13:14 2015 +0000
@@ -46,15 +46,6 @@
 #
 #    make REMOTE="rsh -l me myotherlinuxbox"
 
-# Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
-# JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is built before building libjvm.so
-#                        Please refer to ./makefiles/sa.make
-#  2. libsa.so         - Native library for SA - This is built after
-#                        libjsig.so (signal interposition library)
-#                        Please refer to ./makefiles/vm.make
-# If $(GAMMADIR)/agent dir is not present, SA components are not built.
-
 # No tests on Aix.
 TEST_IN_BUILD=false
 
--- a/hotspot/make/aix/makefiles/buildtree.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/aix/makefiles/buildtree.make	Wed Nov 25 16:13:14 2015 +0000
@@ -50,7 +50,6 @@
 # adlc.make	-
 # trace.make	- generate tracing event and type definitions
 # jvmti.make	- generate JVMTI bindings from the spec (JSR-163)
-# sa.make	- generate SA jar file and natives
 #
 # The makefiles are split this way so that "make foo" will run faster by not
 # having to read the dependency files for the vm.
@@ -125,7 +124,7 @@
 # For dependencies and recursive makes.
 BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
 
-BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make
+BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
 	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@@ -212,7 +211,6 @@
 	echo "TARGET = $(TARGET)"; \
 	echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
 	echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
-	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
 	echo "OPENJDK = $(OPENJDK)"; \
@@ -351,16 +349,6 @@
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
 	) > $@
 
-sa.make: $(BUILDTREE_MAKE)
-	@echo $(LOG_INFO) Creating $@ ...
-	$(QUIETLY) ( \
-	$(BUILDTREE_COMMENT); \
-	echo; \
-	echo include flags.make; \
-	echo; \
-	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
-	) > $@
-
 FORCE:
 
 .PHONY:  all FORCE
--- a/hotspot/make/aix/makefiles/defs.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/aix/makefiles/defs.make	Wed Nov 25 16:13:14 2015 +0000
@@ -219,11 +219,3 @@
 #    endif
 #  endif
 endif
-
-# Serviceability Binaries
-# No SA Support for PPC or zero
-ADD_SA_BINARIES/ppc   =
-ADD_SA_BINARIES/ppc64 =
-ADD_SA_BINARIES/zero  =
-
-EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
--- a/hotspot/make/aix/makefiles/rules.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/aix/makefiles/rules.make	Wed Nov 25 16:13:14 2015 +0000
@@ -103,8 +103,6 @@
 else
 
 # take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined
-# note that this is to support hotspot build without SA. To build
-# SA along with hotspot, you need to define ALT_BOOTDIR, BOOTDIR or JAVA_HOME
 
 RUN.JAVA  = java
 RUN.JAVAP = javap
--- a/hotspot/make/aix/makefiles/sa.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-#
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2012, 2013 SAP AG. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# 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 (sa.make) is included from the sa.make in the
-# build directories.
-
-# This makefile is used to build Serviceability Agent java code
-# and generate JNI header file for native methods.
-
-include $(GAMMADIR)/make/aix/makefiles/rules.make
-
-include $(GAMMADIR)/make/defs.make
-
-AGENT_DIR = $(GAMMADIR)/agent
-
-include $(GAMMADIR)/make/sa.files
-
-TOPDIR    = $(shell echo `pwd`)
-GENERATED = $(TOPDIR)/../generated
-
-# tools.jar is needed by the JDI - SA binding
-SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar
-
-# TODO: if it's a modules image, check if SA module is installed.
-MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
-
-AGENT_FILES_LIST := $(GENERATED)/agent.classes.list
-
-SA_CLASSDIR = $(GENERATED)/saclasses
-
-SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)"
-
-SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
-
-# if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium, PowerPC, ARM or zero.
-
-all:
-	if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
-             -a "$(SRCARCH)" != "arm" \
-             -a "$(SRCARCH)" != "ppc" \
-             -a "$(SRCARCH)" != "zero" ] ; then \
-	   $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
-	fi
-
-$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
-	$(QUIETLY) echo $(LOG_INFO) "Making $@"
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -f $(SA_CLASSPATH) -a ! -d $(MODULELIB_PATH) ] ; then \
-	  echo "Missing $(SA_CLASSPATH) file. Use 1.6.0 or later version of JDK";\
-	  echo ""; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -d $(SA_CLASSDIR) ] ; then \
-	  mkdir -p $(SA_CLASSDIR);        \
-	fi
-# Note: When indented, make tries to execute the '$(shell' comment.
-# In some environments, cmd processors have limited line length.
-# To prevent the javac invocation in the next block from using
-# a very long cmd line, we use javac's @file-list option. We
-# generate the file lists using make's built-in 'foreach' control
-# flow which also avoids cmd processor line length issues. Since
-# the 'foreach' is done as part of make's macro expansion phase,
-# the initialization of the lists is also done in the same phase
-# using '$(shell rm ...' instead of using the more traditional
-# 'rm ...' rule.
-	$(shell rm -rf $(AGENT_FILES_LIST))
-# gnumake 3.78.1 does not accept the *'s that
-# are in AGENT_FILES, so use the shell to expand them.
-# Be extra carefull to not produce too long command lines in the shell!
-	$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
-	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
-	$(QUIETLY) $(REMOTE) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
-	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
-	$(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/*
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/
-	$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
-	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
-	$(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
-
-clean:
-	rm -rf $(SA_CLASSDIR)
-	rm -rf $(GENERATED)/sa-jdi.jar
-	rm -rf $(AGENT_FILES_LIST)
--- a/hotspot/make/aix/makefiles/saproc.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-#
-# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2012, 2013 SAP AG. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# 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 $(GAMMADIR)/make/defs.make
-
-# Rules to build serviceability agent library, used by vm.make
-
-# libsaproc.so: serviceability agent
-
-SAPROC = saproc
-LIBSAPROC = lib$(SAPROC).so
-
-LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
-LIBSAPROC_DIZ         = lib$(SAPROC).diz
-
-AGENT_DIR = $(GAMMADIR)/agent
-
-SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
-
-SASRCFILES = $(SASRCDIR)/salibelf.c                   \
-             $(SASRCDIR)/symtab.c                     \
-             $(SASRCDIR)/libproc_impl.c               \
-             $(SASRCDIR)/ps_proc.c                    \
-             $(SASRCDIR)/ps_core.c                    \
-             $(SASRCDIR)/LinuxDebuggerLocal.c         \
-
-SAMAPFILE = $(SASRCDIR)/mapfile
-
-DEST_SAPROC           = $(JDK_LIBDIR)/$(LIBSAPROC)
-DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
-DEST_SAPROC_DIZ       = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
-
-# DEBUG_BINARIES overrides everything, use full -g debug information
-ifeq ($(DEBUG_BINARIES), true)
-  SA_DEBUG_CFLAGS = -g
-endif
-
-# if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium, PPC, ARM or zero.
-
-ifneq ($(wildcard $(AGENT_DIR)),)
-ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
-  BUILDLIBSAPROC = $(LIBSAPROC)
-endif
-endif
-
-
-SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
-
-$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	  exit 1; \
-	fi
-	@echo $(LOG_INFO) Making SA debugger back-end...
-	$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
-		   -D_FILE_OFFSET_BITS=64                               \
-                   $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG)     \
-		   $(BIN_UTILS)						\
-	           -I$(SASRCDIR)                                        \
-	           -I$(GENERATED)                                       \
-	           -I$(BOOT_JAVA_HOME)/include                          \
-	           -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
-	           $(SASRCFILES)                                        \
-	           $(SA_LFLAGS)                                         \
-	           $(SA_DEBUG_CFLAGS)                                   \
-	           -o $@                                                \
-	           -lthread_db
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
-  ifeq ($(STRIP_POLICY),all_strip)
-	$(QUIETLY) $(STRIP) $@
-  else
-    ifeq ($(STRIP_POLICY),min_strip)
-	$(QUIETLY) $(STRIP) -g $@
-    # implied else here is no stripping at all
-    endif
-  endif
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
-	$(RM) $(LIBSAPROC_DEBUGINFO)
-  endif
-endif
-
-install_saproc: $(BUILDLIBSAPROC)
-	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
-	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
-	  test -f $(LIBSAPROC_DEBUGINFO) &&                  \
-	    $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
-	  test -f $(LIBSAPROC_DIZ) &&                  \
-	    $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \
-	  $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
-	fi
-
-.PHONY: install_saproc
--- a/hotspot/make/aix/makefiles/top.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/aix/makefiles/top.make	Wed Nov 25 16:13:14 2015 +0000
@@ -28,7 +28,6 @@
 # It also:
 #   -builds and runs adlc via adlc.make
 #   -generates JVMTI source and docs via jvmti.make (JSR-163)
-#   -generate sa-jdi.jar (JDI binding to core files)
 
 # It assumes the following flags are set:
 # CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files
@@ -86,7 +85,7 @@
 	@echo All done.
 
 # This is an explicit dependency for the sake of parallel makes.
-vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff sa_stuff
+vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff
 	@# We need a null action here, so implicit rules don't get consulted.
 
 $(Cached_plat): $(Plat_File)
@@ -104,10 +103,6 @@
 trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f trace.make $(MFLAGS-adjusted)
 
-# generate SA jar files and native header
-sa_stuff:
-	@$(MAKE) -f sa.make $(MFLAGS-adjusted)
-
 # and the VM: must use other makefile with dependencies included
 
 # We have to go to great lengths to get control over the -jN argument
@@ -146,7 +141,7 @@
 	rm -fr $(GENERATED)
 
 .PHONY: default vm_build_preliminaries
-.PHONY: lists ad_stuff jvmti_stuff sa_stuff the_vm clean realclean
+.PHONY: lists ad_stuff jvmti_stuff the_vm clean realclean
 .PHONY: checks check_os_version install
 
 .NOTPARALLEL:
--- a/hotspot/make/aix/makefiles/vm.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/aix/makefiles/vm.make	Wed Nov 25 16:13:14 2015 +0000
@@ -61,7 +61,7 @@
 # The order is important for the precompiled headers to work.
 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
 
-# SYMFLAG is used by {jsig,saproc}.make
+# SYMFLAG is used by jsig.make
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   # always build with debug info when we can create .debuginfo files
   SYMFLAG = -g
@@ -359,13 +359,10 @@
 # Signal interposition library
 include $(MAKEFILES_DIR)/jsig.make
 
-# Serviceability agent
-include $(MAKEFILES_DIR)/saproc.make
-
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB)
 
-install: install_jvm install_jsig install_saproc
+install: install_jvm install_jsig
 
 .PHONY: default build install install_jvm
--- a/hotspot/make/bsd/Makefile	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/bsd/Makefile	Wed Nov 25 16:13:14 2015 +0000
@@ -45,15 +45,6 @@
 #
 #    make REMOTE="rsh -l me myotherlinuxbox"
 
-# Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
-# JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is built before building libjvm.so
-#                        Please refer to ./makefiles/sa.make
-#  2. libsa.so         - Native library for SA - This is built after
-#                        libjsig.so (signal interposition library)
-#                        Please refer to ./makefiles/vm.make
-# If $(GAMMADIR)/agent dir is not present, SA components are not built.
-
 ifeq ($(GAMMADIR),)
 include ../../make/defs.make
 else
--- a/hotspot/make/bsd/makefiles/buildtree.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/bsd/makefiles/buildtree.make	Wed Nov 25 16:13:14 2015 +0000
@@ -49,7 +49,6 @@
 # adlc.make	-
 # trace.make	- generate tracing event and type definitions
 # jvmti.make	- generate JVMTI bindings from the spec (JSR-163)
-# sa.make	- generate SA jar file and natives
 #
 # The makefiles are split this way so that "make foo" will run faster by not
 # having to read the dependency files for the vm.
@@ -130,7 +129,7 @@
 BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
 
 # dtrace.make is used on BSD versions that implement Dtrace (like MacOS X)
-BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make dtrace.make
+BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make dtrace.make
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
 	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@@ -218,7 +217,6 @@
 	echo "TARGET = $(TARGET)"; \
 	echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
 	echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
-	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
 	echo "OPENJDK = $(OPENJDK)"; \
@@ -360,16 +358,6 @@
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
 	) > $@
 
-sa.make: $(BUILDTREE_MAKE)
-	@echo $(LOG_INFO) Creating $@ ...
-	$(QUIETLY) ( \
-	$(BUILDTREE_COMMENT); \
-	echo; \
-	echo include flags.make; \
-	echo; \
-	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
-	) > $@
-
 dtrace.make: $(BUILDTREE_MAKE)
 	@echo $(LOG_INFO) Creating $@ ...
 	$(QUIETLY) ( \
--- a/hotspot/make/bsd/makefiles/defs.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/bsd/makefiles/defs.make	Wed Nov 25 16:13:14 2015 +0000
@@ -188,13 +188,13 @@
   ifneq ($(BUILD_FLAVOR),)
     # FULL_DEBUG_SYMBOLS not created for individual static libraries
     ifeq ($(STATIC_BUILD),false)
-      ifeq ($(BUILD_FLAVOR), product)
-        FULL_DEBUG_SYMBOLS ?= 1
-        ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
-      else
-        # debug variants always get Full Debug Symbols (if available)
-        ENABLE_FULL_DEBUG_SYMBOLS = 1
-      endif
+    ifeq ($(BUILD_FLAVOR), product)
+      FULL_DEBUG_SYMBOLS ?= 1
+      ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
+    else
+      # debug variants always get Full Debug Symbols (if available)
+      ENABLE_FULL_DEBUG_SYMBOLS = 1
+    endif
      endif
     $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
     # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
@@ -260,11 +260,11 @@
 
 # Library suffix
 ifneq ($(STATIC_BUILD),true)
-  ifeq ($(OS_VENDOR),Darwin)
-    LIBRARY_SUFFIX=dylib
-  else
-    LIBRARY_SUFFIX=so
-  endif
+ifeq ($(OS_VENDOR),Darwin)
+  LIBRARY_SUFFIX=dylib
+else
+  LIBRARY_SUFFIX=so
+endif
 else
   LIBRARY_SUFFIX=a
 endif
@@ -275,7 +275,7 @@
 # jsig library not needed for static builds
 ifneq ($(STATIC_BUILD),true)
 # client and server subdirectories have symbolic links to ../libjsig.so
-  EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
+EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
 endif
 
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@@ -342,47 +342,6 @@
   endif
 endif
 
-# Serviceability Binaries
-# No SA Support for PPC, IA64, ARM or zero
-ADD_SA_BINARIES/x86   = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
-                        $(EXPORT_LIB_DIR)/sa-jdi.jar
-
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-      ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
-  else
-    ifeq ($(OS_VENDOR), Darwin)
-        ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
-    else
-        ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
-    endif
-  endif
-endif
-
-ADD_SA_BINARIES/sparc = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
-                        $(EXPORT_LIB_DIR)/sa-jdi.jar
-ADD_SA_BINARIES/universal = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
-                            $(EXPORT_LIB_DIR)/sa-jdi.jar
-
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-      ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
-  else
-    ifeq ($(OS_VENDOR), Darwin)
-        ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
-    else
-        ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
-    endif
-  endif
-endif
-
-ADD_SA_BINARIES/ppc   =
-ADD_SA_BINARIES/ia64  =
-ADD_SA_BINARIES/arm   =
-ADD_SA_BINARIES/zero  =
-
-EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
-
 # Universal build settings
 ifeq ($(OS_VENDOR), Darwin)
   # Build universal binaries by default on Mac OS X
@@ -409,9 +368,8 @@
 
     # Binaries to 'universalize' if built
     ifneq ($(STATIC_BUILD),true)
-      UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX)
+    UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX)
     endif
-    UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX)
     UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX)
     UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX)
 
@@ -430,12 +388,10 @@
           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.diz
           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.diz
           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.diz
-          UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libsaproc.diz
       else
           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX).dSYM
           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX).dSYM
           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
-          UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
       endif
     endif
 
--- a/hotspot/make/bsd/makefiles/rules.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/bsd/makefiles/rules.make	Wed Nov 25 16:13:14 2015 +0000
@@ -107,8 +107,6 @@
 else
 
 # take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined
-# note that this is to support hotspot build without SA. To build
-# SA along with hotspot, you need to define ALT_BOOTDIR, BOOTDIR or JAVA_HOME
 
 RUN.JAVA  = java
 RUN.JAVAP = javap
--- a/hotspot/make/bsd/makefiles/sa.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-#
-# Copyright (c) 2003, 2015, 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 (sa.make) is included from the sa.make in the
-# build directories.
-
-define print_info
-  ifneq ($$(LOG_LEVEL), warn)
-    $$(shell echo >&2 "INFO: $1")
-  endif
-endef
-
-# This makefile is used to build Serviceability Agent java code
-# and generate JNI header file for native methods.
-
-include $(GAMMADIR)/make/bsd/makefiles/rules.make
-
-AGENT_DIR = $(GAMMADIR)/agent
-
-include $(GAMMADIR)/make/sa.files
-
--include $(HS_ALT_MAKE)/bsd/makefiles/sa.make
-
-TOPDIR    = $(shell echo `pwd`)
-GENERATED = $(TOPDIR)/../generated
-
-# SA-JDI depends on the standard JDI classes.
-# Default SA_CLASSPATH location:
-DEF_SA_CLASSPATH=$(BOOT_JAVA_HOME)/lib/tools.jar
-ifeq ($(ALT_SA_CLASSPATH),)
-  # no alternate specified; see if default exists
-  SA_CLASSPATH=$(shell test -f $(DEF_SA_CLASSPATH) && echo $(DEF_SA_CLASSPATH))
-  ifeq ($(SA_CLASSPATH),)
-    # the default doesn't exist
-    ifeq ($(OS_VENDOR), Darwin)
-      # A JDK from Apple doesn't have tools.jar; the JDI classes are
-      # are in the regular classes.jar file.
-      APPLE_JAR=$(BOOT_JAVA_HOME)/bundle/Classes/classes.jar
-      SA_CLASSPATH=$(shell test -f $(APPLE_JAR) && echo $(APPLE_JAR))
-    endif
-  endif
-else
-  $(eval $(call print_info, "ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)"))
-  SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
-endif
-
-ifneq ($(SA_CLASSPATH),)
-  SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
-endif
-
-# TODO: if it's a modules image, check if SA module is installed.
-MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
-
-AGENT_FILES_LIST := $(GENERATED)/agent.classes.list
-
-SA_CLASSDIR = $(GENERATED)/saclasses
-
-SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)"
-
-SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
-
-# if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium, PowerPC, ARM or zero.
-
-all:
-	if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
-             -a "$(SRCARCH)" != "arm" \
-             -a "$(SRCARCH)" != "ppc" \
-             -a "$(SRCARCH)" != "zero" ] ; then \
-	   $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
-	fi
-
-$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
-	$(QUIETLY) echo $(LOG_INFO) "Making $@"
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -f "$(SA_CLASSPATH)" -a ! -d $(MODULELIB_PATH) ] ; then \
-	  echo "Cannot find JDI classes. Use 1.6.0 or later version of JDK."; \
-	  echo ""; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -d $(SA_CLASSDIR) ] ; then \
-	  mkdir -p $(SA_CLASSDIR);        \
-	fi
-# Note: When indented, make tries to execute the '$(shell' comment.
-# In some environments, cmd processors have limited line length.
-# To prevent the javac invocation in the next block from using
-# a very long cmd line, we use javac's @file-list option. We
-# generate the file lists using make's built-in 'foreach' control
-# flow which also avoids cmd processor line length issues. Since
-# the 'foreach' is done as part of make's macro expansion phase,
-# the initialization of the lists is also done in the same phase
-# using '$(shell rm ...' instead of using the more traditional
-# 'rm ...' rule.
-	$(shell rm -rf $(AGENT_FILES_LIST))
-# gnumake 3.78.1 does not accept the *'s that
-# are in AGENT_FILES, so use the shell to expand them.
-# Be extra carefull to not produce too long command lines in the shell!
-	$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
-	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -h $(GENERATED) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
-	$(QUIETLY) $(REMOTE) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
-	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
-	$(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/*
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/
-	$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
-	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
-	$(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
-
-clean:
-	rm -rf $(SA_CLASSDIR)
-	rm -rf $(GENERATED)/sa-jdi.jar
-	rm -rf $(AGENT_FILES_LIST)
--- a/hotspot/make/bsd/makefiles/top.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/bsd/makefiles/top.make	Wed Nov 25 16:13:14 2015 +0000
@@ -28,7 +28,6 @@
 # It also:
 #   -builds and runs adlc via adlc.make
 #   -generates JVMTI source and docs via jvmti.make (JSR-163)
-#   -generate sa-jdi.jar (JDI binding to core files)
 
 # It assumes the following flags are set:
 # CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files
@@ -86,7 +85,7 @@
 	@echo All done.
 
 # This is an explicit dependency for the sake of parallel makes.
-vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff trace_stuff sa_stuff dtrace_stuff
+vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff trace_stuff dtrace_stuff
 	@# We need a null action here, so implicit rules don't get consulted.
 
 $(Cached_plat): $(Plat_File)
@@ -113,10 +112,6 @@
 	@# We need a null action here, so implicit rules don't get consulted.
 endif
 
-# generate SA jar files and native header
-sa_stuff:
-	@$(MAKE) -f sa.make $(MFLAGS-adjusted)
-
 # and the VM: must use other makefile with dependencies included
 
 # We have to go to great lengths to get control over the -jN argument
@@ -155,7 +150,7 @@
 	rm -fr $(GENERATED)
 
 .PHONY: default vm_build_preliminaries
-.PHONY: lists ad_stuff jvmti_stuff sa_stuff the_vm clean realclean
+.PHONY: lists ad_stuff jvmti_stuff the_vm clean realclean
 .PHONY: checks check_os_version install
 
 .NOTPARALLEL:
--- a/hotspot/make/bsd/makefiles/vm.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/bsd/makefiles/vm.make	Wed Nov 25 16:13:14 2015 +0000
@@ -60,7 +60,7 @@
 # The order is important for the precompiled headers to work.
 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
 
-# SYMFLAG is used by {jsig,saproc}.make
+# SYMFLAG is used by jsig.make
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   # always build with debug info when we can create .dSYM/.debuginfo files
   SYMFLAG = -g
@@ -299,9 +299,9 @@
 
   ifeq ($(OS_VENDOR), Darwin)
     ifneq ($(STATIC_BUILD),true)
-      LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/.
-      LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/..
-      LFLAGS_VM += -Xlinker -install_name -Xlinker @rpath/$(@F)
+    LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/.
+    LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/..
+    LFLAGS_VM += -Xlinker -install_name -Xlinker @rpath/$(@F)
     endif
   else
     LFLAGS_VM                += -Wl,-z,defs
@@ -421,19 +421,16 @@
 # Signal interposition library
 include $(MAKEFILES_DIR)/jsig.make
 
-# Serviceability agent
-include $(MAKEFILES_DIR)/saproc.make
-
 #----------------------------------------------------------------------
 
 ifeq ($(OS_VENDOR), Darwin)
 # no libjvm_db for macosx
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(EXPORTED_SYMBOLS)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) dtraceCheck $(EXPORTED_SYMBOLS)
 	echo "Doing vm.make build:"
 else
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(EXPORTED_SYMBOLS)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(EXPORTED_SYMBOLS)
 endif
 
-install: install_jvm install_jsig install_saproc
+install: install_jvm install_jsigs
 
 .PHONY: default build install install_jvm
--- a/hotspot/make/excludeSrc.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/excludeSrc.make	Wed Nov 25 16:13:14 2015 +0000
@@ -73,8 +73,9 @@
       CXXFLAGS += -DINCLUDE_CDS=0
       CFLAGS += -DINCLUDE_CDS=0
 
-      Src_Files_EXCLUDE += filemap.cpp metaspaceShared*.cpp sharedPathsMiscInfo.cpp \
-        systemDictionaryShared.cpp classLoaderExt.cpp sharedClassUtil.cpp
+      Src_Files_EXCLUDE += classListParser.cpp classLoaderExt.cpp \
+        filemap.cpp metaspaceShared*.cpp sharedClassUtil.cpp sharedPathsMiscInfo.cpp \
+        systemDictionaryShared.cpp
 endif
 
 ifeq ($(INCLUDE_ALL_GCS), false)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/gensrc/Gensrc-jdk.hotspot.agent.gmk	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+################################################################################
+
+SA_PROPERTIES := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/sa.properties
+
+SA_BUILD_VERSION_PROP_NAME := "sun.jvm.hotspot.runtime.VM.saBuildVersion"
+
+$(SA_PROPERTIES): $(call DependOnVariable, FULL_VERSION)
+	$(MKDIR) -p $(@D)
+	$(ECHO) "$(SA_BUILD_VERSION_PROP_NAME)=$(FULL_VERSION)" > $@
+
+TARGETS += $(SA_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all default
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/lib/Lib-jdk.hotspot.agent.gmk	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,130 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include NativeCompilation.gmk
+
+$(eval $(call IncludeCustomExtension, hotspot, lib/Lib-jdk.hotspot.agent.gmk))
+
+################################################################################
+
+SA_TOPDIR := $(HOTSPOT_TOPDIR)/agent
+
+# SA has a slightly different OS naming scheme
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  SA_TARGET_OS := win32
+else ifeq ($(OPENJDK_TARGET_OS), macosx)
+  SA_TARGET_OS := bsd
+else
+  SA_TARGET_OS := $(OPENJDK_TARGET_OS)
+endif
+
+# Defaults for most platforms
+SA_TOOLCHAIN := TOOLCHAIN_DEFAULT
+SA_NAME := saproc
+SA_SRC += $(SA_TOPDIR)/src/share/native $(SA_TOPDIR)/src/os/$(SA_TARGET_OS)
+SA_MAPFILE := $(SA_TOPDIR)/src/os/$(OPENJDK_TARGET_OS)/mapfile
+SA_INCLUDES := \
+    $(addprefix -I, $(SA_SRC)) \
+    -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
+    -I$(HOTSPOT_TOPDIR)/src/os/$(OPENJDK_TARGET_OS) \
+    #
+
+ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+  SA_MACHINE_FLAG_windows := -machine:AMD64
+else ifeq ($(OPENJDK_TARGET_CPU), x86)
+  SA_MACHINE_FLAG_linux := -march=i586
+  SA_MACHINE_FLAG_windows := -machine:I386
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), linux)
+  SA_CFLAGS := $(CFLAGS_JDKLIB) -D_FILE_OFFSET_BITS=64 \
+      $(SA_MACHINE_FLAG_linux)
+  SA_LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_MACHINE_FLAG_linux)
+  SA_LIBS := -lthread_db $(LIBDL)
+
+else ifeq ($(OPENJDK_TARGET_OS), solaris)
+  SA_TOOLCHAIN := TOOLCHAIN_LINK_CXX
+  SA_MAPFILE := $(SA_TOPDIR)/src/os/solaris/proc/mapfile
+  COMMON_CFLAGS := -I$(SA_TOPDIR)/src/os/$(OPENJDK_TARGET_OS)/proc \
+      -DSOLARIS_11_B159_OR_LATER
+  SA_CFLAGS := $(CFLAGS_JDKLIB) $(COMMON_CFLAGS)
+  SA_CXXFLAGS := $(CXXFLAGS_JDKLIB) $(COMMON_CFLAGS)
+  SA_LDFLAGS := $(subst -z defs,, $(LDFLAGS_JDKLIB)) \
+      -mt $(LDFLAGS_CXX_JDK)
+  SA_LIBS := -ldl -ldemangle -lthread -lc
+
+else ifeq ($(OPENJDK_TARGET_OS), macosx)
+  SA_EXCLUDE_FILES := BsdDebuggerLocal.c ps_proc.c salibelf.c StubDebuggerLocal.c
+  SA_CFLAGS := $(CFLAGS_JDKLIB) \
+      -Damd64 -D_GNU_SOURCE -mno-omit-leaf-frame-pointer \
+      -mstack-alignment=1 -fPIC
+  SA_LDFLAGS := $(LDFLAGS_JDKLIB)
+  SA_LIBS := -framework Foundation -framework JavaNativeFoundation \
+      -framework Security -framework CoreFoundation
+
+else ifeq ($(OPENJDK_TARGET_OS), windows)
+  SA_NAME := sawindbg
+  COMMON_CFLAGS := -D_WINDOWS -D_DEBUG -D_CONSOLE -D_MBCS -EHsc -FD
+  SA_CFLAGS := $(subst -DWIN32_LEAN_AND_MEAN,, $(CFLAGS_JDKLIB)) \
+      $(COMMON_CFLAGS)
+  SA_CXXFLAGS := $(subst -DWIN32_LEAN_AND_MEAN,, $(CXXFLAGS_JDKLIB)) \
+      $(COMMON_CFLAGS)
+  SA_LDFLAGS := $(LDFLAGS_JDKLIB) \
+      $(SA_MACHINE_FLAG_windows) -manifest \
+      -subsystem:console -map
+  SA_LIBS := dbgeng.lib
+  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+    SA_CXXFLAGS += -DWIN64
+  else
+    SA_CXXFLAGS += -RTC1 -ZI
+    SA_LDFLAGS += -SAFESEH
+  endif
+endif
+
+################################################################################
+
+$(eval $(call SetupNativeCompilation, BUILD_LIBSA, \
+    TOOLCHAIN := $(SA_TOOLCHAIN), \
+    OPTIMIZATION := NONE, \
+    DISABLED_WARNINGS_microsoft := 4267, \
+    DISABLED_WARNINGS_gcc := sign-compare, \
+    DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
+    LIBRARY := $(SA_NAME), \
+    OUTPUT_DIR := $(call FindLibDirForModule, $(MODULE)), \
+    SRC := $(SA_SRC), \
+    EXCLUDE_FILES := test.c saproc_audit.cpp $(SA_EXCLUDE_FILES), \
+    CFLAGS := $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CUSTOM_CFLAGS), \
+    CXXFLAGS := $(SA_INCLUDES) $(SA_CXXFLAGS) $(SA_CUSTOM_CXXFLAGS), \
+    LDFLAGS := $(SA_LDFLAGS) $(SA_CUSTOM_LDFLAGS), \
+    LIBS := $(SA_LIBS), \
+    MAPFILE := $(SA_MAPFILE), \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsa, \
+    DEBUG_SYMBOLS := true, \
+    STRIP_SYMBOLS := true, \
+))
+
+TARGETS += $(BUILD_LIBSA)
+
+################################################################################
--- a/hotspot/make/linux/Makefile	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/linux/Makefile	Wed Nov 25 16:13:14 2015 +0000
@@ -45,15 +45,6 @@
 #
 #    make REMOTE="rsh -l me myotherlinuxbox"
 
-# Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
-# JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is built before building libjvm.so
-#                        Please refer to ./makefiles/sa.make
-#  2. libsa.so         - Native library for SA - This is built after
-#                        libjsig.so (signal interposition library)
-#                        Please refer to ./makefiles/vm.make
-# If $(GAMMADIR)/agent dir is not present, SA components are not built.
-
 ifeq ($(GAMMADIR),)
 include ../../make/defs.make
 else
--- a/hotspot/make/linux/makefiles/buildtree.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/linux/makefiles/buildtree.make	Wed Nov 25 16:13:14 2015 +0000
@@ -49,7 +49,6 @@
 # adlc.make	-
 # trace.make	- generate tracing event and type definitions
 # jvmti.make	- generate JVMTI bindings from the spec (JSR-163)
-# sa.make	- generate SA jar file and natives
 #
 # The makefiles are split this way so that "make foo" will run faster by not
 # having to read the dependency files for the vm.
@@ -127,7 +126,7 @@
 # For dependencies and recursive makes.
 BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
 
-BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make dtrace.make
+BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make dtrace.make
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
 	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@@ -219,7 +218,6 @@
 	echo "TARGET = $(TARGET)"; \
 	echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
 	echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
-	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
 	echo "OPENJDK = $(OPENJDK)"; \
@@ -358,16 +356,6 @@
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
 	) > $@
 
-sa.make: $(BUILDTREE_MAKE)
-	@echo $(LOG_INFO) Creating $@ ...
-	$(QUIETLY) ( \
-	$(BUILDTREE_COMMENT); \
-	echo; \
-	echo include flags.make; \
-	echo; \
-	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
-	) > $@
-
 dtrace.make: $(BUILDTREE_MAKE)
 	@echo $(LOG_INFO) Creating $@ ...
 	$(QUIETLY) ( \
--- a/hotspot/make/linux/makefiles/defs.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/linux/makefiles/defs.make	Wed Nov 25 16:13:14 2015 +0000
@@ -293,24 +293,4 @@
   endif
 endif
 
-# Serviceability Binaries
-
-ADD_SA_BINARIES/DEFAULT = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
-                          $(EXPORT_LIB_DIR)/sa-jdi.jar
-
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-    ADD_SA_BINARIES/DEFAULT += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
-  else
-    ADD_SA_BINARIES/DEFAULT += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
-  endif
-endif
-
-ADD_SA_BINARIES/$(HS_ARCH) = $(ADD_SA_BINARIES/DEFAULT)
-
-# No SA Support for zero
-ADD_SA_BINARIES/zero  =
-
 -include $(HS_ALT_MAKE)/linux/makefiles/defs.make
-
-EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
--- a/hotspot/make/linux/makefiles/rules.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/linux/makefiles/rules.make	Wed Nov 25 16:13:14 2015 +0000
@@ -103,8 +103,6 @@
 else
 
 # take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined
-# note that this is to support hotspot build without SA. To build
-# SA along with hotspot, you need to define ALT_BOOTDIR, BOOTDIR or JAVA_HOME
 
 RUN.JAVA  = java
 RUN.JAVAP = javap
--- a/hotspot/make/linux/makefiles/sa.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-#
-# Copyright (c) 2003, 2015, 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 (sa.make) is included from the sa.make in the
-# build directories.
-
-# This makefile is used to build Serviceability Agent java code
-# and generate JNI header file for native methods.
-
-include $(GAMMADIR)/make/linux/makefiles/rules.make
-
-include $(GAMMADIR)/make/defs.make
-include $(GAMMADIR)/make/altsrc.make
-
-AGENT_DIR = $(GAMMADIR)/agent
-
-include $(GAMMADIR)/make/sa.files
-
--include $(HS_ALT_MAKE)/linux/makefiles/sa.make
-
-
-TOPDIR    = $(shell echo `pwd`)
-GENERATED = $(TOPDIR)/../generated
-
-# tools.jar is needed by the JDI - SA binding
-SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar
-
-# TODO: if it's a modules image, check if SA module is installed.
-MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
-
-AGENT_FILES_LIST := $(GENERATED)/agent.classes.list
-
-SA_CLASSDIR = $(GENERATED)/saclasses
-
-SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)"
-
-SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
-
-# if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium or zero.
-
-all:
-	if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
-             -a "$(SRCARCH)" != "zero" ] ; then \
-	   $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
-	fi
-
-$(GENERATED)/sa-jdi.jar:: $(AGENT_FILES)
-	$(QUIETLY) echo $(LOG_INFO) "Making $@"
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -f $(SA_CLASSPATH) -a ! -d $(MODULELIB_PATH) ] ; then \
-	  echo "Missing $(SA_CLASSPATH) file. Use 1.6.0 or later version of JDK";\
-	  echo ""; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -d $(SA_CLASSDIR) ] ; then \
-	  mkdir -p $(SA_CLASSDIR);        \
-	fi
-# Note: When indented, make tries to execute the '$(shell' comment.
-# In some environments, cmd processors have limited line length.
-# To prevent the javac invocation in the next block from using
-# a very long cmd line, we use javac's @file-list option. We
-# generate the file lists using make's built-in 'foreach' control
-# flow which also avoids cmd processor line length issues. Since
-# the 'foreach' is done as part of make's macro expansion phase,
-# the initialization of the lists is also done in the same phase
-# using '$(shell rm ...' instead of using the more traditional
-# 'rm ...' rule.
-	$(shell rm -rf $(AGENT_FILES_LIST))
-# gnumake 3.78.1 does not accept the *'s that
-# are in AGENT_FILES, so use the shell to expand them.
-# Be extra carefull to not produce too long command lines in the shell!
-	$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
-	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
-	$(QUIETLY) $(REMOTE) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
-	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
-	$(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/*
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/
-	$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
-	$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
-	$(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
-
-clean:
-	rm -rf $(SA_CLASSDIR)
-	rm -rf $(GENERATED)/sa-jdi.jar
-	rm -rf $(AGENT_FILES_LIST)
-
--include $(HS_ALT_MAKE)/linux/makefiles/sa-rules.make
--- a/hotspot/make/linux/makefiles/saproc.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-#
-# Copyright (c) 2005, 2015, 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 $(GAMMADIR)/make/defs.make
-include $(GAMMADIR)/make/altsrc.make
-
-# Rules to build serviceability agent library, used by vm.make
-
-# libsaproc.so: serviceability agent
-
-SAPROC = saproc
-LIBSAPROC = lib$(SAPROC).so
-
-LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
-LIBSAPROC_DIZ         = lib$(SAPROC).diz
-
-AGENT_DIR = $(GAMMADIR)/agent
-
-SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
-
-SASRCFILES = $(SASRCDIR)/salibelf.c                   \
-             $(SASRCDIR)/symtab.c                     \
-             $(SASRCDIR)/libproc_impl.c               \
-             $(SASRCDIR)/ps_proc.c                    \
-             $(SASRCDIR)/ps_core.c                    \
-             $(SASRCDIR)/LinuxDebuggerLocal.c         \
-             $(AGENT_DIR)/src/share/native/sadis.c
-
--include $(HS_ALT_MAKE)/linux/makefiles/saproc.make
-
-SAMAPFILE = $(SASRCDIR)/mapfile
-
-DEST_SAPROC           = $(JDK_LIBDIR)/$(LIBSAPROC)
-DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
-DEST_SAPROC_DIZ       = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
-
-# DEBUG_BINARIES overrides everything, use full -g debug information
-ifeq ($(DEBUG_BINARIES), true)
-  SA_DEBUG_CFLAGS = -g
-endif
-
-# if $(AGENT_DIR) does not exist, we don't build SA
-# also, we don't build SA on Itanium or zero.
-
-ifneq ($(wildcard $(AGENT_DIR)),)
-ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
-  BUILDLIBSAPROC = $(LIBSAPROC)
-endif
-endif
-
-ifneq ($(ALT_SASRCDIR),)
-ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR
-else
-ALT_SAINCDIR=
-endif
-SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
-
-SAARCH ?= $(BUILDARCH)
-
-$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	  exit 1; \
-	fi
-	@echo $(LOG_INFO) Making SA debugger back-end...
-	$(QUIETLY) $(CC) -D$(SAARCH) -D_GNU_SOURCE                      \
-		   -D_FILE_OFFSET_BITS=64                               \
-                   $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG)     \
-	           -I$(SASRCDIR)                                        \
-	           -I$(GENERATED)                                       \
-	           -I$(BOOT_JAVA_HOME)/include                          \
-	           -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
-			   $(ALT_SAINCDIR) 										\
-	           $(SASRCFILES)                                        \
-	           $(SA_LFLAGS)                                         \
-	           $(SA_DEBUG_CFLAGS)                                   \
-	           $(EXTRA_CFLAGS)                                      \
-	           -o $@                                                \
-	           -lthread_db
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
-  ifeq ($(STRIP_POLICY),all_strip)
-	$(QUIETLY) $(STRIP) $@
-  else
-    ifeq ($(STRIP_POLICY),min_strip)
-	$(QUIETLY) $(STRIP) -g $@
-    # implied else here is no stripping at all
-    endif
-  endif
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
-	$(RM) $(LIBSAPROC_DEBUGINFO)
-  endif
-endif
-
-install_saproc: $(BUILDLIBSAPROC)
-	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then                   \
-	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";           \
-	  test ! -f $(LIBSAPROC_DEBUGINFO) ||                      \
-	    $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
-	  test ! -f $(LIBSAPROC_DIZ) ||                            \
-	    $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ);             \
-	  $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";        \
-	fi
-
-.PHONY: install_saproc
--- a/hotspot/make/linux/makefiles/top.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/linux/makefiles/top.make	Wed Nov 25 16:13:14 2015 +0000
@@ -28,7 +28,6 @@
 # It also:
 #   -builds and runs adlc via adlc.make
 #   -generates JVMTI source and docs via jvmti.make (JSR-163)
-#   -generate sa-jdi.jar (JDI binding to core files)
 
 # It assumes the following flags are set:
 # CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files
@@ -86,7 +85,7 @@
 	@echo All done.
 
 # This is an explicit dependency for the sake of parallel makes.
-vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff sa_stuff dtrace_stuff
+vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff dtrace_stuff
 	@# We need a null action here, so implicit rules don't get consulted.
 
 $(Cached_plat): $(Plat_File)
@@ -104,10 +103,6 @@
 trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f trace.make $(MFLAGS-adjusted)
 
-# generate SA jar files and native header
-sa_stuff:
-	@$(MAKE) -f sa.make $(MFLAGS-adjusted)
-
 dtrace_stuff: $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f dtrace.make dtrace_gen_headers $(MFLAGS-adjusted) GENERATED=$(GENERATED)
 
@@ -149,7 +144,7 @@
 	rm -fr $(GENERATED)
 
 .PHONY: default vm_build_preliminaries
-.PHONY: lists ad_stuff jvmti_stuff sa_stuff the_vm clean realclean
+.PHONY: lists ad_stuff jvmti_stuff the_vm clean realclean
 .PHONY: checks check_os_version install
 
 .NOTPARALLEL:
--- a/hotspot/make/linux/makefiles/vm.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/linux/makefiles/vm.make	Wed Nov 25 16:13:14 2015 +0000
@@ -62,7 +62,7 @@
 # The order is important for the precompiled headers to work.
 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
 
-# SYMFLAG is used by {jsig,saproc}.make
+# SYMFLAG is used by jsig.make
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   # always build with debug info when we can create .debuginfo files
   SYMFLAG = -g
@@ -396,13 +396,10 @@
 # Signal interposition library
 include $(MAKEFILES_DIR)/jsig.make
 
-# Serviceability agent
-include $(MAKEFILES_DIR)/saproc.make
-
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) dtraceCheck
 
-install: install_jvm install_jsig install_saproc
+install: install_jvm install_jsig
 
 .PHONY: default build install install_jvm $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make
--- a/hotspot/make/sa.files	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-#
-# Copyright (c) 2003, 2015, 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 filelist macro is included in platform specific sa.make
-# included all packages/*.java. package list can be generated by
-# $(GAMMADIR)/agent/make/build-pkglist. 
-
-# define AGENT_DIR before including this file in sa.make
-
-AGENT_SRC_DIR = $(AGENT_DIR)/src/share/classes
-
-# Splitted the set of files into two sets because on linux plaform
-# listing or compiling all the files results in 'Argument list too long' error.
-
-AGENT_FILES = \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/c1/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ci/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/classfile/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/code/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/compiler/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/aarch64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/ia64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ia64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ppc64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/aarch64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/posix/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/posix/elf/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/ppc64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/ppc64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/aarch64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/ppc64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/aarch64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/win32/coff/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/ia64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc/cms/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc/g1/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc/parallel/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc/serial/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc/shared/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/interpreter/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/jdi/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/memory/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/oops/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/opto/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/prims/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/aarch64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_aarch64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_ppc64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/posix/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/sparc/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/win32_amd64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/win32_x86/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ppc64/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/jcore/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/soql/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/types/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/types/basic/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/memo/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/action/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/classbrowser/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/table/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/tree/*.java \
-$(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/treetable/*.java \
-$(AGENT_SRC_DIR)/com/sun/java/swing/action/*.java \
-$(AGENT_SRC_DIR)/com/sun/java/swing/ui/*.java
--- a/hotspot/make/share/makefiles/mapfile-vers	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/share/makefiles/mapfile-vers	Wed Nov 25 16:13:14 2015 +0000
@@ -7,6 +7,7 @@
                 JVM_ActiveProcessorCount;
                 JVM_ArrayCopy;
                 JVM_AssertionStatusDirectives;
+                JVM_CallStackWalk;
                 JVM_ClassDepth;
                 JVM_ClassLoaderDepth;
                 JVM_Clone;
@@ -31,12 +32,12 @@
                 JVM_CurrentTimeMillis;
                 JVM_DefineClass;
                 JVM_DefineClassWithSource;
-                JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
+                JVM_FillStackFrames;
                 JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromBootLoader;
@@ -134,6 +135,7 @@
                 JVM_MonitorNotify;
                 JVM_MonitorNotifyAll;
                 JVM_MonitorWait;
+                JVM_MoreStackWalk;
                 JVM_NanoTime;
                 JVM_NativePath;
                 JVM_NewArray;
@@ -151,6 +153,7 @@
                 JVM_SetClassSigners;
                 JVM_SetNativeThreadName;
                 JVM_SetPrimitiveArrayElement;
+                JVM_SetMethodInfo;
                 JVM_SetThreadPriority;
                 JVM_Sleep;
                 JVM_StartThread;
--- a/hotspot/make/solaris/Makefile	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/solaris/Makefile	Wed Nov 25 16:13:14 2015 +0000
@@ -36,15 +36,6 @@
 # or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc.
 # from the PATH.
 
-# Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
-# JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is built before building libjvm.so
-#                        Please refer to ./makefiles/sa.make
-#  2. libsaproc.so     - Native library for SA - This is built after
-#                        libjsig.so (signal interposition library)
-#                        Please refer to ./makefiles/vm.make
-# If $(GAMMADIR)/agent dir is not present, SA components are not built.
-
 ifeq ($(GAMMADIR),)
 include ../../make/defs.make
 else
--- a/hotspot/make/solaris/makefiles/buildtree.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/solaris/makefiles/buildtree.make	Wed Nov 25 16:13:14 2015 +0000
@@ -49,7 +49,6 @@
 # adlc.make	-
 # trace.make	- generate tracing event and type definitions
 # jvmti.make	- generate JVMTI bindings from the spec (JSR-163)
-# sa.make	- generate SA jar file and natives
 #
 # The makefiles are split this way so that "make foo" will run faster by not
 # having to read the dependency files for the vm.
@@ -117,7 +116,7 @@
 # For dependencies and recursive makes.
 BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
 
-BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make dtrace.make
+BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make dtrace.make
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
 	ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@@ -205,7 +204,6 @@
 	echo "TARGET = $(TARGET)"; \
 	echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
 	echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
-	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
 	echo "OPENJDK = $(OPENJDK)"; \
@@ -344,16 +342,6 @@
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
 	) > $@
 
-sa.make: $(BUILDTREE_MAKE)
-	@echo $(LOG_INFO) Creating $@ ...
-	$(QUIETLY) ( \
-	$(BUILDTREE_COMMENT); \
-	echo; \
-	echo include flags.make; \
-	echo; \
-	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
-	) > $@
-
 dtrace.make: $(BUILDTREE_MAKE)
 	@echo $(LOG_INFO) Creating $@ ...
 	$(QUIETLY) ( \
--- a/hotspot/make/solaris/makefiles/defs.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/solaris/makefiles/defs.make	Wed Nov 25 16:13:14 2015 +0000
@@ -294,13 +294,3 @@
     endif
   endif
 endif
-
-EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX)
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-    EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
-  else
-    EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
-  endif
-endif
-EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
--- a/hotspot/make/solaris/makefiles/rules.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/solaris/makefiles/rules.make	Wed Nov 25 16:13:14 2015 +0000
@@ -95,8 +95,6 @@
 else
 
 # take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined
-# note that this is to support hotspot build without SA. To build
-# SA along with hotspot, you need to define ALT_BOOTDIR, BOOTDIR or JAVA_HOME
 
 RUN.JAVA  = java
 RUN.JAVAP = javap
--- a/hotspot/make/solaris/makefiles/sa.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#
-# Copyright (c) 2003, 2015, 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 (sa.make) is included from the sa.make in the
-# build directories.
-
-# This makefile is used to build Serviceability Agent java code
-# and generate JNI header file for native methods.
-
-include $(GAMMADIR)/make/solaris/makefiles/rules.make
-include $(GAMMADIR)/make/defs.make
-AGENT_DIR = $(GAMMADIR)/agent
-include $(GAMMADIR)/make/sa.files
-
--include $(HS_ALT_MAKE)/solaris/makefiles/sa.make
-
-GENERATED = ../generated
-
-# tools.jar is needed by the JDI - SA binding
-SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar
-
-# TODO: if it's a modules image, check if SA module is installed.
-MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
-
-AGENT_FILES_LIST := $(GENERATED)/agent.classes.list
-
-SA_CLASSDIR = $(GENERATED)/saclasses
-
-SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)"
-
-SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
-
-# if $(AGENT_DIR) does not exist, we don't build SA.
-all:
-	$(QUIETLY) if [ -d $(AGENT_DIR) ] ; then \
-	   $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
-	fi
-
-$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
-	$(QUIETLY) echo $(LOG_INFO) "Making $@";
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	   echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	   exit 1; \
-	fi
-	$(QUIETLY) if [ ! -f $(SA_CLASSPATH) -a ! -d $(MODULELIB_PATH) ] ; then \
-	  echo "Missing $(SA_CLASSPATH) file. Use 1.6.0 or later version of JDK";\
-	  echo ""; \
-	  exit 1; \
-	fi
-	$(QUIETLY) if [ ! -d $(SA_CLASSDIR) ] ; then \
-	  mkdir -p $(SA_CLASSDIR);        \
-	fi
-# Note: When indented, make tries to execute the '$(shell' comment.
-# In some environments, cmd processors have limited line length.
-# To prevent the javac invocation in the next block from using
-# a very long cmd line, we use javac's @file-list option. We
-# generate the file lists using make's built-in 'foreach' control
-# flow which also avoids cmd processor line length issues. Since
-# the 'foreach' is done as part of make's macro expansion phase,
-# the initialization of the lists is also done in the same phase
-# using '$(shell rm ...' instead of using the more traditional
-# 'rm ...' rule.
-	$(shell rm -rf $(AGENT_FILES_LIST))
-# gnumake 3.78.1 does not accept the *'s that
-# are in AGENT_FILES, so use the shell to expand them.
-# Be extra carefull to not produce too long command lines in the shell!
-	$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
-	$(QUIETLY) $(COMPILE.JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
-	$(QUIETLY) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
-	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
-	$(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/*
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/
-	$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
-	$(QUIETLY) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
-	$(QUIETLY) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
-
-clean:
-	rm -rf $(SA_CLASSDIR)
-	rm -rf $(GENERATED)/sa-jdi.jar
-	rm -rf $(AGENT_FILES_LIST)
--- a/hotspot/make/solaris/makefiles/saproc.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-#
-# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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 serviceability agent library, used by vm.make
-
-# libsaproc.so: serviceability agent
-
-SAPROC = saproc
-SADIS = sadis
-LIBSAPROC = lib$(SAPROC).so
-SADISOBJ = $(SADIS).o
-
-LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
-LIBSAPROC_DIZ         = lib$(SAPROC).diz
-
-AGENT_DIR = $(GAMMADIR)/agent
-
-SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)/proc
-
-SASRCFILES = $(SASRCDIR)/saproc.cpp
-
-SADISSRCFILES = $(AGENT_DIR)/src/share/native/sadis.c
-
-SAMAPFILE = $(SASRCDIR)/mapfile
-
-DEST_SAPROC           = $(JDK_LIBDIR)/$(LIBSAPROC)
-DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
-DEST_SAPROC_DIZ       = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
-
-# if $(AGENT_DIR) does not exist, we don't build SA
-
-ifneq ($(wildcard $(AGENT_DIR)),)
-  BUILDLIBSAPROC = $(LIBSAPROC)
-endif
-
-SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
-
-ifdef USE_GCC
-SA_LFLAGS += -D_REENTRANT
-else
-SA_LFLAGS += -mt -xnolib -norunpath
-endif
-
-# The libproc Pstack_iter() interface changed in Nevada-B159.
-# Use 'uname -r -v' to determine the Solaris version as per
-# Solaris Nevada team request. This logic needs to match:
-# agent/src/os/solaris/proc/saproc.cpp: set_has_newer_Pstack_iter():
-#   - skip SunOS 4 or older
-#   - skip Solaris 10 or older
-#   - skip two digit internal Nevada builds
-#   - skip three digit internal Nevada builds thru 149
-#   - skip internal Nevada builds 150-158
-#   - if not skipped, print define for Nevada-B159 or later
-SOLARIS_11_B159_OR_LATER := \
-$(shell uname -r -v \
-    | sed -n \
-          -e '/^[0-4]\. /b' \
-          -e '/^5\.[0-9] /b' \
-          -e '/^5\.10 /b' \
-          -e '/ snv_[0-9][0-9]$$/b' \
-          -e '/ snv_[01][0-4][0-9]$$/b' \
-          -e '/ snv_15[0-8]$$/b' \
-          -e 's/.*/-DSOLARIS_11_B159_OR_LATER/' \
-          -e 'p' \
-          )
-
-# Uncomment the following to simulate building on Nevada-B159 or later
-# when actually building on Nevada-B158 or earlier:
-#SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
-
-$(SADISOBJ): $(SADISSRCFILES)
-	           $(QUIETLY) $(CC)                                     \
-	           $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG)     \
-	           -I$(SASRCDIR)                                        \
-	           -I$(GENERATED)                                       \
-	           -I$(BOOT_JAVA_HOME)/include                          \
-	           -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
-	           $(SOLARIS_11_B159_OR_LATER)                          \
-	           $(EXTRA_CFLAGS)					\
-	           $(SADISSRCFILES)                                     \
-	           -c -o $(SADISOBJ)
-
-$(LIBSAPROC): $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
-	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
-	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
-	  exit 1; \
-	fi
-	@echo $(LOG_INFO) Making SA debugger back-end...
-	           $(QUIETLY) $(CXX)                                    \
-                   $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG)     \
-	           -I$(SASRCDIR)                                        \
-	           -I$(GENERATED)                                       \
-	           -I$(BOOT_JAVA_HOME)/include                          \
-	           -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
-	           $(SOLARIS_11_B159_OR_LATER)                          \
-	           $(EXTRA_CXXFLAGS) $(EXTRA_LDFLAGS)			\
-	           $(SADISOBJ)                                          \
-	           $(SASRCFILES)                                        \
-	           $(SA_LFLAGS)                                         \
-	           -o $@                                                \
-	           -ldl -ldemangle -lthread -lc
-
-ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
-  ifeq ($(STRIP_POLICY),all_strip)
-	$(QUIETLY) $(STRIP) $@
-  else
-    ifeq ($(STRIP_POLICY),min_strip)
-	$(QUIETLY) $(STRIP) -x $@
-    # implied else here is no stripping at all
-    endif
-  endif
-  ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
-	$(RM) $(LIBSAPROC_DEBUGINFO)
-  endif
-endif
-
-install_saproc: $(BULDLIBSAPROC)
-	$(QUIETLY) if [ -f $(LIBSAPROC) ] ; then                   \
-	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";           \
-	  test ! -f $(LIBSAPROC_DEBUGINFO) ||                      \
-	    $(CP) -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
-	  test ! -f $(LIBSAPROC_DIZ) ||                            \
-	    $(CP) -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ);             \
-	  $(CP) -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";        \
-	fi
-
-.PHONY: install_saproc
--- a/hotspot/make/solaris/makefiles/top.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/solaris/makefiles/top.make	Wed Nov 25 16:13:14 2015 +0000
@@ -28,7 +28,6 @@
 # It also:
 #   -builds and runs adlc via adlc.make
 #   -generates JVMTI source and docs via jvmti.make (JSR-163)
-#   -generate sa-jdi.jar (JDI binding to core files)
 
 # It assumes the following flags are set:
 # CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Jvm_Obj_Files
@@ -79,7 +78,7 @@
 	@echo All done.
 
 # This is an explicit dependency for the sake of parallel makes.
-vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff trace_stuff sa_stuff dtrace_stuff
+vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff trace_stuff dtrace_stuff
 	@# We need a null action here, so implicit rules don't get consulted.
 
 $(Cached_plat): $(Plat_File)
@@ -97,10 +96,6 @@
 trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f trace.make $(MFLAGS-adjusted)
 
-# generate SA jar files and native header
-sa_stuff:
-	@$(MAKE) -f sa.make $(MFLAGS-adjusted)
-
 dtrace_stuff: $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f dtrace.make dtrace_gen_headers $(MFLAGS-adjusted) GENERATED=$(GENERATED)
 
@@ -140,7 +135,7 @@
 	rm -fr $(GENERATED)
 
 .PHONY: default vm_build_preliminaries
-.PHONY: lists ad_stuff jvmti_stuff trace_stuff sa_stuff the_vm clean realclean
+.PHONY: lists ad_stuff jvmti_stuff trace_stuff the_vm clean realclean
 .PHONY: checks check_os_version install
 
 .NOTPARALLEL:
--- a/hotspot/make/solaris/makefiles/vm.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/solaris/makefiles/vm.make	Wed Nov 25 16:13:14 2015 +0000
@@ -55,7 +55,7 @@
 Src_Dirs_I += $(GENERATED)
 INCLUDES += $(Src_Dirs_I:%=-I%)
 
-# SYMFLAG is used by {dtrace,jsig,saproc}.make.
+# SYMFLAG is used by {dtrace,jsig}.make.
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   # always build with debug info when we can create .debuginfo files
   # and disable 'lazy debug info' so the .so has everything.
@@ -341,13 +341,10 @@
 # Signal interposition library
 include $(MAKEFILES_DIR)/jsig.make
 
-# Serviceability agent
-include $(MAKEFILES_DIR)/saproc.make
-
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) dtraceCheck
 
-install: install_jvm install_jsig install_saproc
+install: install_jvm install_jsig
 
 .PHONY: default build install install_jvm
--- a/hotspot/make/test/JtregNative.gmk	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/test/JtregNative.gmk	Wed Nov 25 16:13:14 2015 +0000
@@ -51,7 +51,8 @@
 # Add conditional directories here when needed.
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
 BUILD_HOTSPOT_JTREG_NATIVE_SRC += \
-    $(HOTSPOT_TOPDIR)/test/runtime/libadimalloc.solaris.sparc
+    $(HOTSPOT_TOPDIR)/test/runtime/libadimalloc.solaris.sparc \
+    $(HOTSPOT_TOPDIR)/test/runtime/ThreadSignalMask
 endif
 
 ifeq ($(TOOLCHAIN_TYPE), solstudio)
--- a/hotspot/make/windows/build.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/build.make	Wed Nov 25 16:13:14 2015 +0000
@@ -30,14 +30,6 @@
 # Note: Running nmake or build.bat from the Windows command shell requires
 # that "sh" be accessible on the PATH. An MKS install does this.
 
-# SA components are built if BUILD_WIN_SA=1 is specified.
-# See notes in README. This produces files:
-#  1. sa-jdi.jar       - This is built before building jvm.dll
-#  2. sawindbg.dll     - Native library for SA - This is built after jvm.dll
-#                      - Also, .lib, .map, .pdb.
-#
-# Please refer to ./makefiles/sa.make
-
 # If we haven't set an ARCH yet use x86
 # create.bat and build.bat will set it, if used.
 !ifndef ARCH
@@ -202,30 +194,6 @@
 !endif
 !endif
 
-# We don't support SA on ia64, and we can't
-# build it if we are using a version of Vis Studio
-# older than .Net 2003.
-# SA_INCLUDE and SA_LIB are hold-overs from a previous
-# implementation in which we could build SA using
-# Debugging Tools For Windows, in which the .h/.lib files
-# and the .dlls are in different places than
-# they are for Vis Studio .Net 2003.
-# If that code ever needs to be resurrected, these vars
-# can be set here.  They are used in makefiles/sa.make.
-
-checkSA::
-
-!if "$(BUILD_WIN_SA)" != "1"
-checkSA::
-	@echo     Not building SA:  BUILD_WIN_SA != 1
-
-!elseif "$(ARCH)" == "ia64"
-BUILD_WIN_SA = 0
-checkSA::
-	@echo     Not building SA:  ARCH = ia64
-
-!endif  # ! "$(BUILD_WIN_SA)" != "1"
-
 #########################################################################
 
 defaultTarget: product
@@ -282,10 +250,6 @@
 	@ echo HS_COPYRIGHT=$(HOTSPOT_VM_COPYRIGHT)		>> $@
 	@ echo HS_NAME=$(PRODUCT_NAME) $(JDK_MKTG_VERSION)	>> $@
 	@ echo HS_BUILD_VER=$(HS_BUILD_VER)			>> $@
-	@ echo BUILD_WIN_SA=$(BUILD_WIN_SA)    			>> $@
-	@ echo SA_BUILD_VERSION=$(HS_BUILD_VER)                 >> $@
-	@ echo SA_INCLUDE=$(SA_INCLUDE)      			>> $@
-	@ echo SA_LIB=$(SA_LIB)         			>> $@
 	@ echo JDK_VER=$(JDK_VER)				>> $@
 	@ echo JDK_DOTVER=$(JDK_DOTVER)				>> $@
 	@ echo JRE_RELEASE_VER=$(JRE_RELEASE_VER)		>> $@
@@ -304,7 +268,7 @@
 	@ if "$(MV)" NEQ "" echo MV=$(MV)                       >> $@
 	@ if "$(ZIPEXE)" NEQ "" echo ZIPEXE=$(ZIPEXE)           >> $@
 
-checks: checkVariant checkWorkSpace checkSA
+checks: checkVariant checkWorkSpace
 
 checkVariant:
 	@ if "$(Variant)"=="" echo Need to specify "Variant=[tiered|compiler2|compiler1|core]" && false
--- a/hotspot/make/windows/build_vm_def.sh	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/build_vm_def.sh	Wed Nov 25 16:13:14 2015 +0000
@@ -54,20 +54,6 @@
 DUMPBIN="link.exe /dump"
 export VS_UNICODE_OUTPUT= 
 
-if [ "$1" = "-nosa" ]; then
-    echo EXPORTS > vm.def
-    echo ""
-    echo "***"
-    echo "*** Not building SA: BUILD_WIN_SA != 1"
-    echo "*** C++ Vtables NOT included in vm.def"
-    echo "*** This jvm.dll will NOT work properly with SA."
-    echo "***"
-    echo "*** When in doubt, set BUILD_WIN_SA=1, clean and rebuild."
-    echo "***"
-    echo ""
-    exit
-fi
-
 echo "EXPORTS" > vm1.def
 
 # When called from IDE the first param should contain the link version, otherwise may be nill
--- a/hotspot/make/windows/makefiles/debug.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/debug.make	Wed Nov 25 16:13:14 2015 +0000
@@ -19,13 +19,12 @@
 # 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.
-#  
+#
 #
 
 HS_INTERNAL_NAME=jvm
 HS_FNAME=$(HS_INTERNAL_NAME).dll
 AOUT=$(HS_FNAME)
-SAWINDBG=sawindbg.dll
 GENERATED=../generated
 
 # Allow the user to turn off precompiled headers from the command line.
@@ -33,7 +32,7 @@
 BUILD_PCH_FILE=_build_pch_file.obj
 !endif
 
-default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
+default:: $(BUILD_PCH_FILE) $(AOUT)
 
 !include ../local.make
 !include compile.make
@@ -67,4 +66,3 @@
 !endif
 
 !include $(WorkSpace)/make/windows/makefiles/shared.make
-!include $(WorkSpace)/make/windows/makefiles/sa.make
--- a/hotspot/make/windows/makefiles/defs.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/defs.make	Wed Nov 25 16:13:14 2015 +0000
@@ -236,21 +236,6 @@
     ABS_OS_MAKEFILE := $(subst /,\\,$(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME);$(PWD))/build.make)
 endif
 
-# Disable building SA on windows until we are sure
-# we want to release it.  If we build it here,
-# the SDK makefiles will copy it over and put it into
-# the created image.
-BUILD_WIN_SA = 1
-ifneq ($(ALT_BUILD_WIN_SA),)
-  BUILD_WIN_SA = $(ALT_BUILD_WIN_SA)
-endif
-
-ifeq ($(BUILD_WIN_SA), 1)
-  ifeq ($(ARCH),ia64)
-    BUILD_WIN_SA = 0
-  endif
-endif
-
 EXPORT_SERVER_DIR = $(EXPORT_BIN_DIR)/server
 EXPORT_CLIENT_DIR = $(EXPORT_BIN_DIR)/client
 
@@ -281,21 +266,6 @@
 
 EXPORT_LIST += $(EXPORT_LIB_DIR)/jvm.lib
 
-ifeq ($(BUILD_WIN_SA), 1)
-  EXPORT_LIST += $(EXPORT_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX)
-  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-    ifeq ($(ZIP_DEBUGINFO_FILES),1)
-      EXPORT_LIST += $(EXPORT_BIN_DIR)/sawindbg.diz
-    else
-      EXPORT_LIST += $(EXPORT_BIN_DIR)/sawindbg.pdb
-      EXPORT_LIST += $(EXPORT_BIN_DIR)/sawindbg.map
-    endif
-  endif
-  EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
-  # Must pass this down to nmake.
-  MAKE_ARGS += BUILD_WIN_SA=1
-endif
-
 # Propagate compiler and tools paths from configure to nmake.
 # Need to make sure they contain \\ and not /.
 ifneq ($(SPEC),)
--- a/hotspot/make/windows/makefiles/fastdebug.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/fastdebug.make	Wed Nov 25 16:13:14 2015 +0000
@@ -19,13 +19,12 @@
 # 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.
-#  
+#
 #
 
 HS_INTERNAL_NAME=jvm
 HS_FNAME=$(HS_INTERNAL_NAME).dll
 AOUT=$(HS_FNAME)
-SAWINDBG=sawindbg.dll
 GENERATED=../generated
 
 # Allow the user to turn off precompiled headers from the command line.
@@ -33,7 +32,7 @@
 BUILD_PCH_FILE=_build_pch_file.obj
 !endif
 
-default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
+default:: $(BUILD_PCH_FILE) $(AOUT)
 
 !include ../local.make
 !include compile.make
@@ -66,4 +65,3 @@
 !endif
 
 !include $(WorkSpace)/make/windows/makefiles/shared.make
-!include $(WorkSpace)/make/windows/makefiles/sa.make
--- a/hotspot/make/windows/makefiles/generated.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/generated.make	Wed Nov 25 16:13:14 2015 +0000
@@ -19,7 +19,7 @@
 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 # or visit www.oracle.com if you need additional information or have any
 # questions.
-#  
+#
 #
 
 !include ../local.make
@@ -34,9 +34,6 @@
 TraceOutDir=tracefiles
 !include $(WorkSpace)/make/windows/makefiles/trace.make
 
-# Pick up rules for building SA
-!include $(WorkSpace)/make/windows/makefiles/sa.make
-
 AdlcOutDir=adfiles
 
 !if ("$(Variant)" == "compiler2") || ("$(Variant)" == "tiered")
--- a/hotspot/make/windows/makefiles/product.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/product.make	Wed Nov 25 16:13:14 2015 +0000
@@ -19,7 +19,7 @@
 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 # or visit www.oracle.com if you need additional information or have any
 # questions.
-#  
+#
 #
 
 HS_INTERNAL_NAME=jvm
@@ -32,7 +32,7 @@
 BUILD_PCH_FILE=_build_pch_file.obj
 !endif
 
-default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
+default:: $(BUILD_PCH_FILE) $(AOUT)
 
 !include ../local.make
 !include compile.make
@@ -69,4 +69,3 @@
 !endif
 
 !include $(WorkSpace)/make/windows/makefiles/shared.make
-!include $(WorkSpace)/make/windows/makefiles/sa.make
--- a/hotspot/make/windows/makefiles/projectcreator.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/projectcreator.make	Wed Nov 25 16:13:14 2015 +0000
@@ -90,10 +90,6 @@
         -disablePch        getThread_windows_$(Platform_arch).cpp \
         -disablePch_compiler2     opcodes.cpp
 
-!if "$(BUILD_WIN_SA)" != "1"
-BUILD_VM_DEF_FLAG=-nosa
-!endif
-
 # Common options for the IDE builds for c1, and c2
 ProjectCreatorIDEOptions=\
         $(ProjectCreatorIDEOptions) \
@@ -106,7 +102,7 @@
         -jdkTargetRoot $(HOTSPOTJDKDIST) \
         -define ALIGN_STACK_FRAMES \
         -define VM_LITTLE_ENDIAN \
-        -prelink  "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b	set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME)	set JAVA_HOME=$(HOTSPOTJDKDIST)	$(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(BUILD_VM_DEF_FLAG) $(LD_VER)" \
+        -prelink  "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b	set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME)	set JAVA_HOME=$(HOTSPOTJDKDIST)	$(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LD_VER)" \
         -ignoreFile jsig.c \
         -ignoreFile jvmtiEnvRecommended.cpp \
         -ignoreFile jvmtiEnvStub.cpp \
--- a/hotspot/make/windows/makefiles/sa.make	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-#
-# Copyright (c) 2003, 2015, 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 Serviceability Agent code
-# and generate JNI header file for native methods.
-
-AGENT_DIR = $(WorkSpace)/agent
-checkAndBuildSA::
-
-!if "$(BUILD_WIN_SA)" != "1"
-# Already warned about this in build.make
-!else
-
-# This first part is used to build sa-jdi.jar
-!include $(WorkSpace)/make/windows/makefiles/rules.make
-!include $(WorkSpace)/make/sa.files
-
-GENERATED = ../generated
-
-HS_COMMON_SRC_REL = src
-
-!if "$(OPENJDK)" != "true"
-HS_ALT_SRC_REL=src/closed
-HS_ALT_SRC = $(WorkSpace)/$(HS_ALT_SRC_REL)
-!ifndef HS_ALT_MAKE
-HS_ALT_MAKE=$(WorkSpace)/make/closed
-!endif
-!endif
-
-HS_COMMON_SRC = $(WorkSpace)/$(HS_COMMON_SRC_REL)
-
-!ifdef HS_ALT_MAKE
-!include $(HS_ALT_MAKE)/windows/makefiles/sa.make
-!endif
-
-# tools.jar is needed by the JDI - SA binding
-SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar
-
-SA_CLASSDIR = $(GENERATED)/saclasses
-
-SA_BUILD_VERSION_PROP = sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)
-
-SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
-
-default::  $(GENERATED)/sa-jdi.jar
-
-# Remove the space between $(SA_BUILD_VERSION_PROP) and > below as it adds a white space
-# at the end of SA version string and causes a version mismatch with the target VM version.
-
-$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
-	$(QUIETLY) mkdir -p $(SA_CLASSDIR)
-	@echo ...Building sa-jdi.jar into $(SA_CLASSDIR)
-	@echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) ....
-	@$(COMPILE_JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES)
-	$(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
-	$(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES)
-	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
-	$(QUIETLY) rm -rf $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) mkdir $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) $(CP) $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
-	$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)
-	$(RUN_JAR) cf $@ -C $(SA_CLASSDIR) .
-	$(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
-
-
-
-# This second part is used to build sawindbg.dll
-# We currently build it the same way for product, debug, and fastdebug.
-
-SAWINDBG=sawindbg.dll
-
-# Resource file containing VERSIONINFO
-SA_Res_Files=.\version.sares
-
-checkAndBuildSA:: $(SAWINDBG)
-
-# These do not need to be optimized (don't run a lot of code) and it
-# will be useful to have the assertion checks in place
-
-!if "$(BUILDARCH)" == "ia64"
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c
-!elseif "$(BUILDARCH)" == "amd64"
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c
-!else
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c
-!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
-SA_CFLAGS = $(SA_CFLAGS) -ZI
-!endif
-!endif
-!if "$(MT)" != ""
-SA_LD_FLAGS = -manifest $(SA_LD_FLAGS)
-!endif
-
-SASRCFILES = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp \
-		$(AGENT_DIR)/src/share/native/sadis.c
-
-SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE)
-!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
-SA_LFLAGS = $(SA_LFLAGS) -map -debug
-!endif
-!if "$(BUILDARCH)" == "i486"
-SA_LFLAGS = /SAFESEH $(SA_LFLAGS)
-!endif
-
-SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
-
-# Note that we do not keep sawindbj.obj around as it would then
-# get included in the dumpbin command in build_vm_def.sh
-
-# Force resources to be rebuilt every time
-$(SA_Res_Files): FORCE
-
-# In VS2005 or VS2008 the link command creates a .manifest file that we want
-# to insert into the linked artifact so we do not need to track it separately.
-# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
-$(SAWINDBG): $(SASRCFILES) $(SA_Res_Files)
-	set INCLUDE=$(SA_INCLUDE)$(INCLUDE)
-	$(CXX) @<<
-	  -I"$(BootStrapDir)/include" -I"$(BootStrapDir)/include/win32"
-	  -I"$(GENERATED)" $(SA_CFLAGS)
-	  $(SASRCFILES)
-	  -out:$*.obj
-<<
-	set LIB=$(SA_LIB)$(LIB)
-	$(LD) -out:$@ -DLL sawindbg.obj sadis.obj dbgeng.lib $(SA_LFLAGS) $(SA_Res_Files)
-!if "$(MT)" != ""
-	$(MT) -manifest $(@F).manifest -outputresource:$(@F);#2
-!endif
-!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
-!if "$(ZIP_DEBUGINFO_FILES)" == "1"
-	$(ZIPEXE) -q $*.diz $*.map $*.pdb
-	$(RM) $*.map $*.pdb
-!endif
-!endif
-	-@rm -f $*.obj
-
-{$(COMMONSRC)\os\windows\vm}.rc.sares:
-        @$(RC) $(RC_FLAGS) /D "HS_FNAME=$(SAWINDBG)" /fo"$@" $<
-
-cleanall :
-	rm -rf $(GENERATED)/saclasses
-	rm -rf $(GENERATED)/sa-jdi.jar
-!endif
--- a/hotspot/make/windows/makefiles/vm.make	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/make/windows/makefiles/vm.make	Wed Nov 25 16:13:14 2015 +0000
@@ -408,10 +408,5 @@
         @echo #include "precompiled.hpp" > ../generated/_build_pch_file.cpp
         $(CXX) $(CXX_FLAGS) /Fp"vm.pch" /Yc"precompiled.hpp" /c ../generated/_build_pch_file.cpp
 
-!if "$(BUILD_WIN_SA)" != "1"
-BUILD_VM_DEF_FLAG=-nosa
-!endif
-
 vm.def: $(Obj_Files)
-	sh $(WorkSpace)/make/windows/build_vm_def.sh $(BUILD_VM_DEF_FLAG)
-
+	sh $(WorkSpace)/make/windows/build_vm_def.sh
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -189,10 +189,11 @@
   get_cache_and_index_at_bcp(cache, index, bcp_offset, index_size);
   // We use a 32-bit load here since the layout of 64-bit words on
   // little-endian machines allow us that.
-  // n.b. unlike x86 cache alreeady includes the index offset
-  ldrw(bytecode, Address(cache,
+  // n.b. unlike x86 cache already includes the index offset
+  lea(bytecode, Address(cache,
                          ConstantPoolCache::base_offset()
                          + ConstantPoolCacheEntry::indices_offset()));
+  ldarw(bytecode, bytecode);
   const int shift_count = (1 + byte_no) * BitsPerByte;
   ubfx(bytecode, bytecode, shift_count, BitsPerByte);
 }
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -5254,7 +5254,13 @@
     // Note: HeapValidate executes two hardware breakpoints when it finds something
     // wrong; at these points, eax contains the address of the offending block (I think).
     // To get to the exlicit error message(s) below, just continue twice.
-    HANDLE heap = GetProcessHeap();
+    //
+    // Note:  we want to check the CRT heap, which is not necessarily located in the
+    // process default heap.
+    HANDLE heap = (HANDLE) _get_heap_handle();
+    if (!heap) {
+      return true;
+    }
 
     // If we fail to lock the heap, then gflags.exe has been used
     // or some other special heap flag has been set that prevents
@@ -5267,11 +5273,13 @@
             !HeapValidate(heap, 0, phe.lpData)) {
           tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter);
           tty->print_cr("corrupted block near address %#x, length %d", phe.lpData, phe.cbData);
+          HeapUnlock(heap);
           fatal("corrupted C heap");
         }
       }
       DWORD err = GetLastError();
       if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED) {
+        HeapUnlock(heap);
         fatal("heap walk aborted with error %d", err);
       }
       HeapUnlock(heap);
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -704,14 +704,13 @@
                                InstanceKlass*  holder,
                                Symbol*       name,
                                Symbol*       sig,
-                               Bytecodes::Code bc,
-                               constantTag    tag) {
+                               Bytecodes::Code bc) {
   EXCEPTION_CONTEXT;
   KlassHandle h_accessor(THREAD, accessor);
   KlassHandle h_holder(THREAD, holder);
   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
   methodHandle dest_method;
-  LinkInfo link_info(h_holder, name, sig, h_accessor, LinkInfo::needs_access_check, tag);
+  LinkInfo link_info(h_holder, name, sig, h_accessor, /*check_access*/true);
   switch (bc) {
   case Bytecodes::_invokestatic:
     dest_method =
@@ -797,9 +796,7 @@
 
     if (holder_is_accessible) {  // Our declared holder is loaded.
       InstanceKlass* lookup = declared_holder->get_instanceKlass();
-      constantTag tag = cpool->tag_ref_at(index);
-      assert(accessor->get_instanceKlass() == cpool->pool_holder(), "not the pool holder?");
-      Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc, tag);
+      Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc);
       if (m != NULL &&
           (bc == Bytecodes::_invokestatic
            ?  m->method_holder()->is_not_initialized()
--- a/hotspot/src/share/vm/ci/ciEnv.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -158,8 +158,7 @@
                            InstanceKlass*  holder,
                            Symbol*         name,
                            Symbol*         sig,
-                           Bytecodes::Code bc,
-                           constantTag     tag);
+                           Bytecodes::Code bc);
 
   // Get a ciObject from the object factory.  Ensures uniqueness
   // of ciObjects.
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -786,8 +786,7 @@
    Symbol* h_name      = name()->get_symbol();
    Symbol* h_signature = signature()->get_symbol();
 
-   LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass,
-                      check_access ? LinkInfo::needs_access_check : LinkInfo::skip_access_check);
+   LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass, check_access);
    methodHandle m;
    // Only do exact lookup if receiver klass has been linked.  Otherwise,
    // the vtable has not been setup, and the LinkResolver will fail.
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1693,7 +1693,7 @@
     if (id == AnnotationCollector::_unknown)  continue;
     coll->set_annotation(id);
 
-    if (id == AnnotationCollector::_sun_misc_Contended) {
+    if (id == AnnotationCollector::_jdk_internal_vm_annotation_Contended) {
       // @Contended can optionally specify the contention group.
       //
       // Contended group defines the equivalence class over the fields:
@@ -1767,10 +1767,10 @@
     if (_location != _in_field)   break;  // only allow for fields
     if (!privileged)              break;  // only allow in privileged code
     return _field_Stable;
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_vm_annotation_Contended_signature):
     if (_location != _in_field && _location != _in_class)          break;  // only allow for fields and classes
     if (!EnableContended || (RestrictContended && !privileged))    break;  // honor privileges
-    return _sun_misc_Contended;
+    return _jdk_internal_vm_annotation_Contended;
   default: break;
   }
   return AnnotationCollector::_unknown;
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -131,7 +131,7 @@
       _method_LambdaForm_Compiled,
       _method_LambdaForm_Hidden,
       _method_HotSpotIntrinsicCandidate,
-      _sun_misc_Contended,
+      _jdk_internal_vm_annotation_Contended,
       _field_Stable,
       _annotation_LIMIT
     };
@@ -164,7 +164,7 @@
     void set_contended_group(u2 group) { _contended_group = group; }
     u2 contended_group() const { return _contended_group; }
 
-    bool is_contended() const { return has_annotation(_sun_misc_Contended); }
+    bool is_contended() const { return has_annotation(_jdk_internal_vm_annotation_Contended); }
 
     void set_stable(bool stable) { set_annotation(_field_Stable); }
     bool is_stable() const { return has_annotation(_field_Stable); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/classListParser.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015, 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 "classfile/classListParser.hpp"
+#include "runtime/os.hpp"
+#include "runtime/java.hpp"
+
+ClassListParser::ClassListParser(const char* file) {
+  _classlist_file = file;
+  _file = fopen(file, "r");
+  if (_file == NULL) {
+    char errmsg[JVM_MAXPATHLEN];
+    os::lasterror(errmsg, JVM_MAXPATHLEN);
+    vm_exit_during_initialization("Loading classlist failed", errmsg);
+  }
+}
+
+ClassListParser::~ClassListParser() {
+  if (_file) {
+    fclose(_file);
+  }
+}
+
+bool ClassListParser::parse_one_line() {
+  for (;;) {
+    if (fgets(_line, sizeof(_line), _file) == NULL) {
+      return false;
+    }
+    int line_len = (int)strlen(_line);
+    if (line_len > _max_allowed_line_len) {
+      tty->print_cr("input line too long (must be no longer than %d chars)", _max_allowed_line_len);
+      vm_exit_during_initialization("Loading classlist failed");
+    }
+    if (*_line == '#') { // comment
+      continue;
+    }
+    break;
+  }
+
+  // Remove trailing \r\n
+  _line[strcspn(_line, "\r\n")] = 0;
+  return true;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/classListParser.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, 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_MEMORY_CLASSLISTPARSER_HPP
+#define SHARE_VM_MEMORY_CLASSLISTPARSER_HPP
+
+#include "utilities/exceptions.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+class ClassListParser : public StackObj {
+  enum {
+    // Max number of bytes allowed per line in the classlist.
+    // Theoretically Java class names could be 65535 bytes in length. In reality,
+    // 4K bytes is more than enough.
+    _max_allowed_line_len = 4096,
+    _line_buf_extra       = 10, // for detecting input too long
+    _line_buf_size        = _max_allowed_line_len + _line_buf_extra
+  };
+
+  const char* _classlist_file;
+  FILE* _file;
+  char  _line[_line_buf_size];  // The buffer that holds the current line.
+
+public:
+  ClassListParser(const char* file);
+  ~ClassListParser();
+  bool parse_one_line();
+
+  const char* current_class_name() {
+    return _line;
+  }
+};
+
+
+#endif // SHARE_VM_MEMORY_CLASSLISTPARSER_HPP
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -414,30 +414,30 @@
 }
 #endif
 
-void ClassLoader::trace_class_path(const char* msg, const char* name) {
+void ClassLoader::trace_class_path(outputStream* out, const char* msg, const char* name) {
   if (!TraceClassPaths) {
     return;
   }
 
   if (msg) {
-    tty->print("%s", msg);
+    out->print("%s", msg);
   }
   if (name) {
     if (strlen(name) < 256) {
-      tty->print("%s", name);
+      out->print("%s", name);
     } else {
       // For very long paths, we need to print each character separately,
       // as print_cr() has a length limit
       while (name[0] != '\0') {
-        tty->print("%c", name[0]);
+        out->print("%c", name[0]);
         name++;
       }
     }
   }
   if (msg && msg[0] == '[') {
-    tty->print_cr("]");
+    out->print_cr("]");
   } else {
-    tty->cr();
+    out->cr();
   }
 }
 
@@ -466,7 +466,7 @@
     // Don't print sys_class_path - this is the bootcp of this current VM process, not necessarily
     // the same as the bootcp of the shared archive.
   } else {
-    trace_class_path("[Bootstrap loader class path=", sys_class_path);
+    trace_class_path(tty, "[Bootstrap loader class path=", sys_class_path);
   }
 #if INCLUDE_CDS
   if (DumpSharedSpaces) {
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -328,7 +328,7 @@
   static void  exit_with_path_failure(const char* error, const char* message);
 #endif
 
-  static void  trace_class_path(const char* msg, const char* name = NULL);
+  static void  trace_class_path(outputStream* out, const char* msg, const char* name = NULL);
 
   // VM monitoring and management support
   static jlong classloader_time_ms();
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -82,7 +82,7 @@
   _keep_alive(is_anonymous || h_class_loader.is_null()),
   _metaspace(NULL), _unloading(false), _klasses(NULL),
   _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
-  _next(NULL), _dependencies(dependencies),
+  _next(NULL), _dependencies(dependencies), _shared_class_loader_id(-1),
   _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true,
                             Monitor::_safepoint_check_never)) {
     // empty
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -187,6 +187,9 @@
   // Support for walking class loader data objects
   ClassLoaderData* _next; /// Next loader_datas created
 
+  // CDS
+  int _shared_class_loader_id;
+
   // ReadOnly and ReadWrite metaspaces (static because only on the null
   // class loader for now).
   static Metaspace* _ro_metaspace;
@@ -308,6 +311,15 @@
   Metaspace* ro_metaspace();
   Metaspace* rw_metaspace();
   void initialize_shared_metaspaces();
+
+  int shared_class_loader_id() {
+    return _shared_class_loader_id;
+  }
+  void set_shared_class_loader_id(int id) {
+    assert(id >= 0, "sanity");
+    assert(_shared_class_loader_id <0, "cannot be assigned more than once");
+    _shared_class_loader_id = id;
+  }
 };
 
 // An iterator that distributes Klasses to parallel worker threads.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015, 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 "classfile/classListParser.hpp"
+#include "classfile/classLoaderExt.hpp"
+#include "classfile/symbolTable.hpp"
+#include "classfile/systemDictionary.hpp"
+
+
+Klass* ClassLoaderExt::load_one_class(ClassListParser* parser, TRAPS) {
+  TempNewSymbol class_name_symbol = SymbolTable::new_symbol(parser->current_class_name(), THREAD);
+  guarantee(!HAS_PENDING_EXCEPTION, "Exception creating a symbol.");
+  return SystemDictionary::resolve_or_null(class_name_symbol, THREAD);
+}
--- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -29,6 +29,8 @@
 #include "oops/instanceKlass.hpp"
 #include "runtime/handles.hpp"
 
+class ClassListParser;
+
 class ClassLoaderExt: public ClassLoader { // AllStatic
 public:
 
@@ -69,6 +71,7 @@
     ClassLoader::add_to_list(new_entry);
   }
   static void setup_search_paths() {}
+  static Klass* load_one_class(ClassListParser* parser, TRAPS);
 };
 
 #endif // SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP
--- a/hotspot/src/share/vm/classfile/compactHashtable.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/compactHashtable.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -137,7 +137,7 @@
   if (_type == CompactHashtable<Symbol*, char>::_symbol_table) {
     base_address = uintx(MetaspaceShared::shared_rs()->base());
     max_delta    = uintx(MetaspaceShared::shared_rs()->size());
-    assert(max_delta <= 0x7fffffff, "range check");
+    assert(max_delta <= MAX_SHARED_DELTA, "range check");
   } else {
     assert((_type == CompactHashtable<oop, char>::_string_table), "unknown table");
     assert(UseCompressedOops, "UseCompressedOops is required");
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -23,8 +23,10 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/sharedClassUtil.hpp"
 #include "classfile/dictionary.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "classfile/systemDictionaryShared.hpp"
 #include "memory/iterator.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
@@ -34,9 +36,16 @@
 DictionaryEntry*  Dictionary::_current_class_entry = NULL;
 int               Dictionary::_current_class_index =    0;
 
+size_t Dictionary::entry_size() {
+  if (DumpSharedSpaces) {
+    return SystemDictionaryShared::dictionary_entry_size();
+  } else {
+    return sizeof(DictionaryEntry);
+  }
+}
 
 Dictionary::Dictionary(int table_size)
-  : TwoOopHashtable<Klass*, mtClass>(table_size, sizeof(DictionaryEntry)) {
+  : TwoOopHashtable<Klass*, mtClass>(table_size, (int)entry_size()) {
   _current_class_index = 0;
   _current_class_entry = NULL;
   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
@@ -45,7 +54,7 @@
 
 Dictionary::Dictionary(int table_size, HashtableBucket<mtClass>* t,
                        int number_of_entries)
-  : TwoOopHashtable<Klass*, mtClass>(table_size, sizeof(DictionaryEntry), t, number_of_entries) {
+  : TwoOopHashtable<Klass*, mtClass>(table_size, (int)entry_size(), t, number_of_entries) {
   _current_class_index = 0;
   _current_class_entry = NULL;
   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
@@ -61,6 +70,9 @@
   entry->set_loader_data(loader_data);
   entry->set_pd_set(NULL);
   assert(klass->is_instance_klass(), "Must be");
+  if (DumpSharedSpaces) {
+    SystemDictionaryShared::init_shared_dictionary_entry(klass, entry);
+  }
   return entry;
 }
 
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -53,6 +53,7 @@
   DictionaryEntry* get_entry(int index, unsigned int hash,
                              Symbol* name, ClassLoaderData* loader_data);
 
+protected:
   DictionaryEntry* bucket(int i) {
     return (DictionaryEntry*)Hashtable<Klass*, mtClass>::bucket(i);
   }
@@ -66,6 +67,7 @@
     Hashtable<Klass*, mtClass>::add_entry(index, (HashtableEntry<Klass*, mtClass>*)new_entry);
   }
 
+  static size_t entry_size();
 public:
   Dictionary(int table_size);
   Dictionary(int table_size, HashtableBucket<mtClass>* t, int number_of_entries);
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1518,43 +1518,11 @@
 // After this many redefines, the stack trace is unreliable.
 const int MAX_VERSION = USHRT_MAX;
 
-// Helper backtrace functions to store bci|version together.
-static inline int merge_bci_and_version(int bci, int version) {
-  // only store u2 for version, checking for overflow.
-  if (version > USHRT_MAX || version < 0) version = MAX_VERSION;
-  assert((jushort)bci == bci, "bci should be short");
-  return build_int_from_shorts(version, bci);
-}
-
-static inline int bci_at(unsigned int merged) {
-  return extract_high_short_from_int(merged);
-}
-static inline int version_at(unsigned int merged) {
-  return extract_low_short_from_int(merged);
-}
-
 static inline bool version_matches(Method* method, int version) {
   assert(version < MAX_VERSION, "version is too big");
   return method != NULL && (method->constants()->version() == version);
 }
 
-static inline int get_line_number(Method* method, int bci) {
-  int line_number = 0;
-  if (method->is_native()) {
-    // Negative value different from -1 below, enabling Java code in
-    // class java.lang.StackTraceElement to distinguish "native" from
-    // "no LineNumberTable".  JDK tests for -2.
-    line_number = -2;
-  } else {
-    // Returns -1 if no LineNumberTable, and otherwise actual line number
-    line_number = method->line_number_from_bci(bci);
-    if (line_number == -1 && ShowHiddenFrames) {
-      line_number = bci + 1000000;
-    }
-  }
-  return line_number;
-}
-
 // This class provides a simple wrapper over the internal structure of
 // exception backtrace to insulate users of the backtrace from needing
 // to know what it looks like.
@@ -1676,7 +1644,7 @@
     }
 
     _methods->short_at_put(_index, method->orig_method_idnum());
-    _bcis->int_at_put(_index, merge_bci_and_version(bci, method->constants()->version()));
+    _bcis->int_at_put(_index, Backtrace::merge_bci_and_version(bci, method->constants()->version()));
     _cprefs->short_at_put(_index, method->name_index());
 
     // We need to save the mirrors in the backtrace to keep the class
@@ -1688,19 +1656,6 @@
 
 };
 
-Symbol* get_source_file_name(InstanceKlass* holder, int version) {
-  // Find the specific ik version that contains this source_file_name_index
-  // via the previous versions list, but use the current version's
-  // constant pool to look it up.  The previous version's index has been
-  // merged for the current constant pool.
-  InstanceKlass* ik = holder->get_klass_version(version);
-  // This version has been cleaned up.
-  if (ik == NULL) return NULL;
-  int source_file_name_index = ik->source_file_name_index();
-  return (source_file_name_index == 0) ?
-      (Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index);
-}
-
 // Print stack trace element to resource allocated buffer
 char* java_lang_Throwable::print_stack_element_to_buffer(Handle mirror,
                                   int method_id, int version, int bci, int cpref) {
@@ -1718,7 +1673,7 @@
   buf_len += (int)strlen(method_name);
 
   char* source_file_name = NULL;
-  Symbol* source = get_source_file_name(holder, version);
+  Symbol* source = Backtrace::get_source_file_name(holder, version);
   if (source != NULL) {
     source_file_name = source->as_C_string();
     buf_len += (int)strlen(source_file_name);
@@ -1733,7 +1688,7 @@
   if (!version_matches(method, version)) {
     strcat(buf, "(Redefined)");
   } else {
-    int line_number = get_line_number(method, bci);
+    int line_number = Backtrace::get_line_number(method, bci);
     if (line_number == -2) {
       strcat(buf, "(Native Method)");
     } else {
@@ -1802,8 +1757,8 @@
         // NULL mirror means end of stack trace
         if (mirror.is_null()) goto handle_cause;
         int method = methods->short_at(index);
-        int version = version_at(bcis->int_at(index));
-        int bci = bci_at(bcis->int_at(index));
+        int version = Backtrace::version_at(bcis->int_at(index));
+        int bci = Backtrace::bci_at(bcis->int_at(index));
         int cpref = cprefs->short_at(index);
         print_stack_element(st, mirror, method, version, bci, cpref);
       }
@@ -2090,8 +2045,8 @@
   assert(methods != NULL && bcis != NULL && mirrors != NULL, "sanity check");
 
   int method = methods->short_at(chunk_index);
-  int version = version_at(bcis->int_at(chunk_index));
-  int bci = bci_at(bcis->int_at(chunk_index));
+  int version = Backtrace::version_at(bcis->int_at(chunk_index));
+  int bci = Backtrace::bci_at(bcis->int_at(chunk_index));
   int cpref = cprefs->short_at(chunk_index);
   Handle mirror(THREAD, mirrors->obj_at(chunk_index));
 
@@ -2114,6 +2069,7 @@
   }
 
   Handle element = ik->allocate_instance_handle(CHECK_0);
+
   // Fill in class name
   ResourceMark rm(THREAD);
   InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror()));
@@ -2136,13 +2092,13 @@
     java_lang_StackTraceElement::set_lineNumber(element(), -1);
   } else {
     // Fill in source file name and line number.
-    Symbol* source = get_source_file_name(holder, version);
+    Symbol* source = Backtrace::get_source_file_name(holder, version);
     if (ShowHiddenFrames && source == NULL)
       source = vmSymbols::unknown_class_name();
     oop filename = StringTable::intern(source, CHECK_0);
     java_lang_StackTraceElement::set_fileName(element(), filename);
 
-    int line_number = get_line_number(method, bci);
+    int line_number = Backtrace::get_line_number(method, bci);
     java_lang_StackTraceElement::set_lineNumber(element(), line_number);
   }
   return element();
@@ -2155,6 +2111,108 @@
   return create(mirror, method_id, method->constants()->version(), bci, cpref, THREAD);
 }
 
+Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
+  if (MemberNameInStackFrame) {
+    Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
+    Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
+    // we should expand MemberName::name when Throwable uses StackTrace
+    // MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL);
+    return method;
+  } else {
+    short mid       = stackFrame->short_field(_mid_offset);
+    short version   = stackFrame->short_field(_version_offset);
+    return holder->method_with_orig_idnum(mid, version);
+  }
+}
+
+Symbol* java_lang_StackFrameInfo::get_file_name(Handle stackFrame, InstanceKlass* holder) {
+  if (MemberNameInStackFrame) {
+    return holder->source_file_name();
+  } else {
+    short version = stackFrame->short_field(_version_offset);
+    return Backtrace::get_source_file_name(holder, version);
+  }
+}
+
+void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci) {
+  // set Method* or mid/cpref
+  if (MemberNameInStackFrame) {
+    oop mname = stackFrame->obj_field(_memberName_offset);
+    InstanceKlass* ik = method->method_holder();
+    CallInfo info(method(), ik);
+    MethodHandles::init_method_MemberName(mname, info);
+  } else {
+    int mid = method->orig_method_idnum();
+    int cpref = method->name_index();
+    assert((jushort)mid == mid,        "mid should be short");
+    assert((jushort)cpref == cpref,    "cpref should be short");
+    java_lang_StackFrameInfo::set_mid(stackFrame(),     (short)mid);
+    java_lang_StackFrameInfo::set_cpref(stackFrame(),   (short)cpref);
+  }
+  // set bci
+  java_lang_StackFrameInfo::set_bci(stackFrame(), bci);
+  // method may be redefined; store the version
+  int version = method->constants()->version();
+  assert((jushort)version == version, "version should be short");
+  java_lang_StackFrameInfo::set_version(stackFrame(), (short)version);
+}
+
+void java_lang_StackFrameInfo::fill_methodInfo(Handle stackFrame, TRAPS) {
+  ResourceMark rm(THREAD);
+  oop k = stackFrame->obj_field(_declaringClass_offset);
+  InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(k));
+  Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK);
+  int bci = stackFrame->int_field(_bci_offset);
+
+  // The method can be NULL if the requested class version is gone
+  Symbol* sym = (method != NULL) ? method->name() : NULL;
+  if (MemberNameInStackFrame) {
+    assert(sym != NULL, "MemberName must have method name");
+  } else {
+      // The method can be NULL if the requested class version is gone
+    if (sym == NULL) {
+      short cpref   = stackFrame->short_field(_cpref_offset);
+      sym = holder->constants()->symbol_at(cpref);
+    }
+  }
+
+  // set method name
+  oop methodname = StringTable::intern(sym, CHECK);
+  java_lang_StackFrameInfo::set_methodName(stackFrame(), methodname);
+
+  // set file name and line number
+  Symbol* source = get_file_name(stackFrame, holder);
+  if (source != NULL) {
+    oop filename = StringTable::intern(source, CHECK);
+    java_lang_StackFrameInfo::set_fileName(stackFrame(), filename);
+  }
+
+  // if the method has been redefined, the bci is no longer applicable
+  short version = stackFrame->short_field(_version_offset);
+  if (version_matches(method, version)) {
+    int line_number = Backtrace::get_line_number(method, bci);
+    java_lang_StackFrameInfo::set_lineNumber(stackFrame(), line_number);
+  }
+}
+
+void java_lang_StackFrameInfo::compute_offsets() {
+  Klass* k = SystemDictionary::StackFrameInfo_klass();
+  compute_offset(_declaringClass_offset, k, vmSymbols::declaringClass_name(),  vmSymbols::class_signature());
+  compute_offset(_memberName_offset,     k, vmSymbols::memberName_name(),  vmSymbols::object_signature());
+  compute_offset(_bci_offset,            k, vmSymbols::bci_name(),         vmSymbols::int_signature());
+  compute_offset(_methodName_offset,     k, vmSymbols::methodName_name(),  vmSymbols::string_signature());
+  compute_offset(_fileName_offset,       k, vmSymbols::fileName_name(),    vmSymbols::string_signature());
+  compute_offset(_lineNumber_offset,     k, vmSymbols::lineNumber_name(),  vmSymbols::int_signature());
+  STACKFRAMEINFO_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
+}
+
+void java_lang_LiveStackFrameInfo::compute_offsets() {
+  Klass* k = SystemDictionary::LiveStackFrameInfo_klass();
+  compute_offset(_monitors_offset,   k, vmSymbols::monitors_name(),    vmSymbols::object_array_signature());
+  compute_offset(_locals_offset,     k, vmSymbols::locals_name(),      vmSymbols::object_array_signature());
+  compute_offset(_operands_offset,   k, vmSymbols::operands_name(),    vmSymbols::object_array_signature());
+}
+
 void java_lang_reflect_AccessibleObject::compute_offsets() {
   Klass* k = SystemDictionary::reflect_AccessibleObject_klass();
   compute_offset(override_offset, k, vmSymbols::override_name(), vmSymbols::bool_signature());
@@ -3471,6 +3529,18 @@
 int java_lang_StackTraceElement::methodName_offset;
 int java_lang_StackTraceElement::fileName_offset;
 int java_lang_StackTraceElement::lineNumber_offset;
+int java_lang_StackFrameInfo::_declaringClass_offset;
+int java_lang_StackFrameInfo::_memberName_offset;
+int java_lang_StackFrameInfo::_bci_offset;
+int java_lang_StackFrameInfo::_methodName_offset;
+int java_lang_StackFrameInfo::_fileName_offset;
+int java_lang_StackFrameInfo::_lineNumber_offset;
+int java_lang_StackFrameInfo::_mid_offset;
+int java_lang_StackFrameInfo::_version_offset;
+int java_lang_StackFrameInfo::_cpref_offset;
+int java_lang_LiveStackFrameInfo::_monitors_offset;
+int java_lang_LiveStackFrameInfo::_locals_offset;
+int java_lang_LiveStackFrameInfo::_operands_offset;
 int java_lang_AssertionStatusDirectives::classes_offset;
 int java_lang_AssertionStatusDirectives::classEnabled_offset;
 int java_lang_AssertionStatusDirectives::packages_offset;
@@ -3500,6 +3570,50 @@
   element->int_field_put(lineNumber_offset, value);
 }
 
+// Support for java_lang_StackFrameInfo
+void java_lang_StackFrameInfo::set_declaringClass(oop element, oop value) {
+  element->obj_field_put(_declaringClass_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_mid(oop element, short value) {
+  element->short_field_put(_mid_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_version(oop element, short value) {
+  element->short_field_put(_version_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_cpref(oop element, short value) {
+  element->short_field_put(_cpref_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_bci(oop element, int value) {
+  element->int_field_put(_bci_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_fileName(oop element, oop value) {
+  element->obj_field_put(_fileName_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_methodName(oop element, oop value) {
+  element->obj_field_put(_methodName_offset, value);
+}
+
+void java_lang_StackFrameInfo::set_lineNumber(oop element, int value) {
+  element->int_field_put(_lineNumber_offset, value);
+}
+
+void java_lang_LiveStackFrameInfo::set_monitors(oop element, oop value) {
+  element->obj_field_put(_monitors_offset, value);
+}
+
+void java_lang_LiveStackFrameInfo::set_locals(oop element, oop value) {
+  element->obj_field_put(_locals_offset, value);
+}
+
+void java_lang_LiveStackFrameInfo::set_operands(oop element, oop value) {
+  element->obj_field_put(_operands_offset, value);
+}
 
 // Support for java Assertions - java_lang_AssertionStatusDirectives.
 
@@ -3633,6 +3747,8 @@
   sun_reflect_ConstantPool::compute_offsets();
   sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
   java_lang_reflect_Parameter::compute_offsets();
+  java_lang_StackFrameInfo::compute_offsets();
+  java_lang_LiveStackFrameInfo::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1359,6 +1359,85 @@
 };
 
 
+class Backtrace: AllStatic {
+ public:
+  // Helper backtrace functions to store bci|version together.
+  static int merge_bci_and_version(int bci, int version);
+  static int merge_mid_and_cpref(int mid, int cpref);
+  static int bci_at(unsigned int merged);
+  static int version_at(unsigned int merged);
+  static int mid_at(unsigned int merged);
+  static int cpref_at(unsigned int merged);
+  static int get_line_number(const methodHandle& method, int bci);
+  static Symbol* get_source_file_name(InstanceKlass* holder, int version);
+
+  // Debugging
+  friend class JavaClasses;
+};
+
+// Interface to java.lang.StackFrameInfo objects
+
+#define STACKFRAMEINFO_INJECTED_FIELDS(macro)                      \
+  macro(java_lang_StackFrameInfo, mid,     short_signature, false) \
+  macro(java_lang_StackFrameInfo, version, short_signature, false) \
+  macro(java_lang_StackFrameInfo, cpref,   short_signature, false)
+
+class java_lang_StackFrameInfo: AllStatic {
+private:
+  static int _declaringClass_offset;
+  static int _memberName_offset;
+  static int _bci_offset;
+  static int _methodName_offset;
+  static int _fileName_offset;
+  static int _lineNumber_offset;
+
+  static int _mid_offset;
+  static int _version_offset;
+  static int _cpref_offset;
+
+  static Method* get_method(Handle stackFrame, InstanceKlass* holder, TRAPS);
+  static Symbol* get_file_name(Handle stackFrame, InstanceKlass* holder);
+
+public:
+  // Setters
+  static void set_declaringClass(oop info, oop value);
+  static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci);
+  static void set_bci(oop info, int value);
+
+  // set method info in an instance of StackFrameInfo
+  static void fill_methodInfo(Handle info, TRAPS);
+  static void set_methodName(oop info, oop value);
+  static void set_fileName(oop info, oop value);
+  static void set_lineNumber(oop info, int value);
+
+  // these injected fields are only used if -XX:-MemberNameInStackFrame set
+  static void set_mid(oop info, short value);
+  static void set_version(oop info, short value);
+  static void set_cpref(oop info, short value);
+
+  static void compute_offsets();
+
+  // Debugging
+  friend class JavaClasses;
+};
+
+class java_lang_LiveStackFrameInfo: AllStatic {
+ private:
+  static int _monitors_offset;
+  static int _locals_offset;
+  static int _operands_offset;
+
+ public:
+  static void set_monitors(oop info, oop value);
+  static void set_locals(oop info, oop value);
+  static void set_operands(oop info, oop value);
+
+  static void compute_offsets();
+
+  // Debugging
+  friend class JavaClasses;
+};
+
 // Interface to java.lang.AssertionStatusDirectives objects
 
 class java_lang_AssertionStatusDirectives: AllStatic {
@@ -1442,7 +1521,9 @@
   CLASS_INJECTED_FIELDS(macro)              \
   CLASSLOADER_INJECTED_FIELDS(macro)        \
   MEMBERNAME_INJECTED_FIELDS(macro)         \
-  CALLSITECONTEXT_INJECTED_FIELDS(macro)
+  CALLSITECONTEXT_INJECTED_FIELDS(macro)    \
+  STACKFRAMEINFO_INJECTED_FIELDS(macro)
+
 
 // Interface to hard-coded offset checking
 
--- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -73,4 +73,67 @@
   return obj != NULL && is_subclass(obj->klass());
 }
 
+inline int Backtrace::merge_bci_and_version(int bci, int version) {
+  // only store u2 for version, checking for overflow.
+  if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
+  assert((jushort)bci == bci, "bci should be short");
+  return build_int_from_shorts(version, bci);
+}
+
+inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) {
+  // only store u2 for mid and cpref, checking for overflow.
+  assert((jushort)mid == mid, "mid should be short");
+  assert((jushort)cpref == cpref, "cpref should be short");
+  return build_int_from_shorts(cpref, mid);
+}
+
+inline int Backtrace::bci_at(unsigned int merged) {
+  return extract_high_short_from_int(merged);
+}
+
+inline int Backtrace::version_at(unsigned int merged) {
+  return extract_low_short_from_int(merged);
+}
+
+inline int Backtrace::mid_at(unsigned int merged) {
+  return extract_high_short_from_int(merged);
+}
+
+inline int Backtrace::cpref_at(unsigned int merged) {
+  return extract_low_short_from_int(merged);
+}
+
+inline int Backtrace::get_line_number(const methodHandle& method, int bci) {
+  int line_number = 0;
+  if (method->is_native()) {
+    // Negative value different from -1 below, enabling Java code in
+    // class java.lang.StackTraceElement to distinguish "native" from
+    // "no LineNumberTable".  JDK tests for -2.
+    line_number = -2;
+  } else {
+    // Returns -1 if no LineNumberTable, and otherwise actual line number
+    line_number = method->line_number_from_bci(bci);
+    if (line_number == -1 && ShowHiddenFrames) {
+      line_number = bci + 1000000;
+    }
+  }
+  return line_number;
+}
+
+/*
+ * Returns the source file name of a given InstanceKlass and version
+ */
+inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) {
+  // Find the specific ik version that contains this source_file_name_index
+  // via the previous versions list, but use the current version's
+  // constant pool to look it up.  The previous version's index has been
+  // merged for the current constant pool.
+  InstanceKlass* ik = holder->get_klass_version(version);
+  // This version has been cleaned up.
+  if (ik == NULL) return NULL;
+  int source_file_name_index = ik->source_file_name_index();
+  return (source_file_name_index == 0) ?
+      (Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index);
+}
+
 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -67,7 +67,7 @@
 }
 
 bool SharedPathsMiscInfo::fail(const char* msg, const char* name) {
-  ClassLoader::trace_class_path(msg, name);
+  ClassLoader::trace_class_path(tty, msg, name);
   MetaspaceShared::set_archive_loading_failed();
   return false;
 }
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
 #define SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
 
+#include "classfile/classLoader.hpp"
 #include "runtime/os.hpp"
 
 // During dumping time, when processing class paths, we build up the dump-time
@@ -64,7 +65,7 @@
   bool read(void* ptr, size_t size);
 
   static void trace_class_path(const char* msg, const char* name = NULL) {
-    ClassLoader::trace_class_path(msg, name);
+    ClassLoader::trace_class_path(tty, msg, name);
   }
 protected:
   static bool fail(const char* msg, const char* name = NULL);
@@ -106,19 +107,6 @@
     add_path(path, NON_EXIST);
   }
 
-  // The path must exist and have required size and modification time
-  void add_required_file(const char* path) {
-    add_path(path, REQUIRED);
-
-    struct stat st;
-    if (os::stat(path, &st) != 0) {
-      assert(0, "sanity");
-      ClassLoader::exit_with_path_failure("failed to os::stat(%s)", path); // should not happen
-    }
-    write_time(st.st_mtime);
-    write_long(st.st_size);
-  }
-
   // The path must exist, and must contain exactly <num_entries> files/dirs
   void add_boot_classpath(const char* path) {
     add_path(path, BOOT);
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -97,7 +97,7 @@
 int SymbolTable::_symbols_counted = 0;
 volatile int SymbolTable::_parallel_claimed_idx = 0;
 
-void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int* removed, size_t* memory_total) {
+void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int* removed) {
   for (int i = start_idx; i < end_idx; ++i) {
     HashtableEntry<Symbol*, mtSymbol>** p = the_table()->bucket_addr(i);
     HashtableEntry<Symbol*, mtSymbol>* entry = the_table()->bucket(i);
@@ -110,7 +110,6 @@
         break;
       }
       Symbol* s = entry->literal();
-      (*memory_total) += s->size();
       (*processed)++;
       assert(s != NULL, "just checking");
       // If reference count is zero, remove.
@@ -133,15 +132,9 @@
 // This is done late during GC.
 void SymbolTable::unlink(int* processed, int* removed) {
   size_t memory_total = 0;
-  buckets_unlink(0, the_table()->table_size(), processed, removed, &memory_total);
+  buckets_unlink(0, the_table()->table_size(), processed, removed);
   _symbols_removed += *removed;
   _symbols_counted += *processed;
-  // Exclude printing for normal PrintGCDetails because people parse
-  // this output.
-  if (PrintGCDetails && Verbose && WizardMode) {
-    gclog_or_tty->print(" [Symbols=%d size=" SIZE_FORMAT "K] ", *processed,
-                        (memory_total*HeapWordSize)/1024);
-  }
 }
 
 void SymbolTable::possibly_parallel_unlink(int* processed, int* removed) {
@@ -158,16 +151,10 @@
     }
 
     int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_unlink(start_idx, end_idx, processed, removed, &memory_total);
+    buckets_unlink(start_idx, end_idx, processed, removed);
   }
   Atomic::add(*processed, &_symbols_counted);
   Atomic::add(*removed, &_symbols_removed);
-  // Exclude printing for normal PrintGCDetails because people parse
-  // this output.
-  if (PrintGCDetails && Verbose && WizardMode) {
-    gclog_or_tty->print(" [Symbols: scanned=%d removed=%d size=" SIZE_FORMAT "K] ", *processed, *removed,
-                        (memory_total*HeapWordSize)/1024);
-  }
 }
 
 // Create a new table and using alternate hash code, populate the new table
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -132,7 +132,7 @@
   static volatile int _parallel_claimed_idx;
 
   // Release any dead symbols
-  static void buckets_unlink(int start_idx, int end_idx, int* processed, int* removed, size_t* memory_total);
+  static void buckets_unlink(int start_idx, int end_idx, int* processed, int* removed);
 public:
   enum {
     symbol_alloc_batch_size = 8,
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -322,6 +322,17 @@
                                                  Handle protection_domain,
                                                  bool is_superclass,
                                                  TRAPS) {
+#if INCLUDE_CDS
+  if (DumpSharedSpaces) {
+    // Special processing for CDS dump time.
+    Klass* k = SystemDictionaryShared::dump_time_resolve_super_or_fail(child_name,
+        class_name, class_loader, protection_domain, is_superclass, CHECK_NULL);
+    if (k) {
+      return k;
+    }
+  }
+#endif // INCLUDE_CDS
+
   // Double-check, if child class is already loaded, just return super-class,interface
   // Don't add a placedholder if already loaded, i.e. already in system dictionary
   // Make sure there's a placeholder for the *child* before resolving.
@@ -1079,12 +1090,30 @@
   //
   // Note: "name" is updated.
 
-  instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
-                                                             loader_data,
-                                                             protection_domain,
-                                                             parsed_name,
-                                                             verify,
-                                                             THREAD);
+  instanceKlassHandle k;
+
+#if INCLUDE_CDS
+  k = SystemDictionaryShared::lookup_from_stream(class_name,
+                                                 class_loader,
+                                                 protection_domain,
+                                                 st,
+                                                 verify,
+                                                 CHECK_NULL);
+#endif
+
+  if (k.not_null()) {
+    parsed_name = k->name();
+  } else {
+    if (st->buffer() == NULL) {
+      return NULL;
+    }
+    k = ClassFileParser(st).parseClassFile(class_name,
+                                           loader_data,
+                                           protection_domain,
+                                           parsed_name,
+                                           verify,
+                                           THREAD);
+  }
 
   const char* pkg = "java/";
   if (!HAS_PENDING_EXCEPTION &&
@@ -1201,8 +1230,13 @@
 
     if (ik->super() != NULL) {
       Symbol*  cn = ik->super()->name();
-      resolve_super_or_fail(class_name, cn,
-                            class_loader, protection_domain, true, CHECK_(nh));
+      Klass *s = resolve_super_or_fail(class_name, cn,
+                                       class_loader, protection_domain, true, CHECK_(nh));
+      if (s != ik->super()) {
+        // The dynamically resolved super class is not the same as the one we used during dump time,
+        // so we cannot use ik.
+        return nh;
+      }
     }
 
     Array<Klass*>* interfaces = ik->local_interfaces();
@@ -1215,7 +1249,12 @@
       // reinitialized yet (they will be once the interface classes
       // are loaded)
       Symbol*  name  = k->name();
-      resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh));
+      Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh));
+      if (k != i) {
+        // The dynamically resolved interface class is not the same as the one we used during dump time,
+        // so we cannot use ik.
+        return nh;
+      }
     }
 
     // Adjust methods to recover missing data.  They need addresses for
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -27,6 +27,7 @@
 
 #include "classfile/classFileStream.hpp"
 #include "classfile/classLoader.hpp"
+#include "classfile/systemDictionary_ext.hpp"
 #include "oops/objArrayOop.hpp"
 #include "oops/symbol.hpp"
 #include "runtime/java.hpp"
@@ -179,11 +180,17 @@
   do_klass(sun_misc_Launcher_klass,                     sun_misc_Launcher,                         Pre                 ) \
   do_klass(CodeSource_klass,                            java_security_CodeSource,                  Pre                 ) \
                                                                                                                          \
-  /* It's NULL in non-1.4 JDKs. */                                                                                       \
   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
+                                                                                                                         \
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
                                                                                                                          \
+  /* Stack Walking */                                                                                                    \
+  do_klass(StackWalker_klass,                           java_lang_StackWalker,                     Opt                 ) \
+  do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker, Opt          ) \
+  do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo,                  Opt                 ) \
+  do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo,              Opt                 ) \
+                                                                                                                         \
   /* Preload boxing klasses */                                                                                           \
   do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
   do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
@@ -194,15 +201,18 @@
   do_klass(Integer_klass,                               java_lang_Integer,                         Pre                 ) \
   do_klass(Long_klass,                                  java_lang_Long,                            Pre                 ) \
                                                                                                                          \
+  /* Extensions */                                                                                                       \
+  WK_KLASSES_DO_EXT(do_klass)                                                                                            \
   /* JVMCI classes. These are loaded on-demand. */                                                                       \
-  JVMCI_WK_KLASSES_DO(do_klass) \
-
+  JVMCI_WK_KLASSES_DO(do_klass)                                                                                          \
+                                                                                                                         \
   /*end*/
 
 
 class SystemDictionary : AllStatic {
   friend class VMStructs;
   friend class SystemDictionaryHandles;
+  friend class SharedClassUtil;
 
  public:
   enum WKID {
@@ -667,11 +677,6 @@
   // Basic find on classes in the midst of being loaded
   static Symbol* find_placeholder(Symbol* name, ClassLoaderData* loader_data);
 
-  // Updating entry in dictionary
-  // Add a completely loaded class
-  static void add_klass(int index, Symbol* class_name,
-                        ClassLoaderData* loader_data, KlassHandle obj);
-
   // Add a placeholder for a class being loaded
   static void add_placeholder(int index,
                               Symbol* class_name,
--- a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -22,11 +22,13 @@
  *
  */
 
-
 #ifndef SHARE_VM_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP
 #define SHARE_VM_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP
 
 #include "classfile/systemDictionary.hpp"
+#include "classfile/dictionary.hpp"
+
+class ClassFileStream;
 
 class SystemDictionaryShared: public SystemDictionary {
 public:
@@ -42,6 +44,30 @@
     oop class_loader = loader_data->class_loader();
     return (class_loader == NULL);
   }
+
+  static Klass* dump_time_resolve_super_or_fail(Symbol* child_name,
+                                                Symbol* class_name,
+                                                Handle class_loader,
+                                                Handle protection_domain,
+                                                bool is_superclass,
+                                                TRAPS) {
+    return NULL;
+  }
+
+  static size_t dictionary_entry_size() {
+    return sizeof(DictionaryEntry);
+  }
+
+  static void init_shared_dictionary_entry(Klass* k, DictionaryEntry* entry) {}
+
+  static InstanceKlass* lookup_from_stream(Symbol* class_name,
+                                           Handle class_loader,
+                                           Handle protection_domain,
+                                           ClassFileStream* st,
+                                           bool verify,
+                                           TRAPS) {
+    return NULL;
+  }
 };
 
 #endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/systemDictionary_ext.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, 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_CLASSFILE_SYSTEMDICTIONARY_EXT_HPP
+#define SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_EXT_HPP
+
+#define WK_KLASSES_DO_EXT(do_klass)
+
+#endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_EXT_HPP
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
 #define SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
 
+#include "classfile/vmSymbols_ext.hpp"
 #include "oops/symbol.hpp"
 #include "memory/iterator.hpp"
 #include "trace/traceMacros.hpp"
@@ -209,7 +210,7 @@
   template(java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater,    "java/util/concurrent/atomic/AtomicLongFieldUpdater$CASUpdater") \
   template(java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater, "java/util/concurrent/atomic/AtomicLongFieldUpdater$LockedUpdater") \
   template(java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl,     "java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl") \
-  template(sun_misc_Contended_signature,              "Lsun/misc/Contended;")                     \
+  template(jdk_internal_vm_annotation_Contended_signature,                   "Ljdk/internal/vm/annotation/Contended;")    \
                                                                                                   \
   /* class symbols needed by intrinsics */                                                        \
   VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, template, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) \
@@ -310,6 +311,22 @@
   /* Support for JVMCI */                                                                                                             \
   JVMCI_VM_SYMBOLS_DO(template, do_alias)                                                         \
                                                                                                   \
+  template(java_lang_StackWalker,                     "java/lang/StackWalker")                    \
+  template(java_lang_StackFrameInfo,                  "java/lang/StackFrameInfo")                 \
+  template(java_lang_LiveStackFrameInfo,              "java/lang/LiveStackFrameInfo")             \
+  template(java_lang_StackStreamFactory_AbstractStackWalker, "java/lang/StackStreamFactory$AbstractStackWalker") \
+  template(doStackWalk_name,                          "doStackWalk")                              \
+  template(doStackWalk_signature,                     "(JIIII)Ljava/lang/Object;")                \
+  template(asPrimitive_name,                          "asPrimitive")                              \
+  template(asPrimitive_int_signature,                 "(I)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_long_signature,                "(J)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_short_signature,               "(S)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_byte_signature,                "(B)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_char_signature,                "(C)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_float_signature,               "(F)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_double_signature,              "(D)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_boolean_signature,             "(Z)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+                                                                                                  \
   /* common method and field names */                                                             \
   template(object_initializer_name,                   "<init>")                                   \
   template(class_initializer_name,                    "<clinit>")                                 \
@@ -410,6 +427,18 @@
   template(append_name,                               "append")                                   \
   template(klass_name,                                "klass")                                    \
   template(array_klass_name,                          "array_klass")                              \
+  template(declaringClass_name,                       "declaringClass")                           \
+  template(memberName_name,                           "memberName")                               \
+  template(mid_name,                                  "mid")                                      \
+  template(cpref_name,                                "cpref")                                    \
+  template(version_name,                              "version")                                  \
+  template(bci_name,                                  "bci")                                      \
+  template(methodName_name,                           "methodName")                               \
+  template(fileName_name,                             "fileName")                                 \
+  template(lineNumber_name,                           "lineNumber")                               \
+  template(monitors_name,                             "monitors")                                 \
+  template(locals_name,                               "locals")                                   \
+  template(operands_name,                             "operands")                                 \
   template(oop_size_name,                             "oop_size")                                 \
   template(static_oop_field_count_name,               "static_oop_field_count")                   \
   template(protection_domain_name,                    "protection_domain")                        \
@@ -514,6 +543,7 @@
   template(class_array_signature,                     "[Ljava/lang/Class;")                                       \
   template(classloader_signature,                     "Ljava/lang/ClassLoader;")                                  \
   template(object_signature,                          "Ljava/lang/Object;")                                       \
+  template(object_array_signature,                    "[Ljava/lang/Object;")                                      \
   template(class_signature,                           "Ljava/lang/Class;")                                        \
   template(string_signature,                          "Ljava/lang/String;")                                       \
   template(reference_signature,                       "Ljava/lang/ref/Reference;")                                \
@@ -617,6 +647,9 @@
   /* trace signatures */                                                                                          \
   TRACE_TEMPLATES(template)                                                                                       \
                                                                                                                   \
+  /* extensions */                                                                                                \
+  VM_SYMBOLS_DO_EXT(template, do_alias)                                                                           \
+                                                                                                                  \
   /*end*/
 
 // Here are all the intrinsics known to the runtime and the CI.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols_ext.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, 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_CLASSFILE_VMSYMBOLS_EXT_HPP
+#define SHARE_VM_CLASSFILE_VMSYMBOLS_EXT_HPP
+
+#define VM_SYMBOLS_DO_EXT(template, do_alias)
+
+#endif // SHARE_VM_CLASSFILE_VMSYMBOLS_EXT_HPP
+
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -74,9 +74,7 @@
   addr = (HeapWord*)align_size_up((intptr_t)addr,
                                   HeapWordSize << _shifter);
   size_t addrOffset = heapWordToOffset(addr);
-  if (limit == NULL) {
-    limit = _bmStartWord + _bmWordSize;
-  }
+  assert(limit != NULL, "limit must not be NULL");
   size_t limitOffset = heapWordToOffset(limit);
   size_t nextOffset = _bm.get_next_one_offset(addrOffset, limitOffset);
   HeapWord* nextAddr = offsetToHeapWord(nextOffset);
@@ -86,26 +84,6 @@
   return nextAddr;
 }
 
-HeapWord* CMBitMapRO::getNextUnmarkedWordAddress(const HeapWord* addr,
-                                                 const HeapWord* limit) const {
-  size_t addrOffset = heapWordToOffset(addr);
-  if (limit == NULL) {
-    limit = _bmStartWord + _bmWordSize;
-  }
-  size_t limitOffset = heapWordToOffset(limit);
-  size_t nextOffset = _bm.get_next_zero_offset(addrOffset, limitOffset);
-  HeapWord* nextAddr = offsetToHeapWord(nextOffset);
-  assert(nextAddr >= addr, "get_next_one postcondition");
-  assert(nextAddr == limit || !isMarked(nextAddr),
-         "get_next_one postcondition");
-  return nextAddr;
-}
-
-int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const {
-  assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
-  return (int) (diff >> _shifter);
-}
-
 #ifndef PRODUCT
 bool CMBitMapRO::covers(MemRegion heap_rs) const {
   // assert(_bm.map() == _virtual_space.low(), "map inconsistency");
@@ -211,17 +189,6 @@
   return;
 }
 
-void CMBitMap::markRange(MemRegion mr) {
-  mr.intersection(MemRegion(_bmStartWord, _bmWordSize));
-  assert(!mr.is_empty(), "unexpected empty region");
-  assert((offsetToHeapWord(heapWordToOffset(mr.end())) ==
-          ((HeapWord *) mr.end())),
-         "markRange memory region end is not card aligned");
-  // convert address range into offset range
-  _bm.at_put_range(heapWordToOffset(mr.start()),
-                   heapWordToOffset(mr.end()), true);
-}
-
 void CMBitMap::clearRange(MemRegion mr) {
   mr.intersection(MemRegion(_bmStartWord, _bmWordSize));
   assert(!mr.is_empty(), "unexpected empty region");
@@ -230,20 +197,6 @@
                    heapWordToOffset(mr.end()), false);
 }
 
-MemRegion CMBitMap::getAndClearMarkedRegion(HeapWord* addr,
-                                            HeapWord* end_addr) {
-  HeapWord* start = getNextMarkedWordAddress(addr);
-  start = MIN2(start, end_addr);
-  HeapWord* end   = getNextUnmarkedWordAddress(start);
-  end = MIN2(end, end_addr);
-  assert(start <= end, "Consistency check");
-  MemRegion mr(start, end);
-  if (!mr.is_empty()) {
-    clearRange(mr);
-  }
-  return mr;
-}
-
 CMMarkStack::CMMarkStack(ConcurrentMark* cm) :
   _base(NULL), _cm(cm)
 {}
@@ -466,8 +419,6 @@
   _max_parallel_marking_threads(0),
   _sleep_factor(0.0),
   _marking_task_overhead(1.0),
-  _cleanup_sleep_factor(0.0),
-  _cleanup_task_overhead(1.0),
   _cleanup_list("Cleanup List"),
   _region_bm((BitMap::idx_t)(g1h->max_regions()), false /* in_resource_area*/),
   _card_bm((g1h->reserved_region().byte_size() + CardTableModRefBS::card_size - 1) >>
@@ -568,22 +519,6 @@
   _parallel_marking_threads = ConcGCThreads;
   _max_parallel_marking_threads = _parallel_marking_threads;
 
-  if (parallel_marking_threads() > 1) {
-    _cleanup_task_overhead = 1.0;
-  } else {
-    _cleanup_task_overhead = marking_task_overhead();
-  }
-  _cleanup_sleep_factor =
-                   (1.0 - cleanup_task_overhead()) / cleanup_task_overhead();
-
-#if 0
-  gclog_or_tty->print_cr("Marking Threads          %d", parallel_marking_threads());
-  gclog_or_tty->print_cr("CM Marking Task Overhead %1.4lf", marking_task_overhead());
-  gclog_or_tty->print_cr("CM Sleep Factor          %1.4lf", sleep_factor());
-  gclog_or_tty->print_cr("CL Marking Task Overhead %1.4lf", cleanup_task_overhead());
-  gclog_or_tty->print_cr("CL Sleep Factor          %1.4lf", cleanup_sleep_factor());
-#endif
-
   _parallel_workers = new WorkGang("G1 Marker",
        _max_parallel_marking_threads, false, true);
   if (_parallel_workers == NULL) {
@@ -840,14 +775,6 @@
 void ConcurrentMark::checkpointRootsInitialPost() {
   G1CollectedHeap*   g1h = G1CollectedHeap::heap();
 
-  // If we force an overflow during remark, the remark operation will
-  // actually abort and we'll restart concurrent marking. If we always
-  // force an overflow during remark we'll never actually complete the
-  // marking phase. So, we initialize this here, at the start of the
-  // cycle, so that at the remaining overflow number will decrease at
-  // every remark and we'll eventually not need to cause one.
-  force_overflow_stw()->init();
-
   // Start Concurrent Marking weak-reference discovery.
   ReferenceProcessor* rp = g1h->ref_processor_cm();
   // enable ("weak") refs discovery
@@ -920,7 +847,6 @@
       // we exit this method to abort the pause and restart concurrent
       // marking.
       reset_marking_state(true /* clear_overflow */);
-      force_overflow()->update();
 
       if (G1Log::fine()) {
         gclog_or_tty->gclog_stamp();
@@ -940,32 +866,6 @@
   // at this point everything should be re-initialized and ready to go
 }
 
-#ifndef PRODUCT
-void ForceOverflowSettings::init() {
-  _num_remaining = G1ConcMarkForceOverflow;
-  _force = false;
-  update();
-}
-
-void ForceOverflowSettings::update() {
-  if (_num_remaining > 0) {
-    _num_remaining -= 1;
-    _force = true;
-  } else {
-    _force = false;
-  }
-}
-
-bool ForceOverflowSettings::should_force() {
-  if (_force) {
-    _force = false;
-    return true;
-  } else {
-    return false;
-  }
-}
-#endif // !PRODUCT
-
 class CMConcurrentMarkingTask: public AbstractGangTask {
 private:
   ConcurrentMark*       _cm;
@@ -1131,7 +1031,6 @@
   // stop-the-world GC happens even as we mark in this generation.
 
   _restart_for_overflow = false;
-  force_overflow_conc()->init();
 
   // _g1h has _n_par_threads
   _parallel_marking_threads = calc_parallel_marking_threads();
@@ -2440,10 +2339,6 @@
   ((CMBitMap*)_prevMarkBitMap)->clearRange(mr);
 }
 
-void ConcurrentMark::clearRangeNextBitmap(MemRegion mr) {
-  _nextMarkBitMap->clearRange(mr);
-}
-
 HeapRegion*
 ConcurrentMark::claim_region(uint worker_id) {
   // "checkpoint" the finger
@@ -3535,15 +3430,6 @@
     }
   }
 
-  // If we are about to wrap up and go into termination, check if we
-  // should raise the overflow flag.
-  if (do_termination && !has_aborted()) {
-    if (_cm->force_overflow()->should_force()) {
-      _cm->set_has_overflown();
-      regular_clock_call();
-    }
-  }
-
   // We still haven't aborted. Now, let's try to get into the
   // termination protocol.
   if (do_termination && !has_aborted()) {
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -65,11 +65,8 @@
   // constructor
   CMBitMapRO(int shifter);
 
-  enum { do_yield = true };
-
   // inquiries
   HeapWord* startWord()   const { return _bmStartWord; }
-  size_t    sizeInWords() const { return _bmWordSize;  }
   // the following is one past the last word in space
   HeapWord* endWord()     const { return _bmStartWord + _bmWordSize; }
 
@@ -83,18 +80,12 @@
 
   // iteration
   inline bool iterate(BitMapClosure* cl, MemRegion mr);
-  inline bool iterate(BitMapClosure* cl);
 
   // Return the address corresponding to the next marked bit at or after
   // "addr", and before "limit", if "limit" is non-NULL.  If there is no
   // such bit, returns "limit" if that is non-NULL, or else "endWord()".
   HeapWord* getNextMarkedWordAddress(const HeapWord* addr,
                                      const HeapWord* limit = NULL) const;
-  // Return the address corresponding to the next unmarked bit at or after
-  // "addr", and before "limit", if "limit" is non-NULL.  If there is no
-  // such bit, returns "limit" if that is non-NULL, or else "endWord()".
-  HeapWord* getNextUnmarkedWordAddress(const HeapWord* addr,
-                                       const HeapWord* limit = NULL) const;
 
   // conversion utilities
   HeapWord* offsetToHeapWord(size_t offset) const {
@@ -103,7 +94,6 @@
   size_t heapWordToOffset(const HeapWord* addr) const {
     return pointer_delta(addr, _bmStartWord) >> _shifter;
   }
-  int heapWordDiffToOffsetDiff(size_t diff) const;
 
   // The argument addr should be the start address of a valid object
   HeapWord* nextObject(HeapWord* addr) {
@@ -153,20 +143,9 @@
   inline void mark(HeapWord* addr);
   inline void clear(HeapWord* addr);
   inline bool parMark(HeapWord* addr);
-  inline bool parClear(HeapWord* addr);
 
-  void markRange(MemRegion mr);
   void clearRange(MemRegion mr);
 
-  // Starting at the bit corresponding to "addr" (inclusive), find the next
-  // "1" bit, if any.  This bit starts some run of consecutive "1"'s; find
-  // the end of this run (stopping at "end_addr").  Return the MemRegion
-  // covering from the start of the region corresponding to the first bit
-  // of the run to the end of the region corresponding to the last bit of
-  // the run.  If there is no "1" bit at or after "addr", return an empty
-  // MemRegion.
-  MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr);
-
   // Clear the whole mark bitmap.
   void clearAll();
 };
@@ -231,19 +210,6 @@
   template<typename Fn> void iterate(Fn fn);
 };
 
-class ForceOverflowSettings VALUE_OBJ_CLASS_SPEC {
-private:
-#ifndef PRODUCT
-  uintx _num_remaining;
-  bool _force;
-#endif // !defined(PRODUCT)
-
-public:
-  void init() PRODUCT_RETURN;
-  void update() PRODUCT_RETURN;
-  bool should_force() PRODUCT_RETURN_( return false; );
-};
-
 class YoungList;
 
 // Root Regions are regions that are not empty at the beginning of a
@@ -326,10 +292,6 @@
   double                _marking_task_overhead; // Marking target overhead for
                                                 // a single task
 
-  // Same as the two above, but for the cleanup task
-  double                _cleanup_sleep_factor;
-  double                _cleanup_task_overhead;
-
   FreeRegionList        _cleanup_list;
 
   // Concurrent marking support structures
@@ -404,9 +366,6 @@
 
   WorkGang* _parallel_workers;
 
-  ForceOverflowSettings _force_overflow_conc;
-  ForceOverflowSettings _force_overflow_stw;
-
   void weakRefsWorkParallelPart(BoolObjectClosure* is_alive, bool purged_classes);
   void weakRefsWork(bool clear_all_soft_refs);
 
@@ -443,8 +402,6 @@
   uint max_parallel_marking_threads() const { return _max_parallel_marking_threads;}
   double sleep_factor()                     { return _sleep_factor; }
   double marking_task_overhead()            { return _marking_task_overhead;}
-  double cleanup_sleep_factor()             { return _cleanup_sleep_factor; }
-  double cleanup_task_overhead()            { return _cleanup_task_overhead;}
 
   HeapWord*               finger()          { return _finger;   }
   bool                    concurrent()      { return _concurrent; }
@@ -502,22 +459,6 @@
   void enter_first_sync_barrier(uint worker_id);
   void enter_second_sync_barrier(uint worker_id);
 
-  ForceOverflowSettings* force_overflow_conc() {
-    return &_force_overflow_conc;
-  }
-
-  ForceOverflowSettings* force_overflow_stw() {
-    return &_force_overflow_stw;
-  }
-
-  ForceOverflowSettings* force_overflow() {
-    if (concurrent()) {
-      return force_overflow_conc();
-    } else {
-      return force_overflow_stw();
-    }
-  }
-
   // Live Data Counting data structures...
   // These data structures are initialized at the start of
   // marking. They are written to while marking is active.
@@ -625,28 +566,6 @@
                        uint worker_id,
                        HeapRegion* hr = NULL);
 
-  // It iterates over the heap and for each object it comes across it
-  // will dump the contents of its reference fields, as well as
-  // liveness information for the object and its referents. The dump
-  // will be written to a file with the following name:
-  // G1PrintReachableBaseFile + "." + str.
-  // vo decides whether the prev (vo == UsePrevMarking), the next
-  // (vo == UseNextMarking) marking information, or the mark word
-  // (vo == UseMarkWord) will be used to determine the liveness of
-  // each object / referent.
-  // If all is true, all objects in the heap will be dumped, otherwise
-  // only the live ones. In the dump the following symbols / breviations
-  // are used:
-  //   M : an explicitly live object (its bitmap bit is set)
-  //   > : an implicitly live object (over tams)
-  //   O : an object outside the G1 heap (typically: in the perm gen)
-  //   NOT : a reference field whose referent is not live
-  //   AND MARKED : indicates that an object is both explicitly and
-  //   implicitly live (it should be one or the other, not both)
-  void print_reachable(const char* str,
-                       VerifyOption vo,
-                       bool all) PRODUCT_RETURN;
-
   // Clear the next marking bitmap (will be called concurrently).
   void clearNextBitmap();
 
@@ -686,7 +605,6 @@
   // next bitmaps.  NB: the previous bitmap is usually
   // read-only, so use this carefully!
   void clearRangePrevBitmap(MemRegion mr);
-  void clearRangeNextBitmap(MemRegion mr);
 
   // Notify data structures that a GC has started.
   void note_start_of_gc() {
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.inline.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.inline.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -185,11 +185,6 @@
   return true;
 }
 
-inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
-  MemRegion mr(startWord(), sizeInWords());
-  return iterate(cl, mr);
-}
-
 #define check_mark(addr)                                                       \
   assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize),      \
          "outside underlying space?");                                         \
@@ -213,11 +208,6 @@
   return _bm.par_set_bit(heapWordToOffset(addr));
 }
 
-inline bool CMBitMap::parClear(HeapWord* addr) {
-  check_mark(addr);
-  return _bm.par_clear_bit(heapWordToOffset(addr));
-}
-
 #undef check_mark
 
 template<typename Fn>
--- a/hotspot/src/share/vm/gc/g1/g1BlockOffsetTable.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1BlockOffsetTable.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -499,11 +499,14 @@
   return _next_offset_threshold;
 }
 
-void G1BlockOffsetArrayContigSpace::set_for_starts_humongous(HeapWord* obj_top) {
+void G1BlockOffsetArrayContigSpace::set_for_starts_humongous(HeapWord* obj_top, size_t fill_size) {
   // The first BOT entry should have offset 0.
   reset_bot();
   alloc_block(_bottom, obj_top);
- }
+  if (fill_size > 0) {
+    alloc_block(obj_top, fill_size);
+  }
+}
 
 #ifndef PRODUCT
 void G1BlockOffsetArrayContigSpace::print_on(outputStream* out) {
--- a/hotspot/src/share/vm/gc/g1/g1BlockOffsetTable.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1BlockOffsetTable.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -372,7 +372,7 @@
   HeapWord* block_start_unsafe(const void* addr);
   HeapWord* block_start_unsafe_const(const void* addr) const;
 
-  void set_for_starts_humongous(HeapWord* obj_top);
+  void set_for_starts_humongous(HeapWord* obj_top, size_t fill_size);
 
   virtual void print_on(outputStream* out) PRODUCT_RETURN;
 };
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -301,8 +301,8 @@
   assert(is_humongous(word_size), "word_size should be humongous");
   assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
 
-  // Index of last region in the series + 1.
-  uint last = first + num_regions;
+  // Index of last region in the series.
+  uint last = first + num_regions - 1;
 
   // We need to initialize the region(s) we just discovered. This is
   // a bit tricky given that it can happen concurrently with
@@ -339,16 +339,30 @@
   // thread to calculate the object size incorrectly.
   Copy::fill_to_words(new_obj, oopDesc::header_size(), 0);
 
+  // How many words we use for filler objects.
+  size_t word_fill_size = word_size_sum - word_size;
+
+  // How many words memory we "waste" which cannot hold a filler object.
+  size_t words_not_fillable = 0;
+
+  if (word_fill_size >= min_fill_size()) {
+    fill_with_objects(obj_top, word_fill_size);
+  } else if (word_fill_size > 0) {
+    // We have space to fill, but we cannot fit an object there.
+    words_not_fillable = word_fill_size;
+    word_fill_size = 0;
+  }
+
   // We will set up the first region as "starts humongous". This
   // will also update the BOT covering all the regions to reflect
   // that there is a single object that starts at the bottom of the
   // first region.
-  first_hr->set_starts_humongous(obj_top);
+  first_hr->set_starts_humongous(obj_top, word_fill_size);
   first_hr->set_allocation_context(context);
   // Then, if there are any, we will set up the "continues
   // humongous" regions.
   HeapRegion* hr = NULL;
-  for (uint i = first + 1; i < last; ++i) {
+  for (uint i = first + 1; i <= last; ++i) {
     hr = region_at(i);
     hr->set_continues_humongous(first_hr);
     hr->set_allocation_context(context);
@@ -363,41 +377,39 @@
   // object header and the BOT initialization.
   OrderAccess::storestore();
 
-  // Now that the BOT and the object header have been initialized,
-  // we can update top of the "starts humongous" region.
-  first_hr->set_top(MIN2(first_hr->end(), obj_top));
-  if (_hr_printer.is_active()) {
-    _hr_printer.alloc(G1HRPrinter::StartsHumongous, first_hr, first_hr->top());
-  }
-
   // Now, we will update the top fields of the "continues humongous"
-  // regions.
-  hr = NULL;
-  for (uint i = first + 1; i < last; ++i) {
+  // regions except the last one.
+  for (uint i = first; i < last; ++i) {
     hr = region_at(i);
-    if ((i + 1) == last) {
-      // last continues humongous region
-      assert(hr->bottom() < obj_top && obj_top <= hr->end(),
-             "new_top should fall on this region");
-      hr->set_top(obj_top);
-      _hr_printer.alloc(G1HRPrinter::ContinuesHumongous, hr, obj_top);
+    hr->set_top(hr->end());
+  }
+
+  hr = region_at(last);
+  // If we cannot fit a filler object, we must set top to the end
+  // of the humongous object, otherwise we cannot iterate the heap
+  // and the BOT will not be complete.
+  hr->set_top(hr->end() - words_not_fillable);
+
+  assert(hr->bottom() < obj_top && obj_top <= hr->end(),
+         "obj_top should be in last region");
+
+  check_bitmaps("Humongous Region Allocation", first_hr);
+
+  assert(words_not_fillable == 0 ||
+         first_hr->bottom() + word_size_sum - words_not_fillable == hr->top(),
+         "Miscalculation in humongous allocation");
+
+  increase_used((word_size_sum - words_not_fillable) * HeapWordSize);
+
+  for (uint i = first; i <= last; ++i) {
+    hr = region_at(i);
+    _humongous_set.add(hr);
+    if (i == first) {
+      _hr_printer.alloc(G1HRPrinter::StartsHumongous, hr, hr->top());
     } else {
-      // not last one
-      assert(obj_top > hr->end(), "obj_top should be above this region");
-      hr->set_top(hr->end());
-      _hr_printer.alloc(G1HRPrinter::ContinuesHumongous, hr, hr->end());
+      _hr_printer.alloc(G1HRPrinter::ContinuesHumongous, hr, hr->top());
     }
   }
-  // If we have continues humongous regions (hr != NULL), its top should
-  // match obj_top.
-  assert(hr == NULL || (hr->top() == obj_top), "sanity");
-  check_bitmaps("Humongous Region Allocation", first_hr);
-
-  increase_used(word_size * HeapWordSize);
-
-  for (uint i = first; i < last; ++i) {
-    _humongous_set.add(region_at(i));
-  }
 
   return new_obj;
 }
@@ -1202,9 +1214,8 @@
   heap_region_iterate(&cl);
 }
 
-bool G1CollectedHeap::do_collection(bool explicit_gc,
-                                    bool clear_all_soft_refs,
-                                    size_t word_size) {
+bool G1CollectedHeap::do_full_collection(bool explicit_gc,
+                                         bool clear_all_soft_refs) {
   assert_at_safepoint(true /* should_be_vm_thread */);
 
   if (GC_locker::check_active_before_gc()) {
@@ -1362,8 +1373,7 @@
       clear_rsets_post_compaction();
       check_gc_time_stamps();
 
-      // Resize the heap if necessary.
-      resize_if_necessary_after_full_collection(explicit_gc ? 0 : word_size);
+      resize_if_necessary_after_full_collection();
 
       if (_hr_printer.is_active()) {
         // We should do this after we potentially resize the heap so
@@ -1471,22 +1481,15 @@
 }
 
 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) {
-  // do_collection() will return whether it succeeded in performing
-  // the GC. Currently, there is no facility on the
-  // do_full_collection() API to notify the caller than the collection
-  // did not succeed (e.g., because it was locked out by the GC
-  // locker). So, right now, we'll ignore the return value.
-  bool dummy = do_collection(true,                /* explicit_gc */
-                             clear_all_soft_refs,
-                             0                    /* word_size */);
-}
-
-// This code is mostly copied from TenuredGeneration.
-void
-G1CollectedHeap::
-resize_if_necessary_after_full_collection(size_t word_size) {
-  // Include the current allocation, if any, and bytes that will be
-  // pre-allocated to support collections, as "used".
+  // Currently, there is no facility in the do_full_collection(bool) API to notify
+  // the caller that the collection did not succeed (e.g., because it was locked
+  // out by the GC locker). So, right now, we'll ignore the return value.
+  bool dummy = do_full_collection(true,                /* explicit_gc */
+                                  clear_all_soft_refs);
+}
+
+void G1CollectedHeap::resize_if_necessary_after_full_collection() {
+  // Include bytes that will be pre-allocated to support collections, as "used".
   const size_t used_after_gc = used();
   const size_t capacity_after_gc = capacity();
   const size_t free_after_gc = capacity_after_gc - used_after_gc;
@@ -1598,9 +1601,8 @@
 
   if (do_gc) {
     // Expansion didn't work, we'll try to do a Full GC.
-    *gc_succeeded = do_collection(false, /* explicit_gc */
-                                  clear_all_soft_refs,
-                                  word_size);
+    *gc_succeeded = do_full_collection(false, /* explicit_gc */
+                                       clear_all_soft_refs);
   }
 
   return NULL;
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -471,26 +471,20 @@
   void retire_gc_alloc_region(HeapRegion* alloc_region,
                               size_t allocated_bytes, InCSetState dest);
 
-  // - if explicit_gc is true, the GC is for a System.gc() or a heap
-  //   inspection request and should collect the entire heap
+  // - if explicit_gc is true, the GC is for a System.gc() etc,
+  //   otherwise it's for a failed allocation.
   // - if clear_all_soft_refs is true, all soft references should be
-  //   cleared during the GC
-  // - if explicit_gc is false, word_size describes the allocation that
-  //   the GC should attempt (at least) to satisfy
+  //   cleared during the GC.
   // - it returns false if it is unable to do the collection due to the
-  //   GC locker being active, true otherwise
-  bool do_collection(bool explicit_gc,
-                     bool clear_all_soft_refs,
-                     size_t word_size);
+  //   GC locker being active, true otherwise.
+  bool do_full_collection(bool explicit_gc,
+                          bool clear_all_soft_refs);
 
-  // Callback from VM_G1CollectFull operation.
-  // Perform a full collection.
+  // Callback from VM_G1CollectFull operation, or collect_as_vm_thread.
   virtual void do_full_collection(bool clear_all_soft_refs);
 
-  // Resize the heap if necessary after a full collection.  If this is
-  // after a collect-for allocation, "word_size" is the allocation size,
-  // and will be considered part of the used portion of the heap.
-  void resize_if_necessary_after_full_collection(size_t word_size);
+  // Resize the heap if necessary after a full collection.
+  void resize_if_necessary_after_full_collection();
 
   // Callback from VM_G1CollectForAllocation operation.
   // This function does everything necessary/possible to satisfy a
@@ -1150,9 +1144,6 @@
   // "CollectedHeap" supports.
   virtual void collect(GCCause::Cause cause);
 
-  // The same as above but assume that the caller holds the Heap_lock.
-  void collect_locked(GCCause::Cause cause);
-
   virtual bool copy_allocation_context_stats(const jint* contexts,
                                              jlong* totals,
                                              jbyte* accuracy,
@@ -1352,14 +1343,6 @@
     return (region_size / 2);
   }
 
-  // Update mod union table with the set of dirty cards.
-  void updateModUnion();
-
-  // Set the mod union bits corresponding to the given memRegion.  Note
-  // that this is always a safe operation, since it doesn't clear any
-  // bits.
-  void markModUnionRange(MemRegion mr);
-
   // Print the maximum heap capacity.
   virtual size_t max_capacity() const;
 
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -123,16 +123,13 @@
 
 template <G1Barrier barrier, G1Mark do_mark_object>
 class G1ParCopyClosure : public G1ParCopyHelper {
-private:
-  template <class T> void do_oop_work(T* p);
-
 public:
   G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
       G1ParCopyHelper(g1, par_scan_state) {
     assert(ref_processor() == NULL, "sanity");
   }
 
-  template <class T> void do_oop_nv(T* p) { do_oop_work(p); }
+  template <class T> void do_oop_nv(T* p);
   virtual void do_oop(oop* p)       { do_oop_nv(p); }
   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 };
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -251,7 +251,7 @@
 
 template <G1Barrier barrier, G1Mark do_mark_object>
 template <class T>
-void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
+void G1ParCopyClosure<barrier, do_mark_object>::do_oop_nv(T* p) {
   T heap_oop = oopDesc::load_heap_oop(p);
 
   if (oopDesc::is_null(heap_oop)) {
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -73,138 +73,111 @@
   FREE_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, _cset_rs_update_cl);
 }
 
-class ScanRSClosure : public HeapRegionClosure {
-  size_t _cards_done, _cards;
-  G1CollectedHeap* _g1h;
-
-  G1ParPushHeapRSClosure* _oc;
-  CodeBlobClosure* _code_root_cl;
-
-  G1BlockOffsetSharedArray* _bot_shared;
-  G1SATBCardTableModRefBS *_ct_bs;
-
-  double _strong_code_root_scan_time_sec;
-  uint   _worker_i;
-  size_t _block_size;
-  bool   _try_claimed;
-
-public:
-  ScanRSClosure(G1ParPushHeapRSClosure* oc,
-                CodeBlobClosure* code_root_cl,
-                uint worker_i) :
+ScanRSClosure::ScanRSClosure(G1ParPushHeapRSClosure* oc,
+                             CodeBlobClosure* code_root_cl,
+                             uint worker_i) :
     _oc(oc),
     _code_root_cl(code_root_cl),
     _strong_code_root_scan_time_sec(0.0),
     _cards(0),
     _cards_done(0),
     _worker_i(worker_i),
-    _try_claimed(false)
-  {
-    _g1h = G1CollectedHeap::heap();
-    _bot_shared = _g1h->bot_shared();
-    _ct_bs = _g1h->g1_barrier_set();
-    _block_size = MAX2<size_t>(G1RSetScanBlockSize, 1);
+    _try_claimed(false) {
+  _g1h = G1CollectedHeap::heap();
+  _bot_shared = _g1h->bot_shared();
+  _ct_bs = _g1h->g1_barrier_set();
+  _block_size = MAX2<size_t>(G1RSetScanBlockSize, 1);
+}
+
+void ScanRSClosure::scanCard(size_t index, HeapRegion *r) {
+  // Stack allocate the DirtyCardToOopClosure instance
+  HeapRegionDCTOC cl(_g1h, r, _oc,
+      CardTableModRefBS::Precise);
+
+  // Set the "from" region in the closure.
+  _oc->set_region(r);
+  MemRegion card_region(_bot_shared->address_for_index(index), G1BlockOffsetSharedArray::N_words);
+  MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
+  MemRegion mr = pre_gc_allocated.intersection(card_region);
+  if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
+    // We make the card as "claimed" lazily (so races are possible
+    // but they're benign), which reduces the number of duplicate
+    // scans (the rsets of the regions in the cset can intersect).
+    _ct_bs->set_card_claimed(index);
+    _cards_done++;
+    cl.do_MemRegion(mr);
   }
+}
 
-  void set_try_claimed() { _try_claimed = true; }
+void ScanRSClosure::printCard(HeapRegion* card_region, size_t card_index,
+    HeapWord* card_start) {
+  gclog_or_tty->print_cr("T %u Region [" PTR_FORMAT ", " PTR_FORMAT ") "
+      "RS names card " SIZE_FORMAT_HEX ": "
+      "[" PTR_FORMAT ", " PTR_FORMAT ")",
+      _worker_i,
+      p2i(card_region->bottom()), p2i(card_region->end()),
+      card_index,
+      p2i(card_start), p2i(card_start + G1BlockOffsetSharedArray::N_words));
+}
 
-  void scanCard(size_t index, HeapRegion *r) {
-    // Stack allocate the DirtyCardToOopClosure instance
-    HeapRegionDCTOC cl(_g1h, r, _oc,
-                       CardTableModRefBS::Precise);
+void ScanRSClosure::scan_strong_code_roots(HeapRegion* r) {
+  double scan_start = os::elapsedTime();
+  r->strong_code_roots_do(_code_root_cl);
+  _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start);
+}
+
+bool ScanRSClosure::doHeapRegion(HeapRegion* r) {
+  assert(r->in_collection_set(), "should only be called on elements of CS.");
+  HeapRegionRemSet* hrrs = r->rem_set();
+  if (hrrs->iter_is_complete()) return false; // All done.
+  if (!_try_claimed && !hrrs->claim_iter()) return false;
+  // If we ever free the collection set concurrently, we should also
+  // clear the card table concurrently therefore we won't need to
+  // add regions of the collection set to the dirty cards region.
+  _g1h->push_dirty_cards_region(r);
+  // If we didn't return above, then
+  //   _try_claimed || r->claim_iter()
+  // is true: either we're supposed to work on claimed-but-not-complete
+  // regions, or we successfully claimed the region.
+
+  HeapRegionRemSetIterator iter(hrrs);
+  size_t card_index;
 
-    // Set the "from" region in the closure.
-    _oc->set_region(r);
-    MemRegion card_region(_bot_shared->address_for_index(index), G1BlockOffsetSharedArray::N_words);
-    MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
-    MemRegion mr = pre_gc_allocated.intersection(card_region);
-    if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
-      // We make the card as "claimed" lazily (so races are possible
-      // but they're benign), which reduces the number of duplicate
-      // scans (the rsets of the regions in the cset can intersect).
-      _ct_bs->set_card_claimed(index);
-      _cards_done++;
-      cl.do_MemRegion(mr);
+  // We claim cards in block so as to reduce the contention. The block size is determined by
+  // the G1RSetScanBlockSize parameter.
+  size_t jump_to_card = hrrs->iter_claimed_next(_block_size);
+  for (size_t current_card = 0; iter.has_next(card_index); current_card++) {
+    if (current_card >= jump_to_card + _block_size) {
+      jump_to_card = hrrs->iter_claimed_next(_block_size);
+    }
+    if (current_card < jump_to_card) continue;
+    HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index);
+#if 0
+    gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n",
+        card_start, card_start + CardTableModRefBS::card_size_in_words);
+#endif
+
+    HeapRegion* card_region = _g1h->heap_region_containing(card_start);
+    _cards++;
+
+    if (!card_region->is_on_dirty_cards_region_list()) {
+      _g1h->push_dirty_cards_region(card_region);
+    }
+
+    // If the card is dirty, then we will scan it during updateRS.
+    if (!card_region->in_collection_set() &&
+        !_ct_bs->is_card_dirty(card_index)) {
+      scanCard(card_index, card_region);
     }
   }
-
-  void printCard(HeapRegion* card_region, size_t card_index,
-                 HeapWord* card_start) {
-    gclog_or_tty->print_cr("T %u Region [" PTR_FORMAT ", " PTR_FORMAT ") "
-                           "RS names card " SIZE_FORMAT_HEX ": "
-                           "[" PTR_FORMAT ", " PTR_FORMAT ")",
-                           _worker_i,
-                           p2i(card_region->bottom()), p2i(card_region->end()),
-                           card_index,
-                           p2i(card_start), p2i(card_start + G1BlockOffsetSharedArray::N_words));
-  }
-
-  void scan_strong_code_roots(HeapRegion* r) {
-    double scan_start = os::elapsedTime();
-    r->strong_code_roots_do(_code_root_cl);
-    _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start);
-  }
-
-  bool doHeapRegion(HeapRegion* r) {
-    assert(r->in_collection_set(), "should only be called on elements of CS.");
-    HeapRegionRemSet* hrrs = r->rem_set();
-    if (hrrs->iter_is_complete()) return false; // All done.
-    if (!_try_claimed && !hrrs->claim_iter()) return false;
-    // If we ever free the collection set concurrently, we should also
-    // clear the card table concurrently therefore we won't need to
-    // add regions of the collection set to the dirty cards region.
-    _g1h->push_dirty_cards_region(r);
-    // If we didn't return above, then
-    //   _try_claimed || r->claim_iter()
-    // is true: either we're supposed to work on claimed-but-not-complete
-    // regions, or we successfully claimed the region.
-
-    HeapRegionRemSetIterator iter(hrrs);
-    size_t card_index;
+  if (!_try_claimed) {
+    // Scan the strong code root list attached to the current region
+    scan_strong_code_roots(r);
 
-    // We claim cards in block so as to reduce the contention. The block size is determined by
-    // the G1RSetScanBlockSize parameter.
-    size_t jump_to_card = hrrs->iter_claimed_next(_block_size);
-    for (size_t current_card = 0; iter.has_next(card_index); current_card++) {
-      if (current_card >= jump_to_card + _block_size) {
-        jump_to_card = hrrs->iter_claimed_next(_block_size);
-      }
-      if (current_card < jump_to_card) continue;
-      HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index);
-#if 0
-      gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n",
-                          card_start, card_start + CardTableModRefBS::card_size_in_words);
-#endif
-
-      HeapRegion* card_region = _g1h->heap_region_containing(card_start);
-      _cards++;
-
-      if (!card_region->is_on_dirty_cards_region_list()) {
-        _g1h->push_dirty_cards_region(card_region);
-      }
-
-      // If the card is dirty, then we will scan it during updateRS.
-      if (!card_region->in_collection_set() &&
-          !_ct_bs->is_card_dirty(card_index)) {
-        scanCard(card_index, card_region);
-      }
-    }
-    if (!_try_claimed) {
-      // Scan the strong code root list attached to the current region
-      scan_strong_code_roots(r);
-
-      hrrs->set_iter_complete();
-    }
-    return false;
+    hrrs->set_iter_complete();
   }
-
-  double strong_code_root_scan_time_sec() {
-    return _strong_code_root_scan_time_sec;
-  }
-
-  size_t cards_done() { return _cards_done;}
-  size_t cards_looked_up() { return _cards;}
-};
+  return false;
+}
 
 size_t G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
                         CodeBlobClosure* heap_region_codeblobs,
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -54,16 +54,6 @@
   uint n_workers();
 
 protected:
-  enum SomePrivateConstants {
-    UpdateRStoMergeSync  = 0,
-    MergeRStoDoDirtySync = 1,
-    DoDirtySync          = 2,
-    LastSync             = 3,
-
-    SeqTask              = 0,
-    NumSeqTasks          = 1
-  };
-
   CardTableModRefBS*     _ct_bs;
   G1CollectorPolicy*     _g1p;
 
@@ -123,7 +113,6 @@
 
   // Record, if necessary, the fact that *p (where "p" is in region "from",
   // which is required to be non-NULL) has changed to a new non-NULL value.
-  template <class T> void write_ref(HeapRegion* from, T* p);
   template <class T> void par_write_ref(HeapRegion* from, T* p, uint tid);
 
   // Requires "region_bm" and "card_bm" to be bitmaps with 1 bit per region
@@ -156,6 +145,41 @@
   }
 };
 
+class ScanRSClosure : public HeapRegionClosure {
+  size_t _cards_done, _cards;
+  G1CollectedHeap* _g1h;
+
+  G1ParPushHeapRSClosure* _oc;
+  CodeBlobClosure* _code_root_cl;
+
+  G1BlockOffsetSharedArray* _bot_shared;
+  G1SATBCardTableModRefBS *_ct_bs;
+
+  double _strong_code_root_scan_time_sec;
+  uint   _worker_i;
+  size_t _block_size;
+  bool   _try_claimed;
+
+public:
+  ScanRSClosure(G1ParPushHeapRSClosure* oc,
+                CodeBlobClosure* code_root_cl,
+                uint worker_i);
+
+  bool doHeapRegion(HeapRegion* r);
+
+  double strong_code_root_scan_time_sec() {
+    return _strong_code_root_scan_time_sec;
+  }
+  size_t cards_done() { return _cards_done;}
+  size_t cards_looked_up() { return _cards;}
+  void set_try_claimed() { _try_claimed = true; }
+private:
+  void scanCard(size_t index, HeapRegion *r);
+  void printCard(HeapRegion* card_region, size_t card_index,
+                 HeapWord* card_start);
+  void scan_strong_code_roots(HeapRegion* r);
+};
+
 class UpdateRSOopClosure: public ExtendedOopClosure {
   HeapRegion* _from;
   G1RemSet* _rs;
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.inline.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.inline.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -35,11 +35,6 @@
 }
 
 template <class T>
-inline void G1RemSet::write_ref(HeapRegion* from, T* p) {
-  par_write_ref(from, p, 0);
-}
-
-template <class T>
 inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, uint tid) {
   oop obj = oopDesc::load_decode_heap_oop(p);
   if (obj == NULL) {
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -211,14 +211,14 @@
   _gc_efficiency = (double) reclaimable_bytes() / region_elapsed_time_ms;
 }
 
-void HeapRegion::set_starts_humongous(HeapWord* obj_top) {
+void HeapRegion::set_starts_humongous(HeapWord* obj_top, size_t fill_size) {
   assert(!is_humongous(), "sanity / pre-condition");
   assert(top() == bottom(), "should be empty");
 
   _type.set_starts_humongous();
   _humongous_start_region = this;
 
-  _offsets.set_for_starts_humongous(obj_top);
+  _offsets.set_for_starts_humongous(obj_top, fill_size);
 }
 
 void HeapRegion::set_continues_humongous(HeapRegion* first_hr) {
@@ -756,16 +756,6 @@
     size_t obj_size = block_size(p);
     object_num += 1;
 
-    if (is_region_humongous != g1->is_humongous(obj_size) &&
-        !g1->is_obj_dead(obj, this)) { // Dead objects may have bigger block_size since they span several objects.
-      gclog_or_tty->print_cr("obj " PTR_FORMAT " is of %shumongous size ("
-                             SIZE_FORMAT " words) in a %shumongous region",
-                             p2i(p), g1->is_humongous(obj_size) ? "" : "non-",
-                             obj_size, is_region_humongous ? "" : "non-");
-       *failures = true;
-       return;
-    }
-
     if (!g1->is_obj_dead_cond(obj, this, vo)) {
       if (obj->is_oop()) {
         Klass* klass = obj->klass();
@@ -876,14 +866,6 @@
     }
   }
 
-  if (is_region_humongous && object_num > 1) {
-    gclog_or_tty->print_cr("region [" PTR_FORMAT "," PTR_FORMAT "] is humongous "
-                           "but has " SIZE_FORMAT ", objects",
-                           p2i(bottom()), p2i(end()), object_num);
-    *failures = true;
-    return;
-  }
-
   verify_strong_code_roots(vo, failures);
 }
 
--- a/hotspot/src/share/vm/gc/g1/heapRegion.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -455,9 +455,9 @@
   // the first region in a series of one or more contiguous regions
   // that will contain a single "humongous" object.
   //
-  // obj_top : points to the end of the humongous object that's being
-  // allocated.
-  void set_starts_humongous(HeapWord* obj_top);
+  // obj_top : points to the top of the humongous object.
+  // fill_size : size of the filler object at the end of the region series.
+  void set_starts_humongous(HeapWord* obj_top, size_t fill_size);
 
   // Makes the current region be a "continues humongous'
   // region. first_hr is the "start humongous" region of the series
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -245,7 +245,6 @@
   // Get name, signature, and static klass
   _name          = pool->name_ref_at(index);
   _signature     = pool->signature_ref_at(index);
-  _tag           = pool->tag_ref_at(index);
   _current_klass = KlassHandle(THREAD, pool->pool_holder());
 
   // Coming from the constant pool always checks access
@@ -682,15 +681,6 @@
     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
 
-  // check tag at call is method
-  if (!link_info.tag().is_invalid() && !link_info.tag().is_method()) {
-    ResourceMark rm(THREAD);
-    char buf[200];
-    jio_snprintf(buf, sizeof(buf), "Resolving to non regular method %s", link_info.method_string());
-    THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
-  }
-
-
   // 2. lookup method in resolved klass and its super klasses
   methodHandle resolved_method = lookup_method_in_klasses(link_info, true, false, CHECK_NULL);
 
@@ -750,14 +740,6 @@
     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
 
-  // check tag at call is an interface method
-  if (!link_info.tag().is_invalid() && !link_info.tag().is_interface_method()) {
-    ResourceMark rm(THREAD);
-    char buf[200];
-    jio_snprintf(buf, sizeof(buf), "Resolving to non interface method %s", link_info.method_string());
-    THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
-  }
-
   // lookup method in this interface or its super, java.lang.Object
   // JDK8: also look for static methods
   methodHandle resolved_method = lookup_method_in_klasses(link_info, false, true, CHECK_NULL);
@@ -935,8 +917,7 @@
     resolved_klass->initialize(CHECK);
     // Use updated LinkInfo (to reresolve with resolved_klass as method_holder?)
     LinkInfo new_info(resolved_klass, link_info.name(), link_info.signature(),
-                      link_info.current_klass(),
-                      link_info.check_access() ? LinkInfo::needs_access_check : LinkInfo::skip_access_check);
+                      link_info.current_klass(), link_info.check_access());
     resolved_method = linktime_resolve_static_method(new_info, CHECK);
   }
 
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -135,35 +135,20 @@
   KlassHandle _resolved_klass;  // class that the constant pool entry points to
   KlassHandle _current_klass;   // class that owns the constant pool
   bool        _check_access;
-  constantTag _tag;
  public:
-  enum AccessCheck {
-     needs_access_check,
-     skip_access_check
-  };
-
   LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
-
   // Condensed information from other call sites within the vm.
-  LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, KlassHandle current_klass,
-           AccessCheck check_access = needs_access_check,
-           constantTag tag = JVM_CONSTANT_Invalid) :
+  LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature,
+           KlassHandle current_klass, bool check_access = true) :
     _resolved_klass(resolved_klass),
     _name(name), _signature(signature), _current_klass(current_klass),
-    _check_access(check_access == needs_access_check && current_klass.not_null()), _tag(tag) {}
-
-  // Case where we just find the method and don't check access against the current class
-  LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) :
-    _resolved_klass(resolved_klass),
-    _name(name), _signature(signature), _current_klass(NULL),
-    _check_access(false), _tag(JVM_CONSTANT_Invalid) {}
+    _check_access(check_access) {}
 
   // accessors
   Symbol* name() const               { return _name; }
   Symbol* signature() const          { return _signature; }
   KlassHandle resolved_klass() const { return _resolved_klass; }
   KlassHandle current_klass() const  { return _current_klass; }
-  constantTag tag() const            { return _tag; }
   bool check_access() const          { return _check_access; }
   char* method_string() const;
 
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -574,7 +574,7 @@
 
     if (holder_klass->is_interface()) {
       // do link-time resolution to check all access rules.
-      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass);
+      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true);
       methodHandle resolved_method = LinkResolver::linktime_resolve_interface_method_or_null(link_info);
       if (resolved_method.is_null() || resolved_method->is_private()) {
         return NULL;
@@ -586,7 +586,7 @@
       return JNIHandles::make_local(THREAD, result);
     } else {
       // do link-time resolution to check all access rules.
-      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass);
+      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true);
       methodHandle resolved_method = LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
       if (resolved_method.is_null()) {
         return NULL;
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -282,12 +282,11 @@
                                instanceKlassHandle& h_holder,
                                Symbol*       name,
                                Symbol*       sig,
-                               Bytecodes::Code bc,
-                               constantTag   tag) {
+                               Bytecodes::Code bc) {
   JVMCI_EXCEPTION_CONTEXT;
   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
   methodHandle dest_method;
-  LinkInfo link_info(h_holder, name, sig, h_accessor, LinkInfo::needs_access_check, tag);
+  LinkInfo link_info(h_holder, name, sig, h_accessor, /*check_access*/true);
   switch (bc) {
   case Bytecodes::_invokestatic:
     dest_method =
@@ -360,8 +359,7 @@
 
   if (holder_is_accessible) { // Our declared holder is loaded.
     instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder);
-    constantTag tag = cpool->tag_ref_at(index);
-    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc, tag);
+    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
     if (!m.is_null() &&
         (bc == Bytecodes::_invokestatic
          ?  InstanceKlass::cast(m->method_holder())->is_not_initialized()
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -125,8 +125,7 @@
                            instanceKlassHandle&  holder,
                            Symbol*         name,
                            Symbol*         sig,
-                           Bytecodes::Code bc,
-                           constantTag     tag);
+                           Bytecodes::Code bc);
 
   private:
 
--- a/hotspot/src/share/vm/logging/log.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/logging/log.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -37,10 +37,10 @@
 
   // Write long message to output file
   MutexLocker ml(LogConfiguration_lock);
-  LogConfiguration::parse_log_arguments("loglengthoutput.txt", "logging=develop",
+  LogConfiguration::parse_log_arguments("loglengthoutput.txt", "logging=trace",
     NULL, NULL, NULL);
   ResourceMark rm;
-  outputStream* logstream = LogHandle(logging)::develop_stream();
+  outputStream* logstream = LogHandle(logging)::trace_stream();
   logstream->print_cr("01:1234567890-"
                       "02:1234567890-"
                       "03:1234567890-"
--- a/hotspot/src/share/vm/logging/log.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/logging/log.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -49,11 +49,21 @@
 #define log_info(...)    (!log_is_enabled(Info, __VA_ARGS__))    ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
 #define log_debug(...)   (!log_is_enabled(Debug, __VA_ARGS__))   ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
 #define log_trace(...)   (!log_is_enabled(Trace, __VA_ARGS__))   ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
+
+// Macros for logging that should be excluded in product builds.
+// Available for levels Info, Debug and Trace. Includes test macro that
+// evaluates to false in product builds.
 #ifndef PRODUCT
-#define log_develop(...) (!log_is_enabled(Develop, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Develop>
+#define log_develop_info(...)  (!log_is_enabled(Info, __VA_ARGS__))   ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
+#define log_develop_debug(...) (!log_is_enabled(Debug, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
+#define log_develop_trace(...) (!log_is_enabled(Trace, __VA_ARGS__))  ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
+#define develop_log_is_enabled(level, ...)  log_is_enabled(level, __VA_ARGS__)
 #else
 #define DUMMY_ARGUMENT_CONSUMER(...)
-#define log_develop(...) DUMMY_ARGUMENT_CONSUMER
+#define log_develop_info(...)  DUMMY_ARGUMENT_CONSUMER
+#define log_develop_debug(...) DUMMY_ARGUMENT_CONSUMER
+#define log_develop_trace(...) DUMMY_ARGUMENT_CONSUMER
+#define develop_log_is_enabled(...)  false
 #endif
 
 // Convenience macro to test if the logging is enabled on the specified level for given tags.
@@ -88,6 +98,11 @@
   // is not __NO_TAG, the number of tags given exceeds the maximum allowed.
   STATIC_ASSERT(GuardTag == LogTag::__NO_TAG); // Number of logging tags exceeds maximum supported!
 
+  // Empty constructor to avoid warnings on MSVC about unused variables
+  // when the log instance is only used for static functions.
+  Log() {
+  }
+
   static bool is_level(LogLevelType level) {
     return LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().is_level(level);
   }
--- a/hotspot/src/share/vm/logging/logConfiguration.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/logging/logConfiguration.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -44,6 +44,7 @@
   LogDiagnosticCommand::registerCommand();
   LogHandle(logging) log;
   log.info("Log configuration fully initialized.");
+  log_develop_info(logging)("Develop logging is available.");
   if (log.is_trace()) {
     ResourceMark rm;
     MutexLocker ml(LogConfiguration_lock);
--- a/hotspot/src/share/vm/logging/logLevel.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/logging/logLevel.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -29,14 +29,8 @@
 
 // The list of log levels:
 //
-//  develop - A non-product level that is finer than trace.
-//            Should be used for really expensive and/or
-//            extensive logging, or logging that shouldn't
-//            or can't be included in a product build.
-//
-//  trace   - Finest level of logging in product builds.
-//            Use for extensive/noisy logging that can
-//            give slow-down when enabled.
+//  trace   - Finest level of logging. Use for extensive/noisy
+//            logging that can give slow-down when enabled.
 //
 //  debug   - A finer level of logging. Use for semi-noisy
 //            logging that is does not fit the info level.
@@ -49,7 +43,6 @@
 //  error   - Critical messages caused by errors.
 //
 #define LOG_LEVEL_LIST \
-  NOT_PRODUCT(LOG_LEVEL(Develop, develop)) \
   LOG_LEVEL(Trace, trace) \
   LOG_LEVEL(Debug, debug) \
   LOG_LEVEL(Info, info) \
--- a/hotspot/src/share/vm/logging/logTag.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -33,7 +33,8 @@
 #define LOG_TAG_LIST \
   LOG_TAG(defaultmethods) \
   LOG_TAG(logging) \
-  LOG_TAG(safepoint)
+  LOG_TAG(safepoint) \
+  LOG_TAG(vmoperation)
 
 #define PREFIX_LOG_TAG(T) (LogTag::T)
 
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -3230,36 +3230,6 @@
     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
 
-    // make sure SharedReadOnlySize and SharedReadWriteSize are not less than
-    // the minimum values.
-    if (SharedReadOnlySize < MetaspaceShared::min_ro_size){
-      report_out_of_shared_space(SharedReadOnly);
-    }
-
-    if (SharedReadWriteSize < MetaspaceShared::min_rw_size){
-      report_out_of_shared_space(SharedReadWrite);
-    }
-
-    // the min_misc_data_size and min_misc_code_size estimates are based on
-    // MetaspaceShared::generate_vtable_methods().
-    // The minimum size only accounts for the vtable methods. Any size less than the
-    // minimum required size would cause vm crash when allocating the vtable methods.
-    uint min_misc_data_size = align_size_up(
-      MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size * sizeof(void*), max_alignment);
-
-    if (SharedMiscDataSize < min_misc_data_size) {
-      report_out_of_shared_space(SharedMiscData);
-    }
-
-    uintx min_misc_code_size = align_size_up(
-      (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) *
-        (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size,
-          max_alignment);
-
-    if (SharedMiscCodeSize < min_misc_code_size) {
-      report_out_of_shared_space(SharedMiscCode);
-    }
-
     // Initialize with the sum of the shared space sizes.  The read-only
     // and read write metaspace chunks will be allocated out of this and the
     // remainder is the misc code and data chunks.
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -23,6 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classListParser.hpp"
+#include "classfile/classLoaderExt.hpp"
 #include "classfile/dictionary.hpp"
 #include "classfile/loaderConstraints.hpp"
 #include "classfile/placeholders.hpp"
@@ -42,6 +44,7 @@
 #include "runtime/signature.hpp"
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
+#include "utilities/defaultStream.hpp"
 #include "utilities/hashtable.inline.hpp"
 
 int MetaspaceShared::_max_alignment = 0;
@@ -97,6 +100,10 @@
   }
 }
 
+static void collect_classes2(Klass* k, ClassLoaderData* class_data) {
+  collect_classes(k);
+}
+
 static void remove_unshareable_in_classes() {
   for (int i = 0; i < _global_klass_objects->length(); i++) {
     Klass* k = _global_klass_objects->at(i);
@@ -422,12 +429,15 @@
   VirtualSpace _mc_vs;
   CompactHashtableWriter* _string_cht;
   GrowableArray<MemRegion> *_string_regions;
+  char* _md_alloc_low;
+  char* _md_alloc_top;
+  char* _md_alloc_max;
+  static VM_PopulateDumpSharedSpace* _instance;
 
 public:
   VM_PopulateDumpSharedSpace(ClassLoaderData* loader_data,
                              GrowableArray<Klass*> *class_promote_order) :
     _loader_data(loader_data) {
-
     // Split up and initialize the misc code and data spaces
     ReservedSpace* shared_rs = MetaspaceShared::shared_rs();
     size_t metadata_size = SharedReadOnlySize + SharedReadWriteSize;
@@ -440,11 +450,43 @@
     _md_vs.initialize(md_rs, SharedMiscDataSize);
     _mc_vs.initialize(mc_rs, SharedMiscCodeSize);
     _class_promote_order = class_promote_order;
+
+    _md_alloc_low = _md_vs.low();
+    _md_alloc_top = _md_alloc_low + sizeof(char*);
+    _md_alloc_max = _md_vs.low() + SharedMiscDataSize;
+
+    assert(_instance == NULL, "must be singleton");
+    _instance = this;
+  }
+
+  ~VM_PopulateDumpSharedSpace() {
+    assert(_instance == this, "must be singleton");
+    _instance = NULL;
+  }
+
+  static VM_PopulateDumpSharedSpace* instance() {
+    assert(_instance != NULL, "sanity");
+    return _instance;
   }
 
   VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; }
   void doit();   // outline because gdb sucks
 
+  char* misc_data_space_alloc(size_t num_bytes) {
+    size_t alignment = sizeof(char*);
+    num_bytes = align_size_up(num_bytes, alignment);
+    _md_alloc_top = (char*)align_ptr_up(_md_alloc_top, alignment);
+    if (_md_alloc_top + num_bytes > _md_alloc_max) {
+      report_out_of_shared_space(SharedMiscData);
+    }
+
+    char* p = _md_alloc_top;
+    _md_alloc_top += num_bytes;
+
+    memset(p, 0, num_bytes);
+    return p;
+  }
+
 private:
   void handle_misc_data_space_failure(bool success) {
     if (!success) {
@@ -453,6 +495,7 @@
   }
 }; // class VM_PopulateDumpSharedSpace
 
+VM_PopulateDumpSharedSpace* VM_PopulateDumpSharedSpace::_instance;
 
 void VM_PopulateDumpSharedSpace::doit() {
   Thread* THREAD = VMThread::vm_thread();
@@ -475,7 +518,11 @@
   // that so we don't have to walk the SystemDictionary again.
   _global_klass_objects = new GrowableArray<Klass*>(1000);
   Universe::basic_type_classes_do(collect_classes);
-  SystemDictionary::classes_do(collect_classes);
+
+  // Need to call SystemDictionary::classes_do(void f(Klass*, ClassLoaderData*))
+  // as we may have some classes with NULL ClassLoaderData* in the dictionary. Other
+  // variants of SystemDictionary::classes_do will skip those classes.
+  SystemDictionary::classes_do(collect_classes2);
 
   tty->print_cr("Number of classes %d", _global_klass_objects->length());
   {
@@ -515,6 +562,10 @@
   char* mc_top = mc_low;
   char* mc_end = _mc_vs.high();
 
+  assert(_md_alloc_top != NULL, "sanity");
+  *(char**)_md_alloc_low = _md_alloc_top;
+  md_top = _md_alloc_top;
+
   // Reserve space for the list of Klass*s whose vtables are used
   // for patching others as needed.
 
@@ -735,6 +786,7 @@
 void MetaspaceShared::preload_and_dump(TRAPS) {
   TraceTime timer("Dump Shared Spaces", TraceStartupTime);
   ResourceMark rm;
+  char class_list_path_str[JVM_MAXPATHLEN];
 
   tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
                 MetaspaceShared::shared_rs()->size(),
@@ -747,7 +799,6 @@
     // Construct the path to the class list (in jre/lib)
     // Walk up two directories from the location of the VM and
     // optionally tack on "lib" (depending on platform)
-    char class_list_path_str[JVM_MAXPATHLEN];
     os::jvm_path(class_list_path_str, sizeof(class_list_path_str));
     for (int i = 0; i < 3; i++) {
       char *end = strrchr(class_list_path_str, *os::file_separator());
@@ -785,6 +836,11 @@
   static const char map_entry_array_sig[] = "[Ljava/util/Map$Entry;";
   SymbolTable::new_permanent_symbol(map_entry_array_sig, THREAD);
 
+  // Need to allocate the op here:
+  // op.misc_data_space_alloc() will be called during preload_and_dump().
+  ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
+  VM_PopulateDumpSharedSpace op(loader_data, class_promote_order);
+
   tty->print_cr("Loading classes to share ...");
   _has_error_classes = false;
   class_count += preload_and_dump(class_list_path, class_promote_order,
@@ -809,44 +865,27 @@
   link_and_cleanup_shared_classes(CATCH);
   tty->print_cr("Rewriting and linking classes: done");
 
-  // Create and dump the shared spaces.   Everything so far is loaded
-  // with the null class loader.
-  ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
-  VM_PopulateDumpSharedSpace op(loader_data, class_promote_order);
   VMThread::execute(&op);
-
   // Since various initialization steps have been undone by this process,
   // it is not reasonable to continue running a java process.
   exit(0);
 }
 
-int MetaspaceShared::preload_and_dump(const char * class_list_path,
+
+int MetaspaceShared::preload_and_dump(const char* class_list_path,
                                       GrowableArray<Klass*>* class_promote_order,
                                       TRAPS) {
-  FILE* file = fopen(class_list_path, "r");
-  char class_name[256];
+  ClassListParser parser(class_list_path);
   int class_count = 0;
 
-  if (file != NULL) {
-    while ((fgets(class_name, sizeof class_name, file)) != NULL) {
-      if (*class_name == '#') { // comment
-        continue;
-      }
-      // Remove trailing newline
-      size_t name_len = strlen(class_name);
-      if (class_name[name_len-1] == '\n') {
-        class_name[name_len-1] = '\0';
-      }
+    while (parser.parse_one_line()) {
+      Klass* klass = ClassLoaderExt::load_one_class(&parser, THREAD);
 
-      // Got a class name - load it.
-      TempNewSymbol class_name_symbol = SymbolTable::new_permanent_symbol(class_name, THREAD);
-      guarantee(!HAS_PENDING_EXCEPTION, "Exception creating a symbol.");
-      Klass* klass = SystemDictionary::resolve_or_null(class_name_symbol,
-                                                         THREAD);
       CLEAR_PENDING_EXCEPTION;
       if (klass != NULL) {
         if (PrintSharedSpaces && Verbose && WizardMode) {
-          tty->print_cr("Shared spaces preloaded: %s", class_name);
+          ResourceMark rm;
+          tty->print_cr("Shared spaces preloaded: %s", klass->external_name());
         }
 
         InstanceKlass* ik = InstanceKlass::cast(klass);
@@ -862,17 +901,8 @@
         guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
 
         class_count++;
-      } else {
-        //tty->print_cr("Preload failed: %s", class_name);
       }
     }
-    fclose(file);
-  } else {
-    char errmsg[JVM_MAXPATHLEN];
-    os::lasterror(errmsg, JVM_MAXPATHLEN);
-    tty->print_cr("Loading classlist failed: %s", errmsg);
-    exit(1);
-  }
 
   return class_count;
 }
@@ -908,6 +938,11 @@
   }
 }
 
+// Allocate misc data blocks during dumping.
+char* MetaspaceShared::misc_data_space_alloc(size_t num_bytes) {
+  return VM_PopulateDumpSharedSpace::instance()->misc_data_space_alloc(num_bytes);
+}
+
 // Closure for serializing initialization data in from a data area
 // (ptr_array) read from the shared file.
 
@@ -1033,6 +1068,8 @@
 
   char* buffer = mapinfo->header()->region_addr(md);
 
+  buffer = *((char**)buffer); // skip over the md_alloc'ed blocks
+
   // Skip over (reserve space for) a list of addresses of C++ vtables
   // for Klass objects.  They get filled in later.
 
--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -32,14 +32,55 @@
 #include "utilities/exceptions.hpp"
 #include "utilities/macros.hpp"
 
-#define LargeSharedArchiveSize    (300*M)
-#define HugeSharedArchiveSize     (800*M)
-#define ReadOnlyRegionPercentage  0.4
-#define ReadWriteRegionPercentage 0.55
-#define MiscDataRegionPercentage  0.03
-#define MiscCodeRegionPercentage  0.02
-#define LargeThresholdClassCount  5000
-#define HugeThresholdClassCount   40000
+#define DEFAULT_VTBL_LIST_SIZE          (17)  // number of entries in the shared space vtable list.
+#define DEFAULT_VTBL_VIRTUALS_COUNT     (200) // maximum number of virtual functions
+// If virtual functions are added to Metadata,
+// this number needs to be increased.  Also,
+// SharedMiscCodeSize will need to be increased.
+// The following 2 sizes were based on
+// MetaspaceShared::generate_vtable_methods()
+#define DEFAULT_VTBL_METHOD_SIZE        (16)  // conservative size of the mov1 and jmp instructions
+// for the x64 platform
+#define DEFAULT_VTBL_COMMON_CODE_SIZE   (1*K) // conservative size of the "common_code" for the x64 platform
+
+#define DEFAULT_SHARED_READ_WRITE_SIZE  (NOT_LP64(12*M) LP64_ONLY(16*M))
+#define MIN_SHARED_READ_WRITE_SIZE      (NOT_LP64(7*M) LP64_ONLY(12*M))
+
+#define DEFAULT_SHARED_READ_ONLY_SIZE   (NOT_LP64(12*M) LP64_ONLY(16*M))
+#define MIN_SHARED_READ_ONLY_SIZE       (NOT_LP64(8*M) LP64_ONLY(9*M))
+
+// the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on
+// MetaspaceShared::generate_vtable_methods().
+// The minimum size only accounts for the vtable methods. Any size less than the
+// minimum required size would cause vm crash when allocating the vtable methods.
+#define SHARED_MISC_SIZE_FOR(size)      (DEFAULT_VTBL_VIRTUALS_COUNT*DEFAULT_VTBL_LIST_SIZE*size)
+
+#define DEFAULT_SHARED_MISC_DATA_SIZE   (NOT_LP64(2*M) LP64_ONLY(4*M))
+#define MIN_SHARED_MISC_DATA_SIZE       (SHARED_MISC_SIZE_FOR(sizeof(void*)))
+
+#define DEFAULT_SHARED_MISC_CODE_SIZE   (120*K)
+#define MIN_SHARED_MISC_CODE_SIZE       (SHARED_MISC_SIZE_FOR(sizeof(void*))+SHARED_MISC_SIZE_FOR(DEFAULT_VTBL_METHOD_SIZE)+DEFAULT_VTBL_COMMON_CODE_SIZE)
+
+#define DEFAULT_COMBINED_SIZE           (DEFAULT_SHARED_READ_WRITE_SIZE+DEFAULT_SHARED_READ_ONLY_SIZE+DEFAULT_SHARED_MISC_DATA_SIZE+DEFAULT_SHARED_MISC_CODE_SIZE)
+
+// the max size is the MAX size (ie. 0x7FFFFFFF) - the total size of
+// the other 3 sections - page size (to avoid overflow in case the final
+// size will get aligned up on page size)
+#define SHARED_PAGE                     ((size_t)os::vm_page_size())
+#define MAX_SHARED_DELTA                (0x7FFFFFFF)
+#define MAX_SHARED_READ_WRITE_SIZE      (MAX_SHARED_DELTA-(MIN_SHARED_READ_ONLY_SIZE+MIN_SHARED_MISC_DATA_SIZE+MIN_SHARED_MISC_CODE_SIZE)-SHARED_PAGE)
+#define MAX_SHARED_READ_ONLY_SIZE       (MAX_SHARED_DELTA-(MIN_SHARED_READ_WRITE_SIZE+MIN_SHARED_MISC_DATA_SIZE+MIN_SHARED_MISC_CODE_SIZE)-SHARED_PAGE)
+#define MAX_SHARED_MISC_DATA_SIZE       (MAX_SHARED_DELTA-(MIN_SHARED_READ_WRITE_SIZE+MIN_SHARED_READ_ONLY_SIZE+MIN_SHARED_MISC_CODE_SIZE)-SHARED_PAGE)
+#define MAX_SHARED_MISC_CODE_SIZE       (MAX_SHARED_DELTA-(MIN_SHARED_READ_WRITE_SIZE+MIN_SHARED_READ_ONLY_SIZE+MIN_SHARED_MISC_DATA_SIZE)-SHARED_PAGE)
+
+#define LargeSharedArchiveSize          (300*M)
+#define HugeSharedArchiveSize           (800*M)
+#define ReadOnlyRegionPercentage        0.4
+#define ReadWriteRegionPercentage       0.55
+#define MiscDataRegionPercentage        0.03
+#define MiscCodeRegionPercentage        0.02
+#define LargeThresholdClassCount        5000
+#define HugeThresholdClassCount         40000
 
 #define SET_ESTIMATED_SIZE(type, region)                              \
   Shared ##region## Size  = FLAG_IS_DEFAULT(Shared ##region## Size) ? \
@@ -69,21 +110,10 @@
   static bool _archive_loading_failed;
  public:
   enum {
-    vtbl_list_size         = 17,   // number of entries in the shared space vtable list.
-    num_virtuals           = 200,  // maximum number of virtual functions
-                                   // If virtual functions are added to Metadata,
-                                   // this number needs to be increased.  Also,
-                                   // SharedMiscCodeSize will need to be increased.
-                                   // The following 2 sizes were based on
-                                   // MetaspaceShared::generate_vtable_methods()
-    vtbl_method_size       = 16,   // conservative size of the mov1 and jmp instructions
-                                   // for the x64 platform
-    vtbl_common_code_size  = (1*K) // conservative size of the "common_code" for the x64 platform
-  };
-
-  enum {
-    min_ro_size = NOT_LP64(8*M) LP64_ONLY(9*M), // minimum ro and rw regions sizes based on dumping
-    min_rw_size = NOT_LP64(7*M) LP64_ONLY(12*M) // of a shared archive using the default classlist
+    vtbl_list_size         = DEFAULT_VTBL_LIST_SIZE,
+    num_virtuals           = DEFAULT_VTBL_VIRTUALS_COUNT,
+    vtbl_method_size       = DEFAULT_VTBL_METHOD_SIZE,
+    vtbl_common_code_size  = DEFAULT_VTBL_COMMON_CODE_SIZE
   };
 
   enum {
@@ -160,5 +190,8 @@
 
   static int count_class(const char* classlist_file);
   static void estimate_regions_size() NOT_CDS_RETURN;
+
+  // Allocate a block of memory from the "md" region.
+  static char* misc_data_space_alloc(size_t num_bytes);
 };
 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP
--- a/hotspot/src/share/vm/memory/universe.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -115,6 +115,7 @@
 LatestMethodCache* Universe::_loader_addClass_cache    = NULL;
 LatestMethodCache* Universe::_pd_implies_cache         = NULL;
 LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
+LatestMethodCache* Universe::_do_stack_walk_cache     = NULL;
 oop Universe::_out_of_memory_error_java_heap          = NULL;
 oop Universe::_out_of_memory_error_metaspace          = NULL;
 oop Universe::_out_of_memory_error_class_metaspace    = NULL;
@@ -240,6 +241,7 @@
   _loader_addClass_cache->serialize(f);
   _pd_implies_cache->serialize(f);
   _throw_illegal_access_error_cache->serialize(f);
+  _do_stack_walk_cache->serialize(f);
 }
 
 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
@@ -674,6 +676,7 @@
   Universe::_loader_addClass_cache    = new LatestMethodCache();
   Universe::_pd_implies_cache         = new LatestMethodCache();
   Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
+  Universe::_do_stack_walk_cache = new LatestMethodCache();
 
   if (UseSharedSpaces) {
     // Read the data structures supporting the shared spaces (shared
@@ -1048,6 +1051,17 @@
       SystemDictionary::ProtectionDomain_klass(), m);
   }
 
+  // Setup method for stack walking
+  InstanceKlass::cast(SystemDictionary::AbstractStackWalker_klass())->link_class(CHECK_false);
+  m = InstanceKlass::cast(SystemDictionary::AbstractStackWalker_klass())->
+            find_method(vmSymbols::doStackWalk_name(),
+                        vmSymbols::doStackWalk_signature());
+  // Allow NULL which should only happen with bootstrapping.
+  if (m != NULL) {
+    Universe::_do_stack_walk_cache->init(
+      SystemDictionary::AbstractStackWalker_klass(), m);
+  }
+
   // This needs to be done before the first scavenge/gc, since
   // it's an input to soft ref clearing policy.
   {
--- a/hotspot/src/share/vm/memory/universe.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/memory/universe.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -149,6 +149,7 @@
   static LatestMethodCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
   static LatestMethodCache* _pd_implies_cache;         // method for checking protection domain attributes
   static LatestMethodCache* _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method
+  static LatestMethodCache* _do_stack_walk_cache;      // method for stack walker callback
 
   // preallocated error objects (no backtrace)
   static oop          _out_of_memory_error_java_heap;
@@ -314,6 +315,8 @@
   static Method*      protection_domain_implies_method() { return _pd_implies_cache->get_method(); }
   static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error_cache->get_method(); }
 
+  static Method*      do_stack_walk_method()          { return _do_stack_walk_cache->get_method(); }
+
   static oop          null_ptr_exception_instance()   { return _null_ptr_exception_instance;   }
   static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
   static oop          virtual_machine_error_instance() { return _virtual_machine_error_instance; }
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -409,19 +409,6 @@
   return extract_high_short_from_int(ref_index);
 }
 
-constantTag ConstantPool::impl_tag_ref_at(int which, bool uncached) {
-  int pool_index = which;
-  if (!uncached && cache() != NULL) {
-    if (ConstantPool::is_invokedynamic_index(which)) {
-      // Invokedynamic index is index into resolved_references
-      pool_index = invokedynamic_cp_cache_entry_at(which)->constant_pool_index();
-    } else {
-      // change byte-ordering and go via cache
-      pool_index = remap_instruction_operand_from_cache(which);
-    }
-  }
-  return tag_at(pool_index);
-}
 
 int ConstantPool::impl_klass_ref_index_at(int which, bool uncached) {
   guarantee(!ConstantPool::is_invokedynamic_index(which),
@@ -677,7 +664,6 @@
       int callee_index             = this_cp->method_handle_klass_index_at(index);
       Symbol*  name =      this_cp->method_handle_name_ref_at(index);
       Symbol*  signature = this_cp->method_handle_signature_ref_at(index);
-      constantTag m_tag  = this_cp->tag_at(this_cp->method_handle_index_at(index));
       if (PrintMiscellaneous)
         tty->print_cr("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
                       ref_kind, index, this_cp->method_handle_index_at(index),
@@ -686,15 +672,6 @@
       { Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
         callee = KlassHandle(THREAD, k);
       }
-      if ((callee->is_interface() && m_tag.is_method()) ||
-          (!callee->is_interface() && m_tag.is_interface_method())) {
-        ResourceMark rm(THREAD);
-        char buf[200];
-        jio_snprintf(buf, sizeof(buf), "Inconsistent constant data for %s.%s%s at index %d",
-          callee->name()->as_C_string(), name->as_C_string(), signature->as_C_string(), index);
-        THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
-      }
-
       KlassHandle klass(THREAD, this_cp->pool_holder());
       Handle value = SystemDictionary::link_method_handle_constant(klass, ref_kind,
                                                                    callee, name, signature,
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -664,8 +664,6 @@
 
   int remap_instruction_operand_from_cache(int operand);  // operand must be biased by CPCACHE_INDEX_TAG
 
-  constantTag tag_ref_at(int cp_cache_index)      { return impl_tag_ref_at(cp_cache_index, false); }
-
   // Lookup for entries consisting of (name_index, signature_index)
   int name_ref_index_at(int which_nt);            // ==  low-order jshort of name_and_type_at(which_nt)
   int signature_ref_index_at(int which_nt);       // == high-order jshort of name_and_type_at(which_nt)
@@ -786,7 +784,6 @@
   Symbol* impl_signature_ref_at(int which, bool uncached);
   int       impl_klass_ref_index_at(int which, bool uncached);
   int       impl_name_and_type_ref_index_at(int which, bool uncached);
-  constantTag impl_tag_ref_at(int which, bool uncached);
 
   // Used while constructing constant pool (only by ClassFileParser)
   jint klass_index_at(int which) {
--- a/hotspot/src/share/vm/prims/jni.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -261,19 +261,6 @@
   Histogram* JNIHistogram;
   static volatile jint JNIHistogram_lock = 0;
 
-  class JNITraceWrapper : public StackObj {
-   public:
-    JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
-      if (TraceJNICalls) {
-        va_list ap;
-        va_start(ap, format);
-        tty->print("JNI ");
-        tty->vprint_cr(format, ap);
-        va_end(ap);
-      }
-    }
-  };
-
   class JNIHistogramElement : public HistogramElement {
     public:
      JNIHistogramElement(const char* name);
@@ -305,7 +292,7 @@
      static JNIHistogramElement* e = new JNIHistogramElement(arg); \
       /* There is a MT-race condition in VC++. So we need to make sure that that e has been initialized */ \
      if (e != NULL) e->increment_count()
-  #define JNIWrapper(arg) JNICountWrapper(arg); JNITraceWrapper(arg)
+  #define JNIWrapper(arg) JNICountWrapper(arg);
 #else
   #define JNIWrapper(arg)
 #endif
@@ -3759,7 +3746,7 @@
 void quicken_jni_functions() {
   // Replace Get<Primitive>Field with fast versions
   if (UseFastJNIAccessors && !JvmtiExport::can_post_field_access()
-      && !VerifyJNIFields && !TraceJNICalls && !CountJNICalls && !CheckJNICalls
+      && !VerifyJNIFields && !CountJNICalls && !CheckJNICalls
 #if defined(_WINDOWS) && defined(IA32) && defined(COMPILER2)
       // windows x86 currently needs SEH wrapper and the gain of the fast
       // versions currently isn't certain for server vm on uniprocessor.
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -46,6 +46,7 @@
 #include "prims/jvmtiThreadState.hpp"
 #include "prims/nativeLookup.hpp"
 #include "prims/privilegedStack.hpp"
+#include "prims/stackwalk.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/handles.inline.hpp"
@@ -223,19 +224,6 @@
 // Wrapper to trace JVM functions
 
 #ifdef ASSERT
-  class JVMTraceWrapper : public StackObj {
-   public:
-    JVMTraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
-      if (TraceJVMCalls) {
-        va_list ap;
-        va_start(ap, format);
-        tty->print("JVM ");
-        tty->vprint_cr(format, ap);
-        va_end(ap);
-      }
-    }
-  };
-
   Histogram* JVMHistogram;
   volatile jint JVMHistogram_lock = 0;
 
@@ -269,15 +257,9 @@
       static JVMHistogramElement* e = new JVMHistogramElement(arg); \
       if (e != NULL) e->increment_count();  // Due to bug in VC++, we need a NULL check here eventhough it should never happen!
 
-  #define JVMWrapper(arg1)                    JVMCountWrapper(arg1); JVMTraceWrapper(arg1)
-  #define JVMWrapper2(arg1, arg2)             JVMCountWrapper(arg1); JVMTraceWrapper(arg1, arg2)
-  #define JVMWrapper3(arg1, arg2, arg3)       JVMCountWrapper(arg1); JVMTraceWrapper(arg1, arg2, arg3)
-  #define JVMWrapper4(arg1, arg2, arg3, arg4) JVMCountWrapper(arg1); JVMTraceWrapper(arg1, arg2, arg3, arg4)
+  #define JVMWrapper(arg) JVMCountWrapper(arg);
 #else
-  #define JVMWrapper(arg1)
-  #define JVMWrapper2(arg1, arg2)
-  #define JVMWrapper3(arg1, arg2, arg3)
-  #define JVMWrapper4(arg1, arg2, arg3, arg4)
+  #define JVMWrapper(arg)
 #endif
 
 
@@ -547,6 +529,94 @@
 JVM_END
 
 
+// java.lang.StackWalker //////////////////////////////////////////////////////
+
+
+JVM_ENTRY(jobject, JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
+                                     jint skip_frames, jint frame_count, jint start_index,
+                                     jobjectArray classes,
+                                     jobjectArray frames))
+  JVMWrapper("JVM_CallStackWalk");
+  JavaThread* jt = (JavaThread*) THREAD;
+  if (!jt->is_Java_thread() || !jt->has_last_Java_frame()) {
+    THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: no stack trace", NULL);
+  }
+
+  Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
+  objArrayOop ca = objArrayOop(JNIHandles::resolve_non_null(classes));
+  objArrayHandle classes_array_h(THREAD, ca);
+
+  // frames array is null when only getting caller reference
+  objArrayOop fa = objArrayOop(JNIHandles::resolve(frames));
+  objArrayHandle frames_array_h(THREAD, fa);
+
+  int limit = start_index + frame_count;
+  if (classes_array_h->length() < limit) {
+    THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers", NULL);
+  }
+
+  Handle result = StackWalk::walk(stackStream_h, mode, skip_frames, frame_count,
+                                  start_index, classes_array_h,
+                                  frames_array_h, CHECK_NULL);
+  return JNIHandles::make_local(env, result());
+JVM_END
+
+
+JVM_ENTRY(jint, JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
+                                  jint frame_count, jint start_index,
+                                  jobjectArray classes,
+                                  jobjectArray frames))
+  JVMWrapper("JVM_MoreStackWalk");
+  JavaThread* jt = (JavaThread*) THREAD;
+  objArrayOop ca = objArrayOop(JNIHandles::resolve_non_null(classes));
+  objArrayHandle classes_array_h(THREAD, ca);
+
+  // frames array is null when only getting caller reference
+  objArrayOop fa = objArrayOop(JNIHandles::resolve(frames));
+  objArrayHandle frames_array_h(THREAD, fa);
+
+  int limit = start_index+frame_count;
+  if (classes_array_h->length() < limit) {
+    THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers");
+  }
+
+  Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
+  return StackWalk::moreFrames(stackStream_h, mode, anchor, frame_count,
+                               start_index, classes_array_h,
+                               frames_array_h, THREAD);
+JVM_END
+
+JVM_ENTRY(void, JVM_FillStackFrames(JNIEnv *env, jclass stackStream,
+                                    jint start_index,
+                                    jobjectArray frames,
+                                    jint from_index, jint to_index))
+  JVMWrapper("JVM_FillStackFrames");
+  if (TraceStackWalk) {
+    tty->print("JVM_FillStackFrames() start_index=%d from_index=%d to_index=%d\n",
+               start_index, from_index, to_index);
+  }
+
+  JavaThread* jt = (JavaThread*) THREAD;
+
+  objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));
+  objArrayHandle frames_array_h(THREAD, fa);
+
+  if (frames_array_h->length() < to_index) {
+    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "array length not matched");
+  }
+
+  for (int i = from_index; i < to_index; i++) {
+    Handle stackFrame(THREAD, frames_array_h->obj_at(i));
+    java_lang_StackFrameInfo::fill_methodInfo(stackFrame, CHECK);
+  }
+JVM_END
+
+JVM_ENTRY(void, JVM_SetMethodInfo(JNIEnv *env, jobject frame))
+  JVMWrapper("JVM_SetMethodInfo");
+  Handle stackFrame(THREAD, JNIHandles::resolve(frame));
+  java_lang_StackFrameInfo::fill_methodInfo(stackFrame, THREAD);
+JVM_END
+
 // java.lang.Object ///////////////////////////////////////////////
 
 
@@ -672,7 +742,7 @@
 // java.io.File ///////////////////////////////////////////////////////////////
 
 JVM_LEAF(char*, JVM_NativePath(char* path))
-  JVMWrapper2("JVM_NativePath (%s)", path);
+  JVMWrapper("JVM_NativePath");
   return os::native_path(path);
 JVM_END
 
@@ -749,7 +819,7 @@
 // FindClassFromBootLoader is exported to the launcher for windows.
 JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
                                               const char* name))
-  JVMWrapper2("JVM_FindClassFromBootLoader %s", name);
+  JVMWrapper("JVM_FindClassFromBootLoader");
 
   // Java libraries should ensure that name is never null...
   if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
@@ -774,7 +844,7 @@
 JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name,
                                           jboolean init, jobject loader,
                                           jclass caller))
-  JVMWrapper2("JVM_FindClassFromCaller %s throws ClassNotFoundException", name);
+  JVMWrapper("JVM_FindClassFromCaller throws ClassNotFoundException");
   // Java libraries should ensure that name is never null...
   if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
     // It's impossible to create this class;  the name cannot fit
@@ -809,7 +879,7 @@
 
 JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
                                          jboolean init, jclass from))
-  JVMWrapper2("JVM_FindClassFromClass %s", name);
+  JVMWrapper("JVM_FindClassFromClass");
   if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
     // It's impossible to create this class;  the name cannot fit
     // into the constant pool.
@@ -861,11 +931,10 @@
 }
 
 // common code for JVM_DefineClass() and JVM_DefineClassWithSource()
-// and JVM_DefineClassWithSourceCond()
 static jclass jvm_define_class_common(JNIEnv *env, const char *name,
                                       jobject loader, const jbyte *buf,
                                       jsize len, jobject pd, const char *source,
-                                      jboolean verify, TRAPS) {
+                                      TRAPS) {
   if (source == NULL)  source = "__JVM_DefineClass__";
 
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
@@ -906,8 +975,7 @@
   Handle protection_domain (THREAD, JNIHandles::resolve(pd));
   Klass* k = SystemDictionary::resolve_from_stream(class_name, class_loader,
                                                      protection_domain, &st,
-                                                     verify != 0,
-                                                     CHECK_NULL);
+                                                     true, CHECK_NULL);
 
   if (TraceClassResolution && k != NULL) {
     trace_class_resolution(k);
@@ -918,25 +986,16 @@
 
 
 JVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd))
-  JVMWrapper2("JVM_DefineClass %s", name);
-
-  return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, true, THREAD);
+  JVMWrapper("JVM_DefineClass");
+
+  return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, THREAD);
 JVM_END
 
 
 JVM_ENTRY(jclass, JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source))
-  JVMWrapper2("JVM_DefineClassWithSource %s", name);
-
-  return jvm_define_class_common(env, name, loader, buf, len, pd, source, true, THREAD);
-JVM_END
-
-JVM_ENTRY(jclass, JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
-                                                jobject loader, const jbyte *buf,
-                                                jsize len, jobject pd,
-                                                const char *source, jboolean verify))
-  JVMWrapper2("JVM_DefineClassWithSourceCond %s", name);
-
-  return jvm_define_class_common(env, name, loader, buf, len, pd, source, verify, THREAD);
+  JVMWrapper("JVM_DefineClassWithSource");
+
+  return jvm_define_class_common(env, name, loader, buf, len, pd, source, THREAD);
 JVM_END
 
 JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name))
@@ -3361,7 +3420,7 @@
 
 JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))
   //%note jvm_ct
-  JVMWrapper2("JVM_LoadLibrary (%s)", name);
+  JVMWrapper("JVM_LoadLibrary");
   char ebuf[1024];
   void *load_result;
   {
@@ -3393,7 +3452,7 @@
 
 
 JVM_LEAF(void*, JVM_FindLibraryEntry(void* handle, const char* name))
-  JVMWrapper2("JVM_FindLibraryEntry (%s)", name);
+  JVMWrapper("JVM_FindLibraryEntry");
   return os::dll_lookup(handle, name);
 JVM_END
 
@@ -3401,7 +3460,7 @@
 // JNI version ///////////////////////////////////////////////////////////////////////////////
 
 JVM_LEAF(jboolean, JVM_IsSupportedJNIVersion(jint version))
-  JVMWrapper2("JVM_IsSupportedJNIVersion (%d)", version);
+  JVMWrapper("JVM_IsSupportedJNIVersion");
   return Threads::is_supported_jni_version_including_1_1(version);
 JVM_END
 
--- a/hotspot/src/share/vm/prims/jvm.h	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvm.h	Wed Nov 25 16:13:14 2015 +0000
@@ -201,6 +201,37 @@
 JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
 
 /*
+ * java.lang.StackWalker
+ */
+enum {
+  JVM_STACKWALK_FILL_CLASS_REFS_ONLY       = 0x2,
+  JVM_STACKWALK_FILTER_FILL_IN_STACK_TRACE = 0x10,
+  JVM_STACKWALK_SHOW_HIDDEN_FRAMES         = 0x20,
+  JVM_STACKWALK_FILL_LIVE_STACK_FRAMES     = 0x100
+};
+
+JNIEXPORT jobject JNICALL
+JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
+                  jint skip_frames, jint frame_count, jint start_index,
+                  jobjectArray classes,
+                  jobjectArray frames);
+
+JNIEXPORT jint JNICALL
+JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
+                  jint frame_count, jint start_index,
+                  jobjectArray classes,
+                  jobjectArray frames);
+
+JNIEXPORT void JNICALL
+JVM_FillStackFrames(JNIEnv* env, jclass cls,
+                    jint start_index,
+                    jobjectArray frames,
+                    jint from_index, jint toIndex);
+
+JNIEXPORT void JNICALL
+JVM_SetMethodInfo(JNIEnv* env, jobject frame);
+
+/*
  * java.lang.Thread
  */
 JNIEXPORT void JNICALL
@@ -378,17 +409,6 @@
                           const jbyte *buf, jsize len, jobject pd,
                           const char *source);
 
-/* Define a class with a source with conditional verification (added HSX 14)
- * -Xverify:all will verify anyway, -Xverify:none will not verify,
- * -Xverify:remote (default) will obey this conditional
- * i.e. true = should_verify_class
- */
-JNIEXPORT jclass JNICALL
-JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
-                              jobject loader, const jbyte *buf,
-                              jsize len, jobject pd, const char *source,
-                              jboolean verify);
-
 /*
  * Reflection support functions
  */
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -679,7 +679,7 @@
   case IS_METHOD:
     {
       CallInfo result;
-      LinkInfo link_info(defc, name, type, caller);
+      LinkInfo link_info(defc, name, type, caller, caller.not_null());
       {
         assert(!HAS_PENDING_EXCEPTION, "");
         if (ref_kind == JVM_REF_invokeStatic) {
@@ -716,7 +716,7 @@
   case IS_CONSTRUCTOR:
     {
       CallInfo result;
-      LinkInfo link_info(defc, name, type, caller);
+      LinkInfo link_info(defc, name, type, caller, caller.not_null());
       {
         assert(!HAS_PENDING_EXCEPTION, "");
         if (name == vmSymbols::object_initializer_name()) {
@@ -737,7 +737,7 @@
       fieldDescriptor result; // find_field initializes fd if found
       {
         assert(!HAS_PENDING_EXCEPTION, "");
-        LinkInfo link_info(defc, name, type, caller, LinkInfo::skip_access_check);
+        LinkInfo link_info(defc, name, type, caller, /*check_access*/false);
         LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD);
         if (HAS_PENDING_EXCEPTION) {
           return empty;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,470 @@
+/*
+ * Copyright (c) 2015, 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 "classfile/javaClasses.hpp"
+#include "classfile/javaClasses.inline.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "memory/oopFactory.hpp"
+#include "oops/oop.inline.hpp"
+#include "oops/objArrayOop.inline.hpp"
+#include "prims/stackwalk.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/handles.inline.hpp"
+#include "runtime/javaCalls.hpp"
+#include "runtime/vframe.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// setup and cleanup actions
+void StackWalkAnchor::setup_magic_on_entry(objArrayHandle classes_array) {
+  classes_array->obj_at_put(magic_pos, _thread->threadObj());
+  _anchor = address_value();
+  assert(check_magic(classes_array), "invalid magic");
+}
+
+bool StackWalkAnchor::check_magic(objArrayHandle classes_array) {
+  oop   m1 = classes_array->obj_at(magic_pos);
+  jlong m2 = _anchor;
+  if (m1 == _thread->threadObj() && m2 == address_value())  return true;
+  return false;
+}
+
+bool StackWalkAnchor::cleanup_magic_on_exit(objArrayHandle classes_array) {
+  bool ok = check_magic(classes_array);
+  classes_array->obj_at_put(magic_pos, NULL);
+  _anchor = 0L;
+  return ok;
+}
+
+// Returns StackWalkAnchor for the current stack being traversed.
+//
+// Parameters:
+//  thread         Current Java thread.
+//  magic          Magic value used for each stack walking
+//  classes_array  User-supplied buffers.  The 0th element is reserved
+//                 to this StackWalkAnchor to use
+//
+StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic,
+                                               objArrayHandle classes_array)
+{
+  assert(thread != NULL && thread->is_Java_thread(), "");
+  oop m1 = classes_array->obj_at(magic_pos);
+  if (m1 != thread->threadObj())      return NULL;
+  if (magic == 0L)                    return NULL;
+  StackWalkAnchor* anchor = (StackWalkAnchor*) (intptr_t) magic;
+  if (!anchor->is_valid_in(thread, classes_array))   return NULL;
+  return anchor;
+}
+
+// Unpacks one or more frames into user-supplied buffers.
+// Updates the end index, and returns the number of unpacked frames.
+// Always start with the existing vfst.method and bci.
+// Do not call vfst.next to advance over the last returned value.
+// In other words, do not leave any stale data in the vfst.
+//
+// Parameters:
+//   mode           Restrict which frames to be decoded.
+//   vfst           vFrameStream.
+//   max_nframes    Maximum number of frames to be filled.
+//   start_index    Start index to the user-supplied buffers.
+//   classes_array  Buffer to store classes in, starting at start_index.
+//   frames_array   Buffer to store StackFrame in, starting at start_index.
+//                  NULL if not used.
+//   end_index      End index to the user-supplied buffers with unpacked frames.
+//
+// Returns the number of frames whose information was transferred into the buffers.
+//
+int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst,
+                              int max_nframes, int start_index,
+                              objArrayHandle  classes_array,
+                              objArrayHandle  frames_array,
+                              int& end_index, TRAPS) {
+  if (TraceStackWalk) {
+    tty->print_cr("fill_in_frames limit=%d start=%d frames length=%d",
+                  max_nframes, start_index, classes_array->length());
+  }
+  assert(max_nframes > 0, "invalid max_nframes");
+  assert(start_index + max_nframes <= classes_array->length(), "oob");
+
+  int frames_decoded = 0;
+  for (; !vfst.at_end(); vfst.next()) {
+    Method* method = vfst.method();
+    int bci = vfst.bci();
+
+    if (method == NULL) continue;
+    if (!ShowHiddenFrames && StackWalk::skip_hidden_frames(mode)) {
+      if (method->is_hidden()) {
+        if (TraceStackWalk) {
+          tty->print("  hidden method: "); method->print_short_name();
+          tty->print("\n");
+        }
+        continue;
+      }
+    }
+
+    int index = end_index++;
+    if (TraceStackWalk) {
+      tty->print("  %d: frame method: ", index); method->print_short_name();
+      tty->print_cr(" bci=%d", bci);
+    }
+
+    classes_array->obj_at_put(index, method->method_holder()->java_mirror());
+    // fill in StackFrameInfo and initialize MemberName
+    if (live_frame_info(mode)) {
+      Handle stackFrame(frames_array->obj_at(index));
+      fill_live_stackframe(stackFrame, method, bci, vfst.java_frame(), CHECK_0);
+    } else if (need_method_info(mode)) {
+      Handle stackFrame(frames_array->obj_at(index));
+      fill_stackframe(stackFrame, method, bci);
+    }
+    if (++frames_decoded >= max_nframes)  break;
+  }
+  return frames_decoded;
+}
+
+static oop create_primitive_value_instance(StackValueCollection* values, int i, TRAPS) {
+  Klass* k = SystemDictionary::resolve_or_null(vmSymbols::java_lang_LiveStackFrameInfo(), CHECK_NULL);
+  instanceKlassHandle ik (THREAD, k);
+
+  JavaValue result(T_OBJECT);
+  JavaCallArguments args;
+  Symbol* signature = NULL;
+
+  // ## TODO: type is only available in LocalVariable table, if present.
+  // ## StackValue type is T_INT or T_OBJECT.
+  switch (values->at(i)->type()) {
+    case T_INT:
+      args.push_int(values->int_at(i));
+      signature = vmSymbols::asPrimitive_int_signature();
+      break;
+
+    case T_LONG:
+      args.push_long(values->long_at(i));
+      signature = vmSymbols::asPrimitive_long_signature();
+      break;
+
+    case T_FLOAT:
+      args.push_float(values->float_at(i));
+      signature = vmSymbols::asPrimitive_float_signature();
+      break;
+
+    case T_DOUBLE:
+      args.push_double(values->double_at(i));
+      signature = vmSymbols::asPrimitive_double_signature();
+      break;
+
+    case T_BYTE:
+      args.push_int(values->int_at(i));
+      signature = vmSymbols::asPrimitive_byte_signature();
+      break;
+
+    case T_SHORT:
+      args.push_int(values->int_at(i));
+      signature = vmSymbols::asPrimitive_short_signature();
+      break;
+
+    case T_CHAR:
+      args.push_int(values->int_at(i));
+      signature = vmSymbols::asPrimitive_char_signature();
+      break;
+
+    case T_BOOLEAN:
+      args.push_int(values->int_at(i));
+      signature = vmSymbols::asPrimitive_boolean_signature();
+      break;
+
+    case T_OBJECT:
+      return values->obj_at(i)();
+
+    case T_CONFLICT:
+      // put a non-null slot
+      args.push_int(0);
+      signature = vmSymbols::asPrimitive_int_signature();
+      break;
+
+    default: ShouldNotReachHere();
+  }
+  JavaCalls::call_static(&result,
+                         ik,
+                         vmSymbols::asPrimitive_name(),
+                         signature,
+                         &args,
+                         CHECK_NULL);
+  return (instanceOop) result.get_jobject();
+}
+
+static objArrayHandle values_to_object_array(StackValueCollection* values, TRAPS) {
+  objArrayHandle empty;
+  int length = values->size();
+  objArrayOop array_oop = oopFactory::new_objArray(SystemDictionary::Object_klass(),
+                                                   length, CHECK_(empty));
+  objArrayHandle array_h(THREAD, array_oop);
+  for (int i = 0; i < values->size(); i++) {
+    StackValue* st = values->at(i);
+    oop obj = create_primitive_value_instance(values, i, CHECK_(empty));
+    if (obj != NULL)
+      array_h->obj_at_put(i, obj);
+  }
+  return array_h;
+}
+
+static objArrayHandle monitors_to_object_array(GrowableArray<MonitorInfo*>* monitors, TRAPS) {
+  int length = monitors->length();
+  objArrayOop array_oop = oopFactory::new_objArray(SystemDictionary::Object_klass(),
+                                                   length, CHECK_(objArrayHandle()));
+  objArrayHandle array_h(THREAD, array_oop);
+  for (int i = 0; i < length; i++) {
+    MonitorInfo* monitor = monitors->at(i);
+    array_h->obj_at_put(i, monitor->owner());
+  }
+  return array_h;
+}
+
+// Fill StackFrameInfo with declaringClass and bci and initialize memberName
+void StackWalk::fill_stackframe(Handle stackFrame, const methodHandle& method, int bci) {
+  java_lang_StackFrameInfo::set_declaringClass(stackFrame(), method->method_holder()->java_mirror());
+  java_lang_StackFrameInfo::set_method_and_bci(stackFrame(), method, bci);
+}
+
+// Fill LiveStackFrameInfo with locals, monitors, and expressions
+void StackWalk::fill_live_stackframe(Handle stackFrame, const methodHandle& method,
+                                     int bci, javaVFrame* jvf, TRAPS) {
+  fill_stackframe(stackFrame, method, bci);
+  if (jvf != NULL) {
+    StackValueCollection* locals = jvf->locals();
+    StackValueCollection* expressions = jvf->expressions();
+    GrowableArray<MonitorInfo*>* monitors = jvf->monitors();
+
+    if (!locals->is_empty()) {
+      objArrayHandle locals_h = values_to_object_array(locals, CHECK);
+      java_lang_LiveStackFrameInfo::set_locals(stackFrame(), locals_h());
+    }
+    if (!expressions->is_empty()) {
+      objArrayHandle expressions_h = values_to_object_array(expressions, CHECK);
+      java_lang_LiveStackFrameInfo::set_operands(stackFrame(), expressions_h());
+    }
+    if (monitors->length() > 0) {
+      objArrayHandle monitors_h = monitors_to_object_array(monitors, CHECK);
+      java_lang_LiveStackFrameInfo::set_monitors(stackFrame(), monitors_h());
+    }
+  }
+}
+
+// Begins stack walking.
+//
+// Parameters:
+//   stackStream    StackStream object
+//   mode           Stack walking mode.
+//   skip_frames    Number of frames to be skipped.
+//   frame_count    Number of frames to be traversed.
+//   start_index    Start index to the user-supplied buffers.
+//   classes_array  Buffer to store classes in, starting at start_index.
+//   frames_array   Buffer to store StackFrame in, starting at start_index.
+//                  NULL if not used.
+//
+// Returns Object returned from AbstractStackWalker::doStackWalk call.
+//
+oop StackWalk::walk(Handle stackStream, jlong mode,
+                    int skip_frames, int frame_count, int start_index,
+                    objArrayHandle classes_array,
+                    objArrayHandle frames_array,
+                    TRAPS) {
+  JavaThread* jt = (JavaThread*)THREAD;
+  if (TraceStackWalk) {
+    tty->print_cr("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
+                  mode, skip_frames, frame_count);
+  }
+
+  if (need_method_info(mode)) {
+    if (frames_array.is_null()) {
+      THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", NULL);
+    }
+  }
+
+  Klass* stackWalker_klass = SystemDictionary::StackWalker_klass();
+  Klass* abstractStackWalker_klass = SystemDictionary::AbstractStackWalker_klass();
+
+  methodHandle m_doStackWalk(THREAD, Universe::do_stack_walk_method());
+
+  // Open up a traversable stream onto my stack.
+  // This stream will be made available by *reference* to the inner Java call.
+  StackWalkAnchor anchor(jt);
+  vframeStream& vfst = anchor.vframe_stream();
+
+  {
+    // Skip all methods from AbstractStackWalker and StackWalk (enclosing method)
+    if (!fill_in_stacktrace(mode)) {
+      while (!vfst.at_end()) {
+        InstanceKlass* ik = vfst.method()->method_holder();
+        if (ik != stackWalker_klass &&
+              ik != abstractStackWalker_klass && ik->super() != abstractStackWalker_klass)  {
+          break;
+        }
+
+        if (TraceStackWalk) {
+          tty->print("  skip "); vfst.method()->print_short_name(); tty->print("\n");
+        }
+        vfst.next();
+      }
+    }
+
+    // For exceptions, skip Throwable::fillInStackTrace and <init> methods
+    // of the exception class and superclasses
+    if (fill_in_stacktrace(mode)) {
+      bool skip_to_fillInStackTrace = false;
+      bool skip_throwableInit_check = false;
+      while (!vfst.at_end() && !skip_throwableInit_check) {
+        InstanceKlass* ik = vfst.method()->method_holder();
+        Method* method = vfst.method();
+        if (!skip_to_fillInStackTrace) {
+          if (ik == SystemDictionary::Throwable_klass() &&
+              method->name() == vmSymbols::fillInStackTrace_name()) {
+              // this frame will be skipped
+              skip_to_fillInStackTrace = true;
+          }
+        } else if (!(ik->is_subclass_of(SystemDictionary::Throwable_klass()) &&
+                     method->name() == vmSymbols::object_initializer_name())) {
+            // there are none or we've seen them all - either way stop checking
+            skip_throwableInit_check = true;
+            break;
+        }
+
+        if (TraceStackWalk) {
+          tty->print("stack walk: skip "); vfst.method()->print_short_name(); tty->print("\n");
+        }
+        vfst.next();
+      }
+    }
+
+    // stack frame has been traversed individually and resume stack walk
+    // from the stack frame at depth == skip_frames.
+    for (int n=0; n < skip_frames && !vfst.at_end(); vfst.next(), n++) {
+      if (TraceStackWalk) {
+        tty->print("  skip "); vfst.method()->print_short_name();
+        tty->print_cr(" frame id: " PTR_FORMAT " pc: " PTR_FORMAT,
+                      p2i(vfst.frame_id()), p2i(vfst.frame_pc()));
+      }
+    }
+  }
+
+  // The Method* pointer in the vfst has a very short shelf life.  Grab it now.
+  int end_index = start_index;
+  int numFrames = 0;
+  if (!vfst.at_end()) {
+    numFrames = fill_in_frames(mode, vfst, frame_count, start_index, classes_array,
+                               frames_array, end_index, CHECK_NULL);
+    if (numFrames < 1) {
+      THROW_MSG_(vmSymbols::java_lang_InternalError(), "stack walk: decode failed", NULL);
+    }
+  }
+
+  // JVM_CallStackWalk walks the stack and fills in stack frames, then calls to
+  // Java method java.lang.StackStreamFactory.AbstractStackWalker::doStackWalk
+  // which calls the implementation to consume the stack frames.
+  // When JVM_CallStackWalk returns, it invalidates the stack stream.
+  JavaValue result(T_OBJECT);
+  JavaCallArguments args(stackStream);
+  args.push_long(anchor.address_value());
+  args.push_int(skip_frames);
+  args.push_int(frame_count);
+  args.push_int(start_index);
+  args.push_int(end_index);
+
+  // Link the thread and vframe stream into the callee-visible object
+  anchor.setup_magic_on_entry(classes_array);
+
+  JavaCalls::call(&result, m_doStackWalk, &args, THREAD);
+
+  // Do this before anything else happens, to disable any lingering stream objects
+  bool ok = anchor.cleanup_magic_on_exit(classes_array);
+
+  // Throw pending exception if we must
+  (void) (CHECK_NULL);
+
+  if (!ok) {
+    THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers on exit", NULL);
+  }
+
+  // Return normally
+  return (oop)result.get_jobject();
+
+}
+
+// Walk the next batch of stack frames
+//
+// Parameters:
+//   stackStream    StackStream object
+//   mode           Stack walking mode.
+//   magic          Must be valid value to continue the stack walk
+//   frame_count    Number of frames to be decoded.
+//   start_index    Start index to the user-supplied buffers.
+//   classes_array  Buffer to store classes in, starting at start_index.
+//   frames_array   Buffer to store StackFrame in, starting at start_index.
+//                  NULL if not used.
+//
+// Returns the end index of frame filled in the buffer.
+//
+jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
+                           int frame_count, int start_index,
+                           objArrayHandle classes_array,
+                           objArrayHandle frames_array,
+                           TRAPS)
+{
+  JavaThread* jt = (JavaThread*)THREAD;
+  StackWalkAnchor* existing_anchor = StackWalkAnchor::from_current(jt, magic, classes_array);
+  if (existing_anchor == NULL) {
+    THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L);
+  }
+
+  if ((need_method_info(mode) || live_frame_info(mode)) && frames_array.is_null()) {
+    THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", 0L);
+  }
+
+  if (TraceStackWalk) {
+    tty->print_cr("StackWalk::moreFrames frame_count %d existing_anchor " PTR_FORMAT " start %d frames %d",
+                  frame_count, p2i(existing_anchor), start_index, classes_array->length());
+  }
+  int end_index = start_index;
+  if (frame_count <= 0) {
+    return end_index;        // No operation.
+  }
+
+  int count = frame_count + start_index;
+  assert (classes_array->length() >= count, "not enough space in buffers");
+
+  StackWalkAnchor& anchor = (*existing_anchor);
+  vframeStream& vfst = anchor.vframe_stream();
+  if (!vfst.at_end()) {
+    vfst.next();  // this was the last frame decoded in the previous batch
+    if (!vfst.at_end()) {
+      int n = fill_in_frames(mode, vfst, frame_count, start_index, classes_array,
+                             frames_array, end_index, CHECK_0);
+      if (n < 1) {
+        THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L);
+      }
+      return end_index;
+    }
+  }
+  return end_index;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/prims/stackwalk.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2015, 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_STACKWALK_HPP
+#define SHARE_VM_PRIMS_STACKWALK_HPP
+
+#include "oops/oop.hpp"
+#include "runtime/vframe.hpp"
+
+class StackWalkAnchor : public StackObj {
+private:
+  enum {
+    magic_pos = 0
+  };
+
+  JavaThread*           _thread;
+  vframeStream          _vfst;
+  jlong                 _anchor;
+public:
+  StackWalkAnchor(JavaThread* thread)
+    : _thread(thread), _vfst(thread), _anchor(0L) {}
+
+  vframeStream&   vframe_stream()         { return _vfst; }
+  JavaThread*     thread()                { return _thread; }
+
+  void setup_magic_on_entry(objArrayHandle classes_array);
+  bool check_magic(objArrayHandle classes_array);
+  bool cleanup_magic_on_exit(objArrayHandle classes_array);
+
+  bool is_valid_in(Thread* thread, objArrayHandle classes_array) {
+    return (_thread == thread && check_magic(classes_array));
+  }
+
+  jlong address_value() {
+    return (jlong) castable_address(this);
+  }
+
+  static StackWalkAnchor* from_current(JavaThread* thread, jlong anchor, objArrayHandle frames_array);
+};
+
+class StackWalk : public AllStatic {
+private:
+  static int fill_in_frames(jlong mode, vframeStream& vfst,
+                            int max_nframes, int start_index,
+                            objArrayHandle classes_array,
+                            objArrayHandle frames_array,
+                            int& end_index, TRAPS);
+
+  static void fill_stackframe(Handle stackFrame, const methodHandle& method, int bci);
+
+  static void fill_live_stackframe(Handle stackFrame, const methodHandle& method, int bci,
+                                   javaVFrame* jvf, TRAPS);
+
+  static inline bool skip_hidden_frames(int mode) {
+    return (mode & JVM_STACKWALK_SHOW_HIDDEN_FRAMES) == 0;
+  }
+  static inline bool need_method_info(int mode) {
+    return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
+  }
+  static inline bool live_frame_info(int mode) {
+    return (mode & JVM_STACKWALK_FILL_LIVE_STACK_FRAMES) != 0;
+  }
+  static inline bool fill_in_stacktrace(int mode) {
+    return (mode & JVM_STACKWALK_FILTER_FILL_IN_STACK_TRACE) != 0;
+  }
+
+public:
+  static oop walk(Handle stackStream, jlong mode,
+                  int skip_frames, int frame_count, int start_index,
+                  objArrayHandle classes_array,
+                  objArrayHandle frames_array,
+                  TRAPS);
+
+  static jint moreFrames(Handle stackStream, jlong mode, jlong magic,
+                         int frame_count, int start_index,
+                         objArrayHandle classes_array,
+                         objArrayHandle frames_array,
+                         TRAPS);
+};
+#endif // SHARE_VM_PRIMS_STACKWALK_HPP
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1271,6 +1271,10 @@
                    attemptedNoSafepointValue == JNI_TRUE);
 WB_END
 
+WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
+  return (jboolean)MetaspaceShared::is_in_shared_space(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
+WB_END
+
 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
   oop obj_oop = JNIHandles::resolve(obj);
   return (jboolean) obj_oop->mark()->has_monitor();
@@ -1471,6 +1475,7 @@
   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
+  {CC"isSharedClass", CC"(Ljava/lang/Class;)Z",       (void*)&WB_IsSharedClass },
 #if INCLUDE_ALL_GCS
   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
   {CC"g1IsHumongous0",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -3425,7 +3425,7 @@
   }
 
   if (!PrintSharedArchiveAndExit) {
-    ClassLoader::trace_class_path("[classpath: ", _java_class_path->value());
+    ClassLoader::trace_class_path(tty, "[classpath: ", _java_class_path->value());
   }
 }
 
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -223,7 +223,7 @@
 #define EMIT_CONSTRAINT_CHECK(func, type)                               , func, CommandLineFlagConstraint::type
 
 // the "name" argument must be a string literal
-#define INITIAL_CONSTRAINTS_SIZE 45
+#define INITIAL_CONSTRAINTS_SIZE 69
 GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL;
 CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse;
 
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -279,7 +279,7 @@
 // Generate func argument to pass into emit_range_xxx functions
 #define EMIT_RANGE_CHECK(a, b)                               , a, b
 
-#define INITIAL_RANGES_SIZE 205
+#define INITIAL_RANGES_SIZE 320
 GrowableArray<CommandLineFlagRange*>* CommandLineFlagRangeList::_ranges = NULL;
 
 // Check the ranges of all flags that have them
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
 #define SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
 
+#include "memory/metaspaceShared.hpp"
 #include "runtime/globals.hpp"
 #include "utilities/growableArray.hpp"
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -1073,9 +1073,6 @@
   develop(bool, BreakAtWarning, false,                                      \
           "Execute breakpoint upon encountering VM warning")                \
                                                                             \
-  develop(bool, TraceVMOperation, false,                                    \
-          "Trace VM operations")                                            \
-                                                                            \
   develop(bool, UseFakeTimers, false,                                       \
           "Tell whether the VM should use system time or a fake timer")     \
                                                                             \
@@ -1429,18 +1426,9 @@
                                                                             \
   /* tracing */                                                             \
                                                                             \
-  notproduct(bool, TraceRuntimeCalls, false,                                \
-          "Trace run-time calls")                                           \
-                                                                            \
-  develop(bool, TraceJNICalls, false,                                       \
-          "Trace JNI calls")                                                \
-                                                                            \
   develop(bool, StressRewriter, false,                                      \
           "Stress linktime bytecode rewriting")                             \
                                                                             \
-  notproduct(bool, TraceJVMCalls, false,                                    \
-          "Trace JVM calls")                                                \
-                                                                            \
   product(ccstr, TraceJVMTI, NULL,                                          \
           "Trace flags for JVMTI functions and events")                     \
                                                                             \
@@ -3118,6 +3106,12 @@
           "exceptions (0 means all)")                                       \
           range(0, max_jint/2)                                              \
                                                                             \
+  develop(bool, TraceStackWalk, false,                                      \
+          "Trace stack walking")                                            \
+                                                                            \
+  product(bool, MemberNameInStackFrame, true,                               \
+          "Use MemberName in StackFrame")                                   \
+                                                                            \
   /* notice: the max range value here is max_jint, not max_intx  */         \
   /* because of overflow issue                                   */         \
   NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000,          \
@@ -4110,21 +4104,26 @@
           "If PrintSharedArchiveAndExit is true, also print the shared "    \
           "dictionary")                                                     \
                                                                             \
-  product(size_t, SharedReadWriteSize, NOT_LP64(12*M) LP64_ONLY(16*M),      \
+  product(size_t, SharedReadWriteSize, DEFAULT_SHARED_READ_WRITE_SIZE,      \
           "Size of read-write space for metadata (in bytes)")               \
-                                                                            \
-  product(size_t, SharedReadOnlySize, NOT_LP64(12*M) LP64_ONLY(16*M),       \
+          range(MIN_SHARED_READ_WRITE_SIZE, MAX_SHARED_READ_WRITE_SIZE)     \
+                                                                            \
+  product(size_t, SharedReadOnlySize, DEFAULT_SHARED_READ_ONLY_SIZE,        \
           "Size of read-only space for metadata (in bytes)")                \
-                                                                            \
-  product(uintx, SharedMiscDataSize,    NOT_LP64(2*M) LP64_ONLY(4*M),       \
+          range(MIN_SHARED_READ_ONLY_SIZE, MAX_SHARED_READ_ONLY_SIZE)       \
+                                                                            \
+  product(size_t, SharedMiscDataSize, DEFAULT_SHARED_MISC_DATA_SIZE,        \
           "Size of the shared miscellaneous data area (in bytes)")          \
-                                                                            \
-  product(uintx, SharedMiscCodeSize,    120*K,                              \
+          range(MIN_SHARED_MISC_DATA_SIZE, MAX_SHARED_MISC_DATA_SIZE)       \
+                                                                            \
+  product(size_t, SharedMiscCodeSize, DEFAULT_SHARED_MISC_CODE_SIZE,        \
           "Size of the shared miscellaneous code area (in bytes)")          \
-                                                                            \
-  product(uintx, SharedBaseAddress, LP64_ONLY(32*G)                         \
+          range(MIN_SHARED_MISC_CODE_SIZE, MAX_SHARED_MISC_CODE_SIZE)       \
+                                                                            \
+  product(size_t, SharedBaseAddress, LP64_ONLY(32*G)                        \
           NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)),                           \
           "Address to allocate shared memory region for class data")        \
+          range(0, SIZE_MAX)                                                \
                                                                             \
   product(uintx, SharedSymbolTableBucketSize, 4,                            \
           "Average number of symbols per bucket in shared table")           \
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -70,10 +70,6 @@
   Atomic::dec(&RuntimeHistogram_lock);
 }
 
-void InterfaceSupport::trace(const char* result_type, const char* header) {
-  tty->print_cr("%6ld  %s", _number_of_calls, header);
-}
-
 void InterfaceSupport::gc_alot() {
   Thread *thread = Thread::current();
   if (!thread->is_Java_thread()) return; // Avoid concurrent calls
--- a/hotspot/src/share/vm/runtime/interfaceSupport.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -74,9 +74,6 @@
   static long _number_of_calls;
   static long _fullgc_alot_invocation;
 
-  // tracing
-  static void trace(const char* result_type, const char* header);
-
   // Helper methods used to implement +ScavengeALot and +FullGCALot
   static void check_gc_alot() { if (ScavengeALot || FullGCALot) gc_alot(); }
   static void gc_alot();
@@ -402,8 +399,6 @@
 
 #define TRACE_CALL(result_type, header)                            \
   InterfaceSupport::_number_of_calls++;                            \
-  if (TraceRuntimeCalls)                                           \
-    InterfaceSupport::trace(#result_type, #header);                \
   if (CountRuntimeCalls) {                                         \
     static RuntimeHistogramElement* e = new RuntimeHistogramElement(#header); \
     if (e != NULL) e->increment_count();                           \
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -183,7 +183,7 @@
   CallInfo callinfo;
   Handle receiver = args->receiver();
   KlassHandle recvrKlass(THREAD, receiver.is_null() ? (Klass*)NULL : receiver->klass());
-  LinkInfo link_info(spec_klass, name, signature);
+  LinkInfo link_info(spec_klass, name, signature, KlassHandle(), /*check_access*/false);
   LinkResolver::resolve_virtual_call(
           callinfo, receiver, recvrKlass, link_info, true, CHECK);
   methodHandle method = callinfo.selected_method();
@@ -220,7 +220,7 @@
 
 void JavaCalls::call_special(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
   CallInfo callinfo;
-  LinkInfo link_info(klass, name, signature);
+  LinkInfo link_info(klass, name, signature, KlassHandle(), /*check_access*/false);
   LinkResolver::resolve_special_call(callinfo, link_info, CHECK);
   methodHandle method = callinfo.selected_method();
   assert(method.not_null(), "should have thrown exception");
@@ -255,7 +255,7 @@
 
 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
   CallInfo callinfo;
-  LinkInfo link_info(klass, name, signature);
+  LinkInfo link_info(klass, name, signature, KlassHandle(), /*check_access*/false);
   LinkResolver::resolve_static_call(callinfo, link_info, true, CHECK);
   methodHandle method = callinfo.selected_method();
   assert(method.not_null(), "should have thrown exception");
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -830,7 +830,7 @@
   Symbol*  signature  = method->signature();
   Symbol*  name       = method->name();
   LinkResolver::resolve_interface_call(info, receiver, recv_klass,
-                                       LinkInfo(klass, name, signature),
+                                       LinkInfo(klass, name, signature, KlassHandle(), false),
                                        true,
                                        CHECK_(methodHandle()));
   return info.selected_method();
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -4022,13 +4022,6 @@
   // will be stopped at native=>Java/VM barriers. Note that we can't
   // simply kill or suspend them, as it is inherently deadlock-prone.
 
-#ifndef PRODUCT
-  // disable function tracing at JNI/JVM barriers
-  TraceJNICalls = false;
-  TraceJVMCalls = false;
-  TraceRuntimeCalls = false;
-#endif
-
   VM_Exit::set_vm_exited();
 
   notify_vm_shutdown();
--- a/hotspot/src/share/vm/runtime/vframe.hpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/vframe.hpp	Wed Nov 25 16:13:14 2015 +0000
@@ -317,10 +317,18 @@
   intptr_t* frame_id() const { return _frame.id(); }
   address frame_pc() const { return _frame.pc(); }
 
+  javaVFrame* java_frame() {
+    vframe* vf = vframe::new_vframe(&_frame, &_reg_map, _thread);
+    if (vf->is_java_frame()) {
+      return (javaVFrame*)vf;
+    }
+    return NULL;
+  }
+
   CodeBlob*          cb()         const { return _frame.cb();  }
   nmethod*           nm()         const {
-      assert( cb() != NULL && cb()->is_nmethod(), "usage");
-      return (nmethod*) cb();
+    assert( cb() != NULL && cb()->is_nmethod(), "usage");
+    return (nmethod*) cb();
   }
 
   // Frame type
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -29,6 +29,7 @@
 #include "code/codeCacheExtensions.hpp"
 #include "compiler/compileBroker.hpp"
 #include "gc/shared/isGCActiveMark.hpp"
+#include "logging/log.hpp"
 #include "memory/heapInspection.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/symbol.hpp"
@@ -55,13 +56,19 @@
 
 void VM_Operation::evaluate() {
   ResourceMark rm;
-  if (TraceVMOperation) {
-    tty->print("[");
-    NOT_PRODUCT(print();)
+  outputStream* debugstream;
+  bool enabled = log_is_enabled(Debug, vmoperation);
+  if (enabled) {
+    debugstream = LogHandle(vmoperation)::debug_stream();
+    debugstream->print("begin ");
+    print_on_error(debugstream);
+    debugstream->cr();
   }
   doit();
-  if (TraceVMOperation) {
-    tty->print_cr("]");
+  if (enabled) {
+    debugstream->print("end ");
+    print_on_error(debugstream);
+    debugstream->cr();
   }
 }
 
--- a/hotspot/src/share/vm/utilities/hashtable.cpp	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Wed Nov 25 16:13:14 2015 +0000
@@ -365,6 +365,7 @@
 template class RehashableHashtable<oopDesc*, mtSymbol>;
 template class Hashtable<Symbol*, mtSymbol>;
 template class Hashtable<Klass*, mtClass>;
+template class Hashtable<InstanceKlass*, mtClass>;
 template class Hashtable<oop, mtClass>;
 #if defined(SOLARIS) || defined(CHECK_UNHANDLED_OOPS)
 template class Hashtable<oop, mtSymbol>;
@@ -378,6 +379,7 @@
 template class BasicHashtableEntry<mtSymbol>;
 template class BasicHashtableEntry<mtCode>;
 template class BasicHashtable<mtClass>;
+template class BasicHashtable<mtClassShared>;
 template class BasicHashtable<mtSymbol>;
 template class BasicHashtable<mtCode>;
 template class BasicHashtable<mtInternal>;
--- a/hotspot/test/compiler/c2/8004741/Test8004741.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/compiler/c2/8004741/Test8004741.java	Wed Nov 25 16:13:14 2015 +0000
@@ -25,8 +25,8 @@
  * @test Test8004741.java
  * @bug 8004741
  * @summary Missing compiled exception handle table entry for multidimensional array allocation
- * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test8004741
- * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741
+ * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test8004741
+ * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741
  */
 
 import java.util.*;
--- a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java	Wed Nov 25 16:13:14 2015 +0000
@@ -26,7 +26,7 @@
  * @test
  * @bug 8073184
  * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-LoopLimitCheck -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp  TestCastIINoLoopLimitCheck
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LoopLimitCheck -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp  TestCastIINoLoopLimitCheck
  *
  */
 
--- a/hotspot/test/compiler/runtime/7196199/Test7196199.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/compiler/runtime/7196199/Test7196199.java	Wed Nov 25 16:13:14 2015 +0000
@@ -27,7 +27,7 @@
  * @bug 7196199
  * @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
  *
- * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CompileCommand=exclude,Test7196199.test -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test7196199
+ * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:CompileCommand=exclude,Test7196199.test -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test7196199
  */
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, 2015, 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 TestHumongousAllocNearlyFullRegion
+ * @bug 8143587
+ * @summary G1: humongous object allocations should work even when there is
+ *              not enough space in the heapRegion to fit a filler object.
+ * @library /testlibrary
+ * @run driver TestHumongousAllocNearlyFullRegion
+ */
+
+import jdk.test.lib.*;
+
+public class TestHumongousAllocNearlyFullRegion {
+    // Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to
+    // fulfill alignment constraints.
+    private static final int heapSize                       = 224; // MB
+    private static final int heapRegionSize                 = 1;   // MB
+
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UseG1GC",
+            "-Xms" + heapSize + "m",
+            "-Xmx" + heapSize + "m",
+            "-XX:G1HeapRegionSize=" + heapRegionSize + "m",
+            "-XX:+PrintGC",
+            HumongousObjectAllocator.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("GC pause (G1 Humongous Allocation) (young) (initial-mark)");
+        output.shouldHaveExitValue(0);
+    }
+
+    static class HumongousObjectAllocator {
+        public static void main(String [] args) {
+            for (int i = 0; i < heapSize; i++) {
+                // 131069 is the number of longs it takes to fill a heapRegion except
+                // for 8 bytes on 64 bit.
+                long[] largeObect = new long[131069];
+            }
+        }
+    }
+}
+
--- a/hotspot/test/runtime/8087223/BadMethodHandles.java	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2015, 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
- * $bug 8087223
- * @summary Adding constantTag to keep method call consistent with it.
- * @compile -XDignore.symbol.file BadMethodHandles.java
- * @run main/othervm BadMethodHandles
- */
-
-import jdk.internal.org.objectweb.asm.*;
-import java.io.FileOutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-
-public class BadMethodHandles {
-
-    static byte[] dumpBadInterfaceMethodref() {
-        ClassWriter cw = new ClassWriter(0);
-        cw.visit(52, ACC_PUBLIC | ACC_SUPER, "BadInterfaceMethodref", null, "java/lang/Object", null);
-        Handle handle1 =
-            new Handle(Opcodes.H_INVOKEINTERFACE, "BadInterfaceMethodref", "m", "()V");
-        Handle handle2 =
-            new Handle(Opcodes.H_INVOKEINTERFACE, "BadInterfaceMethodref", "staticM", "()V");
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
-            mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "m", "()V", null, null);
-            mv.visitCode();
-            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-            mv.visitLdcInsn("hello from m");
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(3, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "staticM", "()V", null, null);
-            mv.visitCode();
-            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-            mv.visitLdcInsn("hello from staticM");
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(3, 1);
-            mv.visitEnd();
-        }
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runm", "()V", null, null);
-            mv.visitCode();
-            // REF_invokeStatic
-            mv.visitLdcInsn(handle1);
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runStaticM", "()V", null, null);
-            mv.visitCode();
-            // REF_invokeStatic
-            mv.visitLdcInsn(handle2);
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-
-        cw.visitEnd();
-        return cw.toByteArray();
-    }
-
-    static byte[] dumpIBad() {
-        ClassWriter cw = new ClassWriter(0);
-        cw.visit(52, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "IBad", null, "java/lang/Object", null);
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "m", "()V", null, null);
-            mv.visitCode();
-            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-            mv.visitLdcInsn("hello from m");
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(3, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "staticM", "()V", null, null);
-            mv.visitCode();
-            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
-            mv.visitLdcInsn("hello from staticM");
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(3, 1);
-            mv.visitEnd();
-        }
-        cw.visitEnd();
-        return cw.toByteArray();
-    }
-
-    static byte[] dumpBadMethodref() {
-        ClassWriter cw = new ClassWriter(0);
-        cw.visit(52, ACC_PUBLIC | ACC_SUPER,  "BadMethodref", null, "java/lang/Object", new String[]{"IBad"});
-        Handle handle1 =
-            new Handle(Opcodes.H_INVOKEINTERFACE, "BadMethodref", "m", "()V");
-        Handle handle2 =
-            new Handle(Opcodes.H_INVOKEINTERFACE, "BadMethodref", "staticM", "()V");
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
-            mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runm", "()V", null, null);
-            mv.visitCode();
-            // REF_invokeStatic
-            mv.visitLdcInsn(handle1);
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runStaticM", "()V", null, null);
-            mv.visitCode();
-            // REF_invokeStatic
-            mv.visitLdcInsn(handle2);
-            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-
-        cw.visitEnd();
-        return cw.toByteArray();
-    }
-    static class CL extends ClassLoader {
-        @Override
-        protected Class<?> findClass(String name) throws ClassNotFoundException {
-            byte[] classBytes = null;
-            switch (name) {
-            case "BadInterfaceMethodref": classBytes = dumpBadInterfaceMethodref(); break;
-            case "BadMethodref"         : classBytes = dumpBadMethodref(); break;
-            case "IBad"                 : classBytes = dumpIBad(); break;
-            default                     : throw new ClassNotFoundException(name);
-            }
-            return defineClass(name, classBytes, 0, classBytes.length);
-        }
-    }
-
-    public static void main(String[] args) throws Throwable {
-        try (FileOutputStream fos = new FileOutputStream("BadInterfaceMethodref.class")) {
-          fos.write(dumpBadInterfaceMethodref());
-        }
-        try (FileOutputStream fos = new FileOutputStream("IBad.class")) {
-          fos.write(dumpIBad());
-        }
-        try (FileOutputStream fos = new FileOutputStream("BadMethodref.class")) {
-          fos.write(dumpBadMethodref());
-        }
-
-        Class<?> cls = (new CL()).loadClass("BadInterfaceMethodref");
-        String[] methods = {"runm", "runStaticM"};
-        System.out.println("Test BadInterfaceMethodref:");
-        int success = 0;
-        for (String name : methods) {
-            try {
-                System.out.printf("invoke %s: \n", name);
-                cls.getMethod(name).invoke(cls.newInstance());
-                System.out.println("FAILED (no exception)"); // ICCE should be thrown
-            } catch (Throwable e) {
-                if (e instanceof InvocationTargetException && e.getCause() != null &&
-                    e.getCause() instanceof IncompatibleClassChangeError) {
-                    System.out.println("PASSED");
-                    success++;
-                    continue;
-                } else {
-                    System.out.println("FAILED with exception");
-                    throw e;
-                }
-            }
-        }
-        if (success != methods.length) {
-           throw new Exception("BadInterfaceMethodRef Failed to catch IncompatibleClassChangeError");
-        }
-        System.out.println("Test BadMethodref:");
-        cls = (new CL()).loadClass("BadMethodref");
-        success = 0;
-        for (String name : methods) {
-            try {
-                System.out.printf("invoke %s: \n", name);
-                cls.getMethod(name).invoke(cls.newInstance());
-                System.out.println("FAILED (no exception)"); // ICCE should be thrown
-            } catch (Throwable e) {
-                if (e instanceof InvocationTargetException && e.getCause() != null &&
-                    e.getCause() instanceof IncompatibleClassChangeError) {
-                    System.out.println("PASSED");
-                    success++;
-                    continue;
-                } else {
-                    System.out.println("FAILED with exception");
-                    throw e;
-                }
-            }
-         }
-         if (success != methods.length) {
-            throw new Exception("BadMethodRef Failed to catch IncompatibleClassChangeError");
-         }
-
-    }
-}
--- a/hotspot/test/runtime/8087223/IntfMethod.java	Wed Nov 25 16:33:28 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2015, 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
- * $bug 8087223
- * @summary Adding constantTag to keep method call consistent with it.
- * @compile -XDignore.symbol.file IntfMethod.java
- * @run main/othervm IntfMethod
- * @run main/othervm -Xint IntfMethod
- * @run main/othervm -Xcomp IntfMethod
- */
-
-
-import jdk.internal.org.objectweb.asm.*;
-import java.io.FileOutputStream;
-import java.lang.reflect.InvocationTargetException;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-
-public class IntfMethod {
-    static byte[] dumpC() {
-        ClassWriter cw = new ClassWriter(0);
-        cw.visit(52, ACC_PUBLIC | ACC_SUPER, "C", null, "java/lang/Object", new String[]{"I"});
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
-            mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testSpecialIntf", "()V", null, null);
-            mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitMethodInsn(INVOKESPECIAL, "I", "f1", "()V", /*itf=*/false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testStaticIntf", "()V", null, null);
-            mv.visitCode();
-            mv.visitMethodInsn(INVOKESTATIC, "I", "f2", "()V", /*itf=*/false);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testSpecialClass", "()V", null, null);
-            mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitMethodInsn(INVOKESPECIAL, "C", "f1", "()V", /*itf=*/true);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f2", "()V", null, null);
-            mv.visitCode();
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(0, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testStaticClass", "()V", null, null);
-            mv.visitCode();
-            mv.visitMethodInsn(INVOKESTATIC, "C", "f2", "()V", /*itf=*/true);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(1, 1);
-            mv.visitEnd();
-        }
-        cw.visitEnd();
-        return cw.toByteArray();
-    }
-
-    static byte[] dumpI() {
-        ClassWriter cw = new ClassWriter(0);
-        cw.visit(52, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "I", null, "java/lang/Object", null);
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "f1", "()V", null, null);
-            mv.visitCode();
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(0, 1);
-            mv.visitEnd();
-        }
-        {
-            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f2", "()V", null, null);
-            mv.visitCode();
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(0, 1);
-            mv.visitEnd();
-        }
-        cw.visitEnd();
-        return cw.toByteArray();
-    }
-
-    static class CL extends ClassLoader {
-        @Override
-        protected Class<?> findClass(String name) throws ClassNotFoundException {
-            byte[] classFile;
-            switch (name) {
-                case "I": classFile = dumpI(); break;
-                case "C": classFile = dumpC(); break;
-                default:
-                    throw new ClassNotFoundException(name);
-            }
-            return defineClass(name, classFile, 0, classFile.length);
-        }
-    }
-
-    public static void main(String[] args) throws Throwable {
-        Class<?> cls = (new CL()).loadClass("C");
-        try (FileOutputStream fos = new FileOutputStream("I.class")) { fos.write(dumpI()); }
-        try (FileOutputStream fos = new FileOutputStream("C.class")) { fos.write(dumpC()); }
-
-        int success = 0;
-        for (String name : new String[] { "testSpecialIntf", "testStaticIntf", "testSpecialClass", "testStaticClass"}) {
-            System.out.printf("%s: ", name);
-            try {
-                cls.getMethod(name).invoke(cls.newInstance());
-                System.out.println("FAILED");
-            } catch (Throwable e) {
-                if (e instanceof InvocationTargetException &&
-                    e.getCause() != null && e.getCause() instanceof IncompatibleClassChangeError) {
-                    System.out.println("PASSED");
-                    success++;
-                    continue;
-                }
-            }
-        }
-        if (success != 4) throw new Exception("Failed to catch ICCE");
-    }
-}
--- a/hotspot/test/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java	Wed Nov 25 16:13:14 2015 +0000
@@ -131,47 +131,41 @@
 
     /*
       #1.7 locked flag:
-                                      diagnostic & locked             experimental & locked             commercial & locked
-                                      -XX:-UnlockDiagnosticVMOptions  -XX:-UnlockExperimentalVMOptions  -XX:-UnlockCommercialFeatures
-                                      -XX:+PrintInlining              -XX:+AlwaysSafeConstructors       -XX:+FlightRecorder
-      -IgnoreUnrecognizedVMOptions               ERR                           ERR                                 ERR
-      +IgnoreUnrecognizedVMOptions               ERR                           ERR                                 ERR
+                                      diagnostic & locked             experimental & locked
+                                      -XX:-UnlockDiagnosticVMOptions  -XX:-UnlockExperimentalVMOptions
+                                      -XX:+PrintInlining              -XX:+AlwaysSafeConstructors
+      -IgnoreUnrecognizedVMOptions               ERR                           ERR
+      +IgnoreUnrecognizedVMOptions               ERR                           ERR
     */
     runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockDiagnosticVMOptions", "-XX:+PrintInlining", "-version");
     runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockExperimentalVMOptions", "-XX:+AlwaysSafeConstructors", "-version");
-    runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockCommercialFeatures", "-XX:+FlightRecorder", "-version");
     runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockDiagnosticVMOptions", "-XX:+PrintInlining", "-version");
     runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockExperimentalVMOptions", "-XX:+AlwaysSafeConstructors", "-version");
-    runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockCommercialFeatures", "-XX:+FlightRecorder", "-version");
 
     /*
       #1.8 malformed locked flag:
-                                    diagnostic & locked             experimental & locked             commercial & locked
-                                    -XX:-UnlockDiagnosticVMOptions  -XX:-UnlockExperimentalVMOptions  -XX:-UnlockCommercialFeatures
-                                    -XX:PrintInlining               -XX:AlwaysSafeConstructors        -XX:FlightRecorder
-      -IgnoreUnrecognizedVMOptions               ERR                           ERR                                 ERR
-      +IgnoreUnrecognizedVMOptions               ERR                           ERR                                 ERR
+                                    diagnostic & locked             experimental & locked
+                                    -XX:-UnlockDiagnosticVMOptions  -XX:-UnlockExperimentalVMOptions
+                                    -XX:PrintInlining               -XX:AlwaysSafeConstructors
+      -IgnoreUnrecognizedVMOptions               ERR                           ERR
+      +IgnoreUnrecognizedVMOptions               ERR                           ERR
     */
     runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockDiagnosticVMOptions", "-XX:PrintInlining", "-version");
     runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockExperimentalVMOptions", "-XX:AlwaysSafeConstructors", "-version");
-    runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockCommercialFeatures", "-XX:FlightRecorder", "-version");
     runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockDiagnosticVMOptions", "-XX:PrintInlining", "-version");
     runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockExperimentalVMOptions", "-XX:AlwaysSafeConstructors", "-version");
-    runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockCommercialFeatures", "-XX:FlightRecorder", "-version");
 
     /*
       #1.9 malformed unlocked flag:
-                                    diagnostic & locked             experimental & locked             commercial & locked
-                                    -XX:+UnlockDiagnosticVMOptions  -XX:+UnlockExperimentalVMOptions  -XX:+UnlockCommercialFeatures
-                                    -XX:PrintInlining               -XX:AlwaysSafeConstructors        -XX:FlightRecorder
-      -IgnoreUnrecognizedVMOptions               ERR                           ERR                                 ERR
-      +IgnoreUnrecognizedVMOptions               ERR                           ERR                                 ERR
+                                    diagnostic & locked             experimental & locked
+                                    -XX:+UnlockDiagnosticVMOptions  -XX:+UnlockExperimentalVMOptions
+                                    -XX:PrintInlining               -XX:AlwaysSafeConstructors
+      -IgnoreUnrecognizedVMOptions               ERR                           ERR
+      +IgnoreUnrecognizedVMOptions               ERR                           ERR
     */
     runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockDiagnosticVMOptions", "-XX:PrintInlining", "-version");
     runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockExperimentalVMOptions", "-XX:AlwaysSafeConstructors", "-version");
-    runJavaAndCheckExitValue(false, "-XX:-IgnoreUnrecognizedVMOptions", "-XX:-UnlockCommercialFeatures", "-XX:FlightRecorder", "-version");
     runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockDiagnosticVMOptions", "-XX:PrintInlining", "-version");
     runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockExperimentalVMOptions", "-XX:AlwaysSafeConstructors", "-version");
-    runJavaAndCheckExitValue(false, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UnlockCommercialFeatures", "-XX:FlightRecorder", "-version");
   }
 }
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Wed Nov 25 16:13:14 2015 +0000
@@ -41,37 +41,79 @@
 
 public class TestOptionsWithRanges {
 
+    private static Map<String, JVMOption> allOptionsAsMap;
+
+    private static void excludeTestMaxRange(String optionName) {
+        JVMOption option = allOptionsAsMap.get(optionName);
+
+        if (option != null) {
+            option.excludeTestMaxRange();
+        }
+    }
+
+    private static void excludeTestMinRange(String optionName) {
+        JVMOption option = allOptionsAsMap.get(optionName);
+
+        if (option != null) {
+            option.excludeTestMinRange();
+        }
+    }
+
+    private static void excludeTestRange(String optionName) {
+        allOptionsAsMap.remove(optionName);
+    }
+
     public static void main(String[] args) throws Exception {
         int failedTests;
-        Map<String, JVMOption> allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
         List<JVMOption> allOptions;
 
+        allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
+
         /*
          * Remove CICompilerCount from testing because currently it can hang system
          */
-        allOptionsAsMap.remove("CICompilerCount");
+        excludeTestMaxRange("CICompilerCount");
 
         /*
          * JDK-8136766
          * Temporarily remove ThreadStackSize from testing because Windows can set it to 0
          * (for default OS size) but other platforms insist it must be greater than 0
         */
-        allOptionsAsMap.remove("ThreadStackSize");
+        excludeTestRange("ThreadStackSize");
+
+        /*
+         * JDK-8141650
+         * Temporarily exclude SharedMiscDataSize as it will exit the VM with exit code 2 and
+         * "The shared miscellaneous data space is not large enough to preload requested classes."
+         * message at min value.
+         */
+        excludeTestRange("SharedMiscDataSize");
+
+        /*
+         * JDK-8142874
+         * Temporarily exclude Shared* flagse as they will exit the VM with exit code 2 and
+         * "The shared miscellaneous data space is not large enough to preload requested classes."
+         * message at max values.
+         */
+        excludeTestRange("SharedReadWriteSize");
+        excludeTestRange("SharedReadOnlySize");
+        excludeTestRange("SharedMiscDataSize");
+        excludeTestRange("SharedMiscCodeSize");
 
         /*
          * Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0)
          */
-        allOptionsAsMap.remove("MallocMaxTestWords");
+        excludeTestMinRange("MallocMaxTestWords");
 
         /*
          * Exclude below options as their maximum value would consume too much memory
          * and would affect other tests that run in parallel.
          */
-        allOptionsAsMap.remove("G1ConcRefinementThreads");
-        allOptionsAsMap.remove("G1RSetRegionEntries");
-        allOptionsAsMap.remove("G1RSetSparseRegionEntries");
-        allOptionsAsMap.remove("G1UpdateBufferSize");
-        allOptionsAsMap.remove("InitialBootClassLoaderMetaspaceSize");
+        excludeTestMaxRange("G1ConcRefinementThreads");
+        excludeTestMaxRange("G1RSetRegionEntries");
+        excludeTestMaxRange("G1RSetSparseRegionEntries");
+        excludeTestMaxRange("G1UpdateBufferSize");
+        excludeTestMaxRange("InitialBootClassLoaderMetaspaceSize");
 
         /*
          * Remove parameters controlling the code cache. As these
@@ -83,13 +125,13 @@
          * hotspot/src/shared/vm/code/codeCache.cpp), therefore
          * omitting testing for them does not pose a problem.
          */
-        allOptionsAsMap.remove("InitialCodeCacheSize");
-        allOptionsAsMap.remove("CodeCacheMinimumUseSpace");
-        allOptionsAsMap.remove("ReservedCodeCacheSize");
-        allOptionsAsMap.remove("NonProfiledCodeHeapSize");
-        allOptionsAsMap.remove("ProfiledCodeHeapSize");
-        allOptionsAsMap.remove("NonNMethodCodeHeapSize");
-        allOptionsAsMap.remove("CodeCacheExpansionSize");
+        excludeTestMaxRange("InitialCodeCacheSize");
+        excludeTestMaxRange("CodeCacheMinimumUseSpace");
+        excludeTestMaxRange("ReservedCodeCacheSize");
+        excludeTestMaxRange("NonProfiledCodeHeapSize");
+        excludeTestMaxRange("ProfiledCodeHeapSize");
+        excludeTestMaxRange("NonNMethodCodeHeapSize");
+        excludeTestMaxRange("CodeCacheExpansionSize");
 
         allOptions = new ArrayList<>(allOptionsAsMap.values());
 
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java	Wed Nov 25 16:13:14 2015 +0000
@@ -123,22 +123,28 @@
     protected List<String> getValidValues() {
         List<String> validValues = new ArrayList<>();
 
-        validValues.add(formatValue(min));
-        validValues.add(formatValue(max));
-
-        if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0)
-                && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) {
-            validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE));
+        if (testMinRange) {
+            validValues.add(formatValue(min));
+        }
+        if (testMaxRange) {
+            validValues.add(formatValue(max));
         }
 
-        if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0)
-                && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) {
-            validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO));
-        }
+        if (testMinRange) {
+            if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0)
+                    && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) {
+                validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE));
+            }
 
-        if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0)
-                && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) {
-            validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE));
+            if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0)
+                    && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) {
+                validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO));
+            }
+
+            if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0)
+                    && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) {
+                validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE));
+            }
         }
 
         return validValues;
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/IntJVMOption.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/IntJVMOption.java	Wed Nov 25 16:13:14 2015 +0000
@@ -200,43 +200,51 @@
     protected List<String> getValidValues() {
         List<String> validValues = new ArrayList<>();
 
-        validValues.add(min.toString());
-        validValues.add(max.toString());
-
-        if ((min.compareTo(MINUS_ONE) == -1) && (max.compareTo(MINUS_ONE) == 1)) {
-            /*
-             * Add -1 as valid value if min is less than -1 and max is greater than -1
-             */
-            validValues.add("-1");
+        if (testMinRange) {
+            validValues.add(min.toString());
+        }
+        if (testMaxRange) {
+            validValues.add(max.toString());
         }
 
-        if ((min.compareTo(BigInteger.ZERO) == -1) && (max.compareTo(BigInteger.ZERO) == 1)) {
-            /*
-             * Add 0 as valid value if min is less than 0 and max is greater than 0
-             */
-            validValues.add("0");
-        }
-        if ((min.compareTo(BigInteger.ONE) == -1) && (max.compareTo(BigInteger.ONE) == 1)) {
-            /*
-             * Add 1 as valid value if min is less than 1 and max is greater than 1
-             */
-            validValues.add("1");
+        if (testMinRange) {
+            if ((min.compareTo(MINUS_ONE) == -1) && (max.compareTo(MINUS_ONE) == 1)) {
+                /*
+                 * Add -1 as valid value if min is less than -1 and max is greater than -1
+                 */
+                validValues.add("-1");
+            }
+
+            if ((min.compareTo(BigInteger.ZERO) == -1) && (max.compareTo(BigInteger.ZERO) == 1)) {
+                /*
+                 * Add 0 as valid value if min is less than 0 and max is greater than 0
+                 */
+                validValues.add("0");
+            }
+            if ((min.compareTo(BigInteger.ONE) == -1) && (max.compareTo(BigInteger.ONE) == 1)) {
+                /*
+                 * Add 1 as valid value if min is less than 1 and max is greater than 1
+                 */
+                validValues.add("1");
+            }
         }
 
-        if (max.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == 1) {
-            /*
-             * Check for overflow when flag is assigned to the
-             * 4 byte int variable
-             */
-            validValues.add(MAX_4_BYTE_INT_PLUS_ONE.toString());
-        }
+        if (testMaxRange) {
+            if ((min.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == -1) && (max.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == 1)) {
+                /*
+                 * Check for overflow when flag is assigned to the
+                 * 4 byte int variable
+                 */
+                validValues.add(MAX_4_BYTE_INT_PLUS_ONE.toString());
+            }
 
-        if (max.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == 1) {
-            /*
-             * Check for overflow when flag is assigned to the
-             * 4 byte unsigned int variable
-             */
-            validValues.add(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE.toString());
+            if ((min.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == -1) && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == 1)) {
+                /*
+                 * Check for overflow when flag is assigned to the
+                 * 4 byte unsigned int variable
+                 */
+                validValues.add(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE.toString());
+            }
         }
 
         return validValues;
@@ -252,24 +260,28 @@
     protected List<String> getInvalidValues() {
         List<String> invalidValues = new ArrayList<>();
 
+        /* Return invalid values only for options which have defined range in VM */
         if (withRange) {
-            /* Return invalid values only for options which have defined range in VM */
-            if ((is32Bit && min.compareTo(MIN_4_BYTE_INT) != 0)
-                    || (!is32Bit && min.compareTo(MIN_LONG) != 0)) {
-                invalidValues.add(min.subtract(BigInteger.ONE).toString());
-            }
+            if (unsigned) {
+                /* Only add non-negative out-of-range values for unsigned options */
+                if (min.compareTo(BigInteger.ZERO) == 1) {
+                    invalidValues.add(min.subtract(BigInteger.ONE).toString());
+                }
 
-            if (!unsigned
-                    && ((is32Bit && (max.compareTo(MAX_4_BYTE_INT) != 0))
-                    || (!is32Bit && (max.compareTo(MAX_LONG) != 0)))) {
-                invalidValues.add(max.add(BigInteger.ONE).toString());
-            }
-
-            if (unsigned
-                    && ((is32Bit && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT) != 0))
-                    || (!is32Bit && !uint64 && (max.compareTo(MAX_UNSIGNED_LONG) != 0))
-                    || (uint64 && (max.compareTo(MAX_UNSIGNED_LONG_64) != 0)))) {
-                invalidValues.add(max.add(BigInteger.ONE).toString());
+                if ((is32Bit && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT) != 0))
+                        || (!is32Bit && !uint64 && (max.compareTo(MAX_UNSIGNED_LONG) != 0))
+                        || (uint64 && (max.compareTo(MAX_UNSIGNED_LONG_64) != 0))) {
+                    invalidValues.add(max.add(BigInteger.ONE).toString());
+                }
+            } else {
+                if ((is32Bit && min.compareTo(MIN_4_BYTE_INT) != 0)
+                        || (!is32Bit && min.compareTo(MIN_LONG) != 0)) {
+                    invalidValues.add(min.subtract(BigInteger.ONE).toString());
+                }
+                if ((is32Bit && (max.compareTo(MAX_4_BYTE_INT) != 0))
+                        || (!is32Bit && (max.compareTo(MAX_LONG) != 0))) {
+                    invalidValues.add(max.add(BigInteger.ONE).toString());
+                }
             }
         }
 
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java	Wed Nov 25 16:13:14 2015 +0000
@@ -55,6 +55,16 @@
     protected boolean withRange;
 
     /**
+     * Test valid min range value and additional small values
+     */
+    protected boolean testMinRange;
+
+    /**
+     * Test valid max range value and additional big values
+     */
+    protected boolean testMaxRange;
+
+    /**
      * Prepend string which added before testing option to the command line
      */
     private final List<String> prepend;
@@ -64,6 +74,8 @@
         this.prepend = new ArrayList<>();
         prependString = new StringBuilder();
         withRange = false;
+        testMinRange = true;
+        testMaxRange = true;
     }
 
     /**
@@ -136,6 +148,20 @@
     }
 
     /**
+     * Exclude testing of min range value for this option
+     */
+    public final void excludeTestMinRange() {
+        testMinRange = false;
+    }
+
+    /**
+     * Exclude testing of max range value for this option
+     */
+    public final void excludeTestMaxRange() {
+        testMaxRange = false;
+    }
+
+    /**
      * Set new minimum option value
      *
      * @param min new minimum value
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java	Wed Nov 25 16:13:14 2015 +0000
@@ -27,6 +27,7 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -49,6 +50,8 @@
     /* Used to start the JVM with the same type as current */
     static String VMType;
 
+    private static Map<String, JVMOption> optionsAsMap;
+
     static {
         if (Platform.isServer()) {
             VMType = "-server";
@@ -63,6 +66,84 @@
         }
     }
 
+    public static boolean fitsRange(String optionName, BigDecimal number) throws Exception {
+        JVMOption option;
+        String minRangeString = null;
+        String maxRangeString = null;
+        boolean fits = true;
+
+        if (optionsAsMap == null) {
+            optionsAsMap = getOptionsWithRangeAsMap();
+        }
+
+        option = optionsAsMap.get(optionName);
+        if (option != null) {
+            minRangeString = option.getMin();
+            if (minRangeString != null) {
+                fits = (number.compareTo(new BigDecimal(minRangeString)) >= 0);
+            }
+            maxRangeString = option.getMax();
+            if (maxRangeString != null) {
+                fits &= (number.compareTo(new BigDecimal(maxRangeString)) <= 0);
+            }
+        }
+
+        return fits;
+    }
+
+    public static boolean fitsRange(String optionName, String number) throws Exception {
+        String lowerCase = number.toLowerCase();
+        String multiplier = "1";
+        if (lowerCase.endsWith("k")) {
+            multiplier = "1024";
+            lowerCase = lowerCase.substring(0, lowerCase.length()-1);
+        } else if (lowerCase.endsWith("m")) {
+            multiplier = "1048576"; //1024*1024
+            lowerCase = lowerCase.substring(0, lowerCase.length()-1);
+        } else if (lowerCase.endsWith("g")) {
+            multiplier = "1073741824"; //1024*1024*1024
+            lowerCase = lowerCase.substring(0, lowerCase.length()-1);
+        } else if (lowerCase.endsWith("t")) {
+            multiplier = "1099511627776"; //1024*1024*1024*1024
+            lowerCase = lowerCase.substring(0, lowerCase.length()-1);
+        }
+        BigDecimal valueBig = new BigDecimal(lowerCase);
+        BigDecimal multiplierBig = new BigDecimal(multiplier);
+        return fitsRange(optionName, valueBig.multiply(multiplierBig));
+    }
+
+    public static String getMinOptionRange(String optionName) throws Exception {
+        JVMOption option;
+        String minRange = null;
+
+        if (optionsAsMap == null) {
+            optionsAsMap = getOptionsWithRangeAsMap();
+        }
+
+        option = optionsAsMap.get(optionName);
+        if (option != null) {
+            minRange = option.getMin();
+        }
+
+        return minRange;
+    }
+
+    public static String getMaxOptionRange(String optionName) throws Exception {
+        JVMOption option;
+        String maxRange = null;
+
+        if (optionsAsMap == null) {
+            optionsAsMap = getOptionsWithRangeAsMap();
+        }
+
+        option = optionsAsMap.get(optionName);
+        if (option != null) {
+            maxRange = option.getMax();
+        }
+
+        return maxRange;
+    }
+
     /**
      * Add dependency for option depending on it's name. E.g. enable G1 GC for
      * G1 options or add prepend options to not hit constraints.
@@ -80,6 +161,13 @@
             option.addPrepend("-XX:+UseConcMarkSweepGC");
         }
 
+        if (name.startsWith("Shared")) {
+            option.addPrepend("-XX:+UnlockDiagnosticVMOptions");
+            String fileName = "Test" + name + ".jsa";
+            option.addPrepend("-XX:SharedArchiveFile=" + fileName);
+            option.addPrepend("-Xshare:dump");
+        }
+
         switch (name) {
             case "MinHeapFreeRatio":
                 option.addPrepend("-XX:MaxHeapFreeRatio=100");
@@ -112,7 +200,6 @@
                 /* Do nothing */
                 break;
         }
-
     }
 
     /**
--- a/hotspot/test/runtime/CommandLine/VMOptionWarning.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/CommandLine/VMOptionWarning.java	Wed Nov 25 16:13:14 2015 +0000
@@ -47,12 +47,12 @@
         output = new OutputAnalyzer(pb.start());
         output.shouldContain("Error: VM option 'PrintInlining' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.");
 
-        pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceJNICalls", "-version");
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+VerifyStack", "-version");
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Error: VM option 'TraceJNICalls' is develop and is available only in debug version of VM.");
+        output.shouldContain("Error: VM option 'VerifyStack' is develop and is available only in debug version of VM.");
 
-        pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceJVMCalls", "-version");
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+ExecuteInternalVMTests", "-version");
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Error: VM option 'TraceJVMCalls' is notproduct and is available only in debug version of VM.");
+        output.shouldContain("Error: VM option 'ExecuteInternalVMTests' is notproduct and is available only in debug version of VM.");
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java	Wed Nov 25 16:13:14 2015 +0000
@@ -23,50 +23,72 @@
 
 /* @test LimitSharedSizes
  * @summary Test handling of limits on shared space size
- * @library /testlibrary
+ * @library /testlibrary /runtime/CommandLine/OptionsValidation/common
  * @modules java.base/sun.misc
  *          java.management
  * @run main LimitSharedSizes
  */
 
 import jdk.test.lib.*;
+import optionsvalidation.JVMOptionsUtils;
 
 public class LimitSharedSizes {
+    static enum Result {
+        OUT_OF_RANGE,
+        TOO_SMALL,
+        VALID,
+        VALID_ARCHIVE
+    }
+
     static enum Region {
         RO, RW, MD, MC
     }
 
+    private static final boolean fitsRange(String name, String value) throws RuntimeException {
+        boolean fits = true;
+        try {
+            fits = JVMOptionsUtils.fitsRange(name, value);
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        return fits;
+    }
+
     private static class SharedSizeTestData {
         public String optionName;
         public String optionValue;
-        public String expectedErrorMsg;
+        public Result optionResult;
 
-        public SharedSizeTestData(Region region, String value, String msg) {
-            optionName = getName(region);
+        public SharedSizeTestData(Region region, String value) {
+            optionName = "-XX:"+getName(region);
             optionValue = value;
-            expectedErrorMsg = msg;
+            if (fitsRange(getName(region), value) == false) {
+                optionResult = Result.OUT_OF_RANGE;
+            } else {
+                optionResult = Result.TOO_SMALL;
+            }
         }
 
-        public SharedSizeTestData(Region region, String msg) {
-            optionName = getName(region);
-            optionValue = getValue(region);
-            expectedErrorMsg = msg;
+        public SharedSizeTestData(Region region, String value, Result result) {
+            optionName = "-XX:"+getName(region);
+            optionValue = value;
+            optionResult = result;
         }
 
         private String getName(Region region) {
             String name;
             switch (region) {
                 case RO:
-                    name = "-XX:SharedReadOnlySize";
+                    name = "SharedReadOnlySize";
                     break;
                 case RW:
-                    name = "-XX:SharedReadWriteSize";
+                    name = "SharedReadWriteSize";
                     break;
                 case MD:
-                    name = "-XX:SharedMiscDataSize";
+                    name = "SharedMiscDataSize";
                     break;
                 case MC:
-                    name = "-XX:SharedMiscCodeSize";
+                    name = "SharedMiscCodeSize";
                     break;
                 default:
                     name = "Unknown";
@@ -75,53 +97,37 @@
             return name;
         }
 
-        private String getValue(Region region) {
-            String value;
-            switch (region) {
-                case RO:
-                    value = Platform.is64bit() ? "9M" : "8M";
-                    break;
-                case RW:
-                    value = Platform.is64bit() ? "12M" : "7M";
-                    break;
-                case MD:
-                    value = Platform.is64bit() ? "4M" : "2M";
-                    break;
-                case MC:
-                    value = "120k";
-                    break;
-                default:
-                    value = "0M";
-                    break;
-            }
-            return value;
+        public Result getResult() {
+            return optionResult;
         }
     }
 
     private static final SharedSizeTestData[] testTable = {
         // Too small of a region size should not cause a vm crash.
-        // It should result in an error message like the following:
+        // It should result in an error message either like the following #1:
         // The shared miscellaneous code space is not large enough
         // to preload requested classes. Use -XX:SharedMiscCodeSize=
         // to increase the initial size of shared miscellaneous code space.
-        new SharedSizeTestData(Region.RO, "4M",   "read only"),
-        new SharedSizeTestData(Region.RW, "4M",   "read write"),
-        new SharedSizeTestData(Region.MD, "50k",  "miscellaneous data"),
-        new SharedSizeTestData(Region.MC, "20k",  "miscellaneous code"),
+        // or #2:
+        // The shared miscellaneous code space is outside the allowed range
+        new SharedSizeTestData(Region.RO, "4M"),
+        new SharedSizeTestData(Region.RW, "4M"),
+        new SharedSizeTestData(Region.MD, "50k"),
+        new SharedSizeTestData(Region.MC, "20k"),
 
-        // these values are larger than default ones, but should
+        // these values are larger than default ones, and should
         // be acceptable and not cause failure
-        new SharedSizeTestData(Region.RO, "20M", null),
-        new SharedSizeTestData(Region.RW, "20M", null),
-        new SharedSizeTestData(Region.MD, "20M", null),
-        new SharedSizeTestData(Region.MC, "20M", null),
+        new SharedSizeTestData(Region.RO, "20M", Result.VALID),
+        new SharedSizeTestData(Region.RW, "20M", Result.VALID),
+        new SharedSizeTestData(Region.MD, "20M", Result.VALID),
+        new SharedSizeTestData(Region.MC, "20M", Result.VALID),
 
         // test with sizes which just meet the minimum required sizes
         // the following tests also attempt to use the shared archive
-        new SharedSizeTestData(Region.RO, "UseArchive"),
-        new SharedSizeTestData(Region.RW, "UseArchive"),
-        new SharedSizeTestData(Region.MD, "UseArchive"),
-        new SharedSizeTestData(Region.MC, "UseArchive")
+        new SharedSizeTestData(Region.RO, Platform.is64bit() ? "9M":"8M", Result.VALID_ARCHIVE),
+        new SharedSizeTestData(Region.RW, Platform.is64bit() ? "12M":"7M", Result.VALID_ARCHIVE),
+        new SharedSizeTestData(Region.MD, Platform.is64bit() ? "4M":"2M", Result.VALID_ARCHIVE),
+        new SharedSizeTestData(Region.MC, "120k", Result.VALID_ARCHIVE),
     };
 
     public static void main(String[] args) throws Exception {
@@ -131,6 +137,7 @@
             counter++;
 
             String option = td.optionName + "=" + td.optionValue;
+            System.out.println("testing option number <" + counter + ">");
             System.out.println("testing option <" + option + ">");
 
             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
@@ -141,43 +148,52 @@
 
             OutputAnalyzer output = new OutputAnalyzer(pb.start());
 
-            if (td.expectedErrorMsg != null) {
-                if (!td.expectedErrorMsg.equals("UseArchive")) {
-                    output.shouldContain("The shared " + td.expectedErrorMsg
-                        + " space is not large enough");
+            switch (td.getResult()) {
+                case VALID:
+                case VALID_ARCHIVE:
+                {
+                  output.shouldNotContain("space is not large enough");
+                  output.shouldHaveExitValue(0);
 
-                    output.shouldHaveExitValue(2);
-                } else {
-                    output.shouldNotContain("space is not large enough");
-                    output.shouldHaveExitValue(0);
-
-                    // try to use the archive
-                    pb = ProcessTools.createJavaProcessBuilder(
-                       "-XX:+UnlockDiagnosticVMOptions",
-                       "-XX:SharedArchiveFile=./" + fileName,
-                       "-XX:+PrintSharedArchiveAndExit",
-                       "-version");
+                  if (td.getResult() == Result.VALID_ARCHIVE) {
+                      // try to use the archive
+                      pb = ProcessTools.createJavaProcessBuilder(
+                         "-XX:+UnlockDiagnosticVMOptions",
+                         "-XX:SharedArchiveFile=./" + fileName,
+                         "-XX:+PrintSharedArchiveAndExit",
+                         "-version");
 
-                    try {
-                        output = new OutputAnalyzer(pb.start());
-                        output.shouldContain("archive is valid");
-                    } catch (RuntimeException e) {
-                        // if sharing failed due to ASLR or similar reasons,
-                        // check whether sharing was attempted at all (UseSharedSpaces)
-                        if ((output.getOutput().contains("Unable to use shared archive") ||
-                             output.getOutput().contains("Unable to map ReadOnly shared space at required address.") ||
-                             output.getOutput().contains("Unable to map ReadWrite shared space at required address.") ||
-                             output.getOutput().contains("Unable to reserve shared space at required address")) &&
-                             output.getExitValue() == 1) {
-                             System.out.println("Unable to use shared archive: test not executed; assumed passed");
-                             return;
-                        }
-                    }
-                    output.shouldHaveExitValue(0);
+                      try {
+                          output = new OutputAnalyzer(pb.start());
+                          output.shouldContain("archive is valid");
+                      } catch (RuntimeException e) {
+                          // if sharing failed due to ASLR or similar reasons,
+                          // check whether sharing was attempted at all (UseSharedSpaces)
+                          if ((output.getOutput().contains("Unable to use shared archive") ||
+                               output.getOutput().contains("Unable to map ReadOnly shared space at required address.") ||
+                               output.getOutput().contains("Unable to map ReadWrite shared space at required address.") ||
+                               output.getOutput().contains("Unable to reserve shared space at required address")) &&
+                               output.getExitValue() == 1) {
+                               System.out.println("Unable to use shared archive: test not executed; assumed passed");
+                               return;
+                          }
+                      }
+                      output.shouldHaveExitValue(0);
+                  }
                 }
-            } else {
-                output.shouldNotContain("space is not large enough");
-                output.shouldHaveExitValue(0);
+                break;
+                case TOO_SMALL:
+                {
+                    output.shouldContain("space is not large enough");
+                    output.shouldHaveExitValue(2);
+                }
+                break;
+                case OUT_OF_RANGE:
+                {
+                    output.shouldContain("outside the allowed range");
+                    output.shouldHaveExitValue(1);
+                }
+                break;
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ThreadSignalMask/Prog.java	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+public class Prog {
+
+    public static void main(String args[]) {
+        System.out.println("Java class invoked: " + args[0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2015, 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.lang.ProcessBuilder.Redirect;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Arrays;
+import java.util.List;
+import jdk.test.lib.Asserts;
+
+/*
+ * @test
+ * @key cte_test
+ * @bug 4345157
+ * @summary JDK 1.3.0 alters thread signal mask
+ * @requires (os.simpleArch == "sparcv9")
+ * @library /testlibrary
+ * @compile Prog.java
+ * @run main/native ThreadSignalMask
+ */
+public class ThreadSignalMask {
+
+    public static void main(String args[]) throws Exception {
+
+        String testClasses = getSystemProperty("test.classes");
+
+        String testNativePath = getSystemProperty("test.nativepath");
+
+        String testJdk = getSystemProperty("test.jdk");
+
+        Path currentDirPath = Paths.get(".");
+
+        Path classFilePath = Paths.get(testClasses,
+                Prog.class.getSimpleName() + ".class");
+
+        // copy Prog.class file to be invoked from native
+        Files.copy(classFilePath,
+                currentDirPath.resolve(Prog.class.getSimpleName() + ".class"),
+                StandardCopyOption.REPLACE_EXISTING);
+
+        Path executableFilePath = Paths.get(testNativePath,
+                ThreadSignalMask.class.getSimpleName());
+
+        Path executableFileLocalPath = currentDirPath.resolve(
+                ThreadSignalMask.class.getSimpleName());
+
+        // copy compiled native executable ThreadSignalMask
+        Files.copy(executableFilePath,
+                executableFileLocalPath,
+                StandardCopyOption.REPLACE_EXISTING);
+
+        executableFileLocalPath.toFile().setExecutable(true);
+
+        long[] intervalsArray = {2000, 5000, 10000, 20000};
+
+        List<String> processArgs = Arrays.asList(
+                executableFileLocalPath.toString(),
+                testJdk);
+        ProcessBuilder pb = new ProcessBuilder(processArgs);
+        pb.redirectOutput(Redirect.INHERIT);
+        pb.redirectError(Redirect.INHERIT);
+        int result = 0;
+        for (long interval : intervalsArray) {
+            Process p = pb.start();
+
+            // sleep for a specified period of time to let native run
+            sleep(interval);
+            p.destroy();
+
+            // wait for process to finish, get exit value and validate it
+            result = p.waitFor();
+            System.out.println("Result = " + result);
+            if (result == 0) {
+                break;
+            }
+        }
+
+        Asserts.assertEquals(result, 0);
+    }
+
+    // Utility method to handle Thread.sleep
+    private static void sleep(long millis) throws InterruptedException {
+        System.out.println("Sleep for " + millis);
+        Thread.sleep(millis);
+    }
+
+    // Utility method to retrieve and validate system properties
+    private static String getSystemProperty(String propertyName) throws Error {
+        String systemProperty = System.getProperty(propertyName, "").trim();
+        System.out.println(propertyName + " = " + systemProperty);
+        if (systemProperty.isEmpty()) {
+            throw new Error("TESTBUG: property " + propertyName + " is empty");
+        }
+        return systemProperty;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ThreadSignalMask/exeThreadSignalMask.c	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#define _POSIX_PTHREAD_SEMANTICS // to enable POSIX semantics for certain common APIs
+
+#include <jni.h>
+#include <dlfcn.h>
+#include <limits.h>
+#include <pthread.h>
+#include <signal.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+void *handle;
+char *error;
+char path[PATH_MAX];
+
+jint(JNICALL *jni_create_java_vm)(JavaVM **, JNIEnv **, void *) = NULL;
+
+JavaVM *jvm;
+
+// method to perform dlclose on an open dynamic library handle
+void closeHandle() {
+  dlclose(handle);
+  if ((error = dlerror()) != NULL) {
+    fputs("Error occurred while closing handle\n", stderr);
+  }
+}
+
+// method to exit with a fail status
+void fail() {
+  if (handle) {
+    closeHandle();
+  }
+  exit(1);
+}
+
+// method to handle occurred error and fail
+void handleError(char *messageTitle, char *messageBody) {
+  fprintf(stderr, "%s: %s\n", messageTitle, messageBody);
+  fail();
+}
+
+// method to load the dynamic library libjvm
+void loadJVM() {
+  char lib[PATH_MAX];
+  snprintf(lib, sizeof (lib), "%s/lib/sparcv9/server/libjvm.so", path);
+  handle = dlopen(lib, RTLD_LAZY);
+  if (!handle) {
+    handleError(dlerror(), "2");
+  }
+  fputs("Will load JVM...\n", stdout);
+
+  // find the address of function
+  *(void **) (&jni_create_java_vm) = dlsym(handle, "JNI_CreateJavaVM");
+  if ((error = dlerror()) != NULL) {
+    handleError(error, "3");
+  }
+
+  fputs("JVM loaded okay.\n", stdout);
+}
+
+// method to get created jvm environment
+JNIEnv* initJVM() {
+  JNIEnv *env = NULL;
+  JavaVMInitArgs vm_args;
+  JavaVMOption options[1];
+  jint res;
+
+  options[0].optionString = "-Xrs";
+
+  vm_args.version = JNI_VERSION_1_2;
+  vm_args.nOptions = 1;
+  vm_args.options = options;
+  vm_args.ignoreUnrecognized = JNI_FALSE;
+
+  fputs("Will create JVM...\n", stdout);
+
+  res = (*jni_create_java_vm)(&jvm, &env, &vm_args);
+  if (res < 0) {
+    handleError("Can't create Java VM", strerror(res));
+  }
+
+  fputs("JVM created OK!\n", stdout);
+  return env;
+}
+
+// method to invoke java method from java class
+void callJava(JNIEnv *env) {
+  jclass cls;
+  jmethodID mid;
+  jstring jstr;
+  jobjectArray args;
+
+  cls = (*env)->FindClass(env, "Prog");
+  if (cls == 0) {
+    handleError("FindClass", "Can't find Prog class");
+  }
+
+  mid = (*env)->GetStaticMethodID(env, cls, "main", "([Ljava/lang/String;)V");
+  if (mid == 0) {
+    handleError("GetStaticMethodID", "Can't find Prog.main");
+  }
+
+  jstr = (*env)->NewStringUTF(env, "from C!");
+  if (jstr == 0) {
+    handleError("NewStringUTF", "Out of memory");
+  }
+  args = (*env)->NewObjectArray(env, 1,
+          (*env)->FindClass(env, "java/lang/String"), jstr);
+  if (args == 0) {
+    handleError("NewObjectArray", "Out of memory");
+  }
+  (*env)->CallStaticVoidMethod(env, cls, mid, args);
+
+}
+
+// method to load, init jvm and then invoke java method
+void* loadAndCallJava(void* x) {
+  JNIEnv *env;
+
+  fputs("Some thread will create JVM.\n", stdout);
+  loadJVM();
+  env = initJVM();
+
+  fputs("Some thread will call Java.\n", stdout);
+
+  callJava(env);
+
+  if ((*jvm)->DetachCurrentThread(jvm) != 0)
+    fputs("Error: thread not detached!\n", stderr);
+  fputs("Some thread exiting.\n", stdout);
+  return env;
+}
+
+int main(int argc, char **argv) {
+  JNIEnv *env;
+  sigset_t set;
+  pthread_t thr1;
+  pthread_attr_t attr;
+  size_t ss = 0;
+  int sig;
+  int rc; // return code for pthread_* methods
+
+  // verify input
+  if (argc != 2) {
+    handleError("usage", "a.out jdk_path");
+  }
+  // copy input jdk path into a char buffer
+  strncpy(path, argv[1], PATH_MAX);
+  // add null termination character
+  path[PATH_MAX - 1] = '\0';
+
+  fputs("Main thread will set signal mask.\n", stdout);
+
+  // initialize the signal set
+  sigemptyset(&set);
+  // add a number of signals to a signal set
+  sigaddset(&set, SIGPIPE);
+  sigaddset(&set, SIGTERM);
+  sigaddset(&set, SIGHUP);
+  sigaddset(&set, SIGINT);
+
+  // examine and change mask of blocked signal
+  if ((rc = pthread_sigmask(SIG_BLOCK, &set, NULL))) {
+    // handle error if occurred
+    handleError("main: pthread_sigmask() error", strerror(rc));
+  }
+
+  // initializes the thread attributes object with default attribute values
+  if ((rc = pthread_attr_init(&attr))) {
+    // handle error if occurred
+    handleError("main: pthread_attr_init() error", strerror(rc));
+  }
+
+  ss = 1024 * 1024;
+  // set the stack size attribute of the thread attributes object
+  if ((rc = pthread_attr_setstacksize(&attr, ss))) {
+    // handle error if occurred
+    handleError("main: pthread_attr_setstacksize() error", strerror(rc));
+  }
+  // get the stack size attribute of the thread attributes object
+  if ((rc = pthread_attr_getstacksize(&attr, &ss))) {
+    // handle error if occurred
+    handleError("main: pthread_attr_getstacksize() error", strerror(rc));
+  }
+  fprintf(stderr, "Stack size: %zu\n", ss);
+
+  // start a new thread in the calling process,
+  // loadAndCallJava logic is passed as a start_routine argument
+  if ((rc = pthread_create(&thr1, NULL, loadAndCallJava, NULL))) {
+    // handle error if occurred
+    handleError("main: pthread_create() error", strerror(rc));
+  }
+
+  // initialize the signal set
+  sigemptyset(&set);
+  // add a number of signals to a signal set
+  sigaddset(&set, SIGTERM);
+  sigaddset(&set, SIGHUP);
+  sigaddset(&set, SIGINT);
+
+  fputs("Main thread waiting for signal.\n", stdout);
+
+  do {
+    int err;
+
+    sig = 0;
+    err = sigwait(&set, &sig);
+    if (err != 0) {
+      // print error message if unexpected signal occurred
+      fprintf(stderr, "main: sigwait() error:  %s\n", strerror(err));
+    } else {
+      // print success message and exit if expected signal occurred
+      // this branch generally acts when JVM executes destroy()
+      fprintf(stdout, "main: sigwait() got:  %d\nSucceed!\n", sig);
+      exit(0);
+    }
+  } while (sig != SIGTERM && sig != SIGINT); // exit the loop condition
+
+  // join with a terminated thread
+  if ((rc = pthread_join(thr1, NULL))) {
+    // handle error if occurred
+    handleError("main: pthread_join() error", strerror(rc));
+  }
+
+  // close an open dynamic library handle
+  closeHandle();
+  fputs("Main thread exiting.\n", stdout);
+  return 0;
+}
--- a/hotspot/test/runtime/contended/Basic.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/contended/Basic.java	Wed Nov 25 16:13:14 2015 +0000
@@ -36,7 +36,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import sun.misc.Unsafe;
-import sun.misc.Contended;
+import jdk.internal.vm.annotation.Contended;
 
 /*
  * @test
--- a/hotspot/test/runtime/contended/DefaultValue.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/contended/DefaultValue.java	Wed Nov 25 16:13:14 2015 +0000
@@ -36,7 +36,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import sun.misc.Unsafe;
-import sun.misc.Contended;
+import jdk.internal.vm.annotation.Contended;
 
 /*
  * @test
--- a/hotspot/test/runtime/contended/HasNonStatic.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/contended/HasNonStatic.java	Wed Nov 25 16:13:14 2015 +0000
@@ -36,7 +36,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import sun.misc.Unsafe;
-import sun.misc.Contended;
+import jdk.internal.vm.annotation.Contended;
 
 /*
  * @test
--- a/hotspot/test/runtime/contended/Inheritance1.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/contended/Inheritance1.java	Wed Nov 25 16:13:14 2015 +0000
@@ -36,7 +36,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import sun.misc.Unsafe;
-import sun.misc.Contended;
+import jdk.internal.vm.annotation.Contended;
 
 /*
  * @test
--- a/hotspot/test/runtime/contended/OopMaps.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/contended/OopMaps.java	Wed Nov 25 16:13:14 2015 +0000
@@ -36,7 +36,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import sun.misc.Unsafe;
-import sun.misc.Contended;
+import jdk.internal.vm.annotation.Contended;
 
 /*
  * @test
--- a/hotspot/test/runtime/contended/OopMapsSameGroup.java	Wed Nov 25 16:33:28 2015 +0100
+++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java	Wed Nov 25 16:13:14 2015 +0000
@@ -36,7 +36,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import sun.misc.Unsafe;
-import sun.misc.Contended;
+import jdk.internal.vm.annotation.Contended;
 
 /*
  * @test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/VMOperationTest.java	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 8143157
+ * @summary vmoperation=debug should have logging output
+ * @library /testlibrary
+ * @compile VMOperationTestMain.java
+ * @modules java.base/sun.misc
+ *          java.management
+ * @run main VMOperationTest
+ */
+
+import jdk.test.lib.*;
+
+public class VMOperationTest {
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-Xlog:vmoperation=debug", "-Xmx64m", "-Xms64m", "VMOperationTestMain");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("VM_Operation (");
+        output.shouldHaveExitValue(0);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/VMOperationTestMain.java	Wed Nov 25 16:13:14 2015 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, 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.lang.ref.WeakReference;
+
+public class VMOperationTestMain {
+    public static byte[] garbage;
+    public static volatile WeakReference<Object> weakref;
+
+    public static void createweakref() {
+        Object o = new Object();
+        weakref = new WeakReference<>(o);
+    }
+
+    // Loop until a GC runs.
+    public static void main(String[] args) throws Exception {
+        createweakref();
+        while (weakref.get() != null) {
+            garbage = new byte[8192];
+            System.gc();
+        }
+    }
+}