// Finally, the static methods that are the callbacks static void increment(klassOop k) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); if (that->get_initiatingLoader() == NULL) { for (klassOop l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) { that->set_count(that->get_count() + 1); } } else if (k != NULL) { // if initiating loader not null, just include the instance with 1 dimension that->set_count(that->get_count() + 1); } }
// increment the count for the given basic type array class (and any // multi-dimensional arrays). For example, for [B we check for // [[B, [[[B, .. and the count is incremented for each one that exists. static void increment_for_basic_type_arrays(Klass* k) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); assert(that != NULL, "no JvmtiGetLoadedClassesClosure"); for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { that->set_count(that->get_count() + 1); } }
static void prim_array_increment_with_loader(Klass* array, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); oop class_loader = loader_data->class_loader(); if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) { that->set_count(that->get_count() + 1); } }
static void increment_with_loader(klassOop k, oop loader) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); if (loader == JNIHandles::resolve(that->get_initiatingLoader())) { for (klassOop l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) { that->set_count(that->get_count() + 1); } } }
static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); oop class_loader = loader_data->class_loader(); if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) { for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { that->set_count(that->get_count() + 1); } } }
static void prim_array_increment_with_loader(klassOop array, oop loader) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); if (loader == JNIHandles::resolve(that->get_initiatingLoader())) { that->set_count(that->get_count() + 1); } }