Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Oct 25, 2023
2 parents 62cc78d + 5dd22a9 commit f4b9bbb
Show file tree
Hide file tree
Showing 33 changed files with 622 additions and 99 deletions.
2 changes: 1 addition & 1 deletion make/modules/java.desktop/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ else
LIBFONTMANAGER_EXCLUDE_FILES += libharfbuzz/hb-ft.cc

HARFBUZZ_DISABLED_WARNINGS_gcc := missing-field-initializers strict-aliasing \
unused-result array-bounds
unused-result array-bounds parentheses
# noexcept-type required for GCC 7 builds. Not required for GCC 8+.
# expansion-to-defined required for GCC 9 builds. Not required for GCC 10+.
HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := class-memaccess noexcept-type expansion-to-defined dangling-reference
Expand Down
29 changes: 29 additions & 0 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3009,3 +3009,32 @@ void os::print_memory_mappings(char* addr, size_t bytes, outputStream* st) {}
void os::jfr_report_memory_info() {}

#endif // INCLUDE_JFR

// Simulate the library search algorithm of dlopen() (in os::dll_load)
int os::Aix::stat64x_via_LIBPATH(const char* path, struct stat64x* stat) {
if (path[0] == '/' ||
(path[0] == '.' && (path[1] == '/' ||
(path[1] == '.' && path[2] == '/')))) {
return stat64x(path, stat);
}

const char* env = getenv("LIBPATH");
if (env == nullptr || *env == 0)
return -1;

int ret = -1;
size_t libpathlen = strlen(env);
char* libpath = NEW_C_HEAP_ARRAY(char, libpathlen + 1, mtServiceability);
char* combined = NEW_C_HEAP_ARRAY(char, libpathlen + strlen(path) + 1, mtServiceability);
char *saveptr, *token;
strcpy(libpath, env);
for (token = strtok_r(libpath, ":", &saveptr); token != nullptr; token = strtok_r(nullptr, ":", &saveptr)) {
sprintf(combined, "%s/%s", token, path);
if (0 == (ret = stat64x(combined, stat)))
break;
}

FREE_C_HEAP_ARRAY(char*, combined);
FREE_C_HEAP_ARRAY(char*, libpath);
return ret;
}
5 changes: 4 additions & 1 deletion src/hotspot/os/aix/os_aix.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2016 SAP SE. All rights reserved.
* Copyright (c) 2013, 2023 SAP SE. 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 @@ -174,6 +174,9 @@ class os::Aix {

static bool platform_print_native_stack(outputStream* st, const void* context, char *buf, int buf_size, address& lastpc);
static void* resolve_function_descriptor(void* p);

// Simulate the library search algorithm of dlopen() (in os::dll_load)
static int stat64x_via_LIBPATH(const char* path, struct stat64x* stat);
};

