src/share/vm/services/g1MemoryPool.cpp

changeset 2821
b52782ae3880
parent 2314
f95d63e2154a
child 3170
114e52976463
     1.1 --- a/src/share/vm/services/g1MemoryPool.cpp	Thu Apr 21 01:16:20 2011 -0700
     1.2 +++ b/src/share/vm/services/g1MemoryPool.cpp	Thu Apr 21 10:23:44 2011 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -34,10 +34,10 @@
    1.11                                       size_t init_size,
    1.12                                       bool support_usage_threshold) :
    1.13    _g1h(g1h), CollectedMemoryPool(name,
    1.14 -                                 MemoryPool::Heap,
    1.15 -                                 init_size,
    1.16 -                                 undefined_max(),
    1.17 -                                 support_usage_threshold) {
    1.18 +                                   MemoryPool::Heap,
    1.19 +                                   init_size,
    1.20 +                                   undefined_max(),
    1.21 +                                   support_usage_threshold) {
    1.22    assert(UseG1GC, "sanity");
    1.23  }
    1.24  
    1.25 @@ -48,44 +48,27 @@
    1.26  
    1.27  // See the comment at the top of g1MemoryPool.hpp
    1.28  size_t G1MemoryPoolSuper::eden_space_used(G1CollectedHeap* g1h) {
    1.29 -  size_t young_list_length = g1h->young_list()->length();
    1.30 -  size_t eden_used = young_list_length * HeapRegion::GrainBytes;
    1.31 -  size_t survivor_used = survivor_space_used(g1h);
    1.32 -  eden_used = subtract_up_to_zero(eden_used, survivor_used);
    1.33 -  return eden_used;
    1.34 +  return g1h->g1mm()->eden_space_used();
    1.35  }
    1.36  
    1.37  // See the comment at the top of g1MemoryPool.hpp
    1.38  size_t G1MemoryPoolSuper::survivor_space_committed(G1CollectedHeap* g1h) {
    1.39 -  return MAX2(survivor_space_used(g1h), (size_t) HeapRegion::GrainBytes);
    1.40 +  return g1h->g1mm()->survivor_space_committed();
    1.41  }
    1.42  
    1.43  // See the comment at the top of g1MemoryPool.hpp
    1.44  size_t G1MemoryPoolSuper::survivor_space_used(G1CollectedHeap* g1h) {
    1.45 -  size_t survivor_num = g1h->g1_policy()->recorded_survivor_regions();
    1.46 -  size_t survivor_used = survivor_num * HeapRegion::GrainBytes;
    1.47 -  return survivor_used;
    1.48 +  return g1h->g1mm()->survivor_space_used();
    1.49  }
    1.50  
    1.51  // See the comment at the top of g1MemoryPool.hpp
    1.52  size_t G1MemoryPoolSuper::old_space_committed(G1CollectedHeap* g1h) {
    1.53 -  size_t committed = overall_committed(g1h);
    1.54 -  size_t eden_committed = eden_space_committed(g1h);
    1.55 -  size_t survivor_committed = survivor_space_committed(g1h);
    1.56 -  committed = subtract_up_to_zero(committed, eden_committed);
    1.57 -  committed = subtract_up_to_zero(committed, survivor_committed);
    1.58 -  committed = MAX2(committed, (size_t) HeapRegion::GrainBytes);
    1.59 -  return committed;
    1.60 +  return g1h->g1mm()->old_space_committed();
    1.61  }
    1.62  
    1.63  // See the comment at the top of g1MemoryPool.hpp
    1.64  size_t G1MemoryPoolSuper::old_space_used(G1CollectedHeap* g1h) {
    1.65 -  size_t used = overall_used(g1h);
    1.66 -  size_t eden_used = eden_space_used(g1h);
    1.67 -  size_t survivor_used = survivor_space_used(g1h);
    1.68 -  used = subtract_up_to_zero(used, eden_used);
    1.69 -  used = subtract_up_to_zero(used, survivor_used);
    1.70 -  return used;
    1.71 +  return g1h->g1mm()->old_space_used();
    1.72  }
    1.73  
    1.74  G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) :

mercurial