< prev index next >

src/hotspot/share/jvmci/jvmciJavaClasses.cpp

Print this page




  66   if (name_symbol == NULL || signature_symbol == NULL) {
  67 #ifndef PRODUCT
  68     ik->print_on(tty);
  69 #endif
  70     fatal("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string());
  71   }
  72 
  73   fieldDescriptor fd;
  74   if (!ik->find_field(name_symbol, signature_symbol, &fd)) {
  75     ResourceMark rm;
  76     fatal("Could not find field %s.%s with signature %s", ik->external_name(), name, signature);
  77   }
  78   guarantee(fd.is_static() == static_field, "static/instance mismatch");
  79   dest_offset = fd.offset();
  80   assert(dest_offset != 0, "must be valid offset");
  81   if (static_field) {
  82     // Must ensure classes for static fields are initialized as the
  83     // accessor itself does not include a class initialization check.
  84     ik->initialize(CHECK);
  85   }

  86 }
  87 
  88 #ifndef PRODUCT
  89 static void check_resolve_method(const char* call_type, Klass* resolved_klass, Symbol* method_name, Symbol* method_signature, TRAPS) {
  90   methodHandle method;
  91   LinkInfo link_info(resolved_klass, method_name, method_signature, NULL, LinkInfo::skip_access_check);
  92   if (strcmp(call_type, "call_static") == 0) {
  93     method = LinkResolver::resolve_static_call_or_null(link_info);
  94   } else if (strcmp(call_type, "call_virtual") == 0) {
  95     method = LinkResolver::resolve_virtual_call_or_null(resolved_klass, link_info);
  96   } else if (strcmp(call_type, "call_special") == 0) {
  97     method = LinkResolver::resolve_special_call_or_null(link_info);
  98   } else {
  99     fatal("Unknown or unsupported call type: %s", call_type);
 100   }
 101   if (method.is_null()) {
 102     fatal("Could not resolve %s.%s%s", resolved_klass->external_name(), method_name->as_C_string(), method_signature->as_C_string());
 103   }
 104 }
 105 #endif
 106 
 107 jclass JNIJVMCI::_box_classes[T_CONFLICT+1];
 108 jclass JNIJVMCI::_byte_array;
 109 jfieldID JNIJVMCI::_box_fields[T_CONFLICT+1];
 110 jmethodID JNIJVMCI::_box_constructors[T_CONFLICT+1];
 111 jmethodID JNIJVMCI::_Class_getName_method;
 112 
 113 jmethodID JNIJVMCI::_HotSpotResolvedJavaMethodImpl_fromMetaspace_method;
 114 jmethodID JNIJVMCI::_HotSpotConstantPool_fromMetaspace_method;
 115 jmethodID JNIJVMCI::_HotSpotResolvedObjectTypeImpl_fromMetaspace_method;
 116 jmethodID JNIJVMCI::_HotSpotResolvedPrimitiveType_fromMetaspace_method;
 117 
 118 #define START_CLASS(className, fullClassName)                          { \
 119   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::fullClassName(), true, CHECK); \
 120   className::_klass = InstanceKlass::cast(k); \

 121   className::_klass->initialize(CHECK);
 122 
 123 #define END_CLASS }
 124 
 125 #define FIELD(className, name, signature, static_field) compute_offset(className::_##name##_offset, className::_klass, #name, signature, static_field, CHECK);
 126 #define CHAR_FIELD(className, name) FIELD(className, name, "C", false)
 127 #define INT_FIELD(className, name) FIELD(className, name, "I", false)
 128 #define BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", false)
 129 #define LONG_FIELD(className, name) FIELD(className, name, "J", false)
 130 #define FLOAT_FIELD(className, name) FIELD(className, name, "F", false)
 131 #define OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, false)
 132 #define STATIC_OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, true)
 133 #define STATIC_INT_FIELD(className, name) FIELD(className, name, "I", true)
 134 #define STATIC_BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", true)
 135 #ifdef PRODUCT
 136 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args)
 137 #define CONSTRUCTOR(className, signature)
 138 #else
 139 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args) \
 140   check_resolve_method(#hsCallType, k, vmSymbols::methodName##_name(), vmSymbols::signatureSymbolName(), CHECK);


 269 #undef STATIC_OBJECT_FIELD
 270 #undef STATIC_OBJECTARRAY_FIELD
 271 #undef STATIC_INT_FIELD
 272 #undef STATIC_BOOLEAN_FIELD
 273 #undef STATIC_PRIMITIVE_FIELD
 274 #undef EMPTY_CAST
 275 
 276 /**
 277  * Initializes the JNI id of a field. As per the JNI specification,
 278  * this ensures the declaring class is initialized.
 279  */
 280 void JNIJVMCI::initialize_field_id(JNIEnv* env, jfieldID &fieldid, jclass clazz, const char* class_name, const char* name, const char* signature, bool static_field) {
 281   if (JVMCILibDumpJNIConfig != NULL) {
 282     fileStream* st = JVMCIGlobals::get_jni_config_file();
 283     st->print_cr("field %s %s %s", class_name, name, signature);
 284     return;
 285   }
 286   if (env->ExceptionCheck()) {
 287     return;
 288   }

 289   if (static_field) {
 290     // Class initialization barrier
 291     fieldid = env->GetStaticFieldID(clazz, name, signature);
 292   } else {
 293     // Class initialization barrier
 294     fieldid = env->GetFieldID(clazz, name, signature);
 295   }

 296 
 297   if (env->ExceptionCheck()) {
 298     env->ExceptionDescribe();
 299     env->ExceptionClear();
 300     ResourceMark rm;
 301     Thread* THREAD = Thread::current();
 302     fatal("Could not find field %s.%s with signature %s", class_name, name, signature);
 303   }
 304 }
 305 
 306 #define START_CLASS(className, fullClassName) {                                             \
 307   current_class_name = vmSymbols::fullClassName()->as_C_string();                           \
 308   if (JVMCILibDumpJNIConfig != NULL) {                                                      \
 309     fileStream* st = JVMCIGlobals::get_jni_config_file();                                   \
 310     st->print_cr("class %s", current_class_name);                                           \
 311   } else {                                                                                  \
 312     jclass k = env->FindClass(current_class_name);                                          \
 313     JVMCI_EXCEPTION_CHECK(env, "FindClass(%s)", current_class_name);                        \
 314     assert(k != NULL, #fullClassName " not initialized");                                   \
 315     className::_class = (jclass) env->NewGlobalRef(k);                                      \


 316   }
 317 
 318 #define END_CLASS current_class_name = NULL; }
 319 
 320 #define FIELD(className, name, signature, static_field) initialize_field_id(env, className::_##name##_field_id, className::_class, current_class_name, #name, signature, static_field);
 321 #define CHAR_FIELD(className, name) FIELD(className, name, "C", false)
 322 #define INT_FIELD(className, name) FIELD(className, name, "I", false)
 323 #define BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", false)
 324 #define LONG_FIELD(className, name) FIELD(className, name, "J", false)
 325 #define FLOAT_FIELD(className, name) FIELD(className, name, "F", false)
 326 #define OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, false)
 327 #define STATIC_OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, true)
 328 #define STATIC_INT_FIELD(className, name) FIELD(className, name, "I", true)
 329 #define STATIC_BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", true)
 330 
 331 #define GET_JNI_METHOD(jniGetMethod, dst, clazz, methodName, signature)                        \
 332           if (JVMCILibDumpJNIConfig != NULL) {                                                       \
 333             fileStream* st = JVMCIGlobals::get_jni_config_file();                                    \
 334             st->print_cr("method %s %s %s", current_class_name, methodName, signature);              \
 335           } else {                                                                                   \

 336                   dst = env->jniGetMethod(clazz, methodName, signature);                                   \
 337                   JVMCI_EXCEPTION_CHECK(env, #jniGetMethod "(%s.%s%s)", current_class_name, methodName, signature); \

 338                 assert(dst != NULL, "uninitialized");                                          \


 339           }
 340 
 341 #define GET_JNI_CONSTRUCTOR(clazz, signature) \
 342   GET_JNI_METHOD(GetMethodID, JNIJVMCI::clazz::_constructor, clazz::_class, "<init>", signature) \
 343 
 344 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args) \
 345      GET_JNI_METHOD(jniGetMethod,                                        \
 346                     className::_##methodName##_method,                   \
 347                     className::clazz(),                                  \
 348                     vmSymbols::methodName##_name()->as_C_string(),       \
 349                     vmSymbols::signatureSymbolName()->as_C_string())
 350 
 351 #define CONSTRUCTOR(className, signature) \
 352   GET_JNI_CONSTRUCTOR(className, signature)
 353 
 354 extern "C" {
 355   void     JNICALL JVM_RegisterJVMCINatives(JNIEnv *env, jclass compilerToVMClass);
 356   jobject  JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c);
 357 }
 358 


 476   if (JVMCILibDumpJNIConfig != NULL) {
 477     Thread* THREAD = Thread::current();
 478     fileStream* st = JVMCIGlobals::get_jni_config_file();
 479 
 480     DUMP_ALL_NATIVE_METHODS(vmSymbols::jdk_vm_ci_hotspot_CompilerToVM());
 481     ThrowableInitDumper dumper(st);
 482     vmSymbols::symbols_do(&dumper);
 483 
 484     st->flush();
 485     tty->print_cr("Dumped JVMCI shared library JNI configuration to %s", JVMCILibDumpJNIConfig);
 486     vm_exit(0);
 487   }
 488 
 489 #undef DUMP_ALL_NATIVE_METHODS
 490 #undef DO_BOX_CLASS
 491 #undef BOX_CLASSES
 492 #undef IN_CLASS
 493 
 494 #define CC (char*)  /*cast a literal from (const char*)*/
 495 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(f))

 496 
 497   if (env != JavaThread::current()->jni_environment()) {
 498     jclass clazz = env->FindClass("jdk/vm/ci/hotspot/CompilerToVM");

 499     if (env->ExceptionCheck()) {
 500       env->ExceptionDescribe();
 501       guarantee(false, "Could not find class jdk/vm/ci/hotspot/CompilerToVM");
 502     }
 503     JNINativeMethod CompilerToVM_native_methods[] = {
 504       { CC"registerNatives",     CC"()V", FN_PTR(JVM_RegisterJVMCINatives)     },
 505     };
 506     env->RegisterNatives(clazz, CompilerToVM_native_methods, 1);
 507     if (env->ExceptionCheck()) {
 508       env->ExceptionDescribe();
 509       guarantee(false, "");
 510     }
 511 
 512     JNINativeMethod JVMCI_native_methods[] = {
 513       { CC"initializeRuntime",   CC"()Ljdk/vm/ci/runtime/JVMCIRuntime;", FN_PTR(JVM_GetJVMCIRuntime) },
 514     };
 515     env->RegisterNatives(JVMCI::clazz(), JVMCI_native_methods, 1);
 516     if (env->ExceptionCheck()) {
 517       env->ExceptionDescribe();
 518       guarantee(false, "");
 519     }









 520   }
 521 }
 522 
 523 #undef METHOD
 524 #undef CONSTRUCTOR
 525 #undef FIELD2
 526 
 527 #define EMPTY0
 528 #define EMPTY1(x)
 529 #define EMPTY2(x,y)
 530 #define FIELD3(className, name, sig) FIELD2(className, name)
 531 #define FIELD2(className, name) \
 532   jfieldID JNIJVMCI::className::_##name##_field_id = 0; \
 533   int HotSpotJVMCI::className::_##name##_offset = 0;
 534 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args)
 535 #define CONSTRUCTOR(className, signature)
 536 
 537 // Generates the definitions of static fields used by the accessors. For example:
 538 //  jfieldID JNIJVMCI::Architecture::_wordKind_field_id = 0;
 539 //  jfieldID HotSpotJVMCI::Architecture::_wordKind_offset = 0;




  66   if (name_symbol == NULL || signature_symbol == NULL) {
  67 #ifndef PRODUCT
  68     ik->print_on(tty);
  69 #endif
  70     fatal("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string());
  71   }
  72 
  73   fieldDescriptor fd;
  74   if (!ik->find_field(name_symbol, signature_symbol, &fd)) {
  75     ResourceMark rm;
  76     fatal("Could not find field %s.%s with signature %s", ik->external_name(), name, signature);
  77   }
  78   guarantee(fd.is_static() == static_field, "static/instance mismatch");
  79   dest_offset = fd.offset();
  80   assert(dest_offset != 0, "must be valid offset");
  81   if (static_field) {
  82         // Must ensure classes for static fields are initialized as the
  83         // accessor itself does not include a class initialization check.
  84         ik->initialize(CHECK);
  85   }
  86   TRACE_jvmci_2("   field offset for %s %s.%s = %d", signature, ik->external_name(), name, dest_offset);
  87 }
  88 
  89 #ifndef PRODUCT
  90 static void check_resolve_method(const char* call_type, Klass* resolved_klass, Symbol* method_name, Symbol* method_signature, TRAPS) {
  91   methodHandle method;
  92   LinkInfo link_info(resolved_klass, method_name, method_signature, NULL, LinkInfo::skip_access_check);
  93   if (strcmp(call_type, "call_static") == 0) {
  94     method = LinkResolver::resolve_static_call_or_null(link_info);
  95   } else if (strcmp(call_type, "call_virtual") == 0) {
  96     method = LinkResolver::resolve_virtual_call_or_null(resolved_klass, link_info);
  97   } else if (strcmp(call_type, "call_special") == 0) {
  98     method = LinkResolver::resolve_special_call_or_null(link_info);
  99   } else {
 100     fatal("Unknown or unsupported call type: %s", call_type);
 101   }
 102   if (method.is_null()) {
 103     fatal("Could not resolve %s.%s%s", resolved_klass->external_name(), method_name->as_C_string(), method_signature->as_C_string());
 104   }
 105 }
 106 #endif
 107 
 108 jclass JNIJVMCI::_box_classes[T_CONFLICT+1];
 109 jclass JNIJVMCI::_byte_array;
 110 jfieldID JNIJVMCI::_box_fields[T_CONFLICT+1];
 111 jmethodID JNIJVMCI::_box_constructors[T_CONFLICT+1];
 112 jmethodID JNIJVMCI::_Class_getName_method;
 113 
 114 jmethodID JNIJVMCI::_HotSpotResolvedJavaMethodImpl_fromMetaspace_method;
 115 jmethodID JNIJVMCI::_HotSpotConstantPool_fromMetaspace_method;
 116 jmethodID JNIJVMCI::_HotSpotResolvedObjectTypeImpl_fromMetaspace_method;
 117 jmethodID JNIJVMCI::_HotSpotResolvedPrimitiveType_fromMetaspace_method;
 118 
 119 #define START_CLASS(className, fullClassName)                          { \
 120   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::fullClassName(), true, CHECK); \
 121   className::_klass = InstanceKlass::cast(k);                                     \
 122   TRACE_jvmci_2(" klass for %s = " PTR_FORMAT, k->external_name(), p2i(k));       \
 123   className::_klass->initialize(CHECK);
 124 
 125 #define END_CLASS }
 126 
 127 #define FIELD(className, name, signature, static_field) compute_offset(className::_##name##_offset, className::_klass, #name, signature, static_field, CHECK);
 128 #define CHAR_FIELD(className, name) FIELD(className, name, "C", false)
 129 #define INT_FIELD(className, name) FIELD(className, name, "I", false)
 130 #define BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", false)
 131 #define LONG_FIELD(className, name) FIELD(className, name, "J", false)
 132 #define FLOAT_FIELD(className, name) FIELD(className, name, "F", false)
 133 #define OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, false)
 134 #define STATIC_OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, true)
 135 #define STATIC_INT_FIELD(className, name) FIELD(className, name, "I", true)
 136 #define STATIC_BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", true)
 137 #ifdef PRODUCT
 138 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args)
 139 #define CONSTRUCTOR(className, signature)
 140 #else
 141 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args) \
 142   check_resolve_method(#hsCallType, k, vmSymbols::methodName##_name(), vmSymbols::signatureSymbolName(), CHECK);


 271 #undef STATIC_OBJECT_FIELD
 272 #undef STATIC_OBJECTARRAY_FIELD
 273 #undef STATIC_INT_FIELD
 274 #undef STATIC_BOOLEAN_FIELD
 275 #undef STATIC_PRIMITIVE_FIELD
 276 #undef EMPTY_CAST
 277 
 278 /**
 279  * Initializes the JNI id of a field. As per the JNI specification,
 280  * this ensures the declaring class is initialized.
 281  */
 282 void JNIJVMCI::initialize_field_id(JNIEnv* env, jfieldID &fieldid, jclass clazz, const char* class_name, const char* name, const char* signature, bool static_field) {
 283   if (JVMCILibDumpJNIConfig != NULL) {
 284     fileStream* st = JVMCIGlobals::get_jni_config_file();
 285     st->print_cr("field %s %s %s", class_name, name, signature);
 286     return;
 287   }
 288   if (env->ExceptionCheck()) {
 289     return;
 290   }
 291   jfieldID current = fieldid;
 292   if (static_field) {
 293     // Class initialization barrier
 294     fieldid = env->GetStaticFieldID(clazz, name, signature);
 295   } else {
 296     // Class initialization barrier
 297     fieldid = env->GetFieldID(clazz, name, signature);
 298   }
 299   TRACE_jvmci_2("   jfieldID for %s %s.%s = " PTR_FORMAT, signature, class_name, name, p2i(fieldid));
 300 
 301   if (env->ExceptionCheck()) {
 302     env->ExceptionDescribe();
 303     env->ExceptionClear();
 304     ResourceMark rm;
 305     Thread* THREAD = Thread::current();
 306     fatal("Could not find field %s.%s with signature %s", class_name, name, signature);
 307   }
 308 }
 309 
 310 #define START_CLASS(className, fullClassName) {                                             \
 311   current_class_name = vmSymbols::fullClassName()->as_C_string();                           \
 312   if (JVMCILibDumpJNIConfig != NULL) {                                                      \
 313     fileStream* st = JVMCIGlobals::get_jni_config_file();                                   \
 314     st->print_cr("class %s", current_class_name);                                           \
 315   } else {                                                                                  \
 316     jclass k = env->FindClass(current_class_name);                                          \
 317     JVMCI_EXCEPTION_CHECK(env, "FindClass(%s)", current_class_name);                        \
 318     assert(k != NULL, #fullClassName " not initialized");                                   \
 319     k = (jclass) env->NewGlobalRef(k);                                                      \
 320     TRACE_jvmci_2(" jclass for %s = " PTR_FORMAT, current_class_name, p2i(k));              \
 321     className::_class = k;                                                                  \
 322   }
 323 
 324 #define END_CLASS current_class_name = NULL; }
 325 
 326 #define FIELD(className, name, signature, static_field) initialize_field_id(env, className::_##name##_field_id, className::_class, current_class_name, #name, signature, static_field);
 327 #define CHAR_FIELD(className, name) FIELD(className, name, "C", false)
 328 #define INT_FIELD(className, name) FIELD(className, name, "I", false)
 329 #define BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", false)
 330 #define LONG_FIELD(className, name) FIELD(className, name, "J", false)
 331 #define FLOAT_FIELD(className, name) FIELD(className, name, "F", false)
 332 #define OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, false)
 333 #define STATIC_OBJECT_FIELD(className, name, signature) FIELD(className, name, signature, true)
 334 #define STATIC_INT_FIELD(className, name) FIELD(className, name, "I", true)
 335 #define STATIC_BOOLEAN_FIELD(className, name) FIELD(className, name, "Z", true)
 336 
 337 #define GET_JNI_METHOD(jniGetMethod, dst, clazz, methodName, signature)                        \
 338     if (JVMCILibDumpJNIConfig != NULL) {                                                       \
 339       fileStream* st = JVMCIGlobals::get_jni_config_file();                                    \
 340       st->print_cr("method %s %s %s", current_class_name, methodName, signature);              \
 341     } else {                                                                                   \
 342       jmethodID current = dst;                                                                 \
 343       dst = env->jniGetMethod(clazz, methodName, signature);                                   \
 344       JVMCI_EXCEPTION_CHECK(env, #jniGetMethod "(%s.%s%s)",                                    \
 345                   current_class_name, methodName, signature);                                  \
 346       assert(dst != NULL, "uninitialized");                                                    \
 347       TRACE_jvmci_2("   jmethodID for %s.%s%s = " PTR_FORMAT,                                  \
 348                   current_class_name, methodName, signature, p2i(dst));                        \
 349     }
 350 
 351 #define GET_JNI_CONSTRUCTOR(clazz, signature) \
 352   GET_JNI_METHOD(GetMethodID, JNIJVMCI::clazz::_constructor, clazz::_class, "<init>", signature) \
 353 
 354 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args) \
 355      GET_JNI_METHOD(jniGetMethod,                                        \
 356                     className::_##methodName##_method,                   \
 357                     className::clazz(),                                  \
 358                     vmSymbols::methodName##_name()->as_C_string(),       \
 359                     vmSymbols::signatureSymbolName()->as_C_string())
 360 
 361 #define CONSTRUCTOR(className, signature) \
 362   GET_JNI_CONSTRUCTOR(className, signature)
 363 
 364 extern "C" {
 365   void     JNICALL JVM_RegisterJVMCINatives(JNIEnv *env, jclass compilerToVMClass);
 366   jobject  JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c);
 367 }
 368 


 486   if (JVMCILibDumpJNIConfig != NULL) {
 487     Thread* THREAD = Thread::current();
 488     fileStream* st = JVMCIGlobals::get_jni_config_file();
 489 
 490     DUMP_ALL_NATIVE_METHODS(vmSymbols::jdk_vm_ci_hotspot_CompilerToVM());
 491     ThrowableInitDumper dumper(st);
 492     vmSymbols::symbols_do(&dumper);
 493 
 494     st->flush();
 495     tty->print_cr("Dumped JVMCI shared library JNI configuration to %s", JVMCILibDumpJNIConfig);
 496     vm_exit(0);
 497   }
 498 
 499 #undef DUMP_ALL_NATIVE_METHODS
 500 #undef DO_BOX_CLASS
 501 #undef BOX_CLASSES
 502 #undef IN_CLASS
 503 
 504 #define CC (char*)  /*cast a literal from (const char*)*/
 505 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(f))
 506 }
 507 
 508 static void register_natives_for_class(JNIEnv* env, jclass clazz, const char* name, const JNINativeMethod *methods, jint nMethods) {
 509   if (clazz == NULL) {
 510     clazz = env->FindClass(name);
 511     if (env->ExceptionCheck()) {
 512       env->ExceptionDescribe();
 513       fatal("Could not find class %s", name);
 514     }







 515   }
 516   env->RegisterNatives(clazz, methods, nMethods);




 517   if (env->ExceptionCheck()) {
 518     env->ExceptionDescribe();
 519     fatal("Failure registering natives for %s", name);
 520   }
 521 }
 522 
 523 void JNIJVMCI::register_natives(JNIEnv* env) {
 524   if (env != JavaThread::current()->jni_environment()) {
 525     JNINativeMethod CompilerToVM_nmethods[] = {{ CC"registerNatives", CC"()V", FN_PTR(JVM_RegisterJVMCINatives) }};
 526     JNINativeMethod JVMCI_nmethods[] = {{ CC"initializeRuntime",   CC"()Ljdk/vm/ci/runtime/JVMCIRuntime;", FN_PTR(JVM_GetJVMCIRuntime) }};
 527 
 528     register_natives_for_class(env, NULL, "jdk/vm/ci/hotspot/CompilerToVM", CompilerToVM_nmethods, 1);
 529     register_natives_for_class(env, JVMCI::clazz(), "jdk/vm/ci/runtime/JVMCI", JVMCI_nmethods, 1);
 530   }
 531 }
 532 
 533 #undef METHOD
 534 #undef CONSTRUCTOR
 535 #undef FIELD2
 536 
 537 #define EMPTY0
 538 #define EMPTY1(x)
 539 #define EMPTY2(x,y)
 540 #define FIELD3(className, name, sig) FIELD2(className, name)
 541 #define FIELD2(className, name) \
 542   jfieldID JNIJVMCI::className::_##name##_field_id = 0; \
 543   int HotSpotJVMCI::className::_##name##_offset = 0;
 544 #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args)
 545 #define CONSTRUCTOR(className, signature)
 546 
 547 // Generates the definitions of static fields used by the accessors. For example:
 548 //  jfieldID JNIJVMCI::Architecture::_wordKind_field_id = 0;
 549 //  jfieldID HotSpotJVMCI::Architecture::_wordKind_offset = 0;


< prev index next >