1.1 --- a/src/share/vm/memory/metaspace.hpp Wed Sep 11 18:47:54 2013 +0200 1.2 +++ b/src/share/vm/memory/metaspace.hpp Thu Sep 12 10:15:30 2013 +0200 1.3 @@ -182,9 +182,8 @@ 1.4 1.5 char* bottom() const; 1.6 size_t used_words_slow(MetadataType mdtype) const; 1.7 - size_t free_words(MetadataType mdtype) const; 1.8 + size_t free_words_slow(MetadataType mdtype) const; 1.9 size_t capacity_words_slow(MetadataType mdtype) const; 1.10 - size_t waste_words(MetadataType mdtype) const; 1.11 1.12 size_t used_bytes_slow(MetadataType mdtype) const; 1.13 size_t capacity_bytes_slow(MetadataType mdtype) const; 1.14 @@ -221,19 +220,14 @@ 1.15 }; 1.16 1.17 class MetaspaceAux : AllStatic { 1.18 - static size_t free_chunks_total(Metaspace::MetadataType mdtype); 1.19 - 1.20 - public: 1.21 - // Statistics for class space and data space in metaspace. 1.22 + static size_t free_chunks_total_words(Metaspace::MetadataType mdtype); 1.23 1.24 // These methods iterate over the classloader data graph 1.25 // for the given Metaspace type. These are slow. 1.26 static size_t used_bytes_slow(Metaspace::MetadataType mdtype); 1.27 - static size_t free_in_bytes(Metaspace::MetadataType mdtype); 1.28 + static size_t free_bytes_slow(Metaspace::MetadataType mdtype); 1.29 static size_t capacity_bytes_slow(Metaspace::MetadataType mdtype); 1.30 - 1.31 - // Iterates over the virtual space list. 1.32 - static size_t reserved_in_bytes(Metaspace::MetadataType mdtype); 1.33 + static size_t capacity_bytes_slow(); 1.34 1.35 // Running sum of space in all Metachunks that has been 1.36 // allocated to a Metaspace. This is used instead of 1.37 @@ -263,17 +257,16 @@ 1.38 } 1.39 1.40 // Used by MetaspaceCounters 1.41 - static size_t free_chunks_total(); 1.42 - static size_t free_chunks_total_in_bytes(); 1.43 - static size_t free_chunks_total_in_bytes(Metaspace::MetadataType mdtype); 1.44 + static size_t free_chunks_total_words(); 1.45 + static size_t free_chunks_total_bytes(); 1.46 + static size_t free_chunks_total_bytes(Metaspace::MetadataType mdtype); 1.47 1.48 static size_t allocated_capacity_words(Metaspace::MetadataType mdtype) { 1.49 return _allocated_capacity_words[mdtype]; 1.50 } 1.51 static size_t allocated_capacity_words() { 1.52 - return _allocated_capacity_words[Metaspace::NonClassType] + 1.53 - (Metaspace::using_class_space() ? 1.54 - _allocated_capacity_words[Metaspace::ClassType] : 0); 1.55 + return allocated_capacity_words(Metaspace::NonClassType) + 1.56 + allocated_capacity_words(Metaspace::ClassType); 1.57 } 1.58 static size_t allocated_capacity_bytes(Metaspace::MetadataType mdtype) { 1.59 return allocated_capacity_words(mdtype) * BytesPerWord; 1.60 @@ -286,9 +279,8 @@ 1.61 return _allocated_used_words[mdtype]; 1.62 } 1.63 static size_t allocated_used_words() { 1.64 - return _allocated_used_words[Metaspace::NonClassType] + 1.65 - (Metaspace::using_class_space() ? 1.66 - _allocated_used_words[Metaspace::ClassType] : 0); 1.67 + return allocated_used_words(Metaspace::NonClassType) + 1.68 + allocated_used_words(Metaspace::ClassType); 1.69 } 1.70 static size_t allocated_used_bytes(Metaspace::MetadataType mdtype) { 1.71 return allocated_used_words(mdtype) * BytesPerWord; 1.72 @@ -301,31 +293,17 @@ 1.73 static size_t free_bytes(Metaspace::MetadataType mdtype); 1.74 1.75 // Total capacity in all Metaspaces 1.76 - static size_t capacity_bytes_slow() { 1.77 -#ifdef PRODUCT 1.78 - // Use allocated_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 - " class_capacity + non_class_capacity " SIZE_FORMAT 1.86 - " class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT, 1.87 - allocated_capacity_bytes(), class_capacity + non_class_capacity, 1.88 - class_capacity, non_class_capacity)); 1.89 - 1.90 - return class_capacity + non_class_capacity; 1.91 + static size_t reserved_bytes(Metaspace::MetadataType mdtype); 1.92 + static size_t reserved_bytes() { 1.93 + return reserved_bytes(Metaspace::ClassType) + 1.94 + reserved_bytes(Metaspace::NonClassType); 1.95 } 1.96 1.97 - // Total space reserved in all Metaspaces 1.98 - static size_t reserved_in_bytes() { 1.99 - return reserved_in_bytes(Metaspace::ClassType) + 1.100 - reserved_in_bytes(Metaspace::NonClassType); 1.101 + static size_t min_chunk_size_words(); 1.102 + static size_t min_chunk_size_bytes() { 1.103 + return min_chunk_size_words() * BytesPerWord; 1.104 } 1.105 1.106 - static size_t min_chunk_size(); 1.107 - 1.108 // Print change in used metadata. 1.109 static void print_metaspace_change(size_t prev_metadata_used); 1.110 static void print_on(outputStream * out);