428 free_entry(p2); |
428 free_entry(p2); |
429 return; |
429 return; |
430 } |
430 } |
431 |
431 |
432 |
432 |
433 void LoaderConstraintTable::verify(Dictionary* dictionary) { |
433 void LoaderConstraintTable::verify(Dictionary* dictionary, |
|
434 PlaceholderTable* placeholders) { |
434 Thread *thread = Thread::current(); |
435 Thread *thread = Thread::current(); |
435 for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { |
436 for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { |
436 for (LoaderConstraintEntry* probe = bucket(cindex); |
437 for (LoaderConstraintEntry* probe = bucket(cindex); |
437 probe != NULL; |
438 probe != NULL; |
438 probe = probe->next()) { |
439 probe = probe->next()) { |
443 symbolHandle name (thread, ik->name()); |
444 symbolHandle name (thread, ik->name()); |
444 Handle loader(thread, ik->class_loader()); |
445 Handle loader(thread, ik->class_loader()); |
445 unsigned int d_hash = dictionary->compute_hash(name, loader); |
446 unsigned int d_hash = dictionary->compute_hash(name, loader); |
446 int d_index = dictionary->hash_to_index(d_hash); |
447 int d_index = dictionary->hash_to_index(d_hash); |
447 klassOop k = dictionary->find_class(d_index, d_hash, name, loader); |
448 klassOop k = dictionary->find_class(d_index, d_hash, name, loader); |
448 guarantee(k == probe->klass(), "klass should be in dictionary"); |
449 if (k != NULL) { |
|
450 // We found the class in the system dictionary, so we should |
|
451 // make sure that the klassOop matches what we already have. |
|
452 guarantee(k == probe->klass(), "klass should be in dictionary"); |
|
453 } else { |
|
454 // If we don't find the class in the system dictionary, it |
|
455 // has to be in the placeholders table. |
|
456 unsigned int p_hash = placeholders->compute_hash(name, loader); |
|
457 int p_index = placeholders->hash_to_index(p_hash); |
|
458 PlaceholderEntry* entry = placeholders->get_entry(p_index, p_hash, |
|
459 name, loader); |
|
460 |
|
461 // The instanceKlass might not be on the entry, so the only |
|
462 // thing we can check here is whether we were successful in |
|
463 // finding the class in the placeholders table. |
|
464 guarantee(entry != NULL, "klass should be in the placeholders"); |
|
465 } |
449 } |
466 } |
450 for (int n = 0; n< probe->num_loaders(); n++) { |
467 for (int n = 0; n< probe->num_loaders(); n++) { |
451 guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); |
468 guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); |
452 } |
469 } |
453 } |
470 } |