Merge
authordcubed
Wed, 08 Jan 2014 13:53:24 -0800
changeset 22202 f596f2e6c000
parent 22186 c97a9d47d257 (current diff)
parent 22201 9c2ccfa3a5fe (diff)
child 22207 70c05b8b3747
Merge
--- a/hotspot/agent/src/os/linux/symtab.c	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/agent/src/os/linux/symtab.c	Wed Jan 08 13:53:24 2014 -0800
@@ -214,8 +214,10 @@
                                 + 2);
   strcpy(debug_pathname, name);
   char *last_slash = strrchr(debug_pathname, '/');
-  if (last_slash == NULL)
+  if (last_slash == NULL) {
+    free(debug_pathname);
     return -1;
+  }
 
   /* Look in the same directory as the object.  */
   strcpy(last_slash+1, debug_filename);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,19 +24,29 @@
 
 package sun.jvm.hotspot.jdi;
 
-import com.sun.jdi.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import sun.jvm.hotspot.oops.ArrayKlass;
+import sun.jvm.hotspot.oops.Instance;
 import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.ObjArrayKlass;
-import sun.jvm.hotspot.oops.TypeArrayKlass;
 import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.Instance;
+import sun.jvm.hotspot.oops.ObjArrayKlass;
 import sun.jvm.hotspot.oops.Symbol;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
+import sun.jvm.hotspot.oops.TypeArrayKlass;
+
+import com.sun.jdi.ArrayReference;
+import com.sun.jdi.ArrayType;
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.Method;
+import com.sun.jdi.PrimitiveType;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
 
 public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType {
   protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) {
@@ -75,7 +85,8 @@
         }
     }
 
-    void addVisibleMethods(Map methodMap) {
+    @Override
+    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> handledInterfaces) {
         // arrays don't have methods
     }
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,12 +24,30 @@
 
 package sun.jvm.hotspot.jdi;
 
-import com.sun.jdi.*;
-import sun.jvm.hotspot.oops.Klass;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import sun.jvm.hotspot.oops.InstanceKlass;
 
-import java.util.*;
-import java.lang.ref.SoftReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.Field;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
 
 public class ClassTypeImpl extends ReferenceTypeImpl
     implements ClassType
@@ -195,22 +213,26 @@
         return null;
     }
 
