src/hotspot/share/gc/serial/markSweep.inline.hpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 53244 9807daeb47c4
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    26 #define SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
    26 #define SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
    27 
    27 
    28 #include "classfile/classLoaderData.inline.hpp"
    28 #include "classfile/classLoaderData.inline.hpp"
    29 #include "gc/serial/markSweep.hpp"
    29 #include "gc/serial/markSweep.hpp"
    30 #include "memory/universe.hpp"
    30 #include "memory/universe.hpp"
    31 #include "oops/markOop.inline.hpp"
    31 #include "oops/markWord.inline.hpp"
    32 #include "oops/access.inline.hpp"
    32 #include "oops/access.inline.hpp"
    33 #include "oops/compressedOops.inline.hpp"
    33 #include "oops/compressedOops.inline.hpp"
    34 #include "oops/oop.inline.hpp"
    34 #include "oops/oop.inline.hpp"
       
    35 #include "utilities/align.hpp"
    35 #include "utilities/stack.inline.hpp"
    36 #include "utilities/stack.inline.hpp"
    36 
    37 
    37 inline void MarkSweep::mark_object(oop obj) {
    38 inline void MarkSweep::mark_object(oop obj) {
    38   // some marks may contain information we need to preserve so we store them away
    39   // 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   // and overwrite the mark.  We'll restore it at the end of markSweep.
    40   markOop mark = obj->mark_raw();
    41   markWord mark = obj->mark_raw();
    41   obj->set_mark_raw(markOopDesc::prototype()->set_marked());
    42   obj->set_mark_raw(markWord::prototype().set_marked());
    42 
    43 
    43   if (mark->must_be_preserved(obj)) {
    44   if (obj->mark_must_be_preserved(mark)) {
    44     preserve_mark(obj, mark);
    45     preserve_mark(obj, mark);
    45   }
    46   }
    46 }
    47 }
    47 
    48 
    48 template <class T> inline void MarkSweep::mark_and_push(T* p) {
    49 template <class T> inline void MarkSweep::mark_and_push(T* p) {
    49   T heap_oop = RawAccess<>::oop_load(p);
    50   T heap_oop = RawAccess<>::oop_load(p);
    50   if (!CompressedOops::is_null(heap_oop)) {
    51   if (!CompressedOops::is_null(heap_oop)) {
    51     oop obj = CompressedOops::decode_not_null(heap_oop);
    52     oop obj = CompressedOops::decode_not_null(heap_oop);
    52     if (!obj->mark_raw()->is_marked()) {
    53     if (!obj->mark_raw().is_marked()) {
    53       mark_object(obj);
    54       mark_object(obj);
    54       _marking_stack.push(obj);
    55       _marking_stack.push(obj);
    55     }
    56     }
    56   }
    57   }
    57 }
    58 }
    76   T heap_oop = RawAccess<>::oop_load(p);
    77   T heap_oop = RawAccess<>::oop_load(p);
    77   if (!CompressedOops::is_null(heap_oop)) {
    78   if (!CompressedOops::is_null(heap_oop)) {
    78     oop obj = CompressedOops::decode_not_null(heap_oop);
    79     oop obj = CompressedOops::decode_not_null(heap_oop);
    79     assert(Universe::heap()->is_in(obj), "should be in heap");
    80     assert(Universe::heap()->is_in(obj), "should be in heap");
    80 
    81 
    81     oop new_obj = oop(obj->mark_raw()->decode_pointer());
    82     oop new_obj = oop(obj->mark_raw().decode_pointer());
    82 
    83 
    83     assert(new_obj != NULL ||                         // is forwarding ptr?
    84     assert(new_obj != NULL ||                          // is forwarding ptr?
    84            obj->mark_raw() == markOopDesc::prototype() || // not gc marked?
    85            obj->mark_raw() == markWord::prototype() || // not gc marked?
    85            (UseBiasedLocking && obj->mark_raw()->has_bias_pattern()),
    86            (UseBiasedLocking && obj->mark_raw().has_bias_pattern()),
    86            // not gc marked?
    87            // not gc marked?
    87            "should be forwarded");
    88            "should be forwarded");
    88 
    89 
    89     if (new_obj != NULL) {
    90     if (new_obj != NULL) {
    90       assert(Universe::heap()->is_in_reserved(new_obj),
    91       assert(is_object_aligned(new_obj), "oop must be aligned");
    91              "should be in object space");
       
    92       RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
    92       RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
    93     }
    93     }
    94   }
    94   }
    95 }
    95 }
    96 
    96