Skip to content

Commit 804bd72

Browse files
committed
8255128: linux x86 build failure with libJNIPoint.c
Reviewed-by: coleenp, shade, ihse
1 parent 160759c commit 804bd72

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

make/autoconf/flags-cflags.m4

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -663,16 +663,10 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
663663
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
664664
-D$FLAGS_CPU_LEGACY"
665665
666-
if test "x$FLAGS_CPU_BITS" = x64; then
667-
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
668-
# unpack200.exe.
669-
if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then
670-
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
671-
fi
672-
if test "x$FLAGS_OS" != xaix; then
673-
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
674-
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
675-
fi
666+
if test "x$FLAGS_CPU_BITS" = x64 && test "x$FLAGS_OS" != xaix; then
667+
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
668+
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
669+
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
676670
fi
677671
678672
# toolchain dependend, per-cpu

test/micro/org/openjdk/bench/jdk/incubator/foreign/points/support/libJNIPoint.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,41 @@
2222
*/
2323
#include <jni.h>
2424
#include <stdlib.h>
25+
#include "jlong.h"
2526

2627
#include "points.h"
2728

2829
JNIEXPORT jlong JNICALL Java_org_openjdk_bench_jdk_incubator_foreign_points_support_JNIPoint_allocate
2930
(JNIEnv *env, jclass nativePointClass) {
3031
Point* p = malloc(sizeof *p);
31-
return (jlong) p;
32+
return ptr_to_jlong(p);
3233
}
3334

3435
JNIEXPORT void JNICALL Java_org_openjdk_bench_jdk_incubator_foreign_points_support_JNIPoint_free
3536
(JNIEnv *env, jclass cls, jlong thisPoint) {
36-
free((Point*) thisPoint);
37+
free(jlong_to_ptr(thisPoint));
3738
}
3839

3940
JNIEXPORT jint JNICALL Java_org_openjdk_bench_jdk_incubator_foreign_points_support_JNIPoint_getX
4041
(JNIEnv *env, jclass cls, jlong thisPoint) {
41-
Point* point = (Point*) thisPoint;
42+
Point* point = jlong_to_ptr(thisPoint);
4243
return point->x;
4344
}
4445

4546
JNIEXPORT void JNICALL Java_org_openjdk_bench_jdk_incubator_foreign_points_support_JNIPoint_setX
4647
(JNIEnv *env, jclass cls, jlong thisPoint, jint value) {
47-
Point* point = (Point*) thisPoint;
48+
Point* point = jlong_to_ptr(thisPoint);
4849
point->x = value;
4950
}
5051

5152
JNIEXPORT jint JNICALL Java_org_openjdk_bench_jdk_incubator_foreign_points_support_JNIPoint_getY
5253
(JNIEnv *env, jclass cls, jlong thisPoint) {
53-
Point* point = (Point*) thisPoint;
54+
Point* point = jlong_to_ptr(thisPoint);
5455
return point->y;
5556
}
5657

5758
JNIEXPORT void JNICALL Java_org_openjdk_bench_jdk_incubator_foreign_points_support_JNIPoint_setY
5859
(JNIEnv *env, jclass cls, jlong thisPoint, jint value) {
59-
Point* point = (Point*) thisPoint;
60+
Point* point = jlong_to_ptr(thisPoint);
6061
point->y = value;
6162
}

0 commit comments

Comments
 (0)