23 */
24
25 #ifndef SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
26 #define SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
27
28 #include "classfile/classLoaderData.inline.hpp"
29 #include "gc/serial/markSweep.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/markWord.inline.hpp"
32 #include "oops/access.inline.hpp"
33 #include "oops/compressedOops.inline.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "utilities/stack.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 markWord mark = obj->mark_raw();
41 obj->set_mark_raw(markWord::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 }
56 }
57 }
58
59 inline void MarkSweep::follow_klass(Klass* klass) {
60 oop op = klass->class_loader_data()->holder_no_keepalive();
61 MarkSweep::mark_and_push(&op);
62 }
63
|
23 */
24
25 #ifndef SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
26 #define SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
27
28 #include "classfile/classLoaderData.inline.hpp"
29 #include "gc/serial/markSweep.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/markWord.inline.hpp"
32 #include "oops/access.inline.hpp"
33 #include "oops/compressedOops.inline.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "utilities/stack.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 markWord mark = obj->mark_raw();
41 obj->set_mark_raw(markWord::prototype().set_marked());
42
43 if (obj->mark_must_be_preserved(mark)) {
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 }
56 }
57 }
58
59 inline void MarkSweep::follow_klass(Klass* klass) {
60 oop op = klass->class_loader_data()->holder_no_keepalive();
61 MarkSweep::mark_and_push(&op);
62 }
63
|