< prev index next >

src/share/vm/memory/metaspace.cpp

Print this page
rev 8978 : imported patch remove_err_msg

@@ -187,11 +187,11 @@
 
 #define index_bounds_check(index)                                         \
   assert(index == SpecializedIndex ||                                     \
          index == SmallIndex ||                                           \
          index == MediumIndex ||                                          \
-         index == HumongousIndex, err_msg("Bad index: %d", (int) index))
+         index == HumongousIndex, "Bad index: %d", (int) index)
 
   size_t num_free_chunks(ChunkIndex index) const {
     index_bounds_check(index);
 
     if (index == HumongousIndex) {

@@ -376,17 +376,17 @@
   void print_on(outputStream* st) const;
 };
 
 #define assert_is_ptr_aligned(ptr, alignment) \
   assert(is_ptr_aligned(ptr, alignment),      \
-    err_msg(PTR_FORMAT " is not aligned to "  \
-      SIZE_FORMAT, p2i(ptr), alignment))
+         PTR_FORMAT " is not aligned to "     \
+         SIZE_FORMAT, p2i(ptr), alignment)
 
 #define assert_is_size_aligned(size, alignment) \
   assert(is_size_aligned(size, alignment),      \
-    err_msg(SIZE_FORMAT " is not aligned to "   \
-       SIZE_FORMAT, size, alignment))
+         SIZE_FORMAT " is not aligned to "      \
+         SIZE_FORMAT, size, alignment)
 
 
 // Decide if large pages should be committed when the memory is reserved.
 static bool should_commit_large_pages_when_reserving(size_t bytes) {
   if (UseLargePages && UseLargePagesInMetaspace && !os::can_commit_large_page_memory()) {

@@ -799,12 +799,12 @@
 }
 
 #ifdef ASSERT
 void VirtualSpaceNode::verify_container_count() {
   assert(_container_count == container_count_slow(),
-    err_msg("Inconsistency in container_count _container_count " UINTX_FORMAT
-            " container_count_slow() " UINTX_FORMAT, _container_count, container_count_slow()));
+         "Inconsistency in container_count _container_count " UINTX_FORMAT
+         " container_count_slow() " UINTX_FORMAT, _container_count, container_count_slow());
 }
 #endif
 
 // BlockFreelist methods
 

@@ -963,16 +963,16 @@
     set_top((MetaWord*)virtual_space()->low());
     set_reserved(MemRegion((HeapWord*)_rs.base(),
                  (HeapWord*)(_rs.base() + _rs.size())));
 
     assert(reserved()->start() == (HeapWord*) _rs.base(),
-      err_msg("Reserved start was not set properly " PTR_FORMAT
-        " != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base())));
+           "Reserved start was not set properly " PTR_FORMAT
+           " != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base()));
     assert(reserved()->word_size() == _rs.size() / BytesPerWord,
-      err_msg("Reserved size was not set properly " SIZE_FORMAT
+           "Reserved size was not set properly " SIZE_FORMAT
         " != " SIZE_FORMAT, reserved()->word_size(),
-        _rs.size() / BytesPerWord));
+           _rs.size() / BytesPerWord);
   }
 
   return result;
 }
 

