Mercurial > hg > truffle
comparison src/share/vm/memory/space.cpp @ 269:850fdf70db2b
Merge
author | jmasa |
---|---|
date | Mon, 28 Jul 2008 15:30:23 -0700 |
parents | d1605aabd0a1 12eea04c8b06 |
children | 1ee8caae33af |
comparison
equal
deleted
inserted
replaced
238:3df2fe7c4451 | 269:850fdf70db2b |
---|---|
230 CardTableModRefBS::PrecisionStyle precision, | 230 CardTableModRefBS::PrecisionStyle precision, |
231 HeapWord* boundary) { | 231 HeapWord* boundary) { |
232 return new ContiguousSpaceDCTOC(this, cl, precision, boundary); | 232 return new ContiguousSpaceDCTOC(this, cl, precision, boundary); |
233 } | 233 } |
234 | 234 |
235 void Space::initialize(MemRegion mr, bool clear_space) { | 235 void Space::initialize(MemRegion mr, |
236 bool clear_space, | |
237 bool mangle_space) { | |
236 HeapWord* bottom = mr.start(); | 238 HeapWord* bottom = mr.start(); |
237 HeapWord* end = mr.end(); | 239 HeapWord* end = mr.end(); |
238 assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end), | 240 assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end), |
239 "invalid space boundaries"); | 241 "invalid space boundaries"); |
240 set_bottom(bottom); | 242 set_bottom(bottom); |
241 set_end(end); | 243 set_end(end); |
242 if (clear_space) clear(); | 244 if (clear_space) clear(mangle_space); |
243 } | 245 } |
244 | 246 |
245 void Space::clear() { | 247 void Space::clear(bool mangle_space) { |
246 if (ZapUnusedHeapArea) mangle_unused_area(); | 248 if (ZapUnusedHeapArea && mangle_space) { |
247 } | 249 mangle_unused_area(); |
248 | 250 } |
249 void ContiguousSpace::initialize(MemRegion mr, bool clear_space) | 251 } |
252 | |
253 ContiguousSpace::ContiguousSpace(): CompactibleSpace(), _top(NULL) { | |
254 _mangler = new GenSpaceMangler(this); | |
255 } | |
256 | |
257 ContiguousSpace::~ContiguousSpace() { | |
258 delete _mangler; | |
259 } | |
260 | |
261 void ContiguousSpace::initialize(MemRegion mr, | |
262 bool clear_space, | |
263 bool mangle_space) | |
250 { | 264 { |
251 CompactibleSpace::initialize(mr, clear_space); | 265 CompactibleSpace::initialize(mr, clear_space, mangle_space); |
252 _concurrent_iteration_safe_limit = top(); | 266 _concurrent_iteration_safe_limit = top(); |
253 } | 267 } |
254 | 268 |
255 void ContiguousSpace::clear() { | 269 void ContiguousSpace::clear(bool mangle_space) { |
256 set_top(bottom()); | 270 set_top(bottom()); |
257 set_saved_mark(); | 271 set_saved_mark(); |
258 Space::clear(); | 272 Space::clear(mangle_space); |
259 } | 273 } |
260 | 274 |
261 bool Space::is_in(const void* p) const { | 275 bool Space::is_in(const void* p) const { |
262 HeapWord* b = block_start(p); | 276 HeapWord* b = block_start(p); |
263 return b != NULL && block_is_obj(b); | 277 return b != NULL && block_is_obj(b); |
269 | 283 |
270 bool ContiguousSpace::is_free_block(const HeapWord* p) const { | 284 bool ContiguousSpace::is_free_block(const HeapWord* p) const { |
271 return p >= _top; | 285 return p >= _top; |
272 } | 286 } |
273 | 287 |
274 void OffsetTableContigSpace::clear() { | 288 void OffsetTableContigSpace::clear(bool mangle_space) { |
275 ContiguousSpace::clear(); | 289 ContiguousSpace::clear(mangle_space); |
276 _offsets.initialize_threshold(); | 290 _offsets.initialize_threshold(); |
277 } | 291 } |
278 | 292 |
279 void OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) { | 293 void OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) { |
280 Space::set_bottom(new_bottom); | 294 Space::set_bottom(new_bottom); |
286 // until after the underlying offest table has been enlarged. | 300 // until after the underlying offest table has been enlarged. |
287 _offsets.resize(pointer_delta(new_end, bottom())); | 301 _offsets.resize(pointer_delta(new_end, bottom())); |
288 Space::set_end(new_end); | 302 Space::set_end(new_end); |
289 } | 303 } |
290 | 304 |
305 #ifndef PRODUCT | |
306 | |
307 void ContiguousSpace::set_top_for_allocations(HeapWord* v) { | |
308 mangler()->set_top_for_allocations(v); | |
309 } | |
310 void ContiguousSpace::set_top_for_allocations() { | |
311 mangler()->set_top_for_allocations(top()); | |
312 } | |
313 void ContiguousSpace::check_mangled_unused_area(HeapWord* limit) { | |
314 mangler()->check_mangled_unused_area(limit); | |
315 } | |
316 | |
317 void ContiguousSpace::check_mangled_unused_area_complete() { | |
318 mangler()->check_mangled_unused_area_complete(); | |
319 } | |
320 | |
321 // Mangled only the unused space that has not previously | |
322 // been mangled and that has not been allocated since being | |
323 // mangled. | |
291 void ContiguousSpace::mangle_unused_area() { | 324 void ContiguousSpace::mangle_unused_area() { |
292 // to-space is used for storing marks during mark-sweep | 325 mangler()->mangle_unused_area(); |
293 mangle_region(MemRegion(top(), end())); | 326 } |
294 } | 327 void ContiguousSpace::mangle_unused_area_complete() { |
295 | 328 mangler()->mangle_unused_area_complete(); |
329 } | |
296 void ContiguousSpace::mangle_region(MemRegion mr) { | 330 void ContiguousSpace::mangle_region(MemRegion mr) { |
297 debug_only(Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord)); | 331 // Although this method uses SpaceMangler::mangle_region() which |
298 } | 332 // is not specific to a space, the when the ContiguousSpace version |
299 | 333 // is called, it is always with regard to a space and this |
300 void CompactibleSpace::initialize(MemRegion mr, bool clear_space) { | 334 // bounds checking is appropriate. |
301 Space::initialize(mr, clear_space); | 335 MemRegion space_mr(bottom(), end()); |
336 assert(space_mr.contains(mr), "Mangling outside space"); | |
337 SpaceMangler::mangle_region(mr); | |
338 } | |
339 #endif // NOT_PRODUCT | |
340 | |
341 void CompactibleSpace::initialize(MemRegion mr, | |
342 bool clear_space, | |
343 bool mangle_space) { | |
344 Space::initialize(mr, clear_space, mangle_space); | |
302 _compaction_top = bottom(); | 345 _compaction_top = bottom(); |
303 _next_compaction_space = NULL; | 346 _next_compaction_space = NULL; |
304 } | 347 } |
305 | 348 |
306 HeapWord* CompactibleSpace::forward(oop q, size_t size, | 349 HeapWord* CompactibleSpace::forward(oop q, size_t size, |
818 obj->set_klass_gap(0); | 861 obj->set_klass_gap(0); |
819 obj->set_klass(SystemDictionary::object_klass()); | 862 obj->set_klass(SystemDictionary::object_klass()); |
820 } | 863 } |
821 } | 864 } |
822 | 865 |
823 void EdenSpace::clear() { | 866 void EdenSpace::clear(bool mangle_space) { |
824 ContiguousSpace::clear(); | 867 ContiguousSpace::clear(mangle_space); |
825 set_soft_end(end()); | 868 set_soft_end(end()); |
826 } | 869 } |
827 | 870 |
828 // Requires locking. | 871 // Requires locking. |
829 HeapWord* EdenSpace::allocate(size_t size) { | 872 HeapWord* EdenSpace::allocate(size_t size) { |
876 MemRegion mr) : | 919 MemRegion mr) : |
877 _offsets(sharedOffsetArray, mr), | 920 _offsets(sharedOffsetArray, mr), |
878 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true) | 921 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true) |
879 { | 922 { |
880 _offsets.set_contig_space(this); | 923 _offsets.set_contig_space(this); |
881 initialize(mr, true); | 924 initialize(mr, SpaceDecorator::Clear, SpaceDecorator::Mangle); |
882 } | 925 } |
883 | 926 |
884 | 927 |
885 class VerifyOldOopClosure : public OopClosure { | 928 class VerifyOldOopClosure : public OopClosure { |
886 public: | 929 public: |