Merge
authorminqi
Wed, 03 Dec 2014 20:32:33 -0800
changeset 27883 3179632c8f66
parent 27710 df32fbcd3215 (current diff)
parent 27882 ceece07bef14 (diff)
child 27905 12c6386f6775
Merge
hotspot/src/os/aix/vm/perfMemory_aix.cpp
hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
hotspot/src/os/linux/vm/os_linux.cpp
hotspot/src/os/linux/vm/perfMemory_linux.cpp
hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
hotspot/src/share/vm/classfile/classLoader.cpp
hotspot/src/share/vm/compiler/compileLog.cpp
hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
hotspot/src/share/vm/memory/allocation.cpp
hotspot/src/share/vm/memory/cardTableModRefBS.cpp
hotspot/src/share/vm/memory/cardTableRS.cpp
hotspot/src/share/vm/oops/instanceKlass.cpp
hotspot/src/share/vm/prims/unsafe.cpp
hotspot/src/share/vm/prims/whitebox.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/globals.cpp
hotspot/src/share/vm/runtime/sharedRuntime.cpp
hotspot/src/share/vm/runtime/vmStructs.cpp
hotspot/src/share/vm/utilities/ostream.cpp
hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
--- a/hotspot/make/solaris/makefiles/gcc.make	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/make/solaris/makefiles/gcc.make	Wed Dec 03 20:32:33 2014 -0800
@@ -226,18 +226,8 @@
 # Allow no optimizations.
 DEBUG_CFLAGS=-O0
 
-# Use the stabs format for debugging information (this is the default
-# on gcc-2.91). It's good enough, has all the information about line
-# numbers and local variables, and libjvm.so is only about 16M.
-# Change this back to "-g" if you want the most expressive format.
-# (warning: that could easily inflate libjvm.so to 150M!)
-# Note: The Itanium gcc compiler crashes when using -gstabs.
-DEBUG_CFLAGS/ia64  = -g
-DEBUG_CFLAGS/amd64 = -g
-DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
-ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
-  DEBUG_CFLAGS += -gstabs
-endif
+# Enable debug symbols
+DEBUG_CFLAGS += -g
 
 # Enable bounds checking.
 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
--- a/hotspot/make/solaris/makefiles/sparcWorks.make	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/make/solaris/makefiles/sparcWorks.make	Wed Dec 03 20:32:33 2014 -0800
@@ -496,15 +496,6 @@
   FASTDEBUG_CFLAGS += -xs
 endif
 
-# Special global options for SS12
-ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
-  # There appears to be multiple issues with the new Dwarf2 debug format, so
-  #   we tell the compiler to use the older 'stabs' debug format all the time.
-  #   Note that this needs to be used in optimized compiles too to be 100%.
-  #   This is a workaround for SS12 (5.9) bug 6694600
-  CFLAGS += -xdebugformat=stabs
-endif
-
 # Enable the following CFLAGS additions if you need to compare the
 # built ELF objects.
 #
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -570,10 +570,12 @@
   static uint cores_per_cpu()  {
     uint result = 1;
     if (is_intel()) {
-      if (supports_processor_topology()) {
+      bool supports_topology = supports_processor_topology();
+      if (supports_topology) {
         result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
                  _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
-      } else {
+      }
+      if (!supports_topology || result == 0) {
         result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
       }
     } else if (is_amd()) {
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -571,7 +571,7 @@
   char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
   sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
   Arguments::set_library_path(ld_library_path);
-  FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, ld_library_path);
 
   // Extensions directories.
   sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
@@ -581,7 +581,7 @@
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef DEFAULT_LIBPATH
 #undef EXTENSIONS_DIR
@@ -1307,11 +1307,11 @@
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2013 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -127,7 +127,7 @@
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -279,14 +279,14 @@
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -347,7 +347,7 @@
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -358,7 +358,7 @@
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -382,13 +382,13 @@
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -398,7 +398,7 @@
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -406,15 +406,15 @@
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -481,7 +481,7 @@
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -558,7 +558,7 @@
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -703,11 +703,11 @@
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -723,7 +723,7 @@
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -769,7 +769,7 @@
     remove_file(backing_store_file_name);
     // Don't.. Free heap memory could deadlock os::abort() if it is called
     // from signal handler. OS will reclaim the heap memory.
-    // FREE_C_HEAP_ARRAY(char, backing_store_file_name, mtInternal);
+    // FREE_C_HEAP_ARRAY(char, backing_store_file_name);
     backing_store_file_name = NULL;
   }
 }
@@ -853,9 +853,9 @@
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -871,9 +871,9 @@
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, CHECK);
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -418,7 +418,7 @@
                                                      mtInternal);
     sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
     Arguments::set_library_path(ld_library_path);
-    FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
 
   // Extensions directories.
@@ -429,7 +429,7 @@
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #else // __APPLE__
 
@@ -513,7 +513,7 @@
     sprintf(ld_library_path, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.",
             v, v_colon, l, l_colon, user_home_dir);
     Arguments::set_library_path(ld_library_path);
-    FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
 
   // Extensions directories.
@@ -529,7 +529,7 @@
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef SYS_EXTENSIONS_DIR
 #undef SYS_EXTENSIONS_DIRS
@@ -1315,11 +1315,11 @@
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -127,7 +127,7 @@
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -279,14 +279,14 @@
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -347,7 +347,7 @@
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -358,7 +358,7 @@
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -382,13 +382,13 @@
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -398,7 +398,7 @@
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -406,15 +406,15 @@
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -481,7 +481,7 @@
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -558,7 +558,7 @@
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -725,11 +725,11 @@
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -743,7 +743,7 @@
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -872,9 +872,9 @@
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -890,9 +890,9 @@
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, CHECK);
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -404,7 +404,7 @@
                                                      mtInternal);
     sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
     Arguments::set_library_path(ld_library_path);
-    FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
 
   // Extensions directories.
@@ -415,7 +415,7 @@
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef DEFAULT_LIBPATH
 #undef SYS_EXT_DIR
@@ -1621,11 +1621,11 @@
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -2936,7 +2936,7 @@
       }
     }
   }
-  FREE_C_HEAP_ARRAY(unsigned long, cpu_map, mtInternal);
+  FREE_C_HEAP_ARRAY(unsigned long, cpu_map);
 }
 
 int os::Linux::get_node_by_cpu(int cpu_id) {
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -127,7 +127,7 @@
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -279,14 +279,14 @@
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -347,7 +347,7 @@
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -358,7 +358,7 @@
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -382,13 +382,13 @@
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -398,7 +398,7 @@
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -406,15 +406,15 @@
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -481,7 +481,7 @@
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -558,7 +558,7 @@
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -725,11 +725,11 @@
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -743,7 +743,7 @@
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -872,9 +872,9 @@
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -890,9 +890,9 @@
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, THREAD);
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -506,7 +506,7 @@
     }
   }
   if (available_id != NULL) {
-    FREE_C_HEAP_ARRAY(bool, available_id, mtInternal);
+    FREE_C_HEAP_ARRAY(bool, available_id);
   }
   return true;
 }
@@ -538,7 +538,7 @@
     }
   }
   if (id_array != NULL) {
-    FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal);
+    FREE_C_HEAP_ARRAY(processorid_t, id_array);
   }
   return result;
 }
@@ -675,7 +675,7 @@
 
     // Determine search path count and required buffer size.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf);
       vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
     }
 
@@ -686,8 +686,8 @@
 
     // Obtain search path information.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
-      FREE_C_HEAP_ARRAY(char, info, mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf);
+      FREE_C_HEAP_ARRAY(char, info);
       vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
     }
 
@@ -757,8 +757,8 @@
     // Callee copies into its own buffer.
     Arguments::set_library_path(library_path);
 
-    FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
-    FREE_C_HEAP_ARRAY(char, info, mtInternal);
+    FREE_C_HEAP_ARRAY(char, library_path);
+    FREE_C_HEAP_ARRAY(char, info);
   }
 
   // Extensions directories.
@@ -769,7 +769,7 @@
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef SYS_EXT_DIR
 #undef EXTENSIONS_DIR
@@ -1599,11 +1599,11 @@
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -4681,7 +4681,7 @@
       size_t lgrp_limit = os::numa_get_groups_num();
       int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
       size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
-      FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal);
+      FREE_C_HEAP_ARRAY(int, lgrp_ids);
       if (lgrp_num < 2) {
         // There's only one locality group, disable NUMA.
         UseNUMA = false;
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -129,7 +129,7 @@
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -270,14 +270,14 @@
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -338,7 +338,7 @@
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -349,7 +349,7 @@
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -373,13 +373,13 @@
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -389,7 +389,7 @@
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -397,15 +397,15 @@
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -520,7 +520,7 @@
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -597,7 +597,7 @@
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -742,11 +742,11 @@
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -760,7 +760,7 @@
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -890,9 +890,9 @@
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -908,9 +908,9 @@
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, THREAD);
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -211,7 +211,7 @@
     }
     strcpy(home_path, home_dir);
     Arguments::set_java_home(home_path);
-    FREE_C_HEAP_ARRAY(char, home_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, home_path);
 
     dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
                                 mtInternal);
@@ -221,7 +221,7 @@
     strcpy(dll_path, home_dir);
     strcat(dll_path, bin);
     Arguments::set_dll_dir(dll_path);
-    FREE_C_HEAP_ARRAY(char, dll_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dll_path);
 
     if (!set_boot_path('\\', ';')) {
       return;
@@ -276,7 +276,7 @@
     strcat(library_path, ";.");
 
     Arguments::set_library_path(library_path);
-    FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, library_path);
   }
 
   // Default extensions directory
@@ -301,7 +301,7 @@
     Arguments::set_endorsed_dirs(buf);
     // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
     //  duplicates the input.)
-    FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, buf);
 #undef ENDORSED_DIR
   }
 
@@ -1136,7 +1136,7 @@
 
   dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
   if (dirp->path == 0) {
-    free(dirp, mtInternal);
+    free(dirp);
     errno = ENOMEM;
     return 0;
   }
