src/share/vm/services/memSnapshot.cpp

changeset 3994
e5bf1c79ed5b
parent 3986
4acebbe310e1
child 4053
33143ee07800
     1.1 --- a/src/share/vm/services/memSnapshot.cpp	Fri Aug 10 23:16:52 2012 -0700
     1.2 +++ b/src/share/vm/services/memSnapshot.cpp	Tue Aug 14 13:56:46 2012 -0400
     1.3 @@ -338,15 +338,13 @@
     1.4              vm_itr.insert_after(cur_vm);
     1.5            }
     1.6          } else {
     1.7 -#ifdef ASSERT
     1.8            // In theory, we should assert without conditions. However, in case of native
     1.9            // thread stack, NMT explicitly releases the thread stack in Thread's destructor,
    1.10            // due to platform dependent behaviors. On some platforms, we see uncommit/release
    1.11            // native thread stack, but some, we don't.
    1.12 -          if (!cur_vm->is_uncommit_record() && !cur_vm->is_deallocation_record()) {
    1.13 -            fatal(err_msg("Should not reach here, pointer flags = [%x]", cur_vm->flags()));
    1.14 -          }
    1.15 -#endif
    1.16 +          assert(cur_vm->is_uncommit_record() || cur_vm->is_deallocation_record(),
    1.17 +            err_msg("Should not reach here, pointer addr = [" INTPTR_FORMAT "], flags = [%x]",
    1.18 +               cur_vm->addr(), cur_vm->flags()));
    1.19          }
    1.20        }
    1.21      } else {
    1.22 @@ -406,7 +404,7 @@
    1.23  }
    1.24  
    1.25  
    1.26 -#ifdef ASSERT
    1.27 +#ifndef PRODUCT
    1.28  void MemSnapshot::print_snapshot_stats(outputStream* st) {
    1.29    st->print_cr("Snapshot:");
    1.30    st->print_cr("\tMalloced: %d/%d [%5.2f%%]  %dKB", _alloc_ptrs->length(), _alloc_ptrs->capacity(),
    1.31 @@ -434,6 +432,20 @@
    1.32    }
    1.33  }
    1.34  
    1.35 +bool MemSnapshot::has_allocation_record(address addr) {
    1.36 +  MemPointerArrayIteratorImpl itr(_staging_area);
    1.37 +  MemPointerRecord* cur = (MemPointerRecord*)itr.current();
    1.38 +  while (cur != NULL) {
    1.39 +    if (cur->addr() == addr && cur->is_allocation_record()) {
    1.40 +      return true;
    1.41 +    }
    1.42 +    cur = (MemPointerRecord*)itr.next();
    1.43 +  }
    1.44 +  return false;
    1.45 +}
    1.46 +#endif // PRODUCT
    1.47 +
    1.48 +#ifdef ASSERT
    1.49  void MemSnapshot::check_staging_data() {
    1.50    MemPointerArrayIteratorImpl itr(_staging_area);
    1.51    MemPointerRecord* cur = (MemPointerRecord*)itr.current();
    1.52 @@ -447,17 +459,5 @@
    1.53      next = (MemPointerRecord*)itr.next();
    1.54    }
    1.55  }
    1.56 +#endif // ASSERT
    1.57  
    1.58 -bool MemSnapshot::has_allocation_record(address addr) {
    1.59 -  MemPointerArrayIteratorImpl itr(_staging_area);
    1.60 -  MemPointerRecord* cur = (MemPointerRecord*)itr.current();
    1.61 -  while (cur != NULL) {
    1.62 -    if (cur->addr() == addr && cur->is_allocation_record()) {
    1.63 -      return true;
    1.64 -    }
    1.65 -    cur = (MemPointerRecord*)itr.next();
    1.66 -  }
    1.67 -  return false;
    1.68 -}
    1.69 -
    1.70 -#endif

mercurial