< prev index next >

src/hotspot/share/gc/serial/markSweep.inline.hpp

Print this page




  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_SERIAL_MARKSWEEP_INLINE_HPP
  26 #define SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP
  27 
  28 #include "classfile/classLoaderData.inline.hpp"
  29 #include "gc/serial/markSweep.hpp"
  30 #include "memory/metaspaceShared.hpp"
  31 #include "memory/universe.hpp"
  32 #include "oops/markOop.inline.hpp"
  33 #include "oops/access.inline.hpp"
  34 #include "oops/compressedOops.inline.hpp"
  35 #include "oops/oop.inline.hpp"

  36 
  37 inline void MarkSweep::mark_object(oop obj) {
  38   // some marks may contain information we need to preserve so we store them away
  39   // and overwrite the mark.  We'll restore it at the end of markSweep.
  40   markOop mark = obj->mark_raw();
  41   obj->set_mark_raw(markOopDesc::prototype()->set_marked());
  42 
  43   if (mark->must_be_preserved(obj)) {
  44     preserve_mark(obj, mark);
  45   }
  46 }
  47 
  48 template <class T> inline void MarkSweep::mark_and_push(T* p) {
  49   T heap_oop = RawAccess<>::oop_load(p);
  50   if (!CompressedOops::is_null(heap_oop)) {
  51     oop obj = CompressedOops::decode_not_null(heap_oop);
  52     if (!obj->mark_raw()->is_marked()) {
  53       mark_object(obj);
  54       _marking_stack.push(obj);
  55     }




  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_SERIAL_MARKSWEEP_INLINE_HPP
  26 #define SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP
  27 
  28 #include "classfile/classLoaderData.inline.hpp"
  29 #include "gc/serial/markSweep.hpp"
  30 #include "memory/metaspaceShared.hpp"
  31 #include "memory/universe.hpp"
  32 #include "oops/markOop.inline.hpp"
  33 #include "oops/access.inline.hpp"
  34 #include "oops/compressedOops.inline.hpp"
  35 #include "oops/oop.inline.hpp"
  36 #include "utilities/stack.inline.hpp"
  37 
  38 inline void MarkSweep::mark_object(oop obj) {
  39   // some marks may contain information we need to preserve so we store them away
  40   // and overwrite the mark.  We'll restore it at the end of markSweep.
  41   markOop mark = obj->mark_raw();
  42   obj->set_mark_raw(markOopDesc::prototype()->set_marked());
  43 
  44   if (mark->must_be_preserved(obj)) {
  45     preserve_mark(obj, mark);
  46   }
  47 }
  48 
  49 template <class T> inline void MarkSweep::mark_and_push(T* p) {
  50   T heap_oop = RawAccess<>::oop_load(p);
  51   if (!CompressedOops::is_null(heap_oop)) {
  52     oop obj = CompressedOops::decode_not_null(heap_oop);
  53     if (!obj->mark_raw()->is_marked()) {
  54       mark_object(obj);
  55       _marking_stack.push(obj);
  56     }


< prev index next >