Hi,
In jni.cpp the DEFINE_NEWSCALARARRAY macro uses DT_RETURN_MARK_DECL_FOR
instead of the normal DT_RETURN_MARK_DECL. The DT_RETURN_MARK_DECL_FOR
macro should only be used for mark probes that could return a primitive
jfloat or jdouble. But DEFINE_NEWSCALARARRAY creates the functions for
New<Type>Array which return primitiveTypeArrays. This means that for
NewFloatArray and NewDoubleArray you cannot get the return value in the
return mark probe.
According to hotspot_jni.d the intention is to return these values in
those cases:
probe NewDoubleArray__entry(void*, uintptr_t);
probe NewDoubleArray__return(void*);
probe NewFloatArray__entry(void*, uintptr_t);
probe NewFloatArray__return(void*);
The attached trivial patch fixes it and makes the actual return value in
those cases available.
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
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:09:20 2009 +0200
@@ -2150,14 +2150,14 @@
#define DEFINE_NEWSCALARARRAY(Return,Allocator,Result) \
\
- DT_RETURN_MARK_DECL_FOR(Result, New##Result##Array, Return);\
+ DT_RETURN_MARK_DECL(New##Result##Array, Return);\
\
JNI_ENTRY(Return, \
jni_New##Result##Array(JNIEnv *env, jsize len)) \
JNIWrapper("New" XSTR(Result) "Array"); \
DTRACE_PROBE2(hotspot_jni, New##Result##Array__entry, env, len);\
Return ret = NULL;\
- DT_RETURN_MARK_FOR(Result, New##Result##Array, Return, (const Return&)ret);\
+ DT_RETURN_MARK(New##Result##Array, Return, (const Return&)ret);\
\
oop obj= oopFactory::Allocator(len, CHECK_0); \
ret = (Return) JNIHandles::make_local(env, obj); \