From 79345bbbae2564f9f523859d1227a1784293b20f Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 13 Nov 2024 09:41:57 +0000 Subject: [PATCH] 8339783: Implement JEP 479: Remove the Windows 32-bit x86 Port Reviewed-by: kbarrett, kvn, stuefe, shade, erikj --- make/autoconf/basic.m4 | 3 + make/autoconf/platform.m4 | 18 +- make/autoconf/toolchain_microsoft.m4 | 32 +- make/hotspot/gensrc/GensrcAdlc.gmk | 4 +- .../modules/java.desktop/lib/AwtLibraries.gmk | 6 +- make/modules/jdk.accessibility/Launcher.gmk | 85 ++--- make/modules/jdk.accessibility/Lib.gmk | 112 ++---- make/scripts/compare.sh | 33 +- .../cpu/x86/jniFastGetField_x86_32.cpp | 50 --- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 9 +- src/hotspot/cpu/x86/vm_version_x86.cpp | 8 - src/hotspot/os/posix/include/jvm_md.h | 9 +- src/hotspot/os/posix/os_posix.cpp | 8 - src/hotspot/os/windows/include/jvm_md.h | 9 +- src/hotspot/os/windows/os_windows.cpp | 353 +----------------- src/hotspot/os/windows/os_windows.hpp | 17 +- src/hotspot/os/windows/sharedRuntimeRem.cpp | 5 +- .../windows_x86/assembler_windows_x86.cpp | 36 +- .../os_cpu/windows_x86/atomic_windows_x86.hpp | 77 +--- .../os_cpu/windows_x86/copy_windows_x86.hpp | 34 +- .../windows_x86/orderAccess_windows_x86.hpp | 8 +- .../os_cpu/windows_x86/os_windows_x86.cpp | 109 +----- .../windows_x86/os_windows_x86.inline.hpp | 4 +- .../os_cpu/windows_x86/unwind_windows_x86.hpp | 6 +- src/hotspot/share/adlc/adlc.hpp | 6 +- src/hotspot/share/adlc/main.cpp | 2 - src/hotspot/share/classfile/javaClasses.cpp | 6 - .../share/compiler/compilerDefinitions.cpp | 6 - src/hotspot/share/include/jvm.h | 7 + src/hotspot/share/jvmci/jvmciCompilerToVM.cpp | 4 - src/hotspot/share/prims/jniFastGetField.hpp | 13 +- src/hotspot/share/prims/jvm.cpp | 2 +- src/hotspot/share/prims/jvmtiAgent.cpp | 3 +- src/hotspot/share/prims/nativeLookup.cpp | 25 +- src/hotspot/share/prims/nativeLookup.hpp | 6 +- src/hotspot/share/runtime/os.hpp | 4 - .../share/runtime/sharedRuntimeTrans.cpp | 4 +- .../utilities/globalDefinitions_visCPP.hpp | 22 +- src/java.base/share/native/include/jni.h | 2 + .../share/native/libjava/NativeLibraries.c | 9 +- src/java.base/share/native/libjava/jni_util.h | 3 - src/java.base/unix/native/include/jni_md.h | 4 +- .../unix/native/libjava/jni_util_md.c | 11 +- src/java.base/windows/native/include/jni_md.h | 3 +- .../windows/native/libjava/gdefs_md.h | 7 +- .../windows/native/libjava/java_props_md.c | 2 - .../windows/native/libjava/jlong_md.h | 9 +- .../windows/native/libjava/jni_util_md.c | 30 +- src/java.base/windows/native/libjli/java_md.c | 2 +- .../native/libnio/ch/WindowsSelectorImpl.c | 13 +- .../windows/native/libnio/ch/nio_util.h | 14 +- .../libawt/java2d/pipe/ShapeSpanIterator.c | 14 +- .../native/libawt/windows/ThemeReader.cpp | 36 +- .../windows/native/libawt/windows/alloc.h | 4 +- .../windows/native/libawt/windows/awt.h | 38 -- .../native/libawt/windows/awt_Debug.cpp | 6 +- .../native/libawt/windows/awt_DnDDS.cpp | 79 ++-- .../windows/native/libawt/windows/awt_DnDDS.h | 76 ++-- .../native/libawt/windows/awt_DnDDT.cpp | 24 +- .../windows/native/libawt/windows/awt_DnDDT.h | 18 +- .../native/libawt/windows/awt_Toolkit.cpp | 4 +- .../native/libawt/windows/awt_Toolkit.h | 4 +- .../windows/native/libawt/windows/awt_new.cpp | 6 +- .../PLATFORM_API_WinOS_Charset_Util.h | 6 +- .../PLATFORM_API_WinOS_DirectSound.cpp | 6 +- .../libjsound/PLATFORM_API_WinOS_MidiIn.cpp | 6 +- .../libjabsysinfo/AccessBridgeSysInfo.cpp | 56 --- .../AccessBridgeATInstance.cpp | 6 +- .../native/libattach/VirtualMachineImpl.c | 30 +- .../debugger/windbg/WindbgCDebugger.java | 13 +- .../debugger/windbg/WindbgDebuggerLocal.java | 8 +- .../debugger/windbg/x86/WindbgX86Thread.java | 92 ----- .../windbg/x86/WindbgX86ThreadContext.java | 46 --- .../windbg/x86/WindbgX86ThreadFactory.java | 44 --- .../windows/x86/WindowsX86CFrame.java | 88 ----- .../sun/jvm/hotspot/runtime/Threads.java | 5 +- .../win32_x86/Win32X86JavaThreadPDAccess.java | 138 ------- .../windows/native/libsaproc/sawindbg.cpp | 39 +- .../share/native/libjdwp/transport.c | 7 - .../share/native/applauncher/JvmLauncher.cpp | 10 +- .../native/applauncher/WinLauncher.cpp | 4 +- .../windows/native/common/MsiCA.h | 12 +- .../windows/native/msiwrapper/MsiWrapper.cpp | 4 +- .../runtime/jni/nativeStack/libnativeStack.c | 4 +- .../nsk/share/native/native_thread.cpp | 2 +- 85 files changed, 349 insertions(+), 1840 deletions(-) delete mode 100644 src/jdk.accessibility/windows/native/libjabsysinfo/AccessBridgeSysInfo.cpp delete mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java delete mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadContext.java delete mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadFactory.java delete mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java delete mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java diff --git a/make/autoconf/basic.m4 b/make/autoconf/basic.m4 index 585575240ea..f574174a12e 100644 --- a/make/autoconf/basic.m4 +++ b/make/autoconf/basic.m4 @@ -76,6 +76,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], fi if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then + AC_MSG_ERROR([32-bit Windows builds are not supported]) + fi BASIC_SETUP_PATHS_WINDOWS fi diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4 index 9ca808c4c17..3f977058a51 100644 --- a/make/autoconf/platform.m4 +++ b/make/autoconf/platform.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, 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 @@ -666,14 +666,14 @@ AC_DEFUN([PLATFORM_CHECK_DEPRECATION], [ AC_ARG_ENABLE(deprecated-ports, [AS_HELP_STRING([--enable-deprecated-ports@<:@=yes/no@:>@], [Suppress the error when configuring for a deprecated port @<:@no@:>@])]) - if test "x$OPENJDK_TARGET_OS" = xwindows && test "x$OPENJDK_TARGET_CPU" = xx86; then - if test "x$enable_deprecated_ports" = "xyes"; then - AC_MSG_WARN([The Windows 32-bit x86 port is deprecated and may be removed in a future release.]) - else - AC_MSG_ERROR(m4_normalize([The Windows 32-bit x86 port is deprecated and may be removed in a future release. - Use --enable-deprecated-ports=yes to suppress this error.])) - fi - fi + # if test "x$OPENJDK_TARGET_CPU" = xx86; then + # if test "x$enable_deprecated_ports" = "xyes"; then + # AC_MSG_WARN([The x86 port is deprecated and may be removed in a future release.]) + # else + # AC_MSG_ERROR(m4_normalize([The 32-bit x86 port is deprecated and may be removed in a future release. + # Use --enable-deprecated-ports=yes to suppress this error.])) + # fi + # fi ]) AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], diff --git a/make/autoconf/toolchain_microsoft.m4 b/make/autoconf/toolchain_microsoft.m4 index 387e3717718..4f970df7b5f 100644 --- a/make/autoconf/toolchain_microsoft.m4 +++ b/make/autoconf/toolchain_microsoft.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, 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 @@ -82,9 +82,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], fi AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) - if test "x$TARGET_CPU" = xx86; then - VCVARSFILES="vcvars32.bat vcvarsamd64_x86.bat" - elif test "x$TARGET_CPU" = xx86_64; then + if test "x$TARGET_CPU" = xx86_64; then VCVARSFILES="vcvars64.bat vcvarsx86_amd64.bat" elif test "x$TARGET_CPU" = xaarch64; then # for host x86-64, target aarch64 @@ -132,9 +130,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT], elif test -f "$WIN_SDK_BASE/bin/setenv.cmd"; then AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) VS_ENV_CMD="$WIN_SDK_BASE/bin/setenv.cmd" - if test "x$TARGET_CPU" = xx86; then - VS_ENV_ARGS="/x86" - elif test "x$TARGET_CPU" = xx86_64; then + if test "x$TARGET_CPU" = xx86_64; then VS_ENV_ARGS="/x64" elif test "x$TARGET_CPU" = xaarch64; then VS_ENV_ARGS="/arm64" @@ -438,9 +434,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL], # Need to check if the found msvcr is correct architecture AC_MSG_CHECKING([found $DLL_NAME architecture]) MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"` - if test "x$OPENJDK_TARGET_CPU" = xx86; then - CORRECT_MSVCR_ARCH=386 - elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then CORRECT_MSVCR_ARCH=x86-64 elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then # The cygwin 'file' command only returns "PE32+ executable (DLL) (console), for MS Windows", @@ -466,9 +460,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], DLL_HELP="$2" MSVC_DLL= - if test "x$OPENJDK_TARGET_CPU" = xx86; then - vs_target_cpu=x86 - elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then vs_target_cpu=x64 elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then vs_target_cpu=arm64 @@ -522,18 +514,8 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now. # (This was the original behaviour; kept since it might turn something up) if test "x$VCINSTALLDIR" != x; then - if test "x$OPENJDK_TARGET_CPU" = xx86; then - POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ - | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $GREP -v arm64 | $HEAD --lines 1` - if test "x$POSSIBLE_MSVC_DLL" = x; then - # We're grasping at straws now... - POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ - | $HEAD --lines 1` - fi - else - POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ - | $GREP x64 | $HEAD --lines 1` - fi + POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ + | $GREP x64 | $HEAD --lines 1` TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], [search of VCINSTALLDIR]) diff --git a/make/hotspot/gensrc/GensrcAdlc.gmk b/make/hotspot/gensrc/GensrcAdlc.gmk index ce3f2684026..d43a8b8d3ab 100644 --- a/make/hotspot/gensrc/GensrcAdlc.gmk +++ b/make/hotspot/gensrc/GensrcAdlc.gmk @@ -109,9 +109,7 @@ ifeq ($(call check-jvm-feature, compiler2), true) ADLCFLAGS += -DR18_RESERVED endif else ifeq ($(call isTargetOs, windows), true) - ifeq ($(call isTargetCpuBits, 64), true) - ADLCFLAGS += -D_WIN64=1 - endif + ADLCFLAGS += -D_WIN64=1 ifeq ($(HOTSPOT_TARGET_CPU_ARCH), aarch64) ADLCFLAGS += -DR18_RESERVED endif diff --git a/make/modules/java.desktop/lib/AwtLibraries.gmk b/make/modules/java.desktop/lib/AwtLibraries.gmk index b2904f961fd..90eda1c4e64 100644 --- a/make/modules/java.desktop/lib/AwtLibraries.gmk +++ b/make/modules/java.desktop/lib/AwtLibraries.gmk @@ -85,11 +85,7 @@ LIBAWT_EXTRA_HEADER_DIRS := \ LIBAWT_CFLAGS := -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH ifeq ($(call isTargetOs, windows), true) - LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE - ifeq ($(call isTargetCpuBits, 64), true) - LIBAWT_CFLAGS += -DMLIB_OS64BIT - endif - + LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE -DMLIB_OS64BIT LIBAWT_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons LIBAWT_VERSIONINFO_RESOURCE := \ $(TOPDIR)/src/$(MODULE)/windows/native/libawt/windows/awt.rc diff --git a/make/modules/jdk.accessibility/Launcher.gmk b/make/modules/jdk.accessibility/Launcher.gmk index 2499cf56616..86ad96b3a1e 100644 --- a/make/modules/jdk.accessibility/Launcher.gmk +++ b/make/modules/jdk.accessibility/Launcher.gmk @@ -48,63 +48,44 @@ ifeq ($(call isTargetOs, windows), true) TARGETS += $(BUILD_JABSWITCH) ############################################################################## - # Setup rules to create 32/64 bit version of jaccessinspector - # - # Parameter 1 File name suffix - # Parameter 2 ACCESSBRIDGE_ARCH_ -D suffix + # Build jaccessinspector ############################################################################## - define SetupInspector - $$(eval $$(call SetupJdkExecutable, BUILD_JACCESSINSPECTOR$1, \ - NAME := jaccessinspector$1, \ - SRC := jaccessinspector, \ - EXTRA_SRC := \ - bridge \ - common \ - toolscommon, \ - EXTRA_HEADER_DIRS := include/bridge, \ - CFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \ - CXXFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \ - LDFLAGS_windows := -stack:655360, \ - LIBS_windows := advapi32.lib user32.lib, \ - VERSIONINFO_RESOURCE := \ - $(ACCESSIBILITY_SRCDIR)/jaccessinspector/jaccessinspectorWindow.rc, \ - )) - TARGETS += $$(BUILD_JACCESSINSPECTOR$1) - endef + $(eval $(call SetupJdkExecutable, BUILD_JACCESSINSPECTOR, \ + NAME := jaccessinspector, \ + EXTRA_SRC := \ + bridge \ + common \ + toolscommon, \ + EXTRA_HEADER_DIRS := include/bridge, \ + CFLAGS := -DACCESSBRIDGE_ARCH_64 -EHsc, \ + CXXFLAGS := -DACCESSBRIDGE_ARCH_64 -EHsc, \ + LDFLAGS_windows := -stack:655360, \ + LIBS_windows := advapi32.lib user32.lib, \ + VERSIONINFO_RESOURCE := \ + $(ACCESSIBILITY_SRCDIR)/jaccessinspector/jaccessinspectorWindow.rc, \ + )) + + TARGETS += $(BUILD_JACCESSINSPECTOR) ############################################################################## - # Setup rules to create 32/64 bit version of jaccesswalker - # Parameter 1 File name suffix - # Parameter 2 ACCESSBRIDGE_ARCH_ -D suffix + # Build jaccesswalker ############################################################################## - define SetupWalker - $$(eval $$(call SetupJdkExecutable, BUILD_JACCESSWALKER$1, \ - NAME := jaccesswalker$1, \ - SRC := jaccesswalker, \ - EXTRA_SRC := \ - bridge \ - common \ - toolscommon, \ - EXTRA_HEADER_DIRS := include/bridge, \ - CFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \ - CXXFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \ - LDFLAGS_windows := -stack:655360, \ - LIBS_windows := advapi32.lib comctl32.lib gdi32.lib user32.lib, \ - VERSIONINFO_RESOURCE := \ - $(ACCESSIBILITY_SRCDIR)/jaccesswalker/jaccesswalkerWindow.rc, \ - )) - TARGETS += $$(BUILD_JACCESSWALKER$1) - endef + $(eval $(call SetupJdkExecutable, BUILD_JACCESSWALKER, \ + NAME := jaccesswalker, \ + EXTRA_SRC := \ + bridge \ + common \ + toolscommon, \ + EXTRA_HEADER_DIRS := include/bridge, \ + CFLAGS := -DACCESSBRIDGE_ARCH_64 -EHsc, \ + CXXFLAGS := -DACCESSBRIDGE_ARCH_64 -EHsc, \ + LDFLAGS_windows := -stack:655360, \ + LIBS_windows := advapi32.lib comctl32.lib gdi32.lib user32.lib, \ + VERSIONINFO_RESOURCE := \ + $(ACCESSIBILITY_SRCDIR)/jaccesswalker/jaccesswalkerWindow.rc, \ + )) - ifeq ($(call isTargetCpuBits, 32), true) - $(eval $(call SetupInspector,-32,32)) - $(eval $(call SetupWalker,-32,32)) - $(eval $(call SetupInspector,,LEGACY)) - $(eval $(call SetupWalker,,LEGACY)) - else - $(eval $(call SetupInspector,,64)) - $(eval $(call SetupWalker,,64)) - endif + TARGETS += $(BUILD_JACCESSWALKER) endif diff --git a/make/modules/jdk.accessibility/Lib.gmk b/make/modules/jdk.accessibility/Lib.gmk index 657eec2ad4e..6a429a56375 100644 --- a/make/modules/jdk.accessibility/Lib.gmk +++ b/make/modules/jdk.accessibility/Lib.gmk @@ -31,84 +31,50 @@ ifeq ($(call isTargetOs, windows), true) ACCESSIBILITY_SRCDIR := $(TOPDIR)/src/jdk.accessibility/windows/native ############################################################################## - # Setup rules to create 32/64 bit version of javaaccessbridge - # - # Parameter 1 Suffix - # Parameter 2 ACCESSBRIDGE_ARCH_ suffix + ## Build libjavaaccessbridge ############################################################################## - define SetupJavaDLL - $(call SetupJdkLibrary, BUILD_LIBJAVAACCESSBRIDGE$1, \ - NAME := javaaccessbridge$1, \ - SRC := libjavaaccessbridge, \ - EXTRA_SRC := common, \ - OPTIMIZATION := LOW, \ - DISABLED_WARNINGS_microsoft := 4311 4302 4312, \ - CXXFLAGS_FILTER_OUT := -MD, \ - CXXFLAGS := -MT -DACCESSBRIDGE_ARCH_$2, \ - EXTRA_HEADER_DIRS := \ - include/bridge \ - java.desktop:include, \ - JDK_LIBS := java.desktop:libjawt, \ - LIBS_windows := advapi32.lib comdlg32.lib gdi32.lib kernel32.lib \ - odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib \ - user32.lib uuid.lib winspool.lib, \ - VERSIONINFO_RESOURCE := \ - $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ - ) - TARGETS += $$(BUILD_LIBJAVAACCESSBRIDGE$1) - endef + $(eval $(call SetupJdkLibrary, BUILD_LIBJAVAACCESSBRIDGE, \ + NAME := javaaccessbridge, \ + EXTRA_SRC := common, \ + OPTIMIZATION := LOW, \ + DISABLED_WARNINGS_microsoft := 4311 4302 4312, \ + CXXFLAGS_FILTER_OUT := -MD, \ + CXXFLAGS := -MT -DACCESSBRIDGE_ARCH_64, \ + EXTRA_HEADER_DIRS := \ + include/bridge \ + java.desktop:include, \ + JDK_LIBS := java.desktop:libjawt, \ + LIBS_windows := advapi32.lib comdlg32.lib gdi32.lib kernel32.lib \ + odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib \ + user32.lib uuid.lib winspool.lib, \ + VERSIONINFO_RESOURCE := \ + $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ + )) + + TARGETS += $(BUILD_LIBJAVAACCESSBRIDGE) ############################################################################## - # Setup rules to create 32/64 bit version of windowsaccessbridge - # - # Parameter 1 Suffix - # Parameter 2 ACCESSBRIDGE_ARCH_ suffix + ## Build libwindowsaccessbridge ############################################################################## - define SetupWinDLL - $(call SetupJdkLibrary, BUILD_LIBWINDOWSACCESSBRIDGE$1, \ - NAME := windowsaccessbridge$1, \ - SRC := libwindowsaccessbridge, \ - EXTRA_SRC := common, \ - OPTIMIZATION := LOW, \ - DISABLED_WARNINGS_microsoft_WinAccessBridge.cpp := 4302 4311, \ - CXXFLAGS := -DACCESSBRIDGE_ARCH_$2, \ - EXTRA_HEADER_DIRS := \ - include/bridge, \ - LDFLAGS := \ - -def:$(ACCESSIBILITY_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \ - LIBS_windows := advapi32.lib comdlg32.lib gdi32.lib kernel32.lib \ - odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib \ - user32.lib uuid.lib winspool.lib, \ - VERSIONINFO_RESOURCE := \ - $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ - ) - TARGETS += $$(BUILD_LIBWINDOWSACCESSBRIDGE$1) - endef + $(eval $(call SetupJdkLibrary, BUILD_LIBWINDOWSACCESSBRIDGE, \ + NAME := windowsaccessbridge-64, \ + SRC := libwindowsaccessbridge, \ + EXTRA_SRC := common, \ + OPTIMIZATION := LOW, \ + DISABLED_WARNINGS_microsoft_WinAccessBridge.cpp := 4302 4311, \ + CXXFLAGS := -DACCESSBRIDGE_ARCH_64, \ + EXTRA_HEADER_DIRS := \ + include/bridge, \ + LDFLAGS := \ + -def:$(ACCESSIBILITY_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \ + LIBS_windows := advapi32.lib comdlg32.lib gdi32.lib kernel32.lib \ + odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib \ + user32.lib uuid.lib winspool.lib, \ + VERSIONINFO_RESOURCE := \ + $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ + )) - ifeq ($(call isTargetCpuBits, 32), true) - ############################################################################ - # Build libjabsysinfo - ############################################################################ - - $(eval $(call SetupJdkLibrary, BUILD_LIBJABSYSINFO, \ - NAME := jabsysinfo, \ - OPTIMIZATION := LOW, \ - VERSIONINFO_RESOURCE := \ - $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ - ) - - TARGETS += $(BUILD_LIBJABSYSINFO) - endif - - ifeq ($(call isTargetCpuBits, 32), true) - $(eval $(call SetupJavaDLL,-32,32)) - $(eval $(call SetupJavaDLL,,LEGACY)) - $(eval $(call SetupWinDLL,-32,32)) - $(eval $(call SetupWinDLL,,LEGACY)) - else - $(eval $(call SetupJavaDLL,,64)) - $(eval $(call SetupWinDLL,-64,64)) - endif + TARGETS += $(BUILD_LIBWINDOWSACCESSBRIDGE) endif diff --git a/make/scripts/compare.sh b/make/scripts/compare.sh index e81c460225c..cc2f4adf2ed 100644 --- a/make/scripts/compare.sh +++ b/make/scripts/compare.sh @@ -76,26 +76,13 @@ fi # disassembly, such as hard-coded addresses, to be able to catch "actual" differences. if [ "$OPENJDK_TARGET_OS" = "windows" ]; then - if [ "$OPENJDK_TARGET_CPU" = "x86" ]; then - DIS_DIFF_FILTER="$SED -r \ - -e 's/^ [0-9A-F]{16}: //' \ - -e 's/^ [0-9A-F]{8}: / : /' \ - -e 's/(offset \?\?)_C@_.*/\1/' \ - -e 's/[@?][A-Za-z0-9_]{1,25}//' \ - -e 's/([-,+])[0-9A-F]{2,16}/\1/g' \ - -e 's/\[[0-9A-F]{4,16}h\]/[]/' \ - -e 's/: ([a-z]{2}[a-z ]{2}) [0-9A-F]{2,16}h?$/: \1 /' \ - -e 's/_20[0-9]{2}_[0-1][0-9]_[0-9]{2}/_/' \ - " - elif [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then - DIS_DIFF_FILTER="$SED -r \ - -e 's/^ [0-9A-F]{16}: //' \ - -e 's/\[[0-9A-F]{4,16}h\]/[]/' \ - -e 's/([,+])[0-9A-F]{2,16}h/\1/' \ - -e 's/([a-z]{2}[a-z ]{2}) [0-9A-F]{4,16}$/\1 /' \ - -e 's/\[\?\?_C@_.*/[]/' \ - " - fi + DIS_DIFF_FILTER="$SED -r \ + -e 's/^ [0-9A-F]{16}: //' \ + -e 's/\[[0-9A-F]{4,16}h\]/[]/' \ + -e 's/([,+])[0-9A-F]{2,16}h/\1/' \ + -e 's/([a-z]{2}[a-z ]{2}) [0-9A-F]{4,16}$/\1 /' \ + -e 's/\[\?\?_C@_.*/[]/' \ + " elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then DIS_DIFF_FILTER="$SED \ -e 's/0x[0-9a-f]\{3,16\}//g' -e 's/^[0-9a-f]\{12,20\}//' \ @@ -1467,11 +1454,7 @@ if [ "$SKIP_DEFAULT" != "true" ]; then OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip" THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip" if [ "$OPENJDK_TARGET_OS" = "windows" ]; then - if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then - JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip" - else - JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip" - fi + JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip" OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip" OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN" THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip" diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp index 52e4388c5d2..12336289412 100644 --- a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp +++ b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp @@ -36,17 +36,6 @@ #define BUFFER_SIZE 30 -#ifdef _WINDOWS -GetBooleanField_t JNI_FastGetField::jni_fast_GetBooleanField_fp; -GetByteField_t JNI_FastGetField::jni_fast_GetByteField_fp; -GetCharField_t JNI_FastGetField::jni_fast_GetCharField_fp; -GetShortField_t JNI_FastGetField::jni_fast_GetShortField_fp; -GetIntField_t JNI_FastGetField::jni_fast_GetIntField_fp; -GetLongField_t JNI_FastGetField::jni_fast_GetLongField_fp; -GetFloatField_t JNI_FastGetField::jni_fast_GetFloatField_fp; -GetDoubleField_t JNI_FastGetField::jni_fast_GetDoubleField_fp; -#endif - // Instead of issuing lfence for LoadLoad barrier, we create data dependency // between loads, which is much more efficient than lfence. @@ -119,12 +108,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) { // ca1 is data dependent on rax,. __ jcc (Assembler::notEqual, slow); -#ifndef _WINDOWS __ ret (0); -#else - // __stdcall calling convention - __ ret (3*wordSize); -#endif slowcase_entry_pclist[count++] = __ pc(); __ bind (slow); @@ -142,18 +126,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) { __ flush (); -#ifndef _WINDOWS return fast_entry; -#else - switch (type) { - case T_BOOLEAN: jni_fast_GetBooleanField_fp = (GetBooleanField_t) fast_entry; break; - case T_BYTE: jni_fast_GetByteField_fp = (GetByteField_t) fast_entry; break; - case T_CHAR: jni_fast_GetCharField_fp = (GetCharField_t) fast_entry; break; - case T_SHORT: jni_fast_GetShortField_fp = (GetShortField_t) fast_entry; break; - case T_INT: jni_fast_GetIntField_fp = (GetIntField_t) fast_entry; break; - } - return os::win32::fast_jni_accessor_wrapper(type); -#endif } address JNI_FastGetField::generate_fast_get_boolean_field() { @@ -238,12 +211,7 @@ address JNI_FastGetField::generate_fast_get_long_field() { __ pop (rsi); -#ifndef _WINDOWS __ ret (0); -#else - // __stdcall calling convention - __ ret (3*wordSize); -#endif slowcase_entry_pclist[count-1] = __ pc(); slowcase_entry_pclist[count++] = __ pc(); @@ -255,12 +223,7 @@ address JNI_FastGetField::generate_fast_get_long_field() { __ flush (); -#ifndef _WINDOWS return fast_entry; -#else - jni_fast_GetLongField_fp = (GetLongField_t) fast_entry; - return os::win32::fast_jni_accessor_wrapper(T_LONG); -#endif } address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) { @@ -330,12 +293,7 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) { // access. __ jcc (Assembler::notEqual, slow_with_pop); -#ifndef _WINDOWS __ ret (0); -#else - // __stdcall calling convention - __ ret (3*wordSize); -#endif __ bind (slow_with_pop); // invalid load. pop FPU stack. @@ -354,15 +312,7 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) { __ flush (); -#ifndef _WINDOWS return fast_entry; -#else - switch (type) { - case T_FLOAT: jni_fast_GetFloatField_fp = (GetFloatField_t) fast_entry; break; - case T_DOUBLE: jni_fast_GetDoubleField_fp = (GetDoubleField_t) fast_entry; break; - } - return os::win32::fast_jni_accessor_wrapper(type); -#endif } address JNI_FastGetField::generate_fast_get_float_field() { diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 9854aa5e55a..08e089455f2 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -4115,7 +4115,7 @@ RegSet MacroAssembler::call_clobbered_gp_registers() { XMMRegSet MacroAssembler::call_clobbered_xmm_registers() { int num_xmm_registers = XMMRegister::available_xmm_registers(); -#if defined(_WINDOWS) && defined(_LP64) +#if defined(_WINDOWS) XMMRegSet result = XMMRegSet::range(xmm0, xmm5); if (num_xmm_registers > 16) { result += XMMRegSet::range(xmm16, as_XMMRegister(num_xmm_registers - 1)); @@ -10624,10 +10624,6 @@ Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) ShouldNotReachHere(); return Assembler::overflow; } -// 32-bit Windows has its own fast-path implementation -// of get_thread -#if !defined(WIN32) || defined(_LP64) - // This is simply a call to Thread::current() void MacroAssembler::get_thread(Register thread) { if (thread != rax) { @@ -10662,9 +10658,6 @@ void MacroAssembler::get_thread(Register thread) { } } - -#endif // !WIN32 || _LP64 - void MacroAssembler::check_stack_alignment(Register sp, const char* msg, unsigned bias, Register tmp) { Label L_stack_ok; if (bias == 0) { diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index f8c5de551cd..688cd4fa5a6 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -517,12 +517,10 @@ class VM_Version_StubGenerator: public StubCodeGenerator { // https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx __ subptr(rsp, 64); __ evmovdqul(Address(rsp, 0), xmm7, Assembler::AVX_512bit); -#ifdef _LP64 __ subptr(rsp, 64); __ evmovdqul(Address(rsp, 0), xmm8, Assembler::AVX_512bit); __ subptr(rsp, 64); __ evmovdqul(Address(rsp, 0), xmm31, Assembler::AVX_512bit); -#endif // _LP64 #endif // _WINDOWS // load value into all 64 bytes of zmm7 register @@ -546,12 +544,10 @@ class VM_Version_StubGenerator: public StubCodeGenerator { #ifdef _WINDOWS __ subptr(rsp, 32); __ vmovdqu(Address(rsp, 0), xmm7); -#ifdef _LP64 __ subptr(rsp, 32); __ vmovdqu(Address(rsp, 0), xmm8); __ subptr(rsp, 32); __ vmovdqu(Address(rsp, 0), xmm15); -#endif // _LP64 #endif // _WINDOWS // load value into all 32 bytes of ymm7 register @@ -611,12 +607,10 @@ class VM_Version_StubGenerator: public StubCodeGenerator { #endif #ifdef _WINDOWS -#ifdef _LP64 __ evmovdqul(xmm31, Address(rsp, 0), Assembler::AVX_512bit); __ addptr(rsp, 64); __ evmovdqul(xmm8, Address(rsp, 0), Assembler::AVX_512bit); __ addptr(rsp, 64); -#endif // _LP64 __ evmovdqul(xmm7, Address(rsp, 0), Assembler::AVX_512bit); __ addptr(rsp, 64); #endif // _WINDOWS @@ -641,12 +635,10 @@ class VM_Version_StubGenerator: public StubCodeGenerator { #endif #ifdef _WINDOWS -#ifdef _LP64 __ vmovdqu(xmm15, Address(rsp, 0)); __ addptr(rsp, 32); __ vmovdqu(xmm8, Address(rsp, 0)); __ addptr(rsp, 32); -#endif // _LP64 __ vmovdqu(xmm7, Address(rsp, 0)); __ addptr(rsp, 32); #endif // _WINDOWS diff --git a/src/hotspot/os/posix/include/jvm_md.h b/src/hotspot/os/posix/include/jvm_md.h index 2c8ebe06d70..e550ecbb000 100644 --- a/src/hotspot/os/posix/include/jvm_md.h +++ b/src/hotspot/os/posix/include/jvm_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -37,13 +37,6 @@ #include /* For ptrdiff_t */ #include /* For uintptr_t */ -#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} -#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} -#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"} -#define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"} -#define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"} -#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"} - #define JNI_LIB_PREFIX "lib" #ifdef __APPLE__ #define JNI_LIB_SUFFIX ".dylib" diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index df11832ae95..72330190b53 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -696,14 +696,6 @@ void os::print_active_locale(outputStream* st) { } } -void os::print_jni_name_prefix_on(outputStream* st, int args_size) { - // no prefix required -} - -void os::print_jni_name_suffix_on(outputStream* st, int args_size) { - // no suffix required -} - bool os::get_host_name(char* buf, size_t buflen) { struct utsname name; int retcode = uname(&name); diff --git a/src/hotspot/os/windows/include/jvm_md.h b/src/hotspot/os/windows/include/jvm_md.h index 4baba320855..a0e44a45613 100644 --- a/src/hotspot/os/windows/include/jvm_md.h +++ b/src/hotspot/os/windows/include/jvm_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -39,13 +39,6 @@ typedef int socklen_t; -#define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"} -#define JNI_ONUNLOAD_SYMBOLS {"_JNI_OnUnload@8", "JNI_OnUnload"} -#define JVM_ONLOAD_SYMBOLS {"_JVM_OnLoad@12", "JVM_OnLoad"} -#define AGENT_ONLOAD_SYMBOLS {"_Agent_OnLoad@12", "Agent_OnLoad"} -#define AGENT_ONUNLOAD_SYMBOLS {"_Agent_OnUnload@4", "Agent_OnUnload"} -#define AGENT_ONATTACH_SYMBOLS {"_Agent_OnAttach@12", "Agent_OnAttach"} - #define JNI_LIB_PREFIX "" #define JNI_LIB_SUFFIX ".dll" diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 40a022bbc17..9d514e584a4 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -133,7 +133,7 @@ static FILETIME process_kernel_time; #elif defined(_M_AMD64) #define __CPU__ amd64 #else - #define __CPU__ i486 + #error "Unknown CPU" #endif #if defined(USE_VECTORED_EXCEPTION_HANDLING) @@ -282,11 +282,6 @@ void os::run_periodic_checks(outputStream* st) { return; } -#ifndef _WIN64 -// previous UnhandledExceptionFilter, if there is one -static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = nullptr; -#endif - static LONG WINAPI Uncaught_Exception_Handler(struct _EXCEPTION_POINTERS* exceptionInfo); void os::init_system_properties_values() { @@ -399,11 +394,6 @@ void os::init_system_properties_values() { #undef BIN_DIR #undef PACKAGE_DIR -#ifndef _WIN64 - // set our UnhandledExceptionFilter and save any previous one - prev_uef_handler = SetUnhandledExceptionFilter(Uncaught_Exception_Handler); -#endif - // Done return; } @@ -517,7 +507,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); // Thread start routine for all newly created threads. // Called with the associated Thread* as the argument. -static unsigned __stdcall thread_native_entry(void* t) { +static unsigned thread_native_entry(void* t) { Thread* thread = static_cast(t); thread->record_stack_base_and_size(); @@ -876,14 +866,8 @@ bool os::has_allocatable_memory_limit(size_t* limit) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); -#ifdef _LP64 *limit = (size_t)ms.ullAvailVirtual; return true; -#else - // Limit to 1400m because of the 2gb address space wall - *limit = MIN2((size_t)1400*M, (size_t)ms.ullAvailVirtual); - return true; -#endif } int os::active_processor_count() { @@ -1549,7 +1533,7 @@ void os::prepare_native_symbols() { //----------------------------------------------------------- // Helper functions for fatal error handler -#ifdef _WIN64 + // Helper routine which returns true if address in // within the NTDLL address space. // @@ -1571,7 +1555,6 @@ static bool _addr_in_ntdll(address addr) { return false; } } -#endif struct _modinfo { address addr; @@ -1749,7 +1732,6 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) { } arch_t; static const arch_t arch_array[] = { - {IMAGE_FILE_MACHINE_I386, (char*)"IA 32"}, {IMAGE_FILE_MACHINE_AMD64, (char*)"AMD 64"}, {IMAGE_FILE_MACHINE_ARM64, (char*)"ARM 64"} }; @@ -1757,11 +1739,9 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) { static const uint16_t running_arch = IMAGE_FILE_MACHINE_ARM64; #elif (defined _M_AMD64) static const uint16_t running_arch = IMAGE_FILE_MACHINE_AMD64; -#elif (defined _M_IX86) - static const uint16_t running_arch = IMAGE_FILE_MACHINE_I386; #else #error Method os::dll_load requires that one of following \ - is defined :_M_AMD64 or _M_IX86 or _M_ARM64 + is defined :_M_AMD64 or _M_ARM64 #endif @@ -2101,13 +2081,6 @@ void os::print_memory_info(outputStream* st) { (int64_t) ms.ullTotalPageFile >> 20); st->print("(AvailPageFile size " INT64_FORMAT "M)", (int64_t) ms.ullAvailPageFile >> 20); - - // on 32bit Total/AvailVirtual are interesting (show us how close we get to 2-4 GB per process borders) -#if defined(_M_IX86) - st->print(", user-mode portion of virtual address-space " INT64_FORMAT "M ", - (int64_t) ms.ullTotalVirtual >> 20); - st->print("(" INT64_FORMAT "M free)", (int64_t) ms.ullAvailVirtual >> 20); -#endif } else { st->print(", GlobalMemoryStatusEx did not succeed so we miss some memory values."); } @@ -2228,19 +2201,6 @@ void os::jvm_path(char *buf, jint buflen) { } -void os::print_jni_name_prefix_on(outputStream* st, int args_size) { -#ifndef _WIN64 - st->print("_"); -#endif -} - - -void os::print_jni_name_suffix_on(outputStream* st, int args_size) { -#ifndef _WIN64 - st->print("@%d", args_size * sizeof(int)); -#endif -} - // This method is a copy of JDK's sysGetLastErrorString // from src/windows/hpi/src/system_md.c @@ -2465,8 +2425,6 @@ LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, #define PC_NAME Pc #elif defined(_M_AMD64) #define PC_NAME Rip -#elif defined(_M_IX86) - #define PC_NAME Eip #else #error unknown architecture #endif @@ -2590,21 +2548,12 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { ctx->Rdx = (DWORD)0; // remainder // Continue the execution #else - PCONTEXT ctx = exceptionInfo->ContextRecord; - address pc = (address)ctx->Eip; - guarantee(pc[0] == 0xF7, "not an idiv opcode(0xF7), the actual value = 0x%x", pc[1]); - guarantee((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands, the actual value = 0x%x", pc[1]); - guarantee(ctx->Eax == min_jint, "unexpected idiv exception, the actual value = %d while the expected is %d", ctx->Eax, min_jint); - // set correct result values and continue after idiv instruction - ctx->Eip = (DWORD)pc + 2; // idiv reg, reg is 2 bytes - ctx->Eax = (DWORD)min_jint; // result - ctx->Edx = (DWORD)0; // remainder - // Continue the execution + #error unknown architecture #endif return EXCEPTION_CONTINUE_EXECUTION; } -#if defined(_M_AMD64) || defined(_M_IX86) +#if defined(_M_AMD64) //----------------------------------------------------------------------------- static bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) { // handle exception caused by native method modifying control word @@ -2619,16 +2568,6 @@ static bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) { case EXCEPTION_FLT_STACK_CHECK: case EXCEPTION_FLT_UNDERFLOW: { PCONTEXT ctx = exceptionInfo->ContextRecord; -#ifndef _WIN64 - jint fp_control_word = (* (jint*) StubRoutines::x86::addr_fpu_cntrl_wrd_std()); - if (fp_control_word != ctx->FloatSave.ControlWord) { - // Restore FPCW and mask out FLT exceptions - ctx->FloatSave.ControlWord = fp_control_word | 0xffffffc0; - // Mask out pending FLT exceptions - ctx->FloatSave.StatusWord &= 0xffffff00; - return true; - } -#else // !_WIN64 // On Windows, the mxcsr control bits are non-volatile across calls // See also CR 6192333 // @@ -2639,7 +2578,6 @@ static bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) { ctx->MxCsr = MxCsr; return true; } -#endif // !_WIN64 } } @@ -2647,23 +2585,6 @@ static bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) { } #endif -#ifndef _WIN64 -static LONG WINAPI Uncaught_Exception_Handler(struct _EXCEPTION_POINTERS* exceptionInfo) { - if (handle_FLT_exception(exceptionInfo)) { - return EXCEPTION_CONTINUE_EXECUTION; - } - - // we only override this on 32 bits, so only check it there - if (prev_uef_handler != nullptr) { - // We didn't handle this exception so pass it to the previous - // UnhandledExceptionFilter. - return (prev_uef_handler)(exceptionInfo); - } - - return EXCEPTION_CONTINUE_SEARCH; -} -#endif - static inline void report_error(Thread* t, DWORD exception_code, address addr, void* siginfo, void* context) { VMError::report_and_die(t, exception_code, addr, siginfo, context); @@ -2683,98 +2604,18 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { #elif defined(_M_AMD64) address pc = (address) exceptionInfo->ContextRecord->Rip; #else - address pc = (address) exceptionInfo->ContextRecord->Eip; + #error unknown architecture #endif Thread* t = Thread::current_or_null_safe(); -#ifndef _WIN64 - // Execution protection violation - win32 running on AMD64 only - // Handled first to avoid misdiagnosis as a "normal" access violation; - // This is safe to do because we have a new/unique ExceptionInformation - // code for this condition. - if (exception_code == EXCEPTION_ACCESS_VIOLATION) { - int exception_subcode = (int) exception_record->ExceptionInformation[0]; - address addr = (address) exception_record->ExceptionInformation[1]; - - if (exception_subcode == EXCEPTION_INFO_EXEC_VIOLATION) { - size_t page_size = os::vm_page_size(); - - // Make sure the pc and the faulting address are sane. - // - // If an instruction spans a page boundary, and the page containing - // the beginning of the instruction is executable but the following - // page is not, the pc and the faulting address might be slightly - // different - we still want to unguard the 2nd page in this case. - // - // 15 bytes seems to be a (very) safe value for max instruction size. - bool pc_is_near_addr = - (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15); - bool instr_spans_page_boundary = - (align_down((intptr_t) pc ^ (intptr_t) addr, - (intptr_t) page_size) > 0); - - if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) { - static volatile address last_addr = - (address) os::non_memory_address_word(); - - // In conservative mode, don't unguard unless the address is in the VM - if (UnguardOnExecutionViolation > 0 && addr != last_addr && - (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { - - // Set memory to RWX and retry - address page_start = align_down(addr, page_size); - bool res = os::protect_memory((char*) page_start, page_size, - os::MEM_PROT_RWX); - - log_debug(os)("Execution protection violation " - "at " INTPTR_FORMAT - ", unguarding " INTPTR_FORMAT ": %s", p2i(addr), - p2i(page_start), (res ? "success" : os::strerror(errno))); - - // Set last_addr so if we fault again at the same address, we don't - // end up in an endless loop. - // - // There are two potential complications here. Two threads trapping - // at the same address at the same time could cause one of the - // threads to think it already unguarded, and abort the VM. Likely - // very rare. - // - // The other race involves two threads alternately trapping at - // different addresses and failing to unguard the page, resulting in - // an endless loop. This condition is probably even more unlikely - // than the first. - // - // Although both cases could be avoided by using locks or thread - // local last_addr, these solutions are unnecessary complication: - // this handler is a best-effort safety net, not a complete solution. - // It is disabled by default and should only be used as a workaround - // in case we missed any no-execute-unsafe VM code. - - last_addr = addr; - - return EXCEPTION_CONTINUE_EXECUTION; - } - } - - // Last unguard failed or not unguarding - tty->print_raw_cr("Execution protection violation"); -#if !defined(USE_VECTORED_EXCEPTION_HANDLING) - report_error(t, exception_code, addr, exception_record, - exceptionInfo->ContextRecord); -#endif - return EXCEPTION_CONTINUE_SEARCH; - } - } -#endif // _WIN64 - -#if defined(_M_AMD64) || defined(_M_IX86) +#if defined(_M_AMD64) if ((exception_code == EXCEPTION_ACCESS_VIOLATION) && VM_Version::is_cpuinfo_segv_addr(pc)) { // Verify that OS save/restore AVX registers. return Handle_Exception(exceptionInfo, VM_Version::cpuinfo_cont_addr()); } -#if !defined(PRODUCT) && defined(_LP64) +#if !defined(PRODUCT) if ((exception_code == EXCEPTION_ACCESS_VIOLATION) && VM_Version::is_cpuinfo_segv_addr_apx(pc)) { // Verify that OS save/restore APX registers. @@ -2842,7 +2683,6 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { return Handle_Exception(exceptionInfo, stub); } } -#ifdef _WIN64 // If it's a legal stack address map the entire region in if (thread->is_in_usable_stack(addr)) { addr = (address)((uintptr_t)addr & @@ -2851,7 +2691,6 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { !ExecMem); return EXCEPTION_CONTINUE_EXECUTION; } -#endif // Null pointer exception. if (MacroAssembler::uses_implicit_null_check((void*)addr)) { address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); @@ -2862,7 +2701,6 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { return EXCEPTION_CONTINUE_SEARCH; } -#ifdef _WIN64 // Special care for fast JNI field accessors. // jni_fast_GetField can trap at certain pc's if a GC kicks // in and the heap gets shrunk before the field access. @@ -2870,7 +2708,6 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { if (slowcase_pc != (address)-1) { return Handle_Exception(exceptionInfo, slowcase_pc); } -#endif // Stack overflow or null pointer exception in native code. #if !defined(USE_VECTORED_EXCEPTION_HANDLING) @@ -2923,7 +2760,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { } // switch } -#if defined(_M_AMD64) || defined(_M_IX86) +#if defined(_M_AMD64) if ((in_java || in_native) && handle_FLT_exception(exceptionInfo)) { return EXCEPTION_CONTINUE_EXECUTION; } @@ -2967,7 +2804,7 @@ LONG WINAPI topLevelVectoredExceptionFilter(struct _EXCEPTION_POINTERS* exceptio #elif defined(_M_AMD64) address pc = (address) exceptionInfo->ContextRecord->Rip; #else - address pc = (address) exceptionInfo->ContextRecord->Eip; + #error unknown architecture #endif // Fast path for code part of the code cache @@ -3009,63 +2846,6 @@ LONG WINAPI topLevelUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* excepti } #endif -#ifndef _WIN64 -// Special care for fast JNI accessors. -// jni_fast_GetField can trap at certain pc's if a GC kicks in and -// the heap gets shrunk before the field access. -// Need to install our own structured exception handler since native code may -// install its own. -LONG WINAPI fastJNIAccessorExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { - DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; - if (exception_code == EXCEPTION_ACCESS_VIOLATION) { - address pc = (address) exceptionInfo->ContextRecord->Eip; - address addr = JNI_FastGetField::find_slowcase_pc(pc); - if (addr != (address)-1) { - return Handle_Exception(exceptionInfo, addr); - } - } - return EXCEPTION_CONTINUE_SEARCH; -} - -#define DEFINE_FAST_GETFIELD(Return, Fieldname, Result) \ - Return JNICALL jni_fast_Get##Result##Field_wrapper(JNIEnv *env, \ - jobject obj, \ - jfieldID fieldID) { \ - __try { \ - return (*JNI_FastGetField::jni_fast_Get##Result##Field_fp)(env, \ - obj, \ - fieldID); \ - } __except(fastJNIAccessorExceptionFilter((_EXCEPTION_POINTERS*) \ - _exception_info())) { \ - } \ - return 0; \ - } - -DEFINE_FAST_GETFIELD(jboolean, bool, Boolean) -DEFINE_FAST_GETFIELD(jbyte, byte, Byte) -DEFINE_FAST_GETFIELD(jchar, char, Char) -DEFINE_FAST_GETFIELD(jshort, short, Short) -DEFINE_FAST_GETFIELD(jint, int, Int) -DEFINE_FAST_GETFIELD(jlong, long, Long) -DEFINE_FAST_GETFIELD(jfloat, float, Float) -DEFINE_FAST_GETFIELD(jdouble, double, Double) - -address os::win32::fast_jni_accessor_wrapper(BasicType type) { - switch (type) { - case T_BOOLEAN: return (address)jni_fast_GetBooleanField_wrapper; - case T_BYTE: return (address)jni_fast_GetByteField_wrapper; - case T_CHAR: return (address)jni_fast_GetCharField_wrapper; - case T_SHORT: return (address)jni_fast_GetShortField_wrapper; - case T_INT: return (address)jni_fast_GetIntField_wrapper; - case T_LONG: return (address)jni_fast_GetLongField_wrapper; - case T_FLOAT: return (address)jni_fast_GetFloatField_wrapper; - case T_DOUBLE: return (address)jni_fast_GetDoubleField_wrapper; - default: ShouldNotReachHere(); - } - return (address)-1; -} -#endif - // Virtual Memory // Windows large page support is available on Windows 2003. In order to use @@ -3341,12 +3121,7 @@ size_t os::win32::large_page_init_decide_size() { return 0; } -#if defined(IA32) - if (size > 4 * M || LargePageSizeInBytes > 4 * M) { - WARN("JVM cannot use large pages bigger than 4mb."); - return 0; - } -#elif defined(AMD64) +#if defined(AMD64) if (!EnableAllLargePageSizesForWindows) { if (size > 4 * M || LargePageSizeInBytes > 4 * M) { WARN("JVM cannot use large pages bigger than 4mb."); @@ -3430,13 +3205,8 @@ char* os::map_memory_to_file(char* base, size_t size, int fd) { assert(fd != -1, "File descriptor is not valid"); HANDLE fh = (HANDLE)_get_osfhandle(fd); -#ifdef _LP64 HANDLE fileMapping = CreateFileMapping(fh, nullptr, PAGE_READWRITE, (DWORD)(size >> 32), (DWORD)(size & 0xFFFFFFFF), nullptr); -#else - HANDLE fileMapping = CreateFileMapping(fh, nullptr, PAGE_READWRITE, - 0, (DWORD)size, nullptr); -#endif if (fileMapping == nullptr) { if (GetLastError() == ERROR_DISK_FULL) { vm_exit_during_initialization(err_msg("Could not allocate sufficient disk space for Java heap")); @@ -4618,32 +4388,6 @@ bool os::message_box(const char* title, const char* message) { return result == IDYES; } -#ifndef PRODUCT -#ifndef _WIN64 -// Helpers to check whether NX protection is enabled -int nx_exception_filter(_EXCEPTION_POINTERS *pex) { - if (pex->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && - pex->ExceptionRecord->NumberParameters > 0 && - pex->ExceptionRecord->ExceptionInformation[0] == - EXCEPTION_INFO_EXEC_VIOLATION) { - return EXCEPTION_EXECUTE_HANDLER; - } - return EXCEPTION_CONTINUE_SEARCH; -} - -void nx_check_protection() { - // If NX is enabled we'll get an exception calling into code on the stack - char code[] = { (char)0xC3 }; // ret - void *code_ptr = (void *)code; - __try { - __asm call code_ptr - } __except(nx_exception_filter((_EXCEPTION_POINTERS*)_exception_info())) { - tty->print_raw_cr("NX protection detected."); - } -} -#endif // _WIN64 -#endif // PRODUCT - // This is called _before_ the global arguments have been parsed void os::init(void) { _initial_pid = _getpid(); @@ -4663,9 +4407,6 @@ void os::init(void) { fatal("DuplicateHandle failed\n"); } main_thread_id = (int) GetCurrentThreadId(); - - // initialize fast thread access - only used for 32-bit - win32::initialize_thread_ptr_offset(); } // To install functions for atexit processing @@ -4681,11 +4422,7 @@ static jint initSock(); // HotSpot guard pages is added later. size_t os::_compiler_thread_min_stack_allowed = 48 * K; size_t os::_java_thread_min_stack_allowed = 40 * K; -#ifdef _LP64 size_t os::_vm_internal_thread_min_stack_allowed = 64 * K; -#else -size_t os::_vm_internal_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K; -#endif // _LP64 // If stack_commit_size is 0, windows will reserve the default size, // but only commit a small portion of it. This stack size is the size of this @@ -4713,16 +4450,6 @@ jint os::init_2(void) { previousUnhandledExceptionFilter = SetUnhandledExceptionFilter(topLevelUnhandledExceptionFilter); #endif - // for debugging float code generation bugs -#if defined(ASSERT) && !defined(_WIN64) - static long fp_control_word = 0; - __asm { fstcw fp_control_word } - // see Intel PPro Manual, Vol. 2, p 7-16 - const long invalid = 0x01; - fp_control_word |= invalid; - __asm { fldcw fp_control_word } -#endif - // Check and sets minimum stack sizes against command line options if (set_minimum_stack_sizes() == JNI_ERR) { return JNI_ERR; @@ -4746,11 +4473,6 @@ jint os::init_2(void) { } } -#ifndef _WIN64 - // Print something if NX is enabled (win32 on AMD64) - NOT_PRODUCT(if (PrintMiscellaneous && Verbose) nx_check_protection()); -#endif - // initialize thread priority policy prio_init(); @@ -6006,13 +5728,6 @@ ssize_t os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { return ::send(fd, buf, (int)nBytes, flags); } -// WINDOWS CONTEXT Flags for THREAD_SAMPLING -#if defined(IA32) - #define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS) -#elif defined(AMD64) || defined(_M_ARM64) - #define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT) -#endif - // returns true if thread could be suspended, // false otherwise static bool do_suspend(HANDLE* h) { @@ -6057,7 +5772,7 @@ void SuspendedThreadTask::internal_do_task() { // suspend the thread if (do_suspend(&h)) { - ctxt.ContextFlags = sampling_context_flags; + ctxt.ContextFlags = (CONTEXT_FULL | CONTEXT_FLOATING_POINT); // get thread context GetThreadContext(h, &ctxt); SuspendedThreadTaskContext context(_thread, &ctxt); @@ -6103,7 +5818,6 @@ void* os::get_default_process_handle() { // Builds a platform dependent Agent_OnLoad_ function name // which is used to find statically linked in agents. -// Additionally for windows, takes into account __stdcall names. // Parameters: // sym_name: Symbol in library we are looking for // lib_name: Name of library to look in, null for shared libs. @@ -6144,24 +5858,11 @@ char* os::build_agent_function_name(const char *sym_name, const char *lib_name, if (agent_entry_name == nullptr) { return nullptr; } + + strcpy(agent_entry_name, sym_name); if (lib_name != nullptr) { - const char *p = strrchr(sym_name, '@'); - if (p != nullptr && p != sym_name) { - // sym_name == _Agent_OnLoad@XX - strncpy(agent_entry_name, sym_name, (p - sym_name)); - agent_entry_name[(p-sym_name)] = '\0'; - // agent_entry_name == _Agent_OnLoad - strcat(agent_entry_name, "_"); - strncat(agent_entry_name, lib_name, name_len); - strcat(agent_entry_name, p); - // agent_entry_name == _Agent_OnLoad_lib_name@XX - } else { - strcpy(agent_entry_name, sym_name); - strcat(agent_entry_name, "_"); - strncat(agent_entry_name, lib_name, name_len); - } - } else { - strcpy(agent_entry_name, sym_name); + strcat(agent_entry_name, "_"); + strncat(agent_entry_name, lib_name, name_len); } return agent_entry_name; } @@ -6200,19 +5901,6 @@ int os::get_signal_number(const char* name) { return -1; } -// Fast current thread access - -int os::win32::_thread_ptr_offset = 0; - -static void call_wrapper_dummy() {} - -// We need to call the os_exception_wrapper once so that it sets -// up the offset from FS of the thread pointer. -void os::win32::initialize_thread_ptr_offset() { - os::os_exception_wrapper((java_call_t)call_wrapper_dummy, - nullptr, methodHandle(), nullptr, nullptr); -} - bool os::supports_map_sync() { return false; } @@ -6287,7 +5975,7 @@ bool os::win32::find_mapping(address addr, mapping_info_t* mi) { // Helper for print_one_mapping: print n words, both as hex and ascii. // Use Safefetch for all values. static void print_snippet(const void* p, outputStream* st) { - static const int num_words = LP64_ONLY(3) NOT_LP64(6); + static const int num_words = 3; static const int num_bytes = num_words * sizeof(int); intptr_t v[num_words]; const int errval = 0xDE210244; @@ -6330,8 +6018,7 @@ static address print_one_mapping(MEMORY_BASIC_INFORMATION* minfo, address start, if (first_line) { st->print("Base " PTR_FORMAT ": ", p2i(allocation_base)); } else { - st->print_raw(NOT_LP64 (" ") - LP64_ONLY(" ")); + st->print_raw(" "); } address region_start = (address)minfo->BaseAddress; address region_end = region_start + minfo->RegionSize; @@ -6431,7 +6118,7 @@ void os::print_memory_mappings(char* addr, size_t bytes, outputStream* st) { // Here, we advance the probe pointer by alloc granularity. But if the range to print // is large, this may take a long time. Therefore lets stop right away if the address // is outside of what we know are valid addresses on Windows. Also, add a loop fuse. - static const address end_virt = (address)(LP64_ONLY(0x7ffffffffffULL) NOT_LP64(3*G)); + static const address end_virt = (address)(0x7ffffffffffULL); if (p >= end_virt) { break; } else { diff --git a/src/hotspot/os/windows/os_windows.hpp b/src/hotspot/os/windows/os_windows.hpp index 1d523724300..1aba43fb3d2 100644 --- a/src/hotspot/os/windows/os_windows.hpp +++ b/src/hotspot/os/windows/os_windows.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -146,22 +146,7 @@ class os::win32 { // return information about that area. static bool find_mapping(address p, mapping_info_t* mapping_info); -#ifndef _WIN64 - // A wrapper to install a structured exception handler for fast JNI accessors. - static address fast_jni_accessor_wrapper(BasicType); -#endif - - // Fast access to current thread -protected: - static int _thread_ptr_offset; -private: - static void initialize_thread_ptr_offset(); public: - static inline void set_thread_ptr_offset(int offset) { - _thread_ptr_offset = offset; - } - static inline int get_thread_ptr_offset() { return _thread_ptr_offset; } - // signal support static void* install_signal_handler(int sig, signal_handler_t handler); static void* user_handler(); diff --git a/src/hotspot/os/windows/sharedRuntimeRem.cpp b/src/hotspot/os/windows/sharedRuntimeRem.cpp index cb47cb7dfff..62a85e55a01 100644 --- a/src/hotspot/os/windows/sharedRuntimeRem.cpp +++ b/src/hotspot/os/windows/sharedRuntimeRem.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2024, 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 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "runtime/sharedRuntime.hpp" -#ifdef _WIN64 // These are copied defines originally from fdlibm.h. #define __HI(x) *(1+(int*)&x) @@ -158,5 +157,3 @@ double SharedRuntime::fmod_winx64(double x, double y) } return x; /* exact output */ } - -#endif diff --git a/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp index aa1d5820637..c541213615c 100644 --- a/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -24,41 +24,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" -#include "asm/macroAssembler.inline.hpp" -#include "os_windows.hpp" -#include "runtime/os.hpp" void MacroAssembler::int3() { emit_int8((unsigned char)0xCC); } - -#ifndef _LP64 -// The current scheme to accelerate access to the thread -// pointer is to store the current thread in the os_exception_wrapper -// and reference the current thread from stubs and compiled code -// via the FS register. FS[0] contains a pointer to the structured -// exception block which is actually a stack address. The first time -// we call the os exception wrapper, we calculate and store the -// offset from this exception block and use that offset here. -// -// The last mechanism we used was problematic in that the -// the offset we had hard coded in the VM kept changing as Microsoft -// evolved the OS. -// -// Warning: This mechanism assumes that we only attempt to get the -// thread when we are nested below a call wrapper. -// -// movl reg, fs:[0] Get exception pointer -// movl reg, [reg + thread_ptr_offset] Load thread -// -void MacroAssembler::get_thread(Register thread) { - prefix(FS_segment); - movptr(thread, ExternalAddress(nullptr)); - assert(os::win32::get_thread_ptr_offset() != 0, - "Thread Pointer Offset has not been initialized"); - movl(thread, Address(thread, os::win32::get_thread_ptr_offset())); -} - -// #else - use shared x86 implementation in cpu/x86/vm/macroAssembler_x86.cpp - -#endif diff --git a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp index aa0fef3b83a..9f7da19b328 100644 --- a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -111,79 +111,4 @@ DEFINE_INTRINSIC_CMPXCHG(InterlockedCompareExchange64, __int64) #undef DEFINE_INTRINSIC_CMPXCHG -#ifndef AMD64 - -#pragma warning(disable: 4035) // Disables warnings reporting missing return statement - -template<> -template -inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { - STATIC_ASSERT(8 == sizeof(T)); - volatile T dest; - volatile T* pdest = &dest; - __asm { - mov eax, src - fild qword ptr [eax] - mov eax, pdest - fistp qword ptr [eax] - } - return dest; -} - -template<> -template -inline void Atomic::PlatformStore<8>::operator()(T volatile* dest, - T store_value) const { - STATIC_ASSERT(8 == sizeof(T)); - volatile T* src = &store_value; - __asm { - mov eax, src - fild qword ptr [eax] - mov eax, dest - fistp qword ptr [eax] - } -} - -#pragma warning(default: 4035) // Enables warnings reporting missing return statement - -template<> -struct Atomic::PlatformOrderedStore<1, RELEASE_X_FENCE> -{ - template - void operator()(volatile T* p, T v) const { - __asm { - mov edx, p; - mov al, v; - xchg al, byte ptr [edx]; - } - } -}; - -template<> -struct Atomic::PlatformOrderedStore<2, RELEASE_X_FENCE> -{ - template - void operator()(volatile T* p, T v) const { - __asm { - mov edx, p; - mov ax, v; - xchg ax, word ptr [edx]; - } - } -}; - -template<> -struct Atomic::PlatformOrderedStore<4, RELEASE_X_FENCE> -{ - template - void operator()(volatile T* p, T v) const { - __asm { - mov edx, p; - mov eax, v; - xchg eax, dword ptr [edx]; - } - } -}; -#endif // AMD64 - #endif // OS_CPU_WINDOWS_X86_ATOMIC_WINDOWS_X86_HPP diff --git a/src/hotspot/os_cpu/windows_x86/copy_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/copy_windows_x86.hpp index 6f4678e4a5c..4298542629b 100644 --- a/src/hotspot/os_cpu/windows_x86/copy_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/copy_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -53,35 +53,7 @@ static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { } static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { -#ifdef AMD64 pd_conjoint_atomic_helper(from, to, count); -#else - // Guarantee use of fild/fistp or xmm regs via some asm code, because compilers won't. - __asm { - mov eax, from; - mov edx, to; - mov ecx, count; - cmp eax, edx; - jbe downtest; - jmp uptest; - up: - fild qword ptr [eax]; - fistp qword ptr [edx]; - add eax, 8; - add edx, 8; - uptest: - sub ecx, 1; - jge up; - jmp done; - down: - fild qword ptr [eax][ecx*8]; - fistp qword ptr [edx][ecx*8]; - downtest: - sub ecx, 1; - jge down; - done:; - } -#endif // AMD64 } static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { @@ -89,11 +61,7 @@ static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { } static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { -#ifdef AMD64 pd_conjoint_bytes_atomic(from, to, count); -#else - pd_conjoint_bytes(from, to, count); -#endif // AMD64 } static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { diff --git a/src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.hpp index 43764b14a01..a1f1aa76912 100644 --- a/src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -48,13 +48,7 @@ inline void OrderAccess::acquire() { compiler_barrier(); } inline void OrderAccess::release() { compiler_barrier(); } inline void OrderAccess::fence() { -#ifdef AMD64 StubRoutines_fence(); -#else - __asm { - lock add dword ptr [esp], 0; - } -#endif // AMD64 compiler_barrier(); } diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp index f67e5df8e3e..9a23ac67335 100644 --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp @@ -56,15 +56,9 @@ #undef REG_SP #undef REG_FP #undef REG_PC -#ifdef AMD64 #define REG_SP Rsp #define REG_FP Rbp #define REG_PC Rip -#else -#define REG_SP Esp -#define REG_FP Ebp -#define REG_PC Eip -#endif // AMD64 JNIEXPORT extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* ); @@ -72,52 +66,12 @@ extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* ); // Install a win32 structured exception handler around thread. void os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, JavaThread* thread) { __try { - -#ifndef AMD64 - // We store the current thread in this wrapperthread location - // and determine how far away this address is from the structured - // exception pointer that FS:[0] points to. This get_thread - // code can then get the thread pointer via FS. - // - // Warning: This routine must NEVER be inlined since we'd end up with - // multiple offsets. - // - volatile Thread* wrapperthread = thread; - - if (os::win32::get_thread_ptr_offset() == 0) { - int thread_ptr_offset; - __asm { - lea eax, dword ptr wrapperthread; - sub eax, dword ptr FS:[0H]; - mov thread_ptr_offset, eax - }; - os::win32::set_thread_ptr_offset(thread_ptr_offset); - } -#ifdef ASSERT - // Verify that the offset hasn't changed since we initially captured - // it. This might happen if we accidentally ended up with an - // inlined version of this routine. - else { - int test_thread_ptr_offset; - __asm { - lea eax, dword ptr wrapperthread; - sub eax, dword ptr FS:[0H]; - mov test_thread_ptr_offset, eax - }; - assert(test_thread_ptr_offset == os::win32::get_thread_ptr_offset(), - "thread pointer offset from SEH changed"); - } -#endif // ASSERT -#endif // !AMD64 - f(value, method, args, thread); } __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) { // Nothing to do. } } -#ifdef AMD64 - // This is the language specific handler for exceptions // originating from dynamically generated code. // We call the standard structured exception handler @@ -157,7 +111,6 @@ typedef struct { UNWIND_INFO_EH_ONLY unw; } DynamicCodeData, *pDynamicCodeData; -#endif // AMD64 // // Register our CodeCache area with the OS so it will dispatch exceptions // to our topLevelExceptionFilter when we take an exception in our @@ -167,8 +120,6 @@ typedef struct { // codeCache area // bool os::win32::register_code_area(char *low, char *high) { -#ifdef AMD64 - ResourceMark rm; pDynamicCodeData pDCD; @@ -206,7 +157,6 @@ bool os::win32::register_code_area(char *low, char *high) { guarantee(RtlAddFunctionTable(prt, 1, (ULONGLONG)low), "Failed to register Dynamic Code Exception Handler with RtlAddFunctionTable"); -#endif // AMD64 return true; } @@ -334,20 +284,6 @@ frame os::fetch_frame_from_context(const void* ucVoid) { return frame(sp, fp, epc); } -#ifndef AMD64 -// Ignore "C4172: returning address of local variable or temporary" on 32bit -PRAGMA_DIAG_PUSH -PRAGMA_DISABLE_MSVC_WARNING(4172) -// Returns an estimate of the current stack pointer. Result must be guaranteed -// to point into the calling threads stack, and be no lower than the current -// stack pointer. -address os::current_stack_pointer() { - int dummy; - address sp = (address)&dummy; - return sp; -} -PRAGMA_DIAG_POP -#else // Returns the current stack pointer. Accurate value needed for // os::verify_stack_alignment(). address os::current_stack_pointer() { @@ -356,7 +292,6 @@ address os::current_stack_pointer() { StubRoutines::x86::get_previous_sp_entry()); return (*func)(); } -#endif bool os::win32::get_frame_at_stack_banging_point(JavaThread* thread, struct _EXCEPTION_POINTERS* exceptionInfo, address pc, frame* fr) { @@ -414,7 +349,6 @@ void os::print_context(outputStream *st, const void *context) { const CONTEXT* uc = (const CONTEXT*)context; st->print_cr("Registers:"); -#ifdef AMD64 st->print( "RAX=" INTPTR_FORMAT, uc->Rax); st->print(", RBX=" INTPTR_FORMAT, uc->Rbx); st->print(", RCX=" INTPTR_FORMAT, uc->Rcx); @@ -446,26 +380,12 @@ void os::print_context(outputStream *st, const void *context) { i, xmm[1], xmm[0]); } st->print(" MXCSR=" UINT32_FORMAT_X_0, uc->MxCsr); -#else - st->print( "EAX=" INTPTR_FORMAT, uc->Eax); - st->print(", EBX=" INTPTR_FORMAT, uc->Ebx); - st->print(", ECX=" INTPTR_FORMAT, uc->Ecx); - st->print(", EDX=" INTPTR_FORMAT, uc->Edx); - st->cr(); - st->print( "ESP=" INTPTR_FORMAT, uc->Esp); - st->print(", EBP=" INTPTR_FORMAT, uc->Ebp); - st->print(", ESI=" INTPTR_FORMAT, uc->Esi); - st->print(", EDI=" INTPTR_FORMAT, uc->Edi); - st->cr(); - st->print( "EIP=" INTPTR_FORMAT, uc->Eip); - st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags); -#endif // AMD64 st->cr(); st->cr(); } void os::print_register_info(outputStream *st, const void *context, int& continuation) { - const int register_count = AMD64_ONLY(16) NOT_AMD64(8); + const int register_count = 16; int n = continuation; assert(n >= 0 && n <= register_count, "Invalid continuation value"); if (context == nullptr || n == register_count) { @@ -478,7 +398,6 @@ void os::print_register_info(outputStream *st, const void *context, int& continu continuation = n + 1; # define CASE_PRINT_REG(n, str, id) case n: st->print(str); print_location(st, uc->id); switch (n) { -#ifdef AMD64 CASE_PRINT_REG( 0, "RAX=", Rax); break; CASE_PRINT_REG( 1, "RBX=", Rbx); break; CASE_PRINT_REG( 2, "RCX=", Rcx); break; @@ -495,16 +414,6 @@ void os::print_register_info(outputStream *st, const void *context, int& continu CASE_PRINT_REG(13, "R13=", R13); break; CASE_PRINT_REG(14, "R14=", R14); break; CASE_PRINT_REG(15, "R15=", R15); break; -#else - CASE_PRINT_REG(0, "EAX=", Eax); break; - CASE_PRINT_REG(1, "EBX=", Ebx); break; - CASE_PRINT_REG(2, "ECX=", Ecx); break; - CASE_PRINT_REG(3, "EDX=", Edx); break; - CASE_PRINT_REG(4, "ESP=", Esp); break; - CASE_PRINT_REG(5, "EBP=", Ebp); break; - CASE_PRINT_REG(6, "ESI=", Esi); break; - CASE_PRINT_REG(7, "EDI=", Edi); break; -#endif // AMD64 } # undef CASE_PRINT_REG ++n; @@ -512,17 +421,7 @@ void os::print_register_info(outputStream *st, const void *context, int& continu } extern "C" int SpinPause () { -#ifdef AMD64 return 0 ; -#else - // pause == rep:nop - // On systems that don't support pause a rep:nop - // is executed as a nop. The rep: prefix is ignored. - _asm { - pause ; - }; - return 1 ; -#endif // AMD64 } juint os::cpu_microcode_revision() { @@ -544,21 +443,15 @@ juint os::cpu_microcode_revision() { } void os::setup_fpu() { -#ifndef AMD64 - int fpu_cntrl_word = StubRoutines::x86::fpu_cntrl_wrd_std(); - __asm fldcw fpu_cntrl_word; -#endif // !AMD64 } #ifndef PRODUCT void os::verify_stack_alignment() { -#ifdef AMD64 // The current_stack_pointer() calls generated get_previous_sp stub routine. // Only enable the assert after the routine becomes available. if (StubRoutines::initial_stubs_code() != nullptr) { assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); } -#endif } #endif diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.inline.hpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.inline.hpp index f7622611da7..0cc457609cc 100644 --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.inline.hpp +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, 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 @@ -28,13 +28,11 @@ #include "runtime/os.hpp" #include "os_windows.hpp" -#ifdef AMD64 #define HAVE_PLATFORM_PRINT_NATIVE_STACK 1 inline bool os::platform_print_native_stack(outputStream* st, const void* context, char *buf, int buf_size, address& lastpc) { return os::win32::platform_print_native_stack(st, context, buf, buf_size, lastpc); } -#endif inline jlong os::rdtsc() { // 32 bit: 64 bit result in edx:eax diff --git a/src/hotspot/os_cpu/windows_x86/unwind_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/unwind_windows_x86.hpp index 1f66e839fab..ca402a13675 100644 --- a/src/hotspot/os_cpu/windows_x86/unwind_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/unwind_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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 @@ -25,8 +25,6 @@ #ifndef OS_CPU_WINDOWS_X86_UNWIND_WINDOWS_X86_HPP #define OS_CPU_WINDOWS_X86_UNWIND_WINDOWS_X86_HPP - -#ifdef AMD64 typedef unsigned char UBYTE; // This structure is used to define an UNWIND_INFO that @@ -54,6 +52,4 @@ typedef struct _RUNTIME_FUNCTION { } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; */ -#endif // AMD64 - #endif // OS_CPU_WINDOWS_X86_UNWIND_WINDOWS_X86_HPP diff --git a/src/hotspot/share/adlc/adlc.hpp b/src/hotspot/share/adlc/adlc.hpp index 8812066bafa..3e82fe0e210 100644 --- a/src/hotspot/share/adlc/adlc.hpp +++ b/src/hotspot/share/adlc/adlc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, 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 @@ -50,7 +50,7 @@ using namespace std; #ifdef _WIN64 typedef __int64 intptr_t; #else -typedef int intptr_t; +#error "Unsupported platform" #endif #define _INTPTR_T_DEFINED #endif @@ -59,7 +59,7 @@ typedef int intptr_t; #ifdef _WIN64 typedef unsigned __int64 uintptr_t; #else -typedef unsigned int uintptr_t; +#error "Unsupported platform" #endif #define _UINTPTR_T_DEFINED #endif diff --git a/src/hotspot/share/adlc/main.cpp b/src/hotspot/share/adlc/main.cpp index fd270b09443..f15b6e8813f 100644 --- a/src/hotspot/share/adlc/main.cpp +++ b/src/hotspot/share/adlc/main.cpp @@ -491,8 +491,6 @@ int get_legal_text(FileBuff &fbuf, char **legal_text) return (int) (legal_end - legal_start); } -#if !defined(_WIN32) || defined(_WIN64) void *operator new( size_t size, int, const char *, int ) throw() { return ::operator new( size ); } -#endif diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index c18f23badd1..0dd183e06d4 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -412,12 +412,6 @@ Handle java_lang_String::create_from_platform_dependent_str(const char* str, TRA if (_to_java_string_fn == nullptr) { void *lib_handle = os::native_java_library(); _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "JNU_NewStringPlatform")); -#if defined(_WIN32) && !defined(_WIN64) - if (_to_java_string_fn == nullptr) { - // On 32 bit Windows, also try __stdcall decorated name - _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "_JNU_NewStringPlatform@8")); - } -#endif if (_to_java_string_fn == nullptr) { fatal("JNU_NewStringPlatform missing"); } diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index 7b091d8ade5..ad3d14012ff 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -560,11 +560,6 @@ void CompilerConfig::ergo_initialize() { if (has_c1()) { if (!is_compilation_mode_selected()) { -#if defined(_WINDOWS) && !defined(_LP64) - if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) { - FLAG_SET_ERGO(NeverActAsServerClassMachine, true); - } -#endif if (NeverActAsServerClassMachine) { set_client_emulation_mode_flags(); } @@ -628,4 +623,3 @@ void CompilerConfig::ergo_initialize() { } #endif // COMPILER2 } - diff --git a/src/hotspot/share/include/jvm.h b/src/hotspot/share/include/jvm.h index 28e8c2b08d3..e50d758335c 100644 --- a/src/hotspot/share/include/jvm.h +++ b/src/hotspot/share/include/jvm.h @@ -1153,6 +1153,13 @@ JVM_GetClassFileVersion(JNIEnv *env, jclass current); JNIEXPORT jboolean JNICALL JVM_PrintWarningAtDynamicAgentLoad(void); +#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} +#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} +#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"} +#define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"} +#define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"} +#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"} + /* * This structure is used by the launcher to get the default thread * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index b85d2227fc7..3599df18544 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -2578,9 +2578,7 @@ C2V_VMENTRY_NULL(jlongArray, registerNativeMethods, (JNIEnv* env, jobject, jclas stringStream st; char* pure_name = NativeLookup::pure_jni_name(method); guarantee(pure_name != nullptr, "Illegal native method name encountered"); - os::print_jni_name_prefix_on(&st, args_size); st.print_raw(pure_name); - os::print_jni_name_suffix_on(&st, args_size); char* jni_name = st.as_string(); address entry = (address) os::dll_lookup(sl_handle, jni_name); @@ -2589,10 +2587,8 @@ C2V_VMENTRY_NULL(jlongArray, registerNativeMethods, (JNIEnv* env, jobject, jclas st.reset(); char* long_name = NativeLookup::long_jni_name(method); guarantee(long_name != nullptr, "Illegal native method name encountered"); - os::print_jni_name_prefix_on(&st, args_size); st.print_raw(pure_name); st.print_raw(long_name); - os::print_jni_name_suffix_on(&st, args_size); char* jni_long_name = st.as_string(); entry = (address) os::dll_lookup(sl_handle, jni_long_name); if (entry == nullptr) { diff --git a/src/hotspot/share/prims/jniFastGetField.hpp b/src/hotspot/share/prims/jniFastGetField.hpp index 525ff0aba87..0e4c4c849e0 100644 --- a/src/hotspot/share/prims/jniFastGetField.hpp +++ b/src/hotspot/share/prims/jniFastGetField.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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 @@ -71,17 +71,6 @@ class JNI_FastGetField : AllStatic { #endif // AARCH64 public: -#if defined(_WINDOWS) && !defined(_WIN64) - static GetBooleanField_t jni_fast_GetBooleanField_fp; - static GetByteField_t jni_fast_GetByteField_fp; - static GetCharField_t jni_fast_GetCharField_fp; - static GetShortField_t jni_fast_GetShortField_fp; - static GetIntField_t jni_fast_GetIntField_fp; - static GetLongField_t jni_fast_GetLongField_fp; - static GetFloatField_t jni_fast_GetFloatField_fp; - static GetDoubleField_t jni_fast_GetDoubleField_fp; -#endif - static address generate_fast_get_boolean_field(); static address generate_fast_get_byte_field(); static address generate_fast_get_char_field(); diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 9a132b089f2..a027351ff7b 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -378,7 +378,7 @@ JVM_ENTRY(jobjectArray, JVM_GetProperties(JNIEnv *env)) // Add the sun.management.compiler property for the compiler's name { #undef CSIZE -#if defined(_LP64) || defined(_WIN64) +#if defined(_LP64) #define CSIZE "64-Bit " #else #define CSIZE diff --git a/src/hotspot/share/prims/jvmtiAgent.cpp b/src/hotspot/share/prims/jvmtiAgent.cpp index 1231fd5019f..6dd205082a0 100644 --- a/src/hotspot/share/prims/jvmtiAgent.cpp +++ b/src/hotspot/share/prims/jvmtiAgent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, 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 @@ -27,6 +27,7 @@ #include "cds/cds_globals.hpp" #include "cds/cdsConfig.hpp" #include "jni.h" +#include "jvm.h" #include "jvm_io.h" #include "jvmtifiles/jvmtiEnv.hpp" #include "prims/jvmtiEnvBase.hpp" diff --git a/src/hotspot/share/prims/nativeLookup.cpp b/src/hotspot/share/prims/nativeLookup.cpp index 368d5eb264e..7de782c807b 100644 --- a/src/hotspot/share/prims/nativeLookup.cpp +++ b/src/hotspot/share/prims/nativeLookup.cpp @@ -250,9 +250,9 @@ static address lookup_special_native(const char* jni_name) { return nullptr; } -address NativeLookup::lookup_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, bool os_style, TRAPS) { +address NativeLookup::lookup_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, TRAPS) { address entry; - const char* jni_name = compute_complete_jni_name(pure_name, long_name, args_size, os_style); + const char* jni_name = compute_complete_jni_name(pure_name, long_name, args_size); // If the loader is null we have a system class, so we attempt a lookup in @@ -306,17 +306,10 @@ address NativeLookup::lookup_style(const methodHandle& method, char* pure_name, return entry; } -const char* NativeLookup::compute_complete_jni_name(const char* pure_name, const char* long_name, int args_size, bool os_style) { +const char* NativeLookup::compute_complete_jni_name(const char* pure_name, const char* long_name, int args_size) { stringStream st; - if (os_style) { - os::print_jni_name_prefix_on(&st, args_size); - } - st.print_raw(pure_name); st.print_raw(long_name); - if (os_style) { - os::print_jni_name_suffix_on(&st, args_size); - } return st.as_string(); } @@ -339,7 +332,7 @@ address NativeLookup::lookup_entry(const methodHandle& method, TRAPS) { + method->size_of_parameters(); // actual parameters // 1) Try JNI short style - entry = lookup_style(method, pure_name, "", args_size, true, CHECK_NULL); + entry = lookup_style(method, pure_name, "", args_size, CHECK_NULL); if (entry != nullptr) return entry; // Compute long name @@ -351,15 +344,7 @@ address NativeLookup::lookup_entry(const methodHandle& method, TRAPS) { } // 2) Try JNI long style - entry = lookup_style(method, pure_name, long_name, args_size, true, CHECK_NULL); - if (entry != nullptr) return entry; - - // 3) Try JNI short style without os prefix/suffix - entry = lookup_style(method, pure_name, "", args_size, false, CHECK_NULL); - if (entry != nullptr) return entry; - - // 4) Try JNI long style without os prefix/suffix - entry = lookup_style(method, pure_name, long_name, args_size, false, CHECK_NULL); + entry = lookup_style(method, pure_name, long_name, args_size, CHECK_NULL); return entry; // null indicates not found } diff --git a/src/hotspot/share/prims/nativeLookup.hpp b/src/hotspot/share/prims/nativeLookup.hpp index a24768024f7..b9615377e30 100644 --- a/src/hotspot/share/prims/nativeLookup.hpp +++ b/src/hotspot/share/prims/nativeLookup.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -34,12 +34,12 @@ class NativeLookup : AllStatic { private: // Style specific lookup - static address lookup_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, bool os_style, TRAPS); + static address lookup_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, TRAPS); static address lookup_base (const methodHandle& method, TRAPS); static address lookup_entry(const methodHandle& method, TRAPS); static address lookup_entry_prefixed(const methodHandle& method, TRAPS); - static const char* compute_complete_jni_name(const char* pure_name, const char* long_name, int args_size, bool os_style); + static const char* compute_complete_jni_name(const char* pure_name, const char* long_name, int args_size); public: // JNI name computation static char* pure_jni_name(const methodHandle& method); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 323b8d2df8d..2f665df5bba 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -882,10 +882,6 @@ class os: AllStatic { // Fills in path to jvm.dll/libjvm.so (used by the Disassembler) static void jvm_path(char *buf, jint buflen); - // JNI names - static void print_jni_name_prefix_on(outputStream* st, int args_size); - static void print_jni_name_suffix_on(outputStream* st, int args_size); - // Init os specific system properties values static void init_system_properties_values(); diff --git a/src/hotspot/share/runtime/sharedRuntimeTrans.cpp b/src/hotspot/share/runtime/sharedRuntimeTrans.cpp index 5285819ee96..78788d487b7 100644 --- a/src/hotspot/share/runtime/sharedRuntimeTrans.cpp +++ b/src/hotspot/share/runtime/sharedRuntimeTrans.cpp @@ -42,7 +42,7 @@ // Enabling optimizations in this file causes incorrect code to be // generated; can not figure out how to turn down optimization for one // file in the IDE on Windows -#ifdef WIN32 +#ifdef _WINDOWS # pragma warning( disable: 4748 ) // /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function # pragma optimize ( "", off ) #endif @@ -671,6 +671,6 @@ JRT_LEAF(jdouble, SharedRuntime::dpow(jdouble x, jdouble y)) return __ieee754_pow(x, y); JRT_END -#ifdef WIN32 +#ifdef _WINDOWS # pragma optimize ( "", on ) #endif diff --git a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp index 3b28328d7dd..237d12baa6d 100644 --- a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp +++ b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -48,6 +48,11 @@ #define _USE_MATH_DEFINES # include +// Only 64-bit Windows is supported +#ifndef _LP64 +#error unsupported platform +#endif + // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in // system header files. On 32-bit architectures, there is no problem. @@ -61,17 +66,11 @@ // pointer when it extracts the argument, then we may have a problem. // // Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0. -#ifdef _LP64 #undef NULL // 64-bit Windows uses a P64 data model (not LP64, although we define _LP64) // Since longs are 32-bit we cannot use 0L here. Use the Visual C++ specific // 64-bit integer-suffix (LL) instead. #define NULL 0LL -#else -#ifndef NULL -#define NULL 0 -#endif -#endif // NULL vs NULL_WORD: // On Linux NULL is defined as a special type '__null'. Assigning __null to @@ -79,11 +78,7 @@ // pointer is stored as integer value. #define NULL_WORD NULL -#ifdef _WIN64 typedef int64_t ssize_t; -#else -typedef int32_t ssize_t; -#endif // Non-standard stdlib-like stuff: inline int strcasecmp(const char *s1, const char *s2) { return _stricmp(s1,s2); } @@ -120,13 +115,8 @@ inline int g_isfinite(jdouble f) { return _finite(f); } #endif #ifndef SSIZE_MAX -#ifdef _LP64 #define SSIZE_MIN LLONG_MIN #define SSIZE_MAX LLONG_MAX -#else -#define SSIZE_MIN INT_MIN -#define SSIZE_MAX INT_MAX -#endif #endif // SSIZE_MAX missing #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP diff --git a/src/java.base/share/native/include/jni.h b/src/java.base/share/native/include/jni.h index 6bbc71ded1f..1a31c38b3ce 100644 --- a/src/java.base/share/native/include/jni.h +++ b/src/java.base/share/native/include/jni.h @@ -48,6 +48,8 @@ extern "C" { #endif +#define JNICALL + /* * JNI Types */ diff --git a/src/java.base/share/native/libjava/NativeLibraries.c b/src/java.base/share/native/libjava/NativeLibraries.c index 22986306017..df5ff343d61 100644 --- a/src/java.base/share/native/libjava/NativeLibraries.c +++ b/src/java.base/share/native/libjava/NativeLibraries.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -58,7 +58,6 @@ static jboolean initIDs(JNIEnv *env) return JNI_TRUE; } - /* * Support for finding JNI_On(Un)Load_ if it exists. * If cname == NULL then just find normal JNI_On(Un)Load entry point @@ -93,7 +92,11 @@ static void *findJniFunction(JNIEnv *env, void *handle, JNU_ThrowOutOfMemoryError(env, NULL); goto done; } - buildJniFunctionName(syms[i], cname, jniFunctionName); + strcpy(jniFunctionName, syms[i]); + if (cname != NULL) { + strcat(jniFunctionName, "_"); + strcat(jniFunctionName, cname); + } entryName = JVM_FindLibraryEntry(handle, jniFunctionName); free(jniFunctionName); if(entryName) { diff --git a/src/java.base/share/native/libjava/jni_util.h b/src/java.base/share/native/libjava/jni_util.h index 3c73e90d62c..89414697328 100644 --- a/src/java.base/share/native/libjava/jni_util.h +++ b/src/java.base/share/native/libjava/jni_util.h @@ -356,9 +356,6 @@ JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name); void* getProcessHandle(); -void buildJniFunctionName(const char *sym, const char *cname, - char *jniEntryName); - jstring getLastErrorString(JNIEnv *env); JNIEXPORT int JNICALL diff --git a/src/java.base/unix/native/include/jni_md.h b/src/java.base/unix/native/include/jni_md.h index 6e583da7147..b4ed87e0c48 100644 --- a/src/java.base/unix/native/include/jni_md.h +++ b/src/java.base/unix/native/include/jni_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, 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 @@ -52,8 +52,6 @@ #define JNIIMPORT #endif -#define JNICALL - typedef int jint; #ifdef _LP64 typedef long jlong; diff --git a/src/java.base/unix/native/libjava/jni_util_md.c b/src/java.base/unix/native/libjava/jni_util_md.c index 32b477aa7ac..7195b3defdf 100644 --- a/src/java.base/unix/native/libjava/jni_util_md.c +++ b/src/java.base/unix/native/libjava/jni_util_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, 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 @@ -51,15 +51,6 @@ void* getProcessHandle() { return procHandle; } -void buildJniFunctionName(const char *sym, const char *cname, - char *jniEntryName) { - strcpy(jniEntryName, sym); - if (cname != NULL) { - strcat(jniEntryName, "_"); - strcat(jniEntryName, cname); - } -} - jstring getLastErrorString(JNIEnv *env) { diff --git a/src/java.base/windows/native/include/jni_md.h b/src/java.base/windows/native/include/jni_md.h index f795421937e..6d217733d82 100644 --- a/src/java.base/windows/native/include/jni_md.h +++ b/src/java.base/windows/native/include/jni_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, 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 @@ -30,7 +30,6 @@ #define JNIEXPORT __declspec(dllexport) #endif #define JNIIMPORT __declspec(dllimport) -#define JNICALL __stdcall typedef int jint; typedef long long jlong; diff --git a/src/java.base/windows/native/libjava/gdefs_md.h b/src/java.base/windows/native/libjava/gdefs_md.h index 24cc95ff0e7..d7c0e6552a3 100644 --- a/src/java.base/windows/native/libjava/gdefs_md.h +++ b/src/java.base/windows/native/libjava/gdefs_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, 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 @@ -28,8 +28,3 @@ */ #include -#ifndef _WIN64 -typedef int intptr_t; -typedef unsigned int uintptr_t; -typedef unsigned long DWORD_PTR, *PDWORD_PTR; -#endif diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/native/libjava/java_props_md.c index d26d6df1aff..03d0acdae1e 100644 --- a/src/java.base/windows/native/libjava/java_props_md.c +++ b/src/java.base/windows/native/libjava/java_props_md.c @@ -552,8 +552,6 @@ GetJavaProperties(JNIEnv* env) sprops.os_version = _strdup(buf); #if defined(_M_AMD64) sprops.os_arch = "amd64"; -#elif defined(_X86_) - sprops.os_arch = "x86"; #elif defined(_M_ARM64) sprops.os_arch = "aarch64"; #else diff --git a/src/java.base/windows/native/libjava/jlong_md.h b/src/java.base/windows/native/libjava/jlong_md.h index 0e3da8f4947..a5db712b0b0 100644 --- a/src/java.base/windows/native/libjava/jlong_md.h +++ b/src/java.base/windows/native/libjava/jlong_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -63,15 +63,8 @@ /* For static variables initialized to zero */ #define jlong_zero_init ((jlong) 0) -#ifdef _WIN64 #define jlong_to_ptr(a) ((void*)(a)) #define ptr_to_jlong(a) ((jlong)(a)) -#else -/* Double casting to avoid warning messages looking for casting of */ -/* smaller sizes into pointers */ -#define jlong_to_ptr(a) ((void*)(int)(a)) -#define ptr_to_jlong(a) ((jlong)(int)(a)) -#endif #define jint_to_jlong(a) ((jlong)(a)) #define jlong_to_jint(a) ((jint)(a)) diff --git a/src/java.base/windows/native/libjava/jni_util_md.c b/src/java.base/windows/native/libjava/jni_util_md.c index 9c64a339aad..672f719bc81 100644 --- a/src/java.base/windows/native/libjava/jni_util_md.c +++ b/src/java.base/windows/native/libjava/jni_util_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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 @@ -35,34 +35,6 @@ void* getProcessHandle() { return (void*)GetModuleHandle(NULL); } -/* - * Windows symbols can be simple like JNI_OnLoad or __stdcall format - * like _JNI_OnLoad@8. We need to handle both. - */ -void buildJniFunctionName(const char *sym, const char *cname, - char *jniEntryName) { - if (cname != NULL) { - char *p = strrchr(sym, '@'); - if (p != NULL && p != sym) { - // sym == _JNI_OnLoad@8 - strncpy(jniEntryName, sym, (p - sym)); - jniEntryName[(p-sym)] = '\0'; - // jniEntryName == _JNI_OnLoad - strcat(jniEntryName, "_"); - strcat(jniEntryName, cname); - strcat(jniEntryName, p); - //jniEntryName == _JNI_OnLoad_cname@8 - } else { - strcpy(jniEntryName, sym); - strcat(jniEntryName, "_"); - strcat(jniEntryName, cname); - } - } else { - strcpy(jniEntryName, sym); - } - return; -} - jstring getLastErrorString(JNIEnv *env) { diff --git a/src/java.base/windows/native/libjli/java_md.c b/src/java.base/windows/native/libjli/java_md.c index a1012bcc4f9..c4d38a02831 100644 --- a/src/java.base/windows/native/libjli/java_md.c +++ b/src/java.base/windows/native/libjli/java_md.c @@ -681,7 +681,7 @@ void* SplashProcAddress(const char* name) { /* * Signature adapter for _beginthreadex(). */ -static unsigned __stdcall ThreadJavaMain(void* args) { +static unsigned ThreadJavaMain(void* args) { return (unsigned)JavaMain(args); } diff --git a/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c b/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c index 96a3f5ad5c1..deea97dcceb 100644 --- a/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c +++ b/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -69,9 +69,7 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject static struct timeval zerotime = {0, 0}; int read_count = 0, write_count = 0, except_count = 0; -#ifdef _WIN64 int resultbuf[FD_SETSIZE + 1]; -#endif if (timeout == 0) { tv = &zerotime; @@ -121,7 +119,6 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject /* Return selected sockets. */ /* Each Java array consists of sockets count followed by sockets list */ -#ifdef _WIN64 resultbuf[0] = readfds->fd_count; for (i = 0; i < (int)readfds->fd_count; i++) { resultbuf[i + 1] = (int)readfds->fd_array[i]; @@ -142,15 +139,7 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject } (*env)->SetIntArrayRegion(env, returnExceptFds, 0, exceptfds->fd_count + 1, resultbuf); -#else - (*env)->SetIntArrayRegion(env, returnReadFds, 0, - readfds->fd_count + 1, (jint *)readfds); - (*env)->SetIntArrayRegion(env, returnWriteFds, 0, - writefds->fd_count + 1, (jint *)writefds); - (*env)->SetIntArrayRegion(env, returnExceptFds, 0, - exceptfds->fd_count + 1, (jint *)exceptfds); -#endif return 0; } diff --git a/src/java.base/windows/native/libnio/ch/nio_util.h b/src/java.base/windows/native/libnio/ch/nio_util.h index b90e0ac63d5..e7bef3d39cb 100644 --- a/src/java.base/windows/native/libnio/ch/nio_util.h +++ b/src/java.base/windows/native/libnio/ch/nio_util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -47,26 +47,14 @@ jint convertReturnVal(JNIEnv *env, jint n, jboolean r); jlong convertLongReturnVal(JNIEnv *env, jlong n, jboolean r); jboolean purgeOutstandingICMP(JNIEnv *env, jclass clazz, jint fd); -#ifdef _WIN64 - struct iovec { jlong iov_base; jint iov_len; }; -#else - -struct iovec { - jint iov_base; - jint iov_len; -}; - -#endif - /* Defined in UnixDomainSockets.c */ jbyteArray sockaddrToUnixAddressBytes(JNIEnv *env, struct sockaddr_un *sa, socklen_t len); jint unixSocketAddressToSockaddr(JNIEnv *env, jbyteArray uaddr, struct sockaddr_un *sa, int *len); - diff --git a/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c b/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c index 333231c508f..4f973a7037d 100644 --- a/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c +++ b/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, 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 @@ -849,16 +849,6 @@ PCPathDone(PathConsumerVec *consumer) return oom; } -/* - * REMIND: CDECL needed for WIN32 "qsort" - */ - -#ifdef _WIN32 -#define CDECL __cdecl -#else -#define CDECL -#endif - #define SUBDIVIDE_MAX 10 #define MAX_FLAT_SQ (1.0 * 1.0) #define GROW_SIZE 20 @@ -1171,7 +1161,7 @@ subdivideCubic(pathData *pd, int level, return appendSegment(pd, x0, y0, x3, y3); } -static int CDECL +static int sortSegmentsByLeadingY(const void *elem1, const void *elem2) { segmentData *seg1 = *(segmentData **)elem1; diff --git a/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp b/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp index fad778dac4e..ec5a1b4c54e 100644 --- a/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp +++ b/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp @@ -41,53 +41,53 @@ #define GREEN_SHIFT 8 -typedef HRESULT(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme); +typedef HRESULT(*PFNCLOSETHEMEDATA)(HTHEME hTheme); -typedef HRESULT(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, +typedef HRESULT(*PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect); -typedef HTHEME(__stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList); -typedef HTHEME(__stdcall *PFNOPENTHEMEDATAFORDPI)(HWND hwnd, LPCWSTR pszClassList, UINT dpi); +typedef HTHEME(*PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList); +typedef HTHEME(*PFNOPENTHEMEDATAFORDPI)(HWND hwnd, LPCWSTR pszClassList, UINT dpi); -typedef HRESULT (__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc, +typedef HRESULT (*PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect); -typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme, +typedef HRESULT (*PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect); -typedef HRESULT (__stdcall *PFNGETTHEMEMARGINS)(HTHEME hTheme, +typedef HRESULT (*PFNGETTHEMEMARGINS)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins); -typedef BOOL (__stdcall *PFNISTHEMEPARTDEFINED)(HTHEME hTheme, int iPartId, int iStateId); +typedef BOOL (*PFNISTHEMEPARTDEFINED)(HTHEME hTheme, int iPartId, int iStateId); -typedef HRESULT (__stdcall *PFNGETTHEMEBOOL)(HTHEME hTheme, int iPartId, +typedef HRESULT (*PFNGETTHEMEBOOL)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, BOOL *pfVal); -typedef BOOL (__stdcall *PFNGETTHEMESYSBOOL)(HTHEME hTheme, int iPropId); +typedef BOOL (*PFNGETTHEMESYSBOOL)(HTHEME hTheme, int iPropId); -typedef HRESULT (__stdcall *PFNGETTHEMECOLOR)(HTHEME hTheme, int iPartId, +typedef HRESULT (*PFNGETTHEMECOLOR)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor); -typedef HRESULT (__stdcall *PFNGETTHEMEENUMVALUE)(HTHEME hTheme, int iPartId, +typedef HRESULT (*PFNGETTHEMEENUMVALUE)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *val); -typedef HRESULT (__stdcall *PFNGETTHEMEINT)(HTHEME hTheme, int iPartId, +typedef HRESULT (*PFNGETTHEMEINT)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *val); -typedef HRESULT (__stdcall *PFNGETTHEMEPARTSIZE)(HTHEME hTheme, HDC hdc, +typedef HRESULT (*PFNGETTHEMEPARTSIZE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *size); -typedef HRESULT (__stdcall *PFNGETTHEMEPOSITION)(HTHEME hTheme, int iPartId, +typedef HRESULT (*PFNGETTHEMEPOSITION)(HTHEME hTheme, int iPartId, int iStateId, int propID, POINT *point); -typedef HRESULT(__stdcall *PFNSETWINDOWTHEME)(HWND hwnd, LPCWSTR pszSubAppName, +typedef HRESULT(*PFNSETWINDOWTHEME)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList); -typedef BOOL (__stdcall *PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT) +typedef BOOL (*PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT) (HTHEME hTheme, int iPartId, int iStateId); -typedef HRESULT (__stdcall *PFNGETTHEMETRANSITIONDURATION) +typedef HRESULT (*PFNGETTHEMETRANSITIONDURATION) (HTHEME hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, DWORD *pdwDuration); diff --git a/src/java.desktop/windows/native/libawt/windows/alloc.h b/src/java.desktop/windows/native/libawt/windows/alloc.h index 4c92c12cbca..a5796df40b1 100644 --- a/src/java.desktop/windows/native/libawt/windows/alloc.h +++ b/src/java.desktop/windows/native/libawt/windows/alloc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -117,7 +117,7 @@ void handle_bad_alloc(void); void *safe_Malloc_outofmem(size_t size, const char *, int); void *safe_Calloc_outofmem(size_t num, size_t size, const char *, int); void *safe_Realloc_outofmem(void *memblock, size_t size, const char *, int); - void * CDECL operator new(size_t size, const char *, int); + void * operator new(size_t size, const char *, int); #define safe_Malloc(size) \ safe_Malloc_outofmem(size, __FILE__, __LINE__) diff --git a/src/java.desktop/windows/native/libawt/windows/awt.h b/src/java.desktop/windows/native/libawt/windows/awt.h index 3703bfbb0cb..b6289dcae68 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt.h +++ b/src/java.desktop/windows/native/libawt/windows/awt.h @@ -154,15 +154,6 @@ typedef AwtObject* PDATA; JNI_TRUE) /* /NEW JNI */ -/* - * IS_WIN64 returns TRUE on 64-bit Itanium - */ -#if defined (_WIN64) - #define IS_WIN64 TRUE -#else - #define IS_WIN64 FALSE -#endif - /* * IS_WIN2000 returns TRUE on 2000, XP and Vista * IS_WINXP returns TRUE on XP and Vista @@ -195,35 +186,6 @@ extern JavaVM *jvm; #define JNU_GetStringPlatformChars(env, x, y) reinterpret_cast(env->GetStringChars(x, y)) #define JNU_ReleaseStringPlatformChars(env, x, y) env->ReleaseStringChars(x, reinterpret_cast(y)) -/* - * Itanium symbols needed for 64-bit compilation. - * These are defined in winuser.h in the August 2001 MSDN update. - */ -#ifndef GCLP_HBRBACKGROUND - #ifdef _WIN64 - #error Macros for GetClassLongPtr, etc. are for 32-bit windows only - #endif /* !_WIN64 */ - #define GetClassLongPtr GetClassLong - #define SetClassLongPtr SetClassLong - #define GCLP_HBRBACKGROUND GCL_HBRBACKGROUND - #define GCLP_HCURSOR GCL_HCURSOR - #define GCLP_HICON GCL_HICON - #define GCLP_HICONSM GCL_HICONSM - #define GCLP_HMODULE GCL_HMODULE - #define GCLP_MENUNAME GCL_MENUNAME - #define GCLP_WNDPROC GCL_WNDPROC - #define GetWindowLongPtr GetWindowLong - #define SetWindowLongPtr SetWindowLong - #define GWLP_WNDPROC GWL_WNDPROC - #define GWLP_HINSTANCE GWL_HINSTANCE - #define GWLP_HWNDPARENT GWL_HWNDPARENT - #define GWLP_ID GWL_ID - #define GWLP_USERDATA GWL_USERDATA - #define DWLP_DLGPROC DWL_DLGPROC - #define DWLP_MSGRESULT DWL_MSGRESULT - #define DWLP_USER DWL_USER -#endif /* !GCLP_HBRBACKGROUND */ - /* * macros for saving and restoring FPU control word * NOTE: float.h must be defined if using these macros diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp index 3b8043385a1..b6e8b2c2e0e 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp @@ -160,11 +160,7 @@ void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int l // if clicked Yes, break into the debugger if ( ret == IDYES ) { - # if defined(_M_IX86) - _asm { int 3 }; - # else - DebugBreak(); - # endif + DebugBreak(); } // otherwise, try to continue execution } diff --git a/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp b/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp index 2c67b65cc41..a329f5b84b3 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp @@ -71,8 +71,8 @@ typedef std::map CDataMap; java_awt_event_InputEvent_BUTTON3_DOWN_MASK) extern "C" { -DWORD __cdecl convertActionsToDROPEFFECT(jint actions); -jint __cdecl convertDROPEFFECTToActions(DWORD effects); +DWORD convertActionsToDROPEFFECT(jint actions); +jint convertDROPEFFECTToActions(DWORD effects); } class PictureDragHelper @@ -525,8 +525,7 @@ void AwtDragSource::SetCursor(jobject cursor) { * MatchFormatEtc */ -HRESULT __stdcall -AwtDragSource::MatchFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, +HRESULT AwtDragSource::MatchFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC *cacheEnt) { TRY; @@ -586,7 +585,7 @@ AwtDragSource::MatchFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, * QueryInterface */ -HRESULT __stdcall AwtDragSource::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { +HRESULT AwtDragSource::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { TRY; if (riid == IID_IUnknown) { @@ -613,7 +612,7 @@ HRESULT __stdcall AwtDragSource::QueryInterface(REFIID riid, void __RPC_FAR *__R * AddRef */ -ULONG __stdcall AwtDragSource::AddRef() { +ULONG AwtDragSource::AddRef() { return (ULONG)++m_refs; } @@ -621,7 +620,7 @@ ULONG __stdcall AwtDragSource::AddRef() { * Release */ -ULONG __stdcall AwtDragSource::Release() { +ULONG AwtDragSource::Release() { int refs; if ((refs = --m_refs) == 0) delete this; @@ -633,7 +632,7 @@ ULONG __stdcall AwtDragSource::Release() { * QueryContinueDrag */ -HRESULT __stdcall AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState) { +HRESULT AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -687,7 +686,7 @@ HRESULT __stdcall AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWOR * GiveFeedback */ -HRESULT __stdcall AwtDragSource::GiveFeedback(DWORD dwEffect) { +HRESULT AwtDragSource::GiveFeedback(DWORD dwEffect) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -766,7 +765,7 @@ HRESULT __stdcall AwtDragSource::GiveFeedback(DWORD dwEffect) { * GetData */ -HRESULT __stdcall AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc, +HRESULT AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -941,7 +940,7 @@ HRESULT __stdcall AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc, * GetDataHere */ -HRESULT __stdcall AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc, +HRESULT AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -1045,7 +1044,7 @@ HRESULT __stdcall AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc, * QueryGetData */ -HRESULT __stdcall AwtDragSource::QueryGetData(FORMATETC __RPC_FAR *pFormatEtc) { +HRESULT AwtDragSource::QueryGetData(FORMATETC __RPC_FAR *pFormatEtc) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -1059,7 +1058,7 @@ HRESULT __stdcall AwtDragSource::QueryGetData(FORMATETC __RPC_FAR *pFormatEtc) * GetCanonicalFormatEtc */ -HRESULT __stdcall AwtDragSource::GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut) { +HRESULT AwtDragSource::GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -1080,7 +1079,7 @@ HRESULT __stdcall AwtDragSource::GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFo * SetData */ -HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) { +HRESULT AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) { AwtToolkit::GetInstance().eventNumber++; if (pFormatEtc->cfFormat == CF_PERFORMEDDROPEFFECT && pmedium->tymed == TYMED_HGLOBAL) { m_dwPerformedDropEffect = *(DWORD*)::GlobalLock(pmedium->hGlobal); @@ -1103,7 +1102,7 @@ HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMED * EnumFormatEtc */ -HRESULT __stdcall AwtDragSource::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc) { +HRESULT AwtDragSource::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc) { AwtToolkit::GetInstance().eventNumber++; TRY; @@ -1117,7 +1116,7 @@ HRESULT __stdcall AwtDragSource::EnumFormatEtc(DWORD dwDirection, IEnumFORMATET * DAdvise */ -HRESULT __stdcall AwtDragSource::DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection) { +HRESULT AwtDragSource::DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection) { AwtToolkit::GetInstance().eventNumber++; return E_NOTIMPL; } @@ -1126,7 +1125,7 @@ HRESULT __stdcall AwtDragSource::DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD * DUnadvise */ -HRESULT __stdcall AwtDragSource::DUnadvise(DWORD dwConnection) { +HRESULT AwtDragSource::DUnadvise(DWORD dwConnection) { AwtToolkit::GetInstance().eventNumber++; return OLE_E_ADVISENOTSUPPORTED; } @@ -1135,7 +1134,7 @@ HRESULT __stdcall AwtDragSource::DUnadvise(DWORD dwConnection) { * EnumAdvise */ -HRESULT __stdcall AwtDragSource::EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise) { +HRESULT AwtDragSource::EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise) { AwtToolkit::GetInstance().eventNumber++; return OLE_E_ADVISENOTSUPPORTED; } @@ -1143,7 +1142,7 @@ HRESULT __stdcall AwtDragSource::EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR const UINT AwtDragSource::PROCESS_ID_FORMAT = ::RegisterClipboardFormat(TEXT("_SUNW_JAVA_AWT_PROCESS_ID")); -HRESULT __stdcall AwtDragSource::GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) { +HRESULT AwtDragSource::GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) { AwtToolkit::GetInstance().eventNumber++; if ((pFormatEtc->tymed & TYMED_HGLOBAL) == 0) { return DV_E_TYMED; @@ -1294,7 +1293,7 @@ AwtDragSource::ADSIEnumFormatEtc::~ADSIEnumFormatEtc() { * QueryInterface */ -HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { +HRESULT AwtDragSource::ADSIEnumFormatEtc::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { TRY; if (riid == IID_IUnknown) { @@ -1317,7 +1316,7 @@ HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::QueryInterface(REFIID riid, * AddRef */ -ULONG __stdcall AwtDragSource::ADSIEnumFormatEtc::AddRef(void) { +ULONG AwtDragSource::ADSIEnumFormatEtc::AddRef(void) { return (ULONG)++m_refs; } @@ -1325,7 +1324,7 @@ ULONG __stdcall AwtDragSource::ADSIEnumFormatEtc::AddRef(void) { * Release */ -ULONG __stdcall AwtDragSource::ADSIEnumFormatEtc::Release(void) { +ULONG AwtDragSource::ADSIEnumFormatEtc::Release(void) { int refs; if ((refs = --m_refs) == 0) delete this; @@ -1337,7 +1336,7 @@ ULONG __stdcall AwtDragSource::ADSIEnumFormatEtc::Release(void) { * Next */ -HRESULT _stdcall AwtDragSource::ADSIEnumFormatEtc::Next(ULONG celt, FORMATETC __RPC_FAR *rgelt, ULONG __RPC_FAR *pceltFetched) { +HRESULT AwtDragSource::ADSIEnumFormatEtc::Next(ULONG celt, FORMATETC __RPC_FAR *rgelt, ULONG __RPC_FAR *pceltFetched) { TRY; unsigned int len = m_parent->getNTypes(); @@ -1359,7 +1358,7 @@ HRESULT _stdcall AwtDragSource::ADSIEnumFormatEtc::Next(ULONG celt, FORMATETC __ * Skip */ -HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::Skip(ULONG celt) { +HRESULT AwtDragSource::ADSIEnumFormatEtc::Skip(ULONG celt) { TRY; unsigned int len = m_parent->getNTypes(); @@ -1382,7 +1381,7 @@ HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::Skip(ULONG celt) { * Reset */ -HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::Reset(void) { +HRESULT AwtDragSource::ADSIEnumFormatEtc::Reset(void) { m_idx = 0; return S_OK; @@ -1392,7 +1391,7 @@ HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::Reset(void) { * Clone */ -HRESULT __stdcall AwtDragSource::ADSIEnumFormatEtc::Clone(IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenum) { +HRESULT AwtDragSource::ADSIEnumFormatEtc::Clone(IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenum) { TRY; *ppenum = new ADSIEnumFormatEtc(m_parent); @@ -1484,7 +1483,7 @@ AwtDragSource::ADSIStreamProxy::~ADSIStreamProxy() { * QueryInterface */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { +HRESULT AwtDragSource::ADSIStreamProxy::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { TRY; if (riid == IID_IUnknown) { @@ -1507,7 +1506,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::QueryInterface(REFIID riid, v * AddRef */ -ULONG __stdcall AwtDragSource::ADSIStreamProxy::AddRef(void) { +ULONG AwtDragSource::ADSIStreamProxy::AddRef(void) { return (ULONG)++m_refs; } @@ -1515,7 +1514,7 @@ ULONG __stdcall AwtDragSource::ADSIStreamProxy::AddRef(void) { * Release */ -ULONG __stdcall AwtDragSource::ADSIStreamProxy::Release(void) { +ULONG AwtDragSource::ADSIStreamProxy::Release(void) { int refs; if ((refs = --m_refs) == 0) delete this; @@ -1527,7 +1526,7 @@ ULONG __stdcall AwtDragSource::ADSIStreamProxy::Release(void) { * Read */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead) { +HRESULT AwtDragSource::ADSIStreamProxy::Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead) { TRY; unsigned int rem = m_blen - m_off; @@ -1552,7 +1551,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Read(void __RPC_FAR *pv, ULON * Write */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten) { +HRESULT AwtDragSource::ADSIStreamProxy::Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten) { TRY; if (pcbWritten != (ULONG __RPC_FAR *)NULL) { @@ -1570,7 +1569,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Write(const void __RPC_FAR *p * Seek */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition) { +HRESULT AwtDragSource::ADSIStreamProxy::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition) { TRY; if (dlibMove.HighPart != 0) return STG_E_INVALIDPOINTER; @@ -1618,7 +1617,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Seek(LARGE_INTEGER dlibMove, * SetSize */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::SetSize(ULARGE_INTEGER libNewSize) { +HRESULT AwtDragSource::ADSIStreamProxy::SetSize(ULARGE_INTEGER libNewSize) { return STG_E_INVALIDFUNCTION; } @@ -1626,7 +1625,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::SetSize(ULARGE_INTEGER libNew * CopyTo */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) { +HRESULT AwtDragSource::ADSIStreamProxy::CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) { TRY; ULONG written = 0; @@ -1659,7 +1658,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::CopyTo(IStream __RPC_FAR *pst * Commit */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Commit(DWORD grfCommitFlags) { +HRESULT AwtDragSource::ADSIStreamProxy::Commit(DWORD grfCommitFlags) { return S_OK; } @@ -1667,7 +1666,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Commit(DWORD grfCommitFlags) * Revert */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Revert() { +HRESULT AwtDragSource::ADSIStreamProxy::Revert() { return S_OK; } @@ -1675,7 +1674,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Revert() { * LockRegion */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { +HRESULT AwtDragSource::ADSIStreamProxy::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { return STG_E_INVALIDFUNCTION; } @@ -1683,7 +1682,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::LockRegion(ULARGE_INTEGER lib * UnlockRegion */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { +HRESULT AwtDragSource::ADSIStreamProxy::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { return STG_E_INVALIDFUNCTION; } @@ -1691,7 +1690,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::UnlockRegion(ULARGE_INTEGER l * Stat */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag) { +HRESULT AwtDragSource::ADSIStreamProxy::Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag) { TRY; *pstatstg = m_statstg; @@ -1707,7 +1706,7 @@ HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Stat(STATSTG __RPC_FAR *pstat * Clone */ -HRESULT __stdcall AwtDragSource::ADSIStreamProxy::Clone(IStream __RPC_FAR *__RPC_FAR *ppstm) { +HRESULT AwtDragSource::ADSIStreamProxy::Clone(IStream __RPC_FAR *__RPC_FAR *ppstm) { TRY; *ppstm = new ADSIStreamProxy(this); diff --git a/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h b/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h index 6b22b46cd7c..ba41d81da82 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h @@ -53,33 +53,33 @@ class AwtDragSource : virtual public IDropSource, virtual public IDataObject { // IUnknown - virtual HRESULT __stdcall QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); + virtual HRESULT QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); - virtual ULONG __stdcall AddRef(void); - virtual ULONG __stdcall Release(void); + virtual ULONG AddRef(void); + virtual ULONG Release(void); // IDropSource - virtual HRESULT __stdcall QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState); + virtual HRESULT QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState); - virtual HRESULT __stdcall GiveFeedback(DWORD dwEffect); + virtual HRESULT GiveFeedback(DWORD dwEffect); // IDataObject - virtual HRESULT __stdcall GetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium); - virtual HRESULT __stdcall GetDataHere(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium); + virtual HRESULT GetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium); + virtual HRESULT GetDataHere(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium); - virtual HRESULT __stdcall QueryGetData(FORMATETC __RPC_FAR *pFormatEtc); + virtual HRESULT QueryGetData(FORMATETC __RPC_FAR *pFormatEtc); - virtual HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut); + virtual HRESULT GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut); - virtual HRESULT __stdcall SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease); + virtual HRESULT SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease); - virtual HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc); + virtual HRESULT EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc); - virtual HRESULT __stdcall DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection); - virtual HRESULT __stdcall DUnadvise(DWORD dwConnection); - virtual HRESULT __stdcall EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise); + virtual HRESULT DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection); + virtual HRESULT DUnadvise(DWORD dwConnection); + virtual HRESULT EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise); // AwtDragSource @@ -104,7 +104,7 @@ class AwtDragSource : virtual public IDropSource, virtual public IDataObject { INLINE void Signal() { ::ReleaseMutex(m_mutex); } - virtual HRESULT __stdcall GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium); + virtual HRESULT GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium); protected: INLINE void WaitUntilSignalled(BOOL retain) { @@ -117,14 +117,14 @@ class AwtDragSource : virtual public IDropSource, virtual public IDataObject { static void _DoDragDrop(void* param); - HRESULT __stdcall MatchFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC *cacheEnt); + HRESULT MatchFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC *cacheEnt); private: void LoadCache(jlongArray formats); void UnloadCache(); - static int __cdecl _compar(const void *, const void *); + static int _compar(const void *, const void *); static void call_dSCenter(JNIEnv* env, jobject self, jint targetActions, jint modifiers, POINT pt); @@ -151,17 +151,17 @@ class AwtDragSource : virtual public IDropSource, virtual public IDataObject { // IUnknown - virtual HRESULT __stdcall QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); + virtual HRESULT QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); - virtual ULONG __stdcall AddRef(void); - virtual ULONG __stdcall Release(void); + virtual ULONG AddRef(void); + virtual ULONG Release(void); // IEnumFORMATETC - virtual HRESULT _stdcall Next(ULONG celt, FORMATETC __RPC_FAR *rgelt, ULONG __RPC_FAR *pceltFetched); - virtual HRESULT _stdcall Skip(ULONG celt); - virtual HRESULT _stdcall Reset(); - virtual HRESULT _stdcall Clone(IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenum); + virtual HRESULT Next(ULONG celt, FORMATETC __RPC_FAR *rgelt, ULONG __RPC_FAR *pceltFetched); + virtual HRESULT Skip(ULONG celt); + virtual HRESULT Reset(); + virtual HRESULT Clone(IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenum); private: AwtDragSource* m_parent; @@ -181,35 +181,35 @@ class AwtDragSource : virtual public IDropSource, virtual public IDataObject { // IUnknown - virtual HRESULT __stdcall QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); + virtual HRESULT QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); - virtual ULONG __stdcall AddRef(void); - virtual ULONG __stdcall Release(void); + virtual ULONG AddRef(void); + virtual ULONG Release(void); // IStream - virtual HRESULT __stdcall Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead); + virtual HRESULT Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead); - virtual HRESULT __stdcall Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten); + virtual HRESULT Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten); - virtual HRESULT __stdcall Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition); + virtual HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition); - virtual HRESULT __stdcall SetSize(ULARGE_INTEGER libNewSize); + virtual HRESULT SetSize(ULARGE_INTEGER libNewSize); - virtual HRESULT __stdcall CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten); + virtual HRESULT CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten); - virtual HRESULT __stdcall Commit(DWORD grfCommitFlags); + virtual HRESULT Commit(DWORD grfCommitFlags); - virtual HRESULT __stdcall Revert(); + virtual HRESULT Revert(); - virtual HRESULT __stdcall LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); + virtual HRESULT LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); - virtual HRESULT __stdcall UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); + virtual HRESULT UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); - virtual HRESULT __stdcall Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag); + virtual HRESULT Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag); - virtual HRESULT __stdcall Clone(IStream __RPC_FAR *__RPC_FAR *ppstm); + virtual HRESULT Clone(IStream __RPC_FAR *__RPC_FAR *ppstm); protected: AwtDragSource* m_parent; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp b/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp index b33a45a4b07..55d1ecad70f 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -42,9 +42,9 @@ // forwards extern "C" { - DWORD __cdecl convertActionsToDROPEFFECT(jint actions); - jint __cdecl convertDROPEFFECTToActions(DWORD effects); - DWORD __cdecl mapModsToDROPEFFECT(DWORD, DWORD); + DWORD convertActionsToDROPEFFECT(jint actions); + jint convertDROPEFFECTToActions(DWORD effects); + DWORD mapModsToDROPEFFECT(DWORD, DWORD); } // extern "C" @@ -95,7 +95,7 @@ AwtDropTarget::~AwtDropTarget() { * QueryInterface */ -HRESULT __stdcall AwtDropTarget::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { +HRESULT AwtDropTarget::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { if ( IID_IUnknown == riid || IID_IDropTarget == riid ) { @@ -111,7 +111,7 @@ HRESULT __stdcall AwtDropTarget::QueryInterface(REFIID riid, void __RPC_FAR *__R * AddRef */ -ULONG __stdcall AwtDropTarget::AddRef() { +ULONG AwtDropTarget::AddRef() { return (ULONG)++m_refs; } @@ -119,7 +119,7 @@ ULONG __stdcall AwtDropTarget::AddRef() { * Release */ -ULONG __stdcall AwtDropTarget::Release() { +ULONG AwtDropTarget::Release() { int refs; if ((refs = --m_refs) == 0) delete this; @@ -141,7 +141,7 @@ static void ScaleDown(POINT &cp, HWND m_window) { * DragEnter */ -HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) { +HRESULT AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) { TRY; AwtToolkit::GetInstance().isDnDTargetActive = TRUE; if (NULL != m_pIDropTargetHelper) { @@ -225,7 +225,7 @@ HRESULT __stdcall AwtDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWOR * DragOver */ -HRESULT __stdcall AwtDropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) { +HRESULT AwtDropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) { TRY; if (NULL != m_pIDropTargetHelper) { m_pIDropTargetHelper->DragOver( @@ -282,7 +282,7 @@ HRESULT __stdcall AwtDropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD __ * DragLeave */ -HRESULT __stdcall AwtDropTarget::DragLeave() { +HRESULT AwtDropTarget::DragLeave() { TRY_NO_VERIFY; if (NULL != m_pIDropTargetHelper) { m_pIDropTargetHelper->DragLeave(); @@ -323,7 +323,7 @@ HRESULT __stdcall AwtDropTarget::DragLeave() { * Drop */ -HRESULT __stdcall AwtDropTarget::Drop(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) { +HRESULT AwtDropTarget::Drop(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) { TRY; if (NULL != m_pIDropTargetHelper) { m_pIDropTargetHelper->Drop( @@ -1003,7 +1003,7 @@ jobject AwtDropTarget::GetData(jlong fmt) * */ -int __cdecl AwtDropTarget::_compar(const void* first, const void* second) { +int AwtDropTarget::_compar(const void* first, const void* second) { FORMATETC *fp = (FORMATETC *)first; FORMATETC *sp = (FORMATETC *)second; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h b/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h index 865c016698b..fc500965315 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -49,18 +49,18 @@ class AwtDropTarget : virtual public IDropTarget { // IUnknown - virtual HRESULT __stdcall QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); + virtual HRESULT QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); - virtual ULONG __stdcall AddRef(void); - virtual ULONG __stdcall Release(void); + virtual ULONG AddRef(void); + virtual ULONG Release(void); // IDropTarget - virtual HRESULT __stdcall DragEnter(IDataObject __RPC_FAR *pDataObject, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); - virtual HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); - virtual HRESULT __stdcall DragLeave(void); + virtual HRESULT DragEnter(IDataObject __RPC_FAR *pDataObject, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); + virtual HRESULT DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); + virtual HRESULT DragLeave(void); - virtual HRESULT __stdcall Drop(IDataObject __RPC_FAR *pDataObject, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); + virtual HRESULT Drop(IDataObject __RPC_FAR *pDataObject, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); // AwtDropTarget @@ -186,7 +186,7 @@ class AwtDropTarget : virtual public IDropTarget { static const unsigned int CACHE_INCR; - static int __cdecl _compar(const void *, const void *); + static int _compar(const void *, const void *); }; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp index 5d7171addb4..b467a685516 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp @@ -2195,7 +2195,7 @@ bool AwtToolkit::PreloadThread::Terminate(bool wrongThread) return true; } -bool AwtToolkit::PreloadThread::InvokeAndTerminate(void(_cdecl *fn)(void *), void *param) +bool AwtToolkit::PreloadThread::InvokeAndTerminate(void(*fn)(void *), void *param) { CriticalSection::Lock lock(threadLock); @@ -2225,7 +2225,7 @@ unsigned WINAPI AwtToolkit::PreloadThread::StaticThreadProc(void *param) unsigned AwtToolkit::PreloadThread::ThreadProc() { - void(_cdecl *_execFunc)(void *) = NULL; + void(*_execFunc)(void *) = NULL; void *_execParam = NULL; bool _wrongThread = false; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h index 4a4b2bdcb3f..29485c8ba41 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h @@ -612,7 +612,7 @@ public: // false means termination on the application shutdown; // wrongThread is used as reInit parameter for action cleanup. bool Terminate(bool wrongThread); - bool InvokeAndTerminate(void(_cdecl *fn)(void *), void *param); + bool InvokeAndTerminate(void(*fn)(void *), void *param); // waits for the thread completion; // use the method after Terminate() only if Terminate() returned true @@ -664,7 +664,7 @@ public: // function/param to invoke (InvokeAndTerminate) // if execFunc == NULL => just terminate - void(_cdecl *execFunc)(void *); + void(*execFunc)(void *); void *execParam; // action chain diff --git a/src/java.desktop/windows/native/libawt/windows/awt_new.cpp b/src/java.desktop/windows/native/libawt/windows/awt_new.cpp index 1f61a37cfc7..e9cdd95fbb4 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_new.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_new.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -120,7 +120,7 @@ void *safe_Realloc(void *memblock, size_t size) { // std::bad_alloc in an out of memory situation. Instead, VC++ 5.0 returns 0. // // This function can be safely removed when the problem is corrected. -void * CDECL operator new(size_t size) { +void * operator new(size_t size) { return safe_Malloc(size); } #endif @@ -228,7 +228,7 @@ void *safe_Realloc_outofmem(void *memblock, size_t size, const char *file, return safe_Realloc(memblock, size); } -void * CDECL operator new(size_t size, const char *file, int line) { +void * operator new(size_t size, const char *file, int line) { rand_alloc_fail(file, line); return operator new(size); } diff --git a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.h b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.h index 092c5e43e12..7ddd11a4aef 100644 --- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.h +++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -33,9 +33,9 @@ extern "C" { #endif // NOTE: It's a caller responbility to free the allocated memory using delete[], just like in UnicodeToUTF8AndCopy function -LPSTR _cdecl UnicodeToUTF8(const LPCWSTR lpAnsiStr); +LPSTR UnicodeToUTF8(const LPCWSTR lpAnsiStr); -void _cdecl UnicodeToUTF8AndCopy(LPSTR dest, LPCWSTR src, SIZE_T maxLength); +void UnicodeToUTF8AndCopy(LPSTR dest, LPCWSTR src, SIZE_T maxLength); #ifdef __cplusplus } diff --git a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp index 1ca8d7a6676..e04b2351b15 100644 --- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp +++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -469,7 +469,7 @@ protected: } static data; /* StartThread function */ - static DWORD WINAPI __stdcall ThreadProc(void *param); + static DWORD WINAPI ThreadProc(void *param); }; /* StartBufferHelper class implementation @@ -499,7 +499,7 @@ DS_StartBufferHelper::Data::~Data() { // - Windows will do during process shutdown } -DWORD WINAPI __stdcall DS_StartBufferHelper::ThreadProc(void *param) +DWORD WINAPI DS_StartBufferHelper::ThreadProc(void *param) { ::CoInitialize(NULL); while (1) { diff --git a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp index 91e1a50c661..12cfa82fda8 100644 --- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp +++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -165,7 +165,7 @@ protected: } static data; /* StartThread function */ - static DWORD WINAPI __stdcall ThreadProc(void *param); + static DWORD WINAPI ThreadProc(void *param); }; /* MidiIn_OpenHelper class implementation @@ -195,7 +195,7 @@ MidiIn_OpenHelper::Data::~Data() { // - Windows will do during process shutdown } -DWORD WINAPI __stdcall MidiIn_OpenHelper::ThreadProc(void *param) { +DWORD WINAPI MidiIn_OpenHelper::ThreadProc(void *param) { while (1) { // wait for something to do ::WaitForSingleObject(data.doEvent, INFINITE); diff --git a/src/jdk.accessibility/windows/native/libjabsysinfo/AccessBridgeSysInfo.cpp b/src/jdk.accessibility/windows/native/libjabsysinfo/AccessBridgeSysInfo.cpp deleted file mode 100644 index 072093466a6..00000000000 --- a/src/jdk.accessibility/windows/native/libjabsysinfo/AccessBridgeSysInfo.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2014, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include -#include -#include - -extern "C" { - -BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) { - return TRUE; -} - -// Determine bitness of Win OS -JNIEXPORT jboolean JNICALL -Java_com_sun_java_accessibility_internal_AccessBridge_isSysWow(JNIEnv *env, jobject callingObj) { - BOOL bIsWow64 = FALSE; - typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); - - LPFN_ISWOW64PROCESS fnIsWow64Process = - (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); - - if (fnIsWow64Process != NULL) { - if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) { - throw std::runtime_error("fnIsWow64Process() failed"); - } - } - - return bIsWow64 ? JNI_TRUE : JNI_FALSE; -} - -} diff --git a/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp b/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp index 935c0180635..64dd32f7261 100644 --- a/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp +++ b/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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 @@ -141,8 +141,8 @@ typedef struct EVENT_STRUCT #include -#define THREAD_PROC unsigned int __stdcall -typedef unsigned int (__stdcall *THREAD_ROUTINE)(LPVOID lpThreadParameter); +#define THREAD_PROC unsigned int +typedef unsigned int (*THREAD_ROUTINE)(LPVOID lpThreadParameter); static HANDLE BeginThread(THREAD_ROUTINE thread_func,DWORD *id,DWORD param) { diff --git a/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c b/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c index 7a436ef85c2..dc1b0f6e79a 100644 --- a/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c +++ b/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c @@ -76,8 +76,7 @@ typedef struct { GetModuleHandleFunc _GetModuleHandle; GetProcAddressFunc _GetProcAddress; char jvmLib[MAX_LIBNAME_LENGTH]; /* "jvm.dll" */ - char func1[MAX_FUNC_LENGTH]; - char func2[MAX_FUNC_LENGTH]; + char func[MAX_FUNC_LENGTH]; char func_v2[MAX_FUNC_LENGTH]; char cmd[MAX_CMD_LENGTH + 1]; /* "load", "dump", ... */ char arg[MAX_ARGS][MAX_ARG_LENGTH + 1]; /* arguments to command */ @@ -113,10 +112,7 @@ DWORD WINAPI jvm_attach_thread_func(DataBlock *pData) } if (pData->version == 1) { - EnqueueOperationFunc addr = (EnqueueOperationFunc)(pData->_GetProcAddress(h, pData->func1)); - if (addr == NULL) { - addr = (EnqueueOperationFunc)(pData->_GetProcAddress(h, pData->func2)); - } + EnqueueOperationFunc addr = (EnqueueOperationFunc)(pData->_GetProcAddress(h, pData->func)); if (addr == NULL) { return ERR_GET_ENQUEUE_FUNC_FAIL; } @@ -231,24 +227,17 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_openProcess } /* - * On Windows 64-bit we need to handle 32-bit tools trying to attach to 64-bit - * processes (and visa versa). X-architecture attaching is currently not supported - * by this implementation. + * On Windows we need to handle 64-bit tools trying to attach to 32-bit + * processes, which is currently not supported by this implementation. */ if (_IsWow64Process != NULL) { - BOOL isCurrent32bit, isTarget32bit; - (*_IsWow64Process)(GetCurrentProcess(), &isCurrent32bit); + BOOL isTarget32bit; (*_IsWow64Process)(hProcess, &isTarget32bit); - if (isCurrent32bit != isTarget32bit) { + if (isTarget32bit) { CloseHandle(hProcess); - #ifdef _WIN64 - JNU_ThrowByName(env, "com/sun/tools/attach/AttachNotSupportedException", - "Unable to attach to 32-bit process running under WOW64"); - #else - JNU_ThrowByName(env, "com/sun/tools/attach/AttachNotSupportedException", - "Unable to attach to 64-bit process"); - #endif + JNU_ThrowByName(env, "com/sun/tools/attach/AttachNotSupportedException", + "Unable to attach to 32-bit process running under WOW64"); } } @@ -451,8 +440,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_enqueue data._GetProcAddress = _GetProcAddress; strcpy(data.jvmLib, "jvm"); - strcpy(data.func1, "JVM_EnqueueOperation"); - strcpy(data.func2, "_JVM_EnqueueOperation@20"); + strcpy(data.func, "JVM_EnqueueOperation"); strcpy(data.func_v2, "JVM_EnqueueOperation_v2"); /* diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java index 5d6b58fa085..64bdb8c1c72 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -28,9 +28,7 @@ import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.cdbg.*; -import sun.jvm.hotspot.debugger.x86.*; import sun.jvm.hotspot.debugger.amd64.*; -import sun.jvm.hotspot.debugger.windows.x86.*; import sun.jvm.hotspot.debugger.windows.amd64.*; import sun.jvm.hotspot.utilities.AddressOps; @@ -69,14 +67,7 @@ class WindbgCDebugger implements CDebugger { } public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException { - if (dbg.getCPU().equals("x86")) { - X86ThreadContext context = (X86ThreadContext) thread.getContext(); - Address ebp = context.getRegisterAsAddress(X86ThreadContext.EBP); - if (ebp == null) return null; - Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP); - if (pc == null) return null; - return new WindowsX86CFrame(dbg, ebp, pc); - } else if (dbg.getCPU().equals("amd64")) { + if (dbg.getCPU().equals("amd64")) { AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP); if (rbp == null) return null; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java index f082b7e52c6..07704671fd4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -30,10 +30,8 @@ import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.aarch64.*; import sun.jvm.hotspot.debugger.amd64.*; -import sun.jvm.hotspot.debugger.x86.*; import sun.jvm.hotspot.debugger.windbg.aarch64.*; import sun.jvm.hotspot.debugger.windbg.amd64.*; -import sun.jvm.hotspot.debugger.windbg.x86.*; import sun.jvm.hotspot.debugger.win32.coff.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.BasicDebugEvent; @@ -100,9 +98,7 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger machDesc.supports32bitAlignmentOf64bitTypes()); String cpu = PlatformInfo.getCPU(); - if (cpu.equals("x86")) { - threadFactory = new WindbgX86ThreadFactory(this); - } else if (cpu.equals("amd64")) { + if (cpu.equals("amd64")) { threadFactory = new WindbgAMD64ThreadFactory(this); } else if (cpu.equals("aarch64")) { threadFactory = new WindbgAARCH64ThreadFactory(this); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java deleted file mode 100644 index 7a9de861f9a..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.debugger.windbg.x86; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.windbg.*; - -class WindbgX86Thread implements ThreadProxy { - private WindbgDebugger debugger; - private long sysId; - private boolean gotID; - private long id; - - // The address argument must be the address of OSThread::_thread_id - WindbgX86Thread(WindbgDebugger debugger, Address addr) { - this.debugger = debugger; - this.sysId = addr.getCIntegerAt(0, 4, true); - gotID = false; - } - - WindbgX86Thread(WindbgDebugger debugger, long sysId) { - this.debugger = debugger; - this.sysId = sysId; - gotID = false; - } - - public ThreadContext getContext() throws IllegalThreadStateException { - long[] data = debugger.getThreadIntegerRegisterSet(getThreadID()); - WindbgX86ThreadContext context = new WindbgX86ThreadContext(debugger); - for (int i = 0; i < data.length; i++) { - context.setRegister(i, data[i]); - } - return context; - } - - public boolean canSetContext() throws DebuggerException { - return false; - } - - public void setContext(ThreadContext thrCtx) - throws IllegalThreadStateException, DebuggerException { - throw new DebuggerException("Unimplemented"); - } - - public boolean equals(Object obj) { - if (!(obj instanceof WindbgX86Thread other)) { - return false; - } - - return (other.getThreadID() == getThreadID()); - } - - public int hashCode() { - return Long.hashCode(getThreadID()); - } - - public String toString() { - return Long.toString(getThreadID()); - } - - /** Retrieves the thread ID of this thread by examining the Thread - Information Block. */ - private long getThreadID() { - if (!gotID) { - id = debugger.getThreadIdFromSysId(sysId); - } - - return id; - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadContext.java deleted file mode 100644 index 4135653b0b2..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadContext.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.debugger.windbg.x86; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.x86.*; -import sun.jvm.hotspot.debugger.windbg.*; - -class WindbgX86ThreadContext extends X86ThreadContext { - private WindbgDebugger debugger; - - public WindbgX86ThreadContext(WindbgDebugger debugger) { - super(); - this.debugger = debugger; - } - - public void setRegisterAsAddress(int index, Address value) { - setRegister(index, debugger.getAddressValue(value)); - } - - public Address getRegisterAsAddress(int index) { - return debugger.newAddress(getRegister(index)); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadFactory.java deleted file mode 100644 index 8ca83af2c49..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86ThreadFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.debugger.windbg.x86; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.windbg.*; - -public class WindbgX86ThreadFactory implements WindbgThreadFactory { - private WindbgDebugger debugger; - - public WindbgX86ThreadFactory(WindbgDebugger debugger) { - this.debugger = debugger; - } - - public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { - return new WindbgX86Thread(debugger, threadIdentifierAddr); - } - - public ThreadProxy createThreadWrapper(long id) { - return new WindbgX86Thread(debugger, id); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java deleted file mode 100644 index 1d5e015e888..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2001, 2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.debugger.windows.x86; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.x86.*; -import sun.jvm.hotspot.debugger.cdbg.*; -import sun.jvm.hotspot.debugger.cdbg.basic.*; -import sun.jvm.hotspot.debugger.windbg.*; - -public class WindowsX86CFrame extends BasicCFrame { - private Address ebp; - private Address pc; - - private static final int ADDRESS_SIZE = 4; - - /** Constructor for topmost frame */ - public WindowsX86CFrame(WindbgDebugger dbg, Address ebp, Address pc) { - super(dbg.getCDebugger()); - this.ebp = ebp; - this.pc = pc; - this.dbg = dbg; - } - - public CFrame sender(ThreadProxy thread) { - X86ThreadContext context = (X86ThreadContext) thread.getContext(); - /* - * Native code fills in the stack pointer register value using index - * X86ThreadContext.SP. - * See file sawindbg.cpp macro REG_INDEX(x). - * - * Be sure to use SP, or UESP which is aliased to SP in Java code, - * for the frame pointer validity check. - */ - Address esp = context.getRegisterAsAddress(X86ThreadContext.SP); - - if ( (ebp == null) || ebp.lessThan(esp) ) { - return null; - } - - // Check alignment of ebp - if ( dbg.getAddressValue(ebp) % ADDRESS_SIZE != 0) { - return null; - } - - Address nextEBP = ebp.getAddressAt( 0 * ADDRESS_SIZE); - if (nextEBP == null || nextEBP.lessThanOrEqual(ebp)) { - return null; - } - Address nextPC = ebp.getAddressAt( 1 * ADDRESS_SIZE); - if (nextPC == null) { - return null; - } - return new WindowsX86CFrame(dbg, nextEBP, nextPC); - } - - public Address pc() { - return pc; - } - - public Address localVariableBase() { - return ebp; - } - - private WindbgDebugger dbg; -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java index 6e347858154..e8eacbe756f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java @@ -28,7 +28,6 @@ import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess; import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.win32_aarch64.Win32AARCH64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess; @@ -98,9 +97,7 @@ public class Threads { access = null; // FIXME: find the platform specific PD class by reflection? if (os.equals("win32")) { - if (cpu.equals("x86")) { - access = new Win32X86JavaThreadPDAccess(); - } else if (cpu.equals("amd64")) { + if (cpu.equals("amd64")) { access = new Win32AMD64JavaThreadPDAccess(); } else if (cpu.equals("aarch64")) { access = new Win32AARCH64JavaThreadPDAccess(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java deleted file mode 100644 index 93dd66e1acf..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2000, 2020, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.win32_x86; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.x86.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.runtime.x86.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; -import sun.jvm.hotspot.utilities.Observable; -import sun.jvm.hotspot.utilities.Observer; - -/** This class is only public to allow using the VMObjectFactory to - instantiate these. -*/ - -public class Win32X86JavaThreadPDAccess implements JavaThreadPDAccess { - private static AddressField lastJavaFPField; - private static AddressField osThreadField; - - // Field from OSThread - private static Field threadIdField; - - // This is currently unneeded but is being kept in case we change - // the currentFrameGuess algorithm - private static final long GUESS_SCAN_RANGE = 128 * 1024; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("JavaThread"); - Type anchorType = db.lookupType("JavaFrameAnchor"); - lastJavaFPField = anchorType.getAddressField("_last_Java_fp"); - osThreadField = type.getAddressField("_osthread"); - - type = db.lookupType("OSThread"); - threadIdField = type.getField("_thread_id"); - } - - public Address getLastJavaFP(Address addr) { - return lastJavaFPField.getValue(addr.addOffsetTo(sun.jvm.hotspot.runtime.JavaThread.getAnchorField().getOffset())); - } - - public Address getLastJavaPC(Address addr) { - return null; - } - - public Address getBaseOfStackPointer(Address addr) { - return null; - } - - public Frame getLastFramePD(JavaThread thread, Address addr) { - Address fp = thread.getLastJavaFP(); - if (fp == null) { - return null; // no information - } - Address pc = thread.getLastJavaPC(); - if ( pc != null ) { - return new X86Frame(thread.getLastJavaSP(), fp, pc); - } else { - return new X86Frame(thread.getLastJavaSP(), fp); - } - } - - public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) { - return new X86RegisterMap(thread, updateMap); - } - - public Frame getCurrentFrameGuess(JavaThread thread, Address addr) { - ThreadProxy t = getThreadProxy(addr); - X86ThreadContext context = (X86ThreadContext) t.getContext(); - X86CurrentFrameGuess guesser = new X86CurrentFrameGuess(context, thread); - if (!guesser.run(GUESS_SCAN_RANGE)) { - return null; - } - if (guesser.getPC() == null) { - return new X86Frame(guesser.getSP(), guesser.getFP()); - } else { - return new X86Frame(guesser.getSP(), guesser.getFP(), guesser.getPC()); - } - } - - public void printThreadIDOn(Address addr, PrintStream tty) { - tty.print(getThreadProxy(addr)); - } - - public void printInfoOn(Address threadAddr, PrintStream tty) { - } - - public Address getLastSP(Address addr) { - ThreadProxy t = getThreadProxy(addr); - X86ThreadContext context = (X86ThreadContext) t.getContext(); - return context.getRegisterAsAddress(X86ThreadContext.ESP); - } - - public ThreadProxy getThreadProxy(Address addr) { - // Addr is the address of the JavaThread. - // Fetch the OSThread (for now and for simplicity, not making a - // separate "OSThread" class in this package) - Address osThreadAddr = osThreadField.getValue(addr); - // Get the address of the thread_id within the OSThread - Address threadIdAddr = - osThreadAddr.addOffsetTo(threadIdField.getOffset()); - JVMDebugger debugger = VM.getVM().getDebugger(); - return debugger.getThreadForIdentifierAddress(threadIdAddr); - } -} diff --git a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp index de3c45d00d2..1ecac8ac97a 100644 --- a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp +++ b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp @@ -30,10 +30,7 @@ #include "sun_jvm_hotspot_debugger_windbg_WindbgDebuggerLocal.h" -#ifdef _M_IX86 - #include "sun_jvm_hotspot_debugger_x86_X86ThreadContext.h" - #define NPRGREG sun_jvm_hotspot_debugger_x86_X86ThreadContext_NPRGREG -#elif _M_AMD64 +#ifdef _M_AMD64 #include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h" #define NPRGREG sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_NPRGREG #elif _M_ARM64 @@ -560,39 +557,7 @@ static bool addThreads(JNIEnv* env, jobject obj) { memset(&context, 0, sizeof(CONTEXT)); #undef REG_INDEX -#ifdef _M_IX86 - #define REG_INDEX(x) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##x - - context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS; - ptrIDebugAdvanced->GetThreadContext(&context, sizeof(CONTEXT)); - - ptrRegs[REG_INDEX(GS)] = context.SegGs; - ptrRegs[REG_INDEX(FS)] = context.SegFs; - ptrRegs[REG_INDEX(ES)] = context.SegEs; - ptrRegs[REG_INDEX(DS)] = context.SegDs; - - ptrRegs[REG_INDEX(EDI)] = context.Edi; - ptrRegs[REG_INDEX(ESI)] = context.Esi; - ptrRegs[REG_INDEX(EBX)] = context.Ebx; - ptrRegs[REG_INDEX(EDX)] = context.Edx; - ptrRegs[REG_INDEX(ECX)] = context.Ecx; - ptrRegs[REG_INDEX(EAX)] = context.Eax; - - ptrRegs[REG_INDEX(FP)] = context.Ebp; - ptrRegs[REG_INDEX(PC)] = context.Eip; - ptrRegs[REG_INDEX(CS)] = context.SegCs; - ptrRegs[REG_INDEX(EFL)] = context.EFlags; - ptrRegs[REG_INDEX(SP)] = context.Esp; - ptrRegs[REG_INDEX(SS)] = context.SegSs; - - ptrRegs[REG_INDEX(DR0)] = context.Dr0; - ptrRegs[REG_INDEX(DR1)] = context.Dr1; - ptrRegs[REG_INDEX(DR2)] = context.Dr2; - ptrRegs[REG_INDEX(DR3)] = context.Dr3; - ptrRegs[REG_INDEX(DR6)] = context.Dr6; - ptrRegs[REG_INDEX(DR7)] = context.Dr7; - -#elif _M_AMD64 +#ifdef _M_AMD64 #define REG_INDEX(x) sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_##x context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS; diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/transport.c b/src/jdk.jdwp.agent/share/native/libjdwp/transport.c index f67e9da47ea..b19afd972b7 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/transport.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/transport.c @@ -105,13 +105,6 @@ findTransportOnLoad(void *handle) if (handle == NULL) { return onLoad; } -#if defined(_WIN32) && !defined(_WIN64) - onLoad = (jdwpTransport_OnLoad_t) - dbgsysFindLibraryEntry(handle, "_jdwpTransport_OnLoad@16"); - if (onLoad != NULL) { - return onLoad; - } -#endif onLoad = (jdwpTransport_OnLoad_t) dbgsysFindLibraryEntry(handle, "jdwpTransport_OnLoad"); return onLoad; diff --git a/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp b/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp index db01cd164bc..5997b80fa5f 100644 --- a/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp +++ b/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -34,12 +34,6 @@ #include "Toolbox.h" #include "ErrorHandling.h" -#if defined(_WIN32) && !defined(_WIN64) -#define LAUNCH_FUNC "_JLI_Launch@56" -#else -#define LAUNCH_FUNC "JLI_Launch" -#endif - Jvm::Jvm() { LOG_TRACE(tstrings::any() << "Jvm(" << this << ")::Jvm()"); } @@ -206,7 +200,7 @@ void Jvm::launch() { LOG_TRACE(tstrings::any() << "JVM library: \"" << jvmPath << "\""); - DllFunction func(Dll(jvmPath), LAUNCH_FUNC); + DllFunction func(Dll(jvmPath), "JLI_Launch"); int exitStatus = jvmLauncherStartJvm(jld.get(), func.operator void*()); diff --git a/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp b/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp index 5323643cddd..fe59cd94b84 100644 --- a/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp +++ b/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp @@ -339,13 +339,13 @@ void launchApp() { #ifndef JP_LAUNCHERW -int __cdecl wmain() { +int wmain() { return app::launch(std::nothrow, launchApp); } #else -int __stdcall wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) { +int wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) { return app::wlaunch(std::nothrow, launchApp); } diff --git a/src/jdk.jpackage/windows/native/common/MsiCA.h b/src/jdk.jpackage/windows/native/common/MsiCA.h index 67dfde82c91..72dfa7607b0 100644 --- a/src/jdk.jpackage/windows/native/common/MsiCA.h +++ b/src/jdk.jpackage/windows/native/common/MsiCA.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -267,7 +267,7 @@ private: // #define JP_CA_BASE(name, ca_type) \ static void name ## Body(ca_type&); \ - extern "C" UINT __stdcall name(MSIHANDLE hInstall) { \ + extern "C" UINT name(MSIHANDLE hInstall) { \ __pragma(comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)); \ const msi::MsiLogTrigger logTrigger(hInstall); \ JP_DEBUG_BREAK(JP_CA_DEBUG_BREAK, name); \ @@ -286,13 +286,9 @@ private: #define JP_DEFERRED_CA(name) JP_CA_BASE(name, msi::DeferredCA) #define JP_CA_DECLARE(name) \ - extern "C" UINT __stdcall name(MSIHANDLE); \ + extern "C" UINT name(MSIHANDLE); \ __pragma(comment(linker, "/INCLUDE:" JP_CA_MANGLED_NAME(name))) -#ifdef _WIN64 - #define JP_CA_MANGLED_NAME(name) #name -#else - #define JP_CA_MANGLED_NAME(name) "_" #name "@4" -#endif +#define JP_CA_MANGLED_NAME(name) #name #endif // #ifndef MsiCA_h diff --git a/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp b/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp index 405a4cbf0a9..df09aae8079 100644 --- a/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp +++ b/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -83,7 +83,7 @@ void launchApp() { } // namespace -int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int nShowCmd) { +int WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int nShowCmd) { app::wlaunch(std::nothrow, launchApp); return exitCode; } diff --git a/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c b/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c index 2b75f29aa83..1087ff2ca89 100644 --- a/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c +++ b/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -72,7 +72,7 @@ void generateError(JNIEnv *env) { } #ifdef _WIN32 -unsigned __stdcall +unsigned #else void * #endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp index 4e8bf729cff..089aab78bb5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp @@ -90,7 +90,7 @@ void* THREAD_new(PROCEDURE procedure, void* context) { /***************************************************************/ #ifdef windows -unsigned __stdcall procedure(void* t) { +unsigned procedure(void* t) { #else // !windows void* procedure(void* t) { #endif