Skip to content

Commit 6fc3514

Browse files
committed
8318363: Foreign benchmarks fail to build on some platforms
Reviewed-by: jvernee, mcimadamore
1 parent 31ef400 commit 6fc3514

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/micro/org/openjdk/bench/java/lang/foreign/libToCString.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
* questions.
2222
*/
2323

24+
#include <jlong.h>
2425
#include <jni.h>
2526
#include <stdlib.h>
2627
#include <string.h>
2728

2829
JNIEXPORT jlong JNICALL Java_org_openjdk_bench_java_lang_foreign_ToCStringTest_writeString(JNIEnv *const env, const jclass cls, const jstring text) {
2930
const char *str = (*env)->GetStringUTFChars(env, text, NULL);
30-
jlong addr = (jlong)(void*)str;
31+
jlong addr = ptr_to_jlong(str);
3132
(*env)->ReleaseStringUTFChars(env, text, str);
3233
return addr;
3334
}

test/micro/org/openjdk/bench/java/lang/foreign/libToJavaString.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
* questions.
2424
*/
2525

26+
#include <jlong.h>
2627
#include <jni.h>
2728
#include <stdlib.h>
2829
#include <string.h>
2930

3031
JNIEXPORT jstring JNICALL Java_org_openjdk_bench_java_lang_foreign_ToJavaStringTest_readString(JNIEnv *const env, const jclass cls, jlong addr) {
31-
return (*env)->NewStringUTF(env, (char*)(void*)addr);
32+
return (*env)->NewStringUTF(env, jlong_to_ptr(addr));
3233
}

0 commit comments

Comments
 (0)