Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/classLoaderData.cpp @ 14190:ce86c36b8921
8029178: Parallel class loading test anonymous-simple gets SIGSEGV in Metaspace::contains
Summary: Metaspace::contains cannot look at purged metaspaces while CMS concurrently deallocates them.
Reviewed-by: mgerdin, sspitsyn, jmasa
author | coleenp |
---|---|
date | Tue, 07 Jan 2014 13:26:56 -0500 |
parents | 86e6d691f2e1 |
children | 48314d596a04 3cdda110bbb5 |
comparison
equal
deleted
inserted
replaced
14189:1a899ea6b7ed | 14190:ce86c36b8921 |
---|---|
646 } | 646 } |
647 | 647 |
648 return array; | 648 return array; |
649 } | 649 } |
650 | 650 |
651 #ifndef PRODUCT | 651 // For profiling and hsfind() only. Otherwise, this is unsafe (and slow). This |
652 // for debugging and hsfind(x) | 652 // is done lock free to avoid lock inversion problems. It is safe because |
653 bool ClassLoaderDataGraph::contains(address x) { | 653 // new ClassLoaderData are added to the end of the CLDG, and only removed at |
654 // I think we need the _metaspace_lock taken here because the class loader | 654 // safepoint. The _unloading list can be deallocated concurrently with CMS so |
655 // data graph could be changing while we are walking it (new entries added, | 655 // this doesn't look in metaspace for classes that have been unloaded. |
656 // new entries being unloaded, etc). | 656 bool ClassLoaderDataGraph::contains(const void* x) { |
657 if (DumpSharedSpaces) { | 657 if (DumpSharedSpaces) { |
658 // There are only two metaspaces to worry about. | 658 // There are only two metaspaces to worry about. |
659 ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data(); | 659 ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data(); |
660 return (ncld->ro_metaspace()->contains(x) || ncld->rw_metaspace()->contains(x)); | 660 return (ncld->ro_metaspace()->contains(x) || ncld->rw_metaspace()->contains(x)); |
661 } | 661 } |
668 if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) { | 668 if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) { |
669 return true; | 669 return true; |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 // Could also be on an unloading list which is okay, ie. still allocated | 673 // Do not check unloading list because deallocation can be concurrent. |
674 // for a little while. | |
675 for (ClassLoaderData* ucld = _unloading; ucld != NULL; ucld = ucld->next()) { | |
676 if (ucld->metaspace_or_null() != NULL && ucld->metaspace_or_null()->contains(x)) { | |
677 return true; | |
678 } | |
679 } | |
680 return false; | 674 return false; |
681 } | 675 } |
682 | 676 |
677 #ifndef PRODUCT | |
683 bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) { | 678 bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) { |
684 for (ClassLoaderData* data = _head; data != NULL; data = data->next()) { | 679 for (ClassLoaderData* data = _head; data != NULL; data = data->next()) { |
685 if (loader_data == data) { | 680 if (loader_data == data) { |
686 return true; | 681 return true; |
687 } | 682 } |