changeset 42647:d01f2abf2c65

Merge
author jwilhelm
date Thu, 08 Dec 2016 17:03:45 +0100
parents 591ef3658bb0 2d3bde7569e0
children 9b0f9b1d282c
files hotspot/src/share/vm/classfile/moduleEntry.hpp hotspot/src/share/vm/classfile/modules.cpp hotspot/src/share/vm/classfile/vmSymbols.hpp hotspot/src/share/vm/gc/g1/bufferingOopClosure.cpp hotspot/src/share/vm/oops/instanceKlass.cpp hotspot/src/share/vm/prims/jvmti.xml hotspot/src/share/vm/runtime/arguments.cpp hotspot/test/Makefile hotspot/test/serviceability/jdwp/AllModulesCommandTest.java
diffstat 63 files changed, 911 insertions(+), 640 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/make/hotspot.script	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/make/hotspot.script	Thu Dec 08 17:03:45 2016 +0100
@@ -124,15 +124,14 @@
 
 # We will set the LD_LIBRARY_PATH as follows:
 #     o		$JVMPATH (directory portion only)
-#     o		$JRE/lib/$ARCH
+#     o		$JRE/lib
 # followed by the user's previous effective LD_LIBRARY_PATH, if
 # any.
 JRE=$JDK
 JAVA_HOME=$JDK
 export JAVA_HOME
 
-ARCH=@@LIBARCH@@
-SBP=${MYDIR}:${JRE}/lib/${ARCH}
+SBP=${MYDIR}:${JRE}/lib
 
 
 # Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -89,8 +89,18 @@
     if (is_niagara_plus()) {
       if (has_blk_init() && (cache_line_size > 0) && UseTLAB &&
           FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
-        // Use BIS instruction for TLAB allocation prefetch.
-        FLAG_SET_DEFAULT(AllocatePrefetchInstr, 1);
+        if (!has_sparc5_instr()) {
+          // Use BIS instruction for TLAB allocation prefetch
+          // on Niagara plus processors other than those based on CoreS4
+          FLAG_SET_DEFAULT(AllocatePrefetchInstr, 1);
+        } else {
+          // On CoreS4 processors use prefetch instruction
+          // to avoid partial RAW issue, also use prefetch style 3
+          FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
+          if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
+            FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
+          }
+        }
       }
       if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
         if (AllocatePrefetchInstr == 0) {
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -547,11 +547,7 @@
     if (pslash != NULL) {
       pslash = strrchr(buf, '/');
       if (pslash != NULL) {
-        *pslash = '\0';          // Get rid of /<arch>.
-        pslash = strrchr(buf, '/');
-        if (pslash != NULL) {
-          *pslash = '\0';        // Get rid of /lib.
-        }
+        *pslash = '\0';        // Get rid of /lib.
       }
     }
     Arguments::set_java_home(buf);
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -218,9 +218,6 @@
   #endif
 #endif
 
-// Cpu architecture string
-static char cpu_arch[] = HOTSPOT_LIB_ARCH;
-
 
 // pid_t gettid()
 //
@@ -263,7 +260,7 @@
   //
   // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
+  // <JAVA_HOME>/lib/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
   // assume libjvm.so is installed in a JDK and we use this path.
@@ -329,11 +326,7 @@
     if (pslash != NULL) {
       pslash = strrchr(buf, '/');
       if (pslash != NULL) {
-        *pslash = '\0';          // Get rid of /<arch>.
-        pslash = strrchr(buf, '/');
-        if (pslash != NULL) {
-          *pslash = '\0';        // Get rid of /lib.
-        }
+        *pslash = '\0';        // Get rid of /lib.
       }
     }
     Arguments::set_java_home(buf);
@@ -360,9 +353,9 @@
     // That's +1 for the colon and +1 for the trailing '\0'.
     char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char,
                                                      strlen(v) + 1 +
-                                                     sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch) + sizeof(DEFAULT_LIBPATH) + 1,
+                                                     sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
                                                      mtInternal);
-    sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
+    sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
     Arguments::set_library_path(ld_library_path);
     FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
@@ -2310,7 +2303,7 @@
 
   if (Arguments::sun_java_launcher_is_altjvm()) {
     // Support for the java launcher's '-XXaltjvm=<path>' option. Typical
-    // value for buf is "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so".
+    // value for buf is "<JAVA_HOME>/jre/lib/<vmtype>/libjvm.so".
     // If "/jre/lib/" appears at the right place in the string, then
     // assume we are installed in a JDK and we're done. Otherwise, check
     // for a JAVA_HOME environment variable and fix up the path so it
@@ -2346,9 +2339,9 @@
         len = strlen(buf);
         assert(len < buflen, "Ran out of buffer room");
         jrelib_p = buf + len;
-        snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
+        snprintf(jrelib_p, buflen-len, "/jre/lib");
         if (0 != access(buf, F_OK)) {
-          snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
+          snprintf(jrelib_p, buflen-len, "/lib");
         }
 
         if (0 == access(buf, F_OK)) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -534,13 +534,12 @@
 #define SYS_EXT_DIR     "/usr/jdk/packages"
 #define EXTENSIONS_DIR  "/lib/ext"
 
-  char cpu_arch[12];
   // Buffer that fits several sprintfs.
   // Note that the space for the colon and the trailing null are provided
   // by the nulls included by the sizeof operator.
   const size_t bufsize =
     MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
-         sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
+         sizeof(SYS_EXT_DIR) + sizeof("/lib/"), // invariant ld_library_path
          (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
@@ -561,11 +560,7 @@
     if (pslash != NULL) {
       pslash = strrchr(buf, '/');
       if (pslash != NULL) {
-        *pslash = '\0';          // Get rid of /<arch>.
-        pslash = strrchr(buf, '/');
-        if (pslash != NULL) {
-          *pslash = '\0';        // Get rid of /lib.
-        }
+        *pslash = '\0';        // Get rid of /lib.
       }
     }
     Arguments::set_java_home(buf);
@@ -623,21 +618,8 @@
     // However, to prevent the proliferation of improperly built native
     // libraries, the new path component /usr/jdk/packages is added here.
 
-    // Determine the actual CPU architecture.
-    sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch));
-#ifdef _LP64
-    // If we are a 64-bit vm, perform the following translations:
-    //   sparc   -> sparcv9
-    //   i386    -> amd64
-    if (strcmp(cpu_arch, "sparc") == 0) {
-      strcat(cpu_arch, "v9");
-    } else if (strcmp(cpu_arch, "i386") == 0) {
-      strcpy(cpu_arch, "amd64");
-    }
-#endif
-
     // Construct the invariant part of ld_library_path.
-    sprintf(common_path, SYS_EXT_DIR "/lib/%s", cpu_arch);
+    sprintf(common_path, SYS_EXT_DIR "/lib");
 
     // Struct size is more than sufficient for the path components obtained
     // through the dlinfo() call, so only add additional space for the path
@@ -2076,18 +2058,9 @@
       // Look for JAVA_HOME in the environment.
       char* java_home_var = ::getenv("JAVA_HOME");
       if (java_home_var != NULL && java_home_var[0] != 0) {
-        char cpu_arch[12];
         char* jrelib_p;
         int   len;
-        sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch));
-#ifdef _LP64
-        // If we are on sparc running a 64-bit vm, look in jre/lib/sparcv9.
-        if (strcmp(cpu_arch, "sparc") == 0) {
-          strcat(cpu_arch, "v9");
-        } else if (strcmp(cpu_arch, "i386") == 0) {
-          strcpy(cpu_arch, "amd64");
-        }
-#endif
+
         // Check the current module name "libjvm.so".
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
@@ -2098,9 +2071,9 @@
         len = strlen(buf);
         assert(len < buflen, "Ran out of buffer space");
         jrelib_p = buf + len;
-        snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
+        snprintf(jrelib_p, buflen-len, "/jre/lib");
         if (0 != access(buf, F_OK)) {
-          snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
+          snprintf(jrelib_p, buflen-len, "/lib");
         }
 
         if (0 == access(buf, F_OK)) {
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -5412,7 +5412,7 @@
     }
   }
 
-  TRACE_INIT_KLASS_ID(ik);
+  TRACE_INIT_ID(ik);
 
   // If we reach here, all is well.
   // Now remove the InstanceKlass* from the _klass_to_deallocate field
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -504,7 +504,7 @@
 
     if (pkg_name != NULL) {
       if (!Universe::is_module_initialized()) {
-        location = (*JImageFindResource)(_jimage, "java.base", get_jimage_version_string(), name, &size);
+        location = (*JImageFindResource)(_jimage, JAVA_BASE_NAME, get_jimage_version_string(), name, &size);
 #if INCLUDE_CDS
         // CDS uses the boot class loader to load classes whose packages are in
         // modules defined for other class loaders.  So, for now, get their module
@@ -751,6 +751,21 @@
   }
 }
 
+// Determine whether the module has been patched via the command-line
+// option --patch-module
+bool ClassLoader::is_in_patch_mod_entries(Symbol* module_name) {
+  if (_patch_mod_entries != NULL && _patch_mod_entries->is_nonempty()) {
+    int table_len = _patch_mod_entries->length();
+    for (int i = 0; i < table_len; i++) {
+      ModuleClassPathList* patch_mod = _patch_mod_entries->at(i);
+      if (module_name->fast_compare(patch_mod->module_name()) == 0) {
+        return true;
+      }
+    }
+  }
+  return false;
+}
+
 void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_search) {
   int len = (int)strlen(class_path);
   int end = 0;
@@ -771,8 +786,8 @@
     // what the base or core piece of the boot loader search is.  Either a java runtime
     // image is present or this is an exploded module build situation.
     if (set_base_piece) {
-      assert(string_ends_with(path, MODULES_IMAGE_NAME) || string_ends_with(path, "java.base"),
-             "Incorrect boot loader search path, no java runtime image or java.base exploded build");
+      assert(string_ends_with(path, MODULES_IMAGE_NAME) || string_ends_with(path, JAVA_BASE_NAME),
+             "Incorrect boot loader search path, no java runtime image or " JAVA_BASE_NAME " exploded build");
       struct stat st;
       if (os::stat(path, &st) == 0) {
         // Directory found
@@ -1141,7 +1156,7 @@
 
   ResourceMark rm;
   jlong size;
-  JImageLocationRef location = (*JImageFindResource)(jimage, "java.base", get_jimage_version_string(), MODULE_LOADER_MAP, &size);
+  JImageLocationRef location = (*JImageFindResource)(jimage, JAVA_BASE_NAME, get_jimage_version_string(), MODULE_LOADER_MAP, &size);
   if (location == 0) {
     vm_exit_during_initialization(
       "Cannot find ModuleLoaderMap location from modules jimage.", NULL);
@@ -1764,9 +1779,6 @@
 
 // Complete the ClassPathEntry setup for the boot loader
 void ClassLoader::classLoader_init2(TRAPS) {
-  // Create the moduleEntry for java.base
-  create_javabase();
-
   // Setup the list of module/path pairs for --patch-module processing
   // This must be done after the SymbolTable is created in order
   // to use fast_compare on module names instead of a string compare.
@@ -1774,6 +1786,10 @@
     setup_patch_mod_entries();
   }
 
+  // Create the ModuleEntry for java.base (must occur after setup_patch_mod_entries
+  // to successfully determine if java.base has been patched)
+  create_javabase();
+
   // Setup the initial java.base/path pair for the exploded build entries.
   // As more modules are defined during module system initialization, more
   // entries will be added to the exploded build array.
@@ -1823,7 +1839,7 @@
     MutexLocker ml(Module_lock, THREAD);
     ModuleEntry* jb_module = null_cld_modules->locked_create_entry_or_null(Handle(NULL), vmSymbols::java_base(), NULL, NULL, null_cld);
     if (jb_module == NULL) {
-      vm_exit_during_initialization("Unable to create ModuleEntry for java.base");
+      vm_exit_during_initialization("Unable to create ModuleEntry for " JAVA_BASE_NAME);
     }
     ModuleEntryTable::set_javabase_moduleEntry(jb_module);
   }
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -418,6 +418,8 @@
     }
   }
 
+  static bool is_in_patch_mod_entries(Symbol* module_name);
+
 #if INCLUDE_CDS
   // Sharing dump and restore
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -97,7 +97,7 @@
   _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
+  TRACE_INIT_ID(this);
 }
 
 void ClassLoaderData::init_dependencies(TRAPS) {
@@ -167,9 +167,10 @@
 }
 
 void ClassLoaderData::classes_do(void f(Klass * const)) {
-  assert_locked_or_safepoint(_metaspace_lock);
-  for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
+  // Lock-free access requires load_ptr_acquire
+  for (Klass* k = load_ptr_acquire(&_klasses); k != NULL; k = k->next_link()) {
     f(k);
+    assert(k != k->next_link(), "no loops!");
   }
 }
 
