hotspot/src/share/vm/prims/jni.cpp
changeset 13975 2f7431485cfa
parent 13728 882756847a04
child 13977 92de166c91b3
equal deleted inserted replaced
13951:3fc49366dc15 13975:2f7431485cfa
  3001   DTRACE_PROBE3(hotspot_jni, GetStaticObjectField__entry, env, clazz, fieldID);
  3001   DTRACE_PROBE3(hotspot_jni, GetStaticObjectField__entry, env, clazz, fieldID);
  3002 #else /* USDT2 */
  3002 #else /* USDT2 */
  3003   HOTSPOT_JNI_GETSTATICOBJECTFIELD_ENTRY(
  3003   HOTSPOT_JNI_GETSTATICOBJECTFIELD_ENTRY(
  3004                                          env, clazz, (uintptr_t) fieldID);
  3004                                          env, clazz, (uintptr_t) fieldID);
  3005 #endif /* USDT2 */
  3005 #endif /* USDT2 */
  3006 #ifndef JNICHECK_KERNEL
  3006 #if INCLUDE_JNI_CHECK
  3007   DEBUG_ONLY(Klass* param_k = jniCheck::validate_class(thread, clazz);)
  3007   DEBUG_ONLY(Klass* param_k = jniCheck::validate_class(thread, clazz);)
  3008 #endif // JNICHECK_KERNEL
  3008 #endif // INCLUDE_JNI_CHECK
  3009   JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID);
  3009   JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID);
  3010   assert(id->is_static_field_id(), "invalid static field id");
  3010   assert(id->is_static_field_id(), "invalid static field id");
  3011   // Keep JVMTI addition small and only check enabled flag here.
  3011   // Keep JVMTI addition small and only check enabled flag here.
  3012   // jni_GetField_probe() assumes that is okay to create handles.
  3012   // jni_GetField_probe() assumes that is okay to create handles.
  3013   if (JvmtiExport::should_post_field_access()) {
  3013   if (JvmtiExport::should_post_field_access()) {
  3949 // is not native.  Ask JVM TI what prefixes have been specified.  Then check
  3949 // is not native.  Ask JVM TI what prefixes have been specified.  Then check
  3950 // to see if the native method is now wrapped with the prefixes.  See the
  3950 // to see if the native method is now wrapped with the prefixes.  See the
  3951 // SetNativeMethodPrefix(es) functions in the JVM TI Spec for details.
  3951 // SetNativeMethodPrefix(es) functions in the JVM TI Spec for details.
  3952 static Method* find_prefixed_native(KlassHandle k,
  3952 static Method* find_prefixed_native(KlassHandle k,
  3953                                       Symbol* name, Symbol* signature, TRAPS) {
  3953                                       Symbol* name, Symbol* signature, TRAPS) {
       
  3954 #if INCLUDE_JVMTI
  3954   ResourceMark rm(THREAD);
  3955   ResourceMark rm(THREAD);
  3955   Method* method;
  3956   Method* method;
  3956   int name_len = name->utf8_length();
  3957   int name_len = name->utf8_length();
  3957   char* name_str = name->as_utf8();
  3958   char* name_str = name->as_utf8();
  3958   int prefix_count;
  3959   int prefix_count;
  3980     }
  3981     }
  3981     // found as non-native, so prefix is good, add it, probably just need more prefixes
  3982     // found as non-native, so prefix is good, add it, probably just need more prefixes
  3982     name_len = trial_len;
  3983     name_len = trial_len;
  3983     name_str = trial_name_str;
  3984     name_str = trial_name_str;
  3984   }
  3985   }
       
  3986 #endif // INCLUDE_JVMTI
  3985   return NULL; // not found
  3987   return NULL; // not found
  3986 }
  3988 }
  3987 
  3989 
  3988 static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, address entry, TRAPS) {
  3990 static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, address entry, TRAPS) {
  3989   Method* method = Klass::cast(k())->lookup_method(name, signature);
  3991   Method* method = Klass::cast(k())->lookup_method(name, signature);
  4973   }
  4975   }
  4974 }
  4976 }
  4975 
  4977 
  4976 // Returns the function structure
  4978 // Returns the function structure
  4977 struct JNINativeInterface_* jni_functions() {
  4979 struct JNINativeInterface_* jni_functions() {
  4978 #ifndef JNICHECK_KERNEL
  4980 #if INCLUDE_JNI_CHECK
  4979   if (CheckJNICalls) return jni_functions_check();
  4981   if (CheckJNICalls) return jni_functions_check();
  4980 #else  // JNICHECK_KERNEL
  4982 #endif // INCLUDE_JNI_CHECK
  4981   if (CheckJNICalls) warning("-Xcheck:jni is not supported in kernel vm.");
       
  4982 #endif // JNICHECK_KERNEL
       
  4983   return &jni_NativeInterface;
  4983   return &jni_NativeInterface;
  4984 }
  4984 }
  4985 
  4985 
  4986 // Returns the function structure
  4986 // Returns the function structure
  4987 struct JNINativeInterface_* jni_functions_nocheck() {
  4987 struct JNINativeInterface_* jni_functions_nocheck() {