RFR (M) 8210700: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti/unit tests
Alex Menkov
alexey.menkov at oracle.com
Fri Sep 14 00:32:54 UTC 2018
Hi Jc,
Some notes:
<...>/MethodBind/JvmtiTest/JvmtiTest.cpp
and
<...>/StackTrace/JvmtiTest/JvmtiTest.cpp
have several places with extra space before comma like:
- ret = JVMTI_ENV_PTR(jvmti)->GetStackTrace(JVMTI_ENV_ARG(jvmti,
thr), 0, max_count , stack_buffer, &count);
+ ret = jvmti->GetStackTrace(thr, 0, max_count , stack_buffer, &count);
<...>/functions/rawmonitor/rawmonitor.cpp
and
<...>/timers/JvmtiTest/JvmtiTest.cpp
have several suspicious changes when JVMTI_ENV_PTR and JVMTI_ENV_ARG
have different arguments (that's certainly wrong, but needs to re
resolved correctly):
- res =
JVMTI_ENV_PTR(jvmti)->GetCurrentThread(JVMTI_ENV_ARG(jvmti_env,
&main_thread));
+ res = jvmti->GetCurrentThread(&main_thread);
JVMTI_ENV_PTR(jvmti) is an address of the function in the vtable, and
JVMTI_ENV_ARG(jvmti_env, ...) is a C++ "this" pointer.
So I'd expect that this should be
+ res = + jvmti_env->GetCurrentThread(&main_thread);
Looking at timers/JvmtiTest/JvmtiTest.cpp history looks like
JVMTI_ENV_PTR(jvmti)-><func>(JVMTI_ENV_ARG(jvmti_env, ... changes were
introduced recently by the fix for "8209611: use C++ compiler for
hotspot tests".
/functions/rawmonitor/rawmonitor.cpp had such wrong statements before,
so they should be revised carefully.
AFAIU if JVMTI dunction is called from some callback where jvmtiEnv is
passed, the passed value should be used.
--alex
On 09/13/2018 13:26, JC Beyler wrote:
> Hi all,
>
> We have arrived to the last webrev for removing the JNI_ENV macros from
> the vmTestbase:
>
> Webrev: http://cr.openjdk.java.net/~jcbeyler/8210700/webrev.00/
> <http://cr.openjdk.java.net/%7Ejcbeyler/8210700/webrev.00/>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8210700
>
> Thanks again for the reviews,
> Jc
More information about the serviceability-dev
mailing list