479 return sizeof(this) + _next->mem_size(); |
479 return sizeof(this) + _next->mem_size(); |
480 } |
480 } |
481 |
481 |
482 bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) { |
482 bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) { |
483 #if SPARSE_PRT_VERBOSE |
483 #if SPARSE_PRT_VERBOSE |
484 gclog_or_tty->print_cr(" Adding card %d from region %d to region %d sparse.", |
484 gclog_or_tty->print_cr(" Adding card %d from region %d to region " |
485 card_index, region_id, _hr->hrs_index()); |
485 SIZE_FORMAT" sparse.", |
|
486 card_index, region_id, _hr->hrs_index()); |
486 #endif |
487 #endif |
487 if (_next->occupied_entries() * 2 > _next->capacity()) { |
488 if (_next->occupied_entries() * 2 > _next->capacity()) { |
488 expand(); |
489 expand(); |
489 } |
490 } |
490 return _next->add_card(region_id, card_index); |
491 return _next->add_card(region_id, card_index); |
531 void SparsePRT::expand() { |
532 void SparsePRT::expand() { |
532 RSHashTable* last = _next; |
533 RSHashTable* last = _next; |
533 _next = new RSHashTable(last->capacity() * 2); |
534 _next = new RSHashTable(last->capacity() * 2); |
534 |
535 |
535 #if SPARSE_PRT_VERBOSE |
536 #if SPARSE_PRT_VERBOSE |
536 gclog_or_tty->print_cr(" Expanded sparse table for %d to %d.", |
537 gclog_or_tty->print_cr(" Expanded sparse table for "SIZE_FORMAT" to %d.", |
537 _hr->hrs_index(), _next->capacity()); |
538 _hr->hrs_index(), _next->capacity()); |
538 #endif |
539 #endif |
539 for (size_t i = 0; i < last->capacity(); i++) { |
540 for (size_t i = 0; i < last->capacity(); i++) { |
540 SparsePRTEntry* e = last->entry((int)i); |
541 SparsePRTEntry* e = last->entry((int)i); |
541 if (e->valid_entry()) { |
542 if (e->valid_entry()) { |
542 #if SPARSE_PRT_VERBOSE |
543 #if SPARSE_PRT_VERBOSE |