Skip to content

Commit b93970b

Browse files
committed
8308780: Fix the Java Integer types on Windows
Backport-of: c92b049db7853a061ce05cebdc1fd73205ed0c83
1 parent 9d3acf8 commit b93970b

File tree

10 files changed

+23
-28
lines changed

10 files changed

+23
-28
lines changed

src/hotspot/share/c1/c1_Canonicalizer.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,6 @@ class Canonicalizer: InstructionVisitor {
4040
void set_constant(jlong x) { set_canonical(new Constant(new LongConstant(x))); }
4141
void set_constant(jfloat x) { set_canonical(new Constant(new FloatConstant(x))); }
4242
void set_constant(jdouble x) { set_canonical(new Constant(new DoubleConstant(x))); }
43-
#ifdef _WINDOWS
44-
// jint is defined as long in jni_md.h, so convert from int to jint
45-
void set_constant(int x) { set_constant((jint)x); }
46-
#endif
4743
void move_const_to_right(Op2* x);
4844
void do_Op2(Op2* x);
4945
void do_UnsafeRawOp(UnsafeRawOp* x);

src/java.base/windows/native/include/jni_md.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,8 @@
3232
#define JNIIMPORT __declspec(dllimport)
3333
#define JNICALL __stdcall
3434

35-
// 'long' is always 32 bit on windows so this matches what jdk expects
36-
typedef long jint;
37-
typedef __int64 jlong;
35+
typedef int jint;
36+
typedef long long jlong;
3837
typedef signed char jbyte;
3938

4039
#endif /* !_JAVASOFT_JNI_MD_H_ */

src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@ extern "C" {
4949

5050
#define POLYTEMPSIZE (512 / sizeof(POINT))
5151

52-
static void AngleToCoord(jint angle, jint w, jint h, jint *x, jint *y)
52+
static void AngleToCoord(int angle, int w, int h, int *x, int *y)
5353
{
5454
const double pi = 3.1415926535;
5555
const double toRadians = 2 * pi / 360;
@@ -322,7 +322,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawArc
322322
return;
323323
}
324324

325-
long sx, sy, ex, ey;
325+
int sx, sy, ex, ey;
326326
if (angleExtent >= 360 || angleExtent <= -360) {
327327
sx = ex = x + w;
328328
sy = ey = y + h/2;
@@ -602,7 +602,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillArc
602602
if (wsdo == NULL) {
603603
return;
604604
}
605-
long sx, sy, ex, ey;
605+
int sx, sy, ex, ey;
606606
int angleEnd;
607607
if (angleExtent < 0) {
608608
angleEnd = angleStart;

src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -897,7 +897,7 @@ static void GDIWinSD_GetRasInfo(JNIEnv *env,
897897
}
898898
if (wsdo->lockFlags & SD_LOCK_LUT) {
899899
pRasInfo->lutBase =
900-
(long *) wsdo->device->GetSystemPaletteEntries();
900+
(jint *) wsdo->device->GetSystemPaletteEntries();
901901
pRasInfo->lutSize = 256;
902902
} else {
903903
pRasInfo->lutBase = NULL;

src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,12 @@ JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits
10801080
// Extract the color bitmap
10811081
int nBits = iconSize * iconSize;
10821082

1083-
long *colorBits = NULL;
1084-
long *maskBits = NULL;
1083+
jint *colorBits = NULL;
1084+
int *maskBits = NULL;
10851085

10861086
try {
10871087
entry_point();
1088-
colorBits = (long*)safe_Malloc(MAX_ICON_SIZE * MAX_ICON_SIZE * sizeof(long));
1088+
colorBits = (jint*)safe_Malloc(MAX_ICON_SIZE * MAX_ICON_SIZE * sizeof(jint));
10891089
GetDIBits(dc, iconInfo.hbmColor, 0, iconSize, colorBits, &bmi, DIB_RGB_COLORS);
10901090
// XP supports alpha in some icons, and depending on device.
10911091
// This should take precedence over the icon mask bits.
@@ -1100,7 +1100,7 @@ JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits
11001100
}
11011101
if (!hasAlpha) {
11021102
// Extract the mask bitmap
1103-
maskBits = (long*)safe_Malloc(MAX_ICON_SIZE * MAX_ICON_SIZE * sizeof(long));
1103+
maskBits = (int*)safe_Malloc(MAX_ICON_SIZE * MAX_ICON_SIZE * sizeof(int));
11041104
GetDIBits(dc, iconInfo.hbmMask, 0, iconSize, maskBits, &bmi, DIB_RGB_COLORS);
11051105
// Copy the mask alphas into the color bits
11061106
for (int i = 0; i < nBits; i++) {

src/java.desktop/windows/native/libawt/windows/awt_Menu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@ class AwtMenu : public AwtMenuItem {
7373

7474
/*for multifont menu */
7575
BOOL IsTopMenu();
76-
virtual AwtMenuItem* GetItem(jobject target, long index);
76+
virtual AwtMenuItem* GetItem(jobject target, jint index);
7777

7878
virtual int CountItem(jobject target);
7979

src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,7 @@ int AwtMenuBar::CountItem(jobject menuBar)
145145
return nCount;
146146
}
147147

148-
AwtMenuItem* AwtMenuBar::GetItem(jobject target, long index)
148+
AwtMenuItem* AwtMenuBar::GetItem(jobject target, jint index)
149149
{
150150
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
151151
if (env->EnsureLocalCapacity(2) < 0) {

src/java.desktop/windows/native/libawt/windows/awt_MenuBar.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@ class AwtMenuBar : public AwtMenu {
6666
virtual HWND GetOwnerHWnd();
6767
virtual void RedrawMenuBar();
6868

69-
AwtMenuItem* GetItem(jobject target, long index);
69+
AwtMenuItem* GetItem(jobject target, jint index);
7070
int CountItem(jobject menuBar);
7171

7272
void DrawItem(DRAWITEMSTRUCT& drawInfo);

src/jdk.accessibility/windows/native/jaccesswalker/jaccesswalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ void Jaccesswalker::addComponentNodes(long vmID, AccessibleContext context,
543543
} else {
544544
char s[LINE_BUFSIZE];
545545
snprintf( s, sizeof(s),
546-
"ERROR calling GetAccessibleContextInfo; vmID = %X, context = %p",
546+
"ERROR calling GetAccessibleContextInfo; vmID = %lX, context = %p",
547547
vmID, (void*)context );
548548

549549
TVITEM tvi;

src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ char *getAccessibleInfo(long vmID, AccessibleContext ac, int x, int y,
149149
wchar_t tmpBuf[LINE_BUFSIZE];
150150
wchar_t name[LINE_BUFSIZE];
151151
int i, j;
152-
long start;
153-
long end;
152+
jint start;
153+
jint end;
154154

155155
if (buffer == NULL || bufsize <= 0) {
156156
return NULL;

0 commit comments

Comments
 (0)