< prev index next >

src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp

Print this page
rev 8069 : imported patch g1_cleanup


 502       _table->transfer(entry, rehashed_table);
 503     }
 504   }
 505 
 506   rehashed_table->_entries = _table->_entries;
 507 
 508   // Free old table
 509   delete _table;
 510 
 511   // Install new table
 512   _table = rehashed_table;
 513 }
 514 
 515 void G1StringDedupTable::verify() {
 516   for (size_t bucket = 0; bucket < _table->_size; bucket++) {
 517     // Verify entries
 518     G1StringDedupEntry** entry = _table->bucket(bucket);
 519     while (*entry != NULL) {
 520       typeArrayOop value = (*entry)->obj();
 521       guarantee(value != NULL, "Object must not be NULL");
 522       guarantee(Universe::heap()->is_in_reserved(value), "Object must be on the heap");
 523       guarantee(!value->is_forwarded(), "Object must not be forwarded");
 524       guarantee(value->is_typeArray(), "Object must be a typeArrayOop");
 525       unsigned int hash = hash_code(value);
 526       guarantee((*entry)->hash() == hash, "Table entry has inorrect hash");
 527       guarantee(_table->hash_to_index(hash) == bucket, "Table entry has incorrect index");
 528       entry = (*entry)->next_addr();
 529     }
 530 
 531     // Verify that we do not have entries with identical oops or identical arrays.
 532     // We only need to compare entries in the same bucket. If the same oop or an
 533     // identical array has been inserted more than once into different/incorrect
 534     // buckets the verification step above will catch that.
 535     G1StringDedupEntry** entry1 = _table->bucket(bucket);
 536     while (*entry1 != NULL) {
 537       typeArrayOop value1 = (*entry1)->obj();
 538       G1StringDedupEntry** entry2 = (*entry1)->next_addr();
 539       while (*entry2 != NULL) {
 540         typeArrayOop value2 = (*entry2)->obj();
 541         guarantee(!equals(value1, value2), "Table entries must not have identical arrays");
 542         entry2 = (*entry2)->next_addr();




 502       _table->transfer(entry, rehashed_table);
 503     }
 504   }
 505 
 506   rehashed_table->_entries = _table->_entries;
 507 
 508   // Free old table
 509   delete _table;
 510 
 511   // Install new table
 512   _table = rehashed_table;
 513 }
 514 
 515 void G1StringDedupTable::verify() {
 516   for (size_t bucket = 0; bucket < _table->_size; bucket++) {
 517     // Verify entries
 518     G1StringDedupEntry** entry = _table->bucket(bucket);
 519     while (*entry != NULL) {
 520       typeArrayOop value = (*entry)->obj();
 521       guarantee(value != NULL, "Object must not be NULL");
 522       guarantee(G1CollectedHeap::heap()->is_in_reserved(value), "Object must be on the heap");
 523       guarantee(!value->is_forwarded(), "Object must not be forwarded");
 524       guarantee(value->is_typeArray(), "Object must be a typeArrayOop");
 525       unsigned int hash = hash_code(value);
 526       guarantee((*entry)->hash() == hash, "Table entry has inorrect hash");
 527       guarantee(_table->hash_to_index(hash) == bucket, "Table entry has incorrect index");
 528       entry = (*entry)->next_addr();
 529     }
 530 
 531     // Verify that we do not have entries with identical oops or identical arrays.
 532     // We only need to compare entries in the same bucket. If the same oop or an
 533     // identical array has been inserted more than once into different/incorrect
 534     // buckets the verification step above will catch that.
 535     G1StringDedupEntry** entry1 = _table->bucket(bucket);
 536     while (*entry1 != NULL) {
 537       typeArrayOop value1 = (*entry1)->obj();
 538       G1StringDedupEntry** entry2 = (*entry1)->next_addr();
 539       while (*entry2 != NULL) {
 540         typeArrayOop value2 = (*entry2)->obj();
 541         guarantee(!equals(value1, value2), "Table entries must not have identical arrays");
 542         entry2 = (*entry2)->next_addr();


< prev index next >