Skip to content

Commit

Permalink
Merge master jdk-17.0.10+2 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Nov 9, 2023
2 parents 1cd3f35 + d7cadbf commit 64918c0
Show file tree
Hide file tree
Showing 32 changed files with 403 additions and 130 deletions.
7 changes: 7 additions & 0 deletions make/RunTestsPrebuilt.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ ifeq ($(UNAME_OS), CYGWIN)
OPENJDK_TARGET_OS := windows
OPENJDK_TARGET_OS_TYPE := windows
OPENJDK_TARGET_OS_ENV := windows.cygwin
else ifeq ($(UNAME_OS), MINGW64)
OPENJDK_TARGET_OS := windows
OPENJDK_TARGET_OS_TYPE := windows
OPENJDK_TARGET_OS_ENV := windows.msys2
else
OPENJDK_TARGET_OS_TYPE:=unix
ifeq ($(UNAME_OS), Linux)
Expand All @@ -169,6 +173,9 @@ else
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS)
endif

# Sanity check env detection
$(info Detected target OS, type and env: [$(OPENJDK_TARGET_OS)] [$(OPENJDK_TARGET_OS_TYPE)] [$(OPENJDK_TARGET_OS_ENV)])

# Assume little endian unless otherwise specified
OPENJDK_TARGET_CPU_ENDIAN := little

