Skip to content

Commit c7f0064

Browse files
author
Vladimir Kempik
committed
8253899: Make IsClassUnloadingEnabled signature match specification
Reviewed-by: sspitsyn, dholmes
1 parent aad3cf4 commit c7f0064

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/hotspot/share/prims/jvmti.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9949,9 +9949,11 @@ myInit() {
99499949
there is a <code>jint</code> parameter, the event handler should be
99509950
declared:
99519951
<example>
9952-
void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...)
9952+
void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
99539953
</example>
99549954
Note the terminal "<code>...</code>" which indicates varargs.
9955+
The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
9956+
the <code>va_*</code> syntax of the C programming language.
99559957
</description>
99569958
<parameters>
99579959
<param id="jvmti_env">

src/hotspot/share/prims/jvmtiExtensions.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ GrowableArray<jvmtiExtensionEventInfo*>* JvmtiExtensions::_ext_events;
3434

3535

3636
// extension function
37-
static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, jboolean* enabled, ...) {
37+
static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, ...) {
38+
jboolean* enabled = NULL;
39+
va_list ap;
40+
41+
va_start(ap, env);
42+
enabled = va_arg(ap, jboolean *);
43+
va_end(ap);
44+
3845
if (enabled == NULL) {
3946
return JVMTI_ERROR_NULL_POINTER;
4047
}

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ static jrawMonitorID eventMon;
4141
/* ============================================================================= */
4242

4343
static void JNICALL
44-
ClassUnload(jvmtiEnv* jvmti_env, JNIEnv* jni_env, const char* name, ...) {
44+
ClassUnload(jvmtiEnv* jvmti_env, ...) {
45+
JNIEnv *jni_env = NULL;
46+
va_list ap;
47+
48+
va_start(ap, jvmti_env);
49+
jni_env = va_arg(ap, JNIEnv *);
50+
const char * name = va_arg(ap, const char *);
51+
va_end(ap);
52+
4553
// The name argument should never be null
4654
if (name == NULL) {
4755
nsk_jvmti_setFailStatus();

0 commit comments

Comments
 (0)