#endif // OS_AIX_OS_AIX_HPP
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/loopTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3707,7 +3707,7 @@ void IdealLoopTree::enqueue_data_nodes(PhaseIdealLoop* phase, Unique_Node_List&
void IdealLoopTree::collect_loop_core_nodes(PhaseIdealLoop* phase, Unique_Node_List& wq) const {
uint before = wq.size();
wq.push(_head->in(LoopNode::LoopBackControl));
for (uint i = 0; i < wq.size(); ++i) {
for (uint i = before; i < wq.size(); ++i) {
Node* n = wq.at(i);
for (uint j = 0; j < n->req(); ++j) {
Node* in = n->in(j);
Expand Down
43 changes: 43 additions & 0 deletions src/hotspot/share/prims/jvmtiAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ JvmtiAgent::JvmtiAgent(const char* name, const char* options, bool is_absolute_p
_options(copy_string(options)),
_os_lib(nullptr),
_os_lib_path(nullptr),
#ifdef AIX
_inode(0),
_device(0),
#endif
_jplis(nullptr),
_loaded(false),
_absolute_path(is_absolute_path),
Expand Down Expand Up @@ -118,6 +122,24 @@ const char* JvmtiAgent::os_lib_path() const {
return _os_lib_path;
}

#ifdef AIX
void JvmtiAgent::set_inode(ino64_t inode) {
_inode = inode;
}

void JvmtiAgent::set_device(dev64_t device) {
_device = device;
}

ino64_t JvmtiAgent::inode() const {
return _inode;
}

dev64_t JvmtiAgent::device() const {
return _device;
}
#endif

bool JvmtiAgent::is_loaded() const {
return _loaded;
}
Expand Down Expand Up @@ -272,6 +294,20 @@ static bool load_agent_from_executable(JvmtiAgent* agent, const char* on_load_sy
return os::find_builtin_agent(agent, &on_load_symbols[0], num_symbol_entries);
}

#ifdef AIX
// save the inode and device of the library's file as a signature. This signature can be used
// in the same way as the library handle as a signature on other platforms.
static void save_library_signature(JvmtiAgent* agent, const char* name) {
struct stat64x libstat;
if (0 == os::Aix::stat64x_via_LIBPATH(name, &libstat)) {
agent->set_inode(libstat.st_ino);
agent->set_device(libstat.st_dev);
} else {
assert(false, "stat64x failed");
}
}
#endif

// Load the library from the absolute path of the agent, if available.
static void* load_agent_from_absolute_path(JvmtiAgent* agent, bool vm_exit_on_error) {
DEBUG_ONLY(assert_preload(agent);)
Expand All @@ -281,6 +317,7 @@ static void* load_agent_from_absolute_path(JvmtiAgent* agent, bool vm_exit_on_er
if (library == nullptr && vm_exit_on_error) {
vm_exit(agent, " in absolute path, with error: ", nullptr);
}
AIX_ONLY(if (library != nullptr) save_library_signature(agent, agent->name());)
return library;
}

Expand All @@ -293,11 +330,13 @@ static void* load_agent_from_relative_path(JvmtiAgent* agent, bool vm_exit_on_er
// Try to load the agent from the standard dll directory
if (os::dll_locate_lib(&buffer[0], sizeof buffer, Arguments::get_dll_dir(), name)) {
library = os::dll_load(&buffer[0], &ebuf[0], sizeof ebuf);
AIX_ONLY(if (library != nullptr) save_library_signature(agent, &buffer[0]);)
}
if (library == nullptr && os::dll_build_name(&buffer[0], sizeof buffer, name)) {
// Try the library path directory.
library = os::dll_load(&buffer[0], &ebuf[0], sizeof ebuf);
if (library != nullptr) {
AIX_ONLY(save_library_signature(agent, &buffer[0]);)
return library;
}
if (vm_exit_on_error) {
Expand Down Expand Up @@ -515,7 +554,11 @@ static bool invoke_Agent_OnAttach(JvmtiAgent* agent, outputStream* st) {
agent->set_os_lib_path(&buffer[0]);
agent->set_os_lib(library);
agent->set_loaded();
#ifdef AIX
previously_loaded = JvmtiAgentList::is_dynamic_lib_loaded(agent->device(), agent->inode());
#else
previously_loaded = JvmtiAgentList::is_dynamic_lib_loaded(library);
#endif
}

// Print warning if agent was not previously loaded and EnableDynamicAgentLoading not enabled on the command line.
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/share/prims/jvmtiAgent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class JvmtiAgent : public CHeapObj<mtServiceability> {
const char* _options;
void* _os_lib;
const char* _os_lib_path;
#ifdef AIX
ino64_t _inode;
dev64_t _device;
#endif
const void* _jplis;
bool _loaded;
bool _absolute_path;
Expand Down Expand Up @@ -80,6 +84,12 @@ class JvmtiAgent : public CHeapObj<mtServiceability> {
void initialization_end();
const Ticks& initialization_time() const;
const Tickspan& initialization_duration() const;
#ifdef AIX
void set_inode(ino64_t inode);
void set_device(dev64_t device);
unsigned long inode() const;
unsigned long device() const;
#endif

bool load(outputStream* st = nullptr);
void unload();
Expand Down
13 changes: 13 additions & 0 deletions src/hotspot/share/prims/jvmtiAgentList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ bool JvmtiAgentList::is_dynamic_lib_loaded(void* os_lib) {
}
return false;
}
#ifdef AIX
bool JvmtiAgentList::is_dynamic_lib_loaded(dev64_t device, ino64_t inode) {
JvmtiAgentList::Iterator it = JvmtiAgentList::agents();
while (it.has_next()) {
JvmtiAgent* const agent = it.next();
if (!agent->is_static_lib() && device != 0 && inode != 0 &&
agent->device() == device && agent->inode() == inode) {
return true;
}
}
return false;
}
#endif

static bool match(JvmtiEnv* env, const JvmtiAgent* agent, const void* os_module_address) {
assert(env != nullptr, "invariant");
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/prims/jvmtiAgentList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class JvmtiAgentList : AllStatic {

static bool is_static_lib_loaded(const char* name);
static bool is_dynamic_lib_loaded(void* os_lib);
#ifdef AIX
static bool is_dynamic_lib_loaded(dev64_t device, ino64_t inode);
#endif

static JvmtiAgent* lookup(JvmtiEnv* env, void* f_ptr);

Expand Down
9 changes: 0 additions & 9 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1912,15 +1912,6 @@ bool Arguments::check_vm_args_consistency() {
}
#endif

if (UseHeavyMonitors) {
if (FLAG_IS_CMDLINE(LockingMode) && LockingMode != LM_MONITOR) {
jio_fprintf(defaultStream::error_stream(),
"Conflicting -XX:+UseHeavyMonitors and -XX:LockingMode=%d flags", LockingMode);
return false;
}
FLAG_SET_CMDLINE(LockingMode, LM_MONITOR);
}

#if !defined(X86) && !defined(AARCH64) && !defined(PPC64) && !defined(RISCV64) && !defined(S390)
if (LockingMode == LM_MONITOR) {
jio_fprintf(defaultStream::error_stream(),
Expand Down
6 changes: 1 addition & 5 deletions src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,13 +1050,9 @@ const int ObjectAlignmentInBytes = 8;
product(bool, ErrorFileToStdout, false, \
"If true, error data is printed to stdout instead of a file") \
\
develop(bool, UseHeavyMonitors, false, \
"(Deprecated) Use heavyweight instead of lightweight Java " \
"monitors") \
\
develop(bool, VerifyHeavyMonitors, false, \
"Checks that no stack locking happens when using " \
"+UseHeavyMonitors") \
"-XX:LockingMode=0 (LM_MONITOR)") \
\
product(bool, PrintStringTableStatistics, false, \
"print statistics about the StringTable and SymbolTable") \
Expand Down
10 changes: 10 additions & 0 deletions src/java.base/aix/native/libnio/MappedMemoryUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ static void check_aix_einval(JNIEnv* env, void* end_address)
FILE* proc_file;
{
char* fname = (char*) malloc(sizeof(char) * PFNAME_LEN);
if (fname == NULL) {
JNU_ThrowOutOfMemoryError(env, NULL);
return;
}

pid_t the_pid = getpid();
jio_snprintf(fname, PFNAME_LEN, "/proc/%d/map", the_pid);
proc_file = fopen(fname, "r");
Expand All @@ -170,6 +175,11 @@ static void check_aix_einval(JNIEnv* env, void* end_address)
}
{
prmap_t* map_entry = (prmap_t*) malloc(sizeof(prmap_t));
if (map_entry == NULL) {
JNU_ThrowOutOfMemoryError(env, NULL);
fclose(proc_file);
return;
}
check_proc_map_array(env, proc_file, map_entry, end_address);
free(map_entry);
}
Expand Down
8 changes: 6 additions & 2 deletions src/java.base/aix/native/libnio/fs/AixNativeDispatcher.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2019 SAP SE. All rights reserved.
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023 SAP SE. 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 @@ -105,6 +105,10 @@ Java_sun_nio_fs_AixNativeDispatcher_getmntctl(JNIEnv* env, jclass this)
}
buffer_size *= 8;
buffer = malloc(buffer_size);
if (buffer == NULL) {
throwUnixException(env, errno);
return NULL;
}
must_free_buf = 1;
}
/* Treat zero entries like errors. */
Expand Down
39 changes: 39 additions & 0 deletions src/java.base/share/data/cacerts/teliarootcav2
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Owner: CN=Telia Root CA v2, O=Telia Finland Oyj, C=FI
Issuer: CN=Telia Root CA v2, O=Telia Finland Oyj, C=FI
Serial number: 1675f27d6fe7ae3e4acbe095b059e
Valid from: Thu Nov 29 11:55:54 GMT 2018 until: Sun Nov 29 11:55:54 GMT 2043
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 4096-bit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zBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy
rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ
8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi
0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM
A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS
SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K
TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF
6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er
3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt
Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT
VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW
ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA
rBPuUBQemMc=
-----END CERTIFICATE-----
12 changes: 11 additions & 1 deletion src/java.base/unix/native/libjava/java_props_md.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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 @@ -238,6 +238,11 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s
*std_language = "en";
if (language != NULL && mapLookup(language_names, language, std_language) == 0) {
*std_language = malloc(strlen(language)+1);
if (*std_language == NULL) {
free(encoding_variant);
JNU_ThrowOutOfMemoryError(env, NULL);
return 0;
}
strcpy(*std_language, language);
}
}
Expand All @@ -246,6 +251,11 @@ static int ParseLocale(JNIEnv* env, int cat, char ** std_language, char ** std_s
if (std_country != NULL && country != NULL) {
if (mapLookup(country_names, country, std_country) == 0) {
*std_country = malloc(strlen(country)+1);
if (*std_country == NULL) {
free(encoding_variant);
JNU_ThrowOutOfMemoryError(env, NULL);
return 0;
}
strcpy(*std_country, country);
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/java.base/windows/native/libjli/cmdtoargs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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 @@ -324,6 +324,10 @@ class Vector {
bool check() {
// "pgmname" rest of cmdline ie. pgmname + 2 double quotes + space + cmdline from windows
char* cptr = (char*) malloc(strlen(argv[0]) + sizeof(char) * 3 + strlen(cmdline) + 1);
if (cptr == NULL) {
printf("*** cannot allocate memory\n");
doabort();
}
_snprintf(cptr, MAX_PATH, "\"%s\" %s", argv[0], cmdline);
JLI_CmdToArgs(cptr);
free(cptr);
Expand Down
3 changes: 3 additions & 0 deletions src/java.base/windows/native/libnio/ch/UnixDomainSockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ Java_sun_nio_ch_UnixDomainSockets_init(JNIEnv *env, jclass cl)
if (result == SOCKET_ERROR) {
if (GetLastError() == WSAENOBUFS) {
infoPtr = (LPWSAPROTOCOL_INFOW)malloc(len);
if (infoPtr == NULL) {
return JNI_FALSE;
}
result = WSAEnumProtocolsW(0, infoPtr, &len);
if (result == SOCKET_ERROR) {
free(infoPtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ Renderer init(final int pix_boundsX, final int pix_boundsY,
final int pix_boundsWidth, final int pix_boundsHeight,
final int windingRule)
{
this.rdrCtx.doRender = true;
this.windingRule = windingRule;

// bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY
Expand Down
Loading

0 comments on commit f4b9bbb

Please sign in to comment.