JNI GetObjectArrayElement mark probe ret value shadowed
Keith McGuigan
Keith.McGuigan at Sun.COM
Tue Oct 20 07:20:36 PDT 2009
Hi Mark,
I'll help you out with these fixes. Let's move the rest of this to
hotspot-runtime-dev at openjdk.java.net so we don't spam too many people.
--
- Keith
Mark Wielaard wrote:
> Hi,
>
> In jni.cpp the DT_RETURN_MARK for GetObjectArrayElement tries to capture
> the jobject ret value. But the actual ret value returned is a newly
> defined jobject ret in the local scope of the if (is_within_bounds)
> branch. This means when probing the return of GetObjectArrayElement the
> return value always comes as as NULL.
>
> The following trivial patch fixes the issue and makes the actual return
> value available to the return probe.
>
> diff -r 6ddec5389232 src/share/vm/prims/jni.cpp
> --- a/src/share/vm/prims/jni.cpp Fri Oct 02 11:26:25 2009 -0700
> +++ b/src/share/vm/prims/jni.cpp Mon Oct 19 21:10:11 2009 +0200
> @@ -2116,7 +2116,7 @@
> DT_RETURN_MARK(GetObjectArrayElement, jobject, (const jobject&)ret);
> objArrayOop a = objArrayOop(JNIHandles::resolve_non_null(array));
> if (a->is_within_bounds(index)) {
> - jobject ret = JNIHandles::make_local(env, a->obj_at(index));
> + ret = JNIHandles::make_local(env, a->obj_at(index));
> return ret;
> } else {
> char buf[jintAsStringSize];
>
> Tested against Systemtap, but the same should work for DTrace also.
> I don't have access to a system with solaris/dtrace on it, so it would
> be nice of someone who does could double check the above on such a
> system.
>
> Please let me know if I should create a bug also on
> https://bugs.openjdk.java.net/ and/or if I should report/post this patch
> on some other mailing-list.
>
> Thanks,
>
> Mark
>
More information about the serviceability-dev
mailing list