< prev index next >

src/hotspot/share/utilities/concurrentHashTable.inline.hpp

Print this page

        

*** 261,272 **** for (Node* next = bucket->first(); next != NULL ; next = next->next()) { if (pref != NULL) { Prefetch::read(*pref->value(), 0); pref = pref->next(); } ! if (next->next() != NULL) { ! Prefetch::read(*next->next()->value(), 0); } if (eval_f(next->value())) { return true; } } --- 261,275 ---- for (Node* next = bucket->first(); next != NULL ; next = next->next()) { if (pref != NULL) { Prefetch::read(*pref->value(), 0); pref = pref->next(); } ! // Read next() Node* once. May be racing with a thread moving the next ! // pointers. ! Node* next_pref = next->next(); ! if (next_pref != NULL) { ! Prefetch::read(*next_pref->value(), 0); } if (eval_f(next->value())) { return true; } }
*** 544,555 **** while (rem_n != NULL) { bool is_dead = false; lookup_f.equals(rem_n->value(), &is_dead); if (is_dead) { ndel[dels++] = rem_n; ! bucket->release_assign_node_ptr(rem_n_prev, rem_n->next()); ! rem_n = rem_n->next(); if (dels == BULK_DELETE_LIMIT) { break; } } else { rem_n_prev = rem_n->next_ptr(); --- 547,559 ---- while (rem_n != NULL) { bool is_dead = false; lookup_f.equals(rem_n->value(), &is_dead); if (is_dead) { ndel[dels++] = rem_n; ! Node* next_node = rem_n->next(); ! bucket->release_assign_node_ptr(rem_n_prev, next_node); ! rem_n = next_node; if (dels == BULK_DELETE_LIMIT) { break; } } else { rem_n_prev = rem_n->next_ptr();
*** 652,687 **** Node* const volatile * even = new_table->get_bucket(even_index)->first_ptr(); Node* const volatile * odd = new_table->get_bucket(odd_index)->first_ptr(); while (aux != NULL) { bool dead_hash = false; size_t aux_hash = CONFIG::get_hash(*aux->value(), &dead_hash); if (dead_hash) { delete_me = aux; // This item is dead, move both list to next new_table->get_bucket(odd_index)->release_assign_node_ptr(odd, ! aux->next()); new_table->get_bucket(even_index)->release_assign_node_ptr(even, ! aux->next()); } else { size_t aux_index = bucket_idx_hash(new_table, aux_hash); if (aux_index == even_index) { // This is a even, so move odd to aux/even next new_table->get_bucket(odd_index)->release_assign_node_ptr(odd, ! aux->next()); // Keep in even list even = aux->next_ptr(); } else if (aux_index == odd_index) { // This is a odd, so move odd to aux/odd next new_table->get_bucket(even_index)->release_assign_node_ptr(even, ! aux->next()); // Keep in odd list odd = aux->next_ptr(); } else { fatal("aux_index does not match even or odd indices"); } } ! aux = aux->next(); // We can only move 1 pointer otherwise a reader might be moved to the wrong // chain. E.g. looking for even hash value but got moved to the odd bucket // chain. write_synchonize_on_visible_epoch(thread); --- 656,692 ---- Node* const volatile * even = new_table->get_bucket(even_index)->first_ptr(); Node* const volatile * odd = new_table->get_bucket(odd_index)->first_ptr(); while (aux != NULL) { bool dead_hash = false; size_t aux_hash = CONFIG::get_hash(*aux->value(), &dead_hash); + Node* aux_next = aux->next(); if (dead_hash) { delete_me = aux; // This item is dead, move both list to next new_table->get_bucket(odd_index)->release_assign_node_ptr(odd, ! aux_next); new_table->get_bucket(even_index)->release_assign_node_ptr(even, ! aux_next); } else { size_t aux_index = bucket_idx_hash(new_table, aux_hash); if (aux_index == even_index) { // This is a even, so move odd to aux/even next new_table->get_bucket(odd_index)->release_assign_node_ptr(odd, ! aux_next); // Keep in even list even = aux->next_ptr(); } else if (aux_index == odd_index) { // This is a odd, so move odd to aux/odd next new_table->get_bucket(even_index)->release_assign_node_ptr(even, ! aux_next); // Keep in odd list odd = aux->next_ptr(); } else { fatal("aux_index does not match even or odd indices"); } } ! aux = aux_next; // We can only move 1 pointer otherwise a reader might be moved to the wrong // chain. E.g. looking for even hash value but got moved to the odd bucket // chain. write_synchonize_on_visible_epoch(thread);
*** 974,985 **** Node* const volatile * rem_n_prev = bucket->first_ptr(); Node* rem_n = bucket->first(); while (rem_n != NULL) { if (eval_f(rem_n->value())) { ndel[dels++] = rem_n; ! bucket->release_assign_node_ptr(rem_n_prev, rem_n->next()); ! rem_n = rem_n->next(); if (dels == num_del) { break; } } else { rem_n_prev = rem_n->next_ptr(); --- 979,991 ---- Node* const volatile * rem_n_prev = bucket->first_ptr(); Node* rem_n = bucket->first(); while (rem_n != NULL) { if (eval_f(rem_n->value())) { ndel[dels++] = rem_n; ! Node* next_node = rem_n->next(); ! bucket->release_assign_node_ptr(rem_n_prev, next_node); ! rem_n = next_node; if (dels == num_del) { break; } } else { rem_n_prev = rem_n->next_ptr();
< prev index next >