@@ -812,6 +813,16 @@
   }
 }
 
+void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
+  // Only walk the head until any clds not purged from prior unloading
+  // (CMS doesn't purge right away).
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+    assert(cld->is_unloading(), "invariant");
+    cl->do_cld(cld);
+  }
+}
+
 void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
   for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
     CLDClosure* closure = cld->keep_alive() ? strong : weak;
@@ -1042,7 +1053,7 @@
   }
 }
 
-void ClassLoaderDataGraph::post_class_unload_events(void) {
+void ClassLoaderDataGraph::post_class_unload_events() {
 #if INCLUDE_TRACE
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
   if (Tracing::enabled()) {
@@ -1191,9 +1202,7 @@
   EventClassUnload event(UNTIMED);
   event.set_endtime(_class_unload_time);
   event.set_unloadedClass(k);
-  oop defining_class_loader = k->class_loader();
-  event.set_definingClassLoader(defining_class_loader != NULL ?
-                                defining_class_loader->klass() : (Klass*)NULL);
+  event.set_definingClassLoader(k->class_loader_data());
   event.commit();
 }
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -30,6 +30,7 @@
 #include "memory/metaspace.hpp"
 #include "memory/metaspaceCounters.hpp"
 #include "runtime/mutex.hpp"
+#include "trace/traceMacros.hpp"
 #include "utilities/growableArray.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_TRACE
@@ -78,7 +79,7 @@
   static bool _metaspace_oom;
 
   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
-  static void post_class_unload_events(void);
+  static void post_class_unload_events();
  public:
   static ClassLoaderData* find_or_create(Handle class_loader, TRAPS);
   static void purge();
@@ -89,6 +90,7 @@
   static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
   // cld do
   static void cld_do(CLDClosure* cl);
+  static void cld_unloading_do(CLDClosure* cl);
   static void roots_cld_do(CLDClosure* strong, CLDClosure* weak);
   static void keep_alive_cld_do(CLDClosure* cl);
   static void always_strong_cld_do(CLDClosure* cl);
@@ -210,6 +212,8 @@
   static Metaspace* _ro_metaspace;
   static Metaspace* _rw_metaspace;
 
+  TRACE_DEFINE_TRACE_ID_FIELD;
+
   void set_next(ClassLoaderData* next) { _next = next; }
   ClassLoaderData* next() const        { return _next; }
 
@@ -342,6 +346,8 @@
     assert(_shared_class_loader_id <0, "cannot be assigned more than once");
     _shared_class_loader_id = id;
   }
+
+  TRACE_DEFINE_TRACE_ID_METHODS;
 };
 
 // An iterator that distributes Klasses to parallel worker threads.
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -802,7 +802,7 @@
     if (javabase_was_defined) {
       ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
       assert(javabase_entry != NULL && javabase_entry->module() != NULL,
-             "Setting class module field, java.base should be defined");
+             "Setting class module field, " JAVA_BASE_NAME " should be defined");
       Handle javabase_handle(THREAD, JNIHandles::resolve(javabase_entry->module()));
       set_module(mirror(), javabase_handle());
     }
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -301,7 +301,15 @@
   entry->set_version(version);
   entry->set_location(location);
 
-  TRACE_INIT_MODULE_ID(entry);
+  if (ClassLoader::is_in_patch_mod_entries(name)) {
+    entry->set_is_patched();
+    if (log_is_enabled(Trace, modules, patch)) {
+      ResourceMark rm;
+      log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
+    }
+  }
+
+  TRACE_INIT_ID(entry);
 
   return entry;
 }
@@ -365,12 +373,12 @@
   assert(module_table != NULL, "boot loader's ModuleEntryTable not defined");
 
   if (module_handle.is_null()) {
-    fatal("Unable to finalize module definition for java.base");
+    fatal("Unable to finalize module definition for " JAVA_BASE_NAME);
   }
 
   // Set java.lang.reflect.Module, version and location for java.base
   ModuleEntry* jb_module = javabase_moduleEntry();
-  assert(jb_module != NULL, "java.base ModuleEntry not defined");
+  assert(jb_module != NULL, JAVA_BASE_NAME " ModuleEntry not defined");
   jb_module->set_version(version);
   jb_module->set_location(location);
   // Once java.base's ModuleEntry _module field is set with the known
@@ -387,7 +395,8 @@
 // Their module field is set once java.base's java.lang.reflect.Module is known to the VM.
 void ModuleEntryTable::patch_javabase_entries(Handle module_handle) {
   if (module_handle.is_null()) {
-    fatal("Unable to patch the module field of classes loaded prior to java.base's definition, invalid java.lang.reflect.Module");
+    fatal("Unable to patch the module field of classes loaded prior to "
+          JAVA_BASE_NAME "'s definition, invalid java.lang.reflect.Module");
   }
 
   // Do the fixups for the basic primitive types
--- a/hotspot/src/share/vm/classfile/moduleEntry.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/moduleEntry.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -65,6 +65,7 @@
   bool _can_read_all_unnamed;
   bool _has_default_read_edges;        // JVMTI redefine/retransform support
   bool _must_walk_reads;               // walk module's reads list at GC safepoints to purge out dead modules
+  bool _is_patched;                    // whether the module is patched via --patch-module
   TRACE_DEFINE_TRACE_ID_FIELD;
   enum {MODULE_READS_SIZE = 101};      // Initial size of list of modules that the module can read.
 
@@ -79,6 +80,7 @@
     _can_read_all_unnamed = false;
     _has_default_read_edges = false;
     _must_walk_reads = false;
+    _is_patched = false;
   }
 
   Symbol*          name() const                        { return literal(); }
@@ -133,6 +135,13 @@
     return prev;
   }
 
+  void set_is_patched() {
+      _is_patched = true;
+  }
+  bool is_patched() {
+      return _is_patched;
+  }
+
   ModuleEntry* next() const {
     return (ModuleEntry*)HashtableEntry<Symbol*, mtModule>::next();
   }
--- a/hotspot/src/share/vm/classfile/modules.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/modules.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -179,18 +179,18 @@
 
     if (string_obj == NULL || !string_obj->is_a(SystemDictionary::String_klass())) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                "Bad package name for module: java.base");
+                "Bad package name for module: " JAVA_BASE_NAME);
     }
     char *package_name = java_lang_String::as_utf8_string(string_obj);
     if (!Modules::verify_package_name(package_name)) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                err_msg("Invalid package name: %s for module: java.base", package_name));
+                err_msg("Invalid package name: %s for module: " JAVA_BASE_NAME, package_name));
     }
     Symbol* pkg_symbol = SymbolTable::new_symbol(package_name, CHECK);
     // append_if_missing() returns FALSE if entry already exists.
     if (!pkg_list->append_if_missing(pkg_symbol)) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                err_msg("Duplicate package name: %s for module java.base",
+                err_msg("Duplicate package name: %s for module " JAVA_BASE_NAME,
                         package_name));
     }
   }
@@ -208,7 +208,7 @@
   assert(pkg_list->length() == 0 || package_table != NULL, "Bad package_table");
 
   // Ensure java.base's ModuleEntry has been created
-  assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "No ModuleEntry for java.base");
+  assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "No ModuleEntry for " JAVA_BASE_NAME);
 
   bool duplicate_javabase = false;
   {
@@ -229,7 +229,7 @@
         // Some of java.base's packages were added early in bootstrapping, ignore duplicates.
         if (package_table->lookup_only(pkg_list->at(x)) == NULL) {
           pkg = package_table->locked_create_entry_or_null(pkg_list->at(x), ModuleEntryTable::javabase_moduleEntry());
-          assert(pkg != NULL, "Unable to create a java.base package entry");
+          assert(pkg != NULL, "Unable to create a " JAVA_BASE_NAME " package entry");
         }
         // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
         // the Symbol* that was created above for each package. The refcount was incremented
@@ -243,7 +243,7 @@
   }
   if (duplicate_javabase) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "Module java.base is already defined");
+              "Module " JAVA_BASE_NAME " is already defined");
   }
 
   // Only the thread that actually defined the base module will get here,
@@ -252,15 +252,15 @@
   // Patch any previously loaded class's module field with java.base's java.lang.reflect.Module.
   ModuleEntryTable::patch_javabase_entries(module_handle);
 
-  log_debug(modules)("define_javabase_module(): Definition of module: java.base,"
-                     " version: %s, location: %s, package #: %d",
+  log_debug(modules)("define_javabase_module(): Definition of module: "
+                     JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
                      module_version != NULL ? module_version : "NULL",
                      module_location != NULL ? module_location : "NULL",
                      pkg_list->length());
 
   // packages defined to java.base
   for (int x = 0; x < pkg_list->length(); x++) {
-    log_trace(modules)("define_javabase_module(): creation of package %s for module java.base",
+    log_trace(modules)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME,
                        (pkg_list->at(x))->as_C_string());
   }
 }
@@ -285,7 +285,7 @@
   }
 
   // Special handling of java.base definition
-  if (strcmp(module_name, "java.base") == 0) {
+  if (strcmp(module_name, JAVA_BASE_NAME) == 0) {
     define_javabase_module(module, version, location, packages, CHECK);
     return;
   }
@@ -608,7 +608,8 @@
 
 // This method is called by JFR and JNI.
 jobject Modules::get_module(jclass clazz, TRAPS) {
-  assert(ModuleEntryTable::javabase_defined(), "Attempt to call get_module before java.base is defined");
+  assert(ModuleEntryTable::javabase_defined(),
+         "Attempt to call get_module before " JAVA_BASE_NAME " is defined");
 
   if (clazz == NULL) {
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(),
@@ -654,7 +655,7 @@
 jobject Modules::get_module_by_package_name(jobject loader, jstring package, TRAPS) {
   ResourceMark rm(THREAD);
   assert(ModuleEntryTable::javabase_defined(),
-         "Attempt to call get_module_from_pkg before java.base is defined");
+         "Attempt to call get_module_from_pkg before " JAVA_BASE_NAME " is defined");
 
   if (NULL == package) {
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(),
@@ -691,7 +692,7 @@
 
 jobject Modules::get_named_module(Handle h_loader, const char* package_str, TRAPS) {
   assert(ModuleEntryTable::javabase_defined(),
-         "Attempt to call get_named_module before java.base is defined");
+         "Attempt to call get_named_module before " JAVA_BASE_NAME " is defined");
   assert(h_loader.is_null() || java_lang_ClassLoader::is_subclass(h_loader->klass()),
          "Class loader is not a subclass of java.lang.ClassLoader");
   assert(package_str != NULL, "the package_str should not be NULL");
--- a/hotspot/src/share/vm/classfile/packageEntry.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/packageEntry.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -214,7 +214,7 @@
   entry->set_hash(hash);
   entry->set_literal(name);
 
-  TRACE_INIT_PACKAGE_ID(entry);
+  TRACE_INIT_ID(entry);
 
   // Initialize fields specific to a PackageEntry
   entry->init();
@@ -293,7 +293,7 @@
           (module_name->fast_compare(vmSymbols::java_base()) == 0) &&
           !pkg_list->contains(entry->name())) {
         ResourceMark rm;
-        vm_exit_during_initialization("A non-java.base package was loaded prior to module system initialization", entry->name()->as_C_string());
+        vm_exit_during_initialization("A non-" JAVA_BASE_NAME " package was loaded prior to module system initialization", entry->name()->as_C_string());
       }
     }
   }
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -621,35 +621,28 @@
   return (nh);
 }
 
