merge JDK-8200758-branch
authorherrick
Sat, 27 Jul 2019 07:10:20 -0400
branchJDK-8200758-branch
changeset 57556 2f46b16d0659
parent 57555 02d3f1d03abb (current diff)
parent 57551 02cffb476ab0 (diff)
child 57557 b4aa3d0c1431
merge
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Fri Jul 26 19:11:34 2019 -0400
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Sat Jul 27 07:10:20 2019 -0400
@@ -208,7 +208,7 @@
 OopStorage::Block::Block(const OopStorage* owner, void* memory) :
   _data(),
   _allocated_bitmask(0),
-  _owner(owner),
+  _owner_address(reinterpret_cast<intptr_t>(owner)),
   _memory(memory),
   _active_index(0),
   _allocation_list_entry(),
@@ -228,7 +228,7 @@
   // Clear fields used by block_for_ptr and entry validation, which
   // might help catch bugs.  Volatile to prevent dead-store elimination.
   const_cast<uintx volatile&>(_allocated_bitmask) = 0;
-  const_cast<OopStorage* volatile&>(_owner) = NULL;
+  const_cast<intptr_t volatile&>(_owner_address) = 0;
 }
 
 size_t OopStorage::Block::allocation_size() {
@@ -356,9 +356,7 @@
   intptr_t owner_addr = reinterpret_cast<intptr_t>(owner);
   for (unsigned i = 0; i < section_count; ++i, section += section_size) {
     Block* candidate = reinterpret_cast<Block*>(section);
-    intptr_t* candidate_owner_addr
-      = reinterpret_cast<intptr_t*>(&candidate->_owner);
-    if (SafeFetchN(candidate_owner_addr, 0) == owner_addr) {
+    if (SafeFetchN(&candidate->_owner_address, 0) == owner_addr) {
       return candidate;
     }
   }
@@ -420,7 +418,7 @@
   assert(!block->is_full(), "invariant");
   if (block->is_empty()) {
     // Transitioning from empty to not empty.
-    log_debug(oopstorage, blocks)("%s: block not empty " PTR_FORMAT, name(), p2i(block));
+    log_trace(oopstorage, blocks)("%s: block not empty " PTR_FORMAT, name(), p2i(block));
   }
   oop* result = block->allocate();
   assert(result != NULL, "allocation failed");
@@ -429,7 +427,7 @@
   if (block->is_full()) {
     // Transitioning from not full to full.
     // Remove full blocks from consideration by future allocates.
-    log_debug(oopstorage, blocks)("%s: block full " PTR_FORMAT, name(), p2i(block));
+    log_trace(oopstorage, blocks)("%s: block full " PTR_FORMAT, name(), p2i(block));
     _allocation_list.unlink(*block);
   }
   log_trace(oopstorage, ref)("%s: allocated " PTR_FORMAT, name(), p2i(result));
@@ -483,7 +481,7 @@
     } else if (!reduce_deferred_updates()) { // Once more before failure.
       // Attempt to add a block failed, no other thread added a block,
       // and no deferred updated added a block, then allocation failed.
-      log_debug(oopstorage, blocks)("%s: failed block allocation", name());
+      log_info(oopstorage, blocks)("%s: failed block allocation", name());
       return NULL;
     }
   }
@@ -575,13 +573,15 @@
                                     uintx old_allocated,
                                     const OopStorage* owner,
                                     const void* block) {
-  Log(oopstorage, blocks) log;
-  LogStream ls(log.debug());
-  if (is_full_bitmask(old_allocated)) {
-    ls.print_cr("%s: block not full " PTR_FORMAT, owner->name(), p2i(block));
-  }
-  if (releasing == old_allocated) {
-    ls.print_cr("%s: block empty " PTR_FORMAT, owner->name(), p2i(block));
+  LogTarget(Trace, oopstorage, blocks) lt;
+  if (lt.is_enabled()) {
+    LogStream ls(lt);
+    if (is_full_bitmask(old_allocated)) {
+      ls.print_cr("%s: block not full " PTR_FORMAT, owner->name(), p2i(block));
+    }
+    if (releasing == old_allocated) {
+      ls.print_cr("%s: block empty " PTR_FORMAT, owner->name(), p2i(block));
+    }
   }
 }
 
@@ -608,9 +608,7 @@
   // updates and the associated locking here.
   if ((releasing == old_allocated) || is_full_bitmask(old_allocated)) {
     // Log transitions.  Both transitions are possible in a single update.
-    if (log_is_enabled(Debug, oopstorage, blocks)) {
-      log_release_transitions(releasing, old_allocated, _owner, this);
-    }
+    log_release_transitions(releasing, old_allocated, owner, this);
     // Attempt to claim responsibility for adding this block to the deferred
     // list, by setting the link to non-NULL by self-looping.  If this fails,
     // then someone else has made such a claim and the deferred update has not
@@ -633,8 +631,8 @@
       if (releasing == old_allocated) {
         owner->record_needs_cleanup();
       }
-      log_debug(oopstorage, blocks)("%s: deferred update " PTR_FORMAT,
-                                    _owner->name(), p2i(this));
+      log_trace(oopstorage, blocks)("%s: deferred update " PTR_FORMAT,
+                                    owner->name(), p2i(this));
     }
   }
   // Release hold on empty block deletion.
@@ -683,7 +681,7 @@
     _allocation_list.push_back(*block);
   }
 
-  log_debug(oopstorage, blocks)("%s: processed deferred update " PTR_FORMAT,
+  log_trace(oopstorage, blocks)("%s: processed deferred update " PTR_FORMAT,
                                 name(), p2i(block));
   return true;              // Processed one pending update.
 }
--- a/src/hotspot/share/gc/shared/oopStorage.inline.hpp	Fri Jul 26 19:11:34 2019 -0400
+++ b/src/hotspot/share/gc/shared/oopStorage.inline.hpp	Sat Jul 27 07:10:20 2019 -0400
@@ -137,7 +137,7 @@
   static const unsigned _data_pos = 0; // Position of _data.
 
   volatile uintx _allocated_bitmask; // One bit per _data element.
-  const OopStorage* _owner;
+  intptr_t _owner_address;
   void* _memory;              // Unaligned storage containing block.
   size_t _active_index;
   AllocationListEntry _allocation_list_entry;