コード例 #1
0
/*
 * Class:     java_lang_VMClassRegistry
 * Method:    getClassLoader
 * Signature: (Ljava/lang/Class;)Ljava/lang/ClassLoader;
 */
JNIEXPORT jobject JNICALL Java_java_lang_VMClassRegistry_getClassLoader0
  (JNIEnv *jenv, jclass, jclass clazz)
{
    Class_Handle clss = jni_get_class_handle(jenv, clazz);
    Class_Loader_Handle clh = class_get_class_loader(clss);
    return jni_class_loader_from_handle(jenv, clh);
}
コード例 #2
0
static void addProfilesForClassloader(Class_Loader_Handle h, EBProfiles& from, EBProfiles& to, bool erase) {
    for (EBProfiles::iterator it = from.begin(), end = from.end(); it!=end; ++it) {
        EBMethodProfile* profile = *it;
        Class_Handle ch =  method_get_class(profile->mh);;
        Class_Loader_Handle clh = class_get_class_loader(ch);
        if (clh == h) {
            to.push_back(profile);
            if (erase) {
                *it=NULL;
            }
        }
    }
    if (erase) {
        from.erase(std::remove(from.begin(), from.end(), (EBMethodProfile*)NULL), from.end());
    }
}
コード例 #3
0
/**
 * Receives class by given class name, loads it if it's needed.
 */
Class_Handle
    vf_resolve_class( Class_Handle k_class,    // current class
    const char *name,         // resolved class name
    bool need_load)      // load flag
{
    Class_Handle result;

    // get class loader
    Class_Loader_Handle class_loader = class_get_class_loader( k_class );

    result = need_load ?
        class_loader_load_class( class_loader, name )
        : class_loader_lookup_class( class_loader, name );

    //we assume that this pre-defined constant is not a valid class-handler
    assert(CLASS_NOT_LOADED != result);
    
    return result;
} // vf_resolve_class