-// utility function for class load event
 static void post_class_load_event(const Ticks& start_time,
                                   instanceKlassHandle k,
-                                  Handle initiating_loader) {
+                                  const ClassLoaderData* init_cld) {
 #if INCLUDE_TRACE
   EventClassLoad event(UNTIMED);
   if (event.should_commit()) {
     event.set_starttime(start_time);
     event.set_loadedClass(k());
-    oop defining_class_loader = k->class_loader();
-    event.set_definingClassLoader(defining_class_loader != NULL ?
-      defining_class_loader->klass() : (Klass*)NULL);
-    oop class_loader = initiating_loader.is_null() ? (oop)NULL : initiating_loader();
-    event.set_initiatingClassLoader(class_loader != NULL ?
-      class_loader->klass() : (Klass*)NULL);
+    event.set_definingClassLoader(k->class_loader_data());
+    event.set_initiatingClassLoader(init_cld);
     event.commit();
   }
 #endif // INCLUDE_TRACE
 }
 
-// utility function for class define event
-static void class_define_event(instanceKlassHandle k) {
+static void class_define_event(instanceKlassHandle k,
+                               const ClassLoaderData* def_cld) {
 #if INCLUDE_TRACE
-  EventClassDefine event(UNTIMED);
+  EventClassDefine event;
   if (event.should_commit()) {
     event.set_definedClass(k());
-    oop defining_class_loader = k->class_loader();
-    event.set_definingClassLoader(defining_class_loader != NULL ?
-      defining_class_loader->klass() : (Klass*)NULL);
+    event.set_definingClassLoader(def_cld);
     event.commit();
   }
 #endif // INCLUDE_TRACE
@@ -907,7 +900,7 @@
     return NULL;
   }
 
-  post_class_load_event(class_load_start_time, k, class_loader);
+  post_class_load_event(class_load_start_time, k, loader_data);
 
 #ifdef ASSERT
   {
@@ -1090,7 +1083,7 @@
         JvmtiExport::post_class_load((JavaThread *) THREAD, k());
     }
 
-    post_class_load_event(class_load_start_time, k, class_loader);
+    post_class_load_event(class_load_start_time, k, loader_data);
   }
   assert(host_klass != NULL || NULL == cp_patches,
          "cp_patches only found with host_klass");
@@ -1641,7 +1634,7 @@
       JvmtiExport::post_class_load((JavaThread *) THREAD, k());
 
   }
-  class_define_event(k);
+  class_define_event(k, loader_data);
 }
 
 // Support parallel classloading
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
 #define SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
 
+#include "classfile/moduleEntry.hpp"
 #include "classfile/vmSymbols_ext.hpp"
 #include "oops/symbol.hpp"
 #include "memory/iterator.hpp"
@@ -50,7 +51,7 @@
 
 #define VM_SYMBOLS_DO(template, do_alias)                                                         \
   /* commonly used class, package, module names */                                                \
-  template(java_base,                                 "java.base")                                \
+  template(java_base,                                 JAVA_BASE_NAME)                             \
   template(java_lang_System,                          "java/lang/System")                         \
   template(java_lang_Object,                          "java/lang/Object")                         \
   template(java_lang_Class,                           "java/lang/Class")                          \
--- a/hotspot/src/share/vm/gc/cms/parCardTableModRefBS.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/gc/cms/parCardTableModRefBS.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -395,9 +395,13 @@
   // event lock and do the read again in case some other thread had already
   // succeeded and done the resize.
   int cur_collection = GenCollectedHeap::heap()->total_collections();
