comparison src/share/vm/gc_implementation/shared/markSweep.inline.hpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
20 * CA 95054 USA or visit www.sun.com if you need additional information or 20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions. 21 * have any questions.
22 * 22 *
23 */ 23 */
24 24
25 inline void MarkSweep::_adjust_pointer(oop* p, bool isroot) {
26 oop obj = *p;
27 VALIDATE_MARK_SWEEP_ONLY(oop saved_new_pointer = NULL);
28 if (obj != NULL) {
29 oop new_pointer = oop(obj->mark()->decode_pointer());
30 assert(new_pointer != NULL || // is forwarding ptr?
31 obj->mark() == markOopDesc::prototype() || // not gc marked?
32 (UseBiasedLocking && obj->mark()->has_bias_pattern()) || // not gc marked?
33 obj->is_shared(), // never forwarded?
34 "should contain a forwarding pointer");
35 if (new_pointer != NULL) {
36 *p = new_pointer;
37 assert(Universe::heap()->is_in_reserved(new_pointer),
38 "should be in object space");
39 VALIDATE_MARK_SWEEP_ONLY(saved_new_pointer = new_pointer);
40 }
41 }
42 VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, saved_new_pointer, isroot));
43 }
44
45 inline void MarkSweep::mark_object(oop obj) { 25 inline void MarkSweep::mark_object(oop obj) {
46
47 #ifndef SERIALGC 26 #ifndef SERIALGC
48 if (UseParallelOldGC && VerifyParallelOldWithMarkSweep) { 27 if (UseParallelOldGC && VerifyParallelOldWithMarkSweep) {
49 assert(PSParallelCompact::mark_bitmap()->is_marked(obj), 28 assert(PSParallelCompact::mark_bitmap()->is_marked(obj),
50 "Should be marked in the marking bitmap"); 29 "Should be marked in the marking bitmap");
51 } 30 }
52 #endif // SERIALGC 31 #endif // SERIALGC
53 32
54 // some marks may contain information we need to preserve so we store them away 33 // some marks may contain information we need to preserve so we store them away
55 // and overwrite the mark. We'll restore it at the end of markSweep. 34 // and overwrite the mark. We'll restore it at the end of markSweep.
58 37
59 if (mark->must_be_preserved(obj)) { 38 if (mark->must_be_preserved(obj)) {
60 preserve_mark(obj, mark); 39 preserve_mark(obj, mark);
61 } 40 }
62 } 41 }
42
43 template <class T> inline void MarkSweep::follow_root(T* p) {
44 assert(!Universe::heap()->is_in_reserved(p),
45 "roots shouldn't be things within the heap");
46 #ifdef VALIDATE_MARK_SWEEP
47 if (ValidateMarkSweep) {
48 guarantee(!_root_refs_stack->contains(p), "should only be in here once");
49 _root_refs_stack->push(p);
50 }
51 #endif
52 T heap_oop = oopDesc::load_heap_oop(p);
53 if (!oopDesc::is_null(heap_oop)) {
54 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
55 if (!obj->mark()->is_marked()) {
56 mark_object(obj);
57 obj->follow_contents();
58 }
59 }
60 follow_stack();
61 }
62
63 template <class T> inline void MarkSweep::mark_and_follow(T* p) {
64 // assert(Universe::heap()->is_in_reserved(p), "should be in object space");
65 T heap_oop = oopDesc::load_heap_oop(p);
66 if (!oopDesc::is_null(heap_oop)) {
67 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
68 if (!obj->mark()->is_marked()) {
69 mark_object(obj);
70 obj->follow_contents();
71 }
72 }
73 }
74
75 template <class T> inline void MarkSweep::mark_and_push(T* p) {
76 // assert(Universe::heap()->is_in_reserved(p), "should be in object space");
77 T heap_oop = oopDesc::load_heap_oop(p);
78 if (!oopDesc::is_null(heap_oop)) {
79 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
80 if (!obj->mark()->is_marked()) {
81 mark_object(obj);
82 _marking_stack->push(obj);
83 }
84 }
85 }
86
87 template <class T> inline void MarkSweep::adjust_pointer(T* p, bool isroot) {
88 T heap_oop = oopDesc::load_heap_oop(p);
89 if (!oopDesc::is_null(heap_oop)) {
90 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
91 oop new_obj = oop(obj->mark()->decode_pointer());
92 assert(new_obj != NULL || // is forwarding ptr?
93 obj->mark() == markOopDesc::prototype() || // not gc marked?
94 (UseBiasedLocking && obj->mark()->has_bias_pattern()) ||
95 // not gc marked?
96 obj->is_shared(), // never forwarded?
97 "should be forwarded");
98 if (new_obj != NULL) {
99 assert(Universe::heap()->is_in_reserved(new_obj),
100 "should be in object space");
101 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
102 }
103 }
104 VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
105 }
106
107 template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
108 #ifdef VALIDATE_MARK_SWEEP
109 if (ValidateMarkSweep) {
110 if (!Universe::heap()->is_in_reserved(p)) {
111 _root_refs_stack->push(p);
112 } else {
113 _other_refs_stack->push(p);
114 }
115 }
116 #endif
117 mark_and_push(p);
118 }