14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP 26 #define SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP 27 28 #include "gc/g1/g1Allocator.inline.hpp" 29 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" 30 #include "gc/g1/g1FullGCMarker.hpp" 31 #include "gc/g1/g1StringDedup.hpp" 32 #include "gc/g1/g1StringDedupQueue.hpp" 33 #include "gc/shared/preservedMarks.inline.hpp" 34 #include "utilities/debug.hpp" 35 36 inline bool G1FullGCMarker::mark_object(oop obj) { 37 // Not marking closed archive objects. 38 if (G1ArchiveAllocator::is_closed_archive_object(obj)) { 39 return false; 40 } 41 42 // Try to mark. 43 if (!_bitmap->par_mark(obj)) { 44 // Lost mark race. 45 return false; 46 } 47 48 // Marked by us, preserve if needed. 49 markOop mark = obj->mark(); 50 if (mark->must_be_preserved(obj) && 51 !G1ArchiveAllocator::is_open_archive_object(obj)) { 52 preserved_stack()->push(obj, mark); 53 } 54 55 // Check if deduplicatable string. 56 if (G1StringDedup::is_enabled()) { 57 G1StringDedup::enqueue_from_mark(obj, _worker_id); 58 } 59 return true; 60 } 61 62 template <class T> inline void G1FullGCMarker::mark_and_push(T* p) { 63 T heap_oop = oopDesc::load_heap_oop(p); 64 if (!oopDesc::is_null(heap_oop)) { 65 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); 66 if (mark_object(obj)) { 67 _oop_stack.push(obj); 68 assert(_bitmap->is_marked(obj), "Must be marked now - map self"); 69 } else { 70 assert(_bitmap->is_marked(obj) || G1ArchiveAllocator::is_closed_archive_object(obj), 71 "Must be marked by other or closed archive object"); 72 } 73 } 74 } 75 76 inline bool G1FullGCMarker::is_empty() { 77 return _oop_stack.is_empty() && _objarray_stack.is_empty(); 78 } 79 80 inline bool G1FullGCMarker::pop_object(oop& oop) { 81 return _oop_stack.pop_overflow(oop) || _oop_stack.pop_local(oop); 82 } 83 84 inline void G1FullGCMarker::push_objarray(oop obj, size_t index) { 85 ObjArrayTask task(obj, index); | 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP 26 #define SHARE_VM_GC_G1_G1MARKSTACK_INLINE_HPP 27 28 #include "gc/g1/g1Allocator.inline.hpp" 29 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" 30 #include "gc/g1/g1FullGCMarker.hpp" 31 #include "gc/g1/g1StringDedup.hpp" 32 #include "gc/g1/g1StringDedupQueue.hpp" 33 #include "gc/shared/preservedMarks.inline.hpp" 34 #include "oops/access.inline.hpp" 35 #include "oops/compressedOops.inline.hpp" 36 #include "utilities/debug.hpp" 37 38 inline bool G1FullGCMarker::mark_object(oop obj) { 39 // Not marking closed archive objects. 40 if (G1ArchiveAllocator::is_closed_archive_object(obj)) { 41 return false; 42 } 43 44 // Try to mark. 45 if (!_bitmap->par_mark(obj)) { 46 // Lost mark race. 47 return false; 48 } 49 50 // Marked by us, preserve if needed. 51 markOop mark = obj->mark(); 52 if (mark->must_be_preserved(obj) && 53 !G1ArchiveAllocator::is_open_archive_object(obj)) { 54 preserved_stack()->push(obj, mark); 55 } 56 57 // Check if deduplicatable string. 58 if (G1StringDedup::is_enabled()) { 59 G1StringDedup::enqueue_from_mark(obj, _worker_id); 60 } 61 return true; 62 } 63 64 template <class T> inline void G1FullGCMarker::mark_and_push(T* p) { 65 T heap_oop = RawAccess<>::oop_load(p); 66 if (!CompressedOops::is_null(heap_oop)) { 67 oop obj = CompressedOops::decode_not_null(heap_oop); 68 if (mark_object(obj)) { 69 _oop_stack.push(obj); 70 assert(_bitmap->is_marked(obj), "Must be marked now - map self"); 71 } else { 72 assert(_bitmap->is_marked(obj) || G1ArchiveAllocator::is_closed_archive_object(obj), 73 "Must be marked by other or closed archive object"); 74 } 75 } 76 } 77 78 inline bool G1FullGCMarker::is_empty() { 79 return _oop_stack.is_empty() && _objarray_stack.is_empty(); 80 } 81 82 inline bool G1FullGCMarker::pop_object(oop& oop) { 83 return _oop_stack.pop_overflow(oop) || _oop_stack.pop_local(oop); 84 } 85 86 inline void G1FullGCMarker::push_objarray(oop obj, size_t index) { 87 ObjArrayTask task(obj, index); |