-    void addVisibleMethods(Map methodMap) {
+    @Override
+    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
         /*
          * Add methods from
          * parent types first, so that the methods in this class will
          * overwrite them in the hash table
          */
 
-        Iterator iter = interfaces().iterator();
+        Iterator<InterfaceType> iter = interfaces().iterator();
         while (iter.hasNext()) {
             InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addVisibleMethods(methodMap);
+            if (!seenInterfaces.contains(interfaze)) {
+                interfaze.addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
         }
 
         ClassTypeImpl clazz = (ClassTypeImpl)superclass();
         if (clazz != null) {
-            clazz.addVisibleMethods(methodMap);
+            clazz.addVisibleMethods(methodMap, seenInterfaces);
         }
 
         addToMethodMap(methodMap, methods());
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,15 +24,22 @@
 
 package sun.jvm.hotspot.jdi;
 
-import com.sun.jdi.*;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import sun.jvm.hotspot.oops.InstanceKlass;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.Collections;
-import java.lang.ref.SoftReference;
+import com.sun.jdi.ClassNotPreparedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.VirtualMachine;
 
 public class InterfaceTypeImpl extends ReferenceTypeImpl
                                implements InterfaceType {
@@ -96,16 +103,20 @@
         return implementors;
     }
 
-    void addVisibleMethods(Map methodMap) {
+    @Override
+    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
         /*
          * Add methods from
          * parent types first, so that the methods in this class will
          * overwrite them in the hash table
          */
-        Iterator iter = superinterfaces().iterator();
+        Iterator<InterfaceType> iter = superinterfaces().iterator();
         while (iter.hasNext()) {
             InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addVisibleMethods(methodMap);
+            if (!seenInterfaces.contains(interfaze)) {
+                interfaze.addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
         }
 
         addToMethodMap(methodMap, methods());
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,24 +24,45 @@
 
 package sun.jvm.hotspot.jdi;
 
-import java.io.*;
-
-import com.sun.jdi.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import sun.jvm.hotspot.memory.SystemDictionary;
+import sun.jvm.hotspot.oops.ArrayKlass;
+import sun.jvm.hotspot.oops.DefaultHeapVisitor;
 import sun.jvm.hotspot.oops.Instance;
 import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.ArrayKlass;
 import sun.jvm.hotspot.oops.JVMDIClassStatus;
 import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.ObjArray;
 import sun.jvm.hotspot.oops.Oop;
 import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.DefaultHeapVisitor;
 import sun.jvm.hotspot.utilities.Assert;
 
-import java.util.*;
-import java.lang.ref.SoftReference;
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ArrayType;
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassNotPreparedException;
+import com.sun.jdi.ClassObjectReference;
+import com.sun.jdi.Field;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.PrimitiveType;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.Type;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
 
 public abstract class ReferenceTypeImpl extends TypeImpl
 implements ReferenceType {
@@ -421,7 +442,8 @@
         }
     }
 
-    abstract void addVisibleMethods(Map methodMap);
+    abstract void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces);
+
     public final List visibleMethods() throws ClassNotPreparedException {
         checkPrepared();
         /*
@@ -430,8 +452,8 @@
          * concatenation of name and signature.
          */
         //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this);
-        Map map = new HashMap();
-        addVisibleMethods(map);
+        Map<String, Method> map = new HashMap<String, Method>();
+        addVisibleMethods(map, new HashSet<InterfaceType>());
 
         /*
          * ... but the hash map destroys order. Methods should be
@@ -441,7 +463,7 @@
          */
         //System.out.println("jj: RTI: Calling allMethods for:" + this);
 
-        List list = new ArrayList(allMethods());
+        List<Method> list = new ArrayList<Method>(allMethods());
         //System.out.println("jj: allMethods = " + jjstr(list));
         //System.out.println("jj: map = " + map.toString());
         //System.out.println("jj: map = " + jjstr(map.values()));
--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug	Wed Jan 08 13:53:24 2014 -0800
@@ -242,11 +242,6 @@
                 _JVM_Yield
                 _JVM_handle_bsd_signal
 
-                # debug _JVM
-                _JVM_AccessVMBooleanFlag
-                _JVM_AccessVMIntFlag
-                _JVM_VMBreakPoint
-
                 # miscellaneous functions
                 _jio_fprintf
                 _jio_printf
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug	Wed Jan 08 13:53:24 2014 -0800
@@ -244,11 +244,6 @@
                 JVM_Yield;
                 JVM_handle_linux_signal;
 
-                # debug JVM
-                JVM_AccessVMBooleanFlag;
-                JVM_AccessVMIntFlag;
-                JVM_VMBreakPoint;
-
                 # miscellaneous functions
                 jio_fprintf;
                 jio_printf;
--- a/hotspot/make/solaris/makefiles/mapfile-vers-debug	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/make/solaris/makefiles/mapfile-vers-debug	Wed Jan 08 13:53:24 2014 -0800
@@ -28,10 +28,6 @@
 
 SUNWprivate_1.1 {
         global:
-		# debug JVM
-		JVM_AccessVMBooleanFlag;
-		JVM_AccessVMIntFlag;
-		JVM_VMBreakPoint;
 
 		# miscellaneous
 };
--- a/hotspot/make/windows/makefiles/sa.make	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/make/windows/makefiles/sa.make	Wed Jan 08 13:53:24 2014 -0800
@@ -94,7 +94,7 @@
 SA_LD_FLAGS = bufferoverflowU.lib
 !endif
 !else
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c
+SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c 
 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
 SA_CFLAGS = $(SA_CFLAGS) -ZI
 !endif
--- a/hotspot/src/os/bsd/dtrace/hotspot.d	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/os/bsd/dtrace/hotspot.d	Wed Jan 08 13:53:24 2014 -0800
@@ -47,8 +47,8 @@
   probe mem__pool__gc__end(
     char*, uintptr_t, char*, uintptr_t, 
     uintptr_t, uintptr_t, uintptr_t, uintptr_t);
-  probe thread__probe__start(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
-  probe thread__probe__stop(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+  probe thread__start(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+  probe thread__stop(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
   probe thread__sleep__begin(long long);
   probe thread__sleep__end(int);
   probe thread__yield();
@@ -68,7 +68,7 @@
   probe monitor__contended__entered(uintptr_t, uintptr_t, char*, uintptr_t);
   probe monitor__contended__exit(uintptr_t, uintptr_t, char*, uintptr_t);
   probe monitor__wait(uintptr_t, uintptr_t, char*, uintptr_t, uintptr_t);
-  probe monitor__probe__waited(uintptr_t, uintptr_t, char*, uintptr_t);
+  probe monitor__waited(uintptr_t, uintptr_t, char*, uintptr_t);
   probe monitor__notify(uintptr_t, uintptr_t, char*, uintptr_t);
   probe monitor__notifyAll(uintptr_t, uintptr_t, char*, uintptr_t);
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -648,12 +648,12 @@
   return array;
 }
 
-#ifndef PRODUCT
-// for debugging and hsfind(x)
-bool ClassLoaderDataGraph::contains(address x) {
-  // I think we need the _metaspace_lock taken here because the class loader
-  // data graph could be changing while we are walking it (new entries added,
-  // new entries being unloaded, etc).
+// For profiling and hsfind() only.  Otherwise, this is unsafe (and slow).  This
+// is done lock free to avoid lock inversion problems.  It is safe because
+// new ClassLoaderData are added to the end of the CLDG, and only removed at
+// safepoint.  The _unloading list can be deallocated concurrently with CMS so
+// this doesn't look in metaspace for classes that have been unloaded.
+bool ClassLoaderDataGraph::contains(const void* x) {
   if (DumpSharedSpaces) {
     // There are only two metaspaces to worry about.
     ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data();
@@ -670,16 +670,11 @@
     }
   }
 
-  // Could also be on an unloading list which is okay, ie. still allocated
-  // for a little while.
-  for (ClassLoaderData* ucld = _unloading; ucld != NULL; ucld = ucld->next()) {
-    if (ucld->metaspace_or_null() != NULL && ucld->metaspace_or_null()->contains(x)) {
-      return true;
-    }
-  }
+  // Do not check unloading list because deallocation can be concurrent.
   return false;
 }
 
+#ifndef PRODUCT
 bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
   for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
     if (loader_data == data) {
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -90,9 +90,9 @@
   static void dump() { dump_on(tty); }
   static void verify();
 
+  // expensive test for pointer in metaspace for debugging
+  static bool contains(const void* x);
 #ifndef PRODUCT
-  // expensive test for pointer in metaspace for debugging
-  static bool contains(address x);
   static bool contains_loader_data(ClassLoaderData* loader_data);
 #endif
 
--- a/hotspot/src/share/vm/code/dependencies.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/code/dependencies.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -655,8 +655,6 @@
   } else {
     o = _deps->oop_recorder()->metadata_at(i);
   }
-  assert(o == NULL || o->is_metaspace_object(),
-         err_msg("Should be metadata " PTR_FORMAT, o));
   return o;
 }
 
--- a/hotspot/src/share/vm/memory/allocation.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -71,9 +71,8 @@
   return MetaspaceShared::is_in_shared_space(this);
 }
 
-
 bool MetaspaceObj::is_metaspace_object() const {
-  return Metaspace::contains((void*)this);
+  return ClassLoaderDataGraph::contains((void*)this);
 }
 
 void MetaspaceObj::print_address_on(outputStream* st) const {
--- a/hotspot/src/share/vm/memory/allocation.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/memory/allocation.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -264,7 +264,7 @@
 
 class MetaspaceObj {
  public:
-  bool is_metaspace_object() const;  // more specific test but slower
+  bool is_metaspace_object() const;
   bool is_shared() const;
   void print_address_on(outputStream* st) const;  // nonvirtual address printing
 
--- a/hotspot/src/share/vm/memory/metachunk.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/memory/metachunk.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -143,6 +143,8 @@
   void set_is_tagged_free(bool v) { _is_tagged_free = v; }
 #endif
 
+  bool contains(const void* ptr) { return bottom() <= ptr && ptr < _top; }
+
   NOT_PRODUCT(void mangle();)
 
   void print_on(outputStream* st) const;
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -513,8 +513,6 @@
   // Unlink empty VirtualSpaceNodes and free it.
   void purge(ChunkManager* chunk_manager);
 
-  bool contains(const void *ptr);
-
   void print_on(outputStream* st) const;
 
   class VirtualSpaceListIterator : public StackObj {
@@ -558,7 +556,7 @@
 
  private:
 
-  // protects allocations and contains.
+  // protects allocations
   Mutex* const _lock;
 
   // Type of metadata allocated.
@@ -595,7 +593,11 @@
  private:
   // Accessors
   Metachunk* chunks_in_use(ChunkIndex index) const { return _chunks_in_use[index]; }
-  void set_chunks_in_use(ChunkIndex index, Metachunk* v) { _chunks_in_use[index] = v; }
+  void set_chunks_in_use(ChunkIndex index, Metachunk* v) {
+    // ensure lock-free iteration sees fully initialized node
+    OrderAccess::storestore();
+    _chunks_in_use[index] = v;
+  }
 
   BlockFreelist* block_freelists() const {
     return (BlockFreelist*) &_block_freelists;
@@ -708,6 +710,8 @@
   void print_on(outputStream* st) const;
   void locked_print_chunks_in_use_on(outputStream* st) const;
 
+  bool contains(const void *ptr);
+
   void verify();
   void verify_chunk_size(Metachunk* chunk);
   NOT_PRODUCT(void mangle_freed_chunks();)
@@ -1159,8 +1163,6 @@
   } else {
     assert(new_entry->reserved_words() == vs_word_size,
         "Reserved memory size differs from requested memory size");
-    // ensure lock-free iteration sees fully initialized node
-    OrderAccess::storestore();
     link_vs(new_entry);
     return true;
   }
@@ -1287,19 +1289,6 @@
   }
 }
 
-bool VirtualSpaceList::contains(const void *ptr) {
-  VirtualSpaceNode* list = virtual_space_list();
-  VirtualSpaceListIterator iter(list);
-  while (iter.repeat()) {
-    VirtualSpaceNode* node = iter.get_next();
-    if (node->reserved()->contains(ptr)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-
 // MetaspaceGC methods
 
 // VM_CollectForMetadataAllocation is the vm operation used to GC.
@@ -2392,6 +2381,21 @@
   return result;
 }
 
+// This function looks at the chunks in the metaspace without locking.
+// The chunks are added with store ordering and not deleted except for at
+// unloading time.
+bool SpaceManager::contains(const void *ptr) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i))
+  {
+    Metachunk* curr = chunks_in_use(i);
+    while (curr != NULL) {
+      if (curr->contains(ptr)) return true;
+      curr = curr->next();
+    }
+  }
+  return false;
+}
+
 void SpaceManager::verify() {
   // If there are blocks in the dictionary, then
   // verfication of chunks does not work since
@@ -3463,17 +3467,12 @@
   }
 }
 
-bool Metaspace::contains(const void * ptr) {
-  if (MetaspaceShared::is_in_shared_space(ptr)) {
-    return true;
+bool Metaspace::contains(const void* ptr) {
+  if (vsm()->contains(ptr)) return true;
+  if (using_class_space()) {
+    return class_vsm()->contains(ptr);
   }
-  // This is checked while unlocked.  As long as the virtualspaces are added
-  // at the end, the pointer will be in one of them.  The virtual spaces
-  // aren't deleted presently.  When they are, some sort of locking might
-  // be needed.  Note, locking this can cause inversion problems with the
-  // caller in MetaspaceObj::is_metadata() function.
-  return space_list()->contains(ptr) ||
-         (using_class_space() && class_space_list()->contains(ptr));
+  return false;
 }
 
 void Metaspace::verify() {
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -225,7 +225,7 @@
   MetaWord* expand_and_allocate(size_t size,
                                 MetadataType mdtype);
 
-  static bool contains(const void *ptr);
+  bool contains(const void* ptr);
   void dump(outputStream* const out) const;
 
   // Free empty virtualspaces
--- a/hotspot/src/share/vm/oops/klass.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -376,8 +376,6 @@
 }
 
 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) {
-  assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace");
-
 #ifdef ASSERT
   // The class is alive iff the class loader is alive.
   oop loader = class_loader();
--- a/hotspot/src/share/vm/prims/forte.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/prims/forte.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -613,7 +613,7 @@
 #ifdef __APPLE__
 // XXXDARWIN: Link errors occur even when __attribute__((weak_import))
 // is added
-#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0)
+#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void)(0))
 #else
 void    collector_func_load(char* name,
                             void* null_argument_1,
--- a/hotspot/src/share/vm/prims/jni.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -1804,34 +1804,34 @@
 
 // the runtime type of subword integral basic types is integer
 DEFINE_CALLMETHODV(jboolean, Boolean, T_BOOLEAN
-                  , HOTSPOT_JNI_CALLBOOLEANMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLBOOLEANMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLBOOLEANMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLBOOLEANMETHODV_RETURN(_ret_ref))
 DEFINE_CALLMETHODV(jbyte,    Byte,    T_BYTE
-                  , HOTSPOT_JNI_CALLBYTEMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLBYTEMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLBYTEMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLBYTEMETHODV_RETURN(_ret_ref))
 DEFINE_CALLMETHODV(jchar,    Char,    T_CHAR
-                  , HOTSPOT_JNI_CALLCHARMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLCHARMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLCHARMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLCHARMETHODV_RETURN(_ret_ref))
 DEFINE_CALLMETHODV(jshort,   Short,   T_SHORT
-                  , HOTSPOT_JNI_CALLSHORTMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLSHORTMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLSHORTMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLSHORTMETHODV_RETURN(_ret_ref))
 
 DEFINE_CALLMETHODV(jobject,  Object,  T_OBJECT
-                  , HOTSPOT_JNI_CALLOBJECTMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLOBJECTMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLOBJECTMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLOBJECTMETHODV_RETURN(_ret_ref))
 DEFINE_CALLMETHODV(jint,     Int,     T_INT,
-                  HOTSPOT_JNI_CALLINTMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLINTMETHOD_RETURN(_ret_ref))
+                  HOTSPOT_JNI_CALLINTMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLINTMETHODV_RETURN(_ret_ref))
 DEFINE_CALLMETHODV(jlong,    Long,    T_LONG
-                  , HOTSPOT_JNI_CALLLONGMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLLONGMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLLONGMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLLONGMETHODV_RETURN(_ret_ref))
 // Float and double probes don't return value because dtrace doesn't currently support it
 DEFINE_CALLMETHODV(jfloat,   Float,   T_FLOAT
-                  , HOTSPOT_JNI_CALLFLOATMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLFLOATMETHOD_RETURN())
+                  , HOTSPOT_JNI_CALLFLOATMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLFLOATMETHODV_RETURN())
 DEFINE_CALLMETHODV(jdouble,  Double,  T_DOUBLE
-                  , HOTSPOT_JNI_CALLDOUBLEMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLDOUBLEMETHOD_RETURN())
+                  , HOTSPOT_JNI_CALLDOUBLEMETHODV_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLDOUBLEMETHODV_RETURN())
 
 #define DEFINE_CALLMETHODA(ResultType, Result, Tag \
                           , EntryProbe, ReturnProbe)    \
@@ -1856,34 +1856,34 @@
 
 // the runtime type of subword integral basic types is integer
 DEFINE_CALLMETHODA(jboolean, Boolean, T_BOOLEAN
-                  , HOTSPOT_JNI_CALLBOOLEANMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLBOOLEANMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLBOOLEANMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLBOOLEANMETHODA_RETURN(_ret_ref))
 DEFINE_CALLMETHODA(jbyte,    Byte,    T_BYTE
-                  , HOTSPOT_JNI_CALLBYTEMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLBYTEMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLBYTEMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLBYTEMETHODA_RETURN(_ret_ref))
 DEFINE_CALLMETHODA(jchar,    Char,    T_CHAR
-                  , HOTSPOT_JNI_CALLCHARMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLCHARMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLCHARMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLCHARMETHODA_RETURN(_ret_ref))
 DEFINE_CALLMETHODA(jshort,   Short,   T_SHORT
-                  , HOTSPOT_JNI_CALLSHORTMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLSHORTMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLSHORTMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLSHORTMETHODA_RETURN(_ret_ref))
 
 DEFINE_CALLMETHODA(jobject,  Object,  T_OBJECT
-                  , HOTSPOT_JNI_CALLOBJECTMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLOBJECTMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLOBJECTMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLOBJECTMETHODA_RETURN(_ret_ref))
 DEFINE_CALLMETHODA(jint,     Int,     T_INT,
-                  HOTSPOT_JNI_CALLINTMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLINTMETHOD_RETURN(_ret_ref))
+                  HOTSPOT_JNI_CALLINTMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLINTMETHODA_RETURN(_ret_ref))
 DEFINE_CALLMETHODA(jlong,    Long,    T_LONG
-                  , HOTSPOT_JNI_CALLLONGMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLLONGMETHOD_RETURN(_ret_ref))
+                  , HOTSPOT_JNI_CALLLONGMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLLONGMETHODA_RETURN(_ret_ref))
 // Float and double probes don't return value because dtrace doesn't currently support it
 DEFINE_CALLMETHODA(jfloat,   Float,   T_FLOAT
-                  , HOTSPOT_JNI_CALLFLOATMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLFLOATMETHOD_RETURN())
+                  , HOTSPOT_JNI_CALLFLOATMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLFLOATMETHODA_RETURN())
 DEFINE_CALLMETHODA(jdouble,  Double,  T_DOUBLE
-                  , HOTSPOT_JNI_CALLDOUBLEMETHOD_ENTRY(env, obj, (uintptr_t)methodID),
-                  HOTSPOT_JNI_CALLDOUBLEMETHOD_RETURN())
+                  , HOTSPOT_JNI_CALLDOUBLEMETHODA_ENTRY(env, obj, (uintptr_t)methodID),
+                  HOTSPOT_JNI_CALLDOUBLEMETHODA_RETURN())
 
 DT_VOID_RETURN_MARK_DECL(CallVoidMethod, HOTSPOT_JNI_CALLVOIDMETHOD_RETURN());
 DT_VOID_RETURN_MARK_DECL(CallVoidMethodV, HOTSPOT_JNI_CALLVOIDMETHODV_RETURN());
