8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))

Only walk methods in instanceklass if the class is loaded

Reviewed-by: dholmes, fparain
This commit is contained in:
Coleen Phillimore 2014-05-21 14:36:18 -04:00
parent 7f721c111b
commit ead7a2760b
5 changed files with 17 additions and 2 deletions

View file

@ -274,6 +274,8 @@ void ClassLoaderData::add_class(Klass* k) {
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
Klass* old_value = _klasses;
k->set_next_link(old_value);
// Make sure linked class is stable, since the class list is walked without a lock
OrderAccess::storestore();
// link the new item into the list
_klasses = k;