Skip to content

Commit 78452d8

Browse files
authored
Merge branch 'openjdk:master' into backport-sendaoYan-58e75815-master
2 parents c147177 + 50537ae commit 78452d8

File tree

303 files changed

+14244
-3785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+14244
-3785
lines changed

doc/building.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler
539539
<tbody>
540540
<tr class="odd">
541541
<td>Linux</td>
542-
<td>gcc 11.2.0</td>
542+
<td>gcc 13.2.0</td>
543543
</tr>
544544
<tr class="even">
545545
<td>macOS</td>
@@ -560,7 +560,7 @@ <h3 id="gcc">gcc</h3>
560560
generate a warning by <code>configure</code> and are unlikely to
561561
work.</p>
562562
<p>The JDK is currently known to be able to compile with at least
563-
version 11.2 of gcc.</p>
563+
version 13.2 of gcc.</p>
564564
<p>In general, any version between these two should be usable.</p>
565565
<h3 id="clang">clang</h3>
566566
<p>The minimum accepted version of clang is 3.5. Older versions will not

doc/building.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ issues.
336336

337337
| Operating system | Toolchain version |
338338
| ------------------ | ------------------------------------------ |
339-
| Linux | gcc 11.2.0 |
339+
| Linux | gcc 13.2.0 |
340340
| macOS | Apple Xcode 10.1 (using clang 10.0.0) |
341341
| Windows | Microsoft Visual Studio 2022 update 17.1.0 |
342342

@@ -350,7 +350,7 @@ features that it does support.
350350
The minimum accepted version of gcc is 5.0. Older versions will generate a warning
351351
by `configure` and are unlikely to work.
352352

353-
The JDK is currently known to be able to compile with at least version 11.2 of
353+
The JDK is currently known to be able to compile with at least version 13.2 of
354354
gcc.
355355

356356
In general, any version between these two should be usable.

make/autoconf/configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER
223223
# LeakSanitizer
224224
JDKOPT_SETUP_LEAK_SANITIZER
225225

226+
# Setup static analyzer
227+
JDKOPT_SETUP_STATIC_ANALYZER
228+
226229
# Fallback linker
227230
# This needs to go before 'LIB_DETERMINE_DEPENDENCIES'
228231
JDKOPT_SETUP_FALLBACK_LINKER

make/autoconf/jdk-options.m4

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,31 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
462462

463463
###############################################################################
464464
#
465+
# Static analyzer
466+
#
467+
AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_ANALYZER],
468+
[
469+
UTIL_ARG_ENABLE(NAME: static-analyzer, DEFAULT: false, RESULT: STATIC_ANALYZER_ENABLED,
470+
DESC: [enable the GCC static analyzer],
471+
CHECK_AVAILABLE: [
472+
AC_MSG_CHECKING([if static analyzer is available])
473+
if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
474+
AC_MSG_RESULT([yes])
475+
else
476+
AC_MSG_RESULT([no])
477+
AVAILABLE=false
478+
fi
479+
],
480+
IF_ENABLED: [
481+
STATIC_ANALYZER_CFLAGS="-fanalyzer -Wno-analyzer-fd-leak"
482+
CFLAGS_JDKLIB="$CFLAGS_JDKLIB $STATIC_ANALYZER_CFLAGS"
483+
CFLAGS_JDKEXE="$CFLAGS_JDKEXE $STATIC_ANALYZER_CFLAGS"
484+
])
485+
AC_SUBST(STATIC_ANALYZER_ENABLED)
486+
])
487+
488+
################################################################################
489+
#
465490
# LeakSanitizer
466491
#
467492
AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],

