Skip to content

Commit

Permalink
Merge master jdk-17.0.12+5 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <[email protected]>
  • Loading branch information
j9build committed May 30, 2024
2 parents 7f763ae + d796dcb commit b0b3c8f
Show file tree
Hide file tree
Showing 14 changed files with 386 additions and 52 deletions.
2 changes: 1 addition & 1 deletion make/autoconf/libraries.m4
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
if test "x$OPENJDK_TARGET_OS" = xwindows; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib powrprof.lib uuid.lib \
wsock32.lib winmm.lib version.lib psapi.lib"
ws2_32.lib winmm.lib version.lib psapi.lib"
fi
JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -33,6 +33,7 @@
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.annotation.TypeAnnotationParser;
import sun.reflect.generics.repository.ConstructorRepository;
import sun.reflect.generics.repository.GenericDeclRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
import sun.reflect.generics.scope.ConstructorScope;
Expand Down Expand Up @@ -241,7 +242,7 @@ public TypeVariable<Constructor<T>>[] getTypeParameters() {
if (getSignature() != null) {
return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
} else
return (TypeVariable<Constructor<T>>[])new TypeVariable[0];
return (TypeVariable<Constructor<T>>[])GenericDeclRepository.EMPTY_TYPE_VARS;
}


Expand Down
5 changes: 3 additions & 2 deletions src/java.base/share/classes/java/lang/reflect/Method.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -40,6 +40,7 @@
import jdk.internal.vm.annotation.Stable;
import sun.reflect.annotation.ExceptionProxy;
import sun.reflect.annotation.TypeNotPresentExceptionProxy;
import sun.reflect.generics.repository.GenericDeclRepository;
import sun.reflect.generics.repository.MethodRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
Expand Down Expand Up @@ -259,7 +260,7 @@ public TypeVariable<Method>[] getTypeParameters() {
if (getGenericSignature() != null)
return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
else
return (TypeVariable<Method>[])new TypeVariable[0];
return (TypeVariable<Method>[])GenericDeclRepository.EMPTY_TYPE_VARS;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -42,6 +42,8 @@
public abstract class GenericDeclRepository<S extends Signature>
extends AbstractRepository<S> {

public static final TypeVariable<?>[] EMPTY_TYPE_VARS = new TypeVariable<?>[0];

/** The formal type parameters. Lazily initialized. */
private volatile TypeVariable<?>[] typeParameters;

Expand Down Expand Up @@ -77,6 +79,9 @@ private TypeVariable<?>[] computeTypeParameters() {
FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
// create array to store reified subtree(s)
int length = ftps.length;
if (length == 0) {
return EMPTY_TYPE_VARS;
}
TypeVariable<?>[] typeParameters = new TypeVariable<?>[length];
// reify all subtrees
for (int i = 0; i < length; i++) {
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
38 changes: 0 additions & 38 deletions test/hotspot/jtreg/applications/ctw/modules/jdk_crypto_ec.java

This file was deleted.

134 changes: 134 additions & 0 deletions test/hotspot/jtreg/compiler/c2/TestTopCastIIOnUndetectedDeadPath4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* 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
* 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.
*/

/*
* @test id=JDK-8293941
* @bug 8319372 8293941
* @summary Tests that CastII are not dying anymore and breaking the graph due to control that is not removed
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -XX:-RangeCheckElimination
* -Xcomp -XX:CompileOnly=compiler.c2.TestTopCastIIOnUndetectedDeadPath4::*
* compiler.c2.TestTopCastIIOnUndetectedDeadPath4
*/

/*
* @test id=JDK-8314111
* @bug 8319372 8314111
* @summary Tests that CastII are not dying anymore and breaking the graph due to control that is not removed
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.c2.TestTopCastIIOnUndetectedDeadPath4::test*
* compiler.c2.TestTopCastIIOnUndetectedDeadPath4
*/

/*
* @test id=NoFlags
* @summary Tests that CastII are not dying anymore and breaking the graph due to control that is not removed
* @run main/othervm compiler.c2.TestTopCastIIOnUndetectedDeadPath4
*/

package compiler.c2;

public class TestTopCastIIOnUndetectedDeadPath4 {

static boolean bFld;
static int iArrFld[];
static long lArrFld[];
static double dArrFld[][];

public static void main(String[] strArr) {
for (int i = 0; i < 5000; i++) {
test8293941();
test8314111_1();
test8314111_2();
}
}

static void test8293941() {
int i16;
boolean b = false;
for (double d1 = 31.2; d1 < 72; d1++) {
for (i16 = (int) d1; i16 < 2; ++i16) {
iArrFld[i16] >>= 5;
dArrFld[i16 - 1][i16] = 3;
if (b) {
break;
}
lArrFld[i16] = 4;
}
switch (0) {
case 5:
b = b;
}
}
}

static void test8314111_1() {
int i, i1 = 0, i28, i30 = 0, iArr[] = new int[10];
boolean bArr[] = new boolean[10];
i = 1;
while (++i < 5) {
try {
i1 = iArr[i - 1];
i1 = 2 / i;
} catch (ArithmeticException a_e) {
}
if (bFld) {
switch (i) {
case 4:
for (i28 = 3; 100 > i28; i28++) {
i1 -= i28;
}
if ((i30 -= 3) > 0) {
switch (i30) {
case 4:
bArr[i - 1] = bFld;
iArr[i] = 6;
}
}
}
}
}
}

static void test8314111_2() {
int iArr[] = new int[1000];
boolean bArr[] = new boolean[1000];
int x = 0;
int i = 1;
while (++i < 5) {
try {
x = iArr[i - 1];
x = 2 / i;
} catch (ArithmeticException a_e) {
}
if (bFld) {
x++;
bArr[i - 1] = false;
iArr[i] = 0;
}
}
}
}

class Foo {
public static void empty() {
}
}
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
*/
Loading

0 comments on commit b0b3c8f

Please sign in to comment.