src/share/vm/services/memBaseline.cpp

changeset 7080
dd3939fe8424
parent 7074
833b0f92429a
child 7535
7ae4e26cb1e0
child 9054
db49d511817a
     1.1 --- a/src/share/vm/services/memBaseline.cpp	Tue Aug 19 09:05:55 2014 -0400
     1.2 +++ b/src/share/vm/services/memBaseline.cpp	Wed Aug 20 08:41:15 2014 -0400
     1.3 @@ -70,15 +70,13 @@
     1.4   */
     1.5  class MallocAllocationSiteWalker : public MallocSiteWalker {
     1.6   private:
     1.7 -  SortedLinkedList<MallocSite, compare_malloc_size, ResourceObj::ARENA>
     1.8 -                 _malloc_sites;
     1.9 +  SortedLinkedList<MallocSite, compare_malloc_size> _malloc_sites;
    1.10    size_t         _count;
    1.11  
    1.12    // Entries in MallocSiteTable with size = 0 and count = 0,
    1.13    // when the malloc site is not longer there.
    1.14   public:
    1.15 -  MallocAllocationSiteWalker(Arena* arena) : _count(0), _malloc_sites(arena) {
    1.16 -  }
    1.17 +  MallocAllocationSiteWalker() : _count(0) { }
    1.18  
    1.19    inline size_t count() const { return _count; }
    1.20  
    1.21 @@ -109,13 +107,12 @@
    1.22  // Walk all virtual memory regions for baselining
    1.23  class VirtualMemoryAllocationWalker : public VirtualMemoryWalker {
    1.24   private:
    1.25 -  SortedLinkedList<ReservedMemoryRegion, compare_virtual_memory_base, ResourceObj::ARENA>
    1.26 +  SortedLinkedList<ReservedMemoryRegion, compare_virtual_memory_base>
    1.27                  _virtual_memory_regions;
    1.28    size_t        _count;
    1.29  
    1.30   public:
    1.31 -  VirtualMemoryAllocationWalker(Arena* a) : _count(0), _virtual_memory_regions(a) {
    1.32 -  }
    1.33 +  VirtualMemoryAllocationWalker() : _count(0) { }
    1.34  
    1.35    bool do_allocation_site(const ReservedMemoryRegion* rgn)  {
    1.36      if (rgn->size() >= MemBaseline::SIZE_THRESHOLD) {
    1.37 @@ -136,39 +133,30 @@
    1.38  
    1.39  
    1.40  bool MemBaseline::baseline_summary() {
    1.41 -  assert(_malloc_memory_snapshot == NULL, "Malloc baseline not yet reset");
    1.42 -  assert(_virtual_memory_snapshot == NULL, "Virtual baseline not yet reset");
    1.43 -
    1.44 -  _malloc_memory_snapshot =  new (arena()) MallocMemorySnapshot();
    1.45 -  _virtual_memory_snapshot = new (arena()) VirtualMemorySnapshot();
    1.46 -  if (_malloc_memory_snapshot == NULL || _virtual_memory_snapshot == NULL) {
    1.47 -    return false;
    1.48 -  }
    1.49 -  MallocMemorySummary::snapshot(_malloc_memory_snapshot);
    1.50 -  VirtualMemorySummary::snapshot(_virtual_memory_snapshot);
    1.51 +  MallocMemorySummary::snapshot(&_malloc_memory_snapshot);
    1.52 +  VirtualMemorySummary::snapshot(&_virtual_memory_snapshot);
    1.53    return true;
    1.54  }
    1.55  
    1.56  bool MemBaseline::baseline_allocation_sites() {
    1.57 -  assert(arena() != NULL, "Just check");
    1.58    // Malloc allocation sites
    1.59 -  MallocAllocationSiteWalker malloc_walker(arena());
    1.60 +  MallocAllocationSiteWalker malloc_walker;
    1.61    if (!MallocSiteTable::walk_malloc_site(&malloc_walker)) {
    1.62      return false;
    1.63    }
    1.64  
    1.65 -  _malloc_sites.set_head(malloc_walker.malloc_sites()->head());
    1.66 +  _malloc_sites.move(malloc_walker.malloc_sites());
    1.67    // The malloc sites are collected in size order
    1.68    _malloc_sites_order = by_size;
    1.69  
    1.70    // Virtual memory allocation sites
    1.71 -  VirtualMemoryAllocationWalker virtual_memory_walker(arena());
    1.72 +  VirtualMemoryAllocationWalker virtual_memory_walker;
    1.73    if (!VirtualMemoryTracker::walk_virtual_memory(&virtual_memory_walker)) {
    1.74      return false;
    1.75    }
    1.76  
    1.77    // Virtual memory allocations are collected in call stack order
    1.78 -  _virtual_memory_allocations.set_head(virtual_memory_walker.virtual_memory_allocations()->head());
    1.79 +  _virtual_memory_allocations.move(virtual_memory_walker.virtual_memory_allocations());
    1.80  
    1.81    if (!aggregate_virtual_memory_allocation_sites()) {
    1.82      return false;
    1.83 @@ -180,11 +168,6 @@
    1.84  }
    1.85  
    1.86  bool MemBaseline::baseline(bool summaryOnly) {
    1.87 -  if (arena() == NULL) {
    1.88 -    _arena = new (std::nothrow, mtNMT) Arena(mtNMT);
    1.89 -    if (arena() == NULL) return false;
    1.90 -  }
    1.91 -
    1.92    reset();
    1.93  
    1.94    _class_count = InstanceKlass::number_of_instance_classes();
    1.95 @@ -211,8 +194,7 @@
    1.96  }
    1.97  
    1.98  bool MemBaseline::aggregate_virtual_memory_allocation_sites() {
    1.99 -  SortedLinkedList<VirtualMemoryAllocationSite, compare_allocation_site, ResourceObj::ARENA>
   1.100 -    allocation_sites(arena());
   1.101 +  SortedLinkedList<VirtualMemoryAllocationSite, compare_allocation_site> allocation_sites;
   1.102  
   1.103    VirtualMemoryAllocationIterator itr = virtual_memory_allocations();
   1.104    const ReservedMemoryRegion* rgn;
   1.105 @@ -230,12 +212,12 @@
   1.106      site->commit_memory(rgn->committed_size());
   1.107    }
   1.108  
   1.109 -  _virtual_memory_sites.set_head(allocation_sites.head());
   1.110 +  _virtual_memory_sites.move(&allocation_sites);
   1.111    return true;
   1.112  }
   1.113  
   1.114  MallocSiteIterator MemBaseline::malloc_sites(SortingOrder order) {
   1.115 -  assert(!_malloc_sites.is_empty(), "Detail baseline?");
   1.116 +  assert(!_malloc_sites.is_empty(), "Not detail baseline");
   1.117    switch(order) {
   1.118      case by_size:
   1.119        malloc_sites_to_size_order();
   1.120 @@ -251,7 +233,7 @@
   1.121  }
   1.122  
   1.123  VirtualMemorySiteIterator MemBaseline::virtual_memory_sites(SortingOrder order) {
   1.124 -  assert(!_virtual_memory_sites.is_empty(), "Detail baseline?");
   1.125 +  assert(!_virtual_memory_sites.is_empty(), "Not detail baseline");
   1.126    switch(order) {
   1.127      case by_size:
   1.128        virtual_memory_sites_to_size_order();
   1.129 @@ -270,8 +252,7 @@
   1.130  // Sorting allocations sites in different orders
   1.131  void MemBaseline::malloc_sites_to_size_order() {
   1.132    if (_malloc_sites_order != by_size) {
   1.133 -    SortedLinkedList<MallocSite, compare_malloc_size, ResourceObj::ARENA>
   1.134 -      tmp(arena());
   1.135 +    SortedLinkedList<MallocSite, compare_malloc_size> tmp;
   1.136  
   1.137      // Add malloc sites to sorted linked list to sort into size order
   1.138      tmp.move(&_malloc_sites);
   1.139 @@ -283,8 +264,7 @@
   1.140  
   1.141  void MemBaseline::malloc_sites_to_allocation_site_order() {
   1.142    if (_malloc_sites_order != by_site) {
   1.143 -    SortedLinkedList<MallocSite, compare_malloc_site, ResourceObj::ARENA>
   1.144 -      tmp(arena());
   1.145 +    SortedLinkedList<MallocSite, compare_malloc_site> tmp;
   1.146      // Add malloc sites to sorted linked list to sort into site (address) order
   1.147      tmp.move(&_malloc_sites);
   1.148      _malloc_sites.set_head(tmp.head());
   1.149 @@ -295,8 +275,7 @@
   1.150  
   1.151  void MemBaseline::virtual_memory_sites_to_size_order() {
   1.152    if (_virtual_memory_sites_order != by_size) {
   1.153 -    SortedLinkedList<VirtualMemoryAllocationSite, compare_virtual_memory_size, ResourceObj::ARENA>
   1.154 -      tmp(arena());
   1.155 +    SortedLinkedList<VirtualMemoryAllocationSite, compare_virtual_memory_size> tmp;
   1.156  
   1.157      tmp.move(&_virtual_memory_sites);
   1.158  
   1.159 @@ -308,10 +287,9 @@
   1.160  
   1.161  void MemBaseline::virtual_memory_sites_to_reservation_site_order() {
   1.162    if (_virtual_memory_sites_order != by_size) {
   1.163 -    SortedLinkedList<VirtualMemoryAllocationSite, compare_virtual_memory_site, ResourceObj::ARENA>
   1.164 -      tmp(arena());
   1.165 +    SortedLinkedList<VirtualMemoryAllocationSite, compare_virtual_memory_site> tmp;
   1.166  
   1.167 -    tmp.add(&_virtual_memory_sites);
   1.168 +    tmp.move(&_virtual_memory_sites);
   1.169  
   1.170      _virtual_memory_sites.set_head(tmp.head());
   1.171      tmp.set_head(NULL);

mercurial