@@ -1016,13 +1016,13 @@
   _reserved_words = _reserved_words - v;
 }
 
 #define assert_committed_below_limit()                             \
   assert(MetaspaceAux::committed_bytes() <= MaxMetaspaceSize,      \
-      err_msg("Too much committed memory. Committed: " SIZE_FORMAT \
+         "Too much committed memory. Committed: " SIZE_FORMAT \
               " limit (MaxMetaspaceSize): " SIZE_FORMAT,           \
-          MetaspaceAux::committed_bytes(), MaxMetaspaceSize));
+         MetaspaceAux::committed_bytes(), MaxMetaspaceSize);
 
 void VirtualSpaceList::inc_committed_words(size_t v) {
   assert_lock_strong(SpaceManager::expand_lock());
   _committed_words = _committed_words + v;
 

@@ -1459,12 +1459,12 @@
 size_t MetaspaceGC::allowed_expansion() {
   size_t committed_bytes = MetaspaceAux::committed_bytes();
   size_t capacity_until_gc = capacity_until_GC();
 
   assert(capacity_until_gc >= committed_bytes,
-        err_msg("capacity_until_gc: " SIZE_FORMAT " < committed_bytes: " SIZE_FORMAT,
-                capacity_until_gc, committed_bytes));
+         "capacity_until_gc: " SIZE_FORMAT " < committed_bytes: " SIZE_FORMAT,
+         capacity_until_gc, committed_bytes);
 
   size_t left_until_max  = MaxMetaspaceSize - committed_bytes;
   size_t left_until_GC = capacity_until_gc - committed_bytes;
   size_t left_to_commit = MIN2(left_until_GC, left_until_max);
 

@@ -1541,12 +1541,12 @@
   }
 
   // No expansion, now see if we want to shrink
   // We would never want to shrink more than this
   assert(capacity_until_GC >= minimum_desired_capacity,
-         err_msg(SIZE_FORMAT " >= " SIZE_FORMAT,
-                 capacity_until_GC, minimum_desired_capacity));
+         SIZE_FORMAT " >= " SIZE_FORMAT,
+         capacity_until_GC, minimum_desired_capacity);
   size_t max_shrink_bytes = capacity_until_GC - minimum_desired_capacity;
 
   // Should shrinking be considered?
   if (MaxMetaspaceFreeRatio < 100) {
     const double maximum_free_percentage = MaxMetaspaceFreeRatio / 100.0;

@@ -1583,12 +1583,12 @@
       shrink_bytes = shrink_bytes / 100 * current_shrink_factor;
 
       shrink_bytes = align_size_down(shrink_bytes, Metaspace::commit_alignment());
 
       assert(shrink_bytes <= max_shrink_bytes,
-        err_msg("invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT,
-          shrink_bytes, max_shrink_bytes));
+             "invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT,
+             shrink_bytes, max_shrink_bytes);
       if (current_shrink_factor == 0) {
         _shrink_factor = 10;
       } else {
         _shrink_factor = MIN2(current_shrink_factor * 4, (uint) 100);
       }

@@ -1674,13 +1674,13 @@
 }
 
 void ChunkManager::locked_verify_free_chunks_total() {
   assert_lock_strong(SpaceManager::expand_lock());
   assert(sum_free_chunks() == _free_chunks_total,
-    err_msg("_free_chunks_total " SIZE_FORMAT " is not the"
+         "_free_chunks_total " SIZE_FORMAT " is not the"
            " same as sum " SIZE_FORMAT, _free_chunks_total,
-           sum_free_chunks()));
+         sum_free_chunks());
 }
 
 void ChunkManager::verify_free_chunks_total() {
   MutexLockerEx cl(SpaceManager::expand_lock(),
                      Mutex::_no_safepoint_check_flag);

@@ -1688,13 +1688,13 @@
 }
 
 void ChunkManager::locked_verify_free_chunks_count() {
   assert_lock_strong(SpaceManager::expand_lock());
   assert(sum_free_chunks_count() == _free_chunks_count,
-    err_msg("_free_chunks_count " SIZE_FORMAT " is not the"
+         "_free_chunks_count " SIZE_FORMAT " is not the"
            " same as sum " SIZE_FORMAT, _free_chunks_count,
-           sum_free_chunks_count()));
+         sum_free_chunks_count());
 }
 
 void ChunkManager::verify_free_chunks_count() {
 #ifdef ASSERT
   MutexLockerEx cl(SpaceManager::expand_lock(),

@@ -1889,13 +1889,13 @@
     *chunk_word_size = SmallChunk;
     *class_chunk_word_size = ClassSmallChunk;
     break;
   }
   assert(*chunk_word_size != 0 && *class_chunk_word_size != 0,
-    err_msg("Initial chunks sizes bad: data  " SIZE_FORMAT
+         "Initial chunks sizes bad: data  " SIZE_FORMAT
             " class " SIZE_FORMAT,
-            *chunk_word_size, *class_chunk_word_size));
+         *chunk_word_size, *class_chunk_word_size);
 }
 
 size_t SpaceManager::sum_free_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t free = 0;

