8318363: Foreign benchmarks fail to build on some platforms
Reviewed-by: jvernee, mcimadamore
This commit is contained in:
parent
31ef400f31
commit
6fc3514231
@ -21,13 +21,14 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <jlong.h>
|
||||
#include <jni.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_openjdk_bench_java_lang_foreign_ToCStringTest_writeString(JNIEnv *const env, const jclass cls, const jstring text) {
|
||||
const char *str = (*env)->GetStringUTFChars(env, text, NULL);
|
||||
jlong addr = (jlong)(void*)str;
|
||||
jlong addr = ptr_to_jlong(str);
|
||||
(*env)->ReleaseStringUTFChars(env, text, str);
|
||||
return addr;
|
||||
}
|
||||
|
@ -23,10 +23,11 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <jlong.h>
|
||||
#include <jni.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_openjdk_bench_java_lang_foreign_ToJavaStringTest_readString(JNIEnv *const env, const jclass cls, jlong addr) {
|
||||
return (*env)->NewStringUTF(env, (char*)(void*)addr);
|
||||
return (*env)->NewStringUTF(env, jlong_to_ptr(addr));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user