Merge
authorzgu
Wed, 01 Aug 2012 16:16:13 -0700
changeset 13472 32225c19cefc
parent 13469 9a2973794d8c (current diff)
parent 13471 d831cb656c1f (diff)
child 13473 9bbabe271025
Merge
--- a/hotspot/src/share/vm/services/memSnapshot.cpp	Wed Aug 01 16:52:43 2012 -0400
+++ b/hotspot/src/share/vm/services/memSnapshot.cpp	Wed Aug 01 16:16:13 2012 -0700
@@ -344,7 +344,7 @@
           // due to platform dependent behaviors. On some platforms, we see uncommit/release
           // native thread stack, but some, we don't.
           if (!cur_vm->is_uncommit_record() && !cur_vm->is_deallocation_record()) {
-            ShouldNotReachHere();
+            fatal(err_msg("Should not reach here, pointer flags = [%x]", cur_vm->flags()));
           }
 #endif
         }
--- a/hotspot/src/share/vm/services/memSnapshot.hpp	Wed Aug 01 16:52:43 2012 -0400
+++ b/hotspot/src/share/vm/services/memSnapshot.hpp	Wed Aug 01 16:16:13 2012 -0700
@@ -63,13 +63,13 @@
       MemPointer* p1 = (MemPointer*)ptr;
       MemPointer* p2 = (MemPointer*)_array->at(_pos - 1);
       assert(!is_dup_pointer(p1, p2),
-        "dup pointer");
+        err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
     }
      if (_pos < _array->length() -1) {
       MemPointer* p1 = (MemPointer*)ptr;
       MemPointer* p2 = (MemPointer*)_array->at(_pos + 1);
       assert(!is_dup_pointer(p1, p2),
-        "dup pointer");
+        err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
      }
     return _array->insert_at(ptr, _pos);
   }
@@ -79,14 +79,14 @@
       MemPointer* p1 = (MemPointer*)ptr;
       MemPointer* p2 = (MemPointer*)_array->at(_pos - 1);
       assert(!is_dup_pointer(p1, p2),
-        "dup pointer");
+        err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
     }
     if (_pos < _array->length() - 1) {
       MemPointer* p1 = (MemPointer*)ptr;
       MemPointer* p2 = (MemPointer*)_array->at(_pos + 1);
 
       assert(!is_dup_pointer(p1, p2),
-        "dup pointer");
+        err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
      }
     if (_array->insert_at(ptr, _pos + 1)) {
       _pos ++;
--- a/hotspot/src/share/vm/services/memTrackWorker.cpp	Wed Aug 01 16:52:43 2012 -0400
+++ b/hotspot/src/share/vm/services/memTrackWorker.cpp	Wed Aug 01 16:16:13 2012 -0700
@@ -99,9 +99,11 @@
     }
     if (rec != NULL) {
       // merge the recorder into staging area
-      bool result = snapshot->merge(rec);
-      assert(result, "merge failed");
-      debug_only(_merge_count ++;)
+      if (!snapshot->merge(rec)) {
+        MemTracker::shutdown(MemTracker::NMT_out_of_memory);
+      } else {
+        NOT_PRODUCT(_merge_count ++;)
+      }
       MemTracker::release_thread_recorder(rec);
     } else {
       // no more recorder to merge, promote staging area
@@ -129,7 +131,7 @@
   }
   assert(MemTracker::shutdown_in_progress(), "just check");
 
-  // transites to final shutdown
+  // transits to final shutdown
   MemTracker::final_shutdown();
 }
 
--- a/hotspot/src/share/vm/services/memTracker.hpp	Wed Aug 01 16:52:43 2012 -0400
+++ b/hotspot/src/share/vm/services/memTracker.hpp	Wed Aug 01 16:16:13 2012 -0700
@@ -184,7 +184,6 @@
   // record a 'malloc' call
   static inline void record_malloc(address addr, size_t size, MEMFLAGS flags,
                             address pc = 0, Thread* thread = NULL) {
-    assert(is_on(), "check by caller");
     if (NMT_CAN_TRACK(flags)) {
       create_memory_record(addr, (flags|MemPointerRecord::malloc_tag()), size, pc, thread);
     }
@@ -285,7 +284,6 @@
 
   // retrieve global snapshot
   static MemSnapshot* get_snapshot() {
-    assert(is_on(), "native memory tracking is off");
     if (shutdown_in_progress()) {
       return NULL;
     }