Mercurial > hg > truffle
comparison src/share/vm/classfile/loaderConstraints.cpp @ 1258:38836cf1d8d2
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
Summary: the guarantee is too strict and the test will fail (incorrectly) if the class is not in the system dictionary but in the placeholders.
Reviewed-by: acorn, phh
author | tonyp |
---|---|
date | Fri, 05 Feb 2010 11:05:50 -0500 |
parents | a61af66fc99e |
children | 09ac706c2623 |
comparison
equal
deleted
inserted
replaced
1247:230fac611b50 | 1258:38836cf1d8d2 |
---|---|
455 free_entry(p2); | 455 free_entry(p2); |
456 return; | 456 return; |
457 } | 457 } |
458 | 458 |
459 | 459 |
460 void LoaderConstraintTable::verify(Dictionary* dictionary) { | 460 void LoaderConstraintTable::verify(Dictionary* dictionary, |
461 PlaceholderTable* placeholders) { | |
461 Thread *thread = Thread::current(); | 462 Thread *thread = Thread::current(); |
462 for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { | 463 for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { |
463 for (LoaderConstraintEntry* probe = bucket(cindex); | 464 for (LoaderConstraintEntry* probe = bucket(cindex); |
464 probe != NULL; | 465 probe != NULL; |
465 probe = probe->next()) { | 466 probe = probe->next()) { |
470 symbolHandle name (thread, ik->name()); | 471 symbolHandle name (thread, ik->name()); |
471 Handle loader(thread, ik->class_loader()); | 472 Handle loader(thread, ik->class_loader()); |
472 unsigned int d_hash = dictionary->compute_hash(name, loader); | 473 unsigned int d_hash = dictionary->compute_hash(name, loader); |
473 int d_index = dictionary->hash_to_index(d_hash); | 474 int d_index = dictionary->hash_to_index(d_hash); |
474 klassOop k = dictionary->find_class(d_index, d_hash, name, loader); | 475 klassOop k = dictionary->find_class(d_index, d_hash, name, loader); |
475 guarantee(k == probe->klass(), "klass should be in dictionary"); | 476 if (k != NULL) { |
477 // We found the class in the system dictionary, so we should | |
478 // make sure that the klassOop matches what we already have. | |
479 guarantee(k == probe->klass(), "klass should be in dictionary"); | |
480 } else { | |
481 // If we don't find the class in the system dictionary, it | |
482 // has to be in the placeholders table. | |
483 unsigned int p_hash = placeholders->compute_hash(name, loader); | |
484 int p_index = placeholders->hash_to_index(p_hash); | |
485 PlaceholderEntry* entry = placeholders->get_entry(p_index, p_hash, | |
486 name, loader); | |
487 | |
488 // The instanceKlass might not be on the entry, so the only | |
489 // thing we can check here is whether we were successful in | |
490 // finding the class in the placeholders table. | |
491 guarantee(entry != NULL, "klass should be in the placeholders"); | |
492 } | |
476 } | 493 } |
477 for (int n = 0; n< probe->num_loaders(); n++) { | 494 for (int n = 0; n< probe->num_loaders(); n++) { |
478 guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); | 495 guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); |
479 } | 496 } |
480 } | 497 } |