@@ -1144,13 +1144,13 @@
 
   fattr = GetFileAttributes(dirp->path);
   if (fattr == 0xffffffff) {
-    free(dirp->path, mtInternal);
-    free(dirp, mtInternal);
+    free(dirp->path);
+    free(dirp);
     errno = ENOENT;
     return 0;
   } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
-    free(dirp->path, mtInternal);
-    free(dirp, mtInternal);
+    free(dirp->path);
+    free(dirp);
     errno = ENOTDIR;
     return 0;
   }
@@ -1168,8 +1168,8 @@
   dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
   if (dirp->handle == INVALID_HANDLE_VALUE) {
     if (GetLastError() != ERROR_FILE_NOT_FOUND) {
-      free(dirp->path, mtInternal);
-      free(dirp, mtInternal);
+      free(dirp->path);
+      free(dirp);
       errno = EACCES;
       return 0;
     }
@@ -1207,8 +1207,8 @@
     }
     dirp->handle = INVALID_HANDLE_VALUE;
   }
-  free(dirp->path, mtInternal);
-  free(dirp, mtInternal);
+  free(dirp->path);
+  free(dirp);
   return 0;
 }
 
@@ -1275,11 +1275,11 @@
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
@@ -2745,7 +2745,7 @@
 
   void free_node_list() {
     if (_numa_used_node_list != NULL) {
-      FREE_C_HEAP_ARRAY(int, _numa_used_node_list, mtInternal);
+      FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
     }
   }
 
@@ -3781,8 +3781,8 @@
   return NULL;
 }
 
-#define MAX_EXIT_HANDLES    16
-#define EXIT_TIMEOUT      1000 /* 1 sec */
+#define MAX_EXIT_HANDLES PRODUCT_ONLY(32)   NOT_PRODUCT(128)
+#define EXIT_TIMEOUT     PRODUCT_ONLY(1000) NOT_PRODUCT(4000) /* 1 sec in product, 4 sec in debug */
 
 static BOOL CALLBACK init_crit_sect_call(PINIT_ONCE, PVOID pcrit_sect, PVOID*) {
   InitializeCriticalSection((CRITICAL_SECTION*)pcrit_sect);
@@ -3833,6 +3833,9 @@
         // If there's no free slot in the array of the kept handles, we'll have to
         // wait until at least one thread completes exiting.
         if ((handle_count = j) == MAX_EXIT_HANDLES) {
+          // Raise the priority of the oldest exiting thread to increase its chances
+          // to complete sooner.
+          SetThreadPriority(handles[0], THREAD_PRIORITY_ABOVE_NORMAL);
           res = WaitForMultipleObjects(MAX_EXIT_HANDLES, handles, FALSE, EXIT_TIMEOUT);
           if (res >= WAIT_OBJECT_0 && res < (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
             i = (res - WAIT_OBJECT_0);
@@ -3841,7 +3844,8 @@
               handles[i] = handles[i + 1];
             }
           } else {
-            warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+            warning("WaitForMultipleObjects %s in %s: %d\n",
+                    (res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
             // Don't keep handles, if we failed waiting for them.
             for (i = 0; i < MAX_EXIT_HANDLES; ++i) {
               CloseHandle(handles[i]);
@@ -3867,9 +3871,20 @@
         if (handle_count > 0) {
           // Before ending the process, make sure all the threads that had called
           // _endthreadex() completed.
+
+          // Set the priority level of the current thread to the same value as
+          // the priority level of exiting threads.
+          // This is to ensure it will be given a fair chance to execute if
+          // the timeout expires.
+          hthr = GetCurrentThread();
+          SetThreadPriority(hthr, THREAD_PRIORITY_ABOVE_NORMAL);
+          for (i = 0; i < handle_count; ++i) {
+            SetThreadPriority(handles[i], THREAD_PRIORITY_ABOVE_NORMAL);
+          }
           res = WaitForMultipleObjects(handle_count, handles, TRUE, EXIT_TIMEOUT);
-          if (res == WAIT_FAILED) {
-            warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+          if (res < WAIT_OBJECT_0 || res >= (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
+            warning("WaitForMultipleObjects %s in %s: %d\n",
+                    (res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
           }
           for (i = 0; i < handle_count; ++i) {
             CloseHandle(handles[i]);
@@ -4627,7 +4642,7 @@
 
   error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
   if (error == 0) {
-    os::free(lpBuffer, mtInternal);
+    os::free(lpBuffer);
     return FALSE;
   }
 
@@ -4648,7 +4663,7 @@
   }
 
   if (lpBuffer != NULL) {
-    os::free(lpBuffer, mtInternal);
+    os::free(lpBuffer);
   }
 
   *pbytes = (long) actualLength;
--- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -122,7 +122,7 @@
     }
   }
 
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 // Shared Memory Implementation Details
@@ -335,7 +335,7 @@
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -346,7 +346,7 @@
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -367,13 +367,13 @@
         strcat(filename, udentry->d_name);
 
         if (::stat(filename, &statbuf) == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if ((statbuf.st_mode & S_IFMT) != S_IFREG) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -395,22 +395,22 @@
         if (statbuf.st_ctime > latest_ctime) {
           char* user = strchr(dentry->d_name, '_') + 1;
 
-          if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user, mtInternal);
+          if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
           latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
           strcpy(latest_user, user);
           latest_ctime = statbuf.st_ctime;
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(latest_user);
 }
@@ -502,7 +502,7 @@
     }
   }
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 // returns true if the process represented by pid is alive, otherwise
@@ -683,7 +683,7 @@
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // create a file mapping object with the requested name, and size
@@ -749,11 +749,11 @@
     // be an ACL we enlisted. free the resources.
     //
     if (success && exists && pACL != NULL && !isdefault) {
-      FREE_C_HEAP_ARRAY(char, pACL, mtInternal);
+      FREE_C_HEAP_ARRAY(char, pACL);
     }
 
     // free the security descriptor
-    FREE_C_HEAP_ARRAY(char, pSD, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pSD);
   }
 }
 
@@ -768,7 +768,7 @@
     lpSA->lpSecurityDescriptor = NULL;
 
     // free the security attributes structure
-    FREE_C_HEAP_ARRAY(char, lpSA, mtInternal);
+    FREE_C_HEAP_ARRAY(char, lpSA);
   }
 }
 
@@ -815,7 +815,7 @@
       warning("GetTokenInformation failure: lasterror = %d,"
               " rsize = %d\n", GetLastError(), rsize);
     }
-    FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, token_buf);
     CloseHandle(hAccessToken);
     return NULL;
   }
@@ -828,15 +828,15 @@
       warning("GetTokenInformation failure: lasterror = %d,"
               " rsize = %d\n", GetLastError(), rsize);
     }
-    FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, pSID, mtInternal);
+    FREE_C_HEAP_ARRAY(char, token_buf);
+    FREE_C_HEAP_ARRAY(char, pSID);
     CloseHandle(hAccessToken);
     return NULL;
   }
 
   // close the access token.
   CloseHandle(hAccessToken);
-  FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, token_buf);
 
   return pSID;
 }
@@ -920,7 +920,7 @@
     if (PrintMiscellaneous && Verbose) {
       warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
     }
-    FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+    FREE_C_HEAP_ARRAY(char, newACL);
     return false;
   }
 
@@ -933,7 +933,7 @@
         if (PrintMiscellaneous && Verbose) {
           warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
         }
-        FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+        FREE_C_HEAP_ARRAY(char, newACL);
         return false;
       }
       if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceFlags && INHERITED_ACE) {
@@ -960,7 +960,7 @@
           if (PrintMiscellaneous && Verbose) {
             warning("AddAce failure: lasterror = %d \n", GetLastError());
           }
-          FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+          FREE_C_HEAP_ARRAY(char, newACL);
           return false;
         }
       }
@@ -976,7 +976,7 @@
         warning("AddAccessAllowedAce failure: lasterror = %d \n",
                 GetLastError());
       }
-      FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+      FREE_C_HEAP_ARRAY(char, newACL);
       return false;
     }
   }
@@ -991,7 +991,7 @@
         if (PrintMiscellaneous && Verbose) {
           warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
         }
-        FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+        FREE_C_HEAP_ARRAY(char, newACL);
         return false;
       }
       if (!AddAce(newACL, ACL_REVISION, MAXDWORD, ace,
@@ -999,7 +999,7 @@
         if (PrintMiscellaneous && Verbose) {
           warning("AddAce failure: lasterror = %d \n", GetLastError());
         }
-        FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+        FREE_C_HEAP_ARRAY(char, newACL);
         return false;
       }
       ace_index++;
@@ -1012,7 +1012,7 @@
       warning("SetSecurityDescriptorDacl failure:"
               " lasterror = %d \n", GetLastError());
     }
-    FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+    FREE_C_HEAP_ARRAY(char, newACL);
     return false;
   }
 
@@ -1032,7 +1032,7 @@
         warning("SetSecurityDescriptorControl failure:"
                 " lasterror = %d \n", GetLastError());
       }
-      FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+      FREE_C_HEAP_ARRAY(char, newACL);
       return false;
     }
   }
@@ -1149,7 +1149,7 @@
   // create a security attributes structure with access control
   // entries as initialized above.
   LPSECURITY_ATTRIBUTES lpSA = make_security_attr(aces, 3);
-  FREE_C_HEAP_ARRAY(char, aces[0].pSid, mtInternal);
+  FREE_C_HEAP_ARRAY(char, aces[0].pSid);
   FreeSid(everybodySid);
   FreeSid(administratorsSid);
   return(lpSA);
@@ -1464,15 +1464,15 @@
   assert(((size != 0) && (size % os::vm_page_size() == 0)),
          "unexpected PerfMemry region size");
 
