RFR(XXS): 8203346: JFR: Inconsistent signature of jfr_add_string_constant
Aleksey Shipilev
shade at redhat.com
Thu May 17 11:06:13 UTC 2018
On 05/17/2018 12:56 PM, Aleksey Shipilev wrote:
> On 05/17/2018 12:52 PM, Aleksey Shipilev wrote:
>> On 05/17/2018 12:40 PM, Markus Gronlund wrote:
>>> Please see this tiny fix for the following bug:
>>>
>>> https://bugs.openjdk.java.net/browse/JDK-8203346
>>> diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp
>>> --- a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp
>>> +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp
>>>
>>> @@ -117,7 +117,7 @@
>>> jlong JNICALL jfr_get_epoch_address(JNIEnv* env, jobject jvm);
>>>
>>> -jlong JNICALL jfr_add_string_constant(JNIEnv* env, jclass jvm, jlong gen, jlong id, jstring string);
>>> +jlong JNICALL jfr_add_string_constant(JNIEnv* env, jclass jvm, jboolean epoch, jlong id, jstring string);
>>>
>>> void JNICALL jfr_uncaught_exception(JNIEnv* env, jobject jvm, jobject thread, jthrowable throwable);
>>
>> Looks good, but see:
>>
>> $ ack jfr_add_string_constant src/hotspot/
>>
>> src/hotspot/share/jfr/jni/jfrJniMethod.cpp
>> 300:JVM_ENTRY_NO_ENV(jboolean, jfr_add_string_constant(JNIEnv* env, jclass jvm, jboolean epoch,
>> jlong id, jstring string))
>>
>> src/hotspot/share/jfr/jni/jfrJniMethod.hpp
>> 120:jlong JNICALL jfr_add_string_constant(JNIEnv* env, jclass jvm, jlong gen, jlong id, jstring string);
>>
>> src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp
>> 76: (char*)"addStringConstant", (char*)"(ZJLjava/lang/String;)Z", (void*)jfr_add_string_constant,
>>
>>
>> In jfrJniMethodRegistration.cpp, the signature should now be "(ZZLjava/lang/String;)Z"
>
> No, wait, I confused myself. Java method indeed is (boolean, long, String), so current signature is
> correct.
>
> public static native boolean addStringConstant(boolean epoch, long id, String s);
Ugh. I still wonder why the return type is "jlong" in native parts. Should be jboolean too?
-Aleksey
More information about the hotspot-dev
mailing list