Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/systemDictionary.cpp @ 8848:d886ac1dfd36
8010723: fatal error: acquiring lock Metaspace allocation lock/5 out of order
Summary: Avoid holding SystemDictionary_lock while calling Klass::remove_unshareable_info
Reviewed-by: coleenp, acorn
Contributed-by: ioi.lam@oracle.com
author | coleenp |
---|---|
date | Sun, 31 Mar 2013 21:43:10 -0400 |
parents | cd3089a56438 |
children | 0ca3dd0ffaba |
comparison
equal
deleted
inserted
replaced
8847:c0f9217203b2 | 8848:d886ac1dfd36 |
---|---|
814 if (ik.not_null()) { | 814 if (ik.not_null()) { |
815 if (ik->class_loader_data() == NULL) { | 815 if (ik->class_loader_data() == NULL) { |
816 // We didn't go as far as Klass::restore_unshareable_info(), | 816 // We didn't go as far as Klass::restore_unshareable_info(), |
817 // so nothing to clean up. | 817 // so nothing to clean up. |
818 } else { | 818 } else { |
819 MutexLocker mu(SystemDictionary_lock, THREAD); | 819 Klass *kk; |
820 Klass* kk = find_class(name, ik->class_loader_data()); | 820 { |
821 MutexLocker mu(SystemDictionary_lock, THREAD); | |
822 kk = find_class(name, ik->class_loader_data()); | |
823 } | |
821 if (kk != NULL) { | 824 if (kk != NULL) { |
822 // No clean up is needed if the shared class has been entered | 825 // No clean up is needed if the shared class has been entered |
823 // into system dictionary, as load_shared_class() won't be called | 826 // into system dictionary, as load_shared_class() won't be called |
824 // again. | 827 // again. |
825 } else { | 828 } else { |
829 // This must be done outside of the SystemDictionary_lock to | |
830 // avoid deadlock. | |
831 // | |
832 // Note that Klass::restore_unshareable_info (called via | |
833 // load_instance_class above) is also called outside | |
834 // of SystemDictionary_lock. Other threads are blocked from | |
835 // loading this class because they are waiting on the | |
836 // SystemDictionary_lock until this thread removes | |
837 // the placeholder below. | |
838 // | |
839 // This need to be re-thought when parallel-capable non-boot | |
840 // classloaders are supported by CDS (today they're not). | |
826 clean_up_shared_class(ik, class_loader, THREAD); | 841 clean_up_shared_class(ik, class_loader, THREAD); |
827 } | 842 } |
828 } | 843 } |
829 } | 844 } |
830 } | 845 } |