-  FREE_C_HEAP_ARRAY(char, user, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user);
 
   // create the shared memory resources
   sharedmem_fileMapHandle =
                create_sharedmem_resources(dirname, filename, objectname, size);
 
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
-  FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, filename);
+  FREE_C_HEAP_ARRAY(char, objectname);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (sharedmem_fileMapHandle == NULL) {
     return NULL;
@@ -1627,7 +1627,7 @@
   // store file, we also don't following them when attaching
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
   }
@@ -1646,10 +1646,10 @@
   strcpy(robjectname, objectname);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
-  FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
+  FREE_C_HEAP_ARRAY(char, objectname);
 
   if (*sizep == 0) {
     size = sharedmem_filesize(rfilename, CHECK);
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1025,7 +1025,7 @@
 
   ~CodeString() {
     assert(_next == NULL, "wrong interface for freeing list");
-    os::free((void*)_string, mtCode);
+    os::free((void*)_string);
   }
 
   bool is_comment() const { return _offset >= 0; }
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -162,7 +162,7 @@
 
 
 MetaIndex::~MetaIndex() {
-  FREE_C_HEAP_ARRAY(char*, _meta_package_names, mtClass);
+  FREE_C_HEAP_ARRAY(char*, _meta_package_names);
 }
 
 
@@ -248,7 +248,7 @@
   if (ZipClose != NULL) {
     (*ZipClose)(_zip);
   }
-  FREE_C_HEAP_ARRAY(char, _zip_name, mtClass);
+  FREE_C_HEAP_ARRAY(char, _zip_name);
 }
 
 u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) {
--- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -164,7 +164,7 @@
 
         // Purge entry
         *p = probe->next();
-        FREE_C_HEAP_ARRAY(oop, probe->loaders(), mtClass);
+        FREE_C_HEAP_ARRAY(oop, probe->loaders());
         free_entry(probe);
       } else {
 #ifdef ASSERT
@@ -340,7 +340,7 @@
         ClassLoaderData** new_loaders = NEW_C_HEAP_ARRAY(ClassLoaderData*, n, mtClass);
         memcpy(new_loaders, p->loaders(), sizeof(ClassLoaderData*) * p->num_loaders());
         p->set_max_loaders(n);
-        FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders(), mtClass);
+        FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders());
         p->set_loaders(new_loaders);
     }
 }
@@ -422,7 +422,7 @@
   }
 
   *pp2 = p2->next();
-  FREE_C_HEAP_ARRAY(oop, p2->loaders(), mtClass);
+  FREE_C_HEAP_ARRAY(oop, p2->loaders());
   free_entry(p2);
   return;
 }
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -89,7 +89,7 @@
   }
   ~SharedPathsMiscInfo() {
     if (_allocated) {
-      FREE_C_HEAP_ARRAY(char, _buf_start, mtClass);
+      FREE_C_HEAP_ARRAY(char, _buf_start);
     }
   }
   int get_used_bytes() {
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -168,7 +168,7 @@
 
 void CodeBlob::flush() {
   if (_oop_maps) {
-    FREE_C_HEAP_ARRAY(unsigned char, _oop_maps, mtCode);
+    FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
     _oop_maps = NULL;
   }
   _strings.free();
--- a/hotspot/src/share/vm/code/codeCache.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1190,7 +1190,7 @@
     }
   }
 
-  FREE_C_HEAP_ARRAY(int, buckets, mtCode);
+  FREE_C_HEAP_ARRAY(int, buckets);
   print_memory_overhead();
 }
 
--- a/hotspot/src/share/vm/compiler/compileLog.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -58,10 +58,8 @@
 CompileLog::~CompileLog() {
   delete _out; // Close fd in fileStream::~fileStream()
   _out = NULL;
-  // Remove partial file after merging in CompileLog::finish_log_on_error
-  unlink(_file);
-  FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
-  FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
+  FREE_C_HEAP_ARRAY(char, _identities);
+  FREE_C_HEAP_ARRAY(char, _file);
 }
 
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -650,15 +650,15 @@
         || _cursor == NULL) {
       warning("Failed to allocate survivor plab/chunk array");
       if (_survivor_plab_array  != NULL) {
-        FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
+        FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
         _survivor_plab_array = NULL;
       }
       if (_survivor_chunk_array != NULL) {
-        FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
+        FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
         _survivor_chunk_array = NULL;
       }
       if (_cursor != NULL) {
-        FREE_C_HEAP_ARRAY(size_t, _cursor, mtGC);
+        FREE_C_HEAP_ARRAY(size_t, _cursor);
         _cursor = NULL;
       }
     } else {
@@ -668,10 +668,10 @@
         if (vec == NULL) {
           warning("Failed to allocate survivor plab array");
           for (int j = i; j > 0; j--) {
-            FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array(), mtGC);
+            FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array());
           }
-          FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
-          FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
+          FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
+          FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
           _survivor_plab_array = NULL;
           _survivor_chunk_array = NULL;
           _survivor_chunk_capacity = 0;
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,7 +107,7 @@
     for (uint i = 0; i < _n_threads; i++) {
       delete _threads[i];
     }
-    FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC);
+    FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -111,13 +111,13 @@
       // read next before freeing.
       e = e->next();
       unlink_entry(to_remove);
-      FREE_C_HEAP_ARRAY(char, to_remove, mtGC);
+      FREE_C_HEAP_ARRAY(char, to_remove);
     }
   }
   assert(number_of_entries() == 0, "should have removed all entries");
   free_buckets();
   for (BasicHashtableEntry<mtGC>* e = new_entry_free_list(); e != NULL; e = new_entry_free_list()) {
-    FREE_C_HEAP_ARRAY(char, e, mtGC);
+    FREE_C_HEAP_ARRAY(char, e);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -3561,7 +3561,7 @@
 void
 G1CollectedHeap::cleanup_surviving_young_words() {
   guarantee( _surviving_young_words != NULL, "pre-condition" );
-  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words, mtGC);
+  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
   _surviving_young_words = NULL;
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -53,7 +53,7 @@
   }
 
   ~WorkerDataArray() {
-    FREE_C_HEAP_ARRAY(T, _data, mtGC);
+    FREE_C_HEAP_ARRAY(T, _data);
   }
 
   void set(uint worker_i, T value) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
 G1HotCardCache::~G1HotCardCache() {
   if (default_use_cache()) {
     assert(_hot_cache != NULL, "Logic");
-    FREE_C_HEAP_ARRAY(jbyte*, _hot_cache, mtGC);
+    FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -65,7 +65,7 @@
 G1ParScanThreadState::~G1ParScanThreadState() {
   _g1_par_allocator->retire_alloc_buffers();
   delete _g1_par_allocator;
-  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC);
+  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
 }
 
 void
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -94,7 +94,7 @@
   for (uint i = 0; i < n_workers(); i++) {
     assert(_cset_rs_update_cl[i] == NULL, "it should be");
   }
-  FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
+  FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl);
 }
 
 class ScanRSClosure : public HeapRegionClosure {
@@ -353,7 +353,7 @@
   for (uint i = 0; i < n_workers(); ++i) {
     _total_cards_scanned += _cards_scanned[i];
   }
-  FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC);
+  FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
   _cards_scanned = NULL;
   // Cleanup after copy
   _g1->set_refine_cte_cl_concurrency(true);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
 
   void free_and_null() {
     if (_rs_threads_vtimes) {
-      FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes, mtGC);
+      FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
       _rs_threads_vtimes = NULL;
       _num_vtimes = 0;
     }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -187,7 +187,7 @@
 }
 
 G1StringDedupTable::~G1StringDedupTable() {
-  FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets, mtGC);
+  FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets);
 }
 
 void G1StringDedupTable::create() {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -449,7 +449,7 @@
 
 HeapRegionClaimer::~HeapRegionClaimer() {
   if (_claims != NULL) {
-    FREE_C_HEAP_ARRAY(uint, _claims, mtGC);
+    FREE_C_HEAP_ARRAY(uint, _claims);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -449,5 +449,5 @@
 
   bot_storage->uncommit_regions(0, num_regions_in_test);
   delete bot_storage;
-  FREE_C_HEAP_ARRAY(HeapWord, bot_data, mtGC);
+  FREE_C_HEAP_ARRAY(HeapWord, bot_data);
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,7 +129,7 @@
     assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong.");
     void* b = BufferNode::make_block_from_node(_buf_free_list);
     _buf_free_list = _buf_free_list->next();
-    FREE_C_HEAP_ARRAY(char, b, mtGC);
+    FREE_C_HEAP_ARRAY(char, b);
     _buf_free_list_sz --;
     n--;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -154,11 +154,11 @@
 
 RSHashTable::~RSHashTable() {
   if (_entries != NULL) {
-    FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries, mtGC);
+    FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
     _entries = NULL;
   }
   if (_buckets != NULL) {
-    FREE_C_HEAP_ARRAY(int, _buckets, mtGC);
+    FREE_C_HEAP_ARRAY(int, _buckets);
     _buckets = NULL;
   }
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -106,13 +106,13 @@
     _stats_arrays_length = _region_num;
 
     if (old_surv_rate != NULL) {
-      FREE_C_HEAP_ARRAY(double, old_surv_rate, mtGC);
+      FREE_C_HEAP_ARRAY(double, old_surv_rate);
     }
     if (old_accum_surv_rate_pred != NULL) {
-      FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred, mtGC);
+      FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
     }
     if (old_surv_rate_pred != NULL) {
-      FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred, mtGC);
+      FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
     }
   }
 
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -462,7 +462,7 @@
         if (_lowest_non_clean[i] != NULL) {
           assert(n_chunks != _lowest_non_clean_chunk_size[i],
                  "logical consequence");
-          FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i], mtGC);
+          FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i]);
           _lowest_non_clean[i] = NULL;
         }
         // Now allocate a new one if necessary.
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1609,7 +1609,7 @@
       // This can become a scaling bottleneck when there is work queue overflow coincident
       // with promotion failure.
       oopDesc* f = cur;
-      FREE_C_HEAP_ARRAY(oopDesc, f, mtGC);
+      FREE_C_HEAP_ARRAY(oopDesc, f);
     } else if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) {
       assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
       obj_to_push = cur;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -429,7 +429,7 @@
       }
       tty->cr();
     }
