8339783: Implement JEP 479: Remove the Windows 32-bit x86 Port

Reviewed-by: kbarrett, kvn, stuefe, shade, erikj
This commit is contained in:
Magnus Ihse Bursie 2024-11-13 09:41:57 +00:00
parent 2eeaa57b19
commit 79345bbbae
85 changed files with 349 additions and 1840 deletions

View File

@ -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

View File

@ -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],

View File

@ -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
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
[search of VCINSTALLDIR])

View File

@ -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
ifeq ($(HOTSPOT_TARGET_CPU_ARCH), aarch64)
ADLCFLAGS += -DR18_RESERVED
endif

View File

@ -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

View File

@ -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, \
$(eval $(call SetupJdkExecutable, BUILD_JACCESSINSPECTOR, \
NAME := jaccessinspector, \
EXTRA_SRC := \
bridge \
common \
toolscommon, \
EXTRA_HEADER_DIRS := include/bridge, \
CFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \
CXXFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \
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$1)
endef
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, \
$(eval $(call SetupJdkExecutable, BUILD_JACCESSWALKER, \
NAME := jaccesswalker, \
EXTRA_SRC := \
bridge \
common \
toolscommon, \
EXTRA_HEADER_DIRS := include/bridge, \
CFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \
CXXFLAGS := -DACCESSBRIDGE_ARCH_$2 -EHsc, \
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, \
))
TARGETS += $$(BUILD_JACCESSWALKER$1)
endef
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

View File

@ -31,20 +31,16 @@ 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, \
$(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_$2, \
CXXFLAGS := -MT -DACCESSBRIDGE_ARCH_64, \
EXTRA_HEADER_DIRS := \
include/bridge \
java.desktop:include, \
@ -54,25 +50,21 @@ ifeq ($(call isTargetOs, windows), true)
user32.lib uuid.lib winspool.lib, \
VERSIONINFO_RESOURCE := \
$(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
)
))
TARGETS += $$(BUILD_LIBJAVAACCESSBRIDGE$1)
endef
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, \
$(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_$2, \
CXXFLAGS := -DACCESSBRIDGE_ARCH_64, \
EXTRA_HEADER_DIRS := \
include/bridge, \
LDFLAGS := \
@ -82,33 +74,7 @@ ifeq ($(call isTargetOs, windows), true)
user32.lib uuid.lib winspool.lib, \
VERSIONINFO_RESOURCE := \
$(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
)
))
TARGETS += $$(BUILD_LIBWINDOWSACCESSBRIDGE$1)
endef
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

View File

@ -76,18 +76,6 @@ 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}: / <ADDR>: /' \
-e 's/(offset \?\?)_C@_.*/\1<SYM>/' \
-e 's/[@?][A-Za-z0-9_]{1,25}/<SYM>/' \
-e 's/([-,+])[0-9A-F]{2,16}/\1<HEXSTR>/g' \
-e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
-e 's/: ([a-z]{2}[a-z ]{2}) [0-9A-F]{2,16}h?$/: \1 <HEXSTR>/' \
-e 's/_20[0-9]{2}_[0-1][0-9]_[0-9]{2}/_<DATE>/' \
"
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\]/[<HEXSTR>]/' \
@ -95,7 +83,6 @@ if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
-e 's/([a-z]{2}[a-z ]{2}) [0-9A-F]{4,16}$/\1 <HEXSTR>/' \
-e 's/\[\?\?_C@_.*/[<SYM>]/' \
"
fi
elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
DIS_DIFF_FILTER="$SED \
-e 's/0x[0-9a-f]\{3,16\}/<HEXSTR>/g' -e 's/^[0-9a-f]\{12,20\}/<ADDR>/' \
@ -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
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"

View File

@ -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() {

View File

@ -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) {

View File

@ -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

View File

@ -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 <stddef.h> /* For ptrdiff_t */
#include <stdint.h> /* 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"

View File

@ -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);

View File

@ -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"

View File

@ -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<Thread*>(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_Get<Primitive>Field 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_Get<Primitive>Field 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_<lib_name> 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);
}
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 {

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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<typename T>
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<typename T>
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 <typename T>
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 <typename T>
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 <typename T>
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

View File

@ -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) {

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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");
}

View File

@ -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
}

View File

@ -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

View File

@ -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) {

View File

@ -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();

View File

@ -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

View File

@ -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"

View File

@ -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
}

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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 <math.h>
// 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

View File

@ -48,6 +48,8 @@
extern "C" {
#endif
#define JNICALL
/*
* JNI Types
*/

View File

@ -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_<lib_name> 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) {

View File

@ -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

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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 <stddef.h>
#ifndef _WIN64
typedef int intptr_t;
typedef unsigned int uintptr_t;
typedef unsigned long DWORD_PTR, *PDWORD_PTR;
#endif

View File

@ -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

View File

@ -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))

View File

@ -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) {

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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__)

View File

@ -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<LPCWSTR>(env->GetStringChars(x, y))
#define JNU_ReleaseStringPlatformChars(env, x, y) env->ReleaseStringChars(x, reinterpret_cast<const jchar*>(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

View File

@ -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
}
// otherwise, try to continue execution
}

View File

@ -71,8 +71,8 @@ typedef std::map<FORMATETC, STGMEDIUM> 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);

View File

@ -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;

View File

@ -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;

View File

@ -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 *);
};

View File

@ -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;

View File

@ -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

View File

@ -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);
}

View File

@ -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
}

View File

@ -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) {

View File

@ -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);

View File

@ -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 <exception>
#include <stdexcept>
#include <jni.h>
#include <windows.h>
#include <WinDef.h>
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;
}
}

View File

@ -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 <process.h>
#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)
{

View File

@ -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
}
}
@ -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");
/*

View File

@ -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;

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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<void*> func(Dll(jvmPath), LAUNCH_FUNC);
DllFunction<void*> func(Dll(jvmPath), "JLI_Launch");
int exitStatus = jvmLauncherStartJvm(jld.get(), func.operator void*());

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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