Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/genOopClosures.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 |
---|---|
26 class HeapWord; | 26 class HeapWord; |
27 class CardTableRS; | 27 class CardTableRS; |
28 class CardTableModRefBS; | 28 class CardTableModRefBS; |
29 class DefNewGeneration; | 29 class DefNewGeneration; |
30 | 30 |
31 template<class E> class GenericTaskQueue; | |
32 typedef GenericTaskQueue<oop> OopTaskQueue; | |
33 template<class E> class GenericTaskQueueSet; | |
34 typedef GenericTaskQueueSet<oop> OopTaskQueueSet; | |
35 | |
31 // Closure for iterating roots from a particular generation | 36 // Closure for iterating roots from a particular generation |
32 // Note: all classes deriving from this MUST call this do_barrier | 37 // Note: all classes deriving from this MUST call this do_barrier |
33 // method at the end of their own do_oop method! | 38 // method at the end of their own do_oop method! |
34 // Note: no do_oop defined, this is an abstract class. | 39 // Note: no do_oop defined, this is an abstract class. |
35 | 40 |
36 class OopsInGenClosure : public OopClosure { | 41 class OopsInGenClosure : public OopClosure { |
37 private: | 42 private: |
38 Generation* _orig_gen; // generation originally set in ctor | 43 Generation* _orig_gen; // generation originally set in ctor |
39 Generation* _gen; // generation being scanned | 44 Generation* _gen; // generation being scanned |
40 | 45 |
41 protected: | 46 protected: |
42 // Some subtypes need access. | 47 // Some subtypes need access. |
43 HeapWord* _gen_boundary; // start of generation | 48 HeapWord* _gen_boundary; // start of generation |
44 CardTableRS* _rs; // remembered set | 49 CardTableRS* _rs; // remembered set |
45 | 50 |
46 // For assertions | 51 // For assertions |
47 Generation* generation() { return _gen; } | 52 Generation* generation() { return _gen; } |
48 CardTableRS* rs() { return _rs; } | 53 CardTableRS* rs() { return _rs; } |
49 | 54 |
50 // Derived classes that modify oops so that they might be old-to-young | 55 // Derived classes that modify oops so that they might be old-to-young |
51 // pointers must call the method below. | 56 // pointers must call the method below. |
52 void do_barrier(oop* p); | 57 template <class T> void do_barrier(T* p); |
53 | 58 |
54 public: | 59 public: |
55 OopsInGenClosure() : OopClosure(NULL), | 60 OopsInGenClosure() : OopClosure(NULL), |
56 _orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {}; | 61 _orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {}; |
57 | 62 |
73 // Closure for scanning DefNewGeneration. | 78 // Closure for scanning DefNewGeneration. |
74 // | 79 // |
75 // This closure will perform barrier store calls for ALL | 80 // This closure will perform barrier store calls for ALL |
76 // pointers in scanned oops. | 81 // pointers in scanned oops. |
77 class ScanClosure: public OopsInGenClosure { | 82 class ScanClosure: public OopsInGenClosure { |
78 protected: | 83 protected: |
79 DefNewGeneration* _g; | 84 DefNewGeneration* _g; |
80 HeapWord* _boundary; | 85 HeapWord* _boundary; |
81 bool _gc_barrier; | 86 bool _gc_barrier; |
82 public: | 87 template <class T> inline void do_oop_work(T* p); |
88 public: | |
83 ScanClosure(DefNewGeneration* g, bool gc_barrier); | 89 ScanClosure(DefNewGeneration* g, bool gc_barrier); |
84 void do_oop(oop* p); | 90 virtual void do_oop(oop* p); |
85 void do_oop_nv(oop* p); | 91 virtual void do_oop(narrowOop* p); |
92 inline void do_oop_nv(oop* p); | |
93 inline void do_oop_nv(narrowOop* p); | |
86 bool do_header() { return false; } | 94 bool do_header() { return false; } |
87 Prefetch::style prefetch_style() { | 95 Prefetch::style prefetch_style() { |
88 return Prefetch::do_write; | 96 return Prefetch::do_write; |
89 } | 97 } |
90 }; | 98 }; |
93 // | 101 // |
94 // This closure only performs barrier store calls on | 102 // This closure only performs barrier store calls on |
95 // pointers into the DefNewGeneration. This is less | 103 // pointers into the DefNewGeneration. This is less |
96 // precise, but faster, than a ScanClosure | 104 // precise, but faster, than a ScanClosure |
97 class FastScanClosure: public OopsInGenClosure { | 105 class FastScanClosure: public OopsInGenClosure { |
98 protected: | 106 protected: |
99 DefNewGeneration* _g; | 107 DefNewGeneration* _g; |
100 HeapWord* _boundary; | 108 HeapWord* _boundary; |
101 bool _gc_barrier; | 109 bool _gc_barrier; |
102 public: | 110 template <class T> inline void do_oop_work(T* p); |
111 public: | |
103 FastScanClosure(DefNewGeneration* g, bool gc_barrier); | 112 FastScanClosure(DefNewGeneration* g, bool gc_barrier); |
104 void do_oop(oop* p); | 113 virtual void do_oop(oop* p); |
105 void do_oop_nv(oop* p); | 114 virtual void do_oop(narrowOop* p); |
115 inline void do_oop_nv(oop* p); | |
116 inline void do_oop_nv(narrowOop* p); | |
106 bool do_header() { return false; } | 117 bool do_header() { return false; } |
107 Prefetch::style prefetch_style() { | 118 Prefetch::style prefetch_style() { |
108 return Prefetch::do_write; | 119 return Prefetch::do_write; |
109 } | 120 } |
110 }; | 121 }; |
111 | 122 |
112 class FilteringClosure: public OopClosure { | 123 class FilteringClosure: public OopClosure { |
113 HeapWord* _boundary; | 124 private: |
125 HeapWord* _boundary; | |
114 OopClosure* _cl; | 126 OopClosure* _cl; |
115 public: | 127 protected: |
128 template <class T> inline void do_oop_work(T* p) { | |
129 T heap_oop = oopDesc::load_heap_oop(p); | |
130 if (!oopDesc::is_null(heap_oop)) { | |
131 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); | |
132 if ((HeapWord*)obj < _boundary) { | |
133 _cl->do_oop(p); | |
134 } | |
135 } | |
136 } | |
137 public: | |
116 FilteringClosure(HeapWord* boundary, OopClosure* cl) : | 138 FilteringClosure(HeapWord* boundary, OopClosure* cl) : |
117 OopClosure(cl->_ref_processor), _boundary(boundary), | 139 OopClosure(cl->_ref_processor), _boundary(boundary), |
118 _cl(cl) {} | 140 _cl(cl) {} |
119 void do_oop(oop* p); | 141 virtual void do_oop(oop* p); |
120 void do_oop_nv(oop* p) { | 142 virtual void do_oop(narrowOop* p); |
121 oop obj = *p; | 143 inline void do_oop_nv(oop* p) { FilteringClosure::do_oop_work(p); } |
122 if ((HeapWord*)obj < _boundary && obj != NULL) { | 144 inline void do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); } |
123 _cl->do_oop(p); | |
124 } | |
125 } | |
126 bool do_header() { return false; } | 145 bool do_header() { return false; } |
127 }; | 146 }; |
128 | 147 |
129 // Closure for scanning DefNewGeneration's weak references. | 148 // Closure for scanning DefNewGeneration's weak references. |
130 // NOTE: very much like ScanClosure but not derived from | 149 // NOTE: very much like ScanClosure but not derived from |
131 // OopsInGenClosure -- weak references are processed all | 150 // OopsInGenClosure -- weak references are processed all |
132 // at once, with no notion of which generation they were in. | 151 // at once, with no notion of which generation they were in. |
133 class ScanWeakRefClosure: public OopClosure { | 152 class ScanWeakRefClosure: public OopClosure { |
134 protected: | 153 protected: |
135 DefNewGeneration* _g; | 154 DefNewGeneration* _g; |
136 HeapWord* _boundary; | 155 HeapWord* _boundary; |
137 public: | 156 template <class T> inline void do_oop_work(T* p); |
157 public: | |
138 ScanWeakRefClosure(DefNewGeneration* g); | 158 ScanWeakRefClosure(DefNewGeneration* g); |
139 void do_oop(oop* p); | 159 virtual void do_oop(oop* p); |
140 void do_oop_nv(oop* p); | 160 virtual void do_oop(narrowOop* p); |
161 inline void do_oop_nv(oop* p); | |
162 inline void do_oop_nv(narrowOop* p); | |
141 }; | 163 }; |
142 | 164 |
143 class VerifyOopClosure: public OopClosure { | 165 class VerifyOopClosure: public OopClosure { |
144 public: | 166 protected: |
145 void do_oop(oop* p) { | 167 template <class T> inline void do_oop_work(T* p) { |
146 guarantee((*p)->is_oop_or_null(), "invalid oop"); | 168 oop obj = oopDesc::load_decode_heap_oop(p); |
169 guarantee(obj->is_oop_or_null(), "invalid oop"); | |
147 } | 170 } |
171 public: | |
172 virtual void do_oop(oop* p); | |
173 virtual void do_oop(narrowOop* p); | |
148 static VerifyOopClosure verify_oop; | 174 static VerifyOopClosure verify_oop; |
149 }; | 175 }; |