-    FREE_C_HEAP_ARRAY(uint, processor_assignment, mtGC);
+    FREE_C_HEAP_ARRAY(uint, processor_assignment);
   }
   reset_busy_workers();
   set_unblocked();
@@ -458,11 +458,11 @@
       GCTaskThread::destroy(thread(i));
       set_thread(i, NULL);
     }
-    FREE_C_HEAP_ARRAY(GCTaskThread*, _thread, mtGC);
+    FREE_C_HEAP_ARRAY(GCTaskThread*, _thread);
     _thread = NULL;
   }
   if (_resource_flag != NULL) {
-    FREE_C_HEAP_ARRAY(bool, _resource_flag, mtGC);
+    FREE_C_HEAP_ARRAY(bool, _resource_flag);
     _resource_flag = NULL;
   }
   if (queue() != NULL) {
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -58,7 +58,7 @@
 
 GCTaskThread::~GCTaskThread() {
   if (_time_stamps != NULL) {
-    FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps, mtGC);
+    FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
                  ContiguousSpace* s, GenerationCounters* gc);
 
   ~CSpaceCounters() {
-      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtInternal);
+      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   virtual inline void update_capacity() {
--- a/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
     CollectorCounters(const char* name, int ordinal);
 
     ~CollectorCounters() {
-      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
     }
 
     inline PerfCounter* invocation_counter() const  { return _invocations; }
--- a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
                  GenerationCounters* gc, bool sampled=true);
 
   ~GSpaceCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   inline void update_capacity() {
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
                      size_t min_capacity, size_t max_capacity, VirtualSpace* v);
 
   ~GenerationCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   virtual void update_all();
--- a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
                  size_t initial_capacity, GenerationCounters* gc);
 
   ~HSpaceCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   inline void update_capacity(size_t v) {
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -276,7 +276,7 @@
       }
     }
 
-    FREE_C_HEAP_ARRAY(int, lgrp_ids, mtGC);
+    FREE_C_HEAP_ARRAY(int, lgrp_ids);
 
     if (changed) {
       for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
                 MutableSpace* m, GenerationCounters* gc);
 
   ~SpaceCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   inline void update_capacity() {
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -334,7 +334,7 @@
   if (mask_size() > small_mask_limit && _bit_mask[0] != 0) {
     assert(!Thread::current()->resource_area()->contains((void*)_bit_mask[0]),
       "This bit mask should not be in the resource area");
-    FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0], mtClass);
+    FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0]);
     debug_only(_bit_mask[0] = 0;)
   }
 }
@@ -492,7 +492,7 @@
   flush();
   // Deallocate array
   NOT_PRODUCT(_total_memory_usage -= sizeof(OopMapCache) + (sizeof(OopMapCacheEntry) * _size);)
-  FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array, mtClass);
+  FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array);
 }
 
 OopMapCacheEntry* OopMapCache::entry_at(int i) const {
@@ -603,5 +603,5 @@
   tmp->initialize();
   tmp->fill(method, bci);
   entry->resource_copy(tmp);
-  FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp, mtInternal);
+  FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp);
 }
--- a/hotspot/src/share/vm/memory/allocation.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -296,7 +296,7 @@
     // to avoid deadlock with NMT
         while(cur != NULL) {
           next = cur->next();
-      os::free(cur, mtChunk);
+      os::free(cur);
           cur = next;
         }
       }
@@ -384,7 +384,7 @@
    case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
    case Chunk::init_size:   ChunkPool::small_pool()->free(c); break;
    case Chunk::tiny_size:   ChunkPool::tiny_pool()->free(c); break;
-   default:                 os::free(c, mtChunk);
+   default:                 os::free(c);
   }
 }
 
--- a/hotspot/src/share/vm/memory/allocation.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/allocation.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -101,7 +101,7 @@
 //   NEW_RESOURCE_OBJ(type)
 //   NEW_C_HEAP_ARRAY(type, size)
 //   NEW_C_HEAP_OBJ(type, memflags)
-//   FREE_C_HEAP_ARRAY(type, old, memflags)
+//   FREE_C_HEAP_ARRAY(type, old)
 //   FREE_C_HEAP_OBJ(objname, type, memflags)
 //   char* AllocateHeap(size_t size, const char* name);
 //   void  FreeHeap(void* p);
@@ -669,8 +669,8 @@
 #define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\
   (type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL))
 
-#define FREE_C_HEAP_ARRAY(type, old, memflags) \
-  FreeHeap((char*)(old), memflags)
+#define FREE_C_HEAP_ARRAY(type, old) \
+  FreeHeap((char*)(old))
 
 // allocate type in heap without calling ctor
 #define NEW_C_HEAP_OBJ(type, memflags)\
@@ -680,8 +680,8 @@
   NEW_C_HEAP_ARRAY_RETURN_NULL(type, 1, memflags)
 
 // deallocate obj of type in heap without calling dtor
-#define FREE_C_HEAP_OBJ(objname, memflags)\
-  FreeHeap((char*)objname, memflags);
+#define FREE_C_HEAP_OBJ(objname)\
+  FreeHeap((char*)objname);
 
 // for statistics
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -79,11 +79,11 @@
   return p;
 }
 
-inline void FreeHeap(void* p, MEMFLAGS memflags = mtInternal) {
+inline void FreeHeap(void* p) {
   #ifdef ASSERT
   if (PrintMallocFree) trace_heap_free(p);
   #endif
-  os::free(p, memflags);
+  os::free(p);
 }
 
 
@@ -136,11 +136,11 @@
 }
 
 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
-    FreeHeap(p, F);
+    FreeHeap(p);
 }
 
 template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){
-    FreeHeap(p, F);
+    FreeHeap(p);
 }
 
 template <class E, MEMFLAGS F>
@@ -199,7 +199,7 @@
 void ArrayAllocator<E, F>::free() {
   if (_addr != NULL) {
     if (_use_malloc) {
-      FreeHeap(_addr, F);
+      FreeHeap(_addr);
     } else {
       os::release_memory(_addr, _size);
     }
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -171,19 +171,19 @@
     _committed = NULL;
   }
   if (_lowest_non_clean) {
-    FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC);
+    FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
     _lowest_non_clean = NULL;
   }
   if (_lowest_non_clean_chunk_size) {
-    FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC);
+    FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
     _lowest_non_clean_chunk_size = NULL;
   }
   if (_lowest_non_clean_base_chunk_index) {
-    FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC);
+    FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
     _lowest_non_clean_base_chunk_index = NULL;
   }
   if (_last_LNC_resizing_collection) {
-    FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC);
+    FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
     _last_LNC_resizing_collection = NULL;
   }
 }
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -70,7 +70,7 @@
     _ct_bs = NULL;
   }
   if (_last_cur_val_in_gen) {
-    FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal);
+    FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen);
   }
 }
 
--- a/hotspot/src/share/vm/memory/filemap.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -326,7 +326,7 @@
   n = os::read(fd, _paths_misc_info, (unsigned int)info_size);
   if (n != info_size) {
     fail_continue("Unable to read the shared path info header.");
-    FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass);
+    FREE_C_HEAP_ARRAY(char, _paths_misc_info);
     _paths_misc_info = NULL;
     return false;
   }
@@ -709,7 +709,7 @@
   }
 
   if (_paths_misc_info != NULL) {
-    FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass);
+    FREE_C_HEAP_ARRAY(char, _paths_misc_info);
     _paths_misc_info = NULL;
   }
   return status;
--- a/hotspot/src/share/vm/memory/heapInspection.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -153,7 +153,7 @@
     for (int index = 0; index < _size; index++) {
       _buckets[index].empty();
     }
-    FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets, mtInternal);
+    FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets);
     _size = 0;
   }
 }
--- a/hotspot/src/share/vm/memory/memRegion.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/memory/memRegion.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -112,10 +112,10 @@
     AllocFailStrategy::RETURN_NULL);
 }
 void  MemRegion::operator delete(void* p) {
-  FreeHeap(p, mtGC);
+  FreeHeap(p);
 }
 
 void  MemRegion::operator delete [](void* p) {
-  FreeHeap(p, mtGC);
+  FreeHeap(p);
 }
 
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1365,7 +1365,7 @@
       cl->do_field(&fd);
     }
   }
-  FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass);
+  FREE_C_HEAP_ARRAY(int, fields_sorted);
 }
 
 
@@ -2473,7 +2473,7 @@
 
   // deallocate the cached class file
   if (_cached_class_file != NULL) {
-    os::free(_cached_class_file, mtClass);
+    os::free(_cached_class_file);
     _cached_class_file = NULL;
   }
 
@@ -2482,7 +2482,7 @@
   // unreference array name derived from this class name (arrays of an unloaded
   // class can't be referenced anymore).
   if (_array_name != NULL)  _array_name->decrement_refcount();
-  if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
+  if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension);
 
   assert(_total_instanceKlass_count >= 1, "Sanity check");
   Atomic::dec(&_total_instanceKlass_count);
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1757,7 +1757,7 @@
 
   JNIMethodBlockNode(int num_methods = min_block_size);
 
