< prev index next >

src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp

Print this page
rev 49290 : [mq]: JDK-8199735.01.patch
   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  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 {


   1 /*
   2  * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  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/oop.inline.hpp"
  35 #include "utilities/debug.hpp"
  36 
  37 inline bool G1FullGCMarker::mark_object(oop obj) {
  38   // Not marking closed archive objects.
  39   if (G1ArchiveAllocator::is_closed_archive_object(obj)) {
  40     return false;
  41   }
  42 
  43   // Try to mark.
  44   if (!_bitmap->par_mark(obj)) {
  45     // Lost mark race.
  46     return false;
  47   }
  48 
  49   // Marked by us, preserve if needed.
  50   markOop mark = obj->mark_raw();
  51   if (mark->must_be_preserved(obj) &&
  52       !G1ArchiveAllocator::is_open_archive_object(obj)) {
  53     preserved_stack()->push(obj, mark);
  54   }
  55 
  56   // Check if deduplicatable string.
  57   if (G1StringDedup::is_enabled()) {
  58     G1StringDedup::enqueue_from_mark(obj, _worker_id);
  59   }
  60   return true;
  61 }
  62 
  63 template <class T> inline void G1FullGCMarker::mark_and_push(T* p) {
  64   T heap_oop = oopDesc::load_heap_oop(p);
  65   if (!oopDesc::is_null(heap_oop)) {
  66     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
  67     if (mark_object(obj)) {
  68       _oop_stack.push(obj);
  69       assert(_bitmap->is_marked(obj), "Must be marked now - map self");
  70     } else {


< prev index next >