@@ -3145,7 +3145,7 @@
 JNI_END
 
 DEFINE_SETSTATICFIELD(jboolean, bool,   Boolean, 'Z', z
-                      , HOTSPOT_JNI_SETBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value),
+                      , HOTSPOT_JNI_SETSTATICBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value),
                       HOTSPOT_JNI_SETBOOLEANFIELD_RETURN())
 DEFINE_SETSTATICFIELD(jbyte,    byte,   Byte,    'B', b
                       , HOTSPOT_JNI_SETSTATICBYTEFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value),
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -3971,40 +3971,6 @@
 }
 
 
-// Internal SQE debugging support ///////////////////////////////////////////////////////////
-
-#ifndef PRODUCT
-
-extern "C" {
-  JNIEXPORT jboolean JNICALL JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get);
-  JNIEXPORT jboolean JNICALL JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get);
-  JNIEXPORT void JNICALL JVM_VMBreakPoint(JNIEnv *env, jobject obj);
-}
-
-JVM_LEAF(jboolean, JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get))
-  JVMWrapper("JVM_AccessBoolVMFlag");
-  return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, Flag::INTERNAL);
-JVM_END
-
-JVM_LEAF(jboolean, JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get))
-  JVMWrapper("JVM_AccessVMIntFlag");
-  intx v;
-  jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, Flag::INTERNAL);
-  *value = (jint)v;
-  return result;
-JVM_END
-
-
-JVM_ENTRY(void, JVM_VMBreakPoint(JNIEnv *env, jobject obj))
-  JVMWrapper("JVM_VMBreakPoint");
-  oop the_obj = JNIHandles::resolve(obj);
-  BREAKPOINT;
-JVM_END
-
-
-#endif
-
-
 // Method ///////////////////////////////////////////////////////////////////////////////////////////
 
 JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0))