-  ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods, mtInternal); }
+  ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods); }
 
   void ensure_methods(int num_addl_methods) {
     if (_top < _number_of_methods) {
--- a/hotspot/src/share/vm/prims/jniCheck.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1554,7 +1554,7 @@
       }
       // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
-      FreeHeap((char*)result, mtInternal);
+      FreeHeap((char*)result);
     }
     functionExit(thr);
     return new_result;
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,11 +68,11 @@
 
   ~JvmtiConstantPoolReconstituter() {
     if (_symmap != NULL) {
-      os::free(_symmap, mtClass);
+      os::free(_symmap);
       _symmap = NULL;
     }
     if (_classmap != NULL) {
-      os::free(_classmap, mtClass);
+      os::free(_classmap);
       _classmap = NULL;
     }
   }
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -192,7 +192,7 @@
 
   jvmtiError deallocate(unsigned char* mem) {
     if (mem != NULL) {
-      os::free(mem, mtInternal);
+      os::free(mem);
     }
     return JVMTI_ERROR_NONE;
   }
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -727,7 +727,7 @@
     JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
   }
   ~JvmtiCompiledMethodLoadEventMark() {
-     FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map, mtInternal);
+     FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map);
   }
 
   jint code_size() { return _code_size; }
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -88,7 +88,7 @@
 void GrowableCache::recache() {
   int len = _elements->length();
 
-  FREE_C_HEAP_ARRAY(address, _cache, mtInternal);
+  FREE_C_HEAP_ARRAY(address, _cache);
   _cache = NEW_C_HEAP_ARRAY(address,len+1, mtInternal);
 
   for (int i=0; i<len; i++) {
@@ -132,7 +132,7 @@
 GrowableCache::~GrowableCache() {
   clear();
   delete _elements;
-  FREE_C_HEAP_ARRAY(address, _cache, mtInternal);
+  FREE_C_HEAP_ARRAY(address, _cache);
 }
 
 void GrowableCache::initialize(void *this_obj, void listener_fun(void *, address*) ) {
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -262,10 +262,33 @@
 UNSAFE_END
 
 #ifndef SUPPORTS_NATIVE_CX8
-// Keep old code for platforms which may not have atomic jlong (8 bytes) instructions
 
-// Volatile long versions must use locks if !VM_Version::supports_cx8().
-// support_cx8 is a surrogate for 'supports atomic long memory ops'.
+// VM_Version::supports_cx8() is a surrogate for 'supports atomic long memory ops'.
+//
+// On platforms which do not support atomic compare-and-swap of jlong (8 byte)
+// values we have to use a lock-based scheme to enforce atomicity. This has to be
+// applied to all Unsafe operations that set the value of a jlong field. Even so
+// the compareAndSwapLong operation will not be atomic with respect to direct stores
+// to the field from Java code. It is important therefore that any Java code that
+// utilizes these Unsafe jlong operations does not perform direct stores. To permit
+// direct loads of the field from Java code we must also use Atomic::store within the
+// locked regions. And for good measure, in case there are direct stores, we also
+// employ Atomic::load within those regions. Note that the field in question must be
+// volatile and so must have atomic load/store accesses applied at the Java level.
+//
+// The locking scheme could utilize a range of strategies for controlling the locking
+// granularity: from a lock per-field through to a single global lock. The latter is
+// the simplest and is used for the current implementation. Note that the Java object
+// that contains the field, can not, in general, be used for locking. To do so can lead
+// to deadlocks as we may introduce locking into what appears to the Java code to be a
+// lock-free path.
+//
+// As all the locked-regions are very short and themselves non-blocking we can treat
+// them as leaf routines and elide safepoint checks (ie we don't perform any thread
+// state transitions even when blocking for the lock). Note that if we do choose to
+// add safepoint checks and thread state transitions, we must ensure that we calculate
+// the address of the field _after_ we have acquired the lock, else the object may have
+// been moved by the GC
 
 UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
   UnsafeWrapper("Unsafe_GetLongVolatile");
@@ -277,8 +300,8 @@
     else {
       Handle p (THREAD, JNIHandles::resolve(obj));
       jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-      ObjectLocker ol(p, THREAD);
-      jlong value = *addr;
+      MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+      jlong value = Atomic::load(addr);
       return value;
     }
   }
@@ -293,8 +316,8 @@
     else {
       Handle p (THREAD, JNIHandles::resolve(obj));
       jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-      ObjectLocker ol(p, THREAD);
-      *addr = x;
+      MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+      Atomic::store(x, addr);
     }
   }
 UNSAFE_END
@@ -403,8 +426,8 @@
     else {
       Handle p (THREAD, JNIHandles::resolve(obj));
       jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-      ObjectLocker ol(p, THREAD);
-      *addr = x;
+      MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+      Atomic::store(x, addr);
     }
   }
 #endif
@@ -875,10 +898,10 @@
     result = JVM_DefineClass(env, utfName, loader, body, length, pd);
 
     if (utfName && utfName != buf)
-        FREE_C_HEAP_ARRAY(char, utfName, mtInternal);
+        FREE_C_HEAP_ARRAY(char, utfName);
 
  free_body:
-    FREE_C_HEAP_ARRAY(jbyte, body, mtInternal);
+    FREE_C_HEAP_ARRAY(jbyte, body);
     return result;
   }
 }
@@ -1063,7 +1086,7 @@
 
   // try/finally clause:
   if (temp_alloc != NULL) {
-    FREE_C_HEAP_ARRAY(HeapWord, temp_alloc, mtInternal);
+    FREE_C_HEAP_ARRAY(HeapWord, temp_alloc);
   }
 
   // The anonymous class loader data has been artificially been kept alive to
@@ -1152,14 +1175,19 @@
   UnsafeWrapper("Unsafe_CompareAndSwapLong");
   Handle p (THREAD, JNIHandles::resolve(obj));
   jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
+#ifdef SUPPORTS_NATIVE_CX8
+  return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
+#else
   if (VM_Version::supports_cx8())
     return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
   else {
     jboolean success = false;
-    ObjectLocker ol(p, THREAD);
-    if (*addr == e) { *addr = x; success = true; }
+    MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+    jlong val = Atomic::load(addr);
+    if (val == e) { Atomic::store(x, addr); success = true; }
     return success;
   }
+#endif
 UNSAFE_END
 
 UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time))
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -70,38 +70,63 @@
   const char* desc = WhiteBox::lookup_jstring("desc", argument);
   const char* default_value = WhiteBox::lookup_jstring("defaultValue", argument);
   bool mandatory = WhiteBox::lookup_bool("mandatory", argument);
+  bool isarg = WhiteBox::lookup_bool("argument", argument);
   const char*  type = lookup_diagnosticArgumentEnum("type", argument);
 
    if (strcmp(type, "STRING") == 0) {
      DCmdArgument<char*>* argument = new DCmdArgument<char*>(
      name, desc,
      "STRING", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "NANOTIME") == 0) {
      DCmdArgument<NanoTimeArgument>* argument = new DCmdArgument<NanoTimeArgument>(
      name, desc,
      "NANOTIME", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "JLONG") == 0) {
      DCmdArgument<jlong>* argument = new DCmdArgument<jlong>(
      name, desc,
      "JLONG", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "BOOLEAN") == 0) {
      DCmdArgument<bool>* argument = new DCmdArgument<bool>(
      name, desc,
      "BOOLEAN", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "MEMORYSIZE") == 0) {
      DCmdArgument<MemorySizeArgument>* argument = new DCmdArgument<MemorySizeArgument>(
      name, desc,
      "MEMORY SIZE", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "STRINGARRAY") == 0) {
      DCmdArgument<StringArrayArgument*>* argument = new DCmdArgument<StringArrayArgument*>(
      name, desc,
      "STRING SET", mandatory);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    }
 }
 
@@ -111,11 +136,12 @@
  * { name, value, name, value ... }
  * This can then be checked from java.
  */
-WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jobjectArray arguments))
+WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jchar j_delim, jobjectArray arguments))
   ResourceMark rm;
   DCmdParser parser;
 
   const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline));
+  const char c_delim = j_delim & 0xff;
   objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments));
   objArrayHandle argumentArray_ah(THREAD, argumentArray);
 
@@ -127,20 +153,29 @@
   }
 
   CmdLine cmdline(c_cmdline, strlen(c_cmdline), true);
-  parser.parse(&cmdline,',',CHECK_NULL);
+  parser.parse(&cmdline,c_delim,CHECK_NULL);
 
   Klass* k = SystemDictionary::Object_klass();
   objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL);
   objArrayHandle returnvalue_array_ah(THREAD, returnvalue_array);
 
   GrowableArray<const char *>*parsedArgNames = parser.argument_name_array();
+  GenDCmdArgument* arglist = parser.arguments_list();
 
   for (int i = 0; i < parser.num_arguments(); i++) {
     oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL);
     returnvalue_array_ah->obj_at_put(i*2, parsedName);
     GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i)));
+    if (!arg) {
+      arg = arglist;
+      arglist = arglist->next();
+    }
     char buf[VALUE_MAXLEN];
-    arg->value_as_str(buf, sizeof(buf));
+    if (arg) {
+      arg->value_as_str(buf, sizeof(buf));
+    } else {
+      sprintf(buf, "<null>");
+    }
     oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL);
     returnvalue_array_ah->obj_at_put(i*2+1, parsedValue);
   }
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -27,6 +27,6 @@
 #include "prims/jni.h"
 #include "prims/whitebox.hpp"
 
-WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jobjectArray arguments);
+WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jchar delim, jobjectArray arguments);
 
 #endif //SHARE_VM_PRIMS_WBTESTMETHODS_PARSERTESTS_H
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -75,6 +75,9 @@
   return heapOopSize;
 WB_END
 
+WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
+  return os::vm_page_size();
+WB_END
 
 class WBIsKlassAliveClosure : public KlassClosure {
     Symbol* _name;
@@ -318,7 +321,7 @@
 
 // Free the memory allocated by NMTAllocTest
 WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
-  os::free((void*)(uintptr_t)mem, mtTest);
+  os::free((void*)(uintptr_t)mem);
 WB_END
 
 WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
@@ -744,7 +747,7 @@
     env->ReleaseStringUTFChars(value, ccstrValue);
   }
   if (needFree) {
-    FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ccstrResult);
   }
 WB_END
 
@@ -1124,9 +1127,10 @@
   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
