Skip to content

Commit

Permalink
Merge branch 'openjdk:master' into JDK-8265919
Browse files Browse the repository at this point in the history
  • Loading branch information
rkmauryaa authored May 29, 2024
2 parents 381db0d + 787cf27 commit 37602d2
Show file tree
Hide file tree
Showing 14 changed files with 942 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .jcheck/conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[general]
project=jdk-updates
jbs=JDK
version=17.0.12
version=17.0.13

[checks]
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists
Expand Down
4 changes: 2 additions & 2 deletions make/conf/version-numbers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

DEFAULT_VERSION_FEATURE=17
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=12
DEFAULT_VERSION_UPDATE=13
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_EXTRA1=0
DEFAULT_VERSION_EXTRA2=0
DEFAULT_VERSION_EXTRA3=0
DEFAULT_VERSION_DATE=2024-07-16
DEFAULT_VERSION_DATE=2024-10-15
DEFAULT_VERSION_CLASSFILE_MAJOR=61 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
Expand Down
13 changes: 8 additions & 5 deletions src/hotspot/share/gc/shared/genArguments.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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 @@ -273,6 +273,9 @@ void GenArguments::initialize_size_info() {
// and maximum heap size since no explicit flags exist
// for setting the old generation maximum.
MaxOldSize = MAX2(MaxHeapSize - max_young_size, GenAlignment);
MinOldSize = MIN3(MaxOldSize,
InitialHeapSize - initial_young_size,
MinHeapSize - MinNewSize);

size_t initial_old_size = OldSize;

Expand All @@ -284,9 +287,8 @@ void GenArguments::initialize_size_info() {
// with the overall heap size). In either case make
// the minimum, maximum and initial sizes consistent
// with the young sizes and the overall heap sizes.
MinOldSize = GenAlignment;
initial_old_size = clamp(InitialHeapSize - initial_young_size, MinOldSize, MaxOldSize);
// MaxOldSize has already been made consistent above.
// MaxOldSize and MinOldSize have already been made consistent above.
} else {
// OldSize has been explicitly set on the command line. Use it
// for the initial size but make sure the minimum allow a young
Expand All @@ -301,9 +303,10 @@ void GenArguments::initialize_size_info() {
", -XX:OldSize flag is being ignored",
MaxHeapSize);
initial_old_size = MaxOldSize;
} else if (initial_old_size < MinOldSize) {
log_warning(gc, ergo)("Inconsistency between initial old size and minimum old size");
MinOldSize = initial_old_size;
}

MinOldSize = MIN2(initial_old_size, MinHeapSize - MinNewSize);
}

// The initial generation sizes should match the initial heap size,
Expand Down
6 changes: 5 additions & 1 deletion src/java.base/share/classes/java/lang/ProcessBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1296,6 +1296,10 @@ public static List<Process> startPipeline(List<ProcessBuilder> builders) throws
redirects[1] = new RedirectPipeImpl(); // placeholder for new output
}
processes.add(builder.start(redirects));
if (prevOutput instanceof RedirectPipeImpl redir) {
// Wrap the fd so it can be closed
new Process.PipeInputStream(redir.getFd()).close();
}
prevOutput = redirects[1];
}
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,27 @@
import java.util.function.IntBinaryOperator;

