Skip to content

Commit

Permalink
Merge branch 'master' into JDK-8303942
Browse files Browse the repository at this point in the history
  • Loading branch information
elifaslan1 committed Jun 5, 2024
2 parents fd5be8a + 5cdff9f commit ce92b16
Show file tree
Hide file tree
Showing 61 changed files with 1,592 additions and 364 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
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
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
2 changes: 1 addition & 1 deletion make/devkit/createJMHBundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rm -f *
fetchJar() {
url="${MAVEN_MIRROR}/$1/$2/$3/$2-$3.jar"
if command -v curl > /dev/null; then
curl -O --fail $url
curl -OL --fail $url
elif command -v wget > /dev/null; then
wget $url
else
Expand Down
62 changes: 28 additions & 34 deletions src/hotspot/os/bsd/os_perf_bsd.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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 @@ -39,17 +39,18 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>
#include <sys/times.h>
#endif

static const double NANOS_PER_SEC = 1000000000.0;

class CPUPerformanceInterface::CPUPerformance : public CHeapObj<mtInternal> {
friend class CPUPerformanceInterface;
private:
long _total_cpu_nanos;
uint64_t _jvm_real;
long _total_csr_nanos;
long _jvm_user_nanos;
long _jvm_system_nanos;
uint64_t _jvm_user;
uint64_t _jvm_system;
long _jvm_context_switches;
long _used_ticks;
long _total_ticks;
Expand Down Expand Up @@ -83,11 +84,11 @@ class CPUPerformanceInterface::CPUPerformance : public CHeapObj<mtInternal> {
};

CPUPerformanceInterface::CPUPerformance::CPUPerformance() {
_total_cpu_nanos= 0;
_total_csr_nanos= 0;
_jvm_real = 0;
_total_csr_nanos = 0;
_jvm_context_switches = 0;
_jvm_user_nanos = 0;
_jvm_system_nanos = 0;
_jvm_user = 0;
_jvm_system = 0;
_used_ticks = 0;
_total_ticks = 0;
_active_processor_count = 0;
Expand Down Expand Up @@ -148,42 +149,35 @@ int CPUPerformanceInterface::CPUPerformance::cpu_load_total_process(double* cpu_
int CPUPerformanceInterface::CPUPerformance::cpu_loads_process(double* pjvmUserLoad, double* pjvmKernelLoad, double* psystemTotalLoad) {
#ifdef __APPLE__
int result = cpu_load_total_process(psystemTotalLoad);
mach_port_t task = mach_task_self();
mach_msg_type_number_t task_info_count = TASK_INFO_MAX;
task_info_data_t task_info_data;
kern_return_t kr = task_info(task, TASK_ABSOLUTETIME_INFO, (task_info_t)task_info_data, &task_info_count);
if (kr != KERN_SUCCESS) {

struct tms buf;
clock_t jvm_real = times(&buf);
if (jvm_real == (clock_t) (-1)) {
return OS_ERR;
}
task_absolutetime_info_t absolutetime_info = (task_absolutetime_info_t)task_info_data;

int active_processor_count = os::active_processor_count();
long jvm_user_nanos = absolutetime_info->total_user;
long jvm_system_nanos = absolutetime_info->total_system;

long total_cpu_nanos;
if(!now_in_nanos(&total_cpu_nanos)) {
return OS_ERR;
}
uint64_t jvm_user = buf.tms_utime;
uint64_t jvm_system = buf.tms_stime;

if (_total_cpu_nanos == 0 || active_processor_count != _active_processor_count) {
// First call or change in active processor count
if (active_processor_count != _active_processor_count) {
// Change in active processor count
result = OS_ERR;
}
} else {
uint64_t delta = active_processor_count * (jvm_real - _jvm_real);
if (delta == 0) {
// Avoid division by zero
return OS_ERR;
}

long delta_nanos = active_processor_count * (total_cpu_nanos - _total_cpu_nanos);
if (delta_nanos == 0) {
// Avoid division by zero
return OS_ERR;
*pjvmUserLoad = normalize((double)(jvm_user - _jvm_user) / delta);
*pjvmKernelLoad = normalize((double)(jvm_system - _jvm_system) / delta);
}

*pjvmUserLoad = normalize((double)(jvm_user_nanos - _jvm_user_nanos)/delta_nanos);
*pjvmKernelLoad = normalize((double)(jvm_system_nanos - _jvm_system_nanos)/delta_nanos);

_active_processor_count = active_processor_count;
_total_cpu_nanos = total_cpu_nanos;
_jvm_user_nanos = jvm_user_nanos;
_jvm_system_nanos = jvm_system_nanos;
_jvm_real = jvm_real;
_jvm_user = jvm_user;
_jvm_system = jvm_system;

return result;
#else
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/os/posix/os_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,6 @@ int os::connect(int fd, struct sockaddr* him, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}

struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}

void os::exit(int num) {
::exit(num);
}
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5808,10 +5808,6 @@ static jint initSock() {
return JNI_OK;
}

struct hostent* os::get_host_by_name(char* name) {
return (struct hostent*)gethostbyname(name);
}

int os::socket_close(int fd) {
return ::closesocket(fd);
}
Expand Down
16 changes: 0 additions & 16 deletions src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,6 @@ void PSAdaptiveSizePolicy::major_collection_end(size_t amount_live,
_major_timer.start();
}

// If the remaining free space in the old generation is less that
// that expected to be needed by the next collection, do a full
// collection now.
bool PSAdaptiveSizePolicy::should_full_GC(size_t old_free_in_bytes) {

// A similar test is done in the scavenge's should_attempt_scavenge(). If
// this is changed, decide if that test should also be changed.
bool result = padded_average_promoted_in_bytes() > (float) old_free_in_bytes;
log_trace(gc, ergo)("%s after scavenge average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT,
result ? "Full" : "No full",
(size_t) average_promoted_in_bytes(),
(size_t) padded_average_promoted_in_bytes(),
old_free_in_bytes);
return result;
}

void PSAdaptiveSizePolicy::clear_generation_free_space_flags() {

AdaptiveSizePolicy::clear_generation_free_space_flags();
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
}
float major_collection_slope() { return _major_collection_estimator->slope();}

// Given the amount of live data in the heap, should we
// perform a Full GC?
bool should_full_GC(size_t live_in_old_gen);

// Calculates optimal (free) space sizes for both the young and old
// generations. Stores results in _eden_size and _promo_size.
// Takes current used space in all generations as input, as well
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/share/gc/parallel/psScavenge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ bool PSScavenge::invoke() {
IsGCActiveMark mark;

const bool scavenge_done = PSScavenge::invoke_no_policy();
const bool need_full_gc = !scavenge_done ||
policy->should_full_GC(heap->old_gen()->free_in_bytes());
const bool need_full_gc = !scavenge_done;
bool full_gc_done = false;

if (UsePerfData) {
Expand Down Expand Up @@ -739,8 +738,6 @@ bool PSScavenge::should_attempt_scavenge() {
// Test to see if the scavenge will likely fail.
PSAdaptiveSizePolicy* policy = heap->size_policy();

// A similar test is done in the policy's should_full_GC(). If this is
// changed, decide if that test should also be changed.
size_t avg_promoted = (size_t) policy->padded_average_promoted_in_bytes();
size_t promotion_estimate = MIN2(avg_promoted, young_gen->used_in_bytes());
bool result = promotion_estimate < old_gen->free_in_bytes();
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
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ static void do_previous_epoch_artifact(JfrArtifactClosure* callback, T* value) {
assert(value != NULL, "invariant");
if (USED_PREVIOUS_EPOCH(value)) {
callback->do_artifact(value);
assert(IS_NOT_SERIALIZED(value), "invariant");
return;
}
if (IS_SERIALIZED(value)) {
CLEAR_SERIALIZED(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 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 @@ -109,7 +109,14 @@ inline traceid JfrTraceIdLoadBarrier::load(const PackageEntry* package) {

inline traceid JfrTraceIdLoadBarrier::load(const ClassLoaderData* cld) {
assert(cld != NULL, "invariant");
return cld->has_class_mirror_holder() ? 0 : set_used_and_get(cld);
if (cld->has_class_mirror_holder()) {
return 0;
}
const Klass* const class_loader_klass = cld->class_loader_klass();
if (class_loader_klass != nullptr && should_tag(class_loader_klass)) {
load_barrier(class_loader_klass);
}
return set_used_and_get(cld);
}

inline traceid JfrTraceIdLoadBarrier::load_leakp(const Klass* klass, const Method* method) {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/runtime/os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ class os: AllStatic {
static int send(int fd, char* buf, size_t nBytes, uint flags);
static int raw_send(int fd, char* buf, size_t nBytes, uint flags);
static int connect(int fd, struct sockaddr* him, socklen_t len);
static struct hostent* get_host_by_name(char* name);

// Support for signals (see JVM_RaiseSignal, JVM_RegisterSignal)
static void initialize_jdk_signal_support(TRAPS);
Expand Down
13 changes: 10 additions & 3 deletions src/hotspot/share/runtime/reflection.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 @@ -728,8 +728,15 @@ static objArrayHandle get_parameter_types(const methodHandle& method,
int parameter_count,
oop* return_type,
TRAPS) {
// Allocate array holding parameter types (java.lang.Class instances)
objArrayOop m = oopFactory::new_objArray(vmClasses::Class_klass(), parameter_count, CHECK_(objArrayHandle()));
objArrayOop m;
if (parameter_count == 0) {
// Avoid allocating an array for the empty case
// Still need to parse the signature for the return type below
m = Universe::the_empty_class_array();
} else {
// Allocate array holding parameter types (java.lang.Class instances)
m = oopFactory::new_objArray(vmClasses::Class_klass(), parameter_count, CHECK_(objArrayHandle()));
}
objArrayHandle mirrors(THREAD, m);
int index = 0;
// Collect parameter types
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/services/mallocTracker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ class MallocMemorySnapshot : public ResourceObj {
// Total malloc'd memory used by arenas
size_t total_arena() const;

inline size_t thread_count() const {
MallocMemorySnapshot* s = const_cast<MallocMemorySnapshot*>(this);
return s->by_type(mtThreadStack)->malloc_count();
}

void copy_to(MallocMemorySnapshot* s) {
// Need to make sure that mtChunks don't get deallocated while the
// copy is going on, because their size is adjusted using this
Expand Down
12 changes: 4 additions & 8 deletions src/hotspot/share/services/memBaseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,10 @@ class VirtualMemoryAllocationWalker : public VirtualMemoryWalker {
};


bool MemBaseline::baseline_summary() {
void MemBaseline::baseline_summary() {
MallocMemorySummary::snapshot(&_malloc_memory_snapshot);
VirtualMemorySummary::snapshot(&_virtual_memory_snapshot);
_metaspace_stats = MetaspaceUtils::get_combined_statistics();
return true;
}

bool MemBaseline::baseline_allocation_sites() {
Expand Down Expand Up @@ -186,15 +185,13 @@ bool MemBaseline::baseline_allocation_sites() {
return true;
}

bool MemBaseline::baseline(bool summaryOnly) {
void MemBaseline::baseline(bool summaryOnly) {
reset();

_instance_class_count = ClassLoaderDataGraph::num_instance_classes();
_array_class_count = ClassLoaderDataGraph::num_array_classes();

if (!baseline_summary()) {
return false;
}
_thread_count = ThreadStackTracker::thread_count();
baseline_summary();

_baseline_type = Summary_baselined;

Expand All @@ -205,7 +202,6 @@ bool MemBaseline::baseline(bool summaryOnly) {
_baseline_type = Detail_baselined;
}

return true;
}

int compare_allocation_site(const VirtualMemoryAllocationSite& s1,
Expand Down
Loading

0 comments on commit ce92b16

Please sign in to comment.