+  {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
   {CC"parseCommandLine",
-      CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
+      CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
       (void*) &WB_ParseCommandLine
   },
   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -437,7 +437,7 @@
 inline void SysClassPath::reset_item_at(int index) {
   assert(index < _scp_nitems && index != _scp_base, "just checking");
   if (_items[index] != NULL) {
-    FREE_C_HEAP_ARRAY(char, _items[index], mtInternal);
+    FREE_C_HEAP_ARRAY(char, _items[index]);
     _items[index] = NULL;
   }
 }
@@ -473,7 +473,7 @@
       memcpy(dirpath, path, tmp_end - path);
       dirpath[tmp_end - path] = '\0';
       expanded_path = add_jars_to_path(expanded_path, dirpath);
-      FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
+      FREE_C_HEAP_ARRAY(char, dirpath);
       path = tmp_end + 1;
     }
   }
@@ -540,7 +540,7 @@
       cp_tmp += str_len;
       *cp_tmp = separator;
       memcpy(++cp_tmp, path, old_len + 1);      // copy the trailing null
-      FREE_C_HEAP_ARRAY(char, path, mtInternal);
+      FREE_C_HEAP_ARRAY(char, path);
     } else {
       cp = REALLOC_C_HEAP_ARRAY(char, path, len, mtInternal);
       char* cp_tmp = cp + old_len;
@@ -575,10 +575,10 @@
       char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name), mtInternal);
       sprintf(jarpath, "%s%s%s", directory, dir_sep, name);
       path = add_to_path(path, jarpath, false);
-      FREE_C_HEAP_ARRAY(char, jarpath, mtInternal);
+      FREE_C_HEAP_ARRAY(char, jarpath);
     }
   }
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
   os::closedir(dir);
   return path;
 }
@@ -713,7 +713,7 @@
 static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
   if (!CommandLineFlags::ccstrAtPut(name, &value, origin))  return false;
   // Contract:  CommandLineFlags always returns a pointer that needs freeing.
-  FREE_C_HEAP_ARRAY(char, value, mtInternal);
+  FREE_C_HEAP_ARRAY(char, value);
   return true;
 }
 
@@ -737,10 +737,10 @@
   }
   (void) CommandLineFlags::ccstrAtPut(name, &value, origin);
   // CommandLineFlags always returns a pointer that needs freeing.
-  FREE_C_HEAP_ARRAY(char, value, mtInternal);
+  FREE_C_HEAP_ARRAY(char, value);
   if (free_this_too != NULL) {
     // CommandLineFlags made its own copy, so I must delete my own temp. buffer.
-    FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal);
+    FREE_C_HEAP_ARRAY(char, free_this_too);
   }
   return true;
 }
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -82,9 +82,9 @@
 
 
 Deoptimization::UnrollBlock::~UnrollBlock() {
-  FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes, mtCompiler);
-  FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs, mtCompiler);
-  FREE_C_HEAP_ARRAY(intptr_t, _register_block, mtCompiler);
+  FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
+  FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs);
+  FREE_C_HEAP_ARRAY(intptr_t, _register_block);
 }
 
 
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -66,7 +66,7 @@
       _nmethods[i]->make_not_entrant();
       _nmethods[i]->method()->clear_code();
     }
-    FREE_C_HEAP_ARRAY(nmethod*, _nmethods, mtInternal);
+    FREE_C_HEAP_ARRAY(nmethod*, _nmethods);
     _nmethods = NULL;
     _count = 0;
   }
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -936,7 +936,7 @@
       FlatProfiler::interval_reset();
     }
 
-    FREE_C_HEAP_ARRAY(JavaThread *, threadsList, mtInternal);
+    FREE_C_HEAP_ARRAY(JavaThread *, threadsList);
   } else {
     // Couldn't get the threads lock, just record that rather than blocking
     FlatProfiler::threads_lock_ticks += 1;
--- a/hotspot/src/share/vm/runtime/globals.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -840,7 +840,7 @@
   faddr->set_ccstr(new_value);
   if (!faddr->is_default() && old_value != NULL) {
     // Prior value is heap allocated so free it.
-    FREE_C_HEAP_ARRAY(char, old_value, mtInternal);
+    FREE_C_HEAP_ARRAY(char, old_value);
   }
   faddr->set_origin(origin);
 }
@@ -874,7 +874,7 @@
     }
   }
   out->cr();
-  FREE_C_HEAP_ARRAY(Flag*, array, mtInternal);
+  FREE_C_HEAP_ARRAY(Flag*, array);
 }
 
 #ifndef PRODUCT
@@ -908,5 +908,5 @@
       array[i]->print_on(out, withComments);
     }
   }
-  FREE_C_HEAP_ARRAY(Flag*, array, mtInternal);
+  FREE_C_HEAP_ARRAY(Flag*, array);
 }
--- a/hotspot/src/share/vm/runtime/handles.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -179,11 +179,11 @@
 }
 
 void HandleMark::operator delete(void* p) {
-  FreeHeap(p, mtThread);
+  FreeHeap(p);
 }
 
 void HandleMark::operator delete[](void* p) {
-  FreeHeap(p, mtThread);
+  FreeHeap(p);
 }
 
 #ifdef ASSERT
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -136,6 +136,10 @@
 Mutex*   JfrThreadGroups_lock         = NULL;
 #endif
 
+#ifndef SUPPORTS_NATIVE_CX8
+Mutex*   UnsafeJlong_lock             = NULL;
+#endif
+
 #define MAX_NUM_MUTEX 128
 static Monitor * _mutex_array[MAX_NUM_MUTEX];
 static int _num_mutex;
@@ -286,6 +290,9 @@
   def(JfrStacktrace_lock           , Mutex,   special,     true);
 #endif
 
+#ifndef SUPPORTS_NATIVE_CX8
+  def(UnsafeJlong_lock             , Mutex,   special,     false);
+#endif
 }
 
 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -136,6 +136,10 @@
 extern Mutex*   JfrThreadGroups_lock;            // protects JFR access to Thread Groups
 #endif
 
+#ifndef SUPPORTS_NATIVE_CX8
+extern Mutex*   UnsafeJlong_lock;                // provides Unsafe atomic updates to jlongs on platforms that don't support cx8
+#endif
+
 // A MutexLocker provides mutual exclusion with respect to a given mutex
 // for the scope which contains the locker.  The lock is an OS lock, not
 // an object lock, and the two do not interoperate.  Do not use Mutex-based
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -207,7 +207,7 @@
     return operator new (size);
   }
   void operator delete(void* p) {
-    FreeHeap(p, mtInternal);
+    FreeHeap(p);
   }
   void operator delete[] (void *p) {
     operator delete(p);
--- a/hotspot/src/share/vm/runtime/os.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/os.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -473,7 +473,7 @@
       break;
     }
     entryName = dll_lookup(handle, agent_function_name);
-    FREE_C_HEAP_ARRAY(char, agent_function_name, mtThread);
+    FREE_C_HEAP_ARRAY(char, agent_function_name);
     if (entryName != NULL) {
       break;
     }
@@ -689,7 +689,7 @@
 }
 
 
-void  os::free(void *memblock, MEMFLAGS memflags) {
+void  os::free(void *memblock) {
   NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
 #ifdef ASSERT
   if (memblock == NULL) return;
@@ -1211,7 +1211,7 @@
     path_len = new_len;
   }
 
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
   os::closedir(dir);
 
   return path;
@@ -1236,7 +1236,7 @@
   if (rt_jar == NULL) return false;
   struct stat st;
   bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
-  FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);
+  FREE_C_HEAP_ARRAY(char, rt_jar);
 
   if (has_rt_jar) {
     // Any modification to the JAR-file list, for the boot classpath must be
@@ -1320,7 +1320,7 @@
     opath[i] = s;
     p += len + 1;
   }
-  FREE_C_HEAP_ARRAY(char, inpath, mtInternal);
+  FREE_C_HEAP_ARRAY(char, inpath);
   *n = count;
   return opath;
 }
--- a/hotspot/src/share/vm/runtime/os.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/os.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -663,7 +663,7 @@
   static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
   static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
 
-  static void  free    (void *memblock, MEMFLAGS flags = mtNone);
+  static void  free    (void *memblock);
   static bool  check_heap(bool force = false);      // verify C heap integrity
   static char* strdup(const char *, MEMFLAGS flags = mtInternal);  // Like strdup
   // Like strdup, but exit VM when strdup() returns NULL
--- a/hotspot/src/share/vm/runtime/perfData.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/perfData.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -113,10 +113,10 @@
 
 PerfData::~PerfData() {
   if (_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, _name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, _name);
   }
   if (is_on_c_heap()) {
-    FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep, mtInternal);
+    FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep);
   }
 }
 
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -250,7 +250,7 @@
     dest_file = NEW_C_HEAP_ARRAY(char, JVM_MAXPATHLEN, mtInternal);
     if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile),
                                    dest_file, JVM_MAXPATHLEN)) {
-      FREE_C_HEAP_ARRAY(char, dest_file, mtInternal);
+      FREE_C_HEAP_ARRAY(char, dest_file);
       if (PrintMiscellaneous && Verbose) {
         warning("Invalid performance data file path name specified, "\
                 "fall back to a default name");
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -2084,7 +2084,7 @@
 
   ~AdapterFingerPrint() {
     if (_length > 0) {
-      FREE_C_HEAP_ARRAY(int, _value._fingerprint, mtCode);
+      FREE_C_HEAP_ARRAY(int, _value._fingerprint);
     }
   }
 
@@ -2491,7 +2491,7 @@
 void AdapterHandlerEntry::deallocate() {
   delete _fingerprint;
 #ifdef ASSERT
-  if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode);
+  if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
 #endif
 }
 
@@ -2902,7 +2902,7 @@
 JRT_END
 
 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
-  FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
+  FREE_C_HEAP_ARRAY(intptr_t, buf);
 JRT_END
 
 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -171,9 +171,9 @@
 void Thread::operator delete(void* p) {
   if (UseBiasedLocking) {
     void* real_malloc_addr = ((Thread*) p)->_real_malloc_address;
-    FreeHeap(real_malloc_addr, mtThread);
+    FreeHeap(real_malloc_addr);
   } else {
-    FreeHeap(p, mtThread);
+    FreeHeap(p);
   }
 }
 
@@ -1146,7 +1146,7 @@
 
 NamedThread::~NamedThread() {
   if (_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, _name, mtThread);
+    FREE_C_HEAP_ARRAY(char, _name);
     _name = NULL;
   }
 }
