Skip to content

Commit

Permalink
Merge upstream-jdk23u
Browse files Browse the repository at this point in the history
  • Loading branch information
cost0much committed Oct 3, 2024
2 parents be31cdb + dc23fd6 commit 85fcea4
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ jobs:
- build-windows-aarch64
- test-linux-x64
- test-macos-x64
- test-macos-aarch64
- test-windows-x64

steps:
Expand Down
3 changes: 3 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# JDK Vulnerabilities

Please follow the process outlined in the [OpenJDK Vulnerability Policy](https://openjdk.org/groups/vulnerability/report) to disclose vulnerabilities in the JDK.
46 changes: 44 additions & 2 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,10 @@ void os::win32::print_windows_version(outputStream* st) {
// - 2016 GA 10/2016 build: 14393
// - 2019 GA 11/2018 build: 17763
// - 2022 GA 08/2021 build: 20348
if (build_number > 20347) {
// - 2025 Preview build : 26040
if (build_number > 26039) {
st->print("Server 2025");
} else if (build_number > 20347) {
st->print("Server 2022");
} else if (build_number > 17762) {
st->print("Server 2019");
Expand Down Expand Up @@ -4068,6 +4071,39 @@ int os::win32::_build_minor = 0;
bool os::win32::_processor_group_warning_displayed = false;
bool os::win32::_job_object_processor_group_warning_displayed = false;

void getWindowsInstallationType(char* buffer, int bufferSize) {
HKEY hKey;
const char* subKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
const char* valueName = "InstallationType";

DWORD valueLength = bufferSize;

// Initialize buffer with empty string
buffer[0] = '\0';

// Open the registry key
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
// Return empty buffer if key cannot be opened
return;
}

// Query the value
if (RegQueryValueExA(hKey, valueName, NULL, NULL, (LPBYTE)buffer, &valueLength) != ERROR_SUCCESS) {
RegCloseKey(hKey);
buffer[0] = '\0';
return;
}

RegCloseKey(hKey);
}

bool isNanoServer() {
const int BUFFER_SIZE = 256;
char installationType[BUFFER_SIZE];
getWindowsInstallationType(installationType, BUFFER_SIZE);
return (strcmp(installationType, "Nano Server") == 0);
}

void os::win32::initialize_windows_version() {
assert(_major_version == 0, "windows version already initialized.");

Expand All @@ -4085,7 +4121,13 @@ void os::win32::initialize_windows_version() {
warning("Attempt to determine system directory failed: %s", buf_len != 0 ? error_msg_buffer : "<unknown error>");
return;
}
strncat(kernel32_path, "\\kernel32.dll", MAX_PATH - ret);

if (isNanoServer()) {
// On Windows Nanoserver the kernel32.dll is located in the forwarders subdirectory
strncat(kernel32_path, "\\forwarders\\kernel32.dll", MAX_PATH - ret);
} else {
strncat(kernel32_path, "\\kernel32.dll", MAX_PATH - ret);
}

DWORD version_size = GetFileVersionInfoSize(kernel32_path, nullptr);
if (version_size == 0) {
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/opto/bytecodeInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, 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
Expand Down Expand Up @@ -315,7 +315,9 @@ bool InlineTree::should_not_inline(ciMethod* callee_method, ciMethod* caller_met
int invoke_count = caller_method->interpreter_invocation_count();
assert(invoke_count != 0, "require invocation count greater than zero");
double freq = (double)call_site_count / (double)invoke_count;
double min_freq = MAX2(MinInlineFrequencyRatio, 1.0 / CompilationPolicy::min_invocations());
// avoid division by 0, set divisor to at least 1
int cp_min_inv = MAX2(1, CompilationPolicy::min_invocations());
double min_freq = MAX2(MinInlineFrequencyRatio, 1.0 / cp_min_inv);

if (freq < min_freq) {
set_msg("low call site frequency");
Expand Down
9 changes: 7 additions & 2 deletions src/java.base/windows/native/libjava/java_props_md.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, 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
Expand Down Expand Up @@ -444,6 +444,8 @@ GetJavaProperties(JNIEnv* env)
* where (buildNumber > 17762)
* Windows Server 2022 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 20347)
* Windows Server 2025 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 26039)
*
* This mapping will presumably be augmented as new Windows
* versions are released.
Expand Down Expand Up @@ -527,7 +529,10 @@ GetJavaProperties(JNIEnv* env)
case 0:
/* Windows server 2019 GA 10/2018 build number is 17763 */
/* Windows server 2022 build number is 20348 */
if (buildNumber > 20347) {
/* Windows server 2025 Preview build is 26040 */
if (buildNumber > 26039) {
sprops.os_name = "Windows Server 2025";
} else if (buildNumber > 20347) {
sprops.os_name = "Windows Server 2022";
} else if (buildNumber > 17762) {
sprops.os_name = "Windows Server 2019";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ private Frame senderForEntryFrame(PPC64RegisterMap map) {
//------------------------------------------------------------------------------
// frame::adjust_unextended_sp
private void adjustUnextendedSP() {
raw_unextendedSP = getFP();
// Nothing to do. senderForInterpreterFrame finds the correct unextendedSP.
}

private Frame senderForInterpreterFrame(PPC64RegisterMap map) {
if (DEBUG) {
System.out.println("senderForInterpreterFrame");
Expand Down

0 comments on commit 85fcea4

Please sign in to comment.