--- a/hotspot/src/share/vm/runtime/globals.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -295,7 +295,7 @@
     else st->print("%-16s", "");
   }
 
-  st->print("%-20");
+  st->print("%-20s", " ");
   print_kind(st);
 
   if (withComments) {
@@ -702,8 +702,6 @@
   return true;
 }
 
-// Contract:  Flag will make private copy of the incoming value.
-// Outgoing value is always malloc-ed, and caller MUST call free.
 bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
@@ -726,7 +724,6 @@
   return true;
 }
 
-// Contract:  Flag will make private copy of the incoming value.
 void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -376,6 +376,8 @@
 
   static bool ccstrAt(char* name, size_t len, ccstr* value);
   static bool ccstrAt(char* name, ccstr* value)    { return ccstrAt(name, strlen(name), value); }
+  // Contract:  Flag will make private copy of the incoming value.
+  // Outgoing value is always malloc-ed, and caller MUST call free.
   static bool ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin);
   static bool ccstrAtPut(char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
 
--- a/hotspot/src/share/vm/runtime/globals_extension.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/globals_extension.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -201,6 +201,7 @@
   static void uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin);
   static void uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin);
   static void doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin);
+  // Contract:  Flag will make private copy of the incoming value
   static void ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin);
 
   static bool is_default(CommandLineFlag flag);