Expand Down
11 changes: 6 additions & 5 deletions make/autoconf/basic.m4
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
# WARNING: This might be a bad thing to do. You need to be sure you want to
# have a configuration in this directory. Do some sanity checks!
if test ! -e "$OUTPUTDIR/spec.gmk"; then
# If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
# other files
if test ! -e "$OUTPUTDIR/spec.gmk" && test ! -e "$OUTPUTDIR/configure-support/generated-configure.sh"; then
# If we have a spec.gmk or configure-support/generated-configure.sh,
# we have run here before and we are OK. Otherwise, check for other files
files_present=`$LS $OUTPUTDIR`
# Configure has already touched config.log and confdefs.h in the current dir when this check
# is performed.
Expand All @@ -375,8 +375,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
AC_MSG_NOTICE([Current directory is $CONFIGURE_START_DIR.])
AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could])
AC_MSG_NOTICE([seriously mess up just about everything.])
AC_MSG_NOTICE([However, this directory is not empty, additionally to some allowed files])
AC_MSG_NOTICE([it contains $filtered_files.])
AC_MSG_NOTICE([This is not allowed, since it could seriously mess up just about everything.])
AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
AC_MSG_ERROR([Will not continue creating configuration in $CONFIGURE_START_DIR])
Expand Down
5 changes: 1 addition & 4 deletions make/conf/jib-profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,7 @@ var getJibProfilesProfiles = function (input, common, data) {
target_os: input.build_os,
target_cpu: input.build_cpu,
dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
labels: "test",
environment: {
"JT_JAVA": common.boot_jdk_home
}
labels: "test"
}
};
profiles = concatObjects(profiles, testOnlyProfiles);
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/unix/native/jspawnhelper/jspawnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ int main(int argc, char *argv[]) {
ChildStuff c;
int t;
struct stat buf;
/* argv[0] contains the fd number to read all the child info */
/* argv[1] contains the fd number to read all the child info */
int r, fdin, fdout;

r = sscanf (argv[argc-1], "%d:%d", &fdin, &fdout);
r = sscanf (argv[1], "%d:%d", &fdin, &fdout);
if (r == 2 && fcntl(fdin, F_GETFD) != -1) {
fstat(fdin, &buf);
if (!S_ISFIFO(buf.st_mode))
Expand Down
12 changes: 8 additions & 4 deletions src/java.base/unix/native/libjava/ProcessImpl_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,16 +491,20 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
jboolean isCopy;
int i, offset, rval, bufsize, magic;
char *buf, buf1[16];
char *hlpargs[2];
char *hlpargs[3];
SpawnInfo sp;

/* need to tell helper which fd is for receiving the childstuff
* and which fd to send response back on
*/
snprintf(buf1, sizeof(buf1), "%d:%d", c->childenv[0], c->fail[1]);
/* put the fd string as argument to the helper cmd */
hlpargs[0] = buf1;
hlpargs[1] = 0;
/* NULL-terminated argv array.
* argv[0] contains path to jspawnhelper, to follow conventions.
* argv[1] contains the fd string as argument to jspawnhelper
*/
hlpargs[0] = (char*)helperpath;
hlpargs[1] = buf1;
hlpargs[2] = NULL;

/* Following items are sent down the pipe to the helper
* after it is spawned.
Expand Down
14 changes: 10 additions & 4 deletions src/java.desktop/windows/native/libawt/windows/awt_Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,10 +1790,16 @@ void CCombinedSegTable::GetEUDCFileName(LPWSTR lpszFileName, int cchFileName)
DWORD dwBytes = sizeof(szFileName);
// try Typeface-specific EUDC font
char szTmpName[80];
VERIFY(::WideCharToMultiByte(CP_ACP, 0, szFamilyName, -1,
szTmpName, sizeof(szTmpName), NULL, NULL));
LONG lStatus = ::RegQueryValueExA(hKey, (LPCSTR) szTmpName,
NULL, &dwType, szFileName, &dwBytes);
int nb = ::WideCharToMultiByte(CP_ACP, 0, szFamilyName, -1,
szTmpName, sizeof(szTmpName), NULL, NULL);
VERIFY(nb);

LONG lStatus = 1;
if (nb > 0) {
lStatus = ::RegQueryValueExA(hKey, (LPCSTR) szTmpName,
NULL, &dwType, szFileName, &dwBytes);
}

BOOL fUseDefault = FALSE;
if (lStatus != ERROR_SUCCESS){ // try System default EUDC font
if (m_fTTEUDCFileExist == FALSE)
Expand Down
10 changes: 7 additions & 3 deletions src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp
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, 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 @@ -3925,9 +3925,13 @@ static void throwPrinterException(JNIEnv *env, DWORD err) {
sizeof(t_errStr),
NULL );

WideCharToMultiByte(CP_UTF8, 0, t_errStr, -1,
int nb = WideCharToMultiByte(CP_UTF8, 0, t_errStr, -1,
errStr, sizeof(errStr), NULL, NULL);
JNU_ThrowByName(env, PRINTEREXCEPTION_STR, errStr);
if (nb > 0) {
JNU_ThrowByName(env, PRINTEREXCEPTION_STR, errStr);
} else {
JNU_ThrowByName(env, PRINTEREXCEPTION_STR, "secondary error during OS message extraction");
}
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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 @@ -35,16 +35,25 @@ LPSTR UnicodeToUTF8(const LPCWSTR lpUnicodeStr)
{
DWORD dwUTF8Len = WideCharToMultiByte(CP_UTF8, 0, lpUnicodeStr, -1, nullptr, 0, nullptr, nullptr);
LPSTR lpUTF8Str = new CHAR[dwUTF8Len];
if (lpUTF8Str == NULL) return NULL;
memset(lpUTF8Str, 0, sizeof(CHAR) * (dwUTF8Len));
WideCharToMultiByte(CP_UTF8, 0, lpUnicodeStr, -1, lpUTF8Str, dwUTF8Len, nullptr, nullptr);
return lpUTF8Str;
int nb = WideCharToMultiByte(CP_UTF8, 0, lpUnicodeStr, -1, lpUTF8Str, dwUTF8Len, nullptr, nullptr);
if (nb > 0) {
return lpUTF8Str;
}
delete[] lpUTF8Str;
return NULL;
}

void UnicodeToUTF8AndCopy(LPSTR dest, LPCWSTR src, SIZE_T maxLength) {
LPSTR utf8EncodedName = UnicodeToUTF8(src);
strncpy(dest, utf8EncodedName, maxLength - 1);
delete[] utf8EncodedName;
dest[maxLength - 1] = '\0';
if (utf8EncodedName != NULL) {
strncpy(dest, utf8EncodedName, maxLength - 1);
delete[] utf8EncodedName;
dest[maxLength - 1] = '\0';
} else {
if (maxLength > 0) dest[0] = '\0';
}
}

#ifdef __cplusplus
Expand Down
44 changes: 27 additions & 17 deletions src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static void JNICALL cbEarlyVMDeath(jvmtiEnv*, JNIEnv *);
static void JNICALL cbEarlyException(jvmtiEnv*, JNIEnv *,
jthread, jmethodID, jlocation, jobject, jmethodID, jlocation);

static void initialize(JNIEnv *env, jthread thread, EventIndex triggering_ei);
static void initialize(JNIEnv *env, jthread thread, EventIndex triggering_ei, EventInfo *opt_info);
static jboolean parseOptions(char *str);

/*
Expand Down Expand Up @@ -438,7 +438,7 @@ cbEarlyVMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread)
EXIT_ERROR(AGENT_ERROR_INTERNAL,"VM dead at VM_INIT time");
}
if (initOnStartup)
initialize(env, thread, EI_VM_INIT);
initialize(env, thread, EI_VM_INIT, NULL);
vmInitialized = JNI_TRUE;
LOG_MISC(("END cbEarlyVMInit"));
}
Expand Down Expand Up @@ -491,6 +491,16 @@ cbEarlyException(jvmtiEnv *jvmti_env, JNIEnv *env,
LOG_MISC(("VM is not initialized yet"));
return;
}
EventInfo info;
info.ei = EI_EXCEPTION;
info.thread = thread;
info.clazz = getMethodClass(jvmti_env, method);
info.method = method;
info.location = location;
info.object = exception;
info.u.exception.catch_clazz = getMethodClass(jvmti_env, catch_method);
info.u.exception.catch_method = catch_method;
info.u.exception.catch_location = catch_location;

/*
* We want to preserve any current exception that might get wiped
Expand All @@ -505,24 +515,22 @@ cbEarlyException(jvmtiEnv *jvmti_env, JNIEnv *env,
if (initOnUncaught && catch_method == NULL) {

LOG_MISC(("Initializing on uncaught exception"));
initialize(env, thread, EI_EXCEPTION);
initialize(env, thread, EI_EXCEPTION, &info);

} else if (initOnException != NULL) {

jclass clazz;

/* Get class of exception thrown */
clazz = JNI_FUNC_PTR(env,GetObjectClass)(env, exception);
if ( clazz != NULL ) {
jclass exception_clazz = JNI_FUNC_PTR(env, GetObjectClass)(env, exception);
/* check class of exception thrown */
if ( exception_clazz != NULL ) {
char *signature = NULL;
/* initing on throw, check */
error = classSignature(clazz, &signature, NULL);
error = classSignature(exception_clazz, &signature, NULL);
LOG_MISC(("Checking specific exception: looking for %s, got %s",
initOnException, signature));
if ( (error==JVMTI_ERROR_NONE) &&
(strcmp(signature, initOnException) == 0)) {
LOG_MISC(("Initializing on specific exception"));
initialize(env, thread, EI_EXCEPTION);
initialize(env, thread, EI_EXCEPTION, &info);
} else {
error = AGENT_ERROR_INTERNAL; /* Just to cause restore */
}
Expand Down Expand Up @@ -663,9 +671,11 @@ jniFatalError(JNIEnv *env, const char *msg, jvmtiError error, int exit_code)

/*
* Initialize debugger back end modules
*
* @param opt_info optional event info to use, might be null
*/
static void
initialize(JNIEnv *env, jthread thread, EventIndex triggering_ei)
initialize(JNIEnv *env, jthread thread, EventIndex triggering_ei, EventInfo *opt_info)
{
jvmtiError error;
EnumerateArg arg;
Expand Down Expand Up @@ -753,13 +763,13 @@ initialize(JNIEnv *env, jthread thread, EventIndex triggering_ei)
* can get in the queue (from other not-yet-suspended threads)
* before this one does. (Also need to handle allocation error below?)
*/
EventInfo info;
struct bag *initEventBag;
LOG_MISC(("triggering_ei != EI_VM_INIT"));
LOG_MISC(("triggering_ei == EI_EXCEPTION"));
JDI_ASSERT(triggering_ei == EI_EXCEPTION);
JDI_ASSERT(opt_info != NULL);
initEventBag = eventHelper_createEventBag();
(void)memset(&info,0,sizeof(info));
info.ei = triggering_ei;
eventHelper_recordEvent(&info, 0, suspendPolicy, initEventBag);
threadControl_onEventHandlerEntry(currentSessionID, opt_info, NULL);
eventHelper_recordEvent(opt_info, 0, suspendPolicy, initEventBag);
(void)eventHelper_reportEvents(currentSessionID, initEventBag);
bagDestroyBag(initEventBag);
}
Expand Down Expand Up @@ -1394,7 +1404,7 @@ JNIEXPORT char const* JNICALL debugInit_startDebuggingViaCommand(JNIEnv* env, jt
if (!startedViaJcmd) {
startedViaJcmd = JNI_TRUE;
is_first_start = JNI_TRUE;
initialize(env, thread, EI_VM_INIT);
initialize(env, thread, EI_VM_INIT, NULL);
}

bagEnumerateOver(transports, getFirstTransport, &spec);
Expand Down
7 changes: 4 additions & 3 deletions test/hotspot/jtreg/applications/scimark/Scimark.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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 All @@ -24,7 +24,6 @@
/*
* @test
* @library /test/lib
* @requires vm.flagless
* @run driver Scimark
*/

Expand All @@ -47,7 +46,9 @@ public static void main(String... args) throws Exception {
+ Scimark.class.getName(), e);
}

OutputAnalyzer output = new OutputAnalyzer(ProcessTools.createJavaProcessBuilder(
System.setProperty("test.noclasspath", "true");

OutputAnalyzer output = new OutputAnalyzer(ProcessTools.createTestJvm(
"-cp", artifacts.get("gov.nist.math.scimark-2.0").toString(),
"jnt.scimark2.commandline", "-large")
.start());
Expand Down
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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 All @@ -25,6 +25,7 @@
* @test
* @bug 8186211
* @summary CONSTANT_Dynamic_info structure's tries to use a BSM index whose signature is for an invokedynamic and vice versa.
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile CondyUsesIndyBSM.jcod
Expand Down
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/runtime/condy/CondyLDCTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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 All @@ -25,6 +25,7 @@
* @test
* @bug 8186211
* @summary Tests various ldc, ldc_w, ldc2_w instructions of CONSTANT_Dynamic.
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile CondyUseLDC_W.jasm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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 All @@ -25,6 +25,7 @@
* @test
* @bug 8186211
* @summary Test CONSTANT_Dynamic where the BSM is invoked via a REF_newInvokeSpecial.
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile CondyNewInvokeSpecial.jasm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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 All @@ -26,6 +26,7 @@
* @bug 8216970
* @summary Ensure escape analysis can handle an ldc of a dynamic
* constant whose return type is an array of boolean.
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile TestEscapeThroughInvokeWithCondy$A.jasm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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 All @@ -25,6 +25,7 @@
* @test
* @bug 8228485
* @summary Correctly handle initialization error for Condy BSM.
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile Example.jasm
Expand Down
2 changes: 0 additions & 2 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,6 @@ com/sun/nio/sctp/SctpChannel/SocketOptionTests.java 8141694 linux-al

# jdk_security

sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all

javax/net/ssl/DTLS/CipherSuite.java 8202059 macosx-x64

sun/security/smartcardio/TestChannel.java 8039280 generic-all
Expand Down
Loading

0 comments on commit 64918c0

Please sign in to comment.