Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6252173

JVMTI Spec: SetJNIFunctionTable spec may not be achievable with the way that JNIEnv is declared

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 6
    • hotspot
    • None
    • b53
    • generic
    • generic

      The specification for SetJNIFunctionTable states:

      "Set the JNI function table in all current and future JNI environments. As a result, all future JNI calls are directed to the specified functions."

      However the assertion that all future JNI calls will be directs may conflict with the definition of JNIEnv in the standard jni.h header file:

      struct JNIEnv_ {
          const struct JNINativeInterface_ *functions;
          :
      }

      #ifdef __cplusplus
      typedef JNIEnv_ JNIEnv;
      #else
      typedef const struct JNINativeInterface_ *JNIEnv;
      #endif

      As "functions" is a pointer to a readonly function table it's possible that some compilers might optimize away the access to the table.

      The JVMTI spec needs to be updated to make it clear that the future JNI calls will only be directed when JNI code re-fetches the function address.

      ###@###.### 2005-04-07 18:40:53 GMT

            rfield Robert Field (Inactive)
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: