314 315 // All classes, and their class loaders 316 // Don't iterate over placeholders 317 void Dictionary::classes_do(void f(Klass*, ClassLoaderData*)) { 318 for (int index = 0; index < table_size(); index++) { 319 for (DictionaryEntry* probe = bucket(index); 320 probe != NULL; 321 probe = probe->next()) { 322 Klass* k = probe->klass(); 323 f(k, probe->loader_data()); 324 } 325 } 326 } 327 328 void Dictionary::oops_do(OopClosure* f) { 329 // Only the protection domain oops contain references into the heap. Iterate 330 // over all of them. 331 _pd_cache_table->oops_do(f); 332 } 333 334 void Dictionary::methods_do(void f(Method*)) { 335 for (int index = 0; index < table_size(); index++) { 336 for (DictionaryEntry* probe = bucket(index); 337 probe != NULL; 338 probe = probe->next()) { 339 Klass* k = probe->klass(); 340 if (probe->loader_data() == k->class_loader_data()) { 341 // only take klass is we have the entry with the defining class loader 342 InstanceKlass::cast(k)->methods_do(f); 343 } 344 } 345 } 346 } 347 348 void Dictionary::unlink(BoolObjectClosure* is_alive) { 349 // Only the protection domain cache table may contain references to the heap 350 // that need to be unlinked. 351 _pd_cache_table->unlink(is_alive); 352 } 353 354 Klass* Dictionary::try_get_next_class() { 355 while (true) { 356 if (_current_class_entry != NULL) { 357 Klass* k = _current_class_entry->klass(); 358 _current_class_entry = _current_class_entry->next(); 359 return k; 360 } 361 _current_class_index = (_current_class_index + 1) % table_size(); 362 _current_class_entry = bucket(_current_class_index); 363 } 364 // never reached 365 } 366 367 // Add a loaded class to the system dictionary. | 314 315 // All classes, and their class loaders 316 // Don't iterate over placeholders 317 void Dictionary::classes_do(void f(Klass*, ClassLoaderData*)) { 318 for (int index = 0; index < table_size(); index++) { 319 for (DictionaryEntry* probe = bucket(index); 320 probe != NULL; 321 probe = probe->next()) { 322 Klass* k = probe->klass(); 323 f(k, probe->loader_data()); 324 } 325 } 326 } 327 328 void Dictionary::oops_do(OopClosure* f) { 329 // Only the protection domain oops contain references into the heap. Iterate 330 // over all of them. 331 _pd_cache_table->oops_do(f); 332 } 333 334 void Dictionary::unlink(BoolObjectClosure* is_alive) { 335 // Only the protection domain cache table may contain references to the heap 336 // that need to be unlinked. 337 _pd_cache_table->unlink(is_alive); 338 } 339 340 Klass* Dictionary::try_get_next_class() { 341 while (true) { 342 if (_current_class_entry != NULL) { 343 Klass* k = _current_class_entry->klass(); 344 _current_class_entry = _current_class_entry->next(); 345 return k; 346 } 347 _current_class_index = (_current_class_index + 1) % table_size(); 348 _current_class_entry = bucket(_current_class_index); 349 } 350 // never reached 351 } 352 353 // Add a loaded class to the system dictionary. |