--- a/hotspot/src/share/vm/runtime/os.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/os.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -1081,7 +1081,6 @@
 
   }
 
-#ifndef PRODUCT
   // Check if in metaspace.
   if (ClassLoaderDataGraph::contains((address)addr)) {
     // Use addr->print() from the debugger instead (not here)
@@ -1089,7 +1088,6 @@
                  " is pointing into metadata", addr);
     return;
   }
-#endif
 
   // Try an OS specific find
   if (os::find(addr, st)) {
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, 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
@@ -155,7 +155,7 @@
 
 void PerfMemory::destroy() {
 
-  assert(_prologue != NULL, "prologue pointer must be initialized");
+  if (_prologue == NULL) return;
 
   if (_start != NULL && _prologue->overflow != 0) {
 
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -119,7 +119,7 @@
     }                                                                      \
   }
 
-#define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_PROBE_WAITED
+#define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_WAITED
 
 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread)                  \
   {                                                                        \
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -135,8 +135,8 @@
 
 #else /* USDT2 */
 
-#define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_PROBE_START
-#define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_PROBE_STOP
+#define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START
+#define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_STOP
 
 #define DTRACE_THREAD_PROBE(probe, javathread)                             \
   {                                                                        \
--- a/hotspot/src/share/vm/services/attachListener.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -451,15 +451,39 @@
   }
 }
 
