1.1 --- a/src/share/vm/gc_implementation/g1/sparsePRT.cpp Wed Sep 30 14:50:51 2009 -0400 1.2 +++ b/src/share/vm/gc_implementation/g1/sparsePRT.cpp Tue Oct 27 02:42:24 2009 -0700 1.3 @@ -135,7 +135,6 @@ 1.4 _occupied_entries(0), _occupied_cards(0), 1.5 _entries(NEW_C_HEAP_ARRAY(SparsePRTEntry, capacity)), 1.6 _buckets(NEW_C_HEAP_ARRAY(int, capacity)), 1.7 - _next_deleted(NULL), _deleted(false), 1.8 _free_list(NullEntry), _free_region(0) 1.9 { 1.10 clear(); 1.11 @@ -296,40 +295,6 @@ 1.12 assert(e2->num_valid_cards() > 0, "Postcondition."); 1.13 } 1.14 1.15 -RSHashTable* RSHashTable::_head_deleted_list = NULL; 1.16 - 1.17 -void RSHashTable::add_to_deleted_list(RSHashTable* rsht) { 1.18 - assert(!rsht->deleted(), "Should delete only once."); 1.19 - rsht->set_deleted(true); 1.20 - RSHashTable* hd = _head_deleted_list; 1.21 - while (true) { 1.22 - rsht->_next_deleted = hd; 1.23 - RSHashTable* res = 1.24 - (RSHashTable*) 1.25 - Atomic::cmpxchg_ptr(rsht, &_head_deleted_list, hd); 1.26 - if (res == hd) return; 1.27 - else hd = res; 1.28 - } 1.29 -} 1.30 - 1.31 -RSHashTable* RSHashTable::get_from_deleted_list() { 1.32 - RSHashTable* hd = _head_deleted_list; 1.33 - while (hd != NULL) { 1.34 - RSHashTable* next = hd->next_deleted(); 1.35 - RSHashTable* res = 1.36 - (RSHashTable*) 1.37 - Atomic::cmpxchg_ptr(next, &_head_deleted_list, hd); 1.38 - if (res == hd) { 1.39 - hd->set_next_deleted(NULL); 1.40 - hd->set_deleted(false); 1.41 - return hd; 1.42 - } else { 1.43 - hd = res; 1.44 - } 1.45 - } 1.46 - return NULL; 1.47 -} 1.48 - 1.49 CardIdx_t /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() { 1.50 CardIdx_t res; 1.51 while (_bl_ind != RSHashTable::NullEntry) { 1.52 @@ -442,15 +407,6 @@ 1.53 sprt->cleanup(); 1.54 sprt = get_from_expanded_list(); 1.55 } 1.56 - // Now delete all deleted RSHashTables. 1.57 - RSHashTable* rsht = RSHashTable::get_from_deleted_list(); 1.58 - while (rsht != NULL) { 1.59 -#if SPARSE_PRT_VERBOSE 1.60 - gclog_or_tty->print_cr("About to delete RSHT " PTR_FORMAT ".", rsht); 1.61 -#endif 1.62 - delete rsht; 1.63 - rsht = RSHashTable::get_from_deleted_list(); 1.64 - } 1.65 } 1.66 1.67 1.68 @@ -511,8 +467,10 @@ 1.69 } 1.70 1.71 void SparsePRT::cleanup() { 1.72 - // Make sure that the current and next tables agree. (Another mechanism 1.73 - // takes care of deleting now-unused tables.) 1.74 + // Make sure that the current and next tables agree. 1.75 + if (_cur != _next) { 1.76 + delete _cur; 1.77 + } 1.78 _cur = _next; 1.79 set_expanded(false); 1.80 } 1.81 @@ -535,7 +493,8 @@ 1.82 _next->add_entry(e); 1.83 } 1.84 } 1.85 - if (last != _cur) 1.86 - RSHashTable::add_to_deleted_list(last); 1.87 + if (last != _cur) { 1.88 + delete last; 1.89 + } 1.90 add_to_expanded_list(this); 1.91 }