diff -r fa0d9fc371bb -r e30211561a17 src/hotspot/share/runtime/handles.inline.hpp --- a/src/hotspot/share/runtime/handles.inline.hpp Thu Feb 07 12:11:41 2019 +0530 +++ b/src/hotspot/share/runtime/handles.inline.hpp Thu Feb 07 10:26:32 2019 +0100 @@ -79,7 +79,6 @@ initialize(Thread::current()); } - inline void HandleMark::push() { // This is intentionally a NOP. pop_and_restore will reset // values to the HandleMark further down the stack, typically @@ -88,22 +87,18 @@ } inline void HandleMark::pop_and_restore() { - HandleArea* area = _area; // help compilers with poor alias analysis // Delete later chunks - if( _chunk->next() ) { - // reset arena size before delete chunks. Otherwise, the total - // arena size could exceed total chunk size - assert(area->size_in_bytes() > size_in_bytes(), "Sanity check"); - area->set_size_in_bytes(size_in_bytes()); - _chunk->next_chop(); + if(_chunk->next() != NULL) { + assert(_area->size_in_bytes() > size_in_bytes(), "Sanity check"); + chop_later_chunks(); } else { - assert(area->size_in_bytes() == size_in_bytes(), "Sanity check"); + assert(_area->size_in_bytes() == size_in_bytes(), "Sanity check"); } // Roll back arena to saved top markers - area->_chunk = _chunk; - area->_hwm = _hwm; - area->_max = _max; - debug_only(area->_handle_mark_nesting--); + _area->_chunk = _chunk; + _area->_hwm = _hwm; + _area->_max = _max; + debug_only(_area->_handle_mark_nesting--); } inline HandleMarkCleaner::HandleMarkCleaner(Thread* thread) {