< prev index next >

src/share/vm/classfile/stringTable.cpp

Print this page




 295   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 296   const int limit = the_table()->table_size();
 297 
 298   for (;;) {
 299     // Grab next set of buckets to scan
 300     int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
 301     if (start_idx >= limit) {
 302       // End of table
 303       break;
 304     }
 305 
 306     int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
 307     buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
 308   }
 309 }
 310 
 311 void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
 312   const int limit = the_table()->table_size();
 313 
 314   assert(0 <= start_idx && start_idx <= limit,
 315          err_msg("start_idx (%d) is out of bounds", start_idx));
 316   assert(0 <= end_idx && end_idx <= limit,
 317          err_msg("end_idx (%d) is out of bounds", end_idx));
 318   assert(start_idx <= end_idx,
 319          err_msg("Index ordering: start_idx=%d, end_idx=%d",
 320                  start_idx, end_idx));
 321 
 322   for (int i = start_idx; i < end_idx; i += 1) {
 323     HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
 324     while (entry != NULL) {
 325       assert(!entry->is_shared(), "CDS not used for the StringTable");
 326 
 327       f->do_oop((oop*)entry->literal_addr());
 328 
 329       entry = entry->next();
 330     }
 331   }
 332 }
 333 
 334 void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
 335   const int limit = the_table()->table_size();
 336 
 337   assert(0 <= start_idx && start_idx <= limit,
 338          err_msg("start_idx (%d) is out of bounds", start_idx));
 339   assert(0 <= end_idx && end_idx <= limit,
 340          err_msg("end_idx (%d) is out of bounds", end_idx));
 341   assert(start_idx <= end_idx,
 342          err_msg("Index ordering: start_idx=%d, end_idx=%d",
 343                  start_idx, end_idx));
 344 
 345   for (int i = start_idx; i < end_idx; ++i) {
 346     HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
 347     HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
 348     while (entry != NULL) {
 349       assert(!entry->is_shared(), "CDS not used for the StringTable");
 350 
 351       if (is_alive->do_object_b(entry->literal())) {
 352         if (f != NULL) {
 353           f->do_oop((oop*)entry->literal_addr());
 354         }
 355         p = entry->next_addr();
 356       } else {
 357         *p = entry->next();
 358         the_table()->free_entry(entry);
 359         (*removed)++;
 360       }
 361       (*processed)++;
 362       entry = *p;
 363     }




 295   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 296   const int limit = the_table()->table_size();
 297 
 298   for (;;) {
 299     // Grab next set of buckets to scan
 300     int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
 301     if (start_idx >= limit) {
 302       // End of table
 303       break;
 304     }
 305 
 306     int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
 307     buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
 308   }
 309 }
 310 
 311 void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
 312   const int limit = the_table()->table_size();
 313 
 314   assert(0 <= start_idx && start_idx <= limit,
 315          "start_idx (%d) is out of bounds", start_idx);
 316   assert(0 <= end_idx && end_idx <= limit,
 317          "end_idx (%d) is out of bounds", end_idx);
 318   assert(start_idx <= end_idx,
 319          "Index ordering: start_idx=%d, end_idx=%d",
 320          start_idx, end_idx);
 321 
 322   for (int i = start_idx; i < end_idx; i += 1) {
 323     HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
 324     while (entry != NULL) {
 325       assert(!entry->is_shared(), "CDS not used for the StringTable");
 326 
 327       f->do_oop((oop*)entry->literal_addr());
 328 
 329       entry = entry->next();
 330     }
 331   }
 332 }
 333 
 334 void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
 335   const int limit = the_table()->table_size();
 336 
 337   assert(0 <= start_idx && start_idx <= limit,
 338          "start_idx (%d) is out of bounds", start_idx);
 339   assert(0 <= end_idx && end_idx <= limit,
 340          "end_idx (%d) is out of bounds", end_idx);
 341   assert(start_idx <= end_idx,
 342          "Index ordering: start_idx=%d, end_idx=%d",
 343          start_idx, end_idx);
 344 
 345   for (int i = start_idx; i < end_idx; ++i) {
 346     HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
 347     HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
 348     while (entry != NULL) {
 349       assert(!entry->is_shared(), "CDS not used for the StringTable");
 350 
 351       if (is_alive->do_object_b(entry->literal())) {
 352         if (f != NULL) {
 353           f->do_oop((oop*)entry->literal_addr());
 354         }
 355         p = entry->next_addr();
 356       } else {
 357         *p = entry->next();
 358         the_table()->free_entry(entry);
 359         (*removed)++;
 360       }
 361       (*processed)++;
 362       entry = *p;
 363     }


< prev index next >