Summary
The JVMTI specification describes the "Extension Event" and gives an example, but the example doesn't match the specification. The example must be changed to match the specification. This is a clear copy of the same CSR for openjdk16.
Problem
In the JVMTI specification, in the description of "Extension Event", the specification for the extension event callback function is given as:
typedef void (JNICALL *jvmtiExtensionEvent)
(jvmtiEnv* jvmti_env,
...);
But the example for a handler that takes a jint
parameter is given as:
void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...)
Here a variadic function argument (myInt
) is declared as a constant argument.
On some platforms constant and variadic arguments are passed differently, and following the example will result in error on such platforms.
Solution
Change the example function to match the specification of jvmtiExtensionEvent
and only take a varargs parameter. Change IsClassUnloadingEnabled function in hotspot to match updated spec.
Specification
src/hotspot/share/prims/jvmti.xml
there is a <code>jint</code> parameter, the event handler should be
declared:
<example>
- void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...)
+ void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
</example>
Note the terminal "<code>...</code>" which indicates varargs.
+ The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
+ the <code>va_*</code> syntax of the C programming language.
</description>
<parameters>
<param id="jvmti_env">
and additionally in jvmtiExtensions.cpp
-static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, jboolean* enabled, ...) {
+static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, ...) {
- csr of
-
JDK-8268255 Make IsClassUnloadingEnabled signature match specification
-
- Resolved
-
-
JDK-8271333 Make IsClassUnloadingEnabled signature match specification
-
- Resolved
-
-
JDK-8271338 Make IsClassUnloadingEnabled signature match specification
-
- Resolved
-