Skip to content

Commit d7a6e51

Browse files
author
Vladimir Kempik
committedJul 26, 2021
8253899: Make IsClassUnloadingEnabled signature match specification
Reviewed-by: mdoerr Backport-of: c7f0064
1 parent 293d44f commit d7a6e51

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed
 

‎src/hotspot/share/prims/jvmti.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -9909,9 +9909,11 @@ myInit() {
99099909
there is a <code>jint</code> parameter, the event handler should be
99109910
declared:
99119911
<example>
9912-
void JNICALL myHandler(jvmtiEnv* jvmti_env, jint myInt, ...)
9912+
void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
99139913
</example>
99149914
Note the terminal "<code>...</code>" which indicates varargs.
9915+
The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
9916+
the <code>va_*</code> syntax of the C programming language.
99159917
</description>
99169918
<parameters>
99179919
<param id="jvmti_env">

‎src/hotspot/share/prims/jvmtiExtensions.cpp

+8-1
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.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ static jrawMonitorID eventMon;
4343
/* ============================================================================= */
4444

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

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jul 26, 2021

@openjdk-notifier[bot]
Please sign in to comment.