Skip to content

Commit 6737135

Browse files
author
Alex Menkov
committed
8262083: vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/TestDescription.java failed with "No notification: event JVMTI_EVENT_FRAME_POP (61)"
Reviewed-by: lmesnik, cjplummer
1 parent 57fc8e9 commit 6737135

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ public class setnotif001 {
4040
}
4141
}
4242

43-
native static void enableEv();
43+
native static void enableEv(Thread notifyFramePopThread);
4444
native static int getRes();
4545

4646
static int fld = 1;
@@ -55,7 +55,7 @@ public static void main(String[] args) {
5555
public static int run(String argv[], PrintStream ref) {
5656
setnotif001 t = new setnotif001();
5757
fld++;
58-
enableEv();
58+
enableEv(Thread.currentThread());
5959
t.meth();
6060
Thread thr = new Thread(new setnotif001a());
6161
thr.start();

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ static jvmtiEnv *jvmti = NULL;
3838
static jvmtiCapabilities caps;
3939
static jvmtiEventCallbacks callbacks;
4040
static jrawMonitorID access_lock;
41+
static jobject notifyFramePopThread = NULL;
4142
static jint result = PASSED;
4243
static jboolean printdump = JNI_FALSE;
4344
static int flag = 0;
@@ -188,25 +189,27 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *env,
188189

189190
if (flag) {
190191
mark(jvmti_env, JVMTI_EVENT_METHOD_ENTRY);
191-
err = jvmti_env->IsMethodNative(method, &isNative);
192-
if (err != JVMTI_ERROR_NONE) {
193-
result = STATUS_FAILED;
194-
printf("(IsMethodNative) unexpected error: %s (%d)\n",
195-
TranslateError(err), err);
196-
}
197-
if (isNative == JNI_FALSE) {
198-
err = jvmti_env->NotifyFramePop(thr, 0);
199-
if (err == JVMTI_ERROR_NONE) {
200-
enable(jvmti_env, JVMTI_EVENT_FRAME_POP);
201-
} else {
192+
if (env->IsSameObject(notifyFramePopThread, thr)) {
193+
err = jvmti_env->IsMethodNative(method, &isNative);
194+
if (err != JVMTI_ERROR_NONE) {
202195
result = STATUS_FAILED;
203-
printf("(NotifyFramePop) unexpected error: %s (%d)\n",
196+
printf("(IsMethodNative) unexpected error: %s (%d)\n",
204197
TranslateError(err), err);
205198
}
199+
if (isNative == JNI_FALSE) {
200+
err = jvmti_env->NotifyFramePop(thr, 0);
201+
if (err == JVMTI_ERROR_NONE) {
202+
enable(jvmti_env, JVMTI_EVENT_FRAME_POP);
203+
} else {
204+
result = STATUS_FAILED;
205+
printf("(NotifyFramePop) unexpected error: %s (%d)\n",
206+
TranslateError(err), err);
207+
}
208+
}
209+
enable(jvmti_env, JVMTI_EVENT_CLASS_LOAD);
210+
enable(jvmti_env, JVMTI_EVENT_CLASS_PREPARE);
211+
disable(jvmti_env, JVMTI_EVENT_METHOD_ENTRY);
206212
}
207-
enable(jvmti_env, JVMTI_EVENT_CLASS_LOAD);
208-
enable(jvmti_env, JVMTI_EVENT_CLASS_PREPARE);
209-
disable(jvmti_env, JVMTI_EVENT_METHOD_ENTRY);
210213
}
211214
}
212215

@@ -392,8 +395,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
392395

393396
JNIEXPORT void JNICALL
394397
Java_nsk_jvmti_SetEventNotificationMode_setnotif001_enableEv(JNIEnv *env,
395-
jclass cls) {
398+
jclass cls, jobject framePopThread) {
396399
setWatches(jvmti, env, cls);
400+
notifyFramePopThread = env->NewGlobalRef(framePopThread);
397401
enable(jvmti, JVMTI_EVENT_METHOD_ENTRY);
398402
enable(jvmti, JVMTI_EVENT_METHOD_EXIT);
399403
enable(jvmti, JVMTI_EVENT_THREAD_START);

0 commit comments

Comments
 (0)