8308780: Fix the Java Integer types on Windows

Reviewed-by: dholmes, djelinski, aivanov
This commit is contained in:
Julian Waters 2023-06-25 23:41:54 +00:00
parent 0db63ec76d
commit c92b049db7
10 changed files with 23 additions and 28 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,10 +40,6 @@ class Canonicalizer: InstructionVisitor {
void set_constant(jlong x) { set_canonical(new Constant(new LongConstant(x))); } void set_constant(jlong x) { set_canonical(new Constant(new LongConstant(x))); }
void set_constant(jfloat x) { set_canonical(new Constant(new FloatConstant(x))); } void set_constant(jfloat x) { set_canonical(new Constant(new FloatConstant(x))); }
void set_constant(jdouble x) { set_canonical(new Constant(new DoubleConstant(x))); } void set_constant(jdouble x) { set_canonical(new Constant(new DoubleConstant(x))); }
#ifdef _WINDOWS
// jint is defined as long in jni_md.h, so convert from int to jint
void set_constant(int x) { set_constant((jint)x); }
#endif
void move_const_to_right(Op2* x); void move_const_to_right(Op2* x);
void do_Op2(Op2* x); void do_Op2(Op2* x);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,9 +32,8 @@
#define JNIIMPORT __declspec(dllimport) #define JNIIMPORT __declspec(dllimport)
#define JNICALL __stdcall #define JNICALL __stdcall
// 'long' is always 32 bit on windows so this matches what jdk expects typedef int jint;
typedef long jint; typedef long long jlong;
typedef __int64 jlong;
typedef signed char jbyte; typedef signed char jbyte;
#endif /* !_JAVASOFT_JNI_MD_H_ */ #endif /* !_JAVASOFT_JNI_MD_H_ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ extern "C" {
#define POLYTEMPSIZE (512 / sizeof(POINT)) #define POLYTEMPSIZE (512 / sizeof(POINT))
static void AngleToCoord(jint angle, jint w, jint h, jint *x, jint *y) static void AngleToCoord(int angle, int w, int h, int *x, int *y)
{ {
const double pi = 3.1415926535; const double pi = 3.1415926535;
const double toRadians = 2 * pi / 360; const double toRadians = 2 * pi / 360;
@ -322,7 +322,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawArc
return; return;
} }
long sx, sy, ex, ey; int sx, sy, ex, ey;
if (angleExtent >= 360 || angleExtent <= -360) { if (angleExtent >= 360 || angleExtent <= -360) {
sx = ex = x + w; sx = ex = x + w;
sy = ey = y + h/2; sy = ey = y + h/2;
@ -602,7 +602,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillArc
if (wsdo == NULL) { if (wsdo == NULL) {
return; return;
} }
long sx, sy, ex, ey; int sx, sy, ex, ey;
int angleEnd; int angleEnd;
if (angleExtent < 0) { if (angleExtent < 0) {
angleEnd = angleStart; angleEnd = angleStart;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -897,7 +897,7 @@ static void GDIWinSD_GetRasInfo(JNIEnv *env,
} }
if (wsdo->lockFlags & SD_LOCK_LUT) { if (wsdo->lockFlags & SD_LOCK_LUT) {
pRasInfo->lutBase = pRasInfo->lutBase =
(long *) wsdo->device->GetSystemPaletteEntries(); (jint *) wsdo->device->GetSystemPaletteEntries();
pRasInfo->lutSize = 256; pRasInfo->lutSize = 256;
} else { } else {
pRasInfo->lutBase = NULL; pRasInfo->lutBase = NULL;

View File

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

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ public:
/*for multifont menu */ /*for multifont menu */
BOOL IsTopMenu(); BOOL IsTopMenu();
virtual AwtMenuItem* GetItem(jobject target, long index); virtual AwtMenuItem* GetItem(jobject target, jint index);
virtual int CountItem(jobject target); virtual int CountItem(jobject target);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,7 +145,7 @@ int AwtMenuBar::CountItem(jobject menuBar)
return nCount; return nCount;
} }
AwtMenuItem* AwtMenuBar::GetItem(jobject target, long index) AwtMenuItem* AwtMenuBar::GetItem(jobject target, jint index)
{ {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
if (env->EnsureLocalCapacity(2) < 0) { if (env->EnsureLocalCapacity(2) < 0) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -66,7 +66,7 @@ public:
virtual HWND GetOwnerHWnd(); virtual HWND GetOwnerHWnd();
virtual void RedrawMenuBar(); virtual void RedrawMenuBar();
AwtMenuItem* GetItem(jobject target, long index); AwtMenuItem* GetItem(jobject target, jint index);
int CountItem(jobject menuBar); int CountItem(jobject menuBar);
void DrawItem(DRAWITEMSTRUCT& drawInfo); void DrawItem(DRAWITEMSTRUCT& drawInfo);

View File

@ -543,7 +543,7 @@ void Jaccesswalker::addComponentNodes(long vmID, AccessibleContext context,
} else { } else {
char s[LINE_BUFSIZE]; char s[LINE_BUFSIZE];
snprintf( s, sizeof(s), snprintf( s, sizeof(s),
"ERROR calling GetAccessibleContextInfo; vmID = %X, context = %p", "ERROR calling GetAccessibleContextInfo; vmID = %lX, context = %p",
vmID, (void*)context ); vmID, (void*)context );
TVITEM tvi; TVITEM tvi;

View File

@ -149,8 +149,8 @@ char *getAccessibleInfo(long vmID, AccessibleContext ac, int x, int y,
wchar_t tmpBuf[LINE_BUFSIZE]; wchar_t tmpBuf[LINE_BUFSIZE];
wchar_t name[LINE_BUFSIZE]; wchar_t name[LINE_BUFSIZE];
int i, j; int i, j;
long start; jint start;
long end; jint end;
if (buffer == NULL || bufsize <= 0) { if (buffer == NULL || bufsize <= 0) {
return NULL; return NULL;