JDK-6252173 : JVMTI Spec: SetJNIFunctionTable spec may not be achievable with the way that JNIEnv is declared
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-04-07
  • Updated: 2011-02-16
  • Resolved: 2005-09-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b53Fixed
Description
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

Comments
EVALUATION Spec must be updated per Description.
28-07-2005