make/conf/jib-profiles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,10 +1080,10 @@ var getJibProfilesProfiles = function (input, common, data) {
10801080
var getJibProfilesDependencies = function (input, common) {
10811081

10821082
var devkit_platform_revisions = {
1083-
linux_x64: "gcc11.2.0-OL6.4+1.0",
1083+
linux_x64: "gcc13.2.0-OL6.4+1.0",
10841084
macosx: "Xcode12.4+1.1",
10851085
windows_x64: "VS2022-17.1.0+1.1",
1086-
linux_aarch64: input.build_cpu == "x64" ? "gcc11.2.0-OL7.6+1.1" : "gcc11.2.0-OL7.6+1.0",
1086+
linux_aarch64: "gcc13.2.0-OL7.6+1.0",
10871087
linux_arm: "gcc8.2.0-Fedora27+1.0",
10881088
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
10891089
linux_s390x: "gcc8.2.0-Fedora27+1.0",

make/devkit/Tools.gmk

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ KERNEL_HEADERS_RPM := kernel-headers
5555

5656
ifeq ($(BASE_OS), OL)
5757
ifeq ($(ARCH), aarch64)
58-
BASE_URL := http://yum.oracle.com/repo/OracleLinux/OL7/6/base/$(ARCH)/
58+
BASE_URL := https://yum.oracle.com/repo/OracleLinux/OL7/6/base/$(ARCH)/
5959
LINUX_VERSION := OL7.6
6060
KERNEL_HEADERS_RPM := kernel-uek-headers
6161
else
62-
BASE_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
62+
BASE_URL := https://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
6363
LINUX_VERSION := OL6.4
6464
endif
6565
else ifeq ($(BASE_OS), Fedora)
@@ -96,8 +96,17 @@ endif
9696
# Define external dependencies
9797

9898
# Latest that could be made to work.
99-
GCC_VER := 11.3.0
100-
ifeq ($(GCC_VER), 11.3.0)
99+
GCC_VER := 13.2.0
100+
ifeq ($(GCC_VER), 13.2.0)
101+
gcc_ver := gcc-13.2.0
102+
binutils_ver := binutils-2.41
103+
ccache_ver := ccache-3.7.12
104+
mpfr_ver := mpfr-4.2.0
105+
gmp_ver := gmp-6.3.0
106+
mpc_ver := mpc-1.3.1
107+
gdb_ver := gdb-13.2
108+
REQUIRED_MIN_MAKE_MAJOR_VERSION := 4
109+
else ifeq ($(GCC_VER), 11.3.0)
101110
gcc_ver := gcc-11.3.0
102111
binutils_ver := binutils-2.39
103112
ccache_ver := ccache-3.7.12
@@ -671,7 +680,11 @@ $(PREFIX)/Tools.gmk: ./Tools.gmk
671680
rm -rf $@
672681
cp $< $@
673682

674-
THESE_MAKEFILES := $(PREFIX)/Makefile $(PREFIX)/Tools.gmk
683+
$(PREFIX)/Tars.gmk: ./Tars.gmk
684+
rm -rf $@
685+
cp $< $@
686+
687+
THESE_MAKEFILES := $(PREFIX)/Makefile $(PREFIX)/Tools.gmk $(PREFIX)/Tars.gmk
675688

676689
##########################################################################################
677690

src/hotspot/os/linux/cgroupUtil_linux.cpp

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Red Hat, Inc.
2+
* Copyright (c) 2024, 2025, Red Hat, Inc.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -49,20 +49,27 @@ int CgroupUtil::processor_count(CgroupCpuController* cpu_ctrl, int host_cpus) {
4949
}
5050

5151
void CgroupUtil::adjust_controller(CgroupMemoryController* mem) {
52+
assert(mem->cgroup_path() != nullptr, "invariant");
53+
if (strstr(mem->cgroup_path(), "../") != nullptr) {
54+
log_warning(os, container)("Cgroup memory controller path at '%s' seems to have moved to '%s', detected limits won't be accurate",
55+
mem->mount_point(), mem->cgroup_path());
56+
mem->set_subsystem_path("/");
57+
return;
58+
}
5259
if (!mem->needs_hierarchy_adjustment()) {
5360
// nothing to do
5461
return;
5562
}
5663
log_trace(os, container)("Adjusting controller path for memory: %s", mem->subsystem_path());
57-
assert(mem->cgroup_path() != nullptr, "invariant");
5864
char* orig = os::strdup(mem->cgroup_path());
5965
char* cg_path = os::strdup(orig);
6066
char* last_slash;
6167
assert(cg_path[0] == '/', "cgroup path must start with '/'");
6268
julong phys_mem = os::Linux::physical_memory();
6369
char* limit_cg_path = nullptr;
6470
jlong limit = mem->read_memory_limit_in_bytes(phys_mem);
65-
jlong lowest_limit = phys_mem;
71+
jlong lowest_limit = limit < 0 ? phys_mem : limit;
72+
julong orig_limit = ((julong)lowest_limit) != phys_mem ? lowest_limit : phys_mem;
6673
while ((last_slash = strrchr(cg_path, '/')) != cg_path) {
6774
*last_slash = '\0'; // strip path
6875
// update to shortened path and try again
@@ -83,7 +90,7 @@ void CgroupUtil::adjust_controller(CgroupMemoryController* mem) {
8390
limit_cg_path = os::strdup("/");
8491
}
8592
assert(lowest_limit >= 0, "limit must be positive");
86-
if ((julong)lowest_limit != phys_mem) {
93+
if ((julong)lowest_limit != orig_limit) {
8794
// we've found a lower limit anywhere in the hierarchy,
8895
// set the path to the limit path
8996
assert(limit_cg_path != nullptr, "limit path must be set");
@@ -93,6 +100,7 @@ void CgroupUtil::adjust_controller(CgroupMemoryController* mem) {
93100
mem->subsystem_path(),
94101
lowest_limit);
95102
} else {
103+
log_trace(os, container)("Lowest limit was: " JLONG_FORMAT, lowest_limit);
96104
log_trace(os, container)("No lower limit found for memory in hierarchy %s, "
97105
"adjusting to original path %s",
98106
mem->mount_point(), orig);
@@ -104,19 +112,26 @@ void CgroupUtil::adjust_controller(CgroupMemoryController* mem) {
104112
}
105113

106114
void CgroupUtil::adjust_controller(CgroupCpuController* cpu) {
115+
assert(cpu->cgroup_path() != nullptr, "invariant");
116+
if (strstr(cpu->cgroup_path(), "../") != nullptr) {
117+
log_warning(os, container)("Cgroup cpu controller path at '%s' seems to have moved to '%s', detected limits won't be accurate",
118+
cpu->mount_point(), cpu->cgroup_path());
119+
cpu->set_subsystem_path("/");
120+
return;
121+
}
107122
if (!cpu->needs_hierarchy_adjustment()) {
108123
// nothing to do
109124
return;
110125
}
111126
log_trace(os, container)("Adjusting controller path for cpu: %s", cpu->subsystem_path());
112-
assert(cpu->cgroup_path() != nullptr, "invariant");
113127
char* orig = os::strdup(cpu->cgroup_path());
114128
char* cg_path = os::strdup(orig);
115129
char* last_slash;
116130
assert(cg_path[0] == '/', "cgroup path must start with '/'");
117131
int host_cpus = os::Linux::active_processor_count();
118132
int cpus = CgroupUtil::processor_count(cpu, host_cpus);
119-
int lowest_limit = host_cpus;
133+
int lowest_limit = cpus < host_cpus ? cpus: host_cpus;
134+
int orig_limit = lowest_limit != host_cpus ? lowest_limit : host_cpus;
120135
char* limit_cg_path = nullptr;
121136
while ((last_slash = strrchr(cg_path, '/')) != cg_path) {
122137
*last_slash = '\0'; // strip path
@@ -138,7 +153,7 @@ void CgroupUtil::adjust_controller(CgroupCpuController* cpu) {
138153
limit_cg_path = os::strdup(cg_path);
139154
}
140155
assert(lowest_limit >= 0, "limit must be positive");
141-
if (lowest_limit != host_cpus) {
156+
if (lowest_limit != orig_limit) {
142157
// we've found a lower limit anywhere in the hierarchy,
143158
// set the path to the limit path
144159
assert(limit_cg_path != nullptr, "limit path must be set");
@@ -148,6 +163,7 @@ void CgroupUtil::adjust_controller(CgroupCpuController* cpu) {
148163
cpu->subsystem_path(),
149164
lowest_limit);
150165
} else {
166+
log_trace(os, container)("Lowest limit was: %d", lowest_limit);
151167
log_trace(os, container)("No lower limit found for cpu in hierarchy %s, "
152168
"adjusting to original path %s",
153169
cpu->mount_point(), orig);

src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,47 @@
3737
/*
3838
* Set directory to subsystem specific files based
3939
* on the contents of the mountinfo and cgroup files.
40+
*
41+
* The method determines whether it runs in
42+
* - host mode
43+
* - container mode
44+
*
45+
* In the host mode, _root is equal to "/" and
46+
* the subsystem path is equal to the _mount_point path
47+
* joined with cgroup_path.
48+
*
49+
* In the container mode, it can be two possibilities:
50+
* - private namespace (cgroupns=private)
51+
* - host namespace (cgroupns=host, default mode in cgroup V1 hosts)
52+
*
53+
* Private namespace is equivalent to the host mode, i.e.
54+
* the subsystem path is set by concatenating
55+
* _mount_point and cgroup_path.
56+
*
57+
* In the host namespace, _root is equal to host's cgroup path
58+
* of the control group to which the containerized process
59+
* belongs to at the moment of creation. The mountinfo and
60+
* cgroup files are mirrored from the host, while the subsystem
61+
* specific files are mapped directly at _mount_point, i.e.
62+
* at /sys/fs/cgroup/<controller>/, the subsystem path is
63+
* then set equal to _mount_point.
64+
*
65+
* A special case of the subsystem path is when a cgroup path
66+
* includes a subgroup, when a containerized process was associated
67+
* with an existing cgroup, that is different from cgroup
68+
* in which the process has been created.
69+
* Here, the _root is equal to the host's initial cgroup path,
70+
* cgroup_path will be equal to host's new cgroup path.
71+
* As host cgroup hierarchies are not accessible in the container,
72+
* it needs to be determined which part of cgroup path
73+
* is accessible inside container, i.e. mapped under
74+
* /sys/fs/cgroup/<controller>/<subgroup>.
75+
* In Docker default setup, host's cgroup path can be
76+
* of the form: /docker/<CONTAINER_ID>/<subgroup>,
77+
* from which only <subgroup> is mapped.
78+
* The method trims cgroup path from left, until the subgroup
79+
* component is found. The subsystem path will be set to
80+
* the _mount_point joined with the subgroup path.
4081
*/
4182
void CgroupV1Controller::set_subsystem_path(const char* cgroup_path) {
4283
if (_cgroup_path != nullptr) {
@@ -49,28 +90,36 @@ void CgroupV1Controller::set_subsystem_path(const char* cgroup_path) {
4990
_cgroup_path = os::strdup(cgroup_path);
5091
stringStream ss;
5192
if (_root != nullptr && cgroup_path != nullptr) {
93+
ss.print_raw(_mount_point);
5294
if (strcmp(_root, "/") == 0) {
53-
ss.print_raw(_mount_point);
95+
// host processes and containers with cgroupns=private
5496
if (strcmp(cgroup_path,"/") != 0) {
5597
ss.print_raw(cgroup_path);
5698
}
57-
_path = os::strdup(ss.base());
5899
} else {
59-
if (strcmp(_root, cgroup_path) == 0) {
60-
ss.print_raw(_mount_point);
61-
_path = os::strdup(ss.base());
62-
} else {
63-
char *p = strstr((char*)cgroup_path, _root);
64-
if (p != nullptr && p == _root) {
65-
if (strlen(cgroup_path) > strlen(_root)) {
66-
ss.print_raw(_mount_point);
67-
const char* cg_path_sub = cgroup_path + strlen(_root);
68-
ss.print_raw(cg_path_sub);
69-
_path = os::strdup(ss.base());
100+
// containers with cgroupns=host, default setting is _root==cgroup_path
101+
if (strcmp(_root, cgroup_path) != 0) {
102+
if (*cgroup_path != '\0' && strcmp(cgroup_path, "/") != 0) {
103+
// When moved to a subgroup, between subgroups, the path suffix will change.
104+
const char *suffix = cgroup_path;
105+
while (suffix != nullptr) {
106+
stringStream pp;
107+
pp.print_raw(_mount_point);
108+
pp.print_raw(suffix);
109+
if (os::file_exists(pp.base())) {
110+
ss.print_raw(suffix);
111+
if (suffix != cgroup_path) {
112+
log_trace(os, container)("set_subsystem_path: cgroup v1 path reduced to: %s.", suffix);
113+
}
114+
break;
115+
}
116+
log_trace(os, container)("set_subsystem_path: skipped non-existent directory: %s.", suffix);
117+
suffix = strchr(suffix + 1, '/');
70118
}
71119
}
72120
}
73121
}
122+
_path = os::strdup(ss.base());
74123
}
75124
}
76125

src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022, Red Hat Inc.
2+
* Copyright (c) 2020, 2025, Red Hat Inc.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -283,6 +283,10 @@ jlong memory_swap_limit_value(CgroupV2Controller* ctrl) {
283283
}
284284

285285
void CgroupV2Controller::set_subsystem_path(const char* cgroup_path) {
286+
if (_cgroup_path != nullptr) {
287+
os::free(_cgroup_path);
288+
}
289+
_cgroup_path = os::strdup(cgroup_path);
286290
if (_path != nullptr) {
287291
os::free(_path);
288292
}

src/hotspot/share/c1/c1_Canonicalizer.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,6 @@ class Canonicalizer: InstructionVisitor {
4040
void set_constant(jlong x) { set_canonical(new Constant(new LongConstant(x))); }
4141
void set_constant(jfloat x) { set_canonical(new Constant(new FloatConstant(x))); }
4242
void set_constant(jdouble x) { set_canonical(new Constant(new DoubleConstant(x))); }
43-
#ifdef _WINDOWS
44-
// jint is defined as long in jni_md.h, so convert from int to jint
45-
void set_constant(int x) { set_constant((jint)x); }
46-
#endif
4743
void move_const_to_right(Op2* x);
4844
void do_Op2(Op2* x);
4945

0 commit comments

Comments
 (0)