@@ -2998,7 +2998,7 @@
 
 void JavaThread::popframe_free_preserved_args() {
   assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice");
-  FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args, mtThread);
+  FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args);
   _popframe_preserved_args = NULL;
   _popframe_preserved_args_size = 0;
 }
@@ -3608,7 +3608,7 @@
         jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
         // If we can't find the agent, exit.
         vm_exit_during_initialization(buf, NULL);
-        FREE_C_HEAP_ARRAY(char, buf, mtThread);
+        FREE_C_HEAP_ARRAY(char, buf);
       }
     } else {
       // Try to load the agent from the standard dll directory
@@ -3628,7 +3628,7 @@
           jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
           // If we can't find the agent, exit.
           vm_exit_during_initialization(buf, NULL);
-          FREE_C_HEAP_ARRAY(char, buf, mtThread);
+          FREE_C_HEAP_ARRAY(char, buf);
         }
       }
     }
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -3268,10 +3268,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      FREE_C_HEAP_ARRAY(char, s, mtInternal);
+      FREE_C_HEAP_ARRAY(char, s);
       return 1;
     }
-    FREE_C_HEAP_ARRAY(char, s, mtInternal);
+    FREE_C_HEAP_ARRAY(char, s);
   }
   const char* start = NULL;
   if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3287,10 +3287,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      FREE_C_HEAP_ARRAY(char, s, mtInternal);
+      FREE_C_HEAP_ARRAY(char, s);
       return 1;
     }
-    FREE_C_HEAP_ARRAY(char, s, mtInternal);
+    FREE_C_HEAP_ARRAY(char, s);
   }
   if (strstr(typeName, "const ") == typeName) {
     const char * s = typeName + strlen("const ");
--- a/hotspot/src/share/vm/services/attachListener.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -348,7 +348,7 @@
   }
   bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (res) {
-    FREE_C_HEAP_ARRAY(char, value, mtInternal);
+    FREE_C_HEAP_ARRAY(char, value);
   } else {
     out->print_cr("setting flag %s failed", name);
   }
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,7 +174,7 @@
 
 template <> void DCmdArgument<char*>::destroy_value() {
   if (_value != NULL) {
-    FREE_C_HEAP_ARRAY(char, _value, mtInternal);
+    FREE_C_HEAP_ARRAY(char, _value);
     set_value(NULL);
   }
 }
--- a/hotspot/src/share/vm/services/diagnosticArgument.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/diagnosticArgument.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
   ~StringArrayArgument() {
     for (int i=0; i<_array->length(); i++) {
       if(_array->at(i) != NULL) { // Safety check
-        FREE_C_HEAP_ARRAY(char, _array->at(i), mtInternal);
+        FREE_C_HEAP_ARRAY(char, _array->at(i));
       }
     }
     delete _array;
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -60,16 +60,15 @@
 
 bool DCmdArgIter::next(TRAPS) {
   if (_len == 0) return false;
-  // skipping spaces
+  // skipping delimiters
   while (_cursor < _len - 1 && _buffer[_cursor] == _delim) {
     _cursor++;
   }
   // handling end of command line
-  if (_cursor >= _len - 1) {
-    _cursor = _len - 1;
-    _key_addr = &_buffer[_len - 1];
+  if (_cursor == _len - 1 && _buffer[_cursor] == _delim) {
+    _key_addr = &_buffer[_cursor];
     _key_len = 0;
-    _value_addr = &_buffer[_len - 1];
+    _value_addr = &_buffer[_cursor];
     _value_len = 0;
     return false;
   }
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1404,7 +1404,7 @@
       for (int i=0; i < _num_threads; i++) {
         delete _stack_traces[i];
       }
-      FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces, mtInternal);
+      FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces);
     }
     delete _klass_map;
   }
--- a/hotspot/src/share/vm/services/management.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/management.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1744,7 +1744,7 @@
     ccstr svalue = java_lang_String::as_utf8_string(str);
     succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
     if (succeed) {
-      FREE_C_HEAP_ARRAY(char, svalue, mtInternal);
+      FREE_C_HEAP_ARRAY(char, svalue);
     }
   }
   assert(succeed, "Setting flag should succeed");
@@ -1819,7 +1819,7 @@
   for (int i = 0; i < _count; i++) {
     os::free(_names_chars[i]);
   }
-  FREE_C_HEAP_ARRAY(char *, _names_chars, mtInternal);
+  FREE_C_HEAP_ARRAY(char *, _names_chars);
 }
 
 // Fills names with VM internal thread names and times with the corresponding
--- a/hotspot/src/share/vm/services/memoryManager.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/services/memoryManager.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -171,8 +171,8 @@
 }
 
 GCStatInfo::~GCStatInfo() {
-  FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array, mtInternal);
-  FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array, mtInternal);
+  FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array);
+  FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array);
 }
 
 void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) {
--- a/hotspot/src/share/vm/utilities/array.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/array.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
   // allocate and initialize new data section
   void* data = NEW_C_HEAP_ARRAY(char*, esize * size, F);
   memcpy(data, _data, esize * length());
-  FREE_C_HEAP_ARRAY(char*, _data, F);
+  FREE_C_HEAP_ARRAY(char*, _data);
   _data = data;
 }
 
--- a/hotspot/src/share/vm/utilities/bitMap.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -468,7 +468,7 @@
                                        (intptr_t)  NULL_WORD);
     if (res != NULL_WORD) {
       guarantee( _pop_count_table == (void*) res, "invariant" );
-      FREE_C_HEAP_ARRAY(idx_t, table, mtInternal);
+      FREE_C_HEAP_ARRAY(idx_t, table);
     }
   }
 }
--- a/hotspot/src/share/vm/utilities/hashtable.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -149,7 +149,7 @@
     // allocated by os::malloc
     if (!UseSharedSpaces ||
         !FileMapInfo::current_info()->is_in_shared_space(_buckets)) {
-       FREE_C_HEAP_ARRAY(HashtableBucket, _buckets, F);
+       FREE_C_HEAP_ARRAY(HashtableBucket, _buckets);
     }
     _buckets = NULL;
   }
--- a/hotspot/src/share/vm/utilities/numberSeq.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/numberSeq.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -139,7 +139,7 @@
 }
 
 TruncatedSeq::~TruncatedSeq() {
-  FREE_C_HEAP_ARRAY(double, _sequence, mtGC);
+  FREE_C_HEAP_ARRAY(double, _sequence);
 }
 
 void TruncatedSeq::add(double val) {
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -498,37 +498,37 @@
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test.log", tms);
   o_result = make_log_name_internal("test.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // test-%t-%p.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%s-pid%u.log", tms, pid);
   o_result = make_log_name_internal("test-%t-%p.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t-%%p.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // test-%t%p.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%spid%u.log", tms, pid);
   o_result = make_log_name_internal("test-%t%p.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t%%p.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // %p%t.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u%s.log", pid, tms);
   o_result = make_log_name_internal("%p%t.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p%%t.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // %p-test.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u-test.log", pid);
   o_result = make_log_name_internal("%p-test.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p-test.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // %t.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "%s.log", tms);
   o_result = make_log_name_internal("%t.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%t.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 }
 #endif // PRODUCT
 
@@ -627,7 +627,7 @@
     _file = NULL;
   }
   if (_file_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, _file_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, _file_name);
     _file_name = NULL;
   }
 }
@@ -829,7 +829,7 @@
                  "Warning:  Cannot open log file: %s\n", try_name);
     // Note:  This feature is for maintainer use only.  No need for L10N.
     jio_print(warnbuf);
-    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, try_name);
     try_name = make_log_name(log_name, os::get_temp_directory());
     jio_snprintf(warnbuf, sizeof(warnbuf),
                  "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
@@ -837,7 +837,7 @@
     delete file;
     file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
   }
-  FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+  FREE_C_HEAP_ARRAY(char, try_name);
 
   if (file->is_open()) {
     _log_file = file;
@@ -1121,7 +1121,7 @@
     const char* list_name = make_log_name(DumpLoadedClassList, NULL);
     classlist_file = new(ResourceObj::C_HEAP, mtInternal)
                          fileStream(list_name);
-    FREE_C_HEAP_ARRAY(char, list_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, list_name);
   }
 #endif
 
@@ -1274,7 +1274,7 @@
 
 bufferedStream::~bufferedStream() {
   if (!buffer_fixed) {
-    FREE_C_HEAP_ARRAY(char, buffer, mtInternal);
+    FREE_C_HEAP_ARRAY(char, buffer);
   }
 }
 
--- a/hotspot/src/share/vm/utilities/quickSort.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/quickSort.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -214,8 +214,8 @@
     sort(test_array, length, test_even_odd_comparator, true);
     assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
 
-    FREE_C_HEAP_ARRAY(int, test_array, mtInternal);
-    FREE_C_HEAP_ARRAY(int, expected_array, mtInternal);
+    FREE_C_HEAP_ARRAY(int, test_array);
+    FREE_C_HEAP_ARRAY(int, expected_array);
   }
 }
 
--- a/hotspot/src/share/vm/utilities/stack.inline.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/stack.inline.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,7 @@
 template <class E, MEMFLAGS F>
 void Stack<E, F>::free(E* addr, size_t bytes)
 {
-  FREE_C_HEAP_ARRAY(char, (char*) addr, F);
+  FREE_C_HEAP_ARRAY(char, (char*) addr);
 }
 
 template <class E, MEMFLAGS F>
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp	Wed Dec 03 20:32:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -427,7 +427,7 @@
 
 template<class E, MEMFLAGS F, unsigned int N>
 GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