@@ -2034,13 +2034,13 @@
   chunk_word_size =
     MAX2((size_t) chunk_word_size, if_humongous_sized_chunk);
 
   assert(!SpaceManager::is_humongous(word_size) ||
          chunk_word_size == if_humongous_sized_chunk,
-         err_msg("Size calculation is wrong, word_size " SIZE_FORMAT
+         "Size calculation is wrong, word_size " SIZE_FORMAT
                  " chunk_word_size " SIZE_FORMAT,
-                 word_size, chunk_word_size));
+         word_size, chunk_word_size);
   if (TraceMetadataHumongousAllocation &&
       SpaceManager::is_humongous(word_size)) {
     gclog_or_tty->print_cr("Metadata humongous allocation:");
     gclog_or_tty->print_cr("  word_size " PTR_FORMAT, word_size);
     gclog_or_tty->print_cr("  chunk_word_size " PTR_FORMAT,

@@ -2200,13 +2200,13 @@
 }
 
 SpaceManager::~SpaceManager() {
   // This call this->_lock which can't be done while holding expand_lock()
   assert(sum_capacity_in_chunks_in_use() == allocated_chunks_words(),
-    err_msg("sum_capacity_in_chunks_in_use() " SIZE_FORMAT
+         "sum_capacity_in_chunks_in_use() " SIZE_FORMAT
             " allocated_chunks_words() " SIZE_FORMAT,
-            sum_capacity_in_chunks_in_use(), allocated_chunks_words()));
+         sum_capacity_in_chunks_in_use(), allocated_chunks_words());
 
   MutexLockerEx fcl(SpaceManager::expand_lock(),
                     Mutex::_no_safepoint_check_flag);
 
   chunk_manager()->slow_locked_verify();

@@ -2273,13 +2273,13 @@
                           humongous_chunks->word_size());
     }
     assert(humongous_chunks->word_size() == (size_t)
            align_size_up(humongous_chunks->word_size(),
                              smallest_chunk_size()),
-           err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT
+           "Humongous chunk size is wrong: word size " SIZE_FORMAT
                    " granularity " SIZE_FORMAT,
-                   humongous_chunks->word_size(), smallest_chunk_size()));
+           humongous_chunks->word_size(), smallest_chunk_size());
     Metachunk* next_humongous_chunks = humongous_chunks->next();
     humongous_chunks->container()->dec_container_count();
     chunk_manager()->humongous_dictionary()->return_chunk(humongous_chunks);
     humongous_chunks = next_humongous_chunks;
   }