+bool AttachListener::has_init_error(TRAPS) {
+  if (HAS_PENDING_EXCEPTION) {
+    tty->print_cr("Exception in VM (AttachListener::init) : ");
+    java_lang_Throwable::print(PENDING_EXCEPTION, tty);
+    tty->cr();
+
+    CLEAR_PENDING_EXCEPTION;
+
+    return true;
+  } else {
+    return false;
+  }
+}
+
 // Starts the Attach Listener thread
 void AttachListener::init() {
   EXCEPTION_MARK;
-  Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK);
+  Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, THREAD);
+  if (has_init_error(THREAD)) {
+    return;
+  }
+
   instanceKlassHandle klass (THREAD, k);
-  instanceHandle thread_oop = klass->allocate_instance_handle(CHECK);
+  instanceHandle thread_oop = klass->allocate_instance_handle(THREAD);
+  if (has_init_error(THREAD)) {
+    return;
+  }
 
   const char thread_name[] = "Attach Listener";
-  Handle string = java_lang_String::create_from_str(thread_name, CHECK);
+  Handle string = java_lang_String::create_from_str(thread_name, THREAD);
+  if (has_init_error(THREAD)) {
+    return;
+  }
 
   // Initialize thread_oop to put it into the system threadGroup
   Handle thread_group (THREAD, Universe::system_thread_group());
