Skip to content

Commit

Permalink
8253899: Make IsClassUnloadingEnabled signature match specification
Browse files Browse the repository at this point in the history
Reviewed-by: mdoerr
Backport-of: c7f0064
  • Loading branch information
Vladimir Kempik committed Jul 26, 2021
1 parent 293d44f commit d7a6e51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/hotspot/share/prims/jvmti.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9909,9 +9909,11 @@ myInit() {
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">
Expand Down
9 changes: 8 additions & 1 deletion src/hotspot/share/prims/jvmtiExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ GrowableArray<jvmtiExtensionEventInfo*>* JvmtiExtensions::_ext_events;


// extension function
static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, jboolean* enabled, ...) {
static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, ...) {
jboolean* enabled = NULL;
va_list ap;

va_start(ap, env);
enabled = va_arg(ap, jboolean *);
va_end(ap);

if (enabled == NULL) {
return JVMTI_ERROR_NULL_POINTER;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ static jrawMonitorID eventMon;
/* ============================================================================= */

static void JNICALL
ClassUnload(jvmtiEnv* jvmti_env, JNIEnv* jni_env, const char* name, ...) {
ClassUnload(jvmtiEnv* jvmti_env, ...) {
JNIEnv *jni_env = NULL;
va_list ap;

va_start(ap, jvmti_env);
jni_env = va_arg(ap, JNIEnv *);
const char * name = va_arg(ap, const char *);
va_end(ap);

// The name argument should never be null
if (name == NULL) {
nsk_jvmti_setFailStatus();
Expand Down

1 comment on commit d7a6e51

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.