< prev index next >

src/share/vm/jvmci/jvmciRuntime.cpp

Print this page
rev 10076 : 8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime


 617 JVM_END
 618 
 619 Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, const char* signature, JavaCallArguments* args, TRAPS) {
 620   guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
 621 
 622   TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_(Handle()));
 623   KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, CHECK_(Handle()));
 624   TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_(Handle()));
 625   TempNewSymbol sig = SymbolTable::new_symbol(signature, CHECK_(Handle()));
 626   JavaValue result(T_OBJECT);
 627   if (args == NULL) {
 628     JavaCalls::call_static(&result, klass, runtime, sig, CHECK_(Handle()));
 629   } else {
 630     JavaCalls::call_static(&result, klass, runtime, sig, args, CHECK_(Handle()));
 631   }
 632   return Handle((oop)result.get_jobject());
 633 }
 634 
 635 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
 636   if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {

 637 #ifdef ASSERT
 638     // This should only be called in the context of the JVMCI class being initialized
 639     TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/runtime/JVMCI", CHECK);
 640     Klass* k = SystemDictionary::resolve_or_null(name, CHECK);
 641     instanceKlassHandle klass = InstanceKlass::cast(k);
 642     assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
 643            "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
 644 #endif
 645 
 646     if (_compiler != NULL) {
 647       JavaCallArguments args;
 648       oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK);
 649       args.push_oop(compiler);
 650       callStatic("jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig",
 651                  "selectCompiler",
 652                  "(Ljava/lang/String;)Ljava/lang/Boolean;", &args, CHECK);
 653     }
 654 
 655     Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime",
 656                                "runtime",




 617 JVM_END
 618 
 619 Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, const char* signature, JavaCallArguments* args, TRAPS) {
 620   guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
 621 
 622   TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_(Handle()));
 623   KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, CHECK_(Handle()));
 624   TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_(Handle()));
 625   TempNewSymbol sig = SymbolTable::new_symbol(signature, CHECK_(Handle()));
 626   JavaValue result(T_OBJECT);
 627   if (args == NULL) {
 628     JavaCalls::call_static(&result, klass, runtime, sig, CHECK_(Handle()));
 629   } else {
 630     JavaCalls::call_static(&result, klass, runtime, sig, args, CHECK_(Handle()));
 631   }
 632   return Handle((oop)result.get_jobject());
 633 }
 634 
 635 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
 636   if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {
 637     ResourceMark rm;
 638 #ifdef ASSERT
 639     // This should only be called in the context of the JVMCI class being initialized
 640     TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/runtime/JVMCI", CHECK);
 641     Klass* k = SystemDictionary::resolve_or_null(name, CHECK);
 642     instanceKlassHandle klass = InstanceKlass::cast(k);
 643     assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
 644            "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
 645 #endif
 646 
 647     if (_compiler != NULL) {
 648       JavaCallArguments args;
 649       oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK);
 650       args.push_oop(compiler);
 651       callStatic("jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig",
 652                  "selectCompiler",
 653                  "(Ljava/lang/String;)Ljava/lang/Boolean;", &args, CHECK);
 654     }
 655 
 656     Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime",
 657                                "runtime",


< prev index next >