hotspot/src/share/vm/gc/g1/g1AllocRegion.inline.hpp
changeset 33105 294e48b4f704
parent 32389 626f27450e12
--- a/hotspot/src/share/vm/gc/g1/g1AllocRegion.inline.hpp	Mon Sep 28 15:05:02 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1AllocRegion.inline.hpp	Tue Sep 29 11:02:08 2015 +0200
@@ -28,10 +28,18 @@
 #include "gc/g1/g1AllocRegion.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 
+#define assert_alloc_region(p, message)                                  \
+  do {                                                                   \
+    assert((p), "[%s] %s c: %u b: %s r: " PTR_FORMAT " u: " SIZE_FORMAT, \
+           _name, (message), _count, BOOL_TO_STR(_bot_updates),          \
+           p2i(_alloc_region), _used_bytes_before);                      \
+  } while (0)
+
+
 inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region,
                                          size_t word_size,
                                          bool bot_updates) {
-  assert(alloc_region != NULL, err_msg("pre-condition"));
+  assert(alloc_region != NULL, "pre-condition");
 
   if (!bot_updates) {
     return alloc_region->allocate_no_bot_updates(word_size);
@@ -50,8 +58,8 @@
                                              size_t desired_word_size,
                                              size_t* actual_word_size,
                                              bool bot_updates) {
-  assert(alloc_region != NULL, err_msg("pre-condition"));
-  assert(!alloc_region->is_empty(), err_msg("pre-condition"));
+  assert(alloc_region != NULL, "pre-condition");
+  assert(!alloc_region->is_empty(), "pre-condition");
 
   if (!bot_updates) {
     return alloc_region->par_allocate_no_bot_updates(min_word_size, desired_word_size, actual_word_size);
@@ -69,10 +77,10 @@
                                                    size_t desired_word_size,
                                                    size_t* actual_word_size,
                                                    bool bot_updates) {
-  assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition"));
+  assert_alloc_region(bot_updates == _bot_updates, "pre-condition");
 
   HeapRegion* alloc_region = _alloc_region;
-  assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
+  assert_alloc_region(alloc_region != NULL, "not initialized properly");
 
   HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size, bot_updates);
   if (result != NULL) {
@@ -113,8 +121,8 @@
 
 inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size,
                                                          bool bot_updates) {
-  assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition"));
-  assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
+  assert_alloc_region(bot_updates == _bot_updates, "pre-condition");
+  assert_alloc_region(_alloc_region != NULL, "not initialized properly");
 
   trace("forcing alloc", word_size, word_size);
   HeapWord* result = new_alloc_region_and_allocate(word_size, true /* force */);