Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
[GR-38378] Merge in jdk-17.0.4+3.
Browse files Browse the repository at this point in the history
PullRequest: labsjdk-ce-17/44
  • Loading branch information
marwan-hallaoui committed May 31, 2022
2 parents 940070f + fad2395 commit 059a4a3
Show file tree
Hide file tree
Showing 49 changed files with 1,742 additions and 270 deletions.
7 changes: 6 additions & 1 deletion make/autoconf/basic_tools.m4
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ AC_DEFUN([BASIC_CHECK_TAR],
TAR_TYPE="bsd"
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
TAR_TYPE="bsd"
elif test "x$($TAR --version | $GREP "busybox")" != "x"; then
TAR_TYPE="busybox"
elif test "x$OPENJDK_BUILD_OS" = "xaix"; then
TAR_TYPE="aix"
fi
Expand All @@ -281,9 +283,12 @@ AC_DEFUN([BASIC_CHECK_TAR],
TAR_SUPPORTS_TRANSFORM="true"
elif test "x$TAR_TYPE" = "aix"; then
# -L InputList of aix tar: name of file listing the files and directories
# that need to be archived or extracted
# that need to be archived or extracted
TAR_INCLUDE_PARAM="L"
TAR_SUPPORTS_TRANSFORM="false"
elif test "x$TAR_TYPE" = "xbusybox"; then
TAR_INCLUDE_PARAM="T"
TAR_SUPPORTS_TRANSFORM="false"
else
TAR_INCLUDE_PARAM="I"
TAR_SUPPORTS_TRANSFORM="false"
Expand Down
9 changes: 8 additions & 1 deletion make/modules/java.desktop/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ else

endif


LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
libharfbuzz \
common/awt \
Expand All @@ -485,6 +484,14 @@ BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)

LIBFONTMANAGER_OPTIMIZATION := HIGHEST

ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
# gcc (and to an extent clang) is particularly bad at optimizing these files,
# causing a massive spike in compile time. We don't care about these
# particular files anyway, so lower optimization level.
BUILD_LIBFONTMANAGER_hb-subset.cc_OPTIMIZATION := SIZE
BUILD_LIBFONTMANAGER_hb-subset-plan.cc_OPTIMIZATION := SIZE
endif

ifeq ($(call isTargetOs, windows), true)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
X11TextRenderer.c
Expand Down
6 changes: 2 additions & 4 deletions src/hotspot/cpu/ppc/stubGenerator_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021 SAP SE. All rights reserved.
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 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 @@ -4616,8 +4616,6 @@ class StubGenerator: public StubCodeGenerator {

public:
StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
// replace the standard masm with a special one:
_masm = new MacroAssembler(code);
if (all) {
generate_all();
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/hotspot/cpu/s390/stubGenerator_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019 SAP SE. All rights reserved.
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022 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 @@ -2404,9 +2404,6 @@ class StubGenerator: public StubCodeGenerator {

public:
StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
// Replace the standard masm with a special one:
_masm = new MacroAssembler(code);

_stub_count = !all ? 0x100 : 0x200;
if (all) {
generate_all();
Expand Down
15 changes: 10 additions & 5 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,19 +814,24 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
ret = pthread_attr_setguardsize(&attr, 0);
}

ResourceMark rm;
pthread_t tid = 0;

if (ret == 0) {
ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
int limit = 3;
do {
ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
} while (ret == EAGAIN && limit-- > 0);
}

if (ret == 0) {
char buf[64];
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
} else {
char buf[64];
log_warning(os, thread)("Failed to start thread - pthread_create failed (%d=%s) for attributes: %s.",
ret, os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
log_warning(os, thread)("Failed to start thread \"%s\" - pthread_create failed (%d=%s) for attributes: %s.",
thread->name(), ret, os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
// Log some OS information which might explain why creating the thread failed.
log_info(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads());
LogStream st(Log(os, thread)::info());
Expand Down
16 changes: 11 additions & 5 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,16 +633,22 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
ThreadState state;

{

ResourceMark rm;
pthread_t tid;
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
int ret = 0;
int limit = 3;
do {
ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
} while (ret == EAGAIN && limit-- > 0);

char buf[64];
if (ret == 0) {
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
} else {
log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
log_warning(os, thread)("Failed to start thread \"%s\" - pthread_create failed (%s) for attributes: %s.",
thread->name(), os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
// Log some OS information which might explain why creating the thread failed.
log_info(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads());
LogStream st(Log(os, thread)::info());
Expand Down
87 changes: 37 additions & 50 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,16 +864,21 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
ThreadState state;

{
ResourceMark rm;
pthread_t tid;
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
int ret = 0;
int limit = 3;
do {
ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
} while (ret == EAGAIN && limit-- > 0);

char buf[64];
if (ret == 0) {
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
(uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
} else {
log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
log_warning(os, thread)("Failed to start thread \"%s\" - pthread_create failed (%s) for attributes: %s.",
thread->name(), os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
// Log some OS information which might explain why creating the thread failed.
log_info(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads());
LogStream st(Log(os, thread)::info());
Expand Down Expand Up @@ -2227,23 +2232,26 @@ void os::Linux::print_process_memory_info(outputStream* st) {
// - Print glibc tunables
#ifdef __GLIBC__
size_t total_allocated = 0;
size_t free_retained = 0;
bool might_have_wrapped = false;
if (_mallinfo2 != NULL) {
struct glibc_mallinfo2 mi = _mallinfo2();
total_allocated = mi.uordblks;
total_allocated = mi.uordblks + mi.hblkhd;
free_retained = mi.fordblks;
} else if (_mallinfo != NULL) {
// mallinfo is an old API. Member names mean next to nothing and, beyond that, are 32-bit signed.
// So for larger footprints the values may have wrapped around. We try to detect this here: if the
// process whole resident set size is smaller than 4G, malloc footprint has to be less than that
// and the numbers are reliable.
struct glibc_mallinfo mi = _mallinfo();
total_allocated = (size_t)(unsigned)mi.uordblks;
total_allocated = (size_t)(unsigned)mi.uordblks + (size_t)(unsigned)mi.hblkhd;
free_retained = (size_t)(unsigned)mi.fordblks;
// Since mallinfo members are int, glibc values may have wrapped. Warn about this.
might_have_wrapped = (info.vmrss * K) > UINT_MAX && (info.vmrss * K) > (total_allocated + UINT_MAX);
}
if (_mallinfo2 != NULL || _mallinfo != NULL) {
st->print_cr("C-Heap outstanding allocations: " SIZE_FORMAT "K%s",
total_allocated / K,
st->print_cr("C-Heap outstanding allocations: " SIZE_FORMAT "K, retained: " SIZE_FORMAT "K%s",
total_allocated / K, free_retained / K,
might_have_wrapped ? " (may have wrapped)" : "");
}
// Tunables
Expand All @@ -2264,6 +2272,19 @@ void os::Linux::print_uptime_info(outputStream* st) {
}
}

static void print_container_helper(outputStream* st, jlong j, const char* metrics) {
st->print("%s: ", metrics);
if (j > 0) {
if (j >= 1024) {
st->print_cr(UINT64_FORMAT " k", uint64_t(j) / 1024);
} else {
st->print_cr(UINT64_FORMAT, uint64_t(j));
}
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}
}

bool os::Linux::print_container_info(outputStream* st) {
if (!OSContainer::is_containerized()) {
st->print_cr("container information not found.");
Expand Down Expand Up @@ -2319,55 +2340,21 @@ bool os::Linux::print_container_info(outputStream* st) {
st->print_cr("%s", i == OSCONTAINER_ERROR ? "not supported" : "no shares");
}

jlong j = OSContainer::memory_limit_in_bytes();
st->print("memory_limit_in_bytes: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::memory_and_swap_limit_in_bytes();
st->print("memory_and_swap_limit_in_bytes: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::memory_soft_limit_in_bytes();
st->print("memory_soft_limit_in_bytes: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::OSContainer::memory_usage_in_bytes();
st->print("memory_usage_in_bytes: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::OSContainer::memory_max_usage_in_bytes();
st->print("memory_max_usage_in_bytes: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}
print_container_helper(st, OSContainer::memory_limit_in_bytes(), "memory_limit_in_bytes");
print_container_helper(st, OSContainer::memory_and_swap_limit_in_bytes(), "memory_and_swap_limit_in_bytes");
print_container_helper(st, OSContainer::memory_soft_limit_in_bytes(), "memory_soft_limit_in_bytes");
print_container_helper(st, OSContainer::memory_usage_in_bytes(), "memory_usage_in_bytes");
print_container_helper(st, OSContainer::memory_max_usage_in_bytes(), "memory_max_usage_in_bytes");

j = OSContainer::OSContainer::pids_max();
jlong j = OSContainer::pids_max();
st->print("maximum number of tasks: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
} else {
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::OSContainer::pids_current();
j = OSContainer::pids_current();
st->print("current number of tasks: ");
if (j > 0) {
st->print_cr(JLONG_FORMAT, j);
Expand Down
30 changes: 18 additions & 12 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,21 +746,27 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
// flag appears to work with _beginthredex() as well.

const unsigned initflag = CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION;
HANDLE thread_handle =
(HANDLE)_beginthreadex(NULL,
(unsigned)stack_size,
(unsigned (__stdcall *)(void*)) thread_native_entry,
thread,
initflag,
&thread_id);

HANDLE thread_handle;
int limit = 3;
do {
thread_handle =
(HANDLE)_beginthreadex(NULL,
(unsigned)stack_size,
(unsigned (__stdcall *)(void*)) thread_native_entry,
thread,
initflag,
&thread_id);
} while (thread_handle == NULL && errno == EAGAIN && limit-- > 0);

ResourceMark rm;
char buf[64];
if (thread_handle != NULL) {
log_info(os, thread)("Thread started (tid: %u, attributes: %s)",
thread_id, describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
log_info(os, thread)("Thread \"%s\" started (tid: %u, attributes: %s)",
thread->name(), thread_id,
describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
} else {
log_warning(os, thread)("Failed to start thread - _beginthreadex failed (%s) for attributes: %s.",
os::errno_name(errno), describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
log_warning(os, thread)("Failed to start thread \"%s\" - _beginthreadex failed (%s) for attributes: %s.",
thread->name(), os::errno_name(errno), describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
// Log some OS information which might explain why creating the thread failed.
log_info(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads());
LogStream st(Log(os, thread)::info());
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/asm/codeBuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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 @@ -135,11 +135,10 @@ CodeBuffer::~CodeBuffer() {
// Previous incarnations of this buffer are held live, so that internal
// addresses constructed before expansions will not be confused.
cb->free_blob();
// free any overflow storage
delete cb->_overflow_arena;
}

// free any overflow storage
delete _overflow_arena;

// Claim is that stack allocation ensures resources are cleaned up.
// This is resource clean up, let's hope that all were properly copied out.
NOT_PRODUCT(free_strings();)
Expand Down Expand Up @@ -942,6 +941,7 @@ void CodeBuffer::take_over_code_from(CodeBuffer* cb) {
this_sect->take_over_code_from(cb_sect);
}
_overflow_arena = cb->_overflow_arena;
cb->_overflow_arena = NULL;
// Make sure the old cb won't try to use it or free it.
DEBUG_ONLY(cb->_blob = (BufferBlob*)badAddress);
}
Expand Down
7 changes: 4 additions & 3 deletions src/hotspot/share/ci/ciMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
_max_stack = h_m->max_stack();
_max_locals = h_m->max_locals();
_code_size = h_m->code_size();
_intrinsic_id = h_m->intrinsic_id();
_handler_count = h_m->exception_table_length();
_size_of_parameters = h_m->size_of_parameters();
_uses_monitors = h_m->access_flags().has_monitor_bytecodes();
Expand All @@ -101,6 +100,10 @@ ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
_bcea = NULL;
#endif // COMPILER2

// Check for blackhole intrinsic and then populate the intrinsic ID.
CompilerOracle::tag_blackhole_if_possible(h_m);
_intrinsic_id = h_m->intrinsic_id();

ciEnv *env = CURRENT_ENV;
if (env->jvmti_can_hotswap_or_post_breakpoint()) {
// 6328518 check hotswap conditions under the right lock.
Expand Down Expand Up @@ -154,8 +157,6 @@ ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
ciReplay::initialize(this);
}
#endif

CompilerOracle::tag_blackhole_if_possible(h_m);
}


Expand Down
Loading

0 comments on commit 059a4a3

Please sign in to comment.