< prev index next >

src/share/vm/classfile/classLoaderData.cpp

Print this page

        

*** 62,74 **** #include "runtime/safepoint.hpp" #include "runtime/synchronizer.hpp" #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #include "utilities/ostream.hpp" - #if INCLUDE_TRACE - #include "trace/tracing.hpp" - #endif ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL; ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies) : _class_loader(h_class_loader()), --- 62,71 ----
*** 79,89 **** _keep_alive(is_anonymous || h_class_loader.is_null()), _metaspace(NULL), _unloading(false), _klasses(NULL), _claimed(0), _jmethod_ids(NULL), _handles(), _deallocate_list(NULL), _next(NULL), _dependencies(dependencies), _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) { ! // empty } void ClassLoaderData::init_dependencies(TRAPS) { assert(!Universe::is_fully_initialized(), "should only be called when initializing"); assert(is_the_null_class_loader_data(), "should only call this for the null class loader"); --- 76,87 ---- _keep_alive(is_anonymous || h_class_loader.is_null()), _metaspace(NULL), _unloading(false), _klasses(NULL), _claimed(0), _jmethod_ids(NULL), _handles(), _deallocate_list(NULL), _next(NULL), _dependencies(dependencies), _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) { ! ! JFR_ONLY(INIT_ID(this);) } void ClassLoaderData::init_dependencies(TRAPS) { assert(!Universe::is_fully_initialized(), "should only be called when initializing"); assert(is_the_null_class_loader_data(), "should only call this for the null class loader");
*** 644,653 **** --- 642,661 ---- for (ClassLoaderData* cld = _head; cl != NULL && cld != NULL; cld = cld->next()) { cl->do_cld(cld); } } + void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) { + assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!"); + // Only walk the head until any clds not purged from prior unloading + // (CMS doesn't purge right away). + for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) { + assert(cld->is_unloading(), "invariant"); + cl->do_cld(cld); + } + } + void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) { for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) { CLDClosure* closure = cld->keep_alive() ? strong : weak; if (closure != NULL) { closure->do_cld(cld);
*** 738,748 **** return false; } #endif // PRODUCT - // Move class loader data from main list to the unloaded list for unloading // and deallocation later. bool ClassLoaderDataGraph::do_unloading(BoolObjectClosure* is_alive_closure, bool clean_alive) { ClassLoaderData* data = _head; ClassLoaderData* prev = NULL; --- 746,755 ----
*** 778,791 **** if (clean_alive) { // Clean previous versions and the deallocate list. ClassLoaderDataGraph::clean_metaspaces(); } - if (seen_dead_loader) { - post_class_unload_events(); - } - return seen_dead_loader; } void ClassLoaderDataGraph::clean_metaspaces() { // mark metadata seen on the stack and code cache so we can delete unneeded entries. --- 785,794 ----
*** 818,841 **** delete purge_me; } Metaspace::purge(); } - void ClassLoaderDataGraph::post_class_unload_events(void) { - #if INCLUDE_TRACE - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!"); - if (Tracing::enabled()) { - if (Tracing::is_event_enabled(TraceClassUnloadEvent)) { - assert(_unloading != NULL, "need class loader data unload list!"); - _class_unload_time = Ticks::now(); - classes_unloading_do(&class_unload_event); - } - Tracing::on_unloading_classes(); - } - #endif - } - void ClassLoaderDataGraph::free_deallocate_lists() { for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) { // We need to keep this data until InstanceKlass::purge_previous_version has been // called on all alive classes. See the comment in ClassLoaderDataGraph::clean_metaspaces. cld->free_deallocate_list(); --- 821,830 ----
*** 967,989 **** } else { out->print("class loader " INTPTR_FORMAT, p2i(this)); class_loader()->print_value_on(out); } } - - #if INCLUDE_TRACE - - Ticks ClassLoaderDataGraph::_class_unload_time; - - void ClassLoaderDataGraph::class_unload_event(Klass* const k) { - - // post class unload event - EventClassUnload event(UNTIMED); - event.set_endtime(_class_unload_time); - event.set_unloadedClass(k); - oop defining_class_loader = k->class_loader(); - event.set_definingClassLoader(defining_class_loader != NULL ? - defining_class_loader->klass() : (Klass*)NULL); - event.commit(); - } - - #endif // INCLUDE_TRACE --- 956,960 ----
< prev index next >