< prev index next >

src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp

Print this page




 572   assert(rehashed_table != NULL, "Invalid table");
 573 
 574   // Move all newly rehashed entries into the correct buckets in the new table
 575   for (size_t bucket = 0; bucket < _table->_size; bucket++) {
 576     StringDedupEntry** entry = _table->bucket(bucket);
 577     while (*entry != NULL) {
 578       _table->transfer(entry, rehashed_table);
 579     }
 580   }
 581 
 582   rehashed_table->_entries = _table->_entries;
 583 
 584   // Free old table
 585   delete _table;
 586 
 587   // Install new table
 588   _table = rehashed_table;
 589 }
 590 
 591 size_t StringDedupTable::claim_table_partition(size_t partition_size) {
 592   return Atomic::add(partition_size, &_claimed_index) - partition_size;
 593 }
 594 
 595 void StringDedupTable::verify() {
 596   for (size_t bucket = 0; bucket < _table->_size; bucket++) {
 597     // Verify entries
 598     StringDedupEntry** entry = _table->bucket(bucket);
 599     while (*entry != NULL) {
 600       typeArrayOop value = (*entry)->obj();
 601       guarantee(value != NULL, "Object must not be NULL");
 602       guarantee(Universe::heap()->is_in(value), "Object must be on the heap");
 603       guarantee(!value->is_forwarded(), "Object must not be forwarded");
 604       guarantee(value->is_typeArray(), "Object must be a typeArrayOop");
 605       bool latin1 = (*entry)->latin1();
 606       unsigned int hash = hash_code(value, latin1);
 607       guarantee((*entry)->hash() == hash, "Table entry has inorrect hash");
 608       guarantee(_table->hash_to_index(hash) == bucket, "Table entry has incorrect index");
 609       entry = (*entry)->next_addr();
 610     }
 611 
 612     // Verify that we do not have entries with identical oops or identical arrays.




 572   assert(rehashed_table != NULL, "Invalid table");
 573 
 574   // Move all newly rehashed entries into the correct buckets in the new table
 575   for (size_t bucket = 0; bucket < _table->_size; bucket++) {
 576     StringDedupEntry** entry = _table->bucket(bucket);
 577     while (*entry != NULL) {
 578       _table->transfer(entry, rehashed_table);
 579     }
 580   }
 581 
 582   rehashed_table->_entries = _table->_entries;
 583 
 584   // Free old table
 585   delete _table;
 586 
 587   // Install new table
 588   _table = rehashed_table;
 589 }
 590 
 591 size_t StringDedupTable::claim_table_partition(size_t partition_size) {
 592   return Atomic::add(&_claimed_index, partition_size) - partition_size;
 593 }
 594 
 595 void StringDedupTable::verify() {
 596   for (size_t bucket = 0; bucket < _table->_size; bucket++) {
 597     // Verify entries
 598     StringDedupEntry** entry = _table->bucket(bucket);
 599     while (*entry != NULL) {
 600       typeArrayOop value = (*entry)->obj();
 601       guarantee(value != NULL, "Object must not be NULL");
 602       guarantee(Universe::heap()->is_in(value), "Object must be on the heap");
 603       guarantee(!value->is_forwarded(), "Object must not be forwarded");
 604       guarantee(value->is_typeArray(), "Object must be a typeArrayOop");
 605       bool latin1 = (*entry)->latin1();
 606       unsigned int hash = hash_code(value, latin1);
 607       guarantee((*entry)->hash() == hash, "Table entry has inorrect hash");
 608       guarantee(_table->hash_to_index(hash) == bucket, "Table entry has incorrect index");
 609       entry = (*entry)->next_addr();
 610     }
 611 
 612     // Verify that we do not have entries with identical oops or identical arrays.


< prev index next >