-  if (_last_LNC_resizing_collection[i] != cur_collection) {
+  // Updated _last_LNC_resizing_collection[i] must not be visible before
+  // _lowest_non_clean and friends are visible. Therefore use acquire/release
+  // to guarantee this on non TSO architecures.
+  if (OrderAccess::load_acquire(&_last_LNC_resizing_collection[i]) != cur_collection) {
     MutexLocker x(ParGCRareEvent_lock);
-    if (_last_LNC_resizing_collection[i] != cur_collection) {
+    // This load_acquire is here for clarity only. The MutexLocker already fences.
+    if (OrderAccess::load_acquire(&_last_LNC_resizing_collection[i]) != cur_collection) {
       if (_lowest_non_clean[i] == NULL ||
           n_chunks != _lowest_non_clean_chunk_size[i]) {
 
@@ -417,7 +421,8 @@
             _lowest_non_clean[i][j] = NULL;
         }
       }
-      _last_LNC_resizing_collection[i] = cur_collection;
+      // Make sure this gets visible only after _lowest_non_clean* was initialized
+      OrderAccess::release_store(&_last_LNC_resizing_collection[i], cur_collection);
     }
   }
   // In any case, now do the initialization.
--- a/hotspot/src/share/vm/gc/g1/bufferingOopClosure.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-/*
- * 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
- * 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 "gc/g1/bufferingOopClosure.hpp"
-#include "memory/iterator.hpp"
-#include "utilities/debug.hpp"
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-class TestBufferingOopClosure {
-
-  // Helper class to fake a set of oop*s and narrowOop*s.
-  class FakeRoots {
-   public:
-    // Used for sanity checking of the values passed to the do_oops functions in the test.
-    static const uintptr_t NarrowOopMarker = uintptr_t(1) << (BitsPerWord -1);
-
-    int    _num_narrow;
-    int    _num_full;
-    void** _narrow;
-    void** _full;
-
-    FakeRoots(int num_narrow, int num_full) :
-        _num_narrow(num_narrow),
-        _num_full(num_full),
-        _narrow((void**)::malloc(sizeof(void*) * num_narrow)),
-        _full((void**)::malloc(sizeof(void*) * num_full)) {
-
-      for (int i = 0; i < num_narrow; i++) {
-        _narrow[i] = (void*)(NarrowOopMarker + (uintptr_t)i);
-      }
-      for (int i = 0; i < num_full; i++) {
-        _full[i] = (void*)(uintptr_t)i;
-      }
-    }
-
-    ~FakeRoots() {
-      ::free(_narrow);
-      ::free(_full);
-    }
-
-    void oops_do_narrow_then_full(OopClosure* cl) {
-      for (int i = 0; i < _num_narrow; i++) {
-        cl->do_oop((narrowOop*)_narrow[i]);
-      }
-      for (int i = 0; i < _num_full; i++) {
-        cl->do_oop((oop*)_full[i]);
-      }
-    }
-
-    void oops_do_full_then_narrow(OopClosure* cl) {
-      for (int i = 0; i < _num_full; i++) {
-        cl->do_oop((oop*)_full[i]);
-      }
-      for (int i = 0; i < _num_narrow; i++) {
-        cl->do_oop((narrowOop*)_narrow[i]);
-      }
-    }
-
-    void oops_do_mixed(OopClosure* cl) {
-      int i;
-      for (i = 0; i < _num_full && i < _num_narrow; i++) {
-        cl->do_oop((oop*)_full[i]);
-        cl->do_oop((narrowOop*)_narrow[i]);
-      }
-      for (int j = i; j < _num_full; j++) {
-        cl->do_oop((oop*)_full[i]);
-      }
-      for (int j = i; j < _num_narrow; j++) {
-        cl->do_oop((narrowOop*)_narrow[i]);
-      }
-    }
-
-    static const int MaxOrder = 2;
-
-    void oops_do(OopClosure* cl, int do_oop_order) {
-      switch(do_oop_order) {
-        case 0:
-          oops_do_narrow_then_full(cl);
-          break;
-        case 1:
-          oops_do_full_then_narrow(cl);
-          break;
-        case 2:
-          oops_do_mixed(cl);
-          break;
-        default:
-          oops_do_narrow_then_full(cl);
-          break;
-      }
-    }
-  };
-
-  class CountOopClosure : public OopClosure {
-    int _narrow_oop_count;
-    int _full_oop_count;
-   public:
-    CountOopClosure() : _narrow_oop_count(0), _full_oop_count(0) {}
-    void do_oop(narrowOop* p) {
-      assert((uintptr_t(p) & FakeRoots::NarrowOopMarker) != 0,
-          "The narrowOop was unexpectedly not marked with the NarrowOopMarker");
-      _narrow_oop_count++;
-    }
-
-    void do_oop(oop* p){
-      assert((uintptr_t(p) & FakeRoots::NarrowOopMarker) == 0,
-          "The oop was unexpectedly marked with the NarrowOopMarker");
-      _full_oop_count++;
-    }
-
-    int narrow_oop_count() { return _narrow_oop_count; }
-    int full_oop_count()   { return _full_oop_count; }
-    int all_oop_count()    { return _narrow_oop_count + _full_oop_count; }
-  };
-
-  class DoNothingOopClosure : public OopClosure {
-   public:
-    void do_oop(narrowOop* p) {}
-    void do_oop(oop* p)       {}
-  };
-
-  static void testCount(int num_narrow, int num_full, int do_oop_order) {
-    FakeRoots fr(num_narrow, num_full);
-
-    CountOopClosure coc;
-    BufferingOopClosure boc(&coc);
-
-    fr.oops_do(&boc, do_oop_order);
-
-    boc.done();
-
-    #define assert_testCount(got, expected)                                \
-       assert((got) == (expected),                                         \
-              "Expected: %d, got: %d, when running testCount(%d, %d, %d)", \
-              (got), (expected), num_narrow, num_full, do_oop_order)
-
-    assert_testCount(num_narrow, coc.narrow_oop_count());
-    assert_testCount(num_full, coc.full_oop_count());
-    assert_testCount(num_narrow + num_full, coc.all_oop_count());
-  }
-
-  static void testCount() {
-    int buffer_length = BufferingOopClosure::BufferLength;
-
-    for (int order = 0; order < FakeRoots::MaxOrder; order++) {
-      testCount(0,                 0,                 order);
-      testCount(10,                0,                 order);
-      testCount(0,                 10,                order);
-      testCount(10,                10,                order);
-      testCount(buffer_length,     10,                order);
-      testCount(10,                buffer_length,     order);
-      testCount(buffer_length,     buffer_length,     order);
-      testCount(buffer_length + 1, 10,                order);
-      testCount(10,                buffer_length + 1, order);
-      testCount(buffer_length + 1, buffer_length,     order);
-      testCount(buffer_length,     buffer_length + 1, order);
-      testCount(buffer_length + 1, buffer_length + 1, order);
-    }
-  }
-
-  static void testIsBufferEmptyOrFull(int num_narrow, int num_full, bool expect_empty, bool expect_full) {
-    FakeRoots fr(num_narrow, num_full);
-
-    DoNothingOopClosure cl;
-    BufferingOopClosure boc(&cl);
-
-    fr.oops_do(&boc, 0);
-
-    #define assert_testIsBufferEmptyOrFull(got, expected)                        \
-        assert((got) == (expected),                                              \
-               "Expected: %d, got: %d. testIsBufferEmptyOrFull(%d, %d, %s, %s)", \
-               (got), (expected), num_narrow, num_full,                          \
-               BOOL_TO_STR(expect_empty), BOOL_TO_STR(expect_full))
-
-    assert_testIsBufferEmptyOrFull(expect_empty, boc.is_buffer_empty());
-    assert_testIsBufferEmptyOrFull(expect_full, boc.is_buffer_full());
-  }
-
-  static void testIsBufferEmptyOrFull() {
-    int bl = BufferingOopClosure::BufferLength;
-
-    testIsBufferEmptyOrFull(0,       0, true,  false);
-    testIsBufferEmptyOrFull(1,       0, false, false);
-    testIsBufferEmptyOrFull(0,       1, false, false);
-    testIsBufferEmptyOrFull(1,       1, false, false);
-    testIsBufferEmptyOrFull(10,      0, false, false);
-    testIsBufferEmptyOrFull(0,      10, false, false);
-    testIsBufferEmptyOrFull(10,     10, false, false);
-    testIsBufferEmptyOrFull(0,      bl, false, true);
-    testIsBufferEmptyOrFull(bl,      0, false, true);
-    testIsBufferEmptyOrFull(bl/2, bl/2, false, true);
-    testIsBufferEmptyOrFull(bl-1,    1, false, true);
-    testIsBufferEmptyOrFull(1,    bl-1, false, true);
-    // Processed
-    testIsBufferEmptyOrFull(bl+1,    0, false, false);
-    testIsBufferEmptyOrFull(bl*2,    0, false, true);
-  }
-
-  static void testEmptyAfterDone(int num_narrow, int num_full) {
-    FakeRoots fr(num_narrow, num_full);
-
-    DoNothingOopClosure cl;
-    BufferingOopClosure boc(&cl);
-
-    fr.oops_do(&boc, 0);
-
-    // Make sure all get processed.
-    boc.done();
-
-    assert(boc.is_buffer_empty(),
-           "Should be empty after call to done(). testEmptyAfterDone(%d, %d)",
-           num_narrow, num_full);
-  }
-
-  static void testEmptyAfterDone() {
-    int bl = BufferingOopClosure::BufferLength;
-
-    testEmptyAfterDone(0,       0);
-    testEmptyAfterDone(1,       0);
-    testEmptyAfterDone(0,       1);
-    testEmptyAfterDone(1,       1);
-    testEmptyAfterDone(10,      0);
-    testEmptyAfterDone(0,      10);
-    testEmptyAfterDone(10,     10);
-    testEmptyAfterDone(0,      bl);
-    testEmptyAfterDone(bl,      0);
-    testEmptyAfterDone(bl/2, bl/2);
-    testEmptyAfterDone(bl-1,    1);
-    testEmptyAfterDone(1,    bl-1);
-    // Processed
-    testEmptyAfterDone(bl+1,    0);
-    testEmptyAfterDone(bl*2,    0);
-  }
-
-  public:
-  static void test() {
-    testCount();
-    testIsBufferEmptyOrFull();
-    testEmptyAfterDone();
-  }
-};
-
-void TestBufferingOopClosure_test() {
-  TestBufferingOopClosure::test();
-}
-
-#endif
--- a/hotspot/src/share/vm/gc/g1/bufferingOopClosure.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/bufferingOopClosure.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -42,7 +42,7 @@
 // buffered entries.
 
 class BufferingOopClosure: public OopClosure {
-  friend class TestBufferingOopClosure;
+  friend class BufferingOopClosureTest;
 protected:
   static const size_t BufferLength = 1024;
 
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -263,6 +263,13 @@
 }
 
 void
+PSParallelCompact::print_generic_summary_data(ParallelCompactData& summary_data,
+                                              HeapWord* const beg_addr,
+                                              HeapWord* const end_addr) {
+  ::print_generic_summary_data(summary_data,beg_addr, end_addr);
+}
+
+void
 print_generic_summary_data(ParallelCompactData& summary_data,
                            SpaceInfo* space_info)
 {
@@ -377,26 +384,6 @@
     print_generic_summary_data(summary_data, space->bottom(), space->top());
   } while (++id < PSParallelCompact::last_space_id);
 }
-
-void ParallelCompact_test() {
-  if (!UseParallelOldGC) {
-    return;
-  }
-  // Check that print_generic_summary_data() does not print the
-  // end region by placing a bad value in the destination of the
-  // end region.  The end region should not be printed because it
-  // corresponds to the space after the end of the heap.
-  ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
-  ParCompactionManager* const vmthread_cm =
-    ParCompactionManager::manager_array(ParallelGCThreads);
-  HeapWord* begin_heap =
-    (HeapWord*) heap->old_gen()->virtual_space()->low_boundary();
-  HeapWord* end_heap =
-    (HeapWord*) heap->young_gen()->virtual_space()->high_boundary();
-
-  print_generic_summary_data(PSParallelCompact::summary_data(),
-    begin_heap, end_heap);
-}
 #endif  // #ifndef PRODUCT
 
 #ifdef  ASSERT
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -965,6 +965,7 @@
   friend class AdjustPointerClosure;
   friend class AdjustKlassClosure;
   friend class RefProcTaskProxy;
+  friend class PSParallelCompactTest;
 
  private:
   static STWGCTimer           _gc_timer;
@@ -1101,6 +1102,13 @@
   // Reset time since last full gc
   static void reset_millis_since_last_gc();
 
+#ifndef PRODUCT
+  // Print generic summary data
+  static void print_generic_summary_data(ParallelCompactData& summary_data,
+                                         HeapWord* const beg_addr,
+                                         HeapWord* const end_addr);
+#endif  // #ifndef PRODUCT
+
  public:
 
   PSParallelCompact();
--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -85,7 +85,7 @@
   CardArr* _lowest_non_clean;
   size_t*  _lowest_non_clean_chunk_size;
   uintptr_t* _lowest_non_clean_base_chunk_index;
-  int* _last_LNC_resizing_collection;
+  volatile int* _last_LNC_resizing_collection;
 
   // Initializes "lowest_non_clean" to point to the array for the region
   // covering "sp", and "lowest_non_clean_base_chunk_index" to the chunk
--- a/hotspot/src/share/vm/logging/logTag.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -90,6 +90,7 @@
   LOG_TAG(oopmap) \
   LOG_TAG(os) \
   LOG_TAG(pagesize) \
+  LOG_TAG(patch) \
   LOG_TAG(path) \
   LOG_TAG(phases) \
   LOG_TAG(plab) \
--- a/hotspot/src/share/vm/memory/metaspaceTracer.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceTracer.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -62,18 +62,12 @@
                                                     Metaspace::MetadataType mdtype) const {
   E event;
   if (event.should_commit()) {
+    event.set_classLoader(cld);
     if (cld->is_anonymous()) {
-      event.set_classLoader(NULL);
       event.set_anonymousClassLoader(true);
     } else {
-      if (cld->is_the_null_class_loader_data()) {
-        event.set_classLoader((Klass*) NULL);
-      } else {
-        event.set_classLoader(cld->class_loader()->klass());
-      }
       event.set_anonymousClassLoader(false);
     }
-
     event.set_size(word_size * BytesPerWord);
     event.set_metadataType((u1) mdtype);
     event.set_metaspaceObjectType((u1) objtype);
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -90,7 +90,7 @@
     set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
     set_layout_helper(Klass::_lh_neutral_value);
     set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
-    TRACE_INIT_KLASS_ID(this);
+    TRACE_INIT_ID(this);
 }
 
 
@@ -105,7 +105,7 @@
   // These classes will be put on a fixup list and their module fields will be patched once
   // java.base is defined.
   assert((module_entry != NULL) || ((module_entry == NULL) && !ModuleEntryTable::javabase_defined()),
-         "module entry not available post java.base definition");
+         "module entry not available post " JAVA_BASE_NAME " definition");
   oop module = (module_entry != NULL) ? JNIHandles::resolve(module_entry->module()) : (oop)NULL;
   java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(THREAD, module), Handle(NULL), CHECK);
 }
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -2248,7 +2248,7 @@
         // the java.base module.  If a non-java.base package is erroneously placed
         // in the java.base module it will be caught later when java.base
         // is defined by ModuleEntryTable::verify_javabase_packages check.
-        assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "java.base module is NULL");
+        assert(ModuleEntryTable::javabase_moduleEntry() != NULL, JAVA_BASE_NAME " module is NULL");
         _package_entry = loader_data->packages()->lookup(pkg_name, ModuleEntryTable::javabase_moduleEntry());
       } else {
         assert(loader_data->modules()->unnamed_module() != NULL, "unnamed module is NULL");
--- a/hotspot/src/share/vm/oops/klass.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/oops/klass.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -488,7 +488,7 @@
 
 void Klass::remove_unshareable_info() {
   assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
-  TRACE_REMOVE_KLASS_ID(this);
+  TRACE_REMOVE_ID(this);
 
   set_subklass(NULL);
   set_next_sibling(NULL);
@@ -501,7 +501,7 @@
 }
 
 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
-  TRACE_RESTORE_KLASS_ID(this);
+  TRACE_RESTORE_ID(this);
 
   // If an exception happened during CDS restore, some of these fields may already be
   // set.  We leave the class on the CLD list, even if incomplete so that we don't
--- a/hotspot/src/share/vm/opto/macro.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/opto/macro.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -1952,7 +1952,7 @@
       i_o = pf_phi_abio;
    } else if( UseTLAB && AllocatePrefetchStyle == 3 ) {
       // Insert a prefetch instruction for each allocation.
-      // This code is used for SPARC with BIS.
+      // This code is used to generate 1 prefetch instruction per cache line.
 
       // Generate several prefetch instructions.
       uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines;
@@ -1965,11 +1965,8 @@
       transform_later(cache_adr);
       cache_adr = new CastP2XNode(needgc_false, cache_adr);
       transform_later(cache_adr);
-      // For BIS instructions to be emitted, the address must be aligned at cache line size.
-      // (The VM sets AllocatePrefetchStepSize to the cache line size, unless a value is
-      // specified at the command line.) If the address is not aligned at cache line size
-      // boundary, a standard store instruction is triggered (instead of the BIS). For the
-      // latter, 8-byte alignment is necessary.
+      // Address is aligned to execute prefetch to the beginning of cache line size
+      // (it is important when BIS instruction is used on SPARC as prefetch).
       Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1));
       cache_adr = new AndXNode(cache_adr, mask);
       transform_later(cache_adr);
--- a/hotspot/src/share/vm/prims/jvmti.xml	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/prims/jvmti.xml	Thu Dec 08 17:03:45 2016 +0100
@@ -404,7 +404,7 @@
     interfaces are more appropriate than <jvmti/> for many tools. 
     For more information on the Java Platform Debugger Architecture, 
     see the 
-    <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/architecture.html">Java 
+    <externallink id="docs/technotes/guides/jpda/architecture.html">Java 
       Platform Debugger Architecture website</externallink>. 
   </intro>
 
@@ -764,7 +764,8 @@
     An agent creates a <jvmti/> environment 
     by passing a <jvmti/> version 
     as the interface ID to the JNI Invocation API function 
-    <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#GetEnv"><code>GetEnv</code></externallink>.
+    <externallink id="docs/technotes/guides/jni/spec/invocation.html#GetEnv">
+      <code>GetEnv</code></externallink>.
     See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink>
     for more details on the creation and use of 
     <jvmti/> environments.
@@ -883,7 +884,7 @@
     Modified UTF-8 differs 
     from standard UTF-8 in the representation of supplementary characters 
     and of the null character. See the
-    <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16542">
+    <externallink id="docs/technotes/guides/jni/spec/types.html#modified_utf_8_strings">
       Modified UTF-8 Strings</externallink>
     section of the JNI specification for details.
   </intro>
@@ -913,7 +914,7 @@
     by calling <jvmti/> functions. 
     Access to <jvmti/> functions is by use of an interface pointer
     in the same manner as 
-    <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html">Java 
+    <externallink id="docs/technotes/guides/jni/spec/design.html">Java 
       Native Interface (JNI) functions</externallink> are accessed.
     The <jvmti/> interface pointer is called the 
     <i>environment pointer</i>.
@@ -1005,7 +1006,8 @@
     local references--these local references are created 
     during the <jvmti/> call.
     Local references are a resource that must be managed (see the 
-    <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp18654">JNI Documentation</externallink>).  
+    <externallink id="docs/technotes/guides/jni/spec/functions.html#local_references">
+      JNI Documentation</externallink>).  
     When threads return from native code all local references
     are freed.  Note that some threads, including typical
     agent threads, will never return from native code.
@@ -1040,7 +1042,7 @@
       <jvmti/> function.
       See the
       <externallink 
-        id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp770"
+        id="docs/technotes/guides/jni/spec/design.html#java_exceptions"
              >Java Exceptions</externallink>
       section of the JNI specification for information on handling exceptions.
     </intro>
@@ -2105,8 +2107,8 @@
         <functionlink id="GetAllStackTraces"/>).
 	<p/>
 	Upon execution of <code>proc</code>, the new thread will be attached to the
-	VM--see the JNI documentation on 
-	<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp1060"
+	VM -- see the JNI documentation on 
+	<externallink id="docs/technotes/guides/jni/spec/invocation.html#attaching_to_the_vm"
 		      >Attaching to the VM</externallink>.
       </description>
       <origin>jvmdiClone</origin>
@@ -6869,7 +6871,7 @@
       <synopsis>Get Class Signature</synopsis>
       <description>
         For the class indicated by <code>klass</code>, return the 
-        <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16432">JNI 
+        <externallink id="docs/technotes/guides/jni/spec/types.html#type_signatures">JNI 
             type signature</externallink> 
         and the generic signature of the class.
         For example, <code>java.util.List</code> is <code>"Ljava/util/List;"</code>
@@ -7989,8 +7991,9 @@
 	return the field name via <paramlink id="name_ptr"/> and field signature via
 	<paramlink id="signature_ptr"/>.
 	<p/>
-        Field signatures are defined in the JNI Specification and 
-        are referred to as <code>field descriptors</code> in
+        Field signatures are defined in the
+        <externallink id="docs/technotes/guides/jni/spec/jniTOC.html">JNI Specification</externallink>
+        and are referred to as <code>field descriptors</code> in
         <vmspec chapter="4.3.2"/>.
       </description>
       <origin>jvmdiClone</origin>
@@ -8185,8 +8188,9 @@
 	return the method name via <code>name_ptr</code> and method signature via
 	<code>signature_ptr</code>.
         <p/>
-        Method signatures are defined in the JNI Specification and are 
-        referred to as <code>method descriptors</code> in 
+        Method signatures are defined in the
+        <externallink id="docs/technotes/guides/jni/spec/jniTOC.html">JNI Specification</externallink>
+        and are referred to as <code>method descriptors</code> in 
         <vmspec chapter="4.3.3"/>.
 	Note this is different
 	than method signatures as defined in the <i>Java Language Specification</i>.
@@ -9158,7 +9162,7 @@
       Provides the ability to intercept and resend 
       Java Native Interface (JNI) function calls
       by manipulating the JNI function table.
-      See <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html">JNI
+      See <externallink id="docs/technotes/guides/jni/spec/functions.html">JNI
 	Functions</externallink> in the <i>Java Native Interface Specification</i>.
       <p/>
       The following example illustrates intercepting the 
@@ -10859,7 +10863,7 @@
 	  for a class. The segment is typically a directory or JAR file.
 	  <p/>	  
 	  In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
-	  path to a <externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">
+	  path to a <externallink id="docs/technotes/guides/jar/jar.html">
 	  JAR file</externallink>. The agent should take care that the JAR file does not
           contain any classes or resources other than those to be defined by the bootstrap
           class loader for the purposes of instrumentation.
@@ -10906,8 +10910,8 @@
 	  search path segment to be searched after the system class loader unsuccessfully searches
 	  for a class. The segment is typically a directory or JAR file.
 	  <p/>	  
-	  In the live phase the <paramlink id="segment"/> is a platform-dependent path to a <externallink 
-	  id="http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html">JAR file</externallink> to be
+	  In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
+	  <externallink id="docs/technotes/guides/jar/jar.html">JAR file</externallink> to be
 	  searched after the system class loader unsuccessfully searches for a class. The agent should
           take care that the JAR file does not contain any classes or resources other than those to be
           defined by the system class loader for the purposes of instrumentation.
@@ -13741,7 +13745,8 @@
       <description>
 	Typedef for the JNI function table <code>JNINativeInterface</code>
 	defined in the 
-	<externallink id="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp23720">JNI Specification</externallink>.
+	<externallink id="docs/technotes/guides/jni/spec/functions.html#interface_function_table">
+          JNI Specification</externallink>.
 	The JNI reference implementation defines this with an underscore.
       </description>
     </basetype>
--- a/hotspot/src/share/vm/prims/jvmti.xsl	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/prims/jvmti.xsl	Thu Dec 08 17:03:45 2016 +0100
@@ -1033,6 +1033,10 @@
 <xsl:template match="externallink">
   <a>
     <xsl:attribute name="href">
+      <!-- All external links start from the same prefix -->
+      <xsl:text>http://docs.oracle.com/javase/</xsl:text>
+      <xsl:value-of select="//specification/@majorversion"/>
+      <xsl:text>/</xsl:text>
       <xsl:value-of select="@id"/>
     </xsl:attribute>
     <xsl:value-of select="."/>
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/classLoader.hpp"
 #include "classfile/javaAssertions.hpp"
+#include "classfile/moduleEntry.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "code/codeCacheExtensions.hpp"
@@ -3435,9 +3436,9 @@
   // This check is only required for java.base, all other duplicate module specifications
   // will be checked during module system initialization.  The module system initialization
   // will throw an ExceptionInInitializerError if this situation occurs.
-  if (strcmp(module_name, "java.base") == 0) {
+  if (strcmp(module_name, JAVA_BASE_NAME) == 0) {
     if (*patch_mod_javabase) {
-      vm_exit_during_initialization("Cannot specify java.base more than once to --patch-module");
+      vm_exit_during_initialization("Cannot specify " JAVA_BASE_NAME " more than once to --patch-module");
     } else {
       *patch_mod_javabase = true;
     }
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl	Thu Dec 08 17:03:45 2016 +0100
@@ -119,7 +119,7 @@
 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-fields"/>
 
   void writeEventContent(void) {
-    TraceStream ts(*tty);
+    TraceStream ts;
     ts.print("<xsl:value-of select="@label"/>: [");
 <xsl:apply-templates select="value|structvalue" mode="write-data"/>
     ts.print("]\n");
--- a/hotspot/src/share/vm/trace/traceMacros.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/trace/traceMacros.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -31,13 +31,9 @@
 #define EVENT_THREAD_DESTRUCT(thread)
 #define TRACE_KLASS_CREATION(k, p, t)
 
-#define TRACE_INIT_KLASS_ID(k)
-#define TRACE_REMOVE_KLASS_ID(k)
-#define TRACE_RESTORE_KLASS_ID(k)
-
-#define TRACE_INIT_MODULE_ID(m)
-#define TRACE_INIT_PACKAGE_ID(p)
-#define TRACE_INIT_THREAD_ID(td)
+#define TRACE_INIT_ID(k)
+#define TRACE_REMOVE_ID(k)
+#define TRACE_RESTORE_ID(k)
 #define TRACE_DATA TraceThreadData
 
 #define THREAD_TRACE_ID(thread) ((traceid)thread->osthread()->thread_id())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/trace/traceStream.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2016, 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 "trace/traceStream.hpp"
+#if INCLUDE_TRACE
+#include "classfile/classLoaderData.hpp"
+#include "classfile/javaClasses.inline.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/klass.hpp"
+#include "oops/method.hpp"
+#include "oops/symbol.hpp"
+
+void TraceStream::print_val(const char* label, const Klass* val) const {
+  ResourceMark rm;
+  const char* description = "NULL";
+  if (val != NULL) {
+    const Symbol* name = val->name();
+    if (name != NULL) {
+      description = name->as_C_string();
+    }
+  }
+  tty->print("%s = %s", label, description);
+}
+
+void TraceStream::print_val(const char* label, const Method* val) const {
+  ResourceMark rm;
+  const char* description = "NULL";
+  if (val != NULL) {
+    description = val->name_and_sig_as_C_string();
+  }
+  tty->print("%s = %s", label, description);
+}
+
+void TraceStream::print_val(const char* label, const ClassLoaderData* cld) const {
+  ResourceMark rm;
+  if (cld == NULL || cld->is_anonymous()) {
+    tty->print("%s = NULL", label);
+    return;
+  }
+  const char* class_loader_name = "NULL";
+  const char* class_loader_type_name = "NULL";
+  const oop class_loader_oop = cld->class_loader();
+
+  if (class_loader_oop != NULL) {
+    const Klass* k = class_loader_oop->klass();
+    assert(k != NULL, "invariant");
+    const Symbol* klass_name_sym = k->name();
+    if (klass_name_sym != NULL) {
+      class_loader_type_name = klass_name_sym->as_C_string();
+    }
+    const oop class_loader_name_oop =
+      java_lang_ClassLoader::name(class_loader_oop);
+    if (class_loader_name_oop != NULL) {
+      const char* class_loader_name_from_oop =
+        java_lang_String::as_utf8_string(class_loader_name_oop);
+      if (class_loader_name_from_oop != NULL &&
+            class_loader_name_from_oop[0] != '\0') {
+        class_loader_name = class_loader_name_from_oop;
+      }
+    }
+  } else {
+    assert(class_loader_oop == NULL, "invariant");
+    // anonymous CLDs are excluded, this would be the boot loader
+    class_loader_name = "boot";
+  }
+  tty->print("%s = name=%s class=%s", label, class_loader_name, class_loader_type_name);
+}
+
+#endif // INCLUDE_TRACE
--- a/hotspot/src/share/vm/trace/traceStream.hpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/trace/traceStream.hpp	Thu Dec 08 17:03:45 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, 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
@@ -27,87 +27,71 @@
 
 #include "utilities/macros.hpp"
 #if INCLUDE_TRACE
-#include "memory/resourceArea.hpp"
-#include "oops/klass.hpp"
-#include "oops/method.hpp"
-#include "oops/symbol.hpp"
+#include "memory/allocation.hpp"
+#include "utilities/debug.hpp"
 #include "utilities/ostream.hpp"
 
+class ClassLoaderData;
+class Klass;
+class Method;
+
 class TraceStream : public StackObj {
- private:
-  outputStream& _st;
-
  public:
-  TraceStream(outputStream& stream): _st(stream) {}
-
-  void print_val(const char* label, u1 val) {
-    _st.print("%s = " UINT32_FORMAT, label, val);
+  TraceStream() {
+    assert(tty != NULL, "invariant");
   }
 
-  void print_val(const char* label, u2 val) {
-    _st.print("%s = " UINT32_FORMAT, label, val);
+  void print(const char* val) const {
+    tty->print("%s", val);
   }
 
-  void print_val(const char* label, s2 val) {
-    _st.print("%s = " INT32_FORMAT, label, val);
+  void print_val(const char* label, u1 val) const {
+    tty->print("%s = " UINT32_FORMAT, label, val);
   }
 
-  void print_val(const char* label, u4 val) {
-    _st.print("%s = " UINT32_FORMAT, label, val);
+  void print_val(const char* label, u2 val) const {
+    tty->print("%s = " UINT32_FORMAT, label, val);
   }
 
-  void print_val(const char* label, s4 val) {
-    _st.print("%s = " INT32_FORMAT, label, val);
+  void print_val(const char* label, s2 val) const {
+    tty->print("%s = " INT32_FORMAT, label, val);
   }
 
-  void print_val(const char* label, u8 val) {
-    _st.print("%s = " UINT64_FORMAT, label, val);
+  void print_val(const char* label, u4 val) const {
+    tty->print("%s = " UINT32_FORMAT, label, val);
   }
 
-  void print_val(const char* label, s8 val) {
-    _st.print("%s = " INT64_FORMAT, label, (int64_t) val);
+  void print_val(const char* label, s4 val) const {
+    tty->print("%s = " INT32_FORMAT, label, val);
   }
 
-  void print_val(const char* label, bool val) {
-    _st.print("%s = %s", label, val ? "true" : "false");
+  void print_val(const char* label, u8 val) const {
+    tty->print("%s = " UINT64_FORMAT, label, val);
   }
 
-  void print_val(const char* label, float val) {
-    _st.print("%s = %f", label, val);
+  void print_val(const char* label, s8 val) const {
+    tty->print("%s = " INT64_FORMAT, label, (int64_t) val);
   }
 
-  void print_val(const char* label, double val) {
-    _st.print("%s = %f", label, val);
+  void print_val(const char* label, bool val) const {
+    tty->print("%s = %s", label, val ? "true" : "false");
   }
 
-  void print_val(const char* label, const Klass* const val) {
-    ResourceMark rm;
-    const char* description = "NULL";
-    if (val != NULL) {
-      Symbol* name = val->name();
-      if (name != NULL) {
-        description = name->as_C_string();
-      }
-    }
-    _st.print("%s = %s", label, description);
+  void print_val(const char* label, float val) const {
+    tty->print("%s = %f", label, val);
   }
 
-  void print_val(const char* label, const Method* const val) {
-    ResourceMark rm;
-    const char* description = "NULL";
-    if (val != NULL) {
-      description = val->name_and_sig_as_C_string();
-    }
-    _st.print("%s = %s", label, description);
+  void print_val(const char* label, double val) const {
+    tty->print("%s = %f", label, val);
   }
 
-  void print_val(const char* label, const char* val) {
-    _st.print("%s = '%s'", label, val);
+  void print_val(const char* label, const char* val) const {
+    tty->print("%s = '%s'", label, val);
   }
 
-  void print(const char* val) {
-    _st.print("%s", val);
-  }
+  void print_val(const char* label, const Klass* val) const;
+  void print_val(const char* label, const Method* val) const ;
+  void print_val(const char* label, const ClassLoaderData* cld) const;
 };
 
 #endif // INCLUDE_TRACE
--- a/hotspot/src/share/vm/trace/traceevents.xml	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/trace/traceevents.xml	Thu Dec 08 17:03:45 2016 +0100
@@ -113,20 +113,20 @@
   <event id="ClassLoad" path="vm/class/load" label="Class Load"
          has_thread="true" has_stacktrace="true" is_instant="false">
     <value type="CLASS" field="loadedClass" label="Loaded Class"/>
-    <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
-    <value type="CLASS" field="initiatingClassLoader" label="Initiating Class Loader"/>
+    <value type="CLASSLOADER" field="definingClassLoader" label="Defining Class Loader"/>
+    <value type="CLASSLOADER" field="initiatingClassLoader" label="Initiating Class Loader"/>
   </event>
 
   <event id="ClassDefine" path="vm/class/define" label="Class Define"
          has_thread="true" has_stacktrace="true" is_instant="true">
     <value type="CLASS" field="definedClass" label="Defined Class"/>
-    <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
+    <value type="CLASSLOADER" field="definingClassLoader" label="Defining Class Loader"/>
   </event>
 
   <event id="ClassUnload" path="vm/class/unload" label="Class Unload"
          has_thread="true" is_instant="true">
     <value type="CLASS" field="unloadedClass" label="Unloaded Class"/>
-    <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
+    <value type="CLASSLOADER" field="definingClassLoader" label="Defining Class Loader"/>
   </event>
 
   <event id="IntFlagChanged" path="vm/flag/int_changed" label="Int Flag Changed"
@@ -229,7 +229,7 @@
   </event>
 
   <event id="MetaspaceAllocationFailure" path="vm/gc/metaspace/allocation_failure" label="Metaspace Allocation Failure" is_instant="true" has_stacktrace="true">
-    <value type="CLASS" field="classLoader" label="Class Loader" />
+    <value type="CLASSLOADER" field="classLoader" label="Class Loader" />
     <value type="BOOLEAN" field="anonymousClassLoader" label="Anonymous Class Loader" />
     <value type="BYTES64" field="size" label="Size" />
     <value type="METADATATYPE" field="metadataType" label="Metadata Type" />
@@ -237,7 +237,7 @@
   </event>
 
   <event id="MetaspaceOOM" path="vm/gc/metaspace/out_of_memory" label="Metaspace Out of Memory" is_instant="true" has_stacktrace="true">
-    <value type="CLASS" field="classLoader" label="Class Loader" />
+    <value type="CLASSLOADER" field="classLoader" label="Class Loader" />
     <value type="BOOLEAN" field="anonymousClassLoader" label="Anonymous Class Loader" />
     <value type="BYTES64" field="size" label="Size" />
     <value type="METADATATYPE" field="metadataType" label="Metadata Type" />
--- a/hotspot/src/share/vm/trace/tracetypes.xml	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/trace/tracetypes.xml	Thu Dec 08 17:03:45 2016 +0100
@@ -68,21 +68,27 @@
       <value type="THREADGROUP" field="group" label="Java Thread Group"/>
     </content_type>
 
-    <content_type id="ThreadGroup" hr_name="Thread group"
+    <content_type id="ThreadGroup" hr_name="Thread Group"
                   type="U8" jvm_type="THREADGROUP">
       <value type="THREADGROUP" field="parent" label="Parent"/>
       <value type="STRING" field="name" label="Name"/>
     </content_type>
 
-    <content_type id="Class" hr_name="Java class"
+    <content_type id="Class" hr_name="Java Class"
                   type="U8" builtin_type="CLASS">
-      <value type="CLASS" field="classLoaderType" label="Class Loader"/>
+      <value type="CLASSLOADER" field="classLoader" label="Class Loader"/>
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="PACKAGE" field="package" label="Package"/>
       <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
     </content_type>
 
-    <content_type id="Method" hr_name="Java method"
+    <content_type id="ClassLoader" hr_name="Java Class Loader"
+                  type="U8" jvm_type="CLASSLOADER">
+      <value type="CLASS" field="type" label="Type"/>
+      <value type="SYMBOL" field="name" label="Name"/>
+    </content_type>
+
+    <content_type id="Method" hr_name="Java Method"
                   type="U8" jvm_type="METHOD">
       <value type="CLASS" field="type" label="Type"/>
       <value type="SYMBOL" field="name" label="Name"/>
@@ -126,7 +132,7 @@
       <value type="STRING" field="type" label="Type" />
     </content_type>
 
-    <content_type id="GCThresholdUpdater" hr_name="GC Treshold Updater"
+    <content_type id="GCThresholdUpdater" hr_name="GC Threshold Updater"
                   type="U8" jvm_type="GCTHRESHOLDUPDATER">
       <value type="STRING" field="updater" label="Updater" />
     </content_type>
@@ -146,7 +152,7 @@
       <value type="STRING" field="type" label="Type" />
     </content_type>
 
-    <content_type id="NarrowOopMode" hr_name="Narrow oop Mode"
+    <content_type id="NarrowOopMode" hr_name="Narrow Oop Mode"
                   type="U8" jvm_type="NARROWOOPMODE">
       <value type="STRING" field="mode" label="Mode" />
     </content_type>
@@ -181,7 +187,7 @@
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="SYMBOL" field="version" label="Version"/>
       <value type="SYMBOL" field="location" label="Location"/>
-      <value type="CLASS" field="classLoader" label="Class Loader"/>
+      <value type="CLASSLOADER" field="classLoader" label="Class Loader"/>
     </content_type>
 
     <content_type id="Package" hr_name="Package"
@@ -303,6 +309,9 @@
     <primary_type symbol="CLASS" datatype="U8" contenttype="CLASS"
                   type="const Klass*" sizeop="sizeof(u8)"/>
 
+    <primary_type symbol="CLASSLOADER" datatype="U8" contenttype="CLASSLOADER"
+              type="const ClassLoaderData*" sizeop="sizeof(u8)"/>
+
     <primary_type symbol="MODULE" datatype="U8" contenttype="MODULE"
                   type="const ModuleEntry*" sizeop="sizeof(u8)"/>
 
--- a/hotspot/src/share/vm/utilities/globalDefinitions.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -368,93 +368,3 @@
 
 STATIC_ASSERT(left_n_bits(3)   == (intptr_t) LP64_ONLY(0xE000000000000000) NOT_LP64(0xE0000000));
 STATIC_ASSERT(left_n_bits(1|2) == (intptr_t) LP64_ONLY(0xE000000000000000) NOT_LP64(0xE0000000));
-
-
-#ifndef PRODUCT
-// For unit testing only
-class TestGlobalDefinitions {
-private:
-
-  static void test_clamp_address_in_page() {
-    intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 };
-    const int num_page_sizes = sizeof(page_sizes) / sizeof(page_sizes[0]);
-
-    for (int i = 0; i < num_page_sizes; i++) {
-      intptr_t page_size = page_sizes[i];
-
-      address a_page = (address)(10*page_size);
-
-      // Check that address within page is returned as is
-      assert(clamp_address_in_page(a_page, a_page, page_size) == a_page, "incorrect");
-      assert(clamp_address_in_page(a_page + 128, a_page, page_size) == a_page + 128, "incorrect");
-      assert(clamp_address_in_page(a_page + page_size - 1, a_page, page_size) == a_page + page_size - 1, "incorrect");
-
-      // Check that address above page returns start of next page
-      assert(clamp_address_in_page(a_page + page_size, a_page, page_size) == a_page + page_size, "incorrect");
-      assert(clamp_address_in_page(a_page + page_size + 1, a_page, page_size) == a_page + page_size, "incorrect");
-      assert(clamp_address_in_page(a_page + page_size*5 + 1, a_page, page_size) == a_page + page_size, "incorrect");
-
-      // Check that address below page returns start of page
-      assert(clamp_address_in_page(a_page - 1, a_page, page_size) == a_page, "incorrect");
-      assert(clamp_address_in_page(a_page - 2*page_size - 1, a_page, page_size) == a_page, "incorrect");
-      assert(clamp_address_in_page(a_page - 5*page_size - 1, a_page, page_size) == a_page, "incorrect");
-    }
-  }
-
-  static void test_exact_unit_for_byte_size() {
-    assert(strcmp(exact_unit_for_byte_size(0),     "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(1),     "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(K - 1), "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(K),     "K") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(K + 1), "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(M - 1), "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(M),     "M") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(M + 1), "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(M + K), "K") == 0, "incorrect");
-#ifdef LP64
-    assert(strcmp(exact_unit_for_byte_size(G - 1),     "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(G),         "G") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(G + 1),     "B") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(G + K),     "K") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(G + M),     "M") == 0, "incorrect");
-    assert(strcmp(exact_unit_for_byte_size(G + M + K), "K") == 0, "incorrect");
-#endif
-  }
-
-  static void test_byte_size_in_exact_unit() {
-    assert(byte_size_in_exact_unit(0)     == 0,     "incorrect");
-    assert(byte_size_in_exact_unit(1)     == 1,     "incorrect");
-    assert(byte_size_in_exact_unit(K - 1) == K - 1, "incorrect");
-    assert(byte_size_in_exact_unit(K)     == 1,     "incorrect");
-    assert(byte_size_in_exact_unit(K + 1) == K + 1, "incorrect");
-    assert(byte_size_in_exact_unit(M - 1) == M - 1, "incorrect");
-    assert(byte_size_in_exact_unit(M)     == 1,     "incorrect");
-    assert(byte_size_in_exact_unit(M + 1) == M + 1, "incorrect");
-    assert(byte_size_in_exact_unit(M + K) == K + 1, "incorrect");
-#ifdef LP64
-    assert(byte_size_in_exact_unit(G - 1)     == G - 1,     "incorrect");
-    assert(byte_size_in_exact_unit(G)         == 1,         "incorrect");
-    assert(byte_size_in_exact_unit(G + 1)     == G + 1,     "incorrect");
-    assert(byte_size_in_exact_unit(G + K)     == M + 1,     "incorrect");
-    assert(byte_size_in_exact_unit(G + M)     == K + 1,     "incorrect");
-    assert(byte_size_in_exact_unit(G + M + K) == M + K + 1, "incorrect");
-#endif
-  }
-
-  static void test_exact_units() {
-    test_exact_unit_for_byte_size();
-    test_byte_size_in_exact_unit();
-  }
-
-public:
-  static void test() {
-    test_clamp_address_in_page();
-    test_exact_units();
-  }
-};
-
-void TestGlobalDefinitions_test() {
-  TestGlobalDefinitions::test();
-}
-
-#endif // PRODUCT
--- a/hotspot/src/share/vm/utilities/internalVMTests.cpp	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/src/share/vm/utilities/internalVMTests.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -46,17 +46,12 @@
   run_unit_test(TestVirtualSpace_test);
   run_unit_test(TestMetaspaceAux_test);
   run_unit_test(TestVirtualSpaceNode_test);
-  run_unit_test(TestGlobalDefinitions_test);
   run_unit_test(GCTimer_test);
   run_unit_test(ObjectMonitor_test);
   run_unit_test(DirectivesParser_test);
 #if INCLUDE_VM_STRUCTS
   run_unit_test(VMStructs_test);
 #endif
-#if INCLUDE_ALL_GCS
-  run_unit_test(TestBufferingOopClosure_test);
-  run_unit_test(ParallelCompact_test);
-#endif
   tty->print_cr("All internal VM tests passed");
 }
 
--- a/hotspot/test/Makefile	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/Makefile	Thu Dec 08 17:03:45 2016 +0100
@@ -95,6 +95,29 @@
 ALT_MAKE ?= closed
 -include $(ALT_MAKE)/Makefile
 
+# Make sure jtreg exists
+$(JTREG): $(JT_HOME)
+
+jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
+	(                                                                    \
+	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
+            export JT_HOME;                                                  \
+            $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
+              $(JTREG_BASIC_OPTIONS)                                         \
+              -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport")  \
+              -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork")    \
+              -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
+              $(JTREG_NATIVE_PATH)                                           \
+              $(JTREG_FAILURE_HANDLER_OPTIONS)                               \
+              $(JTREG_EXCLUSIONS)                                            \
+              $(JTREG_TEST_OPTIONS)                                          \
+              $(TEST_SELECTION)                                              \
+	  ) ;                                                                \
+	  $(BUNDLE_UP_AND_EXIT)                                              \
+	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
+
+PHONY_LIST += jtreg_tests
+
 # flags used to execute java in test targets
 TEST_FLAGS += -version -Xinternalversion -X -help
 
@@ -118,13 +141,8 @@
 # Set up the directory in which the jvm directories live (client/, server/, etc.)
 ifeq ($(PLATFORM),windows)
 JVMS_DIR := $(PRODUCT_HOME)/bin
-else ifeq ($(PLATFORM),bsd)
+else
 JVMS_DIR := $(PRODUCT_HOME)/lib
-else
-# The jvms live in the architecture directory (amd64, sparcv9,
-# etc.). By using a wildcard there's no need to figure out the exact
-# name of that directory.
-JVMS_DIR := $(PRODUCT_HOME)/lib/*
 endif
 
 # Use the existance of a directory as a sign that jvm variant is available
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/ProblemList.txt	Thu Dec 08 17:03:45 2016 +0100
@@ -0,0 +1,82 @@
+#
+# Copyright (c) 2016, 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.
+#
+
+#############################################################################
+#
+# List of quarantined tests -- tests that should not be run by default, because
+# they may fail due to known reason. The reason (CR#) must be mandatory specified.
+#
+# List items are testnames followed by labels, all MUST BE commented
+#   as to why they are here and use a label:
+#     generic-all   Problems on all platforms
+#     generic-ARCH  Where ARCH is one of: sparc, sparcv9, x64, i586, etc.
+#     OSNAME-all    Where OSNAME is one of: solaris, linux, windows, macosx, aix
+#     OSNAME-ARCH   Specific on to one OSNAME and ARCH, e.g. solaris-amd64
+#     OSNAME-REV    Specific on to one OSNAME and REV, e.g. solaris-5.8
+#
+# More than one label is allowed but must be on the same line.
+#
+#############################################################################
+
+# :hotspot_compiler
+
+compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
+compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
+compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
+compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
+compiler/startup/SmallCodeCacheStartup.java 8134286 generic-all
+compiler/tiered/LevelTransitionTest.java 8067651 generic-all
+compiler/types/correctness/CorrectnessTest.java 8066173 generic-all
+compiler/types/correctness/OffTest.java 8066173 generic-all
+
+#############################################################################
+
+# :hotspot_gc
+
+gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java 8156755 generic-all
+gc/survivorAlignment/TestPromotionToSurvivor.java 8129886 generic-all
+
+#############################################################################
+
+# :hotspot_runtime
+
+runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
+# This test is disabled since it will stress NMT and timeout during normal testing
+runtime/NMT/MallocStressTest.java 8166548 generic-all
+runtime/SharedArchiveFile/BootAppendTests.java 8150683 generic-all
+runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
+
+#############################################################################
+
+# :hotspot_serviceability
+
+serviceability/dcmd/jvmti/LoadAgentDcmdTest.java 8150318 generic-all
+serviceability/jdwp/AllModulesCommandTest.java 8168478 generic-all
+serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
+
+#############################################################################
+
+# :hotspot_misc
+
+#############################################################################
+
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -28,7 +28,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
- * @ignore 8166554
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -28,7 +28,6 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /
  *
- * @ignore 8140405
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -31,7 +31,6 @@
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *
- * @ignore 8158860
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  *        jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  *        sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -34,7 +34,6 @@
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *
- * @ignore 8163894
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
  * @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java	Thu Dec 08 17:03:45 2016 +0100
@@ -31,7 +31,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
- * @ignore 8134286
  * @run driver compiler.startup.SmallCodeCacheStartup
  */
 
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -28,7 +28,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
- * @ignore 8067651
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -266,4 +265,5 @@
         }
     }
 