-  FREE_C_HEAP_ARRAY(E, _elems, F);
+  FREE_C_HEAP_ARRAY(E, _elems);
 }
 
 // OverflowTaskQueue is a TaskQueue that also includes an overflow stack for
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -489,7 +489,7 @@
 
 
 SubTasksDone::~SubTasksDone() {
-  if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks, mtInternal);
+  if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks);
 }
 
 // *** SequentialSubTasksDone
@@ -560,7 +560,7 @@
 
 FreeIdSet::~FreeIdSet() {
   _sets[_index] = NULL;
-  FREE_C_HEAP_ARRAY(int, _ids, mtInternal);
+  FREE_C_HEAP_ARRAY(int, _ids);
 }
 
 void FreeIdSet::set_safepoint(bool b) {
--- a/hotspot/src/share/vm/utilities/xmlstream.cpp	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/src/share/vm/utilities/xmlstream.cpp	Wed Dec 03 20:32:33 2014 -0800
@@ -58,7 +58,7 @@
 
 #ifdef ASSERT
 xmlStream::~xmlStream() {
-  FREE_C_HEAP_ARRAY(char, _element_close_stack_low, mtInternal);
+  FREE_C_HEAP_ARRAY(char, _element_close_stack_low);
 }
 #endif
 
@@ -162,7 +162,7 @@
     _element_close_stack_high = new_high;
     _element_close_stack_low  = new_low;
     _element_close_stack_ptr  = new_ptr;
-    FREE_C_HEAP_ARRAY(char, old_low, mtInternal);
+    FREE_C_HEAP_ARRAY(char, old_low);
     push_ptr = new_ptr - (tag_len+1);
   }
   assert(push_ptr >= _element_close_stack_low, "in range");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/memory/ReadVMPageSize.java	Wed Dec 03 20:32:33 2014 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Using WhiteBox to get VM page size
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ReadVMPageSize
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm  -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI  ReadVMPageSize
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.hotspot.WhiteBox;
+
+public class ReadVMPageSize {
+  public static void main(String args[]) throws Exception {
+    WhiteBox wb = WhiteBox.getWhiteBox();
+    int pageSize = wb.getVMPageSize();
+    if (pageSize < 0) {
+      throw new Exception("pageSize < 0");
+    } else {
+      System.out.println("Page size = " + pageSize);
+    }
+  }
+}
--- a/hotspot/test/serviceability/ParserTest.java	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/test/serviceability/ParserTest.java	Wed Dec 03 20:32:33 2014 -0800
@@ -48,6 +48,7 @@
         testBool();
         testQuotes();
         testMemorySize();
+        testSingleLetterArg();
     }
 
     public static void main(String... args) throws Exception  {
@@ -99,7 +100,7 @@
                 false, "0");
         DiagnosticCommand[] args = {arg};
 
-        wb.parseCommandLine(name + "=10", args);
+        wb.parseCommandLine(name + "=10", ',', args);
         parse(name, "10", name + "=10", args);
         parse(name, "-5", name + "=-5", args);
 
@@ -149,6 +150,15 @@
         parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\",arg=value", args);
     }
 
+    public void testSingleLetterArg() throws Exception {
+        DiagnosticCommand[] args = new DiagnosticCommand[]{
+            new DiagnosticCommand("flag", "desc", DiagnosticArgumentType.STRING, true, false, null),
+            new DiagnosticCommand("value", "desc", DiagnosticArgumentType.STRING, true, false, null)
+        };
+        parse("flag", "flag", "flag v", ' ', args);
+        parse("value", "v", "flag v", ' ', args);
+    }
+
     public void testMemorySize() throws Exception {
         String name = "name";
         String defaultValue = "1024";
@@ -176,9 +186,13 @@
 
     public void parse(String searchName, String expectedValue,
             String cmdLine, DiagnosticCommand[] argumentTypes) throws Exception {
+        parse(searchName, expectedValue, cmdLine, ',', argumentTypes);
+    }
+    public void parse(String searchName, String expectedValue,
+            String cmdLine, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
         //parseCommandLine will return an object array that looks like
         //{<name of parsed object>, <of parsed object> ... }
-        Object[] res = wb.parseCommandLine(cmdLine, argumentTypes);
+        Object[] res = wb.parseCommandLine(cmdLine, delim, argumentTypes);
         for (int i = 0; i < res.length-1; i+=2) {
             String parsedName = (String) res[i];
             if (searchName.equals(parsedName)) {
@@ -196,8 +210,11 @@
     }
 
     private void shouldFail(String argument, DiagnosticCommand[] argumentTypes) throws Exception {
+        shouldFail(argument, ',', argumentTypes);
+    }
+    private void shouldFail(String argument, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
         try {
-            wb.parseCommandLine(argument, argumentTypes);
+            wb.parseCommandLine(argument, delim, argumentTypes);
             throw new Exception("Parser accepted argument: " + argument);
         } catch (IllegalArgumentException e) {
             //expected
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Dec 03 20:32:33 2014 -0800
@@ -34,6 +34,7 @@
 
 import com.oracle.java.testlibrary.JDKToolLauncher;
 import com.oracle.java.testlibrary.OutputBuffer;
+import com.oracle.java.testlibrary.Platform;
 import com.oracle.java.testlibrary.ProcessTools;
 
 import java.io.File;
@@ -48,6 +49,10 @@
     System.out.println(Ã);
 
     try {
+        if (!Platform.shouldSAAttach()) {
+            System.out.println("SA attach not expected to work - test skipped.");
+            return;
+        }
         int pid = ProcessTools.getProcessId();
         JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
                                               .addToolArg("-F")
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java	Wed Dec 03 20:32:33 2014 -0800
@@ -23,6 +23,8 @@
 
 package com.oracle.java.testlibrary;
 
+import com.oracle.java.testlibrary.Utils;
+
 public class Platform {
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
@@ -30,6 +32,7 @@
     private static final String javaVersion = System.getProperty("java.version");
     private static final String osArch      = System.getProperty("os.arch");
     private static final String vmName      = System.getProperty("java.vm.name");
+    private static final String userName    = System.getProperty("user.name");
 
     public static boolean isClient() {
         return vmName.endsWith(" Client VM");
@@ -123,4 +126,56 @@
         return osArch;
     }
 
+    /**
+     * Return a boolean for whether we expect to be able to attach
+     * the SA to our own processes on this system.
+     */
+    public static boolean shouldSAAttach() throws Exception {
+
+        if (isLinux()) {
+            return canPtraceAttachLinux();
+        } else if (isOSX()) {
+            return canAttachOSX();
+        } else {
+            // Other platforms expected to work:
+            return true;
+        }
+    }
+
+    /**
+     * On Linux, first check the SELinux boolean "deny_ptrace" and return false
+     * as we expect to be denied if that is "1".  Then expect permission to attach
+     * if we are root, so return true.  Then return false for an expected denial
+     * if "ptrace_scope" is 1, and true otherwise.
+     */
+    public static boolean canPtraceAttachLinux() throws Exception {
+
+        // SELinux deny_ptrace:
+        String deny_ptrace = Utils.fileAsString("/sys/fs/selinux/booleans/deny_ptrace");
+        if (deny_ptrace != null && deny_ptrace.contains("1")) {
+            // ptrace will be denied:
+            return false;
+        }
+
+        if (userName.equals("root")) {
+            return true;
+        }
+
+        // ptrace_scope:
+        String ptrace_scope = Utils.fileAsString("/proc/sys/kernel/yama/ptrace_scope");
+        if (ptrace_scope != null && ptrace_scope.contains("1")) {
+            // ptrace will be denied:
+            return false;
+        }
+
+        // Otherwise expect to be permitted:
+        return true;
+    }
+
+    /**
+     * On OSX, expect permission to attach only if we are root.
+     */
+    public static boolean canAttachOSX() throws Exception {
+        return userName.equals("root");
+    }
 }
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java	Wed Dec 03 20:32:33 2014 -0800
@@ -314,6 +314,35 @@
     }
 
     /**
+     * Return the contents of the named file as a single String,
+     * or null if not found.
+     * @param filename name of the file to read
+     * @return String contents of file, or null if file not found.
+     */
+    public static String fileAsString(String filename) {
+        StringBuilder result = new StringBuilder();
+        try {
+            File file = new File(filename);
+            if (file.exists()) {
+                BufferedReader reader = new BufferedReader(new FileReader(file));
+                while (true) {
+                    String line = reader.readLine();
+                    if (line == null) {
+                        break;
+                    }
+                    result.append(line).append("\n");
+                }
+            } else {
+                // Does not exist:
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result.toString();
+    }
+
+    /**
      * @return Unsafe instance.
      */
     public static synchronized Unsafe getUnsafe() {
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Wed Dec 03 20:32:33 2014 -0800
@@ -74,6 +74,7 @@
   // Memory
   public native long getObjectAddress(Object o);
   public native int  getHeapOopSize();
+  public native int  getVMPageSize();
   public native boolean isObjectInOldGen(Object o);
   public native long getObjectSize(Object o);
 
@@ -93,7 +94,7 @@
   public native boolean g1IsHumongous(Object o);
   public native long    g1NumFreeRegions();
   public native int     g1RegionSize();
-  public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
+  public native Object[]    parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
 
   // NMT
   public native long NMTMalloc(long size);
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java	Wed Nov 26 20:38:10 2014 -0500
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java	Wed Dec 03 20:32:33 2014 -0800
@@ -34,14 +34,21 @@
     private DiagnosticArgumentType type;
     private boolean mandatory;
     private String defaultValue;
+    private boolean argument;
 
     public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
             boolean mandatory, String defaultValue) {
+        this(name, desc, type, false, mandatory, defaultValue);
+    }
+
+    public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
+            boolean argument, boolean mandatory, String defaultValue) {
         this.name = name;
         this.desc = desc;
         this.type = type;
         this.mandatory = mandatory;
         this.defaultValue = defaultValue;
+        this.argument = argument;
     }
 
     public String getName() {
@@ -60,6 +67,10 @@
         return mandatory;
     }
 
+    public boolean isArgument() {
+        return argument;
+    }
+
     public String getDefaultValue() {
         return defaultValue;
     }