@@ -472,13 +496,7 @@
                        string,
                        THREAD);
 
-  if (HAS_PENDING_EXCEPTION) {
-    tty->print_cr("Exception in VM (AttachListener::init) : ");
-    java_lang_Throwable::print(PENDING_EXCEPTION, tty);
-    tty->cr();
-
-    CLEAR_PENDING_EXCEPTION;
-
+  if (has_init_error(THREAD)) {
     return;
   }
 
@@ -490,14 +508,7 @@
                         vmSymbols::thread_void_signature(),
                         thread_oop,             // ARG 1
                         THREAD);
-
-  if (HAS_PENDING_EXCEPTION) {
-    tty->print_cr("Exception in VM (AttachListener::init) : ");
-    java_lang_Throwable::print(PENDING_EXCEPTION, tty);
-    tty->cr();
-
-    CLEAR_PENDING_EXCEPTION;
-
+  if (has_init_error(THREAD)) {
     return;
   }
 
--- a/hotspot/src/share/vm/services/attachListener.hpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/services/attachListener.hpp	Wed Jan 08 13:53:24 2014 -0800
@@ -94,6 +94,9 @@
   // dequeue the next operation
   static AttachOperation* dequeue();
 #endif // !INCLUDE_SERVICES
+
+ private:
+  static bool has_init_error(TRAPS);
 };
 
 #if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/services/jmm.h	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/services/jmm.h	Wed Jan 08 13:53:24 2014 -0800
@@ -153,6 +153,7 @@
   JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR  = 4,   /* Set via environment variables */
   JMM_VMGLOBAL_ORIGIN_CONFIG_FILE  = 5,   /* Set via config file (such as .hotspotrc) */
   JMM_VMGLOBAL_ORIGIN_ERGONOMIC    = 6,   /* Set via ergonomic */
+  JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND = 7,   /* Set via attach */
   JMM_VMGLOBAL_ORIGIN_OTHER        = 99   /* Set via some other mechanism */
 } jmmVMGlobalOrigin;
 
--- a/hotspot/src/share/vm/services/management.cpp	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/src/share/vm/services/management.cpp	Wed Jan 08 13:53:24 2014 -0800
@@ -1724,6 +1724,9 @@
     case Flag::ERGONOMIC:
       global->origin = JMM_VMGLOBAL_ORIGIN_ERGONOMIC;
       break;
+    case Flag::ATTACH_ON_DEMAND:
+      global->origin = JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND;
+      break;
     default:
       global->origin = JMM_VMGLOBAL_ORIGIN_OTHER;
   }
@@ -1821,7 +1824,7 @@
               "This flag is not writeable.");
   }
 
-  bool succeed;
+  bool succeed = false;
   if (flag->is_bool()) {
     bool bvalue = (new_value.z == JNI_TRUE ? true : false);
     succeed = CommandLineFlags::boolAtPut(name, &bvalue, Flag::MANAGEMENT);
@@ -1841,6 +1844,9 @@
     }
     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);
+    }
   }
   assert(succeed, "Setting flag should succeed");
 JVM_END
--- a/hotspot/test/runtime/NMT/CommandLineDetail.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/test/runtime/NMT/CommandLineDetail.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,7 +24,7 @@
  /*
  * @test
  * @key nmt
- * @summary Running with NMT detail should not result in an error or warning
+ * @summary Running with NMT detail should not result in an error
  * @library /testlibrary
  */
 
