--- old/src/hotspot/share/gc/shared/referenceProcessor.cpp 2018-04-23 17:00:21.424538304 +0200 +++ new/src/hotspot/share/gc/shared/referenceProcessor.cpp 2018-04-23 17:00:21.138529389 +0200 @@ -383,13 +383,14 @@ } void DiscoveredListIterator::load_ptrs(DEBUG_ONLY(bool allow_null_referent)) { - _discovered_addr = java_lang_ref_Reference::discovered_addr_raw(_ref); - oop discovered = java_lang_ref_Reference::discovered(_ref); - assert(_discovered_addr && oopDesc::is_oop_or_null(discovered), + _current_discovered_addr = java_lang_ref_Reference::discovered_addr_raw(_current_discovered); + oop discovered = java_lang_ref_Reference::discovered(_current_discovered); + assert(_current_discovered_addr && oopDesc::is_oop_or_null(discovered), "Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered)); _next_discovered = discovered; - _referent_addr = java_lang_ref_Reference::referent_addr_raw(_ref); - _referent = java_lang_ref_Reference::referent(_ref); + + _referent_addr = java_lang_ref_Reference::referent_addr_raw(_current_discovered); + _referent = java_lang_ref_Reference::referent(_current_discovered); assert(Universe::heap()->is_in_reserved_or_null(_referent), "Wrong oop found in java.lang.Reference object"); assert(allow_null_referent ? @@ -401,12 +402,12 @@ } void DiscoveredListIterator::remove() { - assert(oopDesc::is_oop(_ref), "Dropping a bad reference"); - RawAccess<>::oop_store(_discovered_addr, oop(NULL)); + assert(oopDesc::is_oop(_current_discovered), "Dropping a bad reference"); + RawAccess<>::oop_store(_current_discovered_addr, oop(NULL)); // First _prev_next ref actually points into DiscoveredList (gross). oop new_next; - if (_next_discovered == _ref) { + if (_next_discovered == _current_discovered) { // At the end of the list, we should make _prev point to itself. // If _ref is the first ref, then _prev_next will be in the DiscoveredList, // and _prev will be NULL. --- old/src/hotspot/share/gc/shared/referenceProcessor.hpp 2018-04-23 17:00:22.592574713 +0200 +++ new/src/hotspot/share/gc/shared/referenceProcessor.hpp 2018-04-23 17:00:22.311565954 +0200 @@ -78,11 +78,13 @@ DiscoveredList& _refs_list; HeapWord* _prev_discovered_addr; oop _prev_discovered; - oop _ref; - HeapWord* _discovered_addr; + oop _current_discovered; + HeapWord* _current_discovered_addr; oop _next_discovered; + HeapWord* _referent_addr; oop _referent; + OopClosure* _keep_alive; BoolObjectClosure* _is_alive; @@ -101,10 +103,10 @@ BoolObjectClosure* is_alive); // End Of List. - inline bool has_next() const { return _ref != NULL; } + inline bool has_next() const { return _current_discovered != NULL; } // Get oop to the Reference object. - inline oop obj() const { return _ref; } + inline oop obj() const { return _current_discovered; } // Get oop to the referent object. inline oop referent() const { return _referent; } @@ -123,8 +125,8 @@ // Move to the next discovered reference. inline void next() { - _prev_discovered_addr = _discovered_addr; - _prev_discovered = _ref; + _prev_discovered_addr = _current_discovered_addr; + _prev_discovered = _current_discovered; move_to_next(); } @@ -150,13 +152,13 @@ ) inline void move_to_next() { - if (_ref == _next_discovered) { + if (_current_discovered == _next_discovered) { // End of the list. - _ref = NULL; + _current_discovered = NULL; } else { - _ref = _next_discovered; + _current_discovered = _next_discovered; } - assert(_ref != _first_seen, "cyclic ref_list found"); + assert(_current_discovered != _first_seen, "cyclic ref_list found"); NOT_PRODUCT(_processed++); } }; --- old/src/hotspot/share/gc/shared/referenceProcessor.inline.hpp 2018-04-23 17:00:23.763611215 +0200 +++ new/src/hotspot/share/gc/shared/referenceProcessor.inline.hpp 2018-04-23 17:00:23.476602269 +0200 @@ -53,7 +53,7 @@ _refs_list(refs_list), _prev_discovered_addr(refs_list.adr_head()), _prev_discovered(NULL), - _ref(refs_list.head()), + _current_discovered(refs_list.head()), #ifdef ASSERT _first_seen(refs_list.head()), #endif