275 SparsePRTEntry* e = get_entry(region_index); 276 return (e != NULL && e->contains_card(card_index)); 277 } 278 279 size_t RSHashTable::mem_size() const { 280 return sizeof(RSHashTable) + 281 _num_entries * (SparsePRTEntry::size() + sizeof(int)); 282 } 283 284 // ---------------------------------------------------------------------- 285 286 SparsePRT* volatile SparsePRT::_head_expanded_list = NULL; 287 288 void SparsePRT::add_to_expanded_list(SparsePRT* sprt) { 289 // We could expand multiple times in a pause -- only put on list once. 290 if (sprt->expanded()) return; 291 sprt->set_expanded(true); 292 SparsePRT* hd = _head_expanded_list; 293 while (true) { 294 sprt->_next_expanded = hd; 295 SparsePRT* res = 296 Atomic::cmpxchg(sprt, &_head_expanded_list, hd); 297 if (res == hd) return; 298 else hd = res; 299 } 300 } 301 302 303 SparsePRT* SparsePRT::get_from_expanded_list() { 304 SparsePRT* hd = _head_expanded_list; 305 while (hd != NULL) { 306 SparsePRT* next = hd->next_expanded(); 307 SparsePRT* res = 308 Atomic::cmpxchg(next, &_head_expanded_list, hd); 309 if (res == hd) { 310 hd->set_next_expanded(NULL); 311 return hd; 312 } else { 313 hd = res; 314 } 315 } 316 return NULL; 317 } 318 319 void SparsePRT::reset_for_cleanup_tasks() { 320 _head_expanded_list = NULL; 321 } 322 323 void SparsePRT::do_cleanup_work(SparsePRTCleanupTask* sprt_cleanup_task) { 324 if (should_be_on_expanded_list()) { 325 sprt_cleanup_task->add(this); 326 } 327 } 328 | 275 SparsePRTEntry* e = get_entry(region_index); 276 return (e != NULL && e->contains_card(card_index)); 277 } 278 279 size_t RSHashTable::mem_size() const { 280 return sizeof(RSHashTable) + 281 _num_entries * (SparsePRTEntry::size() + sizeof(int)); 282 } 283 284 // ---------------------------------------------------------------------- 285 286 SparsePRT* volatile SparsePRT::_head_expanded_list = NULL; 287 288 void SparsePRT::add_to_expanded_list(SparsePRT* sprt) { 289 // We could expand multiple times in a pause -- only put on list once. 290 if (sprt->expanded()) return; 291 sprt->set_expanded(true); 292 SparsePRT* hd = _head_expanded_list; 293 while (true) { 294 sprt->_next_expanded = hd; 295 SparsePRT* res = Atomic::cmpxchg(sprt, &_head_expanded_list, hd); 296 if (res == hd) return; 297 else hd = res; 298 } 299 } 300 301 302 SparsePRT* SparsePRT::get_from_expanded_list() { 303 SparsePRT* hd = _head_expanded_list; 304 while (hd != NULL) { 305 SparsePRT* next = hd->next_expanded(); 306 SparsePRT* res = Atomic::cmpxchg(next, &_head_expanded_list, hd); 307 if (res == hd) { 308 hd->set_next_expanded(NULL); 309 return hd; 310 } else { 311 hd = res; 312 } 313 } 314 return NULL; 315 } 316 317 void SparsePRT::reset_for_cleanup_tasks() { 318 _head_expanded_list = NULL; 319 } 320 321 void SparsePRT::do_cleanup_work(SparsePRTCleanupTask* sprt_cleanup_task) { 322 if (should_be_on_expanded_list()) { 323 sprt_cleanup_task->add(this); 324 } 325 } 326 |