JNI functions "CallNonvirtual*" probe is incorrect

Yasumasa Suenaga suenaga.yasumasa at oss.ntt.co.jp
Thu Apr 7 02:26:20 PDT 2011


Hi Mark,

Thank you for the reply.
I wish that my patch pass your test :-)


Thanks,

Yasumasa


(2011/04/07 18:02), Mark Wielaard wrote:
> Hi Yasumasa,
>
> On Thu, 2011-04-07 at 16:24 +0900, Yasumasa Suenaga wrote:
>> Hi,
>>
>> I've tried to test my program with SystemTap.
>> When I probed CallNonvirtualVoidMethod(), I seem to get incorrect value through "hotspot_jni.stp".
>> [...]
>> "clazz" does not exist in hotspot_jni.stp, and methodid points clazz.
>> In HotSpot source code (hotspot/src/share/vm/prims/jni.cpp) defines CallNonvirtual functions as folllowing:
>>
>> ------------
>> #define DEFINE_CALLNONVIRTUALMETHOD(ResultType, Result, Tag) \
>> \
>>    DT_RETURN_MARK_DECL_FOR(Result, CallNonvirtual##Result##Method, ResultType);\
>>    DT_RETURN_MARK_DECL_FOR(Result, CallNonvirtual##Result##MethodV, ResultType);\
>>    DT_RETURN_MARK_DECL_FOR(Result, CallNonvirtual##Result##MethodA, ResultType);\
>> \
>> JNI_ENTRY(ResultType, \
>>            jni_CallNonvirtual##Result##Method(JNIEnv *env, jobject obj, jclass cls, jmethodID methodID, ...)) \
>>    JNIWrapper("CallNonvitual" XSTR(Result) "Method"); \
>> \
>>    DTRACE_PROBE4(hotspot_jni, CallNonvirtual##Result##Method__entry, env, obj, cls, methodID);\
>> ------------
>>
>> $arg3 points cls, $arg4 points methodID.
>>
>> In order to fix this problem, I made a patch for "hotspot_jni.stp.in" .
>> The patch that attached this mail(hotspot_jni.patch) works well on RHEL6.
>
> Of course. CallNonVirtual methods take an extra jclass argument and
> somehow we missed this. Thanks so much for finding the issue and
> providing a patch. It looks good. I'll test it a bit and will commit it.
>
> Thanks,
>
> Mark
>



More information about the distro-pkg-dev mailing list