@@ -39,7 +39,6 @@
       "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
     output.shouldNotContain("error");
-    output.shouldNotContain("warning");
     output.shouldHaveExitValue(0);
   }
 }
--- a/hotspot/test/runtime/NMT/CommandLineSummary.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/test/runtime/NMT/CommandLineSummary.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,7 +24,7 @@
  /*
  * @test
  * @key nmt
- * @summary Running with NMT summary should not result in an error or warning
+ * @summary Running with NMT summary should not result in an error
  * @library /testlibrary
  */
 
@@ -39,7 +39,6 @@
       "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
     output.shouldNotContain("error");
-    output.shouldNotContain("warning");
     output.shouldHaveExitValue(0);
   }
 }
--- a/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java	Wed Jan 08 13:53:24 2014 -0800
@@ -24,7 +24,7 @@
  /*
  * @test
  * @key nmt
- * @summary Turning off NMT should not result in an error or warning
+ * @summary Turning off NMT should not result in an error
  * @library /testlibrary
  */
 
@@ -38,7 +38,6 @@
               "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
     output.shouldNotContain("error");
-    output.shouldNotContain("warning");
     output.shouldHaveExitValue(0);
   }
 }
--- a/hotspot/test/runtime/NMT/PrintNMTStatistics.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/test/runtime/NMT/PrintNMTStatistics.java	Wed Jan 08 13:53:24 2014 -0800
@@ -64,7 +64,6 @@
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
     output.shouldContain("Java Heap (reserved=");
     output.shouldNotContain("error");
-    output.shouldNotContain("warning");
     output.shouldHaveExitValue(0);
   }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java	Wed Jan 08 13:53:24 2014 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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
+ * @bug 8030955
+ * @summary Allow multiple calls to PerfMemory::destroy() without asserting.
+ * @library /testlibrary
+ * @run main PerfMemDestroy
+ */
+
+import java.io.File;
+import java.util.Map;
+import com.oracle.java.testlibrary.*;
+
+public class PerfMemDestroy {
+    public static void main(String args[]) throws Throwable {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PerfAllowAtExitRegistration", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+    }
+}
--- a/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java	Thu Dec 26 11:16:44 2013 -0500
+++ b/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java	Wed Jan 08 13:53:24 2014 -0800
@@ -22,7 +22,6 @@
  */
 
 /*
- * @ignore 8023735
  * @test
  * @bug 7051189 8023393
  * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
@@ -30,7 +29,8 @@
  * @run main XCheckJSig
  */
 
-import java.util.*;
+import java.io.File;
+import java.util.Map;
 import com.oracle.java.testlibrary.*;
 
 public class XCheckJSig {
@@ -47,33 +47,36 @@
         String libjsig;
         String env_var;
         if (Platform.isOSX()) {
-            libjsig = jdk_path + "/jre/lib/server/libjsig.dylib";
             env_var = "DYLD_INSERT_LIBRARIES";
+            libjsig = jdk_path + "/jre/lib/libjsig.dylib"; // jdk location
+            if (!(new File(libjsig).exists())) {
+                libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
+            }
         } else {
-            libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so";
             env_var = "LD_PRELOAD";
-        }
-        String java_program;
-        if (Platform.isSolaris()) {
-            // On Solaris, need to call the 64-bit Java directly in order for
-            // LD_PRELOAD to work because libjsig.so is 64-bit.
-            java_program = jdk_path + "/jre/bin/" + os_arch + "/java";
-        } else {
-            java_program = JDKToolFinder.getJDKTool("java");
+            libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; // jdk location
+            if (!(new File(libjsig).exists())) {
+                libjsig = jdk_path + "/lib/" + os_arch + "/libjsig.so"; // jre location
+            }
         }
         // If this test fails, these might be useful to know.
         System.out.println("libjsig: " + libjsig);
         System.out.println("osArch: " + os_arch);
-        System.out.println("java_program: " + java_program);
 
-        ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version");
+        // Make sure the libjsig file exists.
+        if (!(new File(libjsig).exists())) {
+            System.out.println("File " + libjsig + " not found, skipping");
+            return;
+        }
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");
         Map<String, String> env = pb.environment();
         env.put(env_var, libjsig);
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldNotContain("libjsig is activated");
         output.shouldHaveExitValue(0);
 
-        pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version");
+        pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-verbose:jni", "-version");
         env = pb.environment();
         env.put(env_var, libjsig);
         output = new OutputAnalyzer(pb.start());