Skip to content

Commit

Permalink
8288094: cleanup old _MSC_VER handling
Browse files Browse the repository at this point in the history
Reviewed-by: mdoerr, clanger, aturbanov
  • Loading branch information
MBaesken committed Jun 14, 2022
1 parent 1a65332 commit 0530f4e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 163 deletions.
40 changes: 1 addition & 39 deletions src/hotspot/os_cpu/windows_aarch64/unwind_windows_aarch64.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
* Copyright (c) 2020, 2022, Microsoft Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,15 +28,6 @@

typedef unsigned char UBYTE;

#if _MSC_VER < 1700

/* Not needed for VS2012 compiler, comes from winnt.h. */
#define UNW_FLAG_EHANDLER 0x01
#define UNW_FLAG_UHANDLER 0x02
#define UNW_FLAG_CHAININFO 0x04

#endif

// See https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling#xdata-records
typedef struct _UNWIND_INFO_EH_ONLY {
DWORD FunctionLength : 18;
Expand Down Expand Up @@ -70,33 +61,4 @@ typedef struct _RUNTIME_FUNCTION {
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
*/

#if _MSC_VER < 1700

/* Not needed for VS2012 compiler, comes from winnt.h. */
typedef struct _DISPATCHER_CONTEXT {
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
// PEXCEPTION_ROUTINE LanguageHandler;
char * LanguageHandler; // double dependency problem
PVOID HandlerData;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;

#endif

#if _MSC_VER < 1500

/* Not needed for VS2008 compiler, comes from winnt.h. */
typedef EXCEPTION_DISPOSITION (*PEXCEPTION_ROUTINE) (
IN PEXCEPTION_RECORD ExceptionRecord,
IN ULONG64 EstablisherFrame,
IN OUT PCONTEXT ContextRecord,
IN OUT PDISPATCHER_CONTEXT DispatcherContext
);

#endif

#endif // OS_CPU_WINDOWS_AARCH64_UNWIND_WINDOWS_AARCH64_HPP
41 changes: 1 addition & 40 deletions src/hotspot/os_cpu/windows_x86/unwind_windows_x86.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -29,15 +29,6 @@
#ifdef AMD64
typedef unsigned char UBYTE;

#if _MSC_VER < 1700

/* Not needed for VS2012 compiler, comes from winnt.h. */
#define UNW_FLAG_EHANDLER 0x01
#define UNW_FLAG_UHANDLER 0x02
#define UNW_FLAG_CHAININFO 0x04

#endif

// This structure is used to define an UNWIND_INFO that
// only has an ExceptionHandler. There are no UnwindCodes
// declared.
Expand All @@ -55,7 +46,6 @@ typedef struct _UNWIND_INFO_EH_ONLY {
OPTIONAL ULONG ExceptionData[1];
} UNWIND_INFO_EH_ONLY, *PUNWIND_INFO_EH_ONLY;


/*
typedef struct _RUNTIME_FUNCTION {
ULONG BeginAddress;
Expand All @@ -64,35 +54,6 @@ typedef struct _RUNTIME_FUNCTION {
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
*/

#if _MSC_VER < 1700

/* Not needed for VS2012 compiler, comes from winnt.h. */
typedef struct _DISPATCHER_CONTEXT {
ULONG64 ControlPc;
ULONG64 ImageBase;
PRUNTIME_FUNCTION FunctionEntry;
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
// PEXCEPTION_ROUTINE LanguageHandler;
char * LanguageHandler; // double dependency problem
PVOID HandlerData;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;

#endif

#if _MSC_VER < 1500

/* Not needed for VS2008 compiler, comes from winnt.h. */
typedef EXCEPTION_DISPOSITION (*PEXCEPTION_ROUTINE) (
IN PEXCEPTION_RECORD ExceptionRecord,
IN ULONG64 EstablisherFrame,
IN OUT PCONTEXT ContextRecord,
IN OUT PDISPATCHER_CONTEXT DispatcherContext
);

#endif

#endif // AMD64

#endif // OS_CPU_WINDOWS_X86_UNWIND_WINDOWS_X86_HPP
6 changes: 1 addition & 5 deletions src/hotspot/share/adlc/adlc.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -42,13 +42,9 @@
/* Make sure that we have the intptr_t and uintptr_t definitions */
#ifdef _WIN32

#if _MSC_VER >= 1300
using namespace std;
#endif

#if _MSC_VER >= 1400
#define strdup _strdup
#endif

#if _MSC_VER < 1900
#define snprintf _snprintf
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/adlc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,7 @@ int get_legal_text(FileBuff &fbuf, char **legal_text)
return (int) (legal_end - legal_start);
}

// VS2005 has its own definition, identical to this one.
#if !defined(_WIN32) || defined(_WIN64) || _MSC_VER < 1400
#if !defined(_WIN32) || defined(_WIN64)
void *operator new( size_t size, int, const char *, int ) throw() {
return ::operator new( size );
}
Expand Down
12 changes: 1 addition & 11 deletions src/hotspot/share/interpreter/bytecodes.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -29,16 +29,6 @@
#include "utilities/align.hpp"
#include "utilities/bytes.hpp"


#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER < 1600))
// Windows AMD64 Compiler Hangs compiling this file
// unless optimization is off
#ifdef _M_AMD64
#pragma optimize ("", off)
#endif
#endif


bool Bytecodes::_is_initialized = false;
const char* Bytecodes::_name [Bytecodes::number_of_codes];
BasicType Bytecodes::_result_type [Bytecodes::number_of_codes];
Expand Down
42 changes: 1 addition & 41 deletions src/java.base/share/native/launcher/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -34,46 +34,6 @@
#include "jli_util.h"
#include "jni.h"

#ifdef _MSC_VER
#if _MSC_VER > 1400 && _MSC_VER < 1600

/*
* When building for Microsoft Windows, main has a dependency on msvcr??.dll.
*
* When using Visual Studio 2005 or 2008, that must be recorded in
* the [java,javaw].exe.manifest file.
*
* As of VS2010 (ver=1600), the runtimes again no longer need manifests.
*
* Reference:
* C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
*/
#include <crtassem.h>
#ifdef _M_IX86

#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='x86' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")

#endif /* _M_IX86 */

//This may not be necessary yet for the Windows 64-bit build, but it
//will be when that build environment is updated. Need to test to see
//if it is harmless:
#ifdef _M_AMD64

#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='amd64' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")

#endif /* _M_AMD64 */
#endif /* _MSC_VER > 1400 && _MSC_VER < 1600 */
#endif /* _MSC_VER */

/*
* Entry point.
*/
Expand Down
12 changes: 3 additions & 9 deletions src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,12 +32,6 @@

#include <uxtheme.h>

#if defined(_MSC_VER) && _MSC_VER >= 1800
# define ROUND_TO_INT(num) ((int) round(num))
#else
# define ROUND_TO_INT(num) ((int) floor((num) + 0.5))
#endif

#define ALPHA_MASK 0xff000000
#define RED_MASK 0xff0000
#define GREEN_MASK 0xff00
Expand Down Expand Up @@ -732,11 +726,11 @@ void rescale(SIZE *size) {

if (dpiX !=0 && dpiX != 96) {
float invScaleX = 96.0f / dpiX;
size->cx = ROUND_TO_INT(size->cx * invScaleX);
size->cx = (int) round(size->cx * invScaleX);
}
if (dpiY != 0 && dpiY != 96) {
float invScaleY = 96.0f / dpiY;
size->cy = ROUND_TO_INT(size->cy * invScaleY);
size->cy = (int) round(size->cy * invScaleY);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,12 +37,6 @@

#include "math.h"

#if defined(_MSC_VER) && _MSC_VER >= 1800
# define ROUND_TO_INT(num) ((int) round(num))
#else
# define ROUND_TO_INT(num) ((int) floor((num) + 0.5))
#endif

// WDesktopProperties fields
jfieldID AwtDesktopProperties::pDataID = 0;
jmethodID AwtDesktopProperties::setBooleanPropertyID = 0;
Expand Down Expand Up @@ -103,7 +97,7 @@ void getInvScale(float &invScaleX, float &invScaleY) {
}

int rescale(int value, float invScale){
return invScale == 1.0f ? value : ROUND_TO_INT(value * invScale);
return invScale == 1.0f ? value : (int) round(value * invScale);
}

void AwtDesktopProperties::GetSystemProperties() {
Expand Down Expand Up @@ -286,7 +280,7 @@ void AwtDesktopProperties::GetNonClientParameters() {
// when running on XP. However this can't be referenced at compile time
// with the older SDK, so there use 'lfMessageFont' plus its size.
if (!IS_WINVISTA) {
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
#if defined(_MSC_VER)
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
#else
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT);
Expand Down
9 changes: 2 additions & 7 deletions src/java.desktop/windows/native/libawt/windows/awt_Window.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -51,11 +51,6 @@
typedef __int32 LONG_PTR;
#endif // __int3264

#if defined(_MSC_VER) && _MSC_VER >= 1800
# define ROUND_TO_INT(num) ((int) round(num))
#else
# define ROUND_TO_INT(num) ((int) floor((num) + 0.5))
#endif
// Used for Swing's Menu/Tooltip animation Support
const int UNSPECIFIED = 0;
const int TOOLTIP = 1;
Expand Down Expand Up @@ -3654,7 +3649,7 @@ int getSystemMetricValue(int msgType) {
}
if(dpi != 0 && dpi != 96) {
float invScaleX = 96.0f / dpi;
value = (int) ROUND_TO_INT(value * invScaleX);
value = (int) round(value * invScaleX);
}
return value;
}
Expand Down

1 comment on commit 0530f4e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.