/**
* Implements SSL using two SubscriberWrappers.
* Implements SSL using two {@link SubscriberWrapper}s.
*
* <p> Constructor takes two Flow.Subscribers: one that receives the network
* data (after it has been encrypted by SSLFlowDelegate) data, and one that
* receives the application data (before it has been encrypted by SSLFlowDelegate).
* <p> Constructor takes two {@linkplain Flow.Subscriber subscribers} - {@code downReader}
* and {@code downWriter}. {@code downReader} receives the application data (after it has
* been decrypted by SSLFlowDelegate). {@code downWriter} receives the network data (after it has
* been encrypted by SSLFlowDelegate).
*
* <p> Methods upstreamReader() and upstreamWriter() return the corresponding
* Flow.Subscribers containing Flows for the encrypted/decrypted upstream data.
* See diagram below.
* <p> Method {@link #upstreamWriter()} returns a {@linkplain Subscriber subscriber} which should
* be subscribed with a {@linkplain Flow.Publisher publisher} which publishes application data
* that can then be encrypted into network data by this SSLFlowDelegate and handed off to the
* {@code downWriter}.
*
* <p> How Flow.Subscribers are used in this class, and where they come from:
* <p> Method {@link #upstreamReader()} returns a {@link Subscriber subscriber} which should be
* subscribed with a {@linkplain Flow.Publisher publisher} which publishes encrypted network data
* that can then be decrypted into application data by this SSLFlowDelegate and handed off to the
* {@code downReader}.
*
* <p> Errors are reported to the {@code downReader} subscriber.
*
* <p> The diagram below illustrates how the Flow.Subscribers are used in this class, and where
* they come from:
* <pre>
* {@code
*
Expand All @@ -72,17 +82,21 @@
* ---------> data flow direction
*
*
* +------------------+
* upstreamWriter | | downWriter
* ---------------> | | ------------>
* obtained from this | | supplied to constructor
* | SSLFlowDelegate |
* downReader | | upstreamReader
* <--------------- | | <--------------
* supplied to constructor | | obtained from this
* +------------------+
*
* Errors are reported to the downReader Flow.Subscriber
* | ^
* upstreamWriter | | downReader
* obtained from | | supplied to
* upstreamWriter() | | constructor
* v |
* +-----------------------------------------------------------+
* * decrypts *
* * SSLFlowDelegate *
* * encrypts *
* +-----------------------------------------------------------+
* | ^
* downWriter | | upstreamReader
* supplied to | | obtained from
* constructor | | upstreamReader()
* v |
*
* }
* </pre>
Expand Down Expand Up @@ -467,7 +481,7 @@ else if (this.completing) {
}
}
// request more data and return.
requestMore();
requestMoreDataIfNeeded();
return;
}
if (complete && result.status() == Status.CLOSED) {
Expand Down
82 changes: 79 additions & 3 deletions src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -134,6 +134,82 @@ tstring getJvmLibPath(const Jvm& jvm) {
}


class RunExecutorWithMsgLoop {
public:
static DWORD apply(const Executor& exec) {
RunExecutorWithMsgLoop instance(exec);

UniqueHandle threadHandle = UniqueHandle(CreateThread(NULL, 0, worker,
static_cast<LPVOID>(&instance), 0, NULL));
if (threadHandle.get() == NULL) {
JP_THROW(SysError("CreateThread() failed", CreateThread));
}

MSG msg;
BOOL bRet;
while((bRet = GetMessage(&msg, instance.hwnd, 0, 0 )) != 0) {
if (bRet == -1) {
JP_THROW(SysError("GetMessage() failed", GetMessage));
} else {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

// Wait for worker thread to terminate to guarantee it will not linger
// around after the thread running a message loop terminates.
const DWORD res = ::WaitForSingleObject(threadHandle.get(), INFINITE);
if (WAIT_FAILED == res) {
JP_THROW(SysError("WaitForSingleObject() failed",
WaitForSingleObject));
}

LOG_TRACE(tstrings::any()
<< "Executor worker thread terminated. Exit code="
<< instance.exitCode);
return instance.exitCode;
}

private:
RunExecutorWithMsgLoop(const Executor& v): exec(v) {
exitCode = 1;

// Message-only window.
hwnd = CreateWindowEx(0, _T("STATIC"), _T(""), 0, 0, 0, 0, 0,
HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
if (!hwnd) {
JP_THROW(SysError("CreateWindowEx() failed", CreateWindowEx));
}
}

static DWORD WINAPI worker(LPVOID param) {
static_cast<RunExecutorWithMsgLoop*>(param)->run();
return 0;
}

void run() {
JP_TRY;
exitCode = static_cast<DWORD>(exec.execAndWaitForExit());
JP_CATCH_ALL;

JP_TRY;
if (!PostMessage(hwnd, WM_QUIT, 0, 0)) {
JP_THROW(SysError("PostMessage(WM_QUIT) failed", PostMessage));
}
return;
JP_CATCH_ALL;

// All went wrong, PostMessage() failed. Just terminate with error code.
exit(1);
}

private:
const Executor& exec;
DWORD exitCode;
HWND hwnd;
};


void launchApp() {
// [RT-31061] otherwise UI can be left in back of other windows.
::AllowSetForegroundWindow(ASFW_ANY);
Expand Down Expand Up @@ -165,7 +241,7 @@ void launchApp() {
}
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo = { };
jobInfo.BasicLimitInformation.LimitFlags =
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;
if (!SetInformationJobObject(jobHandle.get(),
JobObjectExtendedLimitInformation, &jobInfo, sizeof(jobInfo))) {
JP_THROW(SysError(tstrings::any() <<
Expand All @@ -180,7 +256,7 @@ void launchApp() {
exec.arg(arg);
});

DWORD exitCode = static_cast<DWORD>(exec.execAndWaitForExit());
DWORD exitCode = RunExecutorWithMsgLoop::apply(exec);

exit(exitCode);
return;
Expand Down
2 changes: 2 additions & 0 deletions test/hotspot/jtreg/gtest/AsyncLogGtest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2023, 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 @@ -33,6 +34,7 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.xml
* @requires vm.flagless
* @run main/native GTestWrapper --gtest_filter=AsyncLogTest* -Xlog:async
* @run main/native GTestWrapper --gtest_filter=Log*Test* -Xlog:async
*/
5 changes: 4 additions & 1 deletion test/hotspot/jtreg/gtest/NMTGtests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -32,6 +32,7 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.xml
* @requires vm.flagless
* @run main/native GTestWrapper --gtest_filter=NMT*:os* -XX:NativeMemoryTracking=off
*/

Expand All @@ -40,6 +41,7 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.xml
* @requires vm.flagless
* @run main/native GTestWrapper --gtest_filter=NMT*:os* -XX:NativeMemoryTracking=summary
*/

Expand All @@ -48,5 +50,6 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.xml
* @requires vm.flagless
* @run main/native GTestWrapper --gtest_filter=NMT*:os* -XX:NativeMemoryTracking=detail
*/
1 change: 1 addition & 0 deletions test/hotspot/jtreg/gtest/NativeHeapTrimmerGtest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.xml
* @requires vm.flagless
* @run main/native GTestWrapper --gtest_filter=os.trim* -Xlog:trimnative -XX:TrimNativeHeapInterval=100
*/
Loading

0 comments on commit 37602d2

Please sign in to comment.