comparison src/share/vm/memory/genOopClosures.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 37f87013dfd8
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
36 assert(rs->rs_kind() == GenRemSet::CardTable, "Wrong rem set kind"); 36 assert(rs->rs_kind() == GenRemSet::CardTable, "Wrong rem set kind");
37 _rs = (CardTableRS*)rs; 37 _rs = (CardTableRS*)rs;
38 } 38 }
39 } 39 }
40 40
41 inline void OopsInGenClosure::do_barrier(oop* p) { 41 template <class T> inline void OopsInGenClosure::do_barrier(T* p) {
42 assert(generation()->is_in_reserved(p), "expected ref in generation"); 42 assert(generation()->is_in_reserved(p), "expected ref in generation");
43 oop obj = *p; 43 assert(!oopDesc::is_null(*p), "expected non-null object");
44 assert(obj != NULL, "expected non-null object"); 44 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
45 // If p points to a younger generation, mark the card. 45 // If p points to a younger generation, mark the card.
46 if ((HeapWord*)obj < _gen_boundary) { 46 if ((HeapWord*)obj < _gen_boundary) {
47 _rs->inline_write_ref_field_gc(p, obj); 47 _rs->inline_write_ref_field_gc(p, obj);
48 } 48 }
49 } 49 }
50 50
51 // NOTE! Any changes made here should also be made 51 // NOTE! Any changes made here should also be made
52 // in FastScanClosure::do_oop(); 52 // in FastScanClosure::do_oop_work()
53 inline void ScanClosure::do_oop(oop* p) { 53 template <class T> inline void ScanClosure::do_oop_work(T* p) {
54 oop obj = *p; 54 T heap_oop = oopDesc::load_heap_oop(p);
55 // Should we copy the obj? 55 // Should we copy the obj?
56 if (obj != NULL) { 56 if (!oopDesc::is_null(heap_oop)) {
57 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
57 if ((HeapWord*)obj < _boundary) { 58 if ((HeapWord*)obj < _boundary) {
58 assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); 59 assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?");
59 if (obj->is_forwarded()) { 60 oop new_obj = obj->is_forwarded() ? obj->forwardee()
60 *p = obj->forwardee(); 61 : _g->copy_to_survivor_space(obj);
61 } else { 62 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
62 *p = _g->copy_to_survivor_space(obj, p);
63 }
64 } 63 }
65 if (_gc_barrier) { 64 if (_gc_barrier) {
66 // Now call parent closure 65 // Now call parent closure
67 do_barrier(p); 66 do_barrier(p);
68 } 67 }
69 } 68 }
70 } 69 }
71 70
72 inline void ScanClosure::do_oop_nv(oop* p) { 71 inline void ScanClosure::do_oop_nv(oop* p) { ScanClosure::do_oop_work(p); }
73 ScanClosure::do_oop(p); 72 inline void ScanClosure::do_oop_nv(narrowOop* p) { ScanClosure::do_oop_work(p); }
74 }
75 73
76 // NOTE! Any changes made here should also be made 74 // NOTE! Any changes made here should also be made
77 // in ScanClosure::do_oop(); 75 // in ScanClosure::do_oop_work()
78 inline void FastScanClosure::do_oop(oop* p) { 76 template <class T> inline void FastScanClosure::do_oop_work(T* p) {
79 oop obj = *p; 77 T heap_oop = oopDesc::load_heap_oop(p);
80 // Should we copy the obj? 78 // Should we copy the obj?
81 if (obj != NULL) { 79 if (!oopDesc::is_null(heap_oop)) {
80 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
82 if ((HeapWord*)obj < _boundary) { 81 if ((HeapWord*)obj < _boundary) {
83 assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); 82 assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?");
84 if (obj->is_forwarded()) { 83 oop new_obj = obj->is_forwarded() ? obj->forwardee()
85 *p = obj->forwardee(); 84 : _g->copy_to_survivor_space(obj);
86 } else { 85 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
87 *p = _g->copy_to_survivor_space(obj, p);
88 }
89 if (_gc_barrier) { 86 if (_gc_barrier) {
90 // Now call parent closure 87 // Now call parent closure
91 do_barrier(p); 88 do_barrier(p);
92 } 89 }
93 } 90 }
94 } 91 }
95 } 92 }
96 93
97 inline void FastScanClosure::do_oop_nv(oop* p) { 94 inline void FastScanClosure::do_oop_nv(oop* p) { FastScanClosure::do_oop_work(p); }
98 FastScanClosure::do_oop(p); 95 inline void FastScanClosure::do_oop_nv(narrowOop* p) { FastScanClosure::do_oop_work(p); }
99 }
100 96
101 // Note similarity to ScanClosure; the difference is that 97 // Note similarity to ScanClosure; the difference is that
102 // the barrier set is taken care of outside this closure. 98 // the barrier set is taken care of outside this closure.
103 inline void ScanWeakRefClosure::do_oop(oop* p) { 99 template <class T> inline void ScanWeakRefClosure::do_oop_work(T* p) {
104 oop obj = *p; 100 assert(!oopDesc::is_null(*p), "null weak reference?");
105 assert (obj != NULL, "null weak reference?"); 101 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
106 // weak references are sometimes scanned twice; must check 102 // weak references are sometimes scanned twice; must check
107 // that to-space doesn't already contain this object 103 // that to-space doesn't already contain this object
108 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) { 104 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) {
109 if (obj->is_forwarded()) { 105 oop new_obj = obj->is_forwarded() ? obj->forwardee()
110 *p = obj->forwardee(); 106 : _g->copy_to_survivor_space(obj);
111 } else { 107 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
112 *p = _g->copy_to_survivor_space(obj, p);
113 }
114 } 108 }
115 } 109 }
116 110
117 inline void ScanWeakRefClosure::do_oop_nv(oop* p) { 111 inline void ScanWeakRefClosure::do_oop_nv(oop* p) { ScanWeakRefClosure::do_oop_work(p); }
118 ScanWeakRefClosure::do_oop(p); 112 inline void ScanWeakRefClosure::do_oop_nv(narrowOop* p) { ScanWeakRefClosure::do_oop_work(p); }
119 }