Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

classes.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void ClassLoadEvent (JNIEnv *env_id, char **name, char **src_name, int num_interfaces, int num_statics, JVMPI_Field *statics, int num_instances, JVMPI_Field *instances, int num_methods, JVMPI_Method *methods, jobjectID class_id, jint eventType)
 Called upon class load. More...

void ClassUnloadEvent (jobjectID class_id)
 Unloads a class. More...


Function Documentation

void ClassLoadEvent ( JNIEnv * env_id,
char ** name,
char ** src_name,
int num_interfaces,
int num_statics,
JVMPI_Field * statics,
int num_instances,
JVMPI_Field * instances,
int num_methods,
JVMPI_Method * methods,
jobjectID class_id,
jint eventType )
 

Called upon class load.

Definition at line 81 of file classes.cpp.

Referenced by NotifyEvent().

00093 {
00094     //Lock(methods_lock);
00095     if (ClassMethods.find(class_id) != ClassMethods.end()) // then it exists
00096     {
00097         debug("!!! exists!!!", class_id, *class_name);
00098     }
00099     
00100     debug((eventType == (JVMPI_EVENT_CLASS_LOAD | JVMPI_REQUESTED_EVENT)) ? "Requested load" : "load", (*class_name) , *source_name == null ? "unknown" : *source_name , class_id);
00101 
00102     //debug("count", *class_name, num_instances , num_statics);
00103 
00104     // load method table
00105     JVMPI_Method* jm = methods;
00106     //string className(class_name);
00107     MethodList & temp_methods = ClassMethods[class_id]  ;
00108     //string sourceName;
00109     /*
00110     if (source_name != null)
00111         sourceName = string(source_name);
00112     else
00113         sourceName = "unknown";
00114     */
00115 
00116     for (int i = 0; i < num_methods; i++)
00117     {
00118         debug("method", jm[i].method_id, jm[i].method_name, jm[i].method_signature);//, jm[i].start_lineno, jm[i].end_lineno, jm[i].method_id, 
00119         //const MethodInfo *mi = new MethodInfo(jm[i].method_name, jm[i].method_signature, jm[i].start_lineno, jm[i].end_lineno, jm[i].method_id, class_id);
00120         //const pair<jmethodID, const MethodInfo*> p(jm[i].method_id, mi);
00121         //Methods.insert(p);
00122         Methods.insert(make_pair(jm[i].method_id, new MethodInfo(jm[i].method_name, jm[i].method_signature, jm[i].start_lineno, jm[i].end_lineno, jm[i].method_id, class_id)));
00123         //Methods[jm[i].method_id] = new MethodInfo(jm[i].method_name, jm[i].method_signature, jm[i].start_lineno, jm[i].end_lineno, jm[i].method_id, class_id);
00124 
00125         temp_methods.push_back(jm[i].method_id);
00126     }
00127 
00128     //ClassMethods[class_id] = temp_methods;
00129     
00130     //ClassInfo ci(*class_name, *source_name, class_id);
00131     //assert(false);
00132     Classes.insert(make_pair(class_id, ClassInfo(*class_name, *source_name, class_id) ));
00133     //Unlock(methods_lock);
00134 }

void ClassUnloadEvent ( jobjectID class_id )
 

Unloads a class.

Parameters:
class_id   the class to unload

Definition at line 42 of file classes.cpp.

Referenced by NotifyEvent().

00043 {
00044     Lock(methods_lock);
00045     ClassMethopMap::iterator i;
00046     i = ClassMethods.find(class_id);
00047     
00048     const ClassInfoMap::iterator & ci = Classes.find(class_id);
00049     if (ci != Classes.end())
00050         debug("Unload ", class_id, ci->second.getShortInfo());
00051     else
00052         debug("Unload ", class_id);
00053     
00054     if (i != ClassMethods.end())
00055     {
00056         MethodList & ms = i->second;
00057 
00058         debug("erase before ", Methods.size(), MethodCache.size());
00059         MethodList::iterator m;
00060         for (m = ms.begin(); m != ms.end(); ++m)
00061         {
00062             const MethodInfo* mi = Methods[*m];
00063             Methods.erase(*m);
00064             MethodCache.erase(*m);
00065             delete mi;          
00066         }
00067         debug("erase after ", Methods.size(), MethodCache.size());
00068     }
00069     
00070     ClassMethods.erase(class_id);
00071     Classes.erase(class_id);
00072     ClassCache.erase(class_id);
00073     
00074     Unlock(methods_lock);
00075 }


Generated at Sun Jun 24 20:57:27 2001 for xdprof by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001