comparison src/share/vm/memory/space.cpp @ 362:f8199438385b

Merge
author apetrusenko
date Wed, 17 Sep 2008 16:49:18 +0400
parents 1ee8caae33af
children 122d10c82f3f
comparison
equal deleted inserted replaced
316:5fa96a5a7e76 362:f8199438385b
103 assert(_precision == CardTableModRefBS::ObjHeadPreciseArray || 103 assert(_precision == CardTableModRefBS::ObjHeadPreciseArray ||
104 _precision == CardTableModRefBS::Precise, 104 _precision == CardTableModRefBS::Precise,
105 "Only ones we deal with for now."); 105 "Only ones we deal with for now.");
106 106
107 assert(_precision != CardTableModRefBS::ObjHeadPreciseArray || 107 assert(_precision != CardTableModRefBS::ObjHeadPreciseArray ||
108 _last_bottom == NULL || 108 _cl->idempotent() || _last_bottom == NULL ||
109 top <= _last_bottom, 109 top <= _last_bottom,
110 "Not decreasing"); 110 "Not decreasing");
111 NOT_PRODUCT(_last_bottom = mr.start()); 111 NOT_PRODUCT(_last_bottom = mr.start());
112 112
113 bottom_obj = _sp->block_start(bottom); 113 bottom_obj = _sp->block_start(bottom);
142 // Walk the region if it is not empty; otherwise there is nothing to do. 142 // Walk the region if it is not empty; otherwise there is nothing to do.
143 if (!mr.is_empty()) { 143 if (!mr.is_empty()) {
144 walk_mem_region(mr, bottom_obj, top); 144 walk_mem_region(mr, bottom_obj, top);
145 } 145 }
146 146
147 _min_done = bottom; 147 // An idempotent closure might be applied in any order, so we don't
148 // record a _min_done for it.
149 if (!_cl->idempotent()) {
150 _min_done = bottom;
151 } else {
152 assert(_min_done == _last_explicit_min_done,
153 "Don't update _min_done for idempotent cl");
154 }
148 } 155 }
149 156
150 DirtyCardToOopClosure* Space::new_dcto_cl(OopClosure* cl, 157 DirtyCardToOopClosure* Space::new_dcto_cl(OopClosure* cl,
151 CardTableModRefBS::PrecisionStyle precision, 158 CardTableModRefBS::PrecisionStyle precision,
152 HeapWord* boundary) { 159 HeapWord* boundary) {
248 if (ZapUnusedHeapArea && mangle_space) { 255 if (ZapUnusedHeapArea && mangle_space) {
249 mangle_unused_area(); 256 mangle_unused_area();
250 } 257 }
251 } 258 }
252 259
253 ContiguousSpace::ContiguousSpace(): CompactibleSpace(), _top(NULL) { 260 ContiguousSpace::ContiguousSpace(): CompactibleSpace(), _top(NULL),
261 _concurrent_iteration_safe_limit(NULL) {
254 _mangler = new GenSpaceMangler(this); 262 _mangler = new GenSpaceMangler(this);
255 } 263 }
256 264
257 ContiguousSpace::~ContiguousSpace() { 265 ContiguousSpace::~ContiguousSpace() {
258 delete _mangler; 266 delete _mangler;
261 void ContiguousSpace::initialize(MemRegion mr, 269 void ContiguousSpace::initialize(MemRegion mr,
262 bool clear_space, 270 bool clear_space,
263 bool mangle_space) 271 bool mangle_space)
264 { 272 {
265 CompactibleSpace::initialize(mr, clear_space, mangle_space); 273 CompactibleSpace::initialize(mr, clear_space, mangle_space);
266 _concurrent_iteration_safe_limit = top(); 274 set_concurrent_iteration_safe_limit(top());
267 } 275 }
268 276
269 void ContiguousSpace::clear(bool mangle_space) { 277 void ContiguousSpace::clear(bool mangle_space) {
270 set_top(bottom()); 278 set_top(bottom());
271 set_saved_mark(); 279 set_saved_mark();
272 Space::clear(mangle_space); 280 CompactibleSpace::clear(mangle_space);
273 } 281 }
274 282
275 bool Space::is_in(const void* p) const { 283 bool Space::is_in(const void* p) const {
276 HeapWord* b = block_start(p); 284 HeapWord* b = block_start_const(p);
277 return b != NULL && block_is_obj(b); 285 return b != NULL && block_is_obj(b);
278 } 286 }
279 287
280 bool ContiguousSpace::is_in(const void* p) const { 288 bool ContiguousSpace::is_in(const void* p) const {
281 return _bottom <= p && p < _top; 289 return _bottom <= p && p < _top;
340 348
341 void CompactibleSpace::initialize(MemRegion mr, 349 void CompactibleSpace::initialize(MemRegion mr,
342 bool clear_space, 350 bool clear_space,
343 bool mangle_space) { 351 bool mangle_space) {
344 Space::initialize(mr, clear_space, mangle_space); 352 Space::initialize(mr, clear_space, mangle_space);
353 set_compaction_top(bottom());
354 _next_compaction_space = NULL;
355 }
356
357 void CompactibleSpace::clear(bool mangle_space) {
358 Space::clear(mangle_space);
345 _compaction_top = bottom(); 359 _compaction_top = bottom();
346 _next_compaction_space = NULL;
347 } 360 }
348 361
349 HeapWord* CompactibleSpace::forward(oop q, size_t size, 362 HeapWord* CompactibleSpace::forward(oop q, size_t size,
350 CompactPoint* cp, HeapWord* compact_top) { 363 CompactPoint* cp, HeapWord* compact_top) {
351 // q is alive 364 // q is alive
518 prev_p = p; 531 prev_p = p;
519 p += oop(p)->size(); 532 p += oop(p)->size();
520 } 533 }
521 guarantee(p == top(), "end of last object must match end of space"); 534 guarantee(p == top(), "end of last object must match end of space");
522 if (top() != end()) { 535 if (top() != end()) {
523 guarantee(top() == block_start(end()-1) && 536 guarantee(top() == block_start_const(end()-1) &&
524 top() == block_start(top()), 537 top() == block_start_const(top()),
525 "top should be start of unallocated block, if it exists"); 538 "top should be start of unallocated block, if it exists");
526 } 539 }
527 } 540 }
528 541
529 void Space::oop_iterate(OopClosure* blk) { 542 void Space::oop_iterate(OopClosure* blk) {
751 ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN) 764 ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
752 765
753 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN 766 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN
754 767
755 // Very general, slow implementation. 768 // Very general, slow implementation.
756 HeapWord* ContiguousSpace::block_start(const void* p) const { 769 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
757 assert(MemRegion(bottom(), end()).contains(p), "p not in space"); 770 assert(MemRegion(bottom(), end()).contains(p), "p not in space");
758 if (p >= top()) { 771 if (p >= top()) {
759 return top(); 772 return top();
760 } else { 773 } else {
761 HeapWord* last = bottom(); 774 HeapWord* last = bottom();
955 while (p < top()) { 968 while (p < top()) {
956 size_t size = oop(p)->size(); 969 size_t size = oop(p)->size();
957 // For a sampling of objects in the space, find it using the 970 // For a sampling of objects in the space, find it using the
958 // block offset table. 971 // block offset table.
959 if (blocks == BLOCK_SAMPLE_INTERVAL) { 972 if (blocks == BLOCK_SAMPLE_INTERVAL) {
960 guarantee(p == block_start(p + (size/2)), "check offset computation"); 973 guarantee(p == block_start_const(p + (size/2)),
974 "check offset computation");
961 blocks = 0; 975 blocks = 0;
962 } else { 976 } else {
963 blocks++; 977 blocks++;
964 } 978 }
965 979