Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @ 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 | 73e96e5c30df |
children | feeb96a45707 |
comparison
equal
deleted
inserted
replaced
110:a49a647afe9a | 113:ba764ed4b6f2 |
---|---|
102 // Restore length so that it can be used if there | 102 // Restore length so that it can be used if there |
103 // is a promotion failure and forwarding pointers | 103 // is a promotion failure and forwarding pointers |
104 // must be removed. | 104 // must be removed. |
105 arrayOop(old)->set_length(end); | 105 arrayOop(old)->set_length(end); |
106 } | 106 } |
107 | |
107 // process our set of indices (include header in first chunk) | 108 // process our set of indices (include header in first chunk) |
108 oop* start_addr = start == 0 ? (oop*)obj : obj->obj_at_addr(start); | 109 // should make sure end is even (aligned to HeapWord in case of compressed oops) |
109 oop* end_addr = obj->base() + end; // obj_at_addr(end) asserts end < length | |
110 MemRegion mr((HeapWord*)start_addr, (HeapWord*)end_addr); | |
111 if ((HeapWord *)obj < young_old_boundary()) { | 110 if ((HeapWord *)obj < young_old_boundary()) { |
112 // object is in to_space | 111 // object is in to_space |
113 obj->oop_iterate(&_to_space_closure, mr); | 112 obj->oop_iterate_range(&_to_space_closure, start, end); |
114 } else { | 113 } else { |
115 // object is in old generation | 114 // object is in old generation |
116 obj->oop_iterate(&_old_gen_closure, mr); | 115 obj->oop_iterate_range(&_old_gen_closure, start, end); |
117 } | 116 } |
118 } | 117 } |
119 | 118 |
120 | 119 |
121 void ParScanThreadState::trim_queues(int max_size) { | 120 void ParScanThreadState::trim_queues(int max_size) { |
317 } | 316 } |
318 } | 317 } |
319 } | 318 } |
320 } | 319 } |
321 | 320 |
322 | |
323 ParScanClosure::ParScanClosure(ParNewGeneration* g, | 321 ParScanClosure::ParScanClosure(ParNewGeneration* g, |
324 ParScanThreadState* par_scan_state) : | 322 ParScanThreadState* par_scan_state) : |
325 OopsInGenClosure(g), _par_scan_state(par_scan_state), _g(g) | 323 OopsInGenClosure(g), _par_scan_state(par_scan_state), _g(g) |
326 { | 324 { |
327 assert(_g->level() == 0, "Optimized for youngest generation"); | 325 assert(_g->level() == 0, "Optimized for youngest generation"); |
328 _boundary = _g->reserved().end(); | 326 _boundary = _g->reserved().end(); |
329 } | 327 } |
330 | 328 |
329 void ParScanWithBarrierClosure::do_oop(oop* p) { ParScanClosure::do_oop_work(p, true, false); } | |
330 void ParScanWithBarrierClosure::do_oop(narrowOop* p) { ParScanClosure::do_oop_work(p, true, false); } | |
331 | |
332 void ParScanWithoutBarrierClosure::do_oop(oop* p) { ParScanClosure::do_oop_work(p, false, false); } | |
333 void ParScanWithoutBarrierClosure::do_oop(narrowOop* p) { ParScanClosure::do_oop_work(p, false, false); } | |
334 | |
335 void ParRootScanWithBarrierTwoGensClosure::do_oop(oop* p) { ParScanClosure::do_oop_work(p, true, true); } | |
336 void ParRootScanWithBarrierTwoGensClosure::do_oop(narrowOop* p) { ParScanClosure::do_oop_work(p, true, true); } | |
337 | |
338 void ParRootScanWithoutBarrierClosure::do_oop(oop* p) { ParScanClosure::do_oop_work(p, false, true); } | |
339 void ParRootScanWithoutBarrierClosure::do_oop(narrowOop* p) { ParScanClosure::do_oop_work(p, false, true); } | |
340 | |
331 ParScanWeakRefClosure::ParScanWeakRefClosure(ParNewGeneration* g, | 341 ParScanWeakRefClosure::ParScanWeakRefClosure(ParNewGeneration* g, |
332 ParScanThreadState* par_scan_state) | 342 ParScanThreadState* par_scan_state) |
333 : ScanWeakRefClosure(g), _par_scan_state(par_scan_state) | 343 : ScanWeakRefClosure(g), _par_scan_state(par_scan_state) |
334 { | 344 {} |
335 } | 345 |
346 void ParScanWeakRefClosure::do_oop(oop* p) { ParScanWeakRefClosure::do_oop_work(p); } | |
347 void ParScanWeakRefClosure::do_oop(narrowOop* p) { ParScanWeakRefClosure::do_oop_work(p); } | |
336 | 348 |
337 #ifdef WIN32 | 349 #ifdef WIN32 |
338 #pragma warning(disable: 4786) /* identifier was truncated to '255' characters in the browser information */ | 350 #pragma warning(disable: 4786) /* identifier was truncated to '255' characters in the browser information */ |
339 #endif | 351 #endif |
340 | 352 |
473 | 485 |
474 // ParNewGeneration:: | 486 // ParNewGeneration:: |
475 ParKeepAliveClosure::ParKeepAliveClosure(ParScanWeakRefClosure* cl) : | 487 ParKeepAliveClosure::ParKeepAliveClosure(ParScanWeakRefClosure* cl) : |
476 DefNewGeneration::KeepAliveClosure(cl), _par_cl(cl) {} | 488 DefNewGeneration::KeepAliveClosure(cl), _par_cl(cl) {} |
477 | 489 |
478 void | 490 template <class T> |
479 // ParNewGeneration:: | 491 void /*ParNewGeneration::*/ParKeepAliveClosure::do_oop_work(T* p) { |
480 ParKeepAliveClosure::do_oop(oop* p) { | 492 #ifdef ASSERT |
481 // We never expect to see a null reference being processed | 493 { |
482 // as a weak reference. | 494 assert(!oopDesc::is_null(*p), "expected non-null ref"); |
483 assert (*p != NULL, "expected non-null ref"); | 495 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
484 assert ((*p)->is_oop(), "expected an oop while scanning weak refs"); | 496 // We never expect to see a null reference being processed |
497 // as a weak reference. | |
498 assert(obj->is_oop(), "expected an oop while scanning weak refs"); | |
499 } | |
500 #endif // ASSERT | |
485 | 501 |
486 _par_cl->do_oop_nv(p); | 502 _par_cl->do_oop_nv(p); |
487 | 503 |
488 if (Universe::heap()->is_in_reserved(p)) { | 504 if (Universe::heap()->is_in_reserved(p)) { |
489 _rs->write_ref_field_gc_par(p, *p); | 505 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
490 } | 506 _rs->write_ref_field_gc_par(p, obj); |
491 } | 507 } |
508 } | |
509 | |
510 void /*ParNewGeneration::*/ParKeepAliveClosure::do_oop(oop* p) { ParKeepAliveClosure::do_oop_work(p); } | |
511 void /*ParNewGeneration::*/ParKeepAliveClosure::do_oop(narrowOop* p) { ParKeepAliveClosure::do_oop_work(p); } | |
492 | 512 |
493 // ParNewGeneration:: | 513 // ParNewGeneration:: |
494 KeepAliveClosure::KeepAliveClosure(ScanWeakRefClosure* cl) : | 514 KeepAliveClosure::KeepAliveClosure(ScanWeakRefClosure* cl) : |
495 DefNewGeneration::KeepAliveClosure(cl) {} | 515 DefNewGeneration::KeepAliveClosure(cl) {} |
496 | 516 |
497 void | 517 template <class T> |
498 // ParNewGeneration:: | 518 void /*ParNewGeneration::*/KeepAliveClosure::do_oop_work(T* p) { |
499 KeepAliveClosure::do_oop(oop* p) { | 519 #ifdef ASSERT |
500 // We never expect to see a null reference being processed | 520 { |
501 // as a weak reference. | 521 assert(!oopDesc::is_null(*p), "expected non-null ref"); |
502 assert (*p != NULL, "expected non-null ref"); | 522 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
503 assert ((*p)->is_oop(), "expected an oop while scanning weak refs"); | 523 // We never expect to see a null reference being processed |
524 // as a weak reference. | |
525 assert(obj->is_oop(), "expected an oop while scanning weak refs"); | |
526 } | |
527 #endif // ASSERT | |
504 | 528 |
505 _cl->do_oop_nv(p); | 529 _cl->do_oop_nv(p); |
506 | 530 |
507 if (Universe::heap()->is_in_reserved(p)) { | 531 if (Universe::heap()->is_in_reserved(p)) { |
508 _rs->write_ref_field_gc_par(p, *p); | 532 oop obj = oopDesc::load_decode_heap_oop_not_null(p); |
509 } | 533 _rs->write_ref_field_gc_par(p, obj); |
510 } | 534 } |
511 | 535 } |
512 void ScanClosureWithParBarrier::do_oop(oop* p) { | 536 |
513 oop obj = *p; | 537 void /*ParNewGeneration::*/KeepAliveClosure::do_oop(oop* p) { KeepAliveClosure::do_oop_work(p); } |
514 // Should we copy the obj? | 538 void /*ParNewGeneration::*/KeepAliveClosure::do_oop(narrowOop* p) { KeepAliveClosure::do_oop_work(p); } |
515 if (obj != NULL) { | 539 |
540 template <class T> void ScanClosureWithParBarrier::do_oop_work(T* p) { | |
541 T heap_oop = oopDesc::load_heap_oop(p); | |
542 if (!oopDesc::is_null(heap_oop)) { | |
543 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); | |
516 if ((HeapWord*)obj < _boundary) { | 544 if ((HeapWord*)obj < _boundary) { |
517 assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); | 545 assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); |
518 if (obj->is_forwarded()) { | 546 oop new_obj = obj->is_forwarded() |
519 *p = obj->forwardee(); | 547 ? obj->forwardee() |
520 } else { | 548 : _g->DefNewGeneration::copy_to_survivor_space(obj); |
521 *p = _g->DefNewGeneration::copy_to_survivor_space(obj, p); | 549 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
522 } | |
523 } | 550 } |
524 if (_gc_barrier) { | 551 if (_gc_barrier) { |
525 // If p points to a younger generation, mark the card. | 552 // If p points to a younger generation, mark the card. |
526 if ((HeapWord*)obj < _gen_boundary) { | 553 if ((HeapWord*)obj < _gen_boundary) { |
527 _rs->write_ref_field_gc_par(p, obj); | 554 _rs->write_ref_field_gc_par(p, obj); |
528 } | 555 } |
529 } | 556 } |
530 } | 557 } |
531 } | 558 } |
559 | |
560 void ScanClosureWithParBarrier::do_oop(oop* p) { ScanClosureWithParBarrier::do_oop_work(p); } | |
561 void ScanClosureWithParBarrier::do_oop(narrowOop* p) { ScanClosureWithParBarrier::do_oop_work(p); } | |
532 | 562 |
533 class ParNewRefProcTaskProxy: public AbstractGangTask { | 563 class ParNewRefProcTaskProxy: public AbstractGangTask { |
534 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; | 564 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; |
535 public: | 565 public: |
536 ParNewRefProcTaskProxy(ProcessTask& task, ParNewGeneration& gen, | 566 ParNewRefProcTaskProxy(ProcessTask& task, ParNewGeneration& gen, |