11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "classfile/classLoaderDataGraph.inline.hpp"
26 #include "classfile/dictionary.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/metadataOnStackMark.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/packageEntry.hpp"
31 #include "logging/log.hpp"
32 #include "logging/logStream.hpp"
33 #include "memory/allocation.inline.hpp"
34 #include "memory/metaspace.hpp"
35 #include "memory/resourceArea.hpp"
36 #include "runtime/atomic.hpp"
37 #include "runtime/handles.inline.hpp"
38 #include "runtime/mutex.hpp"
39 #include "runtime/safepoint.hpp"
40 #include "runtime/safepointVerifiers.hpp"
41 #include "utilities/growableArray.hpp"
42 #include "utilities/macros.hpp"
43 #include "utilities/ostream.hpp"
44
45 volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
46 volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
47
48 void ClassLoaderDataGraph::clear_claimed_marks() {
49 for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
|
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "classfile/classLoaderDataGraph.inline.hpp"
26 #include "classfile/dictionary.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/metadataOnStackMark.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/packageEntry.hpp"
31 #include "code/dependencyContext.hpp"
32 #include "logging/log.hpp"
33 #include "logging/logStream.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "memory/metaspace.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "runtime/atomic.hpp"
38 #include "runtime/handles.inline.hpp"
39 #include "runtime/mutex.hpp"
40 #include "runtime/safepoint.hpp"
41 #include "runtime/safepointVerifiers.hpp"
42 #include "utilities/growableArray.hpp"
43 #include "utilities/macros.hpp"
44 #include "utilities/ostream.hpp"
45
46 volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
47 volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
48
49 void ClassLoaderDataGraph::clear_claimed_marks() {
50 for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
|
559 // dead and should be removed. A module's life cycle is equivalent
560 // to its defining class loader's life cycle. Since a module is
561 // considered dead if its class loader is dead, these walks must
562 // occur after each class loader's aliveness is determined.
563 if (data->packages() != NULL) {
564 data->packages()->purge_all_package_exports();
565 }
566 if (data->modules_defined()) {
567 data->modules()->purge_all_module_reads();
568 }
569 data = data->next();
570 }
571 }
572
573 void ClassLoaderDataGraph::purge() {
574 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
575 ClassLoaderData* list = _unloading;
576 _unloading = NULL;
577 ClassLoaderData* next = list;
578 bool classes_unloaded = false;
579 while (next != NULL) {
580 ClassLoaderData* purge_me = next;
581 next = purge_me->next();
582 delete purge_me;
583 classes_unloaded = true;
584 }
585 if (classes_unloaded) {
586 Metaspace::purge();
587 set_metaspace_oom(false);
588 }
589 }
590
591 int ClassLoaderDataGraph::resize_if_needed() {
592 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
593 int resized = 0;
594 if (Dictionary::does_any_dictionary_needs_resizing()) {
595 FOR_ALL_DICTIONARY(cld) {
596 if (cld->dictionary()->resize_if_needed()) {
597 resized++;
|
560 // dead and should be removed. A module's life cycle is equivalent
561 // to its defining class loader's life cycle. Since a module is
562 // considered dead if its class loader is dead, these walks must
563 // occur after each class loader's aliveness is determined.
564 if (data->packages() != NULL) {
565 data->packages()->purge_all_package_exports();
566 }
567 if (data->modules_defined()) {
568 data->modules()->purge_all_module_reads();
569 }
570 data = data->next();
571 }
572 }
573
574 void ClassLoaderDataGraph::purge() {
575 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
576 ClassLoaderData* list = _unloading;
577 _unloading = NULL;
578 ClassLoaderData* next = list;
579 bool classes_unloaded = false;
580 DependencyContext::purge_dependency_contexts();
581 while (next != NULL) {
582 ClassLoaderData* purge_me = next;
583 next = purge_me->next();
584 delete purge_me;
585 classes_unloaded = true;
586 }
587 if (classes_unloaded) {
588 Metaspace::purge();
589 set_metaspace_oom(false);
590 }
591 }
592
593 int ClassLoaderDataGraph::resize_if_needed() {
594 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
595 int resized = 0;
596 if (Dictionary::does_any_dictionary_needs_resizing()) {
597 FOR_ALL_DICTIONARY(cld) {
598 if (cld->dictionary()->resize_if_needed()) {
599 resized++;
|