< prev index next >

src/share/vm/ci/ciObjectFactory.cpp

Print this page




 368   // Hold metadata from unloading by keeping it's holder alive.
 369   if (_initialized && o->is_klass()) {
 370     Klass* holder = ((Klass*)o);
 371     if (holder->is_instance_klass() && InstanceKlass::cast(holder)->is_anonymous()) {
 372       // Though ciInstanceKlass records class loader oop, it's not enough to keep
 373       // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
 374       // It is enough to record a ciObject, since cached elements are never removed
 375       // during ciObjectFactory lifetime. ciObjectFactory itself is created for
 376       // every compilation and lives for the whole duration of the compilation.
 377       ciObject* h = get(holder->klass_holder());
 378     }
 379   }
 380 
 381   if (o->is_klass()) {
 382     KlassHandle h_k(THREAD, (Klass*)o);
 383     Klass* k = (Klass*)o;
 384     if (k->is_value()) {
 385       return new (arena()) ciValueKlass(h_k);
 386     } else if (k->is_instance_klass()) {
 387       return new (arena()) ciInstanceKlass(h_k);


 388     } else if (k->is_objArray_klass()) {
 389       return new (arena()) ciObjArrayKlass(h_k);
 390     } else if (k->is_typeArray_klass()) {
 391       return new (arena()) ciTypeArrayKlass(h_k);
 392     }
 393   } else if (o->is_method()) {
 394     methodHandle h_m(THREAD, (Method*)o);
 395     ciEnv *env = CURRENT_THREAD_ENV;
 396     ciInstanceKlass* holder = env->get_instance_klass(h_m()->method_holder());
 397     return new (arena()) ciMethod(h_m, holder);
 398   } else if (o->is_methodData()) {
 399     // Hold methodHandle alive - might not be necessary ???
 400     methodHandle h_m(THREAD, ((MethodData*)o)->method());
 401     return new (arena()) ciMethodData((MethodData*)o);
 402   }
 403 
 404   // The Metadata* is of some type not supported by the compiler interface.
 405   ShouldNotReachHere();
 406   return NULL;
 407 }




 368   // Hold metadata from unloading by keeping it's holder alive.
 369   if (_initialized && o->is_klass()) {
 370     Klass* holder = ((Klass*)o);
 371     if (holder->is_instance_klass() && InstanceKlass::cast(holder)->is_anonymous()) {
 372       // Though ciInstanceKlass records class loader oop, it's not enough to keep
 373       // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
 374       // It is enough to record a ciObject, since cached elements are never removed
 375       // during ciObjectFactory lifetime. ciObjectFactory itself is created for
 376       // every compilation and lives for the whole duration of the compilation.
 377       ciObject* h = get(holder->klass_holder());
 378     }
 379   }
 380 
 381   if (o->is_klass()) {
 382     KlassHandle h_k(THREAD, (Klass*)o);
 383     Klass* k = (Klass*)o;
 384     if (k->is_value()) {
 385       return new (arena()) ciValueKlass(h_k);
 386     } else if (k->is_instance_klass()) {
 387       return new (arena()) ciInstanceKlass(h_k);
 388     } else if (k->is_valueArray_klass()) {
 389       return new (arena()) ciValueArrayKlass(h_k);
 390     } else if (k->is_objArray_klass()) {
 391       return new (arena()) ciObjArrayKlass(h_k);
 392     } else if (k->is_typeArray_klass()) {
 393       return new (arena()) ciTypeArrayKlass(h_k);
 394     }
 395   } else if (o->is_method()) {
 396     methodHandle h_m(THREAD, (Method*)o);
 397     ciEnv *env = CURRENT_THREAD_ENV;
 398     ciInstanceKlass* holder = env->get_instance_klass(h_m()->method_holder());
 399     return new (arena()) ciMethod(h_m, holder);
 400   } else if (o->is_methodData()) {
 401     // Hold methodHandle alive - might not be necessary ???
 402     methodHandle h_m(THREAD, ((MethodData*)o)->method());
 403     return new (arena()) ciMethodData((MethodData*)o);
 404   }
 405 
 406   // The Metadata* is of some type not supported by the compiler interface.
 407   ShouldNotReachHere();
 408   return NULL;
 409 }


< prev index next >