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 (SparsePRT*) 297 Atomic::cmpxchg_ptr(sprt, &_head_expanded_list, hd); 298 if (res == hd) return; 299 else hd = res; 300 } 301 } 302 303 304 SparsePRT* SparsePRT::get_from_expanded_list() { 305 SparsePRT* hd = _head_expanded_list; 306 while (hd != NULL) { 307 SparsePRT* next = hd->next_expanded(); 308 SparsePRT* res = 309 (SparsePRT*) 310 Atomic::cmpxchg_ptr(next, &_head_expanded_list, hd); 311 if (res == hd) { 312 hd->set_next_expanded(NULL); 313 return hd; 314 } else { 315 hd = res; 316 } 317 } 318 return NULL; 319 } 320 321 void SparsePRT::reset_for_cleanup_tasks() { 322 _head_expanded_list = NULL; 323 } 324 325 void SparsePRT::do_cleanup_work(SparsePRTCleanupTask* sprt_cleanup_task) { 326 if (should_be_on_expanded_list()) { 327 sprt_cleanup_task->add(this); 328 } 329 } 330 | 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 |