354 extern "C" { |
354 extern "C" { |
355 void JNICALL JVM_RegisterJVMCINatives(JNIEnv *env, jclass compilerToVMClass); |
355 void JNICALL JVM_RegisterJVMCINatives(JNIEnv *env, jclass compilerToVMClass); |
356 jobject JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c); |
356 jobject JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c); |
357 } |
357 } |
358 |
358 |
|
359 // Dumps symbols for public <init>() and <init>(String) methods of |
|
360 // non-abstract Throwable subtypes known by the VM. This is to |
|
361 // support the use of reflection in jdk.vm.ci.hotspot.TranslatedException.create(). |
|
362 class ThrowableInitDumper : public SymbolClosure { |
|
363 private: |
|
364 fileStream* _st; |
|
365 public: |
|
366 ThrowableInitDumper(fileStream* st) { _st = st; } |
|
367 void do_symbol(Symbol** p) { |
|
368 Thread* THREAD = Thread::current(); |
|
369 Symbol* name = *p; |
|
370 if (name == NULL) { |
|
371 return; |
|
372 } |
|
373 Klass* k = SystemDictionary::resolve_or_null(name, CHECK_EXIT); |
|
374 if (k != NULL && k->is_instance_klass()) { |
|
375 InstanceKlass* iklass = InstanceKlass::cast(k); |
|
376 if (iklass->is_subclass_of(SystemDictionary::Throwable_klass()) && iklass->is_public() && !iklass->is_abstract()) { |
|
377 const char* class_name = NULL; |
|
378 Array<Method*>* methods = iklass->methods(); |
|
379 for (int i = 0; i < methods->length(); i++) { |
|
380 Method* m = methods->at(i); |
|
381 if (m->name() == vmSymbols::object_initializer_name() && |
|
382 m->is_public() && |
|
383 (m->signature() == vmSymbols::void_method_signature() || m->signature() == vmSymbols::string_void_signature())) { |
|
384 if (class_name == NULL) { |
|
385 class_name = name->as_C_string(); |
|
386 _st->print_cr("class %s", class_name); |
|
387 } |
|
388 _st->print_cr("method %s %s %s", class_name, m->name()->as_C_string(), m->signature()->as_C_string()); |
|
389 } |
|
390 } |
|
391 } |
|
392 } |
|
393 } |
|
394 }; |
|
395 |
359 #define IN_CLASS(fullClassName) current_class_name = vmSymbols::fullClassName()->as_C_string() |
396 #define IN_CLASS(fullClassName) current_class_name = vmSymbols::fullClassName()->as_C_string() |
360 /** |
397 /** |
361 * Initializes the JNI method and field ids used in JNIJVMCI. |
398 * Initializes the JNI method and field ids used in JNIJVMCI. |
362 */ |
399 */ |
363 void JNIJVMCI::initialize_ids(JNIEnv* env) { |
400 void JNIJVMCI::initialize_ids(JNIEnv* env) { |
439 if (JVMCILibDumpJNIConfig != NULL) { |
476 if (JVMCILibDumpJNIConfig != NULL) { |
440 Thread* THREAD = Thread::current(); |
477 Thread* THREAD = Thread::current(); |
441 fileStream* st = JVMCIGlobals::get_jni_config_file(); |
478 fileStream* st = JVMCIGlobals::get_jni_config_file(); |
442 |
479 |
443 DUMP_ALL_NATIVE_METHODS(vmSymbols::jdk_vm_ci_hotspot_CompilerToVM()); |
480 DUMP_ALL_NATIVE_METHODS(vmSymbols::jdk_vm_ci_hotspot_CompilerToVM()); |
|
481 ThrowableInitDumper dumper(st); |
|
482 vmSymbols::symbols_do(&dumper); |
444 |
483 |
445 st->flush(); |
484 st->flush(); |
446 tty->print_cr("Dumped JVMCI shared library JNI configuration to %s", JVMCILibDumpJNIConfig); |
485 tty->print_cr("Dumped JVMCI shared library JNI configuration to %s", JVMCILibDumpJNIConfig); |
447 vm_exit(0); |
486 vm_exit(0); |
448 } |
487 } |