-}
\ No newline at end of file
+}
+
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -30,7 +30,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
- * @ignore 8066173
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/types/correctness/OffTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/compiler/types/correctness/OffTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -28,7 +28,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
- * @ignore 8066173
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java	Thu Dec 08 17:03:45 2016 +0100
@@ -52,7 +52,6 @@
  * @library /test/lib /
  * @modules java.management java.base/jdk.internal.misc
  * @build sun.hotspot.WhiteBox
- * @ignore 8156755
  *
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java	Thu Dec 08 17:03:45 2016 +0100
@@ -30,7 +30,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
- * @ignore 8129886
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/gc/g1/test_bufferingOopClosure.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2014, 2016, 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 "gc/g1/bufferingOopClosure.hpp"
+#include "memory/iterator.hpp"
+#include "unittest.hpp"
+
+class BufferingOopClosureTest : public ::testing::Test {
+ public:
+  // Helper class to fake a set of oop*s and narrowOop*s.
+  class FakeRoots {
+   public:
+    // Used for sanity checking of the values passed to the do_oops functions in the test.
+    static const uintptr_t NarrowOopMarker = uintptr_t(1) << (BitsPerWord -1);
+
+    int    _num_narrow;
+    int    _num_full;
+    void** _narrow;
+    void** _full;
+
+    FakeRoots(int num_narrow, int num_full) :
+        _num_narrow(num_narrow),
+        _num_full(num_full),
+        _narrow((void**)::malloc(sizeof(void*) * num_narrow)),
+        _full((void**)::malloc(sizeof(void*) * num_full)) {
+
+      for (int i = 0; i < num_narrow; i++) {
+        _narrow[i] = (void*)(NarrowOopMarker + (uintptr_t)i);
+      }
+      for (int i = 0; i < num_full; i++) {
+        _full[i] = (void*)(uintptr_t)i;
+      }
+    }
+
+    ~FakeRoots() {
+      ::free(_narrow);
+      ::free(_full);
+    }
+
+    void oops_do_narrow_then_full(OopClosure* cl) {
+      for (int i = 0; i < _num_narrow; i++) {
+        cl->do_oop((narrowOop*)_narrow[i]);
+      }
+      for (int i = 0; i < _num_full; i++) {
+        cl->do_oop((oop*)_full[i]);
+      }
+    }
+
+    void oops_do_full_then_narrow(OopClosure* cl) {
+      for (int i = 0; i < _num_full; i++) {
+        cl->do_oop((oop*)_full[i]);
+      }
+      for (int i = 0; i < _num_narrow; i++) {
+        cl->do_oop((narrowOop*)_narrow[i]);
+      }
+    }
+
+    void oops_do_mixed(OopClosure* cl) {
+      int i;
+      for (i = 0; i < _num_full && i < _num_narrow; i++) {
+        cl->do_oop((oop*)_full[i]);
+        cl->do_oop((narrowOop*)_narrow[i]);
+      }
+      for (int j = i; j < _num_full; j++) {
+        cl->do_oop((oop*)_full[i]);
+      }
+      for (int j = i; j < _num_narrow; j++) {
+        cl->do_oop((narrowOop*)_narrow[i]);
+      }
+    }
+
+    static const int MaxOrder = 2;
+
+    void oops_do(OopClosure* cl, int do_oop_order) {
+      switch(do_oop_order) {
+        case 0:
+          oops_do_narrow_then_full(cl);
+          break;
+        case 1:
+          oops_do_full_then_narrow(cl);
+          break;
+        case 2:
+          oops_do_mixed(cl);
+          break;
+        default:
+          oops_do_narrow_then_full(cl);
+          break;
+      }
+    }
+  };
+
+  class CountOopClosure : public OopClosure {
+    int _narrow_oop_count;
+    int _full_oop_count;
+   public:
+    CountOopClosure() : _narrow_oop_count(0), _full_oop_count(0) {}
+    void do_oop(narrowOop* p) {
+      EXPECT_NE(uintptr_t(0), (uintptr_t(p) & FakeRoots::NarrowOopMarker))
+              << "The narrowOop was unexpectedly not marked with the NarrowOopMarker";
+      _narrow_oop_count++;
+    }
+
+    void do_oop(oop* p){
+      EXPECT_EQ(uintptr_t(0), (uintptr_t(p) & FakeRoots::NarrowOopMarker))
+              << "The oop was unexpectedly marked with the NarrowOopMarker";
+      _full_oop_count++;
+    }
+
+    int narrow_oop_count() { return _narrow_oop_count; }
+    int full_oop_count()   { return _full_oop_count; }
+    int all_oop_count()    { return _narrow_oop_count + _full_oop_count; }
+  };
+
+  class DoNothingOopClosure : public OopClosure {
+   public:
+    void do_oop(narrowOop* p) {}
+    void do_oop(oop* p)       {}
+  };
+
+  static void testCount(int num_narrow, int num_full, int do_oop_order) {
+    FakeRoots fr(num_narrow, num_full);
+
+    CountOopClosure coc;
+    BufferingOopClosure boc(&coc);
+
+    fr.oops_do(&boc, do_oop_order);
+
+    boc.done();
+
+    EXPECT_EQ(num_narrow, coc.narrow_oop_count()) << "when running testCount("
+            << num_narrow << ", " << num_full << ", " << do_oop_order << ")";
+
+    EXPECT_EQ(num_full, coc.full_oop_count()) << "when running testCount("
+            << num_narrow << ", " << num_full << ", " << do_oop_order << ")";
+
+    EXPECT_EQ(num_narrow + num_full, coc.all_oop_count()) << "when running testCount("
+            << num_narrow << ", " << num_full << ", " << do_oop_order << ")";
+  }
+
+  static void testIsBufferEmptyOrFull(int num_narrow, int num_full, bool expect_empty, bool expect_full) {
+    FakeRoots fr(num_narrow, num_full);
+
+    DoNothingOopClosure cl;
+    BufferingOopClosure boc(&cl);
+
+    fr.oops_do(&boc, 0);
+
+    EXPECT_EQ(expect_empty, boc.is_buffer_empty())
+            << "when running testIsBufferEmptyOrFull("
+            << num_narrow << ", " << num_full << ", "
+            << expect_empty << ", " << expect_full << ")";
+
+    EXPECT_EQ(expect_full, boc.is_buffer_full())
+            << "when running testIsBufferEmptyOrFull("
+            << num_narrow << ", " << num_full << ", "
+            << expect_empty << ", " << expect_full << ")";
+  }
+
+  static void testEmptyAfterDone(int num_narrow, int num_full) {
+    FakeRoots fr(num_narrow, num_full);
+
+    DoNothingOopClosure cl;
+    BufferingOopClosure boc(&cl);
+
+    fr.oops_do(&boc, 0);
+
+    // Make sure all get processed.
+    boc.done();
+
+    EXPECT_TRUE(boc.is_buffer_empty()) << "Should be empty after call to done()."
+            << " testEmptyAfterDone(" << num_narrow << ", " << num_full << ")";
+  }
+
+  static int get_buffer_length() {
+    return BufferingOopClosure::BufferLength;
+  }
+};
+
+TEST_VM_F(BufferingOopClosureTest, count_test) {
+  int bl = BufferingOopClosureTest::get_buffer_length();
+
+  for (int order = 0; order < FakeRoots::MaxOrder; order++) {
+    testCount(0,      0,      order);
+    testCount(10,     0,      order);
+    testCount(0,      10,     order);
+    testCount(10,     10,     order);
+    testCount(bl,     10,     order);
+    testCount(10,     bl,     order);
+    testCount(bl,     bl,     order);
+    testCount(bl + 1, 10,     order);
+    testCount(10,     bl + 1, order);
+    testCount(bl + 1, bl,     order);
+    testCount(bl,     bl + 1, order);
+    testCount(bl + 1, bl + 1, order);
+  }
+}
+
+TEST_VM_F(BufferingOopClosureTest, buffer_empty_or_full) {
+  int bl = BufferingOopClosureTest::get_buffer_length();
+
+  testIsBufferEmptyOrFull(0,      0,      true,  false);
+  testIsBufferEmptyOrFull(1,      0,      false, false);
+  testIsBufferEmptyOrFull(0,      1,      false, false);
+  testIsBufferEmptyOrFull(1,      1,      false, false);
+  testIsBufferEmptyOrFull(10,     0,      false, false);
+  testIsBufferEmptyOrFull(0,      10,     false, false);
+  testIsBufferEmptyOrFull(10,     10,     false, false);
+  testIsBufferEmptyOrFull(0,      bl,     false, true);
+  testIsBufferEmptyOrFull(bl,     0,      false, true);
+  testIsBufferEmptyOrFull(bl / 2, bl / 2, false, true);
+  testIsBufferEmptyOrFull(bl - 1, 1,      false, true);
+  testIsBufferEmptyOrFull(1,      bl - 1, false, true);
+  // Processed
+  testIsBufferEmptyOrFull(bl + 1, 0,      false, false);
+  testIsBufferEmptyOrFull(bl * 2, 0,      false, true);
+}
+
+TEST_VM_F(BufferingOopClosureTest, empty_after_done) {
+  int bl = BufferingOopClosureTest::get_buffer_length();
+
+  testEmptyAfterDone(0,      0);
+  testEmptyAfterDone(1,      0);
+  testEmptyAfterDone(0,      1);
+  testEmptyAfterDone(1,      1);
+  testEmptyAfterDone(10,     0);
+  testEmptyAfterDone(0,      10);
+  testEmptyAfterDone(10,     10);
+  testEmptyAfterDone(0,      bl);
+  testEmptyAfterDone(bl,     0);
+  testEmptyAfterDone(bl / 2, bl / 2);
+  testEmptyAfterDone(bl - 1, 1);
+  testEmptyAfterDone(1,      bl - 1);
+  // Processed
+  testEmptyAfterDone(bl + 1, 0);
+  testEmptyAfterDone(bl * 2, 0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/gc/parallel/test_psParallelCompact.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2005, 2016, 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 "gc/parallel/psParallelCompact.hpp"
+#include "gc/parallel/psCompactionManager.inline.hpp"
+#include "unittest.hpp"
+
+#ifndef PRODUCT
+
+class PSParallelCompactTest : public ::testing::Test {
+ public:
+  static void print_generic_summary_data(ParallelCompactData& summary_data,
+                                         HeapWord* const beg_addr,
+                                         HeapWord* const end_addr) {
+    PSParallelCompact::print_generic_summary_data(summary_data,
+                                                  beg_addr, end_addr);
+  }
+};
+
+// @requires UseParallelGC
+TEST_VM(PSParallelCompact, print_generic_summary_data) {
+  if (!UseParallelOldGC) {
+    return;
+  }
+  // Check that print_generic_summary_data() does not print the
+  // end region by placing a bad value in the destination of the
+  // end region.  The end region should not be printed because it
+  // corresponds to the space after the end of the heap.
+  ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
+  ParCompactionManager* const vmthread_cm =
+    ParCompactionManager::manager_array(ParallelGCThreads);
+  HeapWord* begin_heap =
+    (HeapWord*) heap->old_gen()->virtual_space()->low_boundary();
+  HeapWord* end_heap =
+    (HeapWord*) heap->young_gen()->virtual_space()->high_boundary();
+
+  PSParallelCompactTest::print_generic_summary_data(PSParallelCompact::summary_data(),
+    begin_heap, end_heap);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/utilities/test_globalDefinitions.cpp	Thu Dec 08 17:03:45 2016 +0100
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2016, 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 "runtime/os.hpp"
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+static ::testing::AssertionResult testPageAddress(
+  const char* expected_addr_expr,
+  const char* addr_expr,
+  const char* page_addr_expr,
+  const char* page_size_expr,
+  const char* actual_addr_expr,
+  address expected_addr,
+  address addr,
+  address page_addr,
+  intptr_t page_size,
+  address actual_addr) {
+  if (expected_addr == actual_addr) {
+    return ::testing::AssertionSuccess();
+  }
+
+  return ::testing::AssertionFailure()
+    << actual_addr_expr << " returned unexpected address " << (void*) actual_addr << std::endl
+    << "Expected " << expected_addr_expr << ": " << (void*) expected_addr << std::endl
+    << "where" << std::endl
+    << addr_expr << ": " << (void*) addr << std::endl
+    << page_addr_expr << ": " << (void*) page_addr << std::endl
+    << page_size_expr << ": " << page_size;
+}
+
+TEST_VM(globalDefinitions, clamp_address_in_page) {
+  const intptr_t page_sizes[] = {os::vm_page_size(), 4096, 8192, 65536, 2 * 1024 * 1024};
+  const int num_page_sizes = sizeof(page_sizes) / sizeof(page_sizes[0]);
+
+  for (int i = 0; i < num_page_sizes; i++) {
+    intptr_t page_size = page_sizes[i];
+    address page_address = (address) (10 * page_size);
+
+    const intptr_t within_page_offsets[] = {0, 128, page_size - 1};
+    const int num_within_page_offsets = sizeof(within_page_offsets) / sizeof(within_page_offsets[0]);
+
+    for (int k = 0; k < num_within_page_offsets; ++k) {
+      address addr = page_address + within_page_offsets[k];
+      address expected_address = addr;
+      EXPECT_PRED_FORMAT5(testPageAddress, expected_address, addr, page_address, page_size,
+                          clamp_address_in_page(addr, page_address, page_size))
+        << "Expect that address within page is returned as is";
+    }
+
+    const intptr_t above_page_offsets[] = {page_size, page_size + 1, 5 * page_size + 1};
+    const int num_above_page_offsets = sizeof(above_page_offsets) / sizeof(above_page_offsets[0]);
+
+    for (int k = 0; k < num_above_page_offsets; ++k) {
+      address addr = page_address + above_page_offsets[k];
+      address expected_address = page_address + page_size;
+      EXPECT_PRED_FORMAT5(testPageAddress, expected_address, addr, page_address, page_size,
+                          clamp_address_in_page(addr, page_address, page_size))
+        << "Expect that address above page returns start of next page";
+    }
+
+    const intptr_t below_page_offsets[] = {1, 2 * page_size + 1, 5 * page_size + 1};
+    const int num_below_page_offsets = sizeof(below_page_offsets) / sizeof(below_page_offsets[0]);
+
+    for (int k = 0; k < num_below_page_offsets; ++k) {
+      address addr = page_address - below_page_offsets[k];
+      address expected_address = page_address;
+      EXPECT_PRED_FORMAT5(testPageAddress, expected_address, addr, page_address, page_size,
+                          clamp_address_in_page(addr, page_address, page_size))
+        << "Expect that address below page returns start of page";
+    }
+  }
+}
+
+TEST(globalDefinitions, exact_unit_for_byte_size) {
+  EXPECT_STREQ("B", exact_unit_for_byte_size(0));
+  EXPECT_STREQ("B", exact_unit_for_byte_size(1));
+  EXPECT_STREQ("B", exact_unit_for_byte_size(K - 1));
+  EXPECT_STREQ("K", exact_unit_for_byte_size(K));
+  EXPECT_STREQ("B", exact_unit_for_byte_size(K + 1));
+  EXPECT_STREQ("B", exact_unit_for_byte_size(M - 1));
+  EXPECT_STREQ("M", exact_unit_for_byte_size(M));
+  EXPECT_STREQ("B", exact_unit_for_byte_size(M + 1));
+  EXPECT_STREQ("K", exact_unit_for_byte_size(M + K));
+#ifdef LP64
+  EXPECT_STREQ("B", exact_unit_for_byte_size(G - 1));
+  EXPECT_STREQ("G", exact_unit_for_byte_size(G));
+  EXPECT_STREQ("B", exact_unit_for_byte_size(G + 1));
+  EXPECT_STREQ("K", exact_unit_for_byte_size(G + K));
+  EXPECT_STREQ("M", exact_unit_for_byte_size(G + M));
+  EXPECT_STREQ("K", exact_unit_for_byte_size(G + M + K));
+#endif
+}
+
+TEST(globalDefinitions, byte_size_in_exact_unit) {
+  EXPECT_EQ(0u, byte_size_in_exact_unit(0));
+  EXPECT_EQ(1u, byte_size_in_exact_unit(1));
+  EXPECT_EQ(K - 1, byte_size_in_exact_unit(K - 1));
+  EXPECT_EQ(1u, byte_size_in_exact_unit(K));
+  EXPECT_EQ(K + 1, byte_size_in_exact_unit(K + 1));
+  EXPECT_EQ(M - 1, byte_size_in_exact_unit(M - 1));
+  EXPECT_EQ(1u, byte_size_in_exact_unit(M));
+  EXPECT_EQ(M + 1, byte_size_in_exact_unit(M + 1));
+  EXPECT_EQ(K + 1, byte_size_in_exact_unit(M + K));
+#ifdef LP64
+  EXPECT_EQ(G - 1, byte_size_in_exact_unit(G - 1));
+  EXPECT_EQ(1u, byte_size_in_exact_unit(G));
+  EXPECT_EQ(G + 1, byte_size_in_exact_unit(G + 1));
+  EXPECT_EQ(M + 1, byte_size_in_exact_unit(G + K));
+  EXPECT_EQ(K + 1, byte_size_in_exact_unit(G + M));
+  EXPECT_EQ(M + K + 1, byte_size_in_exact_unit(G + M + K));
+#endif
+}
--- a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java	Thu Dec 08 17:03:45 2016 +0100
@@ -26,7 +26,6 @@
  * @bug 8022865
  * @summary Tests for different combination of UseCompressedOops options
  * @library /test/lib
- * @ignore 8079353
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @run main UseCompressedOops
--- a/hotspot/test/runtime/NMT/MallocStressTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/runtime/NMT/MallocStressTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -29,7 +29,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
- * @ignore - This test is disabled since it will stress NMT and timeout during normal testing
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocStressTest
  */
--- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Thu Dec 08 17:03:45 2016 +0100
@@ -28,7 +28,6 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @ignore 8150683
  * @compile javax/sound/sampled/MyClass.jasm
  * @compile org/omg/CORBA/Context.jasm
  * @compile nonjdk/myPackage/MyClass.java
--- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Thu Dec 08 17:03:45 2016 +0100
@@ -27,7 +27,6 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @ignore 8154204
  * @run main DefaultUseWithClient
  * @bug 8032224
  */
--- a/hotspot/test/runtime/StackGuardPages/testme.sh	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/runtime/StackGuardPages/testme.sh	Thu Dec 08 17:03:45 2016 +0100
@@ -42,7 +42,7 @@
   exit 0
 fi
 
-LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=.:${TESTJAVA}/lib/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
 
 # Run the test for a java and native overflow
--- a/hotspot/test/runtime/ThreadSignalMask/exeThreadSignalMask.c	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/runtime/ThreadSignalMask/exeThreadSignalMask.c	Thu Dec 08 17:03:45 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -66,7 +66,7 @@
 // method to load the dynamic library libjvm
 void loadJVM() {
   char lib[PATH_MAX];
-  snprintf(lib, sizeof (lib), "%s/lib/sparcv9/server/libjvm.so", path);
+  snprintf(lib, sizeof (lib), "%s/lib/server/libjvm.so", path);
   handle = dlopen(lib, RTLD_LAZY);
   if (!handle) {
     handleError(dlerror(), "2");
--- a/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -43,7 +43,6 @@
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
  * @build SimpleJvmtiAgent
- * @ignore 8150318
  * @run main ClassFileInstaller SimpleJvmtiAgent
  * @run testng LoadAgentDcmdTest
  */
--- a/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java	Thu Dec 08 15:49:29 2016 +0100
+++ b/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java	Thu Dec 08 17:03:45 2016 +0100
@@ -28,7 +28,6 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  *
- * @ignore 8163805
  * @run main/othervm SADebugDTest
  */
 import java.io.File;