@@ -2329,11 +2329,11 @@
 void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
   assert_lock_strong(_lock);
   size_t raw_word_size = get_raw_word_size(word_size);
   size_t min_size = TreeChunk<Metablock, FreeList<Metablock> >::min_size();
   assert(raw_word_size >= min_size,
-         err_msg("Should not deallocate dark matter " SIZE_FORMAT "<" SIZE_FORMAT, word_size, min_size));
+         "Should not deallocate dark matter " SIZE_FORMAT "<" SIZE_FORMAT, word_size, min_size);
   block_freelists()->return_block(p, raw_word_size);
 }
 
 // Adds a chunk to the list of chunks in use.
 void SpaceManager::add_chunk(Metachunk* new_chunk, bool make_current) {

@@ -2539,13 +2539,13 @@
 void SpaceManager::verify_allocated_blocks_words() {
   // Verification is only guaranteed at a safepoint.
   assert(SafepointSynchronize::is_at_safepoint() || !Universe::is_fully_initialized(),
     "Verification can fail if the applications is running");
   assert(allocated_blocks_words() == sum_used_in_chunks_in_use(),
-    err_msg("allocation total is not consistent " SIZE_FORMAT
+         "allocation total is not consistent " SIZE_FORMAT
             " vs " SIZE_FORMAT,
-            allocated_blocks_words(), sum_used_in_chunks_in_use()));
+         allocated_blocks_words(), sum_used_in_chunks_in_use());
 }
 
 #endif
 
 void SpaceManager::dump(outputStream* const out) const {

@@ -2614,13 +2614,13 @@
 }
 
 void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
   assert_lock_strong(SpaceManager::expand_lock());
   assert(words <= capacity_words(mdtype),
-    err_msg("About to decrement below 0: words " SIZE_FORMAT
+         "About to decrement below 0: words " SIZE_FORMAT
             " is greater than _capacity_words[%u] " SIZE_FORMAT,
-            words, mdtype, capacity_words(mdtype)));
+         words, mdtype, capacity_words(mdtype));
   _capacity_words[mdtype] -= words;
 }
 
 void MetaspaceAux::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
   assert_lock_strong(SpaceManager::expand_lock());

@@ -2628,13 +2628,13 @@
   _capacity_words[mdtype] += words;
 }
 
 void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) {
   assert(words <= used_words(mdtype),
-    err_msg("About to decrement below 0: words " SIZE_FORMAT
+         "About to decrement below 0: words " SIZE_FORMAT
             " is greater than _used_words[%u] " SIZE_FORMAT,
-            words, mdtype, used_words(mdtype)));
+         words, mdtype, used_words(mdtype));
   // For CMS deallocation of the Metaspaces occurs during the
   // sweep which is a concurrent phase.  Protection by the expand_lock()
   // is not enough since allocation is on a per Metaspace basis
   // and protected by the Metaspace lock.
   jlong minus_words = (jlong) - (jlong) words;

