src/share/vm/memory/metaspace.cpp

changeset 6609
270d7cb38f40
parent 6420
9fdaa79b0c27
child 6678
7384f6a12fc1
     1.1 --- a/src/share/vm/memory/metaspace.cpp	Wed Mar 26 14:15:02 2014 +0100
     1.2 +++ b/src/share/vm/memory/metaspace.cpp	Mon Mar 31 17:09:38 2014 +0200
     1.3 @@ -1447,7 +1447,7 @@
     1.4    uint current_shrink_factor = _shrink_factor;
     1.5    _shrink_factor = 0;
     1.6  
     1.7 -  const size_t used_after_gc = MetaspaceAux::allocated_capacity_bytes();
     1.8 +  const size_t used_after_gc = MetaspaceAux::capacity_bytes();
     1.9    const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC();
    1.10  
    1.11    const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0;
    1.12 @@ -2537,8 +2537,8 @@
    1.13  // MetaspaceAux
    1.14  
    1.15  
    1.16 -size_t MetaspaceAux::_allocated_capacity_words[] = {0, 0};
    1.17 -size_t MetaspaceAux::_allocated_used_words[] = {0, 0};
    1.18 +size_t MetaspaceAux::_capacity_words[] = {0, 0};
    1.19 +size_t MetaspaceAux::_used_words[] = {0, 0};
    1.20  
    1.21  size_t MetaspaceAux::free_bytes(Metaspace::MetadataType mdtype) {
    1.22    VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
    1.23 @@ -2551,38 +2551,38 @@
    1.24  
    1.25  void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
    1.26    assert_lock_strong(SpaceManager::expand_lock());
    1.27 -  assert(words <= allocated_capacity_words(mdtype),
    1.28 +  assert(words <= capacity_words(mdtype),
    1.29      err_msg("About to decrement below 0: words " SIZE_FORMAT
    1.30 -            " is greater than _allocated_capacity_words[%u] " SIZE_FORMAT,
    1.31 -            words, mdtype, allocated_capacity_words(mdtype)));
    1.32 -  _allocated_capacity_words[mdtype] -= words;
    1.33 +            " is greater than _capacity_words[%u] " SIZE_FORMAT,
    1.34 +            words, mdtype, capacity_words(mdtype)));
    1.35 +  _capacity_words[mdtype] -= words;
    1.36  }
    1.37  
    1.38  void MetaspaceAux::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
    1.39    assert_lock_strong(SpaceManager::expand_lock());
    1.40    // Needs to be atomic
    1.41 -  _allocated_capacity_words[mdtype] += words;
    1.42 +  _capacity_words[mdtype] += words;
    1.43  }
    1.44  
    1.45  void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) {
    1.46 -  assert(words <= allocated_used_words(mdtype),
    1.47 +  assert(words <= used_words(mdtype),
    1.48      err_msg("About to decrement below 0: words " SIZE_FORMAT
    1.49 -            " is greater than _allocated_used_words[%u] " SIZE_FORMAT,
    1.50 -            words, mdtype, allocated_used_words(mdtype)));
    1.51 +            " is greater than _used_words[%u] " SIZE_FORMAT,
    1.52 +            words, mdtype, used_words(mdtype)));
    1.53    // For CMS deallocation of the Metaspaces occurs during the
    1.54    // sweep which is a concurrent phase.  Protection by the expand_lock()
    1.55    // is not enough since allocation is on a per Metaspace basis
    1.56    // and protected by the Metaspace lock.
    1.57    jlong minus_words = (jlong) - (jlong) words;
    1.58 -  Atomic::add_ptr(minus_words, &_allocated_used_words[mdtype]);
    1.59 +  Atomic::add_ptr(minus_words, &_used_words[mdtype]);
    1.60  }
    1.61  
    1.62  void MetaspaceAux::inc_used(Metaspace::MetadataType mdtype, size_t words) {
    1.63 -  // _allocated_used_words tracks allocations for
    1.64 +  // _used_words tracks allocations for
    1.65    // each piece of metadata.  Those allocations are
    1.66    // generally done concurrently by different application
    1.67    // threads so must be done atomically.
    1.68 -  Atomic::add_ptr(words, &_allocated_used_words[mdtype]);
    1.69 +  Atomic::add_ptr(words, &_used_words[mdtype]);
    1.70  }
    1.71  
    1.72  size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {
    1.73 @@ -2629,16 +2629,16 @@
    1.74  
    1.75  size_t MetaspaceAux::capacity_bytes_slow() {
    1.76  #ifdef PRODUCT
    1.77 -  // Use allocated_capacity_bytes() in PRODUCT instead of this function.
    1.78 +  // Use capacity_bytes() in PRODUCT instead of this function.
    1.79    guarantee(false, "Should not call capacity_bytes_slow() in the PRODUCT");
    1.80  #endif
    1.81    size_t class_capacity = capacity_bytes_slow(Metaspace::ClassType);
    1.82    size_t non_class_capacity = capacity_bytes_slow(Metaspace::NonClassType);
    1.83 -  assert(allocated_capacity_bytes() == class_capacity + non_class_capacity,
    1.84 -      err_msg("bad accounting: allocated_capacity_bytes() " SIZE_FORMAT
    1.85 +  assert(capacity_bytes() == class_capacity + non_class_capacity,
    1.86 +      err_msg("bad accounting: capacity_bytes() " SIZE_FORMAT
    1.87          " class_capacity + non_class_capacity " SIZE_FORMAT
    1.88          " class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT,
    1.89 -        allocated_capacity_bytes(), class_capacity + non_class_capacity,
    1.90 +        capacity_bytes(), class_capacity + non_class_capacity,
    1.91          class_capacity, non_class_capacity));
    1.92  
    1.93    return class_capacity + non_class_capacity;
    1.94 @@ -2698,14 +2698,14 @@
    1.95                          "->" SIZE_FORMAT
    1.96                          "("  SIZE_FORMAT ")",
    1.97                          prev_metadata_used,
    1.98 -                        allocated_used_bytes(),
    1.99 +                        used_bytes(),
   1.100                          reserved_bytes());
   1.101    } else {
   1.102      gclog_or_tty->print(" "  SIZE_FORMAT "K"
   1.103                          "->" SIZE_FORMAT "K"
   1.104                          "("  SIZE_FORMAT "K)",
   1.105                          prev_metadata_used/K,
   1.106 -                        allocated_used_bytes()/K,
   1.107 +                        used_bytes()/K,
   1.108                          reserved_bytes()/K);
   1.109    }
   1.110  
   1.111 @@ -2721,8 +2721,8 @@
   1.112                  "capacity "  SIZE_FORMAT "K, "
   1.113                  "committed " SIZE_FORMAT "K, "
   1.114                  "reserved "  SIZE_FORMAT "K",
   1.115 -                allocated_used_bytes()/K,
   1.116 -                allocated_capacity_bytes()/K,
   1.117 +                used_bytes()/K,
   1.118 +                capacity_bytes()/K,
   1.119                  committed_bytes()/K,
   1.120                  reserved_bytes()/K);
   1.121  
   1.122 @@ -2733,8 +2733,8 @@
   1.123                    "capacity "  SIZE_FORMAT "K, "
   1.124                    "committed " SIZE_FORMAT "K, "
   1.125                    "reserved "  SIZE_FORMAT "K",
   1.126 -                  allocated_used_bytes(ct)/K,
   1.127 -                  allocated_capacity_bytes(ct)/K,
   1.128 +                  used_bytes(ct)/K,
   1.129 +                  capacity_bytes(ct)/K,
   1.130                    committed_bytes(ct)/K,
   1.131                    reserved_bytes(ct)/K);
   1.132    }
   1.133 @@ -2836,42 +2836,42 @@
   1.134  
   1.135  void MetaspaceAux::verify_capacity() {
   1.136  #ifdef ASSERT
   1.137 -  size_t running_sum_capacity_bytes = allocated_capacity_bytes();
   1.138 +  size_t running_sum_capacity_bytes = capacity_bytes();
   1.139    // For purposes of the running sum of capacity, verify against capacity
   1.140    size_t capacity_in_use_bytes = capacity_bytes_slow();
   1.141    assert(running_sum_capacity_bytes == capacity_in_use_bytes,
   1.142 -    err_msg("allocated_capacity_words() * BytesPerWord " SIZE_FORMAT
   1.143 +    err_msg("capacity_words() * BytesPerWord " SIZE_FORMAT
   1.144              " capacity_bytes_slow()" SIZE_FORMAT,
   1.145              running_sum_capacity_bytes, capacity_in_use_bytes));
   1.146    for (Metaspace::MetadataType i = Metaspace::ClassType;
   1.147         i < Metaspace:: MetadataTypeCount;
   1.148         i = (Metaspace::MetadataType)(i + 1)) {
   1.149      size_t capacity_in_use_bytes = capacity_bytes_slow(i);
   1.150 -    assert(allocated_capacity_bytes(i) == capacity_in_use_bytes,
   1.151 -      err_msg("allocated_capacity_bytes(%u) " SIZE_FORMAT
   1.152 +    assert(capacity_bytes(i) == capacity_in_use_bytes,
   1.153 +      err_msg("capacity_bytes(%u) " SIZE_FORMAT
   1.154                " capacity_bytes_slow(%u)" SIZE_FORMAT,
   1.155 -              i, allocated_capacity_bytes(i), i, capacity_in_use_bytes));
   1.156 +              i, capacity_bytes(i), i, capacity_in_use_bytes));
   1.157    }
   1.158  #endif
   1.159  }
   1.160  
   1.161  void MetaspaceAux::verify_used() {
   1.162  #ifdef ASSERT
   1.163 -  size_t running_sum_used_bytes = allocated_used_bytes();
   1.164 +  size_t running_sum_used_bytes = used_bytes();
   1.165    // For purposes of the running sum of used, verify against used
   1.166    size_t used_in_use_bytes = used_bytes_slow();
   1.167 -  assert(allocated_used_bytes() == used_in_use_bytes,
   1.168 -    err_msg("allocated_used_bytes() " SIZE_FORMAT
   1.169 +  assert(used_bytes() == used_in_use_bytes,
   1.170 +    err_msg("used_bytes() " SIZE_FORMAT
   1.171              " used_bytes_slow()" SIZE_FORMAT,
   1.172 -            allocated_used_bytes(), used_in_use_bytes));
   1.173 +            used_bytes(), used_in_use_bytes));
   1.174    for (Metaspace::MetadataType i = Metaspace::ClassType;
   1.175         i < Metaspace:: MetadataTypeCount;
   1.176         i = (Metaspace::MetadataType)(i + 1)) {
   1.177      size_t used_in_use_bytes = used_bytes_slow(i);
   1.178 -    assert(allocated_used_bytes(i) == used_in_use_bytes,
   1.179 -      err_msg("allocated_used_bytes(%u) " SIZE_FORMAT
   1.180 +    assert(used_bytes(i) == used_in_use_bytes,
   1.181 +      err_msg("used_bytes(%u) " SIZE_FORMAT
   1.182                " used_bytes_slow(%u)" SIZE_FORMAT,
   1.183 -              i, allocated_used_bytes(i), i, used_in_use_bytes));
   1.184 +              i, used_bytes(i), i, used_in_use_bytes));
   1.185    }
   1.186  #endif
   1.187  }

mercurial