@@ -2697,15 +2697,15 @@
   guarantee(false, "Should not call capacity_bytes_slow() in the PRODUCT");
 #endif
   size_t class_capacity = capacity_bytes_slow(Metaspace::ClassType);
   size_t non_class_capacity = capacity_bytes_slow(Metaspace::NonClassType);
   assert(capacity_bytes() == class_capacity + non_class_capacity,
-      err_msg("bad accounting: capacity_bytes() " SIZE_FORMAT
+         "bad accounting: capacity_bytes() " SIZE_FORMAT
         " class_capacity + non_class_capacity " SIZE_FORMAT
         " class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT,
         capacity_bytes(), class_capacity + non_class_capacity,
-        class_capacity, non_class_capacity));
+         class_capacity, non_class_capacity);
 
   return class_capacity + non_class_capacity;
 }
 
 size_t MetaspaceAux::reserved_bytes(Metaspace::MetadataType mdtype) {

@@ -2902,42 +2902,42 @@
 #ifdef ASSERT
   size_t running_sum_capacity_bytes = capacity_bytes();
   // For purposes of the running sum of capacity, verify against capacity
   size_t capacity_in_use_bytes = capacity_bytes_slow();
   assert(running_sum_capacity_bytes == capacity_in_use_bytes,
-    err_msg("capacity_words() * BytesPerWord " SIZE_FORMAT
+         "capacity_words() * BytesPerWord " SIZE_FORMAT
             " capacity_bytes_slow()" SIZE_FORMAT,
-            running_sum_capacity_bytes, capacity_in_use_bytes));
+         running_sum_capacity_bytes, capacity_in_use_bytes);
   for (Metaspace::MetadataType i = Metaspace::ClassType;
        i < Metaspace:: MetadataTypeCount;
        i = (Metaspace::MetadataType)(i + 1)) {
     size_t capacity_in_use_bytes = capacity_bytes_slow(i);
     assert(capacity_bytes(i) == capacity_in_use_bytes,
-      err_msg("capacity_bytes(%u) " SIZE_FORMAT
+           "capacity_bytes(%u) " SIZE_FORMAT
               " capacity_bytes_slow(%u)" SIZE_FORMAT,
-              i, capacity_bytes(i), i, capacity_in_use_bytes));
+           i, capacity_bytes(i), i, capacity_in_use_bytes);
   }
 #endif
 }
 
 void MetaspaceAux::verify_used() {
 #ifdef ASSERT
   size_t running_sum_used_bytes = used_bytes();
   // For purposes of the running sum of used, verify against used
   size_t used_in_use_bytes = used_bytes_slow();
   assert(used_bytes() == used_in_use_bytes,
-    err_msg("used_bytes() " SIZE_FORMAT
+         "used_bytes() " SIZE_FORMAT
             " used_bytes_slow()" SIZE_FORMAT,
-            used_bytes(), used_in_use_bytes));
+         used_bytes(), used_in_use_bytes);
   for (Metaspace::MetadataType i = Metaspace::ClassType;
        i < Metaspace:: MetadataTypeCount;
        i = (Metaspace::MetadataType)(i + 1)) {
     size_t used_in_use_bytes = used_bytes_slow(i);
     assert(used_bytes(i) == used_in_use_bytes,
-      err_msg("used_bytes(%u) " SIZE_FORMAT
+           "used_bytes(%u) " SIZE_FORMAT
               " used_bytes_slow(%u)" SIZE_FORMAT,
-              i, used_bytes(i), i, used_in_use_bytes));
+           i, used_bytes(i), i, used_in_use_bytes);
   }
 #endif
 }
 
 void MetaspaceAux::verify_metrics() {

@@ -3155,11 +3155,11 @@
 // For UseCompressedClassPointers the class space is reserved above the top of
 // the Java heap.  The argument passed in is at the base of the compressed space.
 void Metaspace::initialize_class_space(ReservedSpace rs) {
   // The reserved space size may be bigger because of alignment, esp with UseLargePages
   assert(rs.size() >= CompressedClassSpaceSize,
-         err_msg(SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize));
+         SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize);
   assert(using_class_space(), "Must be using class space");
   _class_space_list = new VirtualSpaceList(rs);
   _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk);
 
   if (!_class_space_list->initialization_succeeded()) {

@@ -3686,11 +3686,11 @@
 const char* Metaspace::metadata_type_name(Metaspace::MetadataType mdtype) {
   switch (mdtype) {
     case Metaspace::ClassType: return "Class";
     case Metaspace::NonClassType: return "Metadata";
     default:
-      assert(false, err_msg("Got bad mdtype: %d", (int) mdtype));
+      assert(false, "Got bad mdtype: %d", (int) mdtype);
       return NULL;
   }
 }
 
 void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) {

@@ -3968,19 +3968,19 @@
 
   }
 
 #define assert_is_available_positive(word_size) \
   assert(vsn.is_available(word_size), \
-    err_msg(#word_size ": " PTR_FORMAT " bytes were not available in " \
+         #word_size ": " PTR_FORMAT " bytes were not available in " \
             "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \
-            (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end())));
+         (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end()));
 
 #define assert_is_available_negative(word_size) \
   assert(!vsn.is_available(word_size), \
-    err_msg(#word_size ": " PTR_FORMAT " bytes should not be available in " \
+         #word_size ": " PTR_FORMAT " bytes should not be available in " \
             "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \
-            (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end())));
+         (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end()));
 
   static void test_is_available_positive() {
     // Reserve some memory.
     VirtualSpaceNode vsn(os::vm_allocation_granularity());
     assert(vsn.initialize(), "Failed